[
  {
    "path": ".gitignore",
    "content": "#PyCharm configuration\n.idea/\n\n# Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n*$py.class\n\n# C extensions\n*.so\n\n# Distribution / packaging\n.Python\nbuild/\ndevelop-eggs/\ndist/\ndownloads/\neggs/\n.eggs/\nlib/\nlib64/\nparts/\nsdist/\nvar/\nwheels/\n*.egg-info/\n.installed.cfg\n*.egg\nMANIFEST\n\n# Installer logs\npip-log.txt\npip-delete-this-directory.txt\n\n# Unit test / coverage reports\nhtmlcov/\n.tox/\n.coverage\n.coverage.*\n.cache\nnosetests.xml\ncoverage.xml\n*.cover\n.hypothesis/\n.pytest_cache/\n\n# Translations\n*.mo\n*.pot\n\n# Django stuff:\n*.log\nlocal_settings.py\ndb.sqlite3\n\n# Flask stuff:\ninstance/\n.webassets-cache\n\n# Scrapy stuff:\n.scrapy\n\n# Sphinx documentation\ndocs/_build/\n\n# PyBuilder\ntarget/\n\n# Jupyter Notebook\n.ipynb_checkpoints\n\n# pyenv\n.python-version\n\n# celery beat schedule file\ncelerybeat-schedule\n\n# SageMath parsed files\n*.sage.py\n\n# Environments\n.env\n.venv\nenv/\nvenv/\nENV/\nenv.bak/\nvenv.bak/\n\n# Spyder project settings\n.spyderproject\n.spyproject\n\n# Rope project settings\n.ropeproject\n\n# mkdocs documentation\n/site\n\n# mypy\n.mypy_cache/\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    <program>  Copyright (C) <year>  <name of author>\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<http://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<http://www.gnu.org/philosophy/why-not-lgpl.html>.\n"
  },
  {
    "path": "README.md",
    "content": "# ButterManager\n\n## Summary\nButterManager is a BTRFS tool for managing snapshots, balancing filesystems and upgrading the system safetly.\n\n## Version\n2.5.2\n\n## Wiki\nYou can find documentation and more info in the [wiki of the project](https://github.com/egara/buttermanager/wiki)\n\n## Caveats\n- For using ButterManager, it is important to have a **good BTRFS structure in your filesystem**. If you want some tips and more information, you can [read\nthis](https://github.com/egara/arch-btrfs-installation).\n\n- ButterManager works with **Debian**, **Ubuntu / derivatives (Linux Mint, KDE Neon, ElementaryOS, Zorin, Deepin...)**, **OpenSUSE / SUSE**, **RHEL / Fedora** and **Arch Linux** so far.\n\n## Main Functionalities\n\n### Managing snapshots\nYou will be able to define all the subvolumes you want to create snapshots and the path for their storage. Then, using ButterManager you will create and delete snapshots of those subvolumes at your will.\n\n### Integration with GRUB\nButterManager is integrated with [grub-btrfs](https://github.com/Antynea/grub-btrfs) and you will be able to boot your system from any snapshot directly from the GRUB menu.\n\n### Balancing BTRFS filesystems\nAs new snapshots are created in the system, the free space of the filesystem decreases and it is necessary to perform a system balancing regularly. With ButterManager you can perform these balances at any time and visualize the real space that is occupied.\n\n### Upgrading the system\nYou will be able to upgrade your system and create new snapshots automatically when this operation is performed. Doing so, if something goes wrong, you will have a snapshot before the upgrade you can use to go back. You will be able to set the maximum number of snapshots in your system and ButterManager will maintain this number with every upgrade.\n\n### Saving the logs\nEverytime your system is upgraded using ButterManager, you could save the log indepently. This way, you would be able to see the packages that have been updated in every snapshot if you wish.\n\n## Installation\nYou can install ButterManager in different ways.\n\n### From the source code\nIn order to install ButterManager manually, you have to install these packages (all the packages described below are for **Arch Linux**. Please, take into account that maybe the name is different in your distribution and you have to install them for python3 version):\n\n- Python 3\n- **python-setuptool** (f.i. the name of the package in Ubuntu is **python3-setuptools**).\n- **python-virtualenv** (f.i. the name of the package in Ubuntu is **python3-venv**). This package will only be needed if you use **venv_install.sh** script (see below).\n- **grub-btrfs**. Please, go to its GitHub repository [https://github.com/Antynea/grub-btrfs](https://github.com/Antynea/grub-btrfs) and follow the instructions to install it if the package is not in the official repository of your distribution.\n- **libxinerama**: This depency has been reported by some users (thanks Adam!) who install ButterManager on Ubuntu 20.04 (proper) (the name of the package in Ubuntu is **libxcb-xinerama0**)\n- **tk** (f.i. the name of the package in Ubuntu is **python3-tk**)\n\nOnce you meet all the requirements, follow these steps:\n\n1. Clone the repository (install **git** if it is needed first)\n\n  ```\n    git clone https://github.com/egara/buttermanager.git\n\n  ```\n\n1. Install ButterManager using one of the following installation scripts:\n\t1. **Native Installation**: This is the preferred method. It is slimmer because no virtual environment is created in order to execute ButterManager. This installation method will install the dependencies needed in your system natively and create an executable script for running the application. You will be able to execute ButterManager from the terminal typing **buttermanager** or directly via a shortcut created. In order to install ButterManager just open a terminal and execute:\n\n    ```\n      cd buttermanager\n      cd install\n      ./native_install.sh\n\n    ```\n\n\t1. **Venv Installation**: If the first method doesn't run ButterManager properly, please try this second one. The installation process will create a virtual environment with all the dependencies needed and a desktop launcher to run ButterManager directly. In order to install ButterManager just open a terminal and type:\n\n    ```\n      cd buttermanager\n      cd install\n      ./venv_install.sh\n    ```\n\n1. If you want to uninstall ButterManager:\n\n  ```\n    cd buttermanager\n    cd install\n    ./uninstall.sh\n  ```\n\n### From AUR\nIf you are an Arch Linux user or your distribution is a derivative (Manjaro, EndevourOS...), ButterManager is in AUR. Depending on your package manager for AUR, type:\n\n    yaourt -S buttermanager\n\nOr\n\n    trizen -S buttermanager\n\nOr\n\n    yay -S buttermanager\n\nThose are only examples. Use the package manager you have installed for AUR. Once ButterManager is installed, you will be able to run it using the icon created in the main menu.\n\n### From Nix\nButterManager is packaged in Nix [and included in the official repo](https://search.nixos.org/packages?channel=24.05&from=0&size=50&sort=relevance&type=packages&query=buttermanager)\n\n### From RPM\nButterManager is packaged in Fedora but it is outdated. [This is the official package](https://packages.fedoraproject.org/pkgs/buttermanager/buttermanager/)\n\n## Changelog\n\n### Version 2.5.2\n- Issue #56. Cancel button has been re-implemented within the consolidation window and now it closes this window when it is clicked.\n- All ButterManager windows have been renamed to ButterManager. New labels in some windows have been added.\n\n### Version 2.5.1\n- Issue #52. A bug that prevented ButterManager to start normally (reported by Fedora users) has been fixed.\n- ButterManager main window title is now displayed.\n- Some missing buttons and different elements from tabs have been included within enable and disable buttons methods.\n\n### Version 2.5.0\n- Flatpak support implemented.\n- Windows layout reimplemented. All windows are resizeable now.\n- Font size customization implemented.\n- Issue #29 fixed. Now, mobile users should be able to rescale the application to fit their displays.\n\n### Version 2.4.3\n- Issue #31 fixed. Preventing errors when calculating diffs against root directly.\n- Issue #33 fixed. Refreshing filesystem statistics when user changes filesystem within combobox.\n- Issue #45 fixed. Changing yaml.load method to yaml.safe_load because pyyaml library requires it since version 5.4.\n\n### Version 2.4.2\n- Minor changes in order to improve the package and preparing all to publish ButterManager in Fedora. Thanks Michel Alexandre Salim!\n\n### Version 2.4.1\n- Issue #32 fixed. ButterManager crashed when it was installed for the first time.\n\n### Version 2.4\n- Delete log icon button fixed.\n- Issue #28 fixed. There is an error for Plasma Desktop (and PyQT5) when the file explorer is opened and the user tries to select a directory when setting subvolumes up. Only for this case, TK will be used as workaround.\n- 'Don't remove snapshots' and 'Snapshots to keep' parameters are not global anymore. The user will be able to configure them per subvolume.\n- Now, when user deletes a specific snapshot, the log related to it will be removed too if it exists.\n\n### Version 2.3\n- Thanks to Fedora guys (Neal Gompa @Conan-Kudo and Michel Alexandre Salim @michel-slm) ButterManager has been restructured in order to be packaged for Fedora. Because of that, now the application won't need to be installed within a virtual environment so the package installation footprint will be very much smaller.\n- Two new installation methods have been created for users who wants to install ButterManager from source code: [native and venv](https://github.com/egara/buttermanager/tree/master/install). The first one is the recommended but the second one is still supported just in case native installation doesn't work properly.\n- Issue #26 fixed: Now, the **Upgrade with snapshots** button creates snapshots and removes the old ones if needed.\n- All the fast action buttons are disabled when a critical operation is executing.\n\n### Version 2.2\n- More stability. Some bugs have been fixed and ButterManager should not crashed after upgrading the system.\n- Other operations are now Fast actions.\n- New fast actions implemented: Upgrade system with/without snapshots and Take snapshots.\n\n### Version 2.1\n- Delete icon has been redesigned.\n- New button to open a file explorer within a specific snapshot has been implemented.\n- New feature to calculate differences between current snapshot and a specified one has been implemented.\n- User will be able to calculate full differences (it will take some time to complete) included files modified and files only present in one of the snapshots.\n- User will be able to calculate partial differences that will be faster but it will only inlcude files modified.\n\n### Version 2.0\n- Now, the installer creates ~/.local/share/applications directory if it didn't exist in order to allocate the ButterManager desktop launcher.\n- The method of calculating the default original subvolume to consolidate the system has been reimplemented and improved to avoid some bugs detected.\n- Now, the allocation of the original snapshot is stored in fstab instead of  the mounted point for every snapshot of root created.\n- grub-mkconfig will run after consolidating deafult root subvolume\n- Consolidation process will check the original path of the default subvolume for root and will use it in fstab.\n\n### Version 1.9\n- Buttermanager has been integrated with **grub-btrfs** package. It means that, for all these users who use GRUB will be able to boot its system from any snapshot created with this version of the application and above. This integration will be optional and configurable from **Settings** tab.\n\n### Version 1.8 ###\n- Font autoscaling implemented in order to let the GUI adapts to the current screen resolution.\n- It has been created a new tab for **Documentation** and a **Wiki** at Github repository.\n- The text of some tooltips have been fixed.\n\n### Version 1.7 ###\n- Bug fixed for Arch Linux and derivatives installing the package from AUR. Now, the application will be installed and run from a virtual environmen with all the modules needed. This causes that the size of the package buttermanager has increased\n\n### Version 1.6 ###\n- Logs generated during the upgrade process can be stored\n- Logs management implemented\n- Version checker implemented. When a new version of ButterManagger is released, a new info window will be display to warn the user\n\n### Version 1.5 ###\n- Labels refreshing after balancing the filesystem has been fixed\n- Values to show certaing labels have been recalculated\n\n### Version 1.4 ###\n- System progress bar has been removed because it doesn't provide any relevant information\n- A new button has been implemented in order to upgrade the system whithout managing snapshots\n- All the ButterManager windows and dialogs have been reconfigured using fixed pixels in order to avoid the resizing\n- The ButterManager icon has been assigned to all windows and dialogs\n- When ButterManager is installed for the first time, the updates checker is not checked by default\n- A new option added to yay command to check for AUR packages only\n- New messages implemented in the main window in order to warn the user about the space of the filesystem\n- Internet connection will be checked during 5 minutes. If there is no Internet connection, then the updates checker process will be cancelled\n\n### Version 1.3 ###\n- The updates checker is executed in other thread, so now the GUI is not freezed during the process.\n\n### Version 1.2 ###\n- Some layouts and texts fixed to fit properly\n- New window to list the packages to be updated implemented\n- Fixed a problem in the snap package for Wayland environments\n\n### Version 1.1 ###\n\n- RHEL / Fedora, OpenSUSE / SUSE support added.\n- New window implemented for displaying serious problems related to the proper functioning of ButterManager.\n\n### Version 1.0 ###\n\n- Initial release.\n- It supports Arch Linux, Debian, Ubuntu and derivatives.\n- Safely system upgrade.\n- BTRFS filesystems detection and visualization.\n- Snapshots management.\n- BTRFS filesystems balancing.\n- Application packaged in AUR.\n- Ubuntu Snap Package implemented for universal use in the rest of Linux distributions.\n\n## Contact ##\nIf you want to contact me, you can do it using this e-mail address <eloy.garcia.pca@gmail.com>.\n"
  },
  {
    "path": "aur/PKGBUILD",
    "content": "# Maintainer: Eloy Garcia Almaden <eloy.garcia.pca@gmail.com>\npkgname=buttermanager\npkgver=2.5.2\npkgrel=0\nepoch=\npkgdesc=\"Graphical tool to create BTRFS snapshots, balance filesystems and upgrade the system safetly\"\narch=('x86_64')\nurl=\"https://github.com/egara/buttermanager\"\nlicense=('GPL')\ngroups=()\ndepends=('btrfs-progs' 'python>=3' 'grub-btrfs' 'python-setuptools' 'python-pyaml' 'python-pyqt5' 'tk')\nmakedepends=('python>=3' 'git')\ncheckdepends=()\noptdepends=()\nprovides=()\nconflicts=()\nreplaces=()\nbackup=()\noptions=()\ninstall=\nchangelog=\n# Local source if user wants to build the package locally once the git repo has been cloned\nsource=('git+file:////home/egarcia/Development/git/buttermanager/')\n# Remote source\n# Master branch\n# source=('git+https://github.com/egara/buttermanager#branch=master')\n# Tagged version\n# source=('https://github.com/egara/buttermanager/archive/\"$pkgver\".tar.gz')\nnoextract=()\nmd5sums=('SKIP')\nvalidpgpkeys=()\n\nbuild() {\n\tcd \"$pkgname\"\n\tpython setup.py build\n}\n\npackage() {\n\tcd \"$pkgname\"\n        # Creating destination directory\n  \tinstall -dm755 \"$pkgdir/opt/$pkgname\"\n\n        # Installing ButterManager using python-setuptools\n\techo -e \"\\n Installing ButterManager. Please wait...\"\n\tpython setup.py install --root=\"$pkgdir\" --optimize=1 --skip-build\n\n  \t# Copying .desktop file and icon\n        echo -e \"\\n Creating desktop icon. Finishing the installation\"\n  \tinstall -Dm644 \"$srcdir/$pkgname/packaging/$pkgname.desktop\" \"$pkgdir/usr/share/applications/$pkgname.desktop\"\n\tinstall -Dm644 \"$srcdir/$pkgname/packaging/$pkgname.svg\" \"$pkgdir/opt/$pkgname/gui/$pkgname.svg\"\n}\n"
  },
  {
    "path": "aur/README.txt",
    "content": "This directory contains all the files needed to package ButterManager application for Arch Linux\n"
  },
  {
    "path": "buttermanager/bm_main.py",
    "content": "from .buttermanager.buttermanager import PasswordWindow\nfrom PyQt5.QtWidgets import QApplication\nimport sys\n\n\ndef main():\n    \"\"\"Main wrapper for starting ButterManager\n    \n    This script is only for packaging purposes. If you are developing ButterManager, then use main.py as initial\n    script. This script will be copied from setup.py using setuptools and it will be invoked from the script\n    created within /usr/bin/buttermanager once the application is installed via sudo python setup.py install\n\n    \"\"\"\n    # Creating application instance\n    application = QApplication(sys.argv)\n    # Creating main window instance\n    PasswordWindow(None)\n    # Launching the application\n    application.exec_()\n\n\nif __name__ == \"__main__\":\n    main()\n"
  },
  {
    "path": "buttermanager/buttermanager/__init__.py",
    "content": "# Copyright 2018-2019 Eloy García Almadén <eloy.garcia.pca@gmail.com>\n#\n# This file is part of buttermanager.\n#\n# This program is free software: you can redistribute it and / or modify it\n# under the terms of the GNU General Public License as published by the\n# Free Software Foundation, version 3 of the License.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\nname = \"buttermanager\"\n"
  },
  {
    "path": "buttermanager/buttermanager/buttermanager.py",
    "content": "# -*- coding: utf-8 -*-\n#\n# Copyright 2018-2019 Eloy García Almadén <eloy.garcia.pca@gmail.com>\n#\n# This file is part of buttermanager.\n#\n# This program is free software: you can redistribute it and / or modify it\n# under the terms of the GNU General Public License as published by the\n# Free Software Foundation, version 3 of the License.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\nfrom .exception import exception\nfrom .filesystem import filesystem, snapshot\nfrom .manager import upgrader\nfrom .util import utils, settings\nfrom .window import windows\nimport os\nimport subprocess\nimport sys\nimport time\nfrom functools import partial\nfrom PyQt5.QtWidgets import QMainWindow, QDesktopWidget\nfrom PyQt5.QtGui import QCursor, QTextCursor, QIcon, QPixmap, QDesktopServices, QFontMetrics\nfrom PyQt5 import uic, QtTest, QtWidgets\nfrom PyQt5.QtCore import Qt, pyqtSignal, QObject, QSize, QUrl\n\n\n# Constants\nSNAP_COMMAND = \"snap\"\nFLATPAK_COMMAND = \"flatpak\"\n\n\nclass EmittingStream(QObject):\n\n    text_written = pyqtSignal(str)\n\n    def write(self, text):\n        self.text_written.emit(str(text))\n\n    def flush(self):\n        pass\n\n\nclass PasswordWindow(QMainWindow):\n    \"\"\"Window to let the user type his/her password.\n\n    Class inherited from QMainWindow (Window constructor)\n    \"\"\"\n    # Constructor\n    def __init__(self, parent):\n        QMainWindow.__init__(self, parent)\n        self.parent = parent\n        # Configuring the application\n        self.__buttermanager_configurator = utils.ConfigManager()\n        self.__buttermanager_configurator.configure()\n        # Locating ui and images directories\n        settings.ui_dir = os.path.join(os.path.dirname(__file__), 'ui')\n        settings.images_dir = os.path.join(os.path.dirname(__file__), 'images')\n\n        # UI elements\n        self.__ui_elements = []\n        # Logger\n        self.__logger = utils.Logger(self.__class__.__name__).get()\n        # Version checker\n        self.__version_checker = utils.VersionChecker(self)\n\n        # Initializing the application\n        self.init_ui()\n\n    def init_ui(self):\n        \"\"\"Initializes the Graphic User Interface.\n\n        \"\"\"\n        # Loading User Interface\n        password_window_ui = os.path.join(settings.ui_dir, 'PasswordWindow.ui')\n        uic.loadUi(password_window_ui, self)\n\n        # Setting the window icon\n        buttermanager_icon = os.path.join(settings.images_dir, 'buttermanager50.png')\n        self.setWindowIcon(QIcon(buttermanager_icon))\n\n        # Calculating the base font size for all UI elements in the application\n        settings.base_font_size = self.get_base_font_size()\n\n        # Adjusting font scale\n        # UI elements\n        self.__ui_elements = [self.label_password, self.button_ok, self.button_cancel, self.button_lock,\n                              self.input_password]\n        utils.scale_fonts(self.__ui_elements)\n        # Tooltips\n        self.setStyleSheet(\" QToolTip{font: \" + str(settings.base_font_size) + \"pt}\")\n\n        # Setting size for the window\n        self.resize(320, 240)\n\n        # Setting lock icon\n        lock_icon = os.path.join(settings.images_dir, 'lock_24px_icon.png')\n        self.button_lock.setIcon(QIcon(lock_icon))\n        self.button_lock.setIconSize(QSize(24, 24))\n\n        # Centering the window\n        qt_rectangle = self.frameGeometry()\n        center_point = QDesktopWidget().availableGeometry().center()\n        qt_rectangle.moveCenter(center_point)\n        self.move(qt_rectangle.topLeft())\n\n        # Events\n        # OK button event\n        self.button_ok.clicked.connect(self.load_main_window)\n\n        # Cancel button event\n        self.button_cancel.clicked.connect(self.exit)\n\n        # Press enter within QLineEdit\n        self.input_password.returnPressed.connect(self.load_main_window)\n\n        # Set focus on input_password\n        self.input_password.setFocusPolicy(Qt.StrongFocus)\n        self.input_password.setFocus()\n\n        # Checks for new versions of ButterManager\n        self.__version_checker.check_version()\n\n        # Showing password window\n        self.show()\n\n    def get_base_font_size(self):\n        \"\"\"Gets the base font size for all the UI elements.\n\n        Returns:\n            int: Base font size.\n\n        \"\"\"\n        self.__logger.info(\"Calculating appropriated base font size for UI elements...\")\n        font_fits = False\n\n        # Base font size will be calculated using self.label_password attribute\n        font = self.label_password.font()\n        font_size = font.pointSize()\n\n        while not font_fits:\n            fm = QFontMetrics(font)\n            pixels_wide = fm.width(self.label_password.text())\n            pixels_high = fm.height()\n\n            bound = fm.boundingRect(0, 0, pixels_wide, pixels_high, Qt.TextWordWrap | Qt.AlignLeft,\n                                    self.label_password.text())\n\n            if bound.width() <= self.label_password.width() and \\\n                    bound.height() <= self.label_password.height():\n                font_fits = True\n            else:\n                font.setPointSize(font.pointSize() - 1)\n                font_size = font_size - 1\n\n        self.__logger.info(\"Base font size = \" + str(font_size))\n        return font_size\n\n    def load_main_window(self):\n        # Storing user's password\n        settings.user_password = self.input_password.text()\n\n        # Exiting password window\n        self.hide()\n\n        # Creating main window\n        # Main window will only be displayed if everything goes right\n        ButtermanagerMainWindow(self)\n\n    def exit(self):\n        # Exits the application\n        self.hide()\n        sys.exit()\n\n\nclass ButtermanagerMainWindow(QMainWindow):\n    \"\"\"Main window.\n\n    Class inherited from QMainWindow (Window constructor)\n    \"\"\"\n    # Constructor\n    def __init__(self, parent):\n        QMainWindow.__init__(self, parent)\n        self.parent = parent\n        # Logger\n        self.__logger = utils.Logger(self.__class__.__name__).get()\n        # Current filesystem (it will be initialize in initialize method)\n        self.__current_filesystem = None\n        # Current filesystem uuid (it will be initialize in initialize method)\n        self.__current_filesystem_uuid = None\n        # Balancer that will balance the current filesystem if it is needed\n        self.__balancer = None\n        # Differentiator that will calculate the differences between a snapshot and the current\n        # subvolume\n        self.__differentiator = None\n        # Upgrader that will upgrade the system if it is needed\n        self.__upgrader = None\n        # Updates checker that will check for updates if it is needed\n        self.__updates_checker = None\n        # Root snapshot checker\n        self.__root_snapshot_checker = snapshot.RootSnapshotChecker(self)\n        # UI elements\n        self.__ui_elements = []\n        # Initializing the application\n        self.init_ui()\n\n        # Installing the custom output stream to write all the console content to the\n        # QTextEdit component\n        sys.stdout = EmittingStream(text_written=self.normal_output_written)\n\n    def __del__(self):\n        \"\"\"Restores sys.stdout.\n\n        \"\"\"\n        sys.stdout = sys.__stdout__\n\n    def normal_output_written(self, text):\n        \"\"\"Appends text to the QTextEdit text_edit_console.\n\n        \"\"\"\n        cursor = self.text_edit_console.textCursor()\n        cursor.movePosition(QTextCursor.End)\n        cursor.insertText(text)\n        self.text_edit_console.setTextCursor(cursor)\n        self.text_edit_console.ensureCursorVisible()\n\n    def init_ui(self):\n        \"\"\"Initializes the Graphic User Interface.\n\n        \"\"\"\n        try:\n            # Loading User Interface\n            main_window_ui = os.path.join(settings.ui_dir, 'MainWindow.ui')\n            uic.loadUi(main_window_ui, self)\n\n            # Setting the window icon\n            buttermanager_icon = os.path.join(settings.images_dir, 'buttermanager50.png')\n            self.setWindowIcon(QIcon(buttermanager_icon))\n\n            # Adjusting font scale\n            # UI elements\n            self.__ui_elements = [self.tab_buttermanager, self.label_filesystem_info, self.label_filesystem_data,\n                                  self.label_filesystem_metadata, self.label_filesystem, self.label_other_operations,\n                                  self.label_filesystem_size, self.label_filesystem_size_value,\n                                  self.label_filesystem_allocated, self.label_filesystem_allocated_value,\n                                  self.label_filesystem_lost_info, self.label_filesystem_info_more, self.label_space_ok,\n                                  self.label_space_danger, self.label_space_ko, self.label_space_data_danger,\n                                  self.label_settings_upgrade, self.label_settings_subvolumes,\n                                  self.label_existing_subvolumes, self.label_logo,\n                                  self.label_app_name, self.label_app_version, self.label_app_developer,\n                                  self.label_app_email, self.label_app_developer_2, self.button_balance,\n                                  self.button_upgrade_system, self.button_upgrade_system_without_snapshots,\n                                  self.button_fa_take_snapshot, self.button_take_snapshot,\n                                  self.button_delete_snapshot, self.button_delete_log, self.button_view_log,\n                                  self.button_edit_subvolume, self.button_delete_subvolume, self.button_add_subvolume,\n                                  self.button_save_subvolume, self.button_github, self.button_close_terminal,\n                                  self.button_save_log, self.text_edit_console, self.progressbar_metadata,\n                                  self.progressbar_data, self.combobox_filesystem, self.list_snapshots, self.list_logs,\n                                  self.combobox_subvolumes, self.line_edit_snapshot_where,\n                                  self.line_edit_snapshot_prefix, self.checkbox_edit_dont_remove_snapshots,\n                                  self.spinbox_edit_snapshots_to_keep, self.checkbox_startup, self.checkbox_log,\n                                  self.checkbox_snap, self.checkbox_flatpak, self.checkbox_aur, self.button_save_log,\n                                  self.button_close_terminal, self.button_wiki, self.label_documentation,\n                                  self.checkbox_grub_btrfs, self.button_regenerate_grub, self.label_settings_ui,\n                                  self.label_font_size, self.spinbox_font_size_increment,\n                                  self.label_settings_subvolumes_where, self.label_settings_subvolumes_prefix,\n                                  self.label_settings_subvolumes_snapshots_to_keep]\n            utils.scale_fonts(self.__ui_elements)\n\n            # Tooltips\n            self.setStyleSheet(\" QToolTip{font: \" + str(settings.base_font_size) + \"pt}\")\n\n            # Setting maximum and minimum  size for the main window\n            self.setMinimumHeight(300)\n            self.setMinimumWidth(300)\n\n            # Hiding terminal and buttons\n            self.button_close_terminal.hide()\n            self.button_save_log.hide()\n            self.text_edit_console.hide()\n\n            # Setting initial size depending on resolution\n            size_object = QtWidgets.QDesktopWidget().screenGeometry(-1)\n\n            if size_object.width() == 1920:\n                self.resize(640, 520)\n            elif size_object.width() > 1920:\n                self.resize(1024, 832)\n            else:\n                self.resize(320, 260)\n\n            # Centering the window\n            qt_rectangle = self.frameGeometry()\n            center_point = QDesktopWidget().availableGeometry().center()\n            qt_rectangle.moveCenter(center_point)\n            self.move(qt_rectangle.topLeft())\n\n            # Retrieving BTRFS Filesystems uuid\n            uuid_filesystems = filesystem.get_btrfs_filesystems()\n            if len(uuid_filesystems) > 0:\n                self.__current_filesystem_uuid = uuid_filesystems[0]\n                self.combobox_filesystem.addItems(uuid_filesystems)\n                self.__current_filesystem = filesystem.Filesystem(self.__current_filesystem_uuid)\n                self.__logger.info(\"BTRFS filesystems found in the system:\")\n                self.__logger.info(str(self.__current_filesystem))\n\n                # Space labels\n                self.label_space_ok.setStyleSheet('color: green')\n                self.label_space_danger.setStyleSheet('color: orange')\n                self.label_space_ko.setStyleSheet('color: red')\n                self.label_space_data_danger.setStyleSheet('color: orange')\n\n                # Displaying all the info related to the filesystem selected by default\n                # and labels (show_labels will be invoked within fill_filesystem_info method)\n                self.fill_filesystem_info(self.__current_filesystem)\n\n                # Displaying snapshots\n                self.fill_snapshots()\n\n                # Displaying logs\n                self.fill_logs()\n\n                # Retrieving subvolumes\n                self.fill_subvolumes()\n\n                # BEGIN -- Displaying settings options\n                # Retrieving snap packages upgrade decision\n                if settings.snap_packages == 0:\n                    self.checkbox_snap.setChecked(False)\n                else:\n                    self.checkbox_snap.setChecked(True)\n\n                if utils.exist_program(SNAP_COMMAND):\n                    self.checkbox_snap.show()\n                else:\n                    self.checkbox_snap.hide()\n\n                if utils.exist_program(SNAP_COMMAND):\n                    self.checkbox_snap.show()\n                else:\n                    self.checkbox_snap.hide()\n\n                # Retrieving Flatpak packages upgrade decision\n                if settings.flatpak_packages == 0:\n                    self.checkbox_flatpak.setChecked(False)\n                else:\n                    self.checkbox_flatpak.setChecked(True)\n\n                if utils.exist_program(FLATPAK_COMMAND):\n                    self.checkbox_flatpak.show()\n                else:\n                    self.checkbox_flatpak.hide()\n\n                # Retrieving AUR packages upgrade decision\n                if settings.aur_repository == 0:\n                    self.checkbox_aur.setChecked(False)\n                else:\n                    self.checkbox_aur.setChecked(True)\n\n                if settings.user_os == utils.OS_ARCH:\n                    self.checkbox_aur.show()\n                else:\n                    self.checkbox_aur.hide()\n\n                # Retrieving check for updates at startup decision\n                if settings.check_at_startup == 0:\n                    self.checkbox_startup.setChecked(False)\n                else:\n                    self.checkbox_startup.setChecked(True)\n\n                # Retrieving boot the system from GRUB using snapshots decision\n                if settings.grub_btrfs == 0:\n                    self.checkbox_grub_btrfs.setChecked(False)\n                    self.button_regenerate_grub.hide()\n                else:\n                    self.checkbox_grub_btrfs.setChecked(True)\n                    self.button_regenerate_grub.show()\n\n                if settings.user_os == utils.OS_ARCH or \\\n                        settings.user_os == utils.OS_DEBIAN or \\\n                        settings.user_os == utils.OS_SUSE or \\\n                        settings.user_os == utils.OS_FEDORA:\n                    self.checkbox_startup.show()\n                else:\n                    self.checkbox_startup.hide()\n\n                # Retrieving save log decision\n                if settings.save_log == 0:\n                    self.checkbox_log.setChecked(False)\n                else:\n                    self.checkbox_log.setChecked(True)\n\n                # Retrieving font size increment\n                self.spinbox_font_size_increment.setValue(settings.font_size_increment)\n\n                # END -- Displaying settings options\n\n                # Setting buttons and icons\n                # Snapshot buttons\n                add_icon = os.path.join(settings.images_dir, 'add_16px_icon.png')\n                self.button_take_snapshot.setIcon(QIcon(add_icon))\n                self.button_take_snapshot.setIconSize(QSize(16, 16))\n                remove_icon = os.path.join(settings.images_dir, 'remove_16px_icon.png')\n                self.button_delete_snapshot.setIcon(QIcon(remove_icon))\n                self.button_delete_snapshot.setIconSize(QSize(16, 16))\n                exchange_arrows_icon = os.path.join(settings.images_dir, 'exchange_arrows_16px_icon.png')\n                self.button_diff.setIcon(QIcon(exchange_arrows_icon))\n                self.button_diff.setIconSize(QSize(16, 16))\n                folder_icon = os.path.join(settings.images_dir, 'folder_16px_icon.png')\n                self.button_folder.setIcon(QIcon(folder_icon))\n                self.button_folder.setIconSize(QSize(16, 16))\n\n                # Logs buttons\n                view_icon = os.path.join(settings.images_dir, 'view_24px_icon.png')\n                self.button_view_log.setIcon(QIcon(view_icon))\n                self.button_view_log.setIconSize(QSize(16, 16))\n                self.button_delete_log.setIcon(QIcon(remove_icon))\n                self.button_delete_log.setIconSize(QSize(16, 16))\n\n                # Subvolume buttons\n                accept_icon = os.path.join(settings.images_dir, 'accept_16px_icon.png')\n                self.button_save_subvolume.setIcon(QIcon(accept_icon))\n                self.button_save_subvolume.setIconSize(QSize(16, 16))\n                edit_icon = os.path.join(settings.images_dir, 'edit_16px_icon.png')\n                self.button_edit_subvolume.setIcon(QIcon(edit_icon))\n                self.button_edit_subvolume.setIconSize(QSize(16, 16))\n                self.button_delete_subvolume.setIcon(QIcon(remove_icon))\n                self.button_delete_subvolume.setIconSize(QSize(16, 16))\n                self.refresh_subvolume_buttons()\n\n                # Displaying logo within About tab\n                self.label_logo.setPixmap(QPixmap(buttermanager_icon))\n\n                # Button events\n                self.combobox_filesystem.currentTextChanged.connect(self.on_combobox_filesystem_changed)\n                self.button_balance.clicked.connect(self.balance_filesystem)\n                self.button_upgrade_system.clicked.connect(partial(self.upgrade_system, True))\n                self.button_upgrade_system_without_snapshots.clicked.connect(partial(self.upgrade_system, False))\n                self.button_fa_take_snapshot.clicked.connect(self.take_snapshot)\n                self.button_close_terminal.clicked.connect(self.close_terminal)\n                self.button_save_log.clicked.connect(self.save_log)\n                self.button_take_snapshot.clicked.connect(self.take_snapshot)\n                self.button_delete_snapshot.clicked.connect(self.delete_snapshots)\n                self.button_diff.clicked.connect(self.find_diffs)\n                self.button_folder.clicked.connect(self.open_file_explorer)\n                self.button_delete_log.clicked.connect(self.delete_logs)\n                self.button_view_log.clicked.connect(self.view_log)\n                self.checkbox_edit_dont_remove_snapshots.clicked.connect(self.dont_remove_snapshots)\n                self.checkbox_snap.clicked.connect(self.include_snap)\n                self.checkbox_flatpak.clicked.connect(self.include_flatpak)\n                self.checkbox_aur.clicked.connect(self.include_aur)\n                self.checkbox_log.clicked.connect(self.include_log)\n                self.checkbox_startup.clicked.connect(self.include_startup)\n                self.checkbox_grub_btrfs.clicked.connect(self.include_grub_btrfs)\n                self.spinbox_font_size_increment.valueChanged.connect(self.change_font_size_increment)\n                self.button_add_subvolume.clicked.connect(self.add_subvolume)\n                self.button_edit_subvolume.clicked.connect(self.edit_subvolume)\n                self.button_save_subvolume.clicked.connect(self.save_subvolume)\n                self.button_delete_subvolume.clicked.connect(self.delete_subvolume)\n                self.combobox_subvolumes.currentTextChanged.connect(self.on_combobox_subvolumes_changed)\n                self.button_github.clicked.connect(self.go_to_github)\n                self.button_wiki.clicked.connect(self.go_to_wiki)\n                self.button_regenerate_grub.clicked.connect(self.regenerate_grub)\n\n                # If no subvolumes are defined, warning the user\n                if len(settings.subvolumes) == 0:\n                    info_dialog = windows.GeneralInfoWindow(self, \"Warning: You don't have any subvolumes \"\n                                                                         \"added.\\n\"\n                                                                         \"If you upgrade the filesystem, no snapshots \"\n                                                                         \"will\\n\"\n                                                                         \"be created. If you want to create \"\n                                                                         \"automatically\\n\"\n                                                                         \"snapshots during the upgrading process, \"\n                                                                         \"go to\\n\"\n                                                                         \"Settings and Add a subvolume.\")\n                    info_dialog.show()\n\n                # If everything goes right, the main window is displayed\n                self.show()\n\n                # Checks for root snapshot mounted\n                root_snapshot_default = self.__root_snapshot_checker.check_root_snapshot()\n                if root_snapshot_default:\n                    # Show the updates window only if the user wants to and if there are updates\n                    self.check_updates()\n                else:\n                    consolidate_window = self.__root_snapshot_checker.open_consolidate_snapshot_window()\n                    # Hiding the main window and showing the consolidate window in order to proceed\n                    self.hide()\n                    consolidate_window.show()\n                    consolidation = consolidate_window.exec_()\n                    if consolidation == 1:\n                        # User chose Ok button to consolidate root snapshot and the process finished successfully\n                        info_dialog = windows.ProblemsFoundWindow(self,\n                                                                         \"The snapshot you choose to boot the system \\n\"\n                                                                         \"has been consolidated as the default root \\n\"\n                                                                         \"snapshot. Please, reboot the system now.\")\n                        info_dialog.show()\n                    elif consolidation == 2:\n                        # User chose Ok button to consolidate root snapshot and the process didn't finish\n                        # successfully\n                        info_dialog = windows.ProblemsFoundWindow(self,\n                                                                         \"Error trying to substitute the root's path \\n\"\n                                                                         \"in fstab with the path of the new snapshot \\n\"\n                                                                         \"created\")\n                        info_dialog.show()\n                    elif consolidation == 3:\n                        # User chose Ok button to consolidate root snapshot and the process didn't finish\n                        # successfully\n                        info_dialog = windows.ProblemsFoundWindow(self,\n                                                                         \"Error removing root snapshot because it is \\n\"\n                                                                         \"not empty and there are subvolumes \\n\"\n                                                                         \"within it. The consolidation process \\n\"\n                                                                         \"couldn't be done.\")\n                        info_dialog.show()\n                    else:\n                        # User chose Cancel button so the application must be closed\n                        info_dialog = windows.ProblemsFoundWindow(self,\n                                                                         \"In order to avoid problems, ButterManager \\n\"\n                                                                         \"cannot execute any operations under \\n\"\n                                                                         \"a non default root snapshot so it will be \"\n                                                                         \"closed.\")\n                        self.close()\n                        info_dialog.show()\n            else:\n                self.__logger.info(\"The application couldn't start normally. No BTRFS file system found.\")\n\n                info_dialog = windows.ProblemsFoundWindow(self, \"No BTRFS file system found. \\n\"\n                                                                       \"The application will be closed.\")\n                info_dialog.show()\n\n        except exception.NoCommandFound:\n            self.__logger.info(\"The application couldn't start normally. There are some programs needed that are not \"\n                               \"installed.\")\n            self.__logger.info(\"Please, install these programs and start ButterManager again.\")\n\n            info_dialog = windows.ProblemsFoundWindow(self, \"These programs need to be installed for \\n\"\n                                                                   \"the proper functioning of ButterManager:\\n\"\n                                                                   \"btrfs, findmnt.\\n\")\n            info_dialog.show()\n\n    def check_updates(self):\n        \"\"\"Creates the updates checker that will start in another thread and check system updates.\n\n        \"\"\"\n        self.__updates_checker = upgrader.UpdatesChecker()\n        self.__updates_checker.show_updates_window.connect(self.show_updates_window)\n        self.__updates_checker.start()\n\n    def show_updates_window(self, command_line_output):\n        \"\"\" Shows a new window with all the packages to  be updated.\n\n        Once the updates_checker knows all the packages that need to be updated, a new\n        UpdatesWindow will be opened from the main GUI thread.\n\n        Arguments:\n            command_line_output (list(:obj:`str`)): Packages to be updated. One per line.\n        \"\"\"\n        updates_window = windows.UpdatesWindow(self, command_line_output)\n        updates_window.upgrade_system.connect(self.upgrade_system)\n        updates_window.upgrade_system_without_snanpshots.connect(partial(self.upgrade_system, False))\n        updates_window.show()\n\n    def balance_filesystem(self):\n        \"\"\"Runs the balance method.\n\n        \"\"\"\n        self.__balancer = filesystem.BalanceManager(self.__current_filesystem.data_percentage,\n                                                               self.__current_filesystem.metadata_percentage,\n                                                               self.__current_filesystem.mounted_points[0])\n        self.__balancer.show_one_window.connect(self.manage_window)\n        # Connecting the signal emitted by the balancer with this slot\n        self.__balancer.refresh_filesystem_statistics.connect(self.refresh_filesystem_statistics)\n        self.__balancer.start()\n\n    def manage_window(self, hide):\n        \"\"\"Shows or hide the main window\n\n        If some important operation (like, f.e. balancing the current filesystem) is being done, then\n        the main window should be hidden in order to avoid the user click on any other button and run\n        another operation until the current is finished.\n\n        Arguments:\n            hide (boolean): Hide or show the main window.\n        \"\"\"\n        if hide:\n            self.hide()\n        else:\n            self.show()\n\n    def refresh_filesystem_statistics(self):\n        \"\"\"Refresh current filesystem statistics in the GUI.\n\n        \"\"\"\n        # Calculating new values for the current filesystem\n        self.__current_filesystem = filesystem.Filesystem(self.__current_filesystem_uuid)\n        # Displaying all the info related to the current filesystem\n        self.fill_filesystem_info(self.__current_filesystem)\n\n    def fill_filesystem_info(self, filesystem):\n        \"\"\"Fills filesystem information in the GUI.\n\n        Arguments:\n            filesystem (obj: Filesystem): Filesystem.\n        \"\"\"\n        tooltip = \"More info about the filesystem: \\n \\n\" \\\n                  \"Devices: {devices} \\n\" \\\n                  \"Mounted points: {mounted_points}\".format(devices=filesystem.devices,\n                                                            mounted_points=filesystem.mounted_points)\n        self.label_filesystem_info_more.setToolTip(tooltip)\n        self.label_filesystem_info_more.setCursor(QCursor(Qt.WhatsThisCursor))\n        self.label_filesystem_size_value.setText(filesystem.total_size)\n        self.label_filesystem_allocated_value.setText(filesystem.total_allocated)\n        self.progressbar_data.setValue(filesystem.data_percentage)\n        self.progressbar_metadata.setValue(filesystem.metadata_percentage)\n        # self.progressbar_system.setValue(filesystem.system_percentage)\n\n        # Showing labels\n        self.show_space_labels()\n\n    def upgrade_system(self, snapshots=True):\n        \"\"\"Runs the system upgrade operation.\n\n        Arguments:\n            snapshots (boolean): Create and delete snapshots when the upgrading process is executed.\n        \"\"\"\n        # Showing terminal and buttons\n        self.button_close_terminal.show()\n        # Save log button will only be displayed when the logs are\n        # not saved automatically\n        if settings.save_log == 0:\n            self.button_save_log.show()\n        else:\n            self.button_save_log.hide()\n        self.text_edit_console.show()\n\n        # Checking if there is any subvolume defined by the user\n        if len(settings.subvolumes) == 0:\n            snapshots = False\n\n        # Gathering user settings\n        include_aur = False\n        if settings.user_os == utils.OS_ARCH:\n            include_aur = self.checkbox_aur.isChecked()\n        include_snap = False\n        if utils.exist_program(SNAP_COMMAND):\n            include_snap = self.checkbox_snap.isChecked()\n        include_flatpak = False\n        if utils.exist_program(FLATPAK_COMMAND):\n            include_flatpak = self.checkbox_flatpak.isChecked()\n\n        # Upgrading the system\n        self.__upgrader = upgrader.Upgrader(include_aur, include_snap, include_flatpak, snapshots)\n        # Connecting the signal emitted by the upgrader with this slot\n        self.__upgrader.disable_buttons.connect(self.__disable_buttons)\n        # Connecting the signal emitted by the upgrader with this slot\n        self.__upgrader.enable_buttons.connect(self.__enable_buttons)\n        # Connecting the signal emitted by the upgrader with this slot\n        # Depending on the decision to save or not the logs, the signal\n        # will be connected to a different slot\n        save_log = self.checkbox_log.isChecked()\n        if save_log:\n            # Saving log if it is needed\n            self.__upgrader.refresh_gui.connect(self.save_log_refresh_gui)\n        else:\n            self.__upgrader.refresh_gui.connect(self.refresh_gui)\n\n        self.__upgrader.start()\n\n    def close_terminal(self):\n        \"\"\"Closes terminal.\n\n        It will restore the proper windows size\n\n        \"\"\"\n        # Hiding terminal and buttons\n        self.button_close_terminal.hide()\n        self.button_save_log.hide()\n        self.text_edit_console.hide()\n\n    def save_log(self):\n        \"\"\"Saves the current content of the terminal into a file.\n\n        \"\"\"\n        try:\n            current_date = time.strftime('%Y%m%d')\n            index = 0\n            log_name = \"{current_date}-{index}.txt\".format(current_date=current_date, index=str(index))\n            log_path = os.path.join(settings.logs_path, log_name)\n            while os.path.exists(log_path):\n                index += 1\n                log_name = \"{current_date}-{index}.txt\".format(current_date=current_date, index=str(index))\n                log_path = os.path.join(settings.logs_path, log_name)\n\n            # Gets the content and saves it\n            log = self.text_edit_console.toPlainText()\n            with open(log_path, 'a') as file:\n                file.write(log)\n        except Exception as exception:\n            self.__logger.info(\"Error saving the log: \" + str(exception))\n\n    def __disable_buttons(self):\n        \"\"\"Disables all the buttons of the GUI.\n\n        \"\"\"\n        self.combobox_filesystem.setEnabled(False)\n        self.button_balance.setEnabled(False)\n        self.button_upgrade_system.setEnabled(False)\n        self.button_upgrade_system_without_snapshots.setEnabled(False)\n        self.button_fa_take_snapshot.setEnabled(False)\n        self.button_close_terminal.setEnabled(False)\n        self.list_snapshots.setEnabled(False)\n        self.list_logs.setEnabled(False)\n        self.combobox_subvolumes.setEnabled(False)\n        self.checkbox_startup.setEnabled(False)\n        self.checkbox_log.setEnabled(False)\n        self.checkbox_snap.setEnabled(False)\n        self.checkbox_aur.setEnabled(False)\n        self.checkbox_grub_btrfs.setEnabled(False)\n        self.checkbox_flatpak.setEnabled(False)\n        self.spinbox_font_size_increment.setEnabled(False)\n        self.button_take_snapshot.setEnabled(False)\n        self.button_delete_snapshot.setEnabled(False)\n        self.button_diff.setEnabled(False)\n        self.button_folder.setEnabled(False)\n        self.button_add_subvolume.setEnabled(False)\n        self.button_delete_subvolume.setEnabled(False)\n        self.button_edit_subvolume.setEnabled(False)\n        self.button_save_subvolume.setEnabled(False)\n        self.button_view_log.setEnabled(False)\n        self.button_delete_log.setEnabled(False)\n        self.button_regenerate_grub.setEnabled(False)\n\n    def __enable_buttons(self):\n        \"\"\"Enable all the buttons of the GUI.\n\n        \"\"\"\n        self.combobox_filesystem.setEnabled(True)\n        self.button_balance.setEnabled(True)\n        self.button_upgrade_system.setEnabled(True)\n        self.button_upgrade_system_without_snapshots.setEnabled(True)\n        self.button_fa_take_snapshot.setEnabled(True)\n        self.button_close_terminal.setEnabled(True)\n        self.list_snapshots.setEnabled(True)\n        self.list_logs.setEnabled(True)\n        self.combobox_subvolumes.setEnabled(True)\n        self.checkbox_startup.setEnabled(True)\n        self.checkbox_log.setEnabled(True)\n        self.checkbox_snap.setEnabled(True)\n        self.checkbox_aur.setEnabled(True)\n        self.checkbox_grub_btrfs.setEnabled(True)\n        self.checkbox_flatpak.setEnabled(True)\n        self.spinbox_font_size_increment.setEnabled(True)\n        self.button_take_snapshot.setEnabled(True)\n        self.button_delete_snapshot.setEnabled(True)\n        self.button_diff.setEnabled(True)\n        self.button_folder.setEnabled(True)\n        self.button_add_subvolume.setEnabled(True)\n        self.button_delete_subvolume.setEnabled(True)\n        self.button_edit_subvolume.setEnabled(True)\n        self.button_save_subvolume.setEnabled(True)\n        self.button_view_log.setEnabled(True)\n        self.button_delete_log.setEnabled(True)\n        self.button_regenerate_grub.setEnabled(True)\n\n    def take_snapshot(self):\n        \"\"\"Takes a BTRFS subvolume snapshot.\n\n        \"\"\"\n        snapshot_window = windows.SnapshotWindow(self)\n        # Connecting the signals emitted by the snapshot window with this slot\n        snapshot_window.refresh_gui.connect(self.refresh_gui)\n        snapshot_window.enable_buttons.connect(self.__enable_buttons)\n        # Disabling buttons\n        self.__disable_buttons()\n        # Displaying snapshot window\n        snapshot_window.show()\n        # Enabling buttons\n        self.__disable_buttons()\n\n    def delete_snapshots(self):\n        \"\"\"Deletes one or several BTRFS subvolume snapshots.\n\n        \"\"\"\n        # Disabling buttons\n        self.__disable_buttons()\n\n        # Waiting 10 msec in order to let self.__disable_buttons to take effect\n        QtTest.QTest.qWait(10)\n\n        snapshots_to_delete = self.list_snapshots.selectedItems()\n        for snap in snapshots_to_delete:\n            snapshot.delete_specific_snapshot(snap.text())\n\n        # Refreshing GUI\n        self.refresh_gui()\n\n        # Enabling buttons\n        self.__enable_buttons()\n\n    def find_diffs(self):\n        \"\"\"Find differences between the snapshot selected and the current state of the subvolume related to it.\n\n        \"\"\"\n        snapshot_to_diff = self.list_snapshots.selectedItems()\n        if len(snapshot_to_diff) != 1:\n            # Only one snapshot can be selected\n            info_dialog = windows.GeneralInfoWindow(self, \"Please, select one (and only one) snapshot\\n\"\n                                                                 \"in order to find the differences between\\n\"\n                                                                 \"it and the current subvolume.\")\n            info_dialog.show()\n        else:\n            # Disabling buttons\n            self.__disable_buttons()\n\n            # Waiting 10 msec in order to let self.__disable_buttons to take effect\n            QtTest.QTest.qWait(10)\n\n            # The user has to select the kind of operation\n            diff_window = windows.DiffWindow()\n\n            # Hidding the main window and showing the diff window in order to proceed\n            self.hide()\n\n            diff_window.show()\n            diff_process = diff_window.exec_()\n            if diff_process == 1:\n                # A full operation will be done\n                self.__differentiator = snapshot.Differentiator(\n                    snapshot_to_diff[0].text(),\n                    snapshot.Differentiator.OPERATION_FULL)\n            elif diff_process == 2:\n                # A partial operation will be done\n                self.__differentiator = snapshot.Differentiator(\n                    snapshot_to_diff[0].text(),\n                    snapshot.Differentiator.OPERATION_PARTIAL)\n\n            self.__differentiator.show_one_window.connect(self.manage_window)\n            self.__differentiator.start()\n\n            # Refreshing GUI\n            self.refresh_gui()\n\n            # Enabling buttons\n            self.__enable_buttons()\n\n            # Showing main window again\n            self.show()\n\n    def open_file_explorer(self):\n        \"\"\"Opens a file explorer to see all the files within a snapshot.\n\n        \"\"\"\n        snapshots_selected = self.list_snapshots.selectedItems()\n        if len(snapshots_selected) != 1:\n            # Only one snapshot can be selected\n            info_dialog = windows.GeneralInfoWindow(self, \"Please, select one (and only one) snapshot \\n\"\n                                                                 \"in order to open the file explorer.\")\n            info_dialog.show()\n        else:\n            subprocess.call(['xdg-open', snapshots_selected[0].text()])\n\n    def delete_logs(self):\n        \"\"\"Deletes one or several logs.\n\n        \"\"\"\n        logs_to_delete = self.list_logs.selectedItems()\n        for log in logs_to_delete:\n            os.remove(os.path.join(settings.logs_path, log.text()))\n\n        # Refreshing GUI\n        self.refresh_gui()\n\n    def view_log(self):\n        \"\"\"Opens the log in a new window to display it.\n\n        \"\"\"\n        logs_to_view = self.list_logs.selectedItems()\n        for log in logs_to_view:\n            log_window = windows.LogViewWindow(self, os.path.join(settings.logs_path, log.text()))\n            log_window.show()\n\n    def add_subvolume(self):\n        \"\"\"Adds a new subvolume to be managed by the application.\n\n        \"\"\"\n        subvolume_window = windows.SubvolumeWindow(self)\n        # Connecting the signal emitted by the subvolume window with this slot\n        subvolume_window.refresh_gui.connect(self.refresh_gui)\n        # Displaying snapshot window\n        subvolume_window.show()\n\n    def dont_remove_snapshots(self):\n        \"\"\"Actions when user checks don't remove snapshots.\n        \"\"\"\n        if self.checkbox_edit_dont_remove_snapshots.isChecked():\n            self.spinbox_edit_snapshots_to_keep.hide()\n        else:\n            self.spinbox_edit_snapshots_to_keep.show()\n            self.spinbox_edit_snapshots_to_keep.setValue(1)\n\n    def include_snap(self):\n        \"\"\"Actions when user checks include snap packages.\n\n        \"\"\"\n        # Storing value in settings\n        if self.checkbox_snap.isChecked():\n            settings.properties_manager.set_property('snap_packages', 1)\n        else:\n            settings.properties_manager.set_property('snap_packages', 0)\n\n    def include_flatpak(self):\n        \"\"\"Actions when user checks include flatpak packages.\n\n        \"\"\"\n        # Storing value in settings\n        if self.checkbox_flatpak.isChecked():\n            settings.properties_manager.set_property('flatpak_packages', 1)\n        else:\n            settings.properties_manager.set_property('flatpak_packages', 0)\n\n    def include_aur(self):\n        \"\"\"Actions when user checks include AUR packages.\n\n        \"\"\"\n        # Storing value in settings\n        if self.checkbox_aur.isChecked():\n            settings.properties_manager.set_property('aur_repository', 1)\n        else:\n            settings.properties_manager.set_property('aur_repository', 0)\n\n    def include_log(self):\n        \"\"\"Actions when user checks include log.\n\n        \"\"\"\n        # Storing value in settings\n        if self.checkbox_log.isChecked():\n            settings.properties_manager.set_property('save_log', 1)\n        else:\n            settings.properties_manager.set_property('save_log', 0)\n\n    def include_startup(self):\n        \"\"\"Actions when user checks check updates at startup.\n\n        \"\"\"\n        # Storing value in settings\n        if self.checkbox_startup.isChecked():\n            settings.properties_manager.set_property('check_at_startup', 1)\n        else:\n            settings.properties_manager.set_property('check_at_startup', 0)\n\n    def include_grub_btrfs(self):\n        \"\"\"Actions when user checks boot the system from GRUB using snapshots.\n\n        \"\"\"\n        # Storing value in settings\n        if self.checkbox_grub_btrfs.isChecked():\n            settings.properties_manager.set_property('grub_btrfs', 1)\n            self.button_regenerate_grub.show()\n        else:\n            settings.properties_manager.set_property('grub_btrfs', 0)\n            self.button_regenerate_grub.hide()\n\n    def change_font_size_increment(self):\n        \"\"\"Actions when user increases or decreases the UI font size.\n\n        \"\"\"\n        # Storing value in settings\n        settings.properties_manager.set_property('font_size_increment', self.spinbox_font_size_increment.value())\n\n        # Changing UI font size dynamically\n        utils.scale_fonts(self.__ui_elements)\n\n    def on_combobox_filesystem_changed(self):\n        self.__current_filesystem_uuid = self.combobox_filesystem.currentText()\n        self.refresh_filesystem_statistics()\n\n    def on_combobox_subvolumes_changed(self):\n        current_subvolume = self.combobox_subvolumes.currentText()\n        if current_subvolume:\n            self.line_edit_snapshot_where.setText(settings.subvolumes[current_subvolume].subvolume_dest)\n            self.line_edit_snapshot_prefix.setText(settings.subvolumes[current_subvolume].snapshot_name)\n\n            snapshots_to_keep = int(settings.subvolumes[current_subvolume].snapshots_to_keep)\n\n            if snapshots_to_keep == -1:\n                # Enable Don't remove snapshots\n                self.checkbox_edit_dont_remove_snapshots.show()\n                self.checkbox_edit_dont_remove_snapshots.setChecked(True)\n                self.checkbox_edit_dont_remove_snapshots.setDisabled(True)\n                # Hide snapshots to keep\n                self.spinbox_edit_snapshots_to_keep.hide()\n            else:\n                # Enable snapshots to keep\n                self.spinbox_edit_snapshots_to_keep.show()\n                self.spinbox_edit_snapshots_to_keep.setDisabled(True)\n                self.spinbox_edit_snapshots_to_keep.setValue(snapshots_to_keep)\n                # Show Don't remove snapshots and disable it\n                self.checkbox_edit_dont_remove_snapshots.show()\n                self.checkbox_edit_dont_remove_snapshots.setDisabled(True)\n\n    def edit_subvolume(self):\n        \"\"\"Actions when user wants to edit a defined subvolume.\n\n        \"\"\"\n        # Buttons management\n        self.button_save_subvolume.show()\n        self.button_edit_subvolume.hide()\n        self.button_delete_subvolume.hide()\n        self.line_edit_snapshot_where.setDisabled(False)\n        self.line_edit_snapshot_prefix.setDisabled(False)\n        self.spinbox_edit_snapshots_to_keep.setDisabled(False)\n        self.checkbox_edit_dont_remove_snapshots.setDisabled(False)\n\n    def save_subvolume(self):\n        \"\"\"Actions when user finishes to edit a subvolume.\n\n        \"\"\"\n        # Buttons management\n        self.button_save_subvolume.hide()\n        self.button_edit_subvolume.show()\n        self.button_delete_subvolume.show()\n        self.line_edit_snapshot_where.setDisabled(True)\n        self.line_edit_snapshot_prefix.setDisabled(True)\n        self.spinbox_edit_snapshots_to_keep.setDisabled(True)\n        self.checkbox_edit_dont_remove_snapshots.setDisabled(True)\n\n        # Storing the modified values\n        new_snapshot_where = self.line_edit_snapshot_where.text()\n        new_snapshot_prefix = self.line_edit_snapshot_prefix.text()\n        subvolume_selected = self.combobox_subvolumes.currentText()\n        snapshots_to_keep = -1\n        if not self.checkbox_edit_dont_remove_snapshots.isChecked():\n            snapshots_to_keep = self.spinbox_edit_snapshots_to_keep.value()\n\n        settings.properties_manager.set_subvolume(subvolume_selected, new_snapshot_where, new_snapshot_prefix,\n                                                  snapshots_to_keep)\n\n        # Refreshing components\n        self.refresh_gui()\n\n    def delete_subvolume(self):\n        \"\"\"Actions when user wants to delete a subvolume.\n\n        \"\"\"\n        # Storing the modified values\n        subvolume_selected = self.combobox_subvolumes.currentText()\n        settings.properties_manager.set_subvolume(subvolume_selected, None, None, None)\n\n        # Refreshing components\n        self.refresh_gui()\n\n    def go_to_github(self):\n        \"\"\"Actions when user clicks on github button.\n\n        \"\"\"\n        url = QUrl('https://github.com/egara/buttermanager')\n        QDesktopServices.openUrl(url)\n\n    def go_to_wiki(self):\n        \"\"\"Actions when user clicks on github button.\n\n        \"\"\"\n        url = QUrl('https://github.com/egara/buttermanager/wiki')\n        QDesktopServices.openUrl(url)\n\n    def fill_snapshots(self):\n        \"\"\"Fills snapshots information in the GUI.\n\n        \"\"\"\n        # Resetting snapshots in the GUI\n        # Clearing the list\n        self.list_snapshots.clear()\n\n        # Adding the snapshots to the list\n        snapshots = []\n        self.list_snapshots.addItems(snapshots)\n        # Loading the snapshots detected\n        for subvolume in settings.subvolumes:\n            snapshots.extend(settings.subvolumes[subvolume].get_all_snapshots_with_the_same_name())\n        self.list_snapshots.addItems(snapshots)\n\n    def fill_logs(self):\n        \"\"\"Fills logs in the GUI.\n\n        \"\"\"\n        # Resetting logs in the GUI\n        # Clearing the list\n        self.list_logs.clear()\n\n        # Adding the logs to the list\n        logs = os.listdir(settings.logs_path)\n        self.list_logs.addItems(logs)\n\n    def fill_subvolumes(self):\n        \"\"\"Fills subvolumes in the GUI.\n\n        \"\"\"\n        # Resetting combo\n        self.combobox_subvolumes.clear()\n        # Adding the new subvolumes to the combobox\n        list_subvolumes = []\n        if len(settings.subvolumes) > 0:\n            for subvolume in settings.subvolumes:\n                list_subvolumes.append(subvolume)\n            self.combobox_subvolumes.addItems(list_subvolumes)\n            self.line_edit_snapshot_where.setDisabled(True)\n            self.line_edit_snapshot_where.setText(settings.subvolumes[list_subvolumes[0]].subvolume_dest)\n            self.line_edit_snapshot_prefix.setDisabled(True)\n            self.line_edit_snapshot_prefix.setText(settings.subvolumes[list_subvolumes[0]].snapshot_name)\n\n            snapshots_to_keep = int(settings.subvolumes[list_subvolumes[0]].snapshots_to_keep)\n\n            if snapshots_to_keep == -1:\n                # Enable Don't remove snapshots\n                self.checkbox_edit_dont_remove_snapshots.show()\n                self.checkbox_edit_dont_remove_snapshots.setChecked(True)\n                self.checkbox_edit_dont_remove_snapshots.setDisabled(True)\n                # Hide snapshots to keep\n                self.spinbox_edit_snapshots_to_keep.hide()\n            else:\n                # Enable snapshots to keep\n                self.spinbox_edit_snapshots_to_keep.show()\n                self.spinbox_edit_snapshots_to_keep.setDisabled(True)\n                self.spinbox_edit_snapshots_to_keep.setValue(snapshots_to_keep)\n                # Show Don't remove snapshots and disable it\n                self.checkbox_edit_dont_remove_snapshots.show()\n                self.checkbox_edit_dont_remove_snapshots.setDisabled(True)\n\n    def refresh_subvolume_buttons(self):\n        \"\"\"Shows or hide subvolume buttons in the GUI.\n\n        \"\"\"\n        # They will be shown only if some subvolume is defined by the user\n        if len(settings.subvolumes) > 0:\n            self.button_save_subvolume.hide()\n            self.button_edit_subvolume.show()\n            self.button_delete_subvolume.show()\n            self.combobox_subvolumes.show()\n            self.line_edit_snapshot_where.show()\n            self.label_settings_subvolumes_where.show()\n            self.line_edit_snapshot_prefix.show()\n            self.label_settings_subvolumes_prefix.show()\n        else:\n            self.label_existing_subvolumes.hide()\n            self.button_save_subvolume.hide()\n            self.button_edit_subvolume.hide()\n            self.button_delete_subvolume.hide()\n            self.combobox_subvolumes.hide()\n            self.line_edit_snapshot_where.hide()\n            self.label_settings_subvolumes_where.hide()\n            self.line_edit_snapshot_prefix.hide()\n            self.label_settings_subvolumes_prefix.hide()\n\n    def refresh_gui(self):\n        \"\"\"Refresh all the GUI elements.\n\n        \"\"\"\n        self.refresh_filesystem_statistics()\n        self.fill_snapshots()\n        self.fill_logs()\n        self.fill_subvolumes()\n        self.refresh_subvolume_buttons()\n        self.show_space_labels()\n\n    def save_log_refresh_gui(self):\n        \"\"\"Save log and refresh all the GUI elements.\n\n        \"\"\"\n        self.save_log()\n        self.refresh_gui()\n\n    def show_space_labels(self):\n        \"\"\"Shows the appropiate labels related to the space left of the system.\n\n        \"\"\"\n        filesystem_space_pertentage = utils.get_percentage(self.__current_filesystem.total_size,\n                                                                self.__current_filesystem.total_allocated)\n        if filesystem_space_pertentage <= 70:\n            self.label_space_ok.show()\n            self.label_space_danger.hide()\n            self.label_space_ko.hide()\n        elif filesystem_space_pertentage > 70 & filesystem_space_pertentage <= 85:\n            self.label_space_ok.hide()\n            self.label_space_danger.show()\n            self.label_space_ko.hide()\n        else:\n            self.label_space_ok.hide()\n            self.label_space_danger.hide()\n            self.label_space_ko.show()\n\n        if self.__current_filesystem.data_percentage <= 85:\n            self.label_space_data_danger.show()\n        else:\n            self.label_space_data_danger.hide()\n\n    def regenerate_grub(self):\n        \"\"\"Regenerates GRUB menu to include the snapshots taken as bootable entries.\n\n        \"\"\"\n        # Disabling buttons\n        self.__disable_buttons()\n\n        # Waiting 100 msec in order to let self.__disable_buttons to take effect\n        QtTest.QTest.qWait(100)\n\n        # Run grub-btrfs in order to regenerate GRUB entries\n        utils.execute_command(snapshot.GRUB_BTRFS_COMMAND, console=True, root=True)\n\n        # Refreshing GUI\n        self.refresh_gui()\n\n        # Enabling buttons\n        self.__enable_buttons()\n\n        # Displaying info\n        info_dialog = windows.GeneralInfoWindow(self, \"GRUB menu has been regenerated.\")\n        info_dialog.show()\n"
  },
  {
    "path": "buttermanager/buttermanager/exception/__init__.py",
    "content": "#Copyright 2018-2019 Eloy García Almadén <eloy.garcia.pca@gmail.com>\n#\n# This file is part of buttermanager.\n#\n# This program is free software: you can redistribute it and / or modify it\n# under the terms of the GNU General Public License as published by the\n# Free Software Foundation, version 3 of the License.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>."
  },
  {
    "path": "buttermanager/buttermanager/exception/exception.py",
    "content": "# -*- coding: utf-8 -*-\n#\n# Copyright 2018-2019 Eloy García Almadén <eloy.garcia.pca@gmail.com>\n#\n# This file is part of buttermanager.\n#\n# This program is free software: you can redistribute it and / or modify it\n# under the terms of the GNU General Public License as published by the\n# Free Software Foundation, version 3 of the License.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\n\"\"\"This module gathers all the custom exceptions rised in buttermanager application.\n\n\"\"\"\n\n\n# Classes\nclass NoCommandFound(Exception):\n    \"\"\"Exception raised when a needed program is not installed in the system.\n\n    \"\"\"\n    pass\n\n\nclass BtrfsSnapshotDeletion(Exception):\n    \"\"\"Exception raised when a subvolume can't be deleted because it is not empty.\n    A subvolume is not empty when there are other subvolumes within it\n\n    \"\"\"\n    def __init__(self, *args):\n        if args:\n            self.message = args[0]\n        else:\n            self.message = None\n\n    def __str__(self):\n        print('calling str')\n        if self.message:\n            return 'MyCustomError, {0} '.format(self.message)\n        else:\n            return 'MyCustomError has been raised'\n"
  },
  {
    "path": "buttermanager/buttermanager/filesystem/__init__.py",
    "content": "# Copyright 2018-2019 Eloy García Almadén <eloy.garcia.pca@gmail.com>\n#\n# This file is part of buttermanager.\n#\n# This program is free software: you can redistribute it and / or modify it\n# under the terms of the GNU General Public License as published by the\n# Free Software Foundation, version 3 of the License.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n"
  },
  {
    "path": "buttermanager/buttermanager/filesystem/filesystem.py",
    "content": "# -*- coding: utf-8 -*-\n#\n# Copyright 2018-2019 Eloy García Almadén <eloy.garcia.pca@gmail.com>\n#\n# This file is part of buttermanager.\n#\n# This program is free software: you can redistribute it and / or modify it\n# under the terms of the GNU General Public License as published by the\n# Free Software Foundation, version 3 of the License.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\n\"\"\"This module gathers all the operations related to BTRFS filesystems.\n\nIt provides also Filesystem class.\n\"\"\"\nfrom ..exception import exception\nfrom ..window import windows\nimport sys\nfrom ..util import utils\nfrom PyQt5.QtCore import QThread, pyqtSignal\n\n# Constants\nDEVID = \"devid\"\nLABEL = \"Label\"\nUUID = \"uuid:\"\nDEVICE_SIZE = \"Device size:\"\nDEVICE_ALLOCATED = \"Device allocated:\"\nDATA = \"Data,\"\nMETADATA = \"Metadata,\"\nSYSTEM = \"System,\"\nSIZE = \"Size:\"\nUSED = \"Used:\"\nBTRFS_SHOW_COMMAND = \"sudo -S btrfs filesystem show\"\nFINDMT_COMMAND = \"sudo -S findmnt -nt btrfs\"\nBTRFS_USAGE_COMMAND = \"sudo -S btrfs filesystem usage\"\nBTRFS_BALANCE_COMMAND = \"sudo -S btrfs balance start\"\nBTRFS_BALANCE_DATA_USAGE_FILTER = \"dusage\"\nBTRFS_BALANCE_METADATA_USAGE_FILTER = \"musage\"\n\n\n# Classes\nclass Filesystem:\n    \"\"\"BTRFS Filesystem.\n\n    \"\"\"\n    # Constructor\n    def __init__(self, uuid):\n\n        self.__uuid = uuid\n        self.__devices = self.__get_devices()\n        self.__mounted_points = self.__get_mounted_points()\n        filesystem_info = self.__get_filesystem_info(self.mounted_points[0])\n        self.__total_size = filesystem_info['total_size']\n        self.__total_allocated = filesystem_info['total_allocated']\n        self.__data_size = filesystem_info['data_size']\n        self.__data_used = filesystem_info['data_used']\n        self.__data_percentage = filesystem_info['data_percentage']\n        self.__metadata_size = filesystem_info['metadata_size']\n        self.__metadata_used = filesystem_info['metadata_used']\n        self.__metadata_percentage = filesystem_info['metadata_percentage']\n        self.__system_size = filesystem_info['system_size']\n        self.__system_used = filesystem_info['system_used']\n        self.__system_percentage = filesystem_info['system_percentage']\n\n    # Private attributes\n    # UUID\n    @property\n    def uuid(self):\n        return self.__uuid\n\n    # Devices\n    @property\n    def devices(self):\n        return self.__devices\n\n    # Mounted points\n    @property\n    def mounted_points(self):\n        return self.__mounted_points\n\n    # Total size\n    @property\n    def total_size(self):\n        return self.__total_size\n\n    # Total allocated\n    @property\n    def total_allocated(self):\n        return self.__total_allocated\n\n    # Data size\n    @property\n    def data_size(self):\n        return self.__data_size\n\n    # Data used\n    @property\n    def data_used(self):\n        return self.__data_used\n\n    # Data percentage\n    @property\n    def data_percentage(self):\n        return self.__data_percentage\n\n    # Metadata size\n    @property\n    def metadata_size(self):\n        return self.__metadata_size\n\n    # Metadata used\n    @property\n    def metadata_used(self):\n        return self.__metadata_used\n\n    # Metadata percentage\n    @property\n    def metadata_percentage(self):\n        return self.__metadata_percentage\n\n    # System size\n    @property\n    def system_size(self):\n        return self.__system_size\n\n    # System used\n    @property\n    def system_used(self):\n        return self.__system_used\n\n    # System percentage\n    @property\n    def system_percentage(self):\n        return self.__system_percentage\n\n    # Methods\n    # Private methods\n    def __get_devices(self):\n        \"\"\"Retrieves all the devices which the BTRFS filesystem is composed.\n\n        Returns:\n            list (:obj:`list` of :obj:`str`): devices.\n        \"\"\"\n        try:\n            devices = []\n            commandline_output = utils.execute_command(BTRFS_SHOW_COMMAND, root=True)\n            filesystem_found = False\n\n            for line in commandline_output.split(\"\\n\"):\n                if UUID in line:\n                    if filesystem_found:\n                        break\n                    else:\n                        if self.uuid in line:\n                            filesystem_found = True\n                            continue\n\n                if filesystem_found:\n                    # The loop is inside the chosen BTRFS filesystem\n                    # It is necessary to find devid to retrieve all the filesystem paths\n                    if DEVID in line:\n                        path_init = line.find('/')\n                        # The device path is appended to the list\n                        devices.append(line[path_init:len(line)])\n\n            return devices\n\n        except exception.NoCommandFound as no_command_found_exception:\n            raise no_command_found_exception\n\n    def __get_mounted_device(self):\n        \"\"\"Retrieves the device tha contains the BTRFS filesystem and it is mounted.\n\n        Returns:\n            string: device path.\n        \"\"\"\n        try:\n            mounted_device = ''\n            commandline_output = utils.execute_command(FINDMT_COMMAND)\n            for device in self.devices:\n                if device in commandline_output:\n                    mounted_device = device\n                    break\n\n            return mounted_device\n\n        except exception.NoCommandFound as no_command_found_exception:\n            raise no_command_found_exception\n\n    def __get_mounted_points(self):\n        \"\"\"Retrieves all the mounted points of the BTRFS filesystem.\n\n        Returns:\n            list (:obj:`list` of :obj:`str`): mounted points.\n        \"\"\"\n        try:\n            mounted_points = []\n            device = self.__get_mounted_device()\n            command = \"{command} {device}\".format(command=FINDMT_COMMAND, device=device)\n            commandline_output = utils.execute_command(command)\n\n            for line in commandline_output.split(\"\\n\"):\n                if len(line) > 0:\n                    mounted_points.append(line.split(\" \")[0].strip())\n\n            return mounted_points\n\n        except exception.NoCommandFound as no_command_found_exception:\n            raise no_command_found_exception\n\n    def __get_filesystem_info(self, mounted_point):\n        \"\"\"Retrieves all the information of the BTRFS filesystem.\n\n        Returns:\n            dictionary (key=:obj:'string', value=:obj:'str' or obj:'int'): all the info. The keys of the dictionary\n            will be:\n                - total_size: Device size\n                - total_allocated: Device allocated\n                - data_size: Data size\n                - data_used: Data used\n                - data_percentage: Percentage of data used\n                - metadata_size: Metadata size\n                - metadata_used: Metadata used\n                - metadata_percentage: Percentage of metadata used\n                - system_size: System size\n                - system_used: System used\n                - system_percentage: Percentage of system used\n        \"\"\"\n        filesystem_info = {'total_size': '0', 'total_allocated': '0',\n                           'data_size': '0', 'data_used': '0', 'data_percentage': 0,\n                           'metadata_size': '0', 'metadata_used': '0', 'metadata_percentage': 0,\n                           'system_size': '0', 'system_used': '0', 'system_percentage': 0}\n        command = \"{command} {point}\".format(command=BTRFS_USAGE_COMMAND, point=mounted_point)\n        commandline_output = utils.execute_command(command, root=True)\n\n        for line in commandline_output.split(\"\\n\"):\n            if DEVICE_SIZE in line:\n                filesystem_info['total_size'] = line.split(DEVICE_SIZE)[1].strip()\n            elif DEVICE_ALLOCATED in line:\n                filesystem_info['total_allocated'] = line.split(DEVICE_ALLOCATED)[1].strip()\n            elif DATA in line:\n                data_size = line.split(SIZE)[1].split(',')[0].strip()\n                filesystem_info['data_size'] = data_size\n                data_used = line.split(USED)[1].strip()\n                if '(' in data_used:\n                    # New versions of btrfs-progs already include the percentage\n                    data_used = data_used.split()[0].strip()\n                filesystem_info['data_used'] = data_used\n                filesystem_info['data_percentage'] = utils.get_percentage(filesystem_info['data_size'],\n                                                                               filesystem_info['data_used'])\n            elif METADATA in line:\n                metadata_size = line.split(SIZE)[1].split(',')[0].strip()\n                filesystem_info['metadata_size'] = metadata_size\n                metadata_used = line.split(USED)[1].strip()\n                if '(' in metadata_used:\n                    # New versions of btrfs-progs already include the percentage\n                    metadata_used = metadata_used.split()[0].strip()\n                filesystem_info['metadata_used'] = metadata_used\n                filesystem_info['metadata_percentage'] = utils.get_percentage(filesystem_info['metadata_size'],\n                                                                                   filesystem_info['metadata_used'])\n            elif SYSTEM in line:\n                system_size = line.split(SIZE)[1].split(',')[0].strip()\n                filesystem_info['system_size'] = system_size\n                filesystem_info['system_used'] = line.split(USED)[1].strip()\n                filesystem_info['system_percentage'] = utils.get_percentage(filesystem_info['system_size'],\n                                                                                 filesystem_info['system_used'])\n\n        return filesystem_info\n\n    # Public methods\n    def __str__(self):\n        \"\"\"Reimplementation of the str method inherited from object class.\n\n        Returns:\n            string: String representation of the Filesystem object.\n        \"\"\"\n        return \"BTRFS Filesystem -> UUID: {0}; Devices: {1}; Mounted Points: {2}\".format(self.uuid, self.devices,\n                                                                                         self.mounted_points)\n\n\n# Module's methods\ndef get_btrfs_filesystems(mounted=True):\n    \"\"\"Retrieves all the BTRFS filesystems.\n\n    Keyword arguments:\n        mounted (bool): Only mounted filesystems will be retrieved (default True).\n\n    Returns:\n        list (:obj:`list` of :obj:`str`): filesystems UUID.\n    \"\"\"\n\n    filesystems = []\n    command = BTRFS_SHOW_COMMAND\n\n    if mounted:\n        command += \" --mounted\"\n\n    commandline_output = utils.execute_command(command, root=True)\n\n    for line in commandline_output.split(\"\\n\"):\n        if UUID in line:\n            # The uuid is appended to the list\n            filesystems.append(line.split(UUID)[1].strip())\n\n    return filesystems\n\n\ndef balance_filesystem(filter, percentage, mounted_point):\n    \"\"\"Balances a specific filesystem.\n\n    Arguments:\n        filter (string): filter.\n        percentage (int): usage filter.\n        mounted_point: path to balance.\n    \"\"\"\n    # Logger\n    logger = utils.Logger(sys.modules['__main__'].__file__).get()\n    logger.info(\"Balancing {mounted_point} using filter {filter} and \"\n                \"percentage {percentage}\".format(mounted_point=mounted_point,\n                                                 filter=filter,\n                                                 percentage=percentage))\n\n    command = \"{command} -{filter}={percentage} {mounted_point}\".format(command=BTRFS_BALANCE_COMMAND,\n                                                                        filter=filter,\n                                                                        percentage=percentage,\n                                                                        mounted_point=mounted_point)\n    logger.info(\"Command executed {command}\".format(command=command))\n    commandline_output = utils.execute_command(command, root=True)\n    for line in commandline_output.split(\"\\n\"):\n        logger.info(line)\n\n\nclass BalanceManager(QThread):\n    \"\"\"Independent thread that will run the filesystem balancing process.\n\n    \"\"\"\n    # Attributes\n    # pyqtSignal that will be emitted when this class requires to display\n    # a single information window on the screen\n    show_one_window = pyqtSignal('bool')\n\n    # pyqtSignal that will be emitted when this class requires that main\n    # window refreshes current filesystem statistics\n    refresh_filesystem_statistics = pyqtSignal()\n\n    # Constructor\n    def __init__(self, data_percentage, metadata_percentage, mounted_point):\n        QThread.__init__(self)\n        self.__data_percentage = data_percentage\n        self.__metadata_percentage = metadata_percentage\n        self.__mounted_point = mounted_point\n\n    # Methods\n    def run(self):\n        # Main window will be hidden\n        self.on_show_one_window(True)\n        info_dialog = windows.InfoWindow(None, \"Balancing '{mounted_point}' mounted point. \\n\"\n                                                      \"This window will be closed automatically \\n\"\n                                                      \"when the operation is done. \\n \\n\"\n                                                      \"Please wait...\".format(mounted_point=self.__mounted_point))\n        # Displaying info window\n        info_dialog.show()\n\n        # Balances the filesystem\n        self.__balance_filesystem()\n\n        # Hiding info window\n        info_dialog.hide()\n\n        # Main window will be shown again\n        self.on_show_one_window(False)\n\n        # Refreshing current filesystem statistics\n        self.on_refresh_filesystem_statistics()\n\n    def __balance_filesystem(self):\n        \"\"\"Wraps all the operations to balance the filesystem.\n\n        \"\"\"\n        # Balancing data\n        balance_filesystem(\n            BTRFS_BALANCE_DATA_USAGE_FILTER,\n            self.__data_percentage,\n            self.__mounted_point)\n        # Balancing metadata\n        balance_filesystem(\n            BTRFS_BALANCE_METADATA_USAGE_FILTER,\n            self.__metadata_percentage,\n            self.__mounted_point)\n\n    def on_show_one_window(self, one_window):\n        \"\"\"Emits a QT Signal to hide or show the rest of application windows.\n\n        Arguments:\n            one_window (boolean): Information window should be unique?.\n        \"\"\"\n        self.show_one_window.emit(one_window)\n\n    def on_refresh_filesystem_statistics(self):\n        \"\"\"Emits a QT Signal to refresh filesystem statistics in main window.\n\n        \"\"\"\n        self.refresh_filesystem_statistics.emit()\n"
  },
  {
    "path": "buttermanager/buttermanager/filesystem/snapshot.py",
    "content": "# -*- coding: utf-8 -*-\n#\n# Copyright 2018-2019 Eloy García Almadén <eloy.garcia.pca@gmail.com>\n#\n# This file is part of buttermanager.\n#\n# This program is free software: you can redistribute it and / or modify it\n# under the terms of the GNU General Public License as published by the\n# Free Software Foundation, version 3 of the License.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\n\"\"\"This module gathers all the operations related to BTRFS snapshots.\n\nIt provides also Snapshot class.\n\"\"\"\nfrom ..exception import exception\nfrom ..util import settings, utils\nfrom ..window import windows\nimport glob\nimport os\nimport shutil\nimport sys\nimport subprocess\nimport time\nfrom PyQt5.QtCore import QThread, pyqtSignal\n\n\n# Constants\nBTRFS_CREATE_SNAPSHOT_R_COMMAND = \"sudo -S btrfs subvolume snapshot -r\"\nBTRFS_CREATE_SNAPSHOT_RW_COMMAND = \"sudo -S btrfs subvolume snapshot\"\nBTRFS_DELETE_SNAPSHOT_COMMAND = \"sudo -S btrfs subvolume delete\"\nBTRFS_FIND_NEW_COMMAND = \"sudo -S btrfs subvolume find-new\"\nGRUB_BTRFS_COMMAND = \"sudo -S grub-mkconfig -o /boot/grub/grub.cfg\"\n\n\n# Classes\nclass Subvolume:\n    \"\"\"BTRFS Snapshot.\n\n    \"\"\"\n    # Constructor\n    def __init__(self, subvolume_origin, subvolume_dest, snapshot_name, snapshots_to_keep):\n        \"\"\" Constructor.\n\n        Arguments:\n            subvolume_origin (str): Full path to the subvolume.\n            subvolume_dest (str): Full path to the subvolume where all of the subvolumes created from origin are going\n            to be stored.\n            snapshot_name (str): Prefix for all the subvolumes created from origin\n            snapshots_to_keep (str): Number of snapshots to keep for this subvolume\n        \"\"\"\n        # Logger\n        self.__logger = utils.Logger(self.__class__.__name__).get()\n        self.subvolume_origin = subvolume_origin if subvolume_origin[-1] == '/' else subvolume_origin + '/'\n        self.subvolume_dest = subvolume_dest if subvolume_dest[-1] == '/' else subvolume_dest + '/'\n        self.snapshot_name = snapshot_name\n        self.snapshots_to_keep = int(snapshots_to_keep)\n        self.__current_date = time.strftime('%Y%m%d')\n\n    # Methods\n    # Private methods\n\n    # Public methods\n    def create_snapshot(self):\n        \"\"\"Creates a snapshot.\n\n        \"\"\"\n        info_message = \"Creating a read-only snapshot of {subvolume_origin} in {subvolume_dest}. \" \\\n                       \"Please wait...\".format(subvolume_origin=self.subvolume_origin,\n                                               subvolume_dest=self.subvolume_dest)\n        self.__logger.info(info_message)\n\n        # Checking how many snapshots are with the same name\n        snapshot_full_name = \"{snapshot_name}-{current_date}\".format(snapshot_name=self.snapshot_name,\n                                                                     current_date=self.__current_date)\n        snapshots_with_same_name = [file for file in os.listdir(self.subvolume_dest) if snapshot_full_name in file]\n\n        # Adding number to the full name\n        snapshot_full_name = \"{snapshot_full_name}-{number}\".format(snapshot_full_name=snapshot_full_name,\n                                                                    number=len(snapshots_with_same_name))\n        # Checks if grub-btrfs integration is enabled\n        if settings.properties_manager.get_property(\"grub_btrfs\"):\n            # Checks if /etc/fstab is in subvolume_origin\n            fstab_path = self.subvolume_origin + 'etc/fstab'\n            if os.path.isfile(fstab_path):\n                everything_ok = True\n                # /etc/fstab is in the subvolume, so it is necessary to\n                # modify it and add the snapshot's name\n                # grep -rnw '/etc/fstab' -e \"/_active/rootvol\"\n                # First, it is necessary to obtain the original subvolume\n                # for / which is mounted in the system (subvolume_origin_real)\n                subvolume_origin_real = None\n                command_string = \"\"\"sudo btrfs subvolume show /\"\"\"\n                command = [command_string]\n                commandline_output = None\n                try:\n                    commandline_output = subprocess.check_output(command, shell=True)\n                except subprocess.CalledProcessError as called_process_error_exception:\n                    self.__logger.error(\"Error retrieving the real and mounted subvolume for / . Reason: \" +\n                                        str(called_process_error_exception.reason))\n                    everything_ok = False\n                if everything_ok:\n                    commandline_output = commandline_output.decode('utf-8')\n                    for line_output in commandline_output.split(\"\\n\"):\n                        # The original subvolume mounted for / will be always the first line\n                        # of the output\n                        subvolume_origin_real = line_output\n                        break\n\n                    # Creating the snapshot in rw mode\n                    command = \"{command} {subvolume_origin} {subvolume_dest}{snapshot_full_name}\".format(\n                        command=BTRFS_CREATE_SNAPSHOT_RW_COMMAND,\n                        subvolume_origin=self.subvolume_origin,\n                        subvolume_dest=self.subvolume_dest,\n                        snapshot_full_name=snapshot_full_name\n                    )\n                    utils.execute_command(command, console=True, root=True)\n\n                    # Obtaining the real subvolume for the new snapshot created\n                    subvolume_snapshot_created_real = None\n                    command_string = \"\"\"sudo btrfs subvolume show {subvolume_dest}{snapshot_full_name}\"\"\".format(\n                        subvolume_dest=self.subvolume_dest,\n                        snapshot_full_name=snapshot_full_name\n                    )\n                    command = [command_string]\n                    commandline_output = None\n                    try:\n                        commandline_output = subprocess.check_output(command, shell=True)\n                    except subprocess.CalledProcessError as called_process_error_exception:\n                        self.__logger.error(\"Error retrieving the real subvolume for snapshot created. Reason: \" +\n                                            str(called_process_error_exception.reason))\n\n                    commandline_output = commandline_output.decode('utf-8')\n                    for line_output in commandline_output.split(\"\\n\"):\n                        # The original subvolume mounted for / will be always the first line\n                        # of the output\n                        subvolume_snapshot_created_real = line_output\n                        break\n\n                    # Getting the line in fstab where it is necessary to substitute the subvolume which is going to be\n                    # mounted as root. It is necessary to discard all the lines with comments in fstab starting with '#'\n                    command_string = \"\"\"grep -rnw '{fstab_path}' -e '{subvolume_origin_real}'\"\"\".format(\n                        fstab_path=fstab_path, subvolume_origin_real=subvolume_origin_real)\n                    command = [command_string]\n                    commandline_output = None\n                    try:\n                        commandline_output = subprocess.check_output(command, shell=True)\n                    except subprocess.CalledProcessError:\n                        pass\n                    commandline_output = commandline_output.decode('utf-8')\n                    # line will be the line where grep has matched subvolume_origin_real. All lines commented with '#'\n                    # will be discarded\n                    line = \"0\"\n                    for line_output in commandline_output.split(\"\\n\"):\n                        line_splitted = line_output.split(':')\n                        # First element of the list will be the line where subvolume_origin_real has been matched by\n                        # grep command. If the second element is '#', this line is commented in fstab and it won't be\n                        # taken into account\n                        if not line_splitted[1].startswith('#'):\n                            line = line_splitted[0]\n                            break\n\n                    command_string = \"\"\"sudo -S sed -i '{line}s|{subvolume_origin_real}|{subvolume_snapshot_created_real}|g' {subvolume_dest}{snapshot_full_name}/etc/fstab\"\"\".format(\n                        line=line,\n                        subvolume_origin_real=subvolume_origin_real,\n                        subvolume_snapshot_created_real=subvolume_snapshot_created_real,\n                        subvolume_dest=self.subvolume_dest,\n                        snapshot_full_name=snapshot_full_name\n                    )\n                    command = [command_string]\n                    try:\n                        subprocess.check_output(command, shell=True)\n                    except subprocess.CalledProcessError as called_process_error_exception:\n                        self.__logger.error(\"Error trying to substitute the root's path in fstab with the \"\n                                            \"path of the new snapshot created. Reason: \" +\n                                            str(called_process_error_exception.reason))\n                        everything_ok = False\n                    if everything_ok:\n                        # subvolume_origin_real will be stored in configuration file in order to let the\n                        # user to consolidate the system's rollback to any snapshot different from the main one\n                        settings.properties_manager.set_property('path_to_consolidate_root_snapshot',\n                                                                      subvolume_origin_real)\n\n                        # Run grub-btrfs in order to regenerate GRUB entries\n                        self.__logger.info(\"Regenerating GRUB entries. Please wait...\")\n                        utils.execute_command(GRUB_BTRFS_COMMAND, console=True, root=True)\n\n                else:\n                    # The original subvolume mounted for / couldn't be found\n                    # Snapshot won't be created\n                    self.__logger.error(\"The original subvolume mounted for / couldn't be found. \"\n                                        \"Snapshot won't be created: \")\n                    pass\n\n            else:\n                command = \"{command} {subvolume_origin} {subvolume_dest}{snapshot_full_name}\".format(\n                    command=BTRFS_CREATE_SNAPSHOT_R_COMMAND,\n                    subvolume_origin=self.subvolume_origin,\n                    subvolume_dest=self.subvolume_dest,\n                    snapshot_full_name=snapshot_full_name\n                )\n                utils.execute_command(command, console=True, root=True)\n        else:\n            command = \"{command} {subvolume_origin} {subvolume_dest}{snapshot_full_name}\".format(\n                command=BTRFS_CREATE_SNAPSHOT_R_COMMAND,\n                subvolume_origin=self.subvolume_origin,\n                subvolume_dest=self.subvolume_dest,\n                snapshot_full_name=snapshot_full_name\n            )\n            utils.execute_command(command, console=True, root=True)\n\n    def delete_snapshots(self):\n        \"\"\"Deletes (or not if user has defined it) all the snapshots needed to keep the desired number set by the user.\n        It will delete the related logs if they exist\n\n        \"\"\"\n        info_message = \"Deleting snapshot of {subvolume_origin} in {subvolume_dest}. \" \\\n                       \"Please wait...\".format(subvolume_origin=self.subvolume_origin,\n                                               subvolume_dest=self.subvolume_dest)\n        self.__logger.info(info_message)\n\n        # If user has selected not delete any snapshot, this operation won't be done\n        if self.snapshots_to_keep > -1:\n            # Checking how many snapshots are with the same name ordered by date\n            snapshots = self.get_all_snapshots_with_the_same_name()\n\n            # Removing all the snapshots needed starting with the oldest one until reach\n            # the limit defined by the user\n            snapshots_to_delete = len(snapshots) - self.snapshots_to_keep\n            index = 0\n            while snapshots_to_delete > 0:\n                # Deletes the snapshot\n                command = \"{command} {snapshot}\".format(command=BTRFS_DELETE_SNAPSHOT_COMMAND,\n                                                        snapshot=snapshots[index])\n                utils.execute_command(command, console=True, root=True)\n                info_message = \"Snapshot {snapshot} deleted.\\n\".format(snapshot=snapshots[index])\n                self.__logger.info(info_message)\n                # Deletes the log if it exists\n                snapshot_name = snapshots[index].split(\"/\")[-1]\n                log = \"{snapshot_name}-{index}.txt\".format(snapshot_name=snapshot_name.split(\"-\")[-2],\n                                                           index=snapshot_name.split(\"-\")[-1])\n                log_path = os.path.join(settings.logs_path, log)\n                if os.path.exists(log_path):\n                    try:\n                        os.remove(log_path)\n                        info_message = \"Log {log} deleted.\\n\".format(log=log)\n                        self.__logger.info(info_message)\n                    except OSError as os_error_exception:\n                        info_message = \"Error deleting log {log}. Error {exception}\\n\".format(log=log,\n                                                                                              exception=str(\n                                                                                                  os_error_exception))\n                        self.__logger.info(info_message)\n                else:\n                    info_message = \"Log {log} doesn't exist. Skipping...deleted.\\n\".format(log=log)\n                    self.__logger.info(info_message)\n\n                snapshots_to_delete -= 1\n                index += 1\n\n            # Checks if grub-btrfs integration is enabled\n            if settings.properties_manager.get_property(\"grub_btrfs\"):\n                # Run grub-btrfs in order to regenerate GRUB entries\n                utils.execute_command(GRUB_BTRFS_COMMAND, console=True, root=True)\n\n    def delete_origin(self):\n        \"\"\"Deletes the original subvolume, i.e. the subvolume in subvolume_origin\n\n        \"\"\"\n        info_message = \"Deleting subvolume from origin {subvolume_origin}. \" \\\n                       \"Please wait...\".format(subvolume_origin=self.subvolume_origin)\n        self.__logger.info(info_message)\n        errors = False\n\n        # Deletes the subvolume\n        command_string = \"{command} {snapshot}\".format(command=BTRFS_DELETE_SNAPSHOT_COMMAND,\n                                                       snapshot=self.subvolume_origin)\n        command = [command_string]\n        commandline_output = None\n        try:\n            # This is a special way for executing a command using Python:\n            # shell=True allows the execution of complex shell commands\n            # stdout=subprocess.PIPE captures the output generated by the command\n            # stderr=subprocess.STDOUT captures the errors generated by the command and redirects them to stdout\n            commandline_output = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)\n            commandline_output = commandline_output.stdout.decode('utf-8')\n        except subprocess.CalledProcessError:\n            pass\n\n        for line in commandline_output.split(\"\\n\"):\n            if 'Directory not empty' in line:\n                errors = True\n                break\n        if errors:\n            # Subvolume is not empty so it can't be deleted. Exception is thrown\n            raise exception.BtrfsSnapshotDeletion(\"Error: {snapshot} is not empty.\\n\".\n                                                            format(snapshot=self.subvolume_origin))\n        else:\n            info_message = \"Snapshot {snapshot} deleted.\\n\".format(snapshot=self.subvolume_origin)\n            self.__logger.info(info_message)\n\n    def get_all_snapshots_with_the_same_name(self):\n        \"\"\"Retrieves all the snapshots with name self.snapshot_name stored within self.subvolume_dest.\n\n        Returns:\n            list (:obj:`list` of :obj:`str`): paths to the snapshots.\n        \"\"\"\n        # Checking how many snapshots are with the same name ordered by date\n        snapshots = glob.glob(\"{snapshot_directory}/*\".format(snapshot_directory=self.subvolume_dest))\n        snapshots.sort(key=os.path.getmtime)\n        snapshots_whit_same_name = [file for file in snapshots if self.snapshot_name in file]\n\n        return snapshots_whit_same_name\n\n\nclass RootSnapshotChecker:\n    \"\"\"Checks if the current snapshot used for root is the default or the user has booted the system from\n    an alternate snapshot.\n\n    \"\"\"\n    def __init__(self, parent_window):\n        # Attributes\n        self.__snapshot_to_clone_in_root_full_path = None\n        self.__root_subvolume = None\n        # Logger\n        self.__logger = utils.Logger(self.__class__.__name__).get()\n        self.__logger.info(\"Checking if the current snapshot used for root is the default. Please wait...\")\n        self.__parent_window = parent_window\n\n    def check_root_snapshot(self):\n        \"\"\"Checks if the current snapshot used for root is the default or the user has booted the system from\n        an alternate snapshot.\n\n        Returns:\n            boolean: true if current snapshot used for root is the default or this paramenter has not been stored yet;\n                     false otherwise.\n        \"\"\"\n        # First, it is necessary to check if path_to_consolidate_root_snapshot is defined\n        if settings.properties_manager.get_property(\"path_to_consolidate_root_snapshot\") != 0:\n            # Obtaining the mounted subvolume for root partition\n            # mount | grep 'on / ' | grep -o 'subvol=/.*' | cut -f2- -d=\n            command_string = \"\"\"mount | grep 'on / ' | grep -o 'subvol=/.*' | cut -f2- -d=\"\"\"\n            command = [command_string]\n            mounted_snapshot_raw = None\n            try:\n                mounted_snapshot_raw = subprocess.check_output(command, shell=True)\n            except subprocess.CalledProcessError:\n                pass\n            if mounted_snapshot_raw:\n                # Removing the last two characters (a /n and a \")\")\n                mounted_snapshot_raw = mounted_snapshot_raw[:-2]\n                # Converting bytes into string\n                mounted_snapshot_raw = mounted_snapshot_raw.decode(\"utf-8\")\n                # Removing first / if path_to_consolidate_root_snapshot doesn't start with /\n                if not settings.properties_manager.get_property(\"path_to_consolidate_root_snapshot\")\\\n                        .startswith(\"/\"):\n                    mounted_snapshot_raw = mounted_snapshot_raw[1:]\n            if mounted_snapshot_raw != settings.properties_manager. \\\n                    get_property(\"path_to_consolidate_root_snapshot\"):\n                # If mounted snapshot is different from the supposed default root subvolume\n                # it means that user has booted the system using an alternate snapshot from GRUB.\n                # ButterManager will ask to consolidate the current snapshot as the default root\n                # subvolume\n\n                # Obtaining the snapshot mounted\n                mounted_snapshot_full_path = None\n                while mounted_snapshot_full_path is None:\n                    for subvolume in settings.subvolumes:\n                        snapshots = settings.subvolumes[subvolume].get_all_snapshots_with_the_same_name()\n                        for snapshot in snapshots:\n                            if mounted_snapshot_raw in snapshot:\n                                mounted_snapshot_full_path = snapshot\n                                break\n                        if mounted_snapshot_full_path is not None:\n                            break\n\n                self.__snapshot_to_clone_in_root_full_path = mounted_snapshot_full_path\n                self.__root_subvolume = settings.subvolumes[subvolume]\n                return False\n            else:\n                return True\n        else:\n            # Path to consolidate root snapshot hasn't been defined yet so this check is skipped\n            return True\n\n    def open_consolidate_snapshot_window(self):\n        \"\"\"Checks if the current snapshot used for root is the default or the user has booted the system from\n        an alternate snapshot.\n\n        Returns:\n            QDialog: The dialog window to consolidate the root snapshot.\n        \"\"\"\n        info_window = windows.ConsolidateSnapshotWindow(self.__parent_window,\n                                                               self.__snapshot_to_clone_in_root_full_path,\n                                                               self.__root_subvolume)\n        return info_window\n\n\nclass Differentiator(QThread):\n    \"\"\"Independent thread that will calculate the differences between a snapshot and its current state.\n\n    \"\"\"\n    # Constants\n    DIFFS_DIR = \"diffs\"\n    DIFF_COMMAND = \"sudo -S diff -qr\"\n    MODIFIED_FILE = \"modified.txt\"\n    OPERATION_FULL = \"full_operation\"\n    OPERATION_PARTIAL = \"partial_operation\"\n\n    # Attributes\n    # pyqtSignal that will be emitted when this class requires to display\n    # a single information window on the screen\n    show_one_window = pyqtSignal('bool')\n\n    # Constructor\n    def __init__(self, snapshot_full_path, operation_type):\n        QThread.__init__(self)\n        self.__snapshot_full_path = snapshot_full_path\n        self.__snapshot_name = snapshot_full_path.split(\"/\")[-1]\n        self.__operation_type = operation_type\n\n    # Methods\n    def run(self):\n        # Main window will be hidden\n        self.on_show_one_window(True)\n        info_dialog = windows.InfoWindow(None, \"Calculating differences in\\n\"\n                                                      \"'{snapshot_name}'.\\n\"\n                                                      \"Please, be patient. This process\\n\"\n                                                      \"can take several minutes. This\\n\"\n                                                      \"window will be closed when the\\n\"\n                                                      \"operation is done. Calculating...\"\n                                                      .format(snapshot_name=self.__snapshot_full_path))\n        # Displaying info window\n        info_dialog.show()\n\n        # Calculates differences\n        self.__calculate_differences()\n\n        # Hiding info window\n        info_dialog.hide()\n\n        # Main window will be shown again\n        self.on_show_one_window(False)\n\n    def __calculate_differences(self):\n        \"\"\"Wraps all the operations to calculate differences.\n\n        \"\"\"\n        # Gets the subvolume of the snapshot\n        subvolume = get_subvolume_by_snapshot_name(self.__snapshot_full_path)\n\n        if subvolume:\n            # Creating a directory to store all the diff files generated if it doesn't exist\n            # or removing and creating it if it existed\n            diffs_path = os.path.join(settings.application_path, self.DIFFS_DIR, self.__snapshot_name)\n\n            if os.path.exists(diffs_path):\n                shutil.rmtree(diffs_path)\n\n            os.makedirs(diffs_path)\n\n            # Getting the current subvolune name. This subvolume is the current one which is going to be\n            # used for the comparison. It is needed to remove all the empty strings within the list\n            subvolume_name_list = subvolume.subvolume_origin.split(\"/\")\n            cleaned_subvolume_name_list = list(filter(None, subvolume_name_list))\n            if not cleaned_subvolume_name_list:\n                subvolume_name = \"original\"\n            else:\n                subvolume_name = cleaned_subvolume_name_list[-1]\n\n            if self.__operation_type == self.OPERATION_FULL:\n                # Full operation\n                # Creating 3 different files to store differences\n                files_only_in_dir1_path = os.path.join(diffs_path, \"{file_name}.txt\".format(file_name=subvolume_name))\n                files_only_in_dir2_path = os.path.join(diffs_path, \"{file_name}.txt\".format(\n                    file_name=self.__snapshot_name))\n                files_in_both_modified_path = os.path.join(diffs_path, self.MODIFIED_FILE)\n                files_only_in_dir1 = open(files_only_in_dir1_path, \"w+\")\n                files_only_in_dir2 = open(files_only_in_dir2_path, \"w+\")\n                files_in_both_modified = open(files_in_both_modified_path, \"w+\")\n\n                files_in_both_modified.write(\"Files in both snapshots that have been modified\" + \"\\r\\n\\r\\n\")\n                files_only_in_dir1.write(\"Files only in ${dir}\".format(dir=subvolume.subvolume_origin) + \"\\r\\n\\r\\n\")\n                files_only_in_dir2.write(\"Files only in ${dir}\".format(dir=self.__snapshot_full_path) + \"\\r\\n\\r\\n\")\n\n                # Calculating differences\n                command = \"{command} {dir1} {dir2}\".format(command=self.DIFF_COMMAND, dir1=subvolume.subvolume_origin,\n                                                           dir2=self.__snapshot_full_path)\n                echo = subprocess.Popen(['echo', settings.user_password], stdout=subprocess.PIPE)\n                result = subprocess.Popen(command.split(), stdin=echo.stdout, stdout=subprocess.PIPE)\n\n                for line in iter(result.stdout.readline, b''):\n                    line_decoded = line.decode('utf-8')\n                    if \" differ\" in line_decoded:\n                        file_modified_splitted = line_decoded.split(\n                            \"Files {path}\".format(path=subvolume.subvolume_origin))\n                        file_modified = \"/\" + file_modified_splitted[1].split(\" \")[0]\n                        files_in_both_modified.write(file_modified + \"\\r\\n\")\n                    elif \"Only in {dir1}\".format(dir1=subvolume.subvolume_origin) in line_decoded:\n                        file_only_in_dir1_splitted = line_decoded.split(\"Only in {path}\".format(\n                            path=subvolume.subvolume_origin))\n                        file_only_in_dir1_splitted = file_only_in_dir1_splitted[1].split(\":\")\n                        file_name = file_only_in_dir1_splitted[1].strip()\n                        file_only_in_dir1 = \"/\" + file_only_in_dir1_splitted[0] + \"/\" + file_name\n                        files_only_in_dir1.write(file_only_in_dir1 + \"\\r\\n\")\n                    elif \"Only in {dir2}\".format(dir2=self.__snapshot_full_path) in line_decoded:\n                        file_only_in_dir2_splitted = line_decoded.split(\"Only in {path}\".format(\n                            path=self.__snapshot_full_path))\n                        file_only_in_dir2_splitted = file_only_in_dir2_splitted[1].split(\":\")\n                        file_name = file_only_in_dir2_splitted[1].strip()\n                        file_only_in_dir2 = file_only_in_dir2_splitted[0] + \"/\" + file_name\n                        files_only_in_dir2.write(file_only_in_dir2 + \"\\r\\n\")\n                # Closing files\n                files_only_in_dir1.close()\n                files_only_in_dir2.close()\n                files_in_both_modified.close()\n\n                # Opening the file with the default application installed in the OS\n                # Warning, xdg-open is not working executing the code from PyCharm so\n                # it seems it doesn't work but it is really working\n                subprocess.call(['xdg-open', files_only_in_dir1_path])\n                subprocess.call(['xdg-open', files_only_in_dir2_path])\n                subprocess.call(['xdg-open', files_in_both_modified_path])\n\n            else:\n                # Partial operation\n                # Creating only one file to store differences\n                temp_sorted_modified_path = os.path.join(diffs_path, \"tmp.txt\")\n                temp_sorted_modified = open(temp_sorted_modified_path, \"w+\")\n\n                # Calculating differences\n                # sudo btrfs subvolume find-new /mnt/defvol/_snapshots/root-20201021-0/  '9999999'\n                # sudo btrfs subvolume find-new /mnt/defvol/_active/rootvol/ 463579 | sed '$d' | cut -f17- -d' ' |\n                # sort | uniq\n\n                # First, old transid is calculated. This ID will be used as a reference for the comparison\n                transid = \"9999999\"\n                command = \"{command} {dir1} {transid}\".format(command=BTRFS_FIND_NEW_COMMAND,\n                                                              dir1=self.__snapshot_full_path, transid=transid)\n                echo = subprocess.Popen(['echo', settings.user_password], stdout=subprocess.PIPE)\n                result = subprocess.Popen(command.split(), stdin=echo.stdout, stdout=subprocess.PIPE)\n\n                for line in iter(result.stdout.readline, b''):\n                    line_decoded = line.decode('utf-8')\n                    line_splitted = line_decoded.split(\" \")\n                    transid = line_splitted[-1].strip()\n\n                # Then, the differences are obtained using transid\n                command = \"{command} {dir1} {transid}\".format(\n                    command=BTRFS_FIND_NEW_COMMAND,\n                    dir1=subvolume.subvolume_origin,\n                    transid=transid)\n                echo = subprocess.Popen(['echo', settings.user_password], stdout=subprocess.PIPE)\n                result = subprocess.Popen(command.split(), stdin=echo.stdout, stdout=subprocess.PIPE)\n\n                temp_sorted_modified.write(\"- Files in both snapshots that have been modified\" + \"\\r\\n\")\n\n                for line in iter(result.stdout.readline, b''):\n                    line_decoded = line.decode('utf-8')\n                    line_splitted = line_decoded.split(\" \")\n                    file_modified = \"/\" + line_splitted[-1].strip()\n                    temp_sorted_modified.write(file_modified + \"\\r\\n\")\n\n                # Closing file\n                temp_sorted_modified.close()\n\n                # Sorting file\n                files_in_both_modified_path = os.path.join(diffs_path, self.MODIFIED_FILE)\n                files_in_both_modified = open(files_in_both_modified_path, \"w+\")\n                command = \"sort {file}\".format(file=temp_sorted_modified_path)\n                subprocess.Popen(command.split(), stdout=files_in_both_modified)\n\n                # Opening the file with the default application installed in the OS\n                # Warning, xdg-open is not working executing the code from PyCharm so\n                # it seems it doesn't work but it is really working\n                subprocess.call(['xdg-open', files_in_both_modified_path])\n\n    def on_show_one_window(self, one_window):\n        \"\"\"Emits a QT Signal to hide or show the rest of application windows.\n\n        Arguments:\n            one_window (boolean): Information window should be unique?.\n        \"\"\"\n        self.show_one_window.emit(one_window)\n\n\n# Module's methods\ndef delete_specific_snapshot(snapshot_full_path):\n    \"\"\"Deletes a specific snapshot.\n    It will delete the specific log related if it exists too.\n\n    Arguments:\n        snapshot_full_path (string): path to the snapshot that user wants to delete.\n\n    \"\"\"\n    # Logger\n    logger = utils.Logger(sys.modules['__main__'].__file__).get()\n    info_message = \"Deleting snapshot {snapshot}\".format(snapshot=snapshot_full_path)\n    logger.info(info_message)\n\n    command = \"{command} {snapshot}\".format(command=BTRFS_DELETE_SNAPSHOT_COMMAND, snapshot=snapshot_full_path)\n    utils.execute_command(command, root=True)\n    info_message = \"Snapshot {snapshot} deleted.\\n\".format(snapshot=snapshot_full_path)\n    logger.info(info_message)\n\n    # Checks if grub-btrfs integration is enabled\n    if settings.properties_manager.get_property(\"grub_btrfs\"):\n        # Run grub-btrfs in order to regenerate GRUB entries\n        utils.execute_command(GRUB_BTRFS_COMMAND, console=True, root=True)\n        info_message = \"Regenerating GRUB entries. Please wait...\"\n        logger.info(info_message)\n\n    # Deletes the log if it exists\n    snapshot_name = snapshot_full_path.split(\"/\")[-1]\n    log = \"{snapshot_name}-{index}.txt\".format(snapshot_name=snapshot_name.split(\"-\")[-2],\n                                               index=snapshot_name.split(\"-\")[-1])\n    log_path = os.path.join(settings.logs_path, log)\n    if os.path.exists(log_path):\n        try:\n            os.remove(log_path)\n            info_message = \"Log {log} deleted.\\n\".format(log=log)\n            logger.info(info_message)\n        except OSError as os_error_exception:\n            info_message = \"Error deleting log {log}. Error {exception}\\n\".format(log=log,\n                                                                                  exception=str(os_error_exception))\n            logger.info(info_message)\n    else:\n        info_message = \"Log {log} doesn't exist. Skipping...deleted.\\n\".format(log=log)\n        logger.info(info_message)\n\n\ndef get_subvolume_by_snapshot_name(snapshot_name):\n    \"\"\"Gets a subvolume object using the name of the snapshot.\n\n    Arguments:\n        snapshot_name (string): name of the snapshot.\n\n        Returns:\n            Subvolume: The subvolume which belongs the snapshot. None if subvolume was not found.\n    \"\"\"\n    # Logger\n    logger = utils.Logger(sys.modules['__main__'].__file__).get()\n    info_message = \"Getting subvolume from snapshot's name {snapshot_name}\".format(snapshot_name=snapshot_name)\n    logger.info(info_message)\n\n    subvolume_found = None\n\n    for subvolume_key in settings.subvolumes:\n        subvolume = settings.subvolumes[subvolume_key]\n        subvolume_snapshots_prefix = \"{subvolume_dest}{subvolume_prefix}\".format(\n            subvolume_dest=subvolume.subvolume_dest,\n            subvolume_prefix=subvolume.snapshot_name)\n        if snapshot_name.startswith(subvolume_snapshots_prefix):\n            info_message = \"Found subvolume {subvolume}\".format(subvolume=subvolume.subvolume_origin)\n            logger.info(info_message)\n            subvolume_found = subvolume\n    return subvolume_found\n"
  },
  {
    "path": "buttermanager/buttermanager/manager/__init__.py",
    "content": ""
  },
  {
    "path": "buttermanager/buttermanager/manager/upgrader.py",
    "content": "# -*- coding: utf-8 -*-\n#\n# Copyright 2018-2019 Eloy García Almadén <eloy.garcia.pca@gmail.com>\n#\n# This file is part of buttermanager.\n#\n# This program is free software: you can redistribute it and / or modify it\n# under the terms of the GNU General Public License as published by the\n# Free Software Foundation, version 3 of the License.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\n\"\"\"This module gathers all the managers built for the application.\n\n\"\"\"\nfrom .. import manager\nfrom ..util import settings, utils\nimport sys\nimport urllib.request\nfrom PyQt5.QtCore import QThread, pyqtSignal\nfrom urllib.error import URLError\n\n# Constants\nARCH_PACMAN_REFRESH_REPOSITORIES = \"sudo -S pacman -Sy\"\nARCH_PACMAN_CHECK_UPDATES = \"sudo -S pacman -Qu\"\nARCH_PACMAN_UPGRADE_COMMAND = \"sudo -S pacman -Syu --noconfirm\"\nDEBIAN_APT_UPDATE_COMMAND = \"sudo -S apt update\"\nDEBIAN_APT_UPGRADE_COMMAND = \"sudo -S apt upgrade -y\"\nDEBIAN_APT_CHECK_UPDATES = \"sudo -S apt list --upgradable\"\nARCH_YAOURT_UPGRADE_COMMAND = \"yaourt -Syua --noconfirm\"\nARCH_YAOURT_COMMAND = \"yaourt\"\nARCH_YAY_UPGRADE_COMMAND = \"yay -Syua --noconfirm\"\nARCH_YAY_COMMAND = \"yay\"\nARCH_TRIZEN_UPGRADE_COMMAND = \"trizen -Syua --noconfirm\"\nARCH_TRIZEN_COMMAND = \"trizen\"\nSNAP_COMMAND = \"snap\"\nFLATPAK_COMMAND = \"flatpak\"\nSNAP_UPGRADE_COMMAND = \"sudo -S snap refresh\"\nFLATPAK_UPGRADE_COMMAND = \"flatpak update -y\"\nSUSE_ZYPPER_UPGRADE_COMMAND = \"sudo -S zypper -n update\"\nSUSE_ZYPPER_CHECK_UPDATES = \"sudo -S zypper list-updates\"\nFEDORA_DNF_UPGRADE_COMMAND = \"sudo -S dnf upgrade --refresh --assumeyes\"\nFEDORA_DNF_CHECK_UPDATES = \"sudo -S dnf check-update\"\n\n\nclass Upgrader(QThread):\n    \"\"\"Independent thread that will run the system upgrading process.\n\n    \"\"\"\n    # Attributes\n\n    # pyqtSignal that will be emitted when this class requires that main\n    # window disables all the buttons\n    disable_buttons = pyqtSignal()\n\n    # pyqtSignal that will be emitted when this class requires that main\n    # window enables all the buttons\n    enable_buttons = pyqtSignal()\n\n    # pyqtSignal that will be emitted when this class requires that main\n    # window refreshes GUI\n    refresh_gui = pyqtSignal()\n\n    # Constructor\n    def __init__(self, include_aur, include_snap, include_flatpak, snapshots):\n        QThread.__init__(self)\n        # Logger\n        self.__logger = utils.Logger(self.__class__.__name__).get()\n        # Include AUR packages upgrade\n        self.__include_aur = include_aur\n        # Include snap packages upgrade\n        self.__include_snap = include_snap\n        # Include flatpak packages upgrade\n        self.__include_flatpak = include_flatpak\n        # Create and delete snapshots\n        self.__snapshots = snapshots\n\n    # Methods\n    def run(self):\n        # Upgrading the system\n        self.__upgrade_system()\n\n    def __upgrade_system(self):\n        \"\"\"Wraps all the operations to upgrade the system.\n\n        \"\"\"\n        # Check for updates\n        if check_updates():\n            # There are system updates\n            # Starting the upgrading process. Disabling all the buttons.\n            self.on_disable_gui_buttons()\n\n            sys.stdout.write(\"\\n\")\n            sys.stdout.write(\"--------\")\n            sys.stdout.write(\"\\n\")\n            self.__logger.info(\"Starting system upgrading process.\")\n            sys.stdout.write(\"Starting system upgrading process. Please wait...\")\n            sys.stdout.write(\"\\n\")\n\n            # Creates all the snapshots needed before upgrading the system\n            # only if it is needed\n            if self.__snapshots:\n                sys.stdout.write(\"\\n\")\n                sys.stdout.write(\"--------\")\n                sys.stdout.write(\"\\n\")\n                sys.stdout.write(\"Creating snapshots and updating GRUB entries if it is necessary...\")\n                sys.stdout.write(\"\\n\")\n                sys.stdout.write(\"--------\")\n                sys.stdout.write(\"\\n\")\n                for snapshot in settings.subvolumes:\n                    try:\n                        settings.subvolumes[snapshot].create_snapshot()\n                    except Exception as exception:\n                        sys.stdout.write(\"\\n\")\n                        sys.stdout.write(\"--------\")\n                        sys.stdout.write(\"\\n\")\n                        sys.stdout.write(\"Error creating the snapshot \" +\n                                         settings.subvolumes[snapshot].subvolume_origin)\n                        sys.stdout.write(\"\\n\")\n                        sys.stdout.write(\"Error: \" + str(exception))\n                        sys.stdout.write(\"\\n\")\n                        sys.stdout.write(\"--------\")\n                        sys.stdout.write(\"\\n\")\n\n            # Upgrades the system\n            upgrading_command = \"\"\n            if settings.user_os == utils.OS_ARCH:\n                upgrading_command = ARCH_PACMAN_UPGRADE_COMMAND\n            elif settings.user_os == utils.OS_DEBIAN:\n                # First, it is necessary to update the system\n                sys.stdout.write(\"\\n\")\n                sys.stdout.write(\"--------\")\n                sys.stdout.write(\"\\n\")\n                sys.stdout.write(\"Updating the system. Please wait...\")\n                sys.stdout.write(\"\\n\")\n                utils.execute_command(DEBIAN_APT_UPDATE_COMMAND, console=True)\n                sys.stdout.write(\"\\n\")\n                upgrading_command = DEBIAN_APT_UPGRADE_COMMAND\n            elif settings.user_os == utils.OS_SUSE:\n                upgrading_command = SUSE_ZYPPER_UPGRADE_COMMAND\n            elif settings.user_os == utils.OS_FEDORA:\n                upgrading_command = FEDORA_DNF_UPGRADE_COMMAND\n\n            if upgrading_command:\n                try:\n                    sys.stdout.write(\"Upgrading the system. Please wait...\")\n                    sys.stdout.write(\"\\n\")\n                    utils.execute_command(upgrading_command, console=True)\n                except Exception as exception:\n                    sys.stdout.write(\"\\n\")\n                    sys.stdout.write(\"--------\")\n                    sys.stdout.write(\"\\n\")\n                    sys.stdout.write(\"Error upgrading the system\")\n                    sys.stdout.write(\"\\n\")\n                    sys.stdout.write(\"Error: \" + str(exception))\n                    sys.stdout.write(\"\\n\")\n                    sys.stdout.write(\"--------\")\n                    sys.stdout.write(\"\\n\")\n\n            # Upgrades AUR if distro is ArchLinux or derivatives\n            if settings.user_os == utils.OS_ARCH:\n                if self.__include_aur:\n                    try:\n                        sys.stdout.write(\"\\n\")\n                        sys.stdout.write(\"--------\")\n                        sys.stdout.write(\"\\n\")\n                        sys.stdout.write(\"Updating AUR packages if it is needed. Please wait...\")\n                        sys.stdout.write(\"\\n\")\n                        if utils.exist_program(ARCH_YAY_COMMAND):\n                            utils.execute_command(ARCH_YAY_UPGRADE_COMMAND, console=True)\n                        elif utils.exist_program(ARCH_TRIZEN_COMMAND):\n                            utils.execute_command(ARCH_TRIZEN_UPGRADE_COMMAND, console=True)\n                        elif utils.exist_program(ARCH_YAOURT_COMMAND):\n                            utils.execute_command(ARCH_YAOURT_UPGRADE_COMMAND, console=True)\n                    except Exception as exception:\n                        sys.stdout.write(\"\\n\")\n                        sys.stdout.write(\"--------\")\n                        sys.stdout.write(\"\\n\")\n                        sys.stdout.write(\"Error upgrading AUR packages\")\n                        sys.stdout.write(\"\\n\")\n                        sys.stdout.write(\"Error: \" + str(exception))\n                        sys.stdout.write(\"\\n\")\n                        sys.stdout.write(\"--------\")\n                        sys.stdout.write(\"\\n\")\n\n            # Upgrades snap packages\n            if self.__include_snap:\n                if utils.exist_program(SNAP_COMMAND):\n                    try:\n                        sys.stdout.write(\"\\n\")\n                        sys.stdout.write(\"--------\")\n                        sys.stdout.write(\"\\n\")\n                        sys.stdout.write(\"Updating snap applications. Please wait...\")\n                        sys.stdout.write(\"\\n\")\n                        utils.execute_command(SNAP_UPGRADE_COMMAND, console=True)\n                    except Exception as exception:\n                        sys.stdout.write(\"\\n\")\n                        sys.stdout.write(\"--------\")\n                        sys.stdout.write(\"\\n\")\n                        sys.stdout.write(\"Error upgrading snap packages\")\n                        sys.stdout.write(\"\\n\")\n                        sys.stdout.write(\"Error: \" + str(exception))\n                        sys.stdout.write(\"\\n\")\n                        sys.stdout.write(\"--------\")\n                        sys.stdout.write(\"\\n\")\n\n            # Upgrades flatpak packages\n            if self.__include_flatpak:\n                if utils.exist_program(FLATPAK_COMMAND):\n                    try:\n                        sys.stdout.write(\"\\n\")\n                        sys.stdout.write(\"--------\")\n                        sys.stdout.write(\"\\n\")\n                        sys.stdout.write(\"Updating flatpak applications. Please wait...\")\n                        sys.stdout.write(\"\\n\")\n                        utils.execute_command(FLATPAK_UPGRADE_COMMAND, console=True)\n                    except Exception as exception:\n                        sys.stdout.write(\"\\n\")\n                        sys.stdout.write(\"--------\")\n                        sys.stdout.write(\"\\n\")\n                        sys.stdout.write(\"Error upgrading flatpak packages\")\n                        sys.stdout.write(\"\\n\")\n                        sys.stdout.write(\"Error: \" + str(exception))\n                        sys.stdout.write(\"\\n\")\n                        sys.stdout.write(\"--------\")\n                        sys.stdout.write(\"\\n\")\n\n            # Removes all the snapshots not needed any more it is needed\n            if self.__snapshots:\n                sys.stdout.write(\"\\n\")\n                sys.stdout.write(\"--------\")\n                sys.stdout.write(\"\\n\")\n                sys.stdout.write(\"Removing old snapshots if it is needed and updating GRUB entries. Please wait...\")\n                sys.stdout.write(\"\\n\")\n                for snapshot in settings.subvolumes:\n                    try:\n                        settings.subvolumes[snapshot].delete_snapshots()\n                    except Exception as exception:\n                        sys.stdout.write(\"\\n\")\n                        sys.stdout.write(\"--------\")\n                        sys.stdout.write(\"\\n\")\n                        sys.stdout.write(\"Error deleting the snapshot \" +\n                                         settings.subvolumes[snapshot].subvolume_origin)\n                        sys.stdout.write(\"\\n\")\n                        sys.stdout.write(\"Error: \" + str(exception))\n                        sys.stdout.write(\"\\n\")\n                        sys.stdout.write(\"--------\")\n                        sys.stdout.write(\"\\n\")\n\n            sys.stdout.write(\"\\n\")\n            sys.stdout.write(\"--------\")\n            sys.stdout.write(\"\\n\")\n            self.__logger.info(\"System upgrading process finished.\")\n            sys.stdout.write(\"System upgrading process finished. You can close the terminal output now.\")\n            sys.stdout.write(\"\\n\")\n            sys.stdout.write(\"\\n\")\n\n            # Refreshing GUI\n            self.on_refresh_gui()\n        else:\n            # There are not system updates\n            self.__logger.info(\"Your system is up to date.\")\n            sys.stdout.write(\"Your system is up to date. You can close the terminal output now.\")\n            sys.stdout.write(\"\\n\")\n            sys.stdout.write(\"\\n\")\n\n        # Finishing the upgrading process. Enabling all the buttons.\n        self.on_enable_gui_buttons()\n\n    def on_disable_gui_buttons(self):\n        \"\"\"Emits a QT Signal to disable all the buttons in main window.\n\n        \"\"\"\n        self.disable_buttons.emit()\n\n    def on_enable_gui_buttons(self):\n        \"\"\"Emits a QT Signal to enable all the buttons in main window.\n\n        \"\"\"\n        self.enable_buttons.emit()\n\n    def on_refresh_gui(self):\n        \"\"\"Emits a QT Signal to refresh filesystem statistics in main window.\n\n        \"\"\"\n        self.refresh_gui.emit()\n\n\nclass UpdatesChecker(QThread):\n    \"\"\"Independent thread that will run the system checking for updates.\n\n    \"\"\"\n    # Attributes\n\n    # pyqtSignal that will be emitted when this class requires that main\n    # window shows the updates window. The signal will emit an 'object' that,\n    # in hits case, will be a list of strings.\n    show_updates_window = pyqtSignal(object)\n\n    # Constructor\n    def __init__(self):\n        QThread.__init__(self)\n        # Logger\n        self.__logger = utils.Logger(self.__class__.__name__).get()\n\n    # Methods\n    def run(self):\n        # Checks for updates\n        self.__check_updates()\n\n    def __check_updates(self):\n        \"\"\"Wraps all the operations to check updates.\n\n        First, it will check Internet connectivity for doing the operation.\n        Emits a signal with the packages found. Otherwise, it won't emit this signal and\n        nothing will happen.\n\n        \"\"\"\n        # Checking Internet connection for 5 minutes\n        tries = 0\n        internet_available = self.__internet_available()\n\n        while (not internet_available) & (tries < 60):\n            self.__logger.info(\"Trying to reach Internet again. If there is no Internet connection in 5 minutes, this\"\n                               \"operation will be canceled\")\n            self.sleep(5)\n            internet_available = self.__internet_available()\n            tries += 1\n\n        # Checking updates only if Internet connection is available\n        if internet_available:\n            # Checking updates only if the user selected the option\n            if settings.check_at_startup == 1:\n                # Emmiting the signal only if there are updates\n                if manager.upgrader.check_updates():\n                    commandline_output = []\n                    if settings.user_os == utils.OS_ARCH:\n                        refresh_repositories_command = manager.upgrader.ARCH_PACMAN_REFRESH_REPOSITORIES\n                        utils.execute_command(refresh_repositories_command)\n                        check_for_updates_command = manager.upgrader.ARCH_PACMAN_CHECK_UPDATES\n                        commandline_output = utils.execute_command(check_for_updates_command)\n\n                    elif settings.user_os == utils.OS_DEBIAN:\n                        check_for_updates_command = manager.upgrader.DEBIAN_APT_CHECK_UPDATES\n                        commandline_output = utils.execute_command(check_for_updates_command)\n\n                    elif settings.user_os == utils.OS_SUSE:\n                        check_for_updates_command = manager.upgrader.SUSE_ZYPPER_CHECK_UPDATES\n                        commandline_output = utils.execute_command(check_for_updates_command)\n\n                    elif settings.user_os == utils.OS_FEDORA:\n                        check_for_updates_command = manager.upgrader.FEDORA_DNF_CHECK_UPDATES\n                        commandline_output = utils.execute_command(check_for_updates_command)\n\n                    # If there are updates, emits the signal thta will be captured in buttermanager.py\n                    self.show_updates_window.emit(commandline_output)\n        else:\n            self.__logger.error(\"Timeout. Checking updates process has been cancelled because there is no Intenert\"\n                                \" connection\")\n\n    def __internet_available(self):\n        \"\"\"Checks Internet connection.\n\n        Returns:\n            boolean: true if there is Internet connection available; false otherwise.\n        \"\"\"\n        self.__logger.info(\"Checking Internet connection. Please wait...\")\n        try:\n            urllib.request.urlopen('https://www.google.com', timeout=20)\n            self.__logger.info(\"Internet connection is available!\")\n            return True\n        except urllib.error.URLError as error:\n            self.__logger.error(\"Internet connection is not available... Error: {error}\".format(error=error))\n            return False\n\n\n# Module's methods\ndef check_updates():\n    \"\"\"Checks for updates.\n\n    Returns:\n        boolean: true if there are updates; false otherwise.\n    \"\"\"\n    # Logger\n    logger = utils.Logger(sys.modules['__main__'].__file__).get()\n    logger.info(\"Checking for system updates.\")\n    sys.stdout.write(\"Checking for system updates.\")\n    sys.stdout.write(\"\\n\")\n    sys.stdout.write(\"--------\")\n    sys.stdout.write(\"\\n\")\n\n    updates = False\n    if settings.user_os == utils.OS_ARCH:\n        refresh_repositories_command = ARCH_PACMAN_REFRESH_REPOSITORIES\n        utils.execute_command(refresh_repositories_command)\n        check_for_updates_command = ARCH_PACMAN_CHECK_UPDATES\n        commandline_output = utils.execute_command(check_for_updates_command)\n\n        for line in commandline_output.split(\"\\n\"):\n            if line:\n                updates = True\n\n    elif settings.user_os == utils.OS_DEBIAN:\n        check_for_updates_command = DEBIAN_APT_CHECK_UPDATES\n        commandline_output = utils.execute_command(check_for_updates_command)\n        lines = commandline_output.split(\"\\n\")\n        if len(lines) > 2:\n            updates = True\n\n    elif settings.user_os == utils.OS_SUSE:\n        check_for_updates_command = SUSE_ZYPPER_CHECK_UPDATES\n        commandline_output = utils.execute_command(check_for_updates_command)\n        lines = commandline_output.split(\"\\n\")\n        if len(lines) > 4:\n            updates = True\n\n    elif settings.user_os == utils.OS_FEDORA:\n        check_for_updates_command = FEDORA_DNF_CHECK_UPDATES\n        commandline_output = utils.execute_command(check_for_updates_command)\n        lines = commandline_output.split(\"\\n\")\n        if len(lines) > 2:\n            updates = True\n\n    else:\n        updates = True\n\n    return updates\n"
  },
  {
    "path": "buttermanager/buttermanager/ui/ConsolidateSnapshotWindow.ui",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>Dialog</class>\n <widget class=\"QDialog\" name=\"Dialog\">\n  <property name=\"geometry\">\n   <rect>\n    <x>0</x>\n    <y>0</y>\n    <width>424</width>\n    <height>300</height>\n   </rect>\n  </property>\n  <property name=\"windowTitle\">\n   <string>ButterManager</string>\n  </property>\n  <layout class=\"QVBoxLayout\" name=\"verticalLayout_2\">\n   <item>\n    <layout class=\"QVBoxLayout\" name=\"verticalLayout\">\n     <property name=\"leftMargin\">\n      <number>10</number>\n     </property>\n     <property name=\"topMargin\">\n      <number>10</number>\n     </property>\n     <property name=\"rightMargin\">\n      <number>10</number>\n     </property>\n     <property name=\"bottomMargin\">\n      <number>10</number>\n     </property>\n     <item>\n      <widget class=\"QLabel\" name=\"label_info\">\n       <property name=\"text\">\n        <string/>\n       </property>\n       <property name=\"alignment\">\n        <set>Qt::AlignCenter</set>\n       </property>\n      </widget>\n     </item>\n     <item>\n      <widget class=\"QDialogButtonBox\" name=\"button_box\">\n       <property name=\"orientation\">\n        <enum>Qt::Horizontal</enum>\n       </property>\n       <property name=\"standardButtons\">\n        <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>\n       </property>\n      </widget>\n     </item>\n    </layout>\n   </item>\n  </layout>\n </widget>\n <resources/>\n <connections/>\n</ui>\n"
  },
  {
    "path": "buttermanager/buttermanager/ui/GeneralInfoWindow.ui",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>Dialog</class>\n <widget class=\"QDialog\" name=\"Dialog\">\n  <property name=\"geometry\">\n   <rect>\n    <x>0</x>\n    <y>0</y>\n    <width>420</width>\n    <height>285</height>\n   </rect>\n  </property>\n  <property name=\"windowTitle\">\n   <string>ButterManager</string>\n  </property>\n  <layout class=\"QVBoxLayout\" name=\"verticalLayout_2\">\n   <item>\n    <layout class=\"QVBoxLayout\" name=\"verticalLayout\">\n     <property name=\"leftMargin\">\n      <number>10</number>\n     </property>\n     <property name=\"topMargin\">\n      <number>10</number>\n     </property>\n     <property name=\"rightMargin\">\n      <number>10</number>\n     </property>\n     <property name=\"bottomMargin\">\n      <number>10</number>\n     </property>\n     <item>\n      <widget class=\"QLabel\" name=\"label_info\">\n       <property name=\"text\">\n        <string/>\n       </property>\n       <property name=\"alignment\">\n        <set>Qt::AlignCenter</set>\n       </property>\n      </widget>\n     </item>\n     <item>\n      <widget class=\"QDialogButtonBox\" name=\"button_box\">\n       <property name=\"orientation\">\n        <enum>Qt::Horizontal</enum>\n       </property>\n       <property name=\"standardButtons\">\n        <set>QDialogButtonBox::Close</set>\n       </property>\n      </widget>\n     </item>\n    </layout>\n   </item>\n  </layout>\n </widget>\n <resources/>\n <connections/>\n</ui>\n"
  },
  {
    "path": "buttermanager/buttermanager/ui/InfoWindow.ui",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>Dialog</class>\n <widget class=\"QDialog\" name=\"Dialog\">\n  <property name=\"geometry\">\n   <rect>\n    <x>0</x>\n    <y>0</y>\n    <width>320</width>\n    <height>240</height>\n   </rect>\n  </property>\n  <property name=\"windowTitle\">\n   <string>ButterManager</string>\n  </property>\n  <layout class=\"QVBoxLayout\" name=\"verticalLayout_2\">\n   <item>\n    <layout class=\"QVBoxLayout\" name=\"verticalLayout\">\n     <property name=\"leftMargin\">\n      <number>10</number>\n     </property>\n     <property name=\"topMargin\">\n      <number>10</number>\n     </property>\n     <property name=\"rightMargin\">\n      <number>10</number>\n     </property>\n     <property name=\"bottomMargin\">\n      <number>10</number>\n     </property>\n     <item>\n      <widget class=\"QLabel\" name=\"label_info\">\n       <property name=\"layoutDirection\">\n        <enum>Qt::LeftToRight</enum>\n       </property>\n       <property name=\"autoFillBackground\">\n        <bool>false</bool>\n       </property>\n       <property name=\"text\">\n        <string>TextLabel</string>\n       </property>\n       <property name=\"alignment\">\n        <set>Qt::AlignCenter</set>\n       </property>\n      </widget>\n     </item>\n    </layout>\n   </item>\n  </layout>\n </widget>\n <resources/>\n <connections/>\n</ui>\n"
  },
  {
    "path": "buttermanager/buttermanager/ui/LogViewWindow.ui",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>LogViewWindow</class>\n <widget class=\"QMainWindow\" name=\"LogViewWindow\">\n  <property name=\"geometry\">\n   <rect>\n    <x>0</x>\n    <y>0</y>\n    <width>767</width>\n    <height>442</height>\n   </rect>\n  </property>\n  <property name=\"windowTitle\">\n   <string>ButterManager</string>\n  </property>\n  <widget class=\"QWidget\" name=\"centralwidget\">\n   <layout class=\"QVBoxLayout\" name=\"verticalLayout_2\">\n    <item>\n     <layout class=\"QVBoxLayout\" name=\"verticalLayout\">\n      <property name=\"leftMargin\">\n       <number>10</number>\n      </property>\n      <property name=\"topMargin\">\n       <number>10</number>\n      </property>\n      <property name=\"rightMargin\">\n       <number>10</number>\n      </property>\n      <property name=\"bottomMargin\">\n       <number>10</number>\n      </property>\n      <item>\n       <widget class=\"QLabel\" name=\"label_log\">\n        <property name=\"text\">\n         <string>Log details</string>\n        </property>\n       </widget>\n      </item>\n      <item>\n       <widget class=\"QTextEdit\" name=\"text_log\"/>\n      </item>\n     </layout>\n    </item>\n   </layout>\n  </widget>\n </widget>\n <resources/>\n <connections/>\n</ui>\n"
  },
  {
    "path": "buttermanager/buttermanager/ui/MainWindow.ui",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>MainWindow</class>\n <widget class=\"QMainWindow\" name=\"MainWindow\">\n  <property name=\"geometry\">\n   <rect>\n    <x>0</x>\n    <y>0</y>\n    <width>756</width>\n    <height>746</height>\n   </rect>\n  </property>\n  <property name=\"windowTitle\">\n   <string>ButterManager</string>\n  </property>\n  <widget class=\"QWidget\" name=\"centralwidget\">\n   <layout class=\"QVBoxLayout\" name=\"verticalLayout_10\">\n    <item>\n     <widget class=\"QTabWidget\" name=\"tab_buttermanager\">\n      <property name=\"currentIndex\">\n       <number>0</number>\n      </property>\n      <widget class=\"QWidget\" name=\"tab_main\">\n       <attribute name=\"title\">\n        <string>Main</string>\n       </attribute>\n       <layout class=\"QVBoxLayout\" name=\"verticalLayout_3\">\n        <item>\n         <layout class=\"QVBoxLayout\" name=\"verticalLayout_4\"/>\n        </item>\n        <item>\n         <layout class=\"QHBoxLayout\" name=\"horizontalLayout_2\">\n          <property name=\"leftMargin\">\n           <number>10</number>\n          </property>\n          <property name=\"rightMargin\">\n           <number>10</number>\n          </property>\n          <item>\n           <widget class=\"QLabel\" name=\"label_filesystem_info\">\n            <property name=\"font\">\n             <font>\n              <weight>75</weight>\n              <bold>true</bold>\n              <underline>true</underline>\n             </font>\n            </property>\n            <property name=\"text\">\n             <string>Filesystem Information</string>\n            </property>\n           </widget>\n          </item>\n          <item>\n           <widget class=\"QLabel\" name=\"label_filesystem_info_more\">\n            <property name=\"font\">\n             <font>\n              <pointsize>15</pointsize>\n             </font>\n            </property>\n            <property name=\"text\">\n             <string>?</string>\n            </property>\n           </widget>\n          </item>\n          <item>\n           <layout class=\"QVBoxLayout\" name=\"verticalLayout_5\">\n            <item>\n             <spacer name=\"verticalSpacer_20\">\n              <property name=\"orientation\">\n               <enum>Qt::Vertical</enum>\n              </property>\n              <property name=\"sizeHint\" stdset=\"0\">\n               <size>\n                <width>20</width>\n                <height>40</height>\n               </size>\n              </property>\n             </spacer>\n            </item>\n            <item>\n             <widget class=\"QLabel\" name=\"label_filesystem\">\n              <property name=\"text\">\n               <string>Filesystem</string>\n              </property>\n             </widget>\n            </item>\n            <item>\n             <widget class=\"QComboBox\" name=\"combobox_filesystem\"/>\n            </item>\n           </layout>\n          </item>\n         </layout>\n        </item>\n        <item>\n         <layout class=\"QGridLayout\" name=\"gridLayout\">\n          <property name=\"leftMargin\">\n           <number>10</number>\n          </property>\n          <property name=\"topMargin\">\n           <number>0</number>\n          </property>\n          <property name=\"rightMargin\">\n           <number>10</number>\n          </property>\n          <property name=\"bottomMargin\">\n           <number>10</number>\n          </property>\n          <item row=\"0\" column=\"0\">\n           <widget class=\"QLabel\" name=\"label_filesystem_size\">\n            <property name=\"text\">\n             <string>Size:</string>\n            </property>\n           </widget>\n          </item>\n          <item row=\"0\" column=\"1\">\n           <widget class=\"QLabel\" name=\"label_filesystem_size_value\">\n            <property name=\"text\">\n             <string>30 GB</string>\n            </property>\n           </widget>\n          </item>\n          <item row=\"1\" column=\"1\">\n           <widget class=\"QLabel\" name=\"label_filesystem_allocated_value\">\n            <property name=\"text\">\n             <string>19.77 GB</string>\n            </property>\n           </widget>\n          </item>\n          <item row=\"1\" column=\"0\">\n           <widget class=\"QLabel\" name=\"label_filesystem_allocated\">\n            <property name=\"text\">\n             <string>Allocated:</string>\n            </property>\n           </widget>\n          </item>\n          <item row=\"0\" column=\"2\">\n           <spacer name=\"horizontalSpacer_6\">\n            <property name=\"orientation\">\n             <enum>Qt::Horizontal</enum>\n            </property>\n            <property name=\"sizeHint\" stdset=\"0\">\n             <size>\n              <width>40</width>\n              <height>20</height>\n             </size>\n            </property>\n           </spacer>\n          </item>\n         </layout>\n        </item>\n        <item>\n         <layout class=\"QVBoxLayout\" name=\"verticalLayout_9\">\n          <property name=\"leftMargin\">\n           <number>10</number>\n          </property>\n          <property name=\"rightMargin\">\n           <number>10</number>\n          </property>\n          <item>\n           <widget class=\"QLabel\" name=\"label_space_danger\">\n            <property name=\"font\">\n             <font>\n              <weight>75</weight>\n              <italic>true</italic>\n              <bold>true</bold>\n             </font>\n            </property>\n            <property name=\"text\">\n             <string>Keep calm and clean a little bit your filesystem</string>\n            </property>\n           </widget>\n          </item>\n          <item>\n           <widget class=\"QLabel\" name=\"label_space_ok\">\n            <property name=\"font\">\n             <font>\n              <weight>75</weight>\n              <italic>true</italic>\n              <bold>true</bold>\n             </font>\n            </property>\n            <property name=\"text\">\n             <string>No problem, you have enough free space in your filesystem</string>\n            </property>\n           </widget>\n          </item>\n          <item>\n           <widget class=\"QLabel\" name=\"label_space_ko\">\n            <property name=\"font\">\n             <font>\n              <weight>75</weight>\n              <italic>true</italic>\n              <bold>true</bold>\n             </font>\n            </property>\n            <property name=\"text\">\n             <string>Low space svailable. Remove old snapshots, clean the filesystem and balance it</string>\n            </property>\n           </widget>\n          </item>\n          <item>\n           <spacer name=\"verticalSpacer\">\n            <property name=\"orientation\">\n             <enum>Qt::Vertical</enum>\n            </property>\n            <property name=\"sizeHint\" stdset=\"0\">\n             <size>\n              <width>20</width>\n              <height>40</height>\n             </size>\n            </property>\n           </spacer>\n          </item>\n         </layout>\n        </item>\n        <item>\n         <layout class=\"QHBoxLayout\" name=\"horizontalLayout_7\">\n          <property name=\"leftMargin\">\n           <number>10</number>\n          </property>\n          <property name=\"topMargin\">\n           <number>10</number>\n          </property>\n          <property name=\"rightMargin\">\n           <number>10</number>\n          </property>\n          <property name=\"bottomMargin\">\n           <number>10</number>\n          </property>\n          <item>\n           <layout class=\"QVBoxLayout\" name=\"verticalLayout_8\">\n            <item>\n             <widget class=\"QLabel\" name=\"label_filesystem_lost_info\">\n              <property name=\"font\">\n               <font>\n                <weight>75</weight>\n                <bold>true</bold>\n                <underline>true</underline>\n               </font>\n              </property>\n              <property name=\"text\">\n               <string>Used space of total allocated</string>\n              </property>\n             </widget>\n            </item>\n            <item>\n             <spacer name=\"verticalSpacer_3\">\n              <property name=\"orientation\">\n               <enum>Qt::Vertical</enum>\n              </property>\n              <property name=\"sizeType\">\n               <enum>QSizePolicy::Fixed</enum>\n              </property>\n              <property name=\"sizeHint\" stdset=\"0\">\n               <size>\n                <width>20</width>\n                <height>10</height>\n               </size>\n              </property>\n             </spacer>\n            </item>\n            <item>\n             <layout class=\"QHBoxLayout\" name=\"horizontalLayout_8\" stretch=\"0,0,0,0\">\n              <property name=\"spacing\">\n               <number>6</number>\n              </property>\n              <item>\n               <widget class=\"QLabel\" name=\"label_filesystem_data\">\n                <property name=\"text\">\n                 <string>Data</string>\n                </property>\n               </widget>\n              </item>\n              <item>\n               <spacer name=\"horizontalSpacer_2\">\n                <property name=\"orientation\">\n                 <enum>Qt::Horizontal</enum>\n                </property>\n                <property name=\"sizeType\">\n                 <enum>QSizePolicy::Fixed</enum>\n                </property>\n                <property name=\"sizeHint\" stdset=\"0\">\n                 <size>\n                  <width>65</width>\n                  <height>20</height>\n                 </size>\n                </property>\n               </spacer>\n              </item>\n              <item>\n               <widget class=\"QProgressBar\" name=\"progressbar_data\">\n                <property name=\"value\">\n                 <number>85</number>\n                </property>\n               </widget>\n              </item>\n              <item>\n               <spacer name=\"horizontalSpacer_4\">\n                <property name=\"orientation\">\n                 <enum>Qt::Horizontal</enum>\n                </property>\n                <property name=\"sizeType\">\n                 <enum>QSizePolicy::Fixed</enum>\n                </property>\n                <property name=\"sizeHint\" stdset=\"0\">\n                 <size>\n                  <width>40</width>\n                  <height>20</height>\n                 </size>\n                </property>\n               </spacer>\n              </item>\n             </layout>\n            </item>\n            <item>\n             <layout class=\"QHBoxLayout\" name=\"horizontalLayout_9\" stretch=\"0,0,0,0\">\n              <item>\n               <widget class=\"QLabel\" name=\"label_filesystem_metadata\">\n                <property name=\"text\">\n                 <string>Metadata</string>\n                </property>\n               </widget>\n              </item>\n              <item>\n               <spacer name=\"horizontalSpacer_3\">\n                <property name=\"orientation\">\n                 <enum>Qt::Horizontal</enum>\n                </property>\n                <property name=\"sizeType\">\n                 <enum>QSizePolicy::Fixed</enum>\n                </property>\n                <property name=\"sizeHint\" stdset=\"0\">\n                 <size>\n                  <width>40</width>\n                  <height>20</height>\n                 </size>\n                </property>\n               </spacer>\n              </item>\n              <item>\n               <widget class=\"QProgressBar\" name=\"progressbar_metadata\">\n                <property name=\"value\">\n                 <number>50</number>\n                </property>\n               </widget>\n              </item>\n              <item>\n               <spacer name=\"horizontalSpacer_5\">\n                <property name=\"orientation\">\n                 <enum>Qt::Horizontal</enum>\n                </property>\n                <property name=\"sizeType\">\n                 <enum>QSizePolicy::Fixed</enum>\n                </property>\n                <property name=\"sizeHint\" stdset=\"0\">\n                 <size>\n                  <width>40</width>\n                  <height>20</height>\n                 </size>\n                </property>\n               </spacer>\n              </item>\n             </layout>\n            </item>\n            <item>\n             <layout class=\"QHBoxLayout\" name=\"horizontalLayout_4\">\n              <item>\n               <widget class=\"QLabel\" name=\"label_space_data_danger\">\n                <property name=\"font\">\n                 <font>\n                  <weight>75</weight>\n                  <italic>true</italic>\n                  <bold>true</bold>\n                 </font>\n                </property>\n                <property name=\"text\">\n                 <string>It is a perfect time to balance the filesystem. Click on Balance button to free some unused space</string>\n                </property>\n               </widget>\n              </item>\n             </layout>\n            </item>\n           </layout>\n          </item>\n          <item>\n           <widget class=\"QPushButton\" name=\"button_balance\">\n            <property name=\"toolTip\">\n             <string>Balance the selected filesystem</string>\n            </property>\n            <property name=\"text\">\n             <string>Balance</string>\n            </property>\n           </widget>\n          </item>\n         </layout>\n        </item>\n        <item>\n         <spacer name=\"verticalSpacer_19\">\n          <property name=\"orientation\">\n           <enum>Qt::Vertical</enum>\n          </property>\n          <property name=\"sizeHint\" stdset=\"0\">\n           <size>\n            <width>20</width>\n            <height>40</height>\n           </size>\n          </property>\n         </spacer>\n        </item>\n        <item>\n         <widget class=\"Line\" name=\"line_2\">\n          <property name=\"orientation\">\n           <enum>Qt::Horizontal</enum>\n          </property>\n         </widget>\n        </item>\n        <item>\n         <layout class=\"QVBoxLayout\" name=\"verticalLayout_6\">\n          <item>\n           <layout class=\"QVBoxLayout\" name=\"verticalLayout_7\">\n            <property name=\"spacing\">\n             <number>0</number>\n            </property>\n            <property name=\"leftMargin\">\n             <number>10</number>\n            </property>\n            <property name=\"topMargin\">\n             <number>10</number>\n            </property>\n            <property name=\"rightMargin\">\n             <number>10</number>\n            </property>\n            <property name=\"bottomMargin\">\n             <number>10</number>\n            </property>\n            <item>\n             <widget class=\"QLabel\" name=\"label_other_operations\">\n              <property name=\"text\">\n               <string>Fast actions</string>\n              </property>\n             </widget>\n            </item>\n            <item>\n             <spacer name=\"verticalSpacer_2\">\n              <property name=\"orientation\">\n               <enum>Qt::Vertical</enum>\n              </property>\n              <property name=\"sizeType\">\n               <enum>QSizePolicy::Fixed</enum>\n              </property>\n              <property name=\"sizeHint\" stdset=\"0\">\n               <size>\n                <width>20</width>\n                <height>10</height>\n               </size>\n              </property>\n             </spacer>\n            </item>\n            <item>\n             <layout class=\"QHBoxLayout\" name=\"horizontalLayout_3\">\n              <item>\n               <widget class=\"QPushButton\" name=\"button_upgrade_system\">\n                <property name=\"toolTip\">\n                 <string>Upgrade the system creating a previous snapshot and removing old snapshots according to configuration</string>\n                </property>\n                <property name=\"text\">\n                 <string>Upgrade System with snapshots</string>\n                </property>\n               </widget>\n              </item>\n              <item>\n               <widget class=\"QPushButton\" name=\"button_upgrade_system_without_snapshots\">\n                <property name=\"toolTip\">\n                 <string>Upgrade the system without creating or deleting snapshots</string>\n                </property>\n                <property name=\"text\">\n                 <string>Upgrade System without snapshots</string>\n                </property>\n               </widget>\n              </item>\n              <item>\n               <widget class=\"QPushButton\" name=\"button_fa_take_snapshot\">\n                <property name=\"toolTip\">\n                 <string>Take a BTRFS snapshot</string>\n                </property>\n                <property name=\"text\">\n                 <string>Take snapshots</string>\n                </property>\n               </widget>\n              </item>\n              <item>\n               <widget class=\"QPushButton\" name=\"button_regenerate_grub\">\n                <property name=\"toolTip\">\n                 <string>Regenerates GRUB menu including entries for the current snapshots</string>\n                </property>\n                <property name=\"text\">\n                 <string>Regenerate GRUB</string>\n                </property>\n               </widget>\n              </item>\n             </layout>\n            </item>\n           </layout>\n          </item>\n          <item>\n           <widget class=\"QTextEdit\" name=\"text_edit_console\"/>\n          </item>\n          <item>\n           <layout class=\"QHBoxLayout\" name=\"horizontalLayout\">\n            <item>\n             <widget class=\"QPushButton\" name=\"button_save_log\">\n              <property name=\"font\">\n               <font>\n                <weight>50</weight>\n                <italic>false</italic>\n                <bold>false</bold>\n                <underline>false</underline>\n                <strikeout>false</strikeout>\n                <kerning>true</kerning>\n               </font>\n              </property>\n              <property name=\"toolTip\">\n               <string>Save the log in a txt file</string>\n              </property>\n              <property name=\"layoutDirection\">\n               <enum>Qt::LeftToRight</enum>\n              </property>\n              <property name=\"text\">\n               <string>Save Log</string>\n              </property>\n             </widget>\n            </item>\n            <item>\n             <spacer name=\"horizontalSpacer\">\n              <property name=\"orientation\">\n               <enum>Qt::Horizontal</enum>\n              </property>\n              <property name=\"sizeHint\" stdset=\"0\">\n               <size>\n                <width>40</width>\n                <height>20</height>\n               </size>\n              </property>\n             </spacer>\n            </item>\n            <item>\n             <widget class=\"QPushButton\" name=\"button_close_terminal\">\n              <property name=\"font\">\n               <font>\n                <weight>50</weight>\n                <italic>false</italic>\n                <bold>false</bold>\n                <underline>false</underline>\n                <strikeout>false</strikeout>\n                <kerning>true</kerning>\n               </font>\n              </property>\n              <property name=\"toolTip\">\n               <string>Close the terminal below</string>\n              </property>\n              <property name=\"layoutDirection\">\n               <enum>Qt::LeftToRight</enum>\n              </property>\n              <property name=\"text\">\n               <string>Close Terminal</string>\n              </property>\n             </widget>\n            </item>\n           </layout>\n          </item>\n         </layout>\n        </item>\n       </layout>\n      </widget>\n      <widget class=\"QWidget\" name=\"tab_snapshots\">\n       <attribute name=\"title\">\n        <string>Snapshots</string>\n       </attribute>\n       <layout class=\"QVBoxLayout\" name=\"verticalLayout_12\">\n        <item>\n         <layout class=\"QVBoxLayout\" name=\"verticalLayout_11\">\n          <item>\n           <layout class=\"QHBoxLayout\" name=\"horizontalLayout_5\">\n            <item>\n             <widget class=\"QListWidget\" name=\"list_snapshots\">\n              <property name=\"selectionMode\">\n               <enum>QAbstractItemView::MultiSelection</enum>\n              </property>\n              <property name=\"selectionBehavior\">\n               <enum>QAbstractItemView::SelectItems</enum>\n              </property>\n             </widget>\n            </item>\n            <item>\n             <layout class=\"QVBoxLayout\" name=\"verticalLayout_13\">\n              <item>\n               <spacer name=\"verticalSpacer_5\">\n                <property name=\"orientation\">\n                 <enum>Qt::Vertical</enum>\n                </property>\n                <property name=\"sizeHint\" stdset=\"0\">\n                 <size>\n                  <width>20</width>\n                  <height>40</height>\n                 </size>\n                </property>\n               </spacer>\n              </item>\n              <item>\n               <widget class=\"QPushButton\" name=\"button_delete_snapshot\">\n                <property name=\"toolTip\">\n                 <string>Remove one or several BTRF snapshots</string>\n                </property>\n                <property name=\"text\">\n                 <string/>\n                </property>\n               </widget>\n              </item>\n              <item>\n               <widget class=\"QPushButton\" name=\"button_take_snapshot\">\n                <property name=\"toolTip\">\n                 <string>Take a BTRFS snapshot</string>\n                </property>\n                <property name=\"autoFillBackground\">\n                 <bool>false</bool>\n                </property>\n                <property name=\"text\">\n                 <string/>\n                </property>\n               </widget>\n              </item>\n              <item>\n               <widget class=\"QPushButton\" name=\"button_diff\">\n                <property name=\"toolTip\">\n                 <string>Find differences between the selected snapshot and the current state</string>\n                </property>\n                <property name=\"text\">\n                 <string/>\n                </property>\n               </widget>\n              </item>\n              <item>\n               <widget class=\"QPushButton\" name=\"button_folder\">\n                <property name=\"toolTip\">\n                 <string>Open the selected snapshot in a file browser</string>\n                </property>\n                <property name=\"text\">\n                 <string/>\n                </property>\n               </widget>\n              </item>\n              <item>\n               <spacer name=\"verticalSpacer_4\">\n                <property name=\"orientation\">\n                 <enum>Qt::Vertical</enum>\n                </property>\n                <property name=\"sizeHint\" stdset=\"0\">\n                 <size>\n                  <width>20</width>\n                  <height>40</height>\n                 </size>\n                </property>\n               </spacer>\n              </item>\n             </layout>\n            </item>\n           </layout>\n          </item>\n         </layout>\n        </item>\n       </layout>\n      </widget>\n      <widget class=\"QWidget\" name=\"tab_logs\">\n       <attribute name=\"title\">\n        <string>Logs</string>\n       </attribute>\n       <layout class=\"QHBoxLayout\" name=\"horizontalLayout_10\">\n        <item>\n         <layout class=\"QHBoxLayout\" name=\"horizontalLayout_6\">\n          <item>\n           <widget class=\"QListWidget\" name=\"list_logs\">\n            <property name=\"selectionMode\">\n             <enum>QAbstractItemView::SingleSelection</enum>\n            </property>\n            <property name=\"selectionBehavior\">\n             <enum>QAbstractItemView::SelectItems</enum>\n            </property>\n           </widget>\n          </item>\n         </layout>\n        </item>\n        <item>\n         <layout class=\"QVBoxLayout\" name=\"verticalLayout_14\">\n          <item>\n           <spacer name=\"verticalSpacer_6\">\n            <property name=\"orientation\">\n             <enum>Qt::Vertical</enum>\n            </property>\n            <property name=\"sizeHint\" stdset=\"0\">\n             <size>\n              <width>20</width>\n              <height>40</height>\n             </size>\n            </property>\n           </spacer>\n          </item>\n          <item>\n           <widget class=\"QPushButton\" name=\"button_view_log\">\n            <property name=\"toolTip\">\n             <string>View the entire log</string>\n            </property>\n            <property name=\"autoFillBackground\">\n             <bool>false</bool>\n            </property>\n            <property name=\"text\">\n             <string/>\n            </property>\n           </widget>\n          </item>\n          <item>\n           <widget class=\"QPushButton\" name=\"button_delete_log\">\n            <property name=\"toolTip\">\n             <string>Remove the log selected</string>\n            </property>\n            <property name=\"text\">\n             <string/>\n            </property>\n           </widget>\n          </item>\n          <item>\n           <spacer name=\"verticalSpacer_7\">\n            <property name=\"orientation\">\n             <enum>Qt::Vertical</enum>\n            </property>\n            <property name=\"sizeHint\" stdset=\"0\">\n             <size>\n              <width>20</width>\n              <height>40</height>\n             </size>\n            </property>\n           </spacer>\n          </item>\n         </layout>\n        </item>\n       </layout>\n      </widget>\n      <widget class=\"QWidget\" name=\"tab_settings\">\n       <attribute name=\"title\">\n        <string>Settings</string>\n       </attribute>\n       <layout class=\"QVBoxLayout\" name=\"verticalLayout_16\" stretch=\"0,0,0,0,0\">\n        <item>\n         <layout class=\"QVBoxLayout\" name=\"verticalLayout_15\">\n          <item>\n           <layout class=\"QVBoxLayout\" name=\"verticalLayout_17\">\n            <property name=\"leftMargin\">\n             <number>10</number>\n            </property>\n            <property name=\"rightMargin\">\n             <number>10</number>\n            </property>\n            <item>\n             <widget class=\"QLabel\" name=\"label_settings_subvolumes\">\n              <property name=\"font\">\n               <font>\n                <weight>75</weight>\n                <bold>true</bold>\n                <underline>true</underline>\n               </font>\n              </property>\n              <property name=\"text\">\n               <string>Subvolumes</string>\n              </property>\n             </widget>\n            </item>\n            <item>\n             <layout class=\"QHBoxLayout\" name=\"horizontalLayout_11\">\n              <item>\n               <widget class=\"QPushButton\" name=\"button_add_subvolume\">\n                <property name=\"text\">\n                 <string>Add subvolume</string>\n                </property>\n               </widget>\n              </item>\n              <item>\n               <spacer name=\"horizontalSpacer_7\">\n                <property name=\"orientation\">\n                 <enum>Qt::Horizontal</enum>\n                </property>\n                <property name=\"sizeHint\" stdset=\"0\">\n                 <size>\n                  <width>40</width>\n                  <height>20</height>\n                 </size>\n                </property>\n               </spacer>\n              </item>\n             </layout>\n            </item>\n           </layout>\n          </item>\n          <item>\n           <spacer name=\"verticalSpacer_8\">\n            <property name=\"orientation\">\n             <enum>Qt::Vertical</enum>\n            </property>\n            <property name=\"sizeHint\" stdset=\"0\">\n             <size>\n              <width>20</width>\n              <height>40</height>\n             </size>\n            </property>\n           </spacer>\n          </item>\n          <item>\n           <layout class=\"QGridLayout\" name=\"gridLayout_2\" columnstretch=\"5,0,0,0,0\">\n            <property name=\"leftMargin\">\n             <number>10</number>\n            </property>\n            <property name=\"rightMargin\">\n             <number>10</number>\n            </property>\n            <property name=\"verticalSpacing\">\n             <number>6</number>\n            </property>\n            <item row=\"1\" column=\"0\">\n             <widget class=\"QComboBox\" name=\"combobox_subvolumes\"/>\n            </item>\n            <item row=\"1\" column=\"1\">\n             <spacer name=\"horizontalSpacer_8\">\n              <property name=\"orientation\">\n               <enum>Qt::Horizontal</enum>\n              </property>\n              <property name=\"sizeHint\" stdset=\"0\">\n               <size>\n                <width>100</width>\n                <height>20</height>\n               </size>\n              </property>\n             </spacer>\n            </item>\n            <item row=\"1\" column=\"3\">\n             <widget class=\"QPushButton\" name=\"button_delete_subvolume\">\n              <property name=\"toolTip\">\n               <string>Remove the selected subvolume</string>\n              </property>\n              <property name=\"text\">\n               <string/>\n              </property>\n             </widget>\n            </item>\n            <item row=\"1\" column=\"4\">\n             <widget class=\"QPushButton\" name=\"button_edit_subvolume\">\n              <property name=\"toolTip\">\n               <string>Edit subvolume configuration</string>\n              </property>\n              <property name=\"text\">\n               <string/>\n              </property>\n             </widget>\n            </item>\n            <item row=\"1\" column=\"2\">\n             <widget class=\"QPushButton\" name=\"button_save_subvolume\">\n              <property name=\"toolTip\">\n               <string>Apply changes</string>\n              </property>\n              <property name=\"text\">\n               <string/>\n              </property>\n             </widget>\n            </item>\n            <item row=\"0\" column=\"0\">\n             <widget class=\"QLabel\" name=\"label_existing_subvolumes\">\n              <property name=\"font\">\n               <font>\n                <weight>75</weight>\n                <bold>true</bold>\n                <underline>true</underline>\n               </font>\n              </property>\n              <property name=\"text\">\n               <string>Existing subvolumes</string>\n              </property>\n             </widget>\n            </item>\n           </layout>\n          </item>\n         </layout>\n        </item>\n        <item>\n         <layout class=\"QGridLayout\" name=\"gridLayout_3\">\n          <property name=\"leftMargin\">\n           <number>10</number>\n          </property>\n          <property name=\"rightMargin\">\n           <number>10</number>\n          </property>\n          <item row=\"0\" column=\"0\">\n           <widget class=\"QLineEdit\" name=\"line_edit_snapshot_where\">\n            <property name=\"readOnly\">\n             <bool>false</bool>\n            </property>\n           </widget>\n          </item>\n          <item row=\"1\" column=\"2\">\n           <widget class=\"QLabel\" name=\"label_settings_subvolumes_prefix\">\n            <property name=\"font\">\n             <font>\n              <pointsize>8</pointsize>\n              <italic>true</italic>\n             </font>\n            </property>\n            <property name=\"text\">\n             <string>(Prefix of the snapshot stored)</string>\n            </property>\n           </widget>\n          </item>\n          <item row=\"2\" column=\"0\">\n           <widget class=\"QCheckBox\" name=\"checkbox_edit_dont_remove_snapshots\">\n            <property name=\"text\">\n             <string>Don't remove any snapshot</string>\n            </property>\n           </widget>\n          </item>\n          <item row=\"0\" column=\"2\">\n           <widget class=\"QLabel\" name=\"label_settings_subvolumes_where\">\n            <property name=\"font\">\n             <font>\n              <pointsize>8</pointsize>\n              <italic>true</italic>\n             </font>\n            </property>\n            <property name=\"text\">\n             <string>(Path where the snapshot of the subvolume is stored)</string>\n            </property>\n           </widget>\n          </item>\n          <item row=\"2\" column=\"2\">\n           <widget class=\"QLabel\" name=\"label_settings_subvolumes_snapshots_to_keep\">\n            <property name=\"font\">\n             <font>\n              <pointsize>8</pointsize>\n              <italic>true</italic>\n             </font>\n            </property>\n            <property name=\"text\">\n             <string>(Snapshots to keep)</string>\n            </property>\n           </widget>\n          </item>\n          <item row=\"1\" column=\"0\">\n           <widget class=\"QLineEdit\" name=\"line_edit_snapshot_prefix\">\n            <property name=\"readOnly\">\n             <bool>false</bool>\n            </property>\n           </widget>\n          </item>\n          <item row=\"2\" column=\"1\">\n           <widget class=\"QSpinBox\" name=\"spinbox_edit_snapshots_to_keep\"/>\n          </item>\n         </layout>\n        </item>\n        <item>\n         <spacer name=\"verticalSpacer_9\">\n          <property name=\"orientation\">\n           <enum>Qt::Vertical</enum>\n          </property>\n          <property name=\"sizeHint\" stdset=\"0\">\n           <size>\n            <width>20</width>\n            <height>40</height>\n           </size>\n          </property>\n         </spacer>\n        </item>\n        <item>\n         <layout class=\"QVBoxLayout\" name=\"verticalLayout\">\n          <property name=\"leftMargin\">\n           <number>10</number>\n          </property>\n          <property name=\"rightMargin\">\n           <number>10</number>\n          </property>\n          <item>\n           <widget class=\"QLabel\" name=\"label_settings_upgrade\">\n            <property name=\"font\">\n             <font>\n              <weight>75</weight>\n              <bold>true</bold>\n              <underline>true</underline>\n             </font>\n            </property>\n            <property name=\"text\">\n             <string>Upgrade System</string>\n            </property>\n           </widget>\n          </item>\n          <item>\n           <widget class=\"QCheckBox\" name=\"checkbox_startup\">\n            <property name=\"text\">\n             <string>Check updates at startup</string>\n            </property>\n           </widget>\n          </item>\n          <item>\n           <widget class=\"QCheckBox\" name=\"checkbox_log\">\n            <property name=\"text\">\n             <string>Save logs automatically</string>\n            </property>\n           </widget>\n          </item>\n          <item>\n           <widget class=\"QCheckBox\" name=\"checkbox_snap\">\n            <property name=\"text\">\n             <string>Include snap packages</string>\n            </property>\n           </widget>\n          </item>\n          <item>\n           <widget class=\"QCheckBox\" name=\"checkbox_flatpak\">\n            <property name=\"text\">\n             <string>Include Flatpak packages</string>\n            </property>\n           </widget>\n          </item>\n          <item>\n           <widget class=\"QCheckBox\" name=\"checkbox_aur\">\n            <property name=\"text\">\n             <string>Include AUR packages</string>\n            </property>\n           </widget>\n          </item>\n          <item>\n           <widget class=\"QCheckBox\" name=\"checkbox_grub_btrfs\">\n            <property name=\"toolTip\">\n             <string>Before checking this option, make sure you have GRUB installed. After marking it, the created snapshots of the subvolume mounted as root will be modified to include the appropriate path in the /etc/fstab file</string>\n            </property>\n            <property name=\"text\">\n             <string>Boot the system from GRUB using snapshots</string>\n            </property>\n           </widget>\n          </item>\n          <item>\n           <spacer name=\"verticalSpacer_10\">\n            <property name=\"orientation\">\n             <enum>Qt::Vertical</enum>\n            </property>\n            <property name=\"sizeHint\" stdset=\"0\">\n             <size>\n              <width>20</width>\n              <height>40</height>\n             </size>\n            </property>\n           </spacer>\n          </item>\n          <item>\n           <widget class=\"QLabel\" name=\"label_settings_ui\">\n            <property name=\"font\">\n             <font>\n              <weight>75</weight>\n              <bold>true</bold>\n              <underline>true</underline>\n             </font>\n            </property>\n            <property name=\"text\">\n             <string>UI</string>\n            </property>\n           </widget>\n          </item>\n          <item>\n           <layout class=\"QHBoxLayout\" name=\"horizontalLayout_12\">\n            <item>\n             <widget class=\"QLabel\" name=\"label_font_size\">\n              <property name=\"text\">\n               <string>Font size increment</string>\n              </property>\n             </widget>\n            </item>\n            <item>\n             <widget class=\"QSpinBox\" name=\"spinbox_font_size_increment\">\n              <property name=\"minimum\">\n               <number>-99</number>\n              </property>\n             </widget>\n            </item>\n            <item>\n             <spacer name=\"horizontalSpacer_9\">\n              <property name=\"orientation\">\n               <enum>Qt::Horizontal</enum>\n              </property>\n              <property name=\"sizeHint\" stdset=\"0\">\n               <size>\n                <width>40</width>\n                <height>20</height>\n               </size>\n              </property>\n             </spacer>\n            </item>\n           </layout>\n          </item>\n         </layout>\n        </item>\n        <item>\n         <spacer name=\"verticalSpacer_11\">\n          <property name=\"orientation\">\n           <enum>Qt::Vertical</enum>\n          </property>\n          <property name=\"sizeHint\" stdset=\"0\">\n           <size>\n            <width>20</width>\n            <height>40</height>\n           </size>\n          </property>\n         </spacer>\n        </item>\n       </layout>\n      </widget>\n      <widget class=\"QWidget\" name=\"tab\">\n       <attribute name=\"title\">\n        <string>Documentation</string>\n       </attribute>\n       <layout class=\"QVBoxLayout\" name=\"verticalLayout_18\">\n        <item>\n         <layout class=\"QVBoxLayout\" name=\"verticalLayout_2\">\n          <item>\n           <spacer name=\"verticalSpacer_13\">\n            <property name=\"orientation\">\n             <enum>Qt::Vertical</enum>\n            </property>\n            <property name=\"sizeHint\" stdset=\"0\">\n             <size>\n              <width>20</width>\n              <height>40</height>\n             </size>\n            </property>\n           </spacer>\n          </item>\n          <item>\n           <widget class=\"QLabel\" name=\"label_documentation\">\n            <property name=\"layoutDirection\">\n             <enum>Qt::LeftToRight</enum>\n            </property>\n            <property name=\"autoFillBackground\">\n             <bool>false</bool>\n            </property>\n            <property name=\"text\">\n             <string>For additional documentation about setting up and using Buttermanager, please go to the Wiki of the project</string>\n            </property>\n            <property name=\"alignment\">\n             <set>Qt::AlignCenter</set>\n            </property>\n           </widget>\n          </item>\n          <item>\n           <spacer name=\"verticalSpacer_14\">\n            <property name=\"orientation\">\n             <enum>Qt::Vertical</enum>\n            </property>\n            <property name=\"sizeType\">\n             <enum>QSizePolicy::Fixed</enum>\n            </property>\n            <property name=\"sizeHint\" stdset=\"0\">\n             <size>\n              <width>20</width>\n              <height>40</height>\n             </size>\n            </property>\n           </spacer>\n          </item>\n          <item>\n           <widget class=\"QPushButton\" name=\"button_wiki\">\n            <property name=\"font\">\n             <font>\n              <italic>true</italic>\n              <underline>true</underline>\n             </font>\n            </property>\n            <property name=\"cursor\">\n             <cursorShape>PointingHandCursor</cursorShape>\n            </property>\n            <property name=\"autoFillBackground\">\n             <bool>false</bool>\n            </property>\n            <property name=\"styleSheet\">\n             <string notr=\"true\">border: none;</string>\n            </property>\n            <property name=\"text\">\n             <string>https://github.com/egara/buttermanager/wiki</string>\n            </property>\n           </widget>\n          </item>\n          <item>\n           <spacer name=\"verticalSpacer_12\">\n            <property name=\"orientation\">\n             <enum>Qt::Vertical</enum>\n            </property>\n            <property name=\"sizeHint\" stdset=\"0\">\n             <size>\n              <width>20</width>\n              <height>40</height>\n             </size>\n            </property>\n           </spacer>\n          </item>\n         </layout>\n        </item>\n       </layout>\n      </widget>\n      <widget class=\"QWidget\" name=\"tab_2\">\n       <attribute name=\"title\">\n        <string>About</string>\n       </attribute>\n       <layout class=\"QVBoxLayout\" name=\"verticalLayout_20\">\n        <item>\n         <layout class=\"QVBoxLayout\" name=\"verticalLayout_19\">\n          <item>\n           <spacer name=\"verticalSpacer_18\">\n            <property name=\"orientation\">\n             <enum>Qt::Vertical</enum>\n            </property>\n            <property name=\"sizeHint\" stdset=\"0\">\n             <size>\n              <width>20</width>\n              <height>40</height>\n             </size>\n            </property>\n           </spacer>\n          </item>\n          <item>\n           <widget class=\"QLabel\" name=\"label_logo\">\n            <property name=\"text\">\n             <string>Logo</string>\n            </property>\n            <property name=\"alignment\">\n             <set>Qt::AlignCenter</set>\n            </property>\n           </widget>\n          </item>\n          <item>\n           <spacer name=\"verticalSpacer_16\">\n            <property name=\"orientation\">\n             <enum>Qt::Vertical</enum>\n            </property>\n            <property name=\"sizeHint\" stdset=\"0\">\n             <size>\n              <width>20</width>\n              <height>40</height>\n             </size>\n            </property>\n           </spacer>\n          </item>\n          <item>\n           <widget class=\"QLabel\" name=\"label_app_name\">\n            <property name=\"font\">\n             <font>\n              <weight>75</weight>\n              <bold>true</bold>\n             </font>\n            </property>\n            <property name=\"text\">\n             <string>ButterManager (A BTRFS Tool)</string>\n            </property>\n            <property name=\"alignment\">\n             <set>Qt::AlignCenter</set>\n            </property>\n           </widget>\n          </item>\n          <item>\n           <widget class=\"QLabel\" name=\"label_app_version\">\n            <property name=\"font\">\n             <font>\n              <weight>75</weight>\n              <bold>true</bold>\n             </font>\n            </property>\n            <property name=\"text\">\n             <string>v2.5.2</string>\n            </property>\n            <property name=\"alignment\">\n             <set>Qt::AlignCenter</set>\n            </property>\n           </widget>\n          </item>\n          <item>\n           <spacer name=\"verticalSpacer_15\">\n            <property name=\"orientation\">\n             <enum>Qt::Vertical</enum>\n            </property>\n            <property name=\"sizeHint\" stdset=\"0\">\n             <size>\n              <width>20</width>\n              <height>40</height>\n             </size>\n            </property>\n           </spacer>\n          </item>\n          <item>\n           <widget class=\"QLabel\" name=\"label_app_developer\">\n            <property name=\"font\">\n             <font>\n              <weight>50</weight>\n              <bold>false</bold>\n             </font>\n            </property>\n            <property name=\"text\">\n             <string>Eloy García Almadén</string>\n            </property>\n            <property name=\"alignment\">\n             <set>Qt::AlignCenter</set>\n            </property>\n           </widget>\n          </item>\n          <item>\n           <widget class=\"QLabel\" name=\"label_app_email\">\n            <property name=\"font\">\n             <font>\n              <weight>50</weight>\n              <bold>false</bold>\n             </font>\n            </property>\n            <property name=\"text\">\n             <string>eloy.garcia.pca@gmail.com</string>\n            </property>\n            <property name=\"alignment\">\n             <set>Qt::AlignCenter</set>\n            </property>\n           </widget>\n          </item>\n          <item>\n           <widget class=\"QPushButton\" name=\"button_github\">\n            <property name=\"font\">\n             <font>\n              <italic>true</italic>\n              <underline>true</underline>\n             </font>\n            </property>\n            <property name=\"cursor\">\n             <cursorShape>PointingHandCursor</cursorShape>\n            </property>\n            <property name=\"autoFillBackground\">\n             <bool>false</bool>\n            </property>\n            <property name=\"styleSheet\">\n             <string notr=\"true\">border: none;</string>\n            </property>\n            <property name=\"text\">\n             <string>https://github.com/egara/buttermanager</string>\n            </property>\n           </widget>\n          </item>\n          <item>\n           <widget class=\"QLabel\" name=\"label_app_developer_2\">\n            <property name=\"font\">\n             <font>\n              <weight>50</weight>\n              <bold>false</bold>\n             </font>\n            </property>\n            <property name=\"text\">\n             <string>Jaime Álvarez Fernández (Icon)</string>\n            </property>\n            <property name=\"alignment\">\n             <set>Qt::AlignCenter</set>\n            </property>\n           </widget>\n          </item>\n          <item>\n           <spacer name=\"verticalSpacer_17\">\n            <property name=\"orientation\">\n             <enum>Qt::Vertical</enum>\n            </property>\n            <property name=\"sizeHint\" stdset=\"0\">\n             <size>\n              <width>20</width>\n              <height>40</height>\n             </size>\n            </property>\n           </spacer>\n          </item>\n         </layout>\n        </item>\n       </layout>\n      </widget>\n     </widget>\n    </item>\n   </layout>\n  </widget>\n  <widget class=\"QMenuBar\" name=\"menubar\">\n   <property name=\"geometry\">\n    <rect>\n     <x>0</x>\n     <y>0</y>\n     <width>756</width>\n     <height>30</height>\n    </rect>\n   </property>\n  </widget>\n  <widget class=\"QStatusBar\" name=\"statusbar\"/>\n </widget>\n <resources/>\n <connections/>\n</ui>\n"
  },
  {
    "path": "buttermanager/buttermanager/ui/PasswordWindow.ui",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>PasswordWindow</class>\n <widget class=\"QMainWindow\" name=\"PasswordWindow\">\n  <property name=\"geometry\">\n   <rect>\n    <x>0</x>\n    <y>0</y>\n    <width>330</width>\n    <height>195</height>\n   </rect>\n  </property>\n  <property name=\"windowTitle\">\n   <string>ButterManager</string>\n  </property>\n  <widget class=\"QWidget\" name=\"centralwidget\">\n   <layout class=\"QVBoxLayout\" name=\"verticalLayout_3\">\n    <item>\n     <spacer name=\"verticalSpacer_3\">\n      <property name=\"orientation\">\n       <enum>Qt::Vertical</enum>\n      </property>\n      <property name=\"sizeHint\" stdset=\"0\">\n       <size>\n        <width>20</width>\n        <height>40</height>\n       </size>\n      </property>\n     </spacer>\n    </item>\n    <item>\n     <layout class=\"QVBoxLayout\" name=\"verticalLayout_2\">\n      <property name=\"leftMargin\">\n       <number>10</number>\n      </property>\n      <property name=\"rightMargin\">\n       <number>10</number>\n      </property>\n      <item>\n       <layout class=\"QHBoxLayout\" name=\"horizontalLayout\">\n        <item>\n         <spacer name=\"horizontalSpacer\">\n          <property name=\"orientation\">\n           <enum>Qt::Horizontal</enum>\n          </property>\n          <property name=\"sizeHint\" stdset=\"0\">\n           <size>\n            <width>40</width>\n            <height>20</height>\n           </size>\n          </property>\n         </spacer>\n        </item>\n        <item>\n         <widget class=\"QPushButton\" name=\"button_lock\">\n          <property name=\"font\">\n           <font>\n            <kerning>false</kerning>\n           </font>\n          </property>\n          <property name=\"cursor\">\n           <cursorShape>ArrowCursor</cursorShape>\n          </property>\n          <property name=\"toolTip\">\n           <string/>\n          </property>\n          <property name=\"autoFillBackground\">\n           <bool>false</bool>\n          </property>\n          <property name=\"text\">\n           <string/>\n          </property>\n          <property name=\"flat\">\n           <bool>true</bool>\n          </property>\n         </widget>\n        </item>\n        <item>\n         <spacer name=\"horizontalSpacer_2\">\n          <property name=\"orientation\">\n           <enum>Qt::Horizontal</enum>\n          </property>\n          <property name=\"sizeHint\" stdset=\"0\">\n           <size>\n            <width>40</width>\n            <height>20</height>\n           </size>\n          </property>\n         </spacer>\n        </item>\n       </layout>\n      </item>\n      <item>\n       <spacer name=\"verticalSpacer_2\">\n        <property name=\"orientation\">\n         <enum>Qt::Vertical</enum>\n        </property>\n        <property name=\"sizeHint\" stdset=\"0\">\n         <size>\n          <width>20</width>\n          <height>40</height>\n         </size>\n        </property>\n       </spacer>\n      </item>\n      <item>\n       <widget class=\"QLabel\" name=\"label_password\">\n        <property name=\"text\">\n         <string>Please. type your password:</string>\n        </property>\n       </widget>\n      </item>\n      <item>\n       <widget class=\"QLineEdit\" name=\"input_password\">\n        <property name=\"echoMode\">\n         <enum>QLineEdit::Password</enum>\n        </property>\n       </widget>\n      </item>\n      <item>\n       <spacer name=\"verticalSpacer\">\n        <property name=\"orientation\">\n         <enum>Qt::Vertical</enum>\n        </property>\n        <property name=\"sizeHint\" stdset=\"0\">\n         <size>\n          <width>20</width>\n          <height>40</height>\n         </size>\n        </property>\n       </spacer>\n      </item>\n     </layout>\n    </item>\n    <item>\n     <layout class=\"QHBoxLayout\" name=\"horizontalLayout_2\">\n      <property name=\"leftMargin\">\n       <number>10</number>\n      </property>\n      <property name=\"rightMargin\">\n       <number>10</number>\n      </property>\n      <item>\n       <spacer name=\"horizontalSpacer_3\">\n        <property name=\"orientation\">\n         <enum>Qt::Horizontal</enum>\n        </property>\n        <property name=\"sizeHint\" stdset=\"0\">\n         <size>\n          <width>40</width>\n          <height>20</height>\n         </size>\n        </property>\n       </spacer>\n      </item>\n      <item>\n       <widget class=\"QPushButton\" name=\"button_ok\">\n        <property name=\"text\">\n         <string>Ok</string>\n        </property>\n       </widget>\n      </item>\n      <item>\n       <widget class=\"QPushButton\" name=\"button_cancel\">\n        <property name=\"text\">\n         <string>Cancel</string>\n        </property>\n       </widget>\n      </item>\n     </layout>\n    </item>\n   </layout>\n  </widget>\n  <widget class=\"QStatusBar\" name=\"statusbar\"/>\n </widget>\n <resources/>\n <connections/>\n</ui>\n"
  },
  {
    "path": "buttermanager/buttermanager/ui/ProblemsFoundWindow.ui",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>SnapshotWindow</class>\n <widget class=\"QMainWindow\" name=\"SnapshotWindow\">\n  <property name=\"geometry\">\n   <rect>\n    <x>0</x>\n    <y>0</y>\n    <width>420</width>\n    <height>285</height>\n   </rect>\n  </property>\n  <property name=\"windowTitle\">\n   <string>ButterManager</string>\n  </property>\n  <widget class=\"QWidget\" name=\"centralwidget\">\n   <layout class=\"QVBoxLayout\" name=\"verticalLayout_2\">\n    <item>\n     <layout class=\"QVBoxLayout\" name=\"verticalLayout\" stretch=\"10,0\">\n      <property name=\"leftMargin\">\n       <number>10</number>\n      </property>\n      <property name=\"topMargin\">\n       <number>10</number>\n      </property>\n      <property name=\"rightMargin\">\n       <number>10</number>\n      </property>\n      <property name=\"bottomMargin\">\n       <number>10</number>\n      </property>\n      <item>\n       <widget class=\"QLabel\" name=\"label_info\">\n        <property name=\"text\">\n         <string/>\n        </property>\n        <property name=\"alignment\">\n         <set>Qt::AlignCenter</set>\n        </property>\n       </widget>\n      </item>\n      <item>\n       <layout class=\"QHBoxLayout\" name=\"horizontalLayout\">\n        <item>\n         <spacer name=\"horizontalSpacer\">\n          <property name=\"orientation\">\n           <enum>Qt::Horizontal</enum>\n          </property>\n          <property name=\"sizeHint\" stdset=\"0\">\n           <size>\n            <width>40</width>\n            <height>20</height>\n           </size>\n          </property>\n         </spacer>\n        </item>\n        <item>\n         <widget class=\"QPushButton\" name=\"button_ok\">\n          <property name=\"text\">\n           <string>OK</string>\n          </property>\n         </widget>\n        </item>\n       </layout>\n      </item>\n     </layout>\n    </item>\n   </layout>\n  </widget>\n </widget>\n <resources/>\n <connections/>\n</ui>\n"
  },
  {
    "path": "buttermanager/buttermanager/ui/SnapshotWindow.ui",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>SnapshotWindow</class>\n <widget class=\"QMainWindow\" name=\"SnapshotWindow\">\n  <property name=\"geometry\">\n   <rect>\n    <x>0</x>\n    <y>0</y>\n    <width>640</width>\n    <height>300</height>\n   </rect>\n  </property>\n  <property name=\"windowTitle\">\n   <string>ButterManager</string>\n  </property>\n  <widget class=\"QWidget\" name=\"centralwidget\">\n   <layout class=\"QVBoxLayout\" name=\"verticalLayout_2\">\n    <item>\n     <layout class=\"QVBoxLayout\" name=\"verticalLayout\">\n      <property name=\"leftMargin\">\n       <number>10</number>\n      </property>\n      <property name=\"topMargin\">\n       <number>20</number>\n      </property>\n      <property name=\"rightMargin\">\n       <number>10</number>\n      </property>\n      <property name=\"bottomMargin\">\n       <number>10</number>\n      </property>\n      <item>\n       <widget class=\"QLabel\" name=\"label_take_snapshots\">\n        <property name=\"text\">\n         <string>Take snapshots</string>\n        </property>\n       </widget>\n      </item>\n      <item>\n       <spacer name=\"verticalSpacer_2\">\n        <property name=\"orientation\">\n         <enum>Qt::Vertical</enum>\n        </property>\n        <property name=\"sizeType\">\n         <enum>QSizePolicy::Fixed</enum>\n        </property>\n        <property name=\"sizeHint\" stdset=\"0\">\n         <size>\n          <width>20</width>\n          <height>10</height>\n         </size>\n        </property>\n       </spacer>\n      </item>\n      <item>\n       <widget class=\"QRadioButton\" name=\"radiobutton_all_subvolumes\">\n        <property name=\"text\">\n         <string>All s&amp;ubvolumes</string>\n        </property>\n       </widget>\n      </item>\n      <item>\n       <widget class=\"QRadioButton\" name=\"radiobutton_one_subvolume\">\n        <property name=\"text\">\n         <string>One speci&amp;fic subvolume</string>\n        </property>\n       </widget>\n      </item>\n      <item>\n       <layout class=\"QHBoxLayout\" name=\"horizontalLayout\">\n        <item>\n         <spacer name=\"horizontalSpacer\">\n          <property name=\"orientation\">\n           <enum>Qt::Horizontal</enum>\n          </property>\n          <property name=\"sizeType\">\n           <enum>QSizePolicy::Fixed</enum>\n          </property>\n          <property name=\"sizeHint\" stdset=\"0\">\n           <size>\n            <width>40</width>\n            <height>20</height>\n           </size>\n          </property>\n         </spacer>\n        </item>\n        <item>\n         <widget class=\"QComboBox\" name=\"combobox_subvolumes\"/>\n        </item>\n       </layout>\n      </item>\n      <item>\n       <spacer name=\"verticalSpacer\">\n        <property name=\"orientation\">\n         <enum>Qt::Vertical</enum>\n        </property>\n        <property name=\"sizeHint\" stdset=\"0\">\n         <size>\n          <width>20</width>\n          <height>40</height>\n         </size>\n        </property>\n       </spacer>\n      </item>\n      <item>\n       <layout class=\"QHBoxLayout\" name=\"horizontalLayout_2\">\n        <item>\n         <spacer name=\"horizontalSpacer_3\">\n          <property name=\"orientation\">\n           <enum>Qt::Horizontal</enum>\n          </property>\n          <property name=\"sizeHint\" stdset=\"0\">\n           <size>\n            <width>40</width>\n            <height>20</height>\n           </size>\n          </property>\n         </spacer>\n        </item>\n        <item>\n         <widget class=\"QPushButton\" name=\"button_ok\">\n          <property name=\"text\">\n           <string>OK</string>\n          </property>\n         </widget>\n        </item>\n        <item>\n         <widget class=\"QPushButton\" name=\"button_cancel\">\n          <property name=\"text\">\n           <string>Cancel</string>\n          </property>\n         </widget>\n        </item>\n       </layout>\n      </item>\n     </layout>\n    </item>\n   </layout>\n  </widget>\n </widget>\n <resources/>\n <connections/>\n</ui>\n"
  },
  {
    "path": "buttermanager/buttermanager/ui/SubvolumeWindow.ui",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>SubvolumeWindow</class>\n <widget class=\"QMainWindow\" name=\"SubvolumeWindow\">\n  <property name=\"geometry\">\n   <rect>\n    <x>0</x>\n    <y>0</y>\n    <width>640</width>\n    <height>300</height>\n   </rect>\n  </property>\n  <property name=\"windowTitle\">\n   <string>ButterManager</string>\n  </property>\n  <widget class=\"QWidget\" name=\"centralwidget\">\n   <layout class=\"QVBoxLayout\" name=\"verticalLayout_2\">\n    <property name=\"leftMargin\">\n     <number>10</number>\n    </property>\n    <property name=\"rightMargin\">\n     <number>10</number>\n    </property>\n    <item>\n     <spacer name=\"verticalSpacer_3\">\n      <property name=\"orientation\">\n       <enum>Qt::Vertical</enum>\n      </property>\n      <property name=\"sizeType\">\n       <enum>QSizePolicy::Fixed</enum>\n      </property>\n      <property name=\"sizeHint\" stdset=\"0\">\n       <size>\n        <width>20</width>\n        <height>10</height>\n       </size>\n      </property>\n     </spacer>\n    </item>\n    <item>\n     <widget class=\"QLabel\" name=\"label_add_subvolume\">\n      <property name=\"text\">\n       <string>Add subvolume</string>\n      </property>\n     </widget>\n    </item>\n    <item>\n     <spacer name=\"verticalSpacer_2\">\n      <property name=\"orientation\">\n       <enum>Qt::Vertical</enum>\n      </property>\n      <property name=\"sizeType\">\n       <enum>QSizePolicy::Fixed</enum>\n      </property>\n      <property name=\"sizeHint\" stdset=\"0\">\n       <size>\n        <width>20</width>\n        <height>10</height>\n       </size>\n      </property>\n     </spacer>\n    </item>\n    <item>\n     <layout class=\"QVBoxLayout\" name=\"verticalLayout\">\n      <item>\n       <layout class=\"QGridLayout\" name=\"gridLayout\">\n        <item row=\"0\" column=\"0\">\n         <widget class=\"QLabel\" name=\"label_subvolume_origin\">\n          <property name=\"text\">\n           <string>Subvolume to manage</string>\n          </property>\n         </widget>\n        </item>\n        <item row=\"0\" column=\"2\">\n         <widget class=\"QPushButton\" name=\"button_add_subvolume_orig\">\n          <property name=\"toolTip\">\n           <string comment=\" \">Select the subvolume you want to create the snapshot, f.i. / if you have a subvolume created for root</string>\n          </property>\n          <property name=\"text\">\n           <string/>\n          </property>\n         </widget>\n        </item>\n        <item row=\"1\" column=\"2\">\n         <widget class=\"QPushButton\" name=\"button_add_subvolume_dest\">\n          <property name=\"toolTip\">\n           <string>Selet the path where the snapshot will be stored. it is advisable to store the snapshot in a different subvolume</string>\n          </property>\n          <property name=\"text\">\n           <string/>\n          </property>\n         </widget>\n        </item>\n        <item row=\"1\" column=\"0\">\n         <widget class=\"QLabel\" name=\"label_subvolume_dest\">\n          <property name=\"text\">\n           <string>Path where the snapshot will be stored</string>\n          </property>\n         </widget>\n        </item>\n        <item row=\"1\" column=\"1\">\n         <widget class=\"QLineEdit\" name=\"line_subvolume_dest\"/>\n        </item>\n        <item row=\"0\" column=\"1\">\n         <widget class=\"QLineEdit\" name=\"line_subvolume_origin\"/>\n        </item>\n        <item row=\"2\" column=\"0\">\n         <widget class=\"QLabel\" name=\"label_subvolume_prefix\">\n          <property name=\"text\">\n           <string>Snapshot prefix</string>\n          </property>\n         </widget>\n        </item>\n        <item row=\"2\" column=\"1\">\n         <widget class=\"QLineEdit\" name=\"line_snapshot_name\"/>\n        </item>\n       </layout>\n      </item>\n     </layout>\n    </item>\n    <item>\n     <layout class=\"QHBoxLayout\" name=\"horizontalLayout\">\n      <item>\n       <widget class=\"QCheckBox\" name=\"checkbox_dont_remove_snapshots\">\n        <property name=\"text\">\n         <string>Don't remove any snapshot</string>\n        </property>\n       </widget>\n      </item>\n      <item>\n       <spacer name=\"horizontalSpacer\">\n        <property name=\"orientation\">\n         <enum>Qt::Horizontal</enum>\n        </property>\n        <property name=\"sizeHint\" stdset=\"0\">\n         <size>\n          <width>40</width>\n          <height>20</height>\n         </size>\n        </property>\n       </spacer>\n      </item>\n      <item>\n       <widget class=\"QLabel\" name=\"label_subvolume_snapshots_to_keep\">\n        <property name=\"text\">\n         <string>Snapshot to keep</string>\n        </property>\n       </widget>\n      </item>\n      <item>\n       <widget class=\"QSpinBox\" name=\"spinbox_snapshots_to_keep\"/>\n      </item>\n     </layout>\n    </item>\n    <item>\n     <spacer name=\"verticalSpacer\">\n      <property name=\"orientation\">\n       <enum>Qt::Vertical</enum>\n      </property>\n      <property name=\"sizeHint\" stdset=\"0\">\n       <size>\n        <width>20</width>\n        <height>40</height>\n       </size>\n      </property>\n     </spacer>\n    </item>\n    <item>\n     <layout class=\"QHBoxLayout\" name=\"horizontalLayout_2\">\n      <item>\n       <spacer name=\"horizontalSpacer_2\">\n        <property name=\"orientation\">\n         <enum>Qt::Horizontal</enum>\n        </property>\n        <property name=\"sizeHint\" stdset=\"0\">\n         <size>\n          <width>40</width>\n          <height>20</height>\n         </size>\n        </property>\n       </spacer>\n      </item>\n      <item>\n       <widget class=\"QPushButton\" name=\"button_ok\">\n        <property name=\"text\">\n         <string>OK</string>\n        </property>\n       </widget>\n      </item>\n      <item>\n       <widget class=\"QPushButton\" name=\"button_cancel\">\n        <property name=\"text\">\n         <string>Cancel</string>\n        </property>\n       </widget>\n      </item>\n     </layout>\n    </item>\n   </layout>\n  </widget>\n  <widget class=\"QStatusBar\" name=\"statusbar\"/>\n </widget>\n <resources/>\n <connections/>\n</ui>\n"
  },
  {
    "path": "buttermanager/buttermanager/ui/UpdatesWindow.ui",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>UpdatesWindow</class>\n <widget class=\"QMainWindow\" name=\"UpdatesWindow\">\n  <property name=\"geometry\">\n   <rect>\n    <x>0</x>\n    <y>0</y>\n    <width>767</width>\n    <height>442</height>\n   </rect>\n  </property>\n  <property name=\"windowTitle\">\n   <string>ButterManager</string>\n  </property>\n  <widget class=\"QWidget\" name=\"centralwidget\">\n   <layout class=\"QVBoxLayout\" name=\"verticalLayout_2\">\n    <property name=\"leftMargin\">\n     <number>10</number>\n    </property>\n    <property name=\"rightMargin\">\n     <number>10</number>\n    </property>\n    <item>\n     <layout class=\"QVBoxLayout\" name=\"verticalLayout\">\n      <property name=\"leftMargin\">\n       <number>10</number>\n      </property>\n      <property name=\"topMargin\">\n       <number>10</number>\n      </property>\n      <property name=\"rightMargin\">\n       <number>10</number>\n      </property>\n      <property name=\"bottomMargin\">\n       <number>10</number>\n      </property>\n      <item>\n       <layout class=\"QHBoxLayout\" name=\"horizontalLayout\">\n        <item>\n         <widget class=\"QLabel\" name=\"label_updates\">\n          <property name=\"text\">\n           <string>Packages to update</string>\n          </property>\n         </widget>\n        </item>\n        <item>\n         <spacer name=\"horizontalSpacer\">\n          <property name=\"orientation\">\n           <enum>Qt::Horizontal</enum>\n          </property>\n          <property name=\"sizeHint\" stdset=\"0\">\n           <size>\n            <width>40</width>\n            <height>20</height>\n           </size>\n          </property>\n         </spacer>\n        </item>\n        <item>\n         <widget class=\"QPushButton\" name=\"button_upgrade_system\">\n          <property name=\"toolTip\">\n           <string>Upgrade the system creating a previous snapshot and removing old snapshots according to configuration</string>\n          </property>\n          <property name=\"text\">\n           <string>Upgrade with snapshots</string>\n          </property>\n         </widget>\n        </item>\n        <item>\n         <widget class=\"QPushButton\" name=\"button_upgrade_system_without_snapshots\">\n          <property name=\"toolTip\">\n           <string>Upgrade the system without creating snapshots</string>\n          </property>\n          <property name=\"text\">\n           <string>Upgrade without snapshots</string>\n          </property>\n         </widget>\n        </item>\n        <item>\n         <widget class=\"QPushButton\" name=\"button_cancel\">\n          <property name=\"text\">\n           <string>Cancel</string>\n          </property>\n         </widget>\n        </item>\n       </layout>\n      </item>\n      <item>\n       <widget class=\"QTextEdit\" name=\"text_edit_console\"/>\n      </item>\n     </layout>\n    </item>\n   </layout>\n  </widget>\n  <widget class=\"QStatusBar\" name=\"statusbar\"/>\n </widget>\n <resources/>\n <connections/>\n</ui>\n"
  },
  {
    "path": "buttermanager/buttermanager/util/__init__.py",
    "content": "#Copyright 2018-2019 Eloy García Almadén <eloy.garcia.pca@gmail.com>\n#\n# This file is part of buttermanager.\n#\n# This program is free software: you can redistribute it and / or modify it\n# under the terms of the GNU General Public License as published by the\n# Free Software Foundation, version 3 of the License.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>."
  },
  {
    "path": "buttermanager/buttermanager/util/settings.py",
    "content": "# -*- coding: utf-8 -*-\n#\n# Copyright 2018-2019 Eloy García Almadén <eloy.garcia.pca@gmail.com>\n#\n# This file is part of buttermanager.\n#\n# This program is free software: you can redistribute it and / or modify it\n# under the terms of the GNU General Public License as published by the\n# Free Software Foundation, version 3 of the License.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\n\"\"\"This module gathers all the global attributes, methods and classes needed for application settings.\n\n\"\"\"\nfrom . import utils\nfrom .. import filesystem\nimport os\nimport yaml\n\n# Global module constants\nCONF_FILE = \"buttermanager.yaml\"\nVERSION = \"2.5.2\"\n\n# Global module attributes\n# Application version\napplication_version = \"\"\n# Application name\napplication_name = \"\"\n# Application work directory\napplication_path = \"\"\n# Logs directory\nlogs_path = \"\"\n# User's password\nuser_password = \"\"\n# Linux distribution\nuser_os = \"\"\n# Do user want to remove snapshots? 0=False 1=True\nremove_snapshots = 1\n# Do user want to upgrade snap packages? 0=False 1=True\nsnap_packages = 1\n# Do user want to upgrade flatpak packages? 0=False 1=True\nflatpak_packages = 1\n# Do user want to upgrade packages from AUR? 0=False 1=True\naur_repository = 1\n# Do user want to check for updates at startup? 0=False 1=True\ncheck_at_startup = 1\n# The path of the root snapshot that must be within /etc/fstab as / mount point\npath_to_consolidate_root_snapshot = \"0\"\n# Do user want to boot the system from GRUB using snapshots? 0=False 1=True\ngrub_btrfs = 0\n# Do user want to save log automatically after upgrading system? 0=False 1=True\nsave_log = 1\n# Subvolumes managed by the application\n# It will be a dictionary:\n# Key=origin path for the subvolume; Value=Subvolume object\nsubvolumes = {}\n# Properties Manager\nproperties_manager = None\n# Base fot size for all the UI elements (it is dynamically calculated during application start up)\nbase_font_size = 10\n# Fot size increment defined by the user\nfont_size_increment = 0\n# Location of the UI layouts directory\nui_dir = \"\"\n# Location of the images directory\nimages_dir = \"\"\n# Desktop environment\ndesktop_environment = \"\"\n# Installation type\ninstallation_type = \"\"\n\n\nclass PropertiesManager:\n    \"\"\"Manages the user properties for the application.\n\n    If no user settings are loaded yet, then the yaml file ~/.buttermanager/buttermanager.yaml will be\n    read and parsed in self.__user_settings dictionary.\n\n    The keys of the dictionary will be the properties name in the yaml file. The values will be the values\n    in the yaml file for every property.\n    \"\"\"\n    # Constructor\n    def __init__(self):\n        # Logger\n        self.__logger = utils.Logger(self.__class__.__name__).get()\n        # Setting global values related to the application\n        self.__conf_file_path = '{application_path}/{conf_file}'.format(application_path=application_path,\n                                                                        conf_file=CONF_FILE)\n        self.__user_settings = []\n        # Reading configuration file (buttermanager.yaml file within ~/.buttermanager directory)\n        if os.path.exists(self.__conf_file_path):\n            conf_file = open(self.__conf_file_path)\n            self.__user_settings = yaml.load(conf_file, Loader=yaml.FullLoader)\n            conf_file.close()\n        else:\n            self.__logger.info(\"Warning: There is no configuration file...\")\n\n    def get_property(self, property):\n        \"\"\"Gets the value of a property.\n\n        Arguments:\n            property (string): Property to get its value.\n\n        Returns:\n            string: The value of the property. 0 if the property was not found.\n        \"\"\"\n        value = \"\"\n        if len(self.__user_settings) > 0:\n            value = self.__user_settings.get(property, 0)\n        return value\n\n    def set_property(self, property, value):\n        \"\"\"Sets the value of a property.\n\n        Arguments:\n            property (string): Property to set its value.\n            value (string): Value to be set.\n        \"\"\"\n        self.__logger.info(\"Setting property {property} with value {value}\".format(property=property, value=value))\n        # Setting property in memory\n        self.__user_settings[property] = value\n\n        # Setting property in buttermanager.yaml file\n        self.__store_configuration()\n\n    def remove_property(self, property):\n        \"\"\"Removes s property from properties file.\n\n        Arguments:\n            property (string): Property to be removed.\n        \"\"\"\n        self.__logger.info(\"Removing property {property}\".format(property=property))\n        self.__user_settings.pop(property)\n\n        # Storing buttermanager.yaml file\n        self.__store_configuration()\n\n    def set_subvolume(self, subvolume_selected, snapshot_where, snapshot_prefix, snapshots_to_keep):\n        \"\"\"Sets the value of a subvolume.\n\n        If snapshot_where = None and snapshot_prefix = None, then the subvolume\n        will be removed\n\n        Arguments:\n            subvolume_selected (string): Subvolume selected to be set with the new values.\n            snapshot_where (string): Path where the snapshot is going to be stored. None if the subvolume is removed\n            snapshot_prefix (string): Prefix used to store the snapshot of a specific subvolume. None if the subvolume\n            is removed\n            snapshots_to_keep (int): Number of the snapshots to keep in the filesystem for this subvolume\n        \"\"\"\n        self.__logger.info(\"Setting subvolume {subvolume} with new values: where {where}; prefix {prefix}; \"\n                           \"snapshots to keep {snapshots_to_keep}\".format(subvolume=subvolume_selected,\n                                                                          where=snapshot_where,\n                                                                          prefix=snapshot_prefix,\n                                                                          snapshots_to_keep=snapshots_to_keep))\n        if subvolume_selected in subvolumes:\n            if not snapshot_where and not snapshot_prefix:\n                # The subvolume has to be removed from memory\n                subvolumes.pop(subvolume_selected, 'None')\n            else:\n                # Modifying subvolume in memory\n                subvolumes[subvolume_selected].subvolume_dest = snapshot_where if snapshot_where[-1] == '/' else snapshot_where + '/'\n                subvolumes[subvolume_selected].snapshot_name = snapshot_prefix\n                subvolumes[subvolume_selected].snapshots_to_keep = snapshots_to_keep\n        else:\n            subvolumes[subvolume_selected] = filesystem.snapshot.Subvolume(subvolume_selected,\n                                                                           snapshot_where,\n                                                                           snapshot_prefix,\n                                                                           snapshots_to_keep)\n        subvolumes_orig = \"\"\n        subvolumes_dest = \"\"\n        subvolumes_prefix = \"\"\n        subvolumes_snapshost_to_keep = \"\"\n        index = 0\n\n        for subvolume in subvolumes:\n            subvolumes_orig += subvolumes[subvolume].subvolume_origin\n            subvolumes_dest += subvolumes[subvolume].subvolume_dest\n            subvolumes_prefix += subvolumes[subvolume].snapshot_name\n            subvolumes_snapshost_to_keep += str(subvolumes[subvolume].snapshots_to_keep)\n            if index + 1 < len(subvolumes):\n                subvolumes_orig += \"|\"\n                subvolumes_dest += \"|\"\n                subvolumes_prefix += \"|\"\n                subvolumes_snapshost_to_keep += \"|\"\n            index += 1\n\n        self.__user_settings['subvolumes_orig'] = subvolumes_orig\n        self.__user_settings['subvolumes_dest'] = subvolumes_dest\n        self.__user_settings['subvolumes_prefix'] = subvolumes_prefix\n        self.__user_settings['subvolumes_snapshots_to_keep'] = subvolumes_snapshost_to_keep\n\n        # Setting property in buttermanager.yaml file\n        self.__store_configuration()\n\n    def __store_configuration(self):\n        \"\"\"Stores configuration file.\n\n        \"\"\"\n        # Setting property in buttermanager.yaml file\n        if os.path.exists(self.__conf_file_path):\n            conf_file = open(self.__conf_file_path, 'w')\n            yaml.dump(self.__user_settings, conf_file)\n            conf_file.close()\n        else:\n            self.__logger.info(\"Warning: There is no configuration file...\")\n"
  },
  {
    "path": "buttermanager/buttermanager/util/utils.py",
    "content": "# -*- coding: utf-8 -*-\n#\n# Copyright 2018-2019 Eloy García Almadén <eloy.garcia.pca@gmail.com>\n#\n# This file is part of buttermanager.\n#\n# This program is free software: you can redistribute it and / or modify it\n# under the terms of the GNU General Public License as published by the\n# Free Software Foundation, version 3 of the License.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\n\"\"\"This module gathers all the utils and tools for buttermanager application.\n\n\"\"\"\nfrom . import settings\nfrom ..exception import exception\nfrom ..filesystem import snapshot\nfrom ..window import windows\nfrom PyQt5.QtWidgets import QFileDialog\nfrom tkinter import Tk\nfrom tkinter.filedialog import askdirectory\nimport logging\nimport logging.handlers\nimport os\nimport pathlib\nimport shutil\nimport subprocess\nimport sys\nimport urllib.request\nimport urllib.error\nimport yaml\n\n# Constants\nGB = \"GiB\"  # Gigabytes\nMB = \"MiB\"  # Megabytes\nKB = \"KiB\"  # Kilobytes\nB = \"B\"     # Bytes\nBYTE_SIZE = 1024\nARCH_PM = \"pacman\"\nDEBIAN_PM = \"apt\"\nSUSE_PM = \"zypper\"\nFEDORA_PM = \"dnf\"\nSNAP_PM = \"snap\"\nOS_ARCH = \"ARCH\"\nOS_DEBIAN = \"DEBIAN\"\nOS_SUSE = \"SUSE\"\nOS_FEDORA = \"FEDORA\"\nVERSION_URL = \"https://raw.githubusercontent.com/egara/buttermanager/master/version.txt\"\n\n\nclass ConfigManager:\n    \"\"\"Manages the configuration.\n\n    \"\"\"\n    # Constants\n    APP_NAME = \"buttermanager\"\n    LOGS_DIR = \"logs\"\n\n    # Constructor\n    def __init__(self):\n        # Setting global values related to the application\n        settings.application_name = self.APP_NAME\n        application_directory = \".{name}\".format(name=settings.application_name)\n        settings.application_path = os.path.join(str(pathlib.Path.home()), application_directory)\n        settings.logs_path = os.path.join(settings.application_path, self.LOGS_DIR)\n\n        # Creating application's directory if it is needed\n        if not os.path.exists(settings.application_path):\n            # Application directory does not exist. Creating directory...\n            os.makedirs(settings.application_path)\n\n            # Creating buttermanager.yaml file with default values\n            config_file_as_dictionary = '''\n                aur_repository: 0\n                check_at_startup: 0\n                snap_packages: 0\n                flatpak_packages: 0\n                save_log: 1\n                grub_btrfs: 0\n                path_to_consolidate_root_snapshot: 0\n                subvolumes_dest:\n                subvolumes_orig:\n                subvolumes_prefix:\n                subvolumes_snapshots_to_keep:\n                font_size_increment: 0\n            '''\n            config_file_dictionary = yaml.safe_load(config_file_as_dictionary)\n            conf_file_path = '{application_path}/{conf_file}'.format(application_path=settings.application_path,\n                                                                     conf_file=settings.CONF_FILE)\n            conf_file = open(conf_file_path, 'w')\n            yaml.dump(config_file_dictionary, conf_file)\n            conf_file.close()\n\n            # Sanitazing config file. All null values will be replaced by blank spaces\n            with open(conf_file_path, 'r') as file:\n                config_file_data = file.read()\n                config_file_data = config_file_data.replace('null', '')\n\n            with open(conf_file_path, 'w') as file:\n                file.write(config_file_data)\n\n        # Creating logs directory if it doesn't exist\n        if not os.path.exists(settings.logs_path):\n            os.makedirs(settings.logs_path)\n\n        # Logger\n        self.__logger = Logger(self.__class__.__name__).get()\n\n    def configure(self):\n        \"\"\"Configures the application.\n\n        \"\"\"\n        # Version\n        settings.application_version = settings.VERSION\n\n        # Checking OS\n        if exist_program(SUSE_PM):\n            settings.user_os = OS_SUSE\n        elif exist_program(DEBIAN_PM):\n            settings.user_os = OS_DEBIAN\n        elif exist_program(ARCH_PM):\n            settings.user_os = OS_ARCH\n        elif exist_program(FEDORA_PM):\n            settings.user_os = OS_FEDORA\n        self.__logger.info(\"Checking OS. {os} found\".format(os=settings.user_os))\n\n        # Checking Desktop Environment\n        settings.desktop_environment = get_desktop_environment()\n        self.__logger.info(\"Checking Desktop Environment. {de} found\".format(de=settings.desktop_environment))\n\n        # Checking Installation Type\n        if not os.path.exists(\"/opt/buttermanager/buttermanager\"):\n            settings.installation_type = \"native\"\n        else:\n            settings.installation_type = \"venv\"\n        self.__logger.info(\"Installation type: {installation}\".format(installation=settings.installation_type))\n\n        # Creating a properties manager to manage all the application properties\n        self.__logger.info(\"Creating PropertiesManager...\")\n        settings.properties_manager = settings.PropertiesManager()\n\n        # Triggering migration process\n        self.migrate_properties()\n\n        # Retrieving configuration...\n        self.__logger.info(\"Retrieving user's configuration from buttermanager.yaml file and loading it in memory...\")\n\n        # Do the user want to update snap packages during the upgrading process\n        settings.snap_packages = int(settings.properties_manager.get_property('snap_packages'))\n\n        # Do the user want to update flatpak packages during the upgrading process\n        settings.flatpak_packages = int(settings.properties_manager.get_property('flatpak_packages'))\n\n        # Do the user want to update AUR packages during the upgrading process\n        settings.aur_repository = int(settings.properties_manager.get_property('aur_repository'))\n\n        # Do the user want to check for updates at startup\n        settings.check_at_startup = int(settings.properties_manager.get_property('check_at_startup'))\n\n        # Do user want to boot the system from GRUB using snapshots\n        settings.grub_btrfs = int(settings.properties_manager.get_property('grub_btrfs'))\n\n        # The path of the root snapshot that must be within /etc/fstab as / mount point\n        # It will be 0 if this property is not defined yet or it is empty\n        settings.path_to_consolidate_root_snapshot = settings.properties_manager.\\\n            get_property('path_to_consolidate_root_snapshot')\n\n        # Do the user want to save logs automatically\n        settings.save_log = int(settings.properties_manager.get_property('save_log'))\n\n        # Font size increment defined by the user\n        settings.font_size_increment = int(settings.properties_manager.get_property('font_size_increment'))\n\n        # Subvolumes to manage\n        subvolumes_list = get_subvolumes()\n        subvolumes = {}\n        for subvolume in subvolumes_list:\n            subvolumes[subvolume.subvolume_origin] = subvolume\n\n        settings.subvolumes = subvolumes\n\n    def migrate_properties(self):\n        \"\"\"Migrates buttermanager.yaml properties file from one version to another if necessary.\n\n        \"\"\"\n        # Checking if it is necessary to do some migrations to newer versions\n\n        # ##########################################\n        # BEGIN Version 2.3 or older -> 2.4 or newer\n        # ##########################################\n        # Number of snapshots per subvolume have been introduced in version 2.4\n        # Filling this property in case the user comes from version 2.3\n        snapshots_to_keep = int(settings.properties_manager.get_property('snapshots_to_keep'))\n        remove_snapshots = settings.properties_manager.get_property('remove_snapshots')\n        if snapshots_to_keep != 0:\n            # snapshots_to_keep property is still in buttermanager.yaml\n            self.__logger.info(\"Migrating from version 2.3 or older to version 2.4 or newer. Please wait...\")\n            self.__logger.info(\"snapshots_to_keep property and remove_snapshots will be removed from buttermanager.yaml\"\n                               \" configuration file and every subvolume defined will have their own properties\")\n            subvolumes_orig_raw = settings.properties_manager.get_property('subvolumes_orig')\n            subvolumes_snapshots_to_keep_raw = \"\"\n            if subvolumes_orig_raw is not None and subvolumes_orig_raw != \"\":\n                subvolumes_orig = subvolumes_orig_raw.split(\"|\")\n                for index, subvolume_orig in enumerate(subvolumes_orig):\n                    if remove_snapshots == 0:\n                        # From this moment, when snapshots_to_keep is -1, then the user havve decided not to\n                        # delete any snapshot\n                        snapshots_to_keep = -1\n                    subvolumes_snapshots_to_keep_raw += str(snapshots_to_keep)\n                    if index + 1 < len(subvolumes_orig):\n                        subvolumes_snapshots_to_keep_raw += \"|\"\n            # Adding the new property\n            settings.properties_manager.set_property('subvolumes_snapshots_to_keep', subvolumes_snapshots_to_keep_raw)\n\n            # Removing old snapshots_to_keep and remove_snapshots properties\n            settings.properties_manager.remove_property('snapshots_to_keep')\n            settings.properties_manager.remove_property('remove_snapshots')\n\n        # ########################################\n        # END Version 2.3 or older -> 2.4 or newer\n        # ########################################\n\n        self.__logger.info(\"Migration process has finished successfully!\")\n\n\nclass Logger(object):\n    \"\"\"Creates the logs of the application.\n\n    \"\"\"\n    def __init__(self, class_name):\n        name = os.path.join(settings.application_path, \"buttermanager.log\")\n        logger = logging.getLogger(class_name)\n        logger.setLevel(logging.DEBUG)\n\n        # Add the log message handler to the logger\n        handler = logging.handlers.RotatingFileHandler(name, maxBytes=1048576, backupCount=5)\n        formatter = logging.Formatter('%(asctime)s %(levelname)s:%(name)s. %(message)s')\n        handler.setFormatter(formatter)\n        logger.addHandler(handler)\n        self.__logger = logger\n\n    def get(self):\n        return self.__logger\n\n\nclass VersionChecker:\n    \"\"\"Checks if there is a newest version of ButterManager available.\n\n    \"\"\"\n    def __init__(self, parent_window):\n        # Logger\n        self.__logger = Logger(self.__class__.__name__).get()\n        self.__logger.info(\"Checking for a new version of ButterManager. Please wait...\")\n        self.__version_url = VERSION_URL\n        self.__parent_window = parent_window\n\n    def check_version(self):\n        \"\"\"Checks if there is a newest version of ButterManager available.\n\n        \"\"\"\n        try:\n            # Retrieving the last version from GitHub\n            response = urllib.request.urlopen(self.__version_url)\n            last_version = response.read().decode(response.headers.get_content_charset()).strip()\n\n        except urllib.error.HTTPError as exception:\n            self.__logger.error(\"Error checking new versions of ButterManager. Reason: \" + str(exception.reason))\n        except urllib.error.URLError as exception:\n            self.__logger.error(\"Error checking new versions of ButterManager. Reason: \" + str(exception.reason))\n        else:\n            self.__logger.info(\"Last version is \" + last_version + \" and current version is \" +\n                               settings.application_version)\n\n            if last_version != settings.application_version:\n                if settings.user_os == OS_ARCH:\n                    info_window = windows.GeneralInfoWindow(self.__parent_window, \"New version \" +\n                                                                   last_version + \" is available. Update ButterManager \"\n                                                                                  \"via AUR\")\n                else:\n                    info_window = windows.GeneralInfoWindow(self.__parent_window, \"New version \" +\n                                                                   last_version + \" is available. Check the repository \"\n                                                                   \"\\nof the project \"\n                                                                   \"(https://github.com/egara/buttermanager)\\n \"\n                                                                   \"to get the latest code\")\n\n                info_window.show()\n\n\n# Module's methods\ndef execute_command(command, console=False, root=False):\n    \"\"\"Executes a shell command.\n\n    Arguments:\n        command (str): Command to be executed.\n        console (boolean): The command output needs to be redirected to the console.\n        root (boolean): The command is only accesible by root user\n\n    Returns:\n        str: Command line output encoded in UTF-8.\n    \"\"\"\n\n    # Checking if the program executed by the command is installed in the system\n    program = command.split()\n    single_command = program[0]\n    if \"sudo\" in program:\n        sudo_position = program.index(\"sudo\")\n        single_command = program[sudo_position + 2]\n    if exist_program(single_command, root=root):\n        echo = subprocess.Popen(['echo', settings.user_password], stdout=subprocess.PIPE)\n        # run method receives a list, so it is necessary to convert command string into a list using split\n        result = subprocess.Popen(command.split(), stdin=echo.stdout, stdout=subprocess.PIPE)\n\n        if not console:\n            # The whole output will be returned\n            # result is Bytes type, so it is needed to decode Unicode string using UTF-8\n            commandline_output = result.stdout.read().decode('utf-8')\n        else:\n            # The output will be written in stdout in real time\n            # It is good for operations that need to display the output\n            # in the GUI terminal of the application in real time\n            for line in iter(result.stdout.readline, b''):\n                sys.stdout.write(line.decode('utf-8'))\n            commandline_output = None\n\n        return commandline_output\n    else:\n        # Logger\n        logger = Logger(sys.modules['__main__'].__file__).get()\n        logger.info(single_command + \" program does not exist in the system\")\n        raise exception.NoCommandFound()\n\n\ndef get_percentage(total, parcial):\n    \"\"\"Calculates the percentage between total amount and parcial amount.\n\n    Arguments:\n        total (str): Total amount. It should be specified the unit, f.i.: 30.00GiB\n        parcial (str): Parcial amount. It should be specified the unit, f.i.: 3.00GiB\n    Returns:\n        int: Percentage between total and parcial, f.i.: 10 (3.00GiB is 10% of 30.00GiB).\n\n    >>> get_percentage(\"30.00GiB\", \"3.00GiB\")\n    10\n    \"\"\"\n    total_number_unit = get_number_unit(total)\n    parcial_number_unit = get_number_unit(parcial)\n    # All the operations will be done using Bytes unit as reference\n    total_number = convert_to_bytes(total_number_unit)\n    parcial_number = convert_to_bytes(parcial_number_unit)\n    percentage = int((parcial_number * 100) / total_number)\n    return percentage\n\n\ndef get_number_unit(number_unit_string):\n    \"\"\"Gets the number and the unit present in a specific string.\n\n    Arguments:\n        number_unit_string (str): String consisting of amount and unit, f.i.: 30.00GiB\n\n    Returns:\n        dictionary (key=:obj:'str', value=:obj:'str' or obj:'int'): all the info. The keys of the dictionary will be:\n            - total_size: Device size\n            - total_allocated: Device allocated\n\n    >>> get_number_unit(\"30.00GiB\")\n    ['number': 30.00, 'unit': 'GiB']\n    \"\"\"\n    number_unit = {'number': 0.0, 'unit': 'GiB'}\n    number_unit_string_list = number_unit_string.split('.')\n    number = float(\"{integer}.{decimal}\".format(integer=number_unit_string_list[0].strip(),\n                                                decimal=number_unit_string_list[1][0:2]))\n    number_unit['number'] = number\n    number_unit['unit'] = number_unit_string_list[1][2:]\n    return number_unit\n\n\ndef convert_to_bytes(number_unit):\n    \"\"\"Converts a number into a bytes depending on its unit.\n\n    Arguments:\n        number_unit (dictionary): Number and unit to convert\n\n    Returns:\n        float: Number in bytes\n\n    >>> number_unit = {'number': 30.00, 'unit': 'GiB'}\n    >>> convert_to_bytes(number_unit)\n    32212254720\n    \"\"\"\n    factor = 1\n    if number_unit['unit'] == GB:\n        factor = factor * BYTE_SIZE * BYTE_SIZE * BYTE_SIZE\n    elif number_unit['unit'] == MB:\n        factor = factor * BYTE_SIZE * BYTE_SIZE\n    elif number_unit['unit'] == KB:\n        factor = factor * BYTE_SIZE\n    elif number_unit['unit'] == B:\n        factor = factor\n\n    return number_unit['number'] * factor\n\n\ndef exist_program(program, root=False):\n    \"\"\"Checks if a program is installed on the system.\n\n    Some problems have been detected in distributions like SUSE and OpenSUSE using\n    shutil.which function. There are some commands, like btrfs, that are only found\n    if sudo which is used instead of simply which from current user.\n    Because of that, root variable has been declared above. By default, root value\n    will be False, i.e. for those commands which are discoverable simply by using\n    which without sudo.\n\n    Arguments:\n        program (string): Program to check\n        root (boolean): The program to be checked is only usable by root user\n\n    Returns:\n        bool: True if the program is installed, False otherwise\n\n    >>> exist_program('ls')\n    True\n    \"\"\"\n    if root:\n        command = \"sudo -S which \" + program\n        # Checking if the program executed by the command is installed in the system\n        echo = subprocess.Popen(['echo', settings.user_password], stdout=subprocess.PIPE)\n        # run method receives a list, so it is necessary to convert command string into a list using split\n        result = subprocess.Popen(command.split(), stdin=echo.stdout, stdout=subprocess.PIPE)\n\n        # The whole output will be returned\n        # result is Bytes type, so it is needed to decode Unicode string using UTF-8\n        commandline_output = result.stdout.read().decode('utf-8')\n        exist = not commandline_output.startswith(\"which:\")\n        return exist\n    else:\n        path = shutil.which(program)\n        return path is not None\n\n\ndef get_subvolumes():\n    \"\"\"Gets the subvolumes defined by the user in the properties file.\n\n    Returns:\n        list (:obj:`list` of :obj:`Subvolume`): subvolumes objects defined by the user.\n    \"\"\"\n    subvolumes = []\n    subvolumes_orig_raw = settings.properties_manager.get_property('subvolumes_orig')\n    subvolumes_dest_raw = settings.properties_manager.get_property('subvolumes_dest')\n    subvolumes_prefix_raw = settings.properties_manager.get_property('subvolumes_prefix')\n    subvolumes_snapshots_to_keep_raw = settings.properties_manager.get_property('subvolumes_snapshots_to_keep')\n    if subvolumes_orig_raw is not None and subvolumes_orig_raw != \"\":\n        subvolumes_orig = subvolumes_orig_raw.split(\"|\")\n        subvolumes_dest = subvolumes_dest_raw.split(\"|\")\n        subvolumes_prefix = subvolumes_prefix_raw.split(\"|\")\n        subvolumes_snapshots_to_keep = subvolumes_snapshots_to_keep_raw.split(\"|\")\n        for index, subvolume_orig in enumerate(subvolumes_orig):\n            subvolume = snapshot.Subvolume(subvolume_orig, subvolumes_dest[index], subvolumes_prefix[index],\n                                           subvolumes_snapshots_to_keep[index])\n            subvolumes.append(subvolume)\n\n    return subvolumes\n\n\ndef scale_fonts(ui_elements):\n    \"\"\"Scales all the UI elements fonts in order to fit on the window.\n\n    Arguments:\n        ui_elements (list): UI elements to change the font\n    \"\"\"\n    font_size = settings.base_font_size + int(settings.properties_manager.get_property('font_size_increment'))\n    # Changing the font for every UI element\n    for label in ui_elements:\n        font = label.font()\n        font.setPointSize(font_size)\n        label.setFont(font)\n\n\ndef get_desktop_environment():\n    \"\"\"Gets desktop environment.\n    \"\"\"\n    desktop_environment = 'generic'\n    if os.environ.get('KDE_FULL_SESSION') == 'true':\n        desktop_environment = 'kde'\n    elif os.environ.get('GNOME_DESKTOP_SESSION_ID'):\n        desktop_environment = 'gnome'\n    else:\n        try:\n            info = subprocess.getoutput('xprop -root _DT_SAVE_MODE')\n            if ' = \"xfce4\"' in info:\n                desktop_environment = 'xfce'\n        except (OSError, RuntimeError):\n            pass\n    return desktop_environment\n\n\ndef open_file_browser_directory(parent_window):\n    \"\"\"Opens a file browser to select a directory.\n\n    A bug has being detected in KDE Plasma native installatiom. When a native file browser is opened to\n    select a directory, then the application crashes. This doesn't happen in GNOME for example. So a\n    fallback has had to be implemented for this case, suing TKinter.\n\n    Arguments:\n        parent_window: Parent window\n\n    Returns:\n        str: Path of the directory selected\n    \"\"\"\n\n    # Creating a QFileDialog or Tkinter file browser to select the directory\n    # Only directories will be allowed\n    selected_path = \"\"\n    if settings.desktop_environment == 'kde' and settings.installation_type == 'native':\n        Tk().withdraw()\n        filename = askdirectory()\n\n        if filename:\n            selected_path = filename\n    else:\n        file_dialog = QFileDialog(parent_window)\n        file_dialog.setFileMode(QFileDialog.Directory)\n        file_dialog.setOption(QFileDialog.ShowDirsOnly, True)\n        file_dialog.setOption(QFileDialog.DontUseNativeDialog)\n\n        if file_dialog.exec_():\n            selected_path = file_dialog.selectedFiles()[0]\n\n    return selected_path\n"
  },
  {
    "path": "buttermanager/buttermanager/window/__init__.py",
    "content": ""
  },
  {
    "path": "buttermanager/buttermanager/window/windows.py",
    "content": "# -*- coding: utf-8 -*-\n#\n# Copyright 2018-2019 Eloy García Almadén <eloy.garcia.pca@gmail.com>\n#\n# This file is part of buttermanager.\n#\n# This program is free software: you can redistribute it and / or modify it\n# under the terms of the GNU General Public License as published by the\n# Free Software Foundation, version 3 of the License.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\n\"\"\"This module gathers all the additional windows for displaying information in the application.\n\n\"\"\"\nfrom ..exception import exception\nfrom ..filesystem import snapshot\nfrom ..util import settings, utils\nimport os\nimport subprocess\nimport sys\nfrom PyQt5.QtWidgets import QDesktopWidget, QDialog, QMainWindow, QPushButton, QVBoxLayout, QLabel\nfrom PyQt5 import uic, QtCore, QtTest\nfrom PyQt5.QtCore import pyqtSignal, QSize\nfrom PyQt5.QtGui import QIcon, QTextCursor\n\n\nclass InfoWindow(QDialog):\n    \"\"\"Window to display information.\n\n    \"\"\"\n    # Constructor\n    def __init__(self, parent, information):\n        QDialog.__init__(self, parent)\n        # Setting window flags, f.i. this window won't have a close button\n        self.setWindowFlags(\n            QtCore.Qt.Window |\n            QtCore.Qt.CustomizeWindowHint |\n            QtCore.Qt.WindowTitleHint |\n            QtCore.Qt.WindowMinimizeButtonHint |\n            QtCore.Qt.WindowStaysOnTopHint\n        )\n        self.parent = parent\n\n        # UI elements\n        self.__ui_elements = []\n\n        # Initializing the window\n        self.init_ui(information)\n\n    def init_ui(self, information):\n        \"\"\"Initializes the Graphic User Interface.\n\n        \"\"\"\n        # Loading User Interface\n        info_window_ui = os.path.join(settings.ui_dir, 'InfoWindow.ui')\n        uic.loadUi(info_window_ui, self)\n\n        # Setting the window icon\n        buttermanager_icon = os.path.join(settings.images_dir, 'buttermanager50.png')\n        self.setWindowIcon(QIcon(buttermanager_icon))\n\n        # Adjusting font scale\n        # UI elements\n        self.__ui_elements = [self.label_info]\n        utils.scale_fonts(self.__ui_elements)\n        # Tooltips\n        self.setStyleSheet(\" QToolTip{font: \" + str(settings.base_font_size) + \"pt}\")\n\n        # Setting size for the window\n        self.resize(320, 240)\n\n        # Centering the window\n        qt_rectangle = self.frameGeometry()\n        center_point = QDesktopWidget().availableGeometry().center()\n        qt_rectangle.moveCenter(center_point)\n        self.move(qt_rectangle.topLeft())\n\n        # Setting information\n        self.label_info.setText(information)\n\n\nclass GeneralInfoWindow(QDialog):\n    \"\"\"Window to display generic information.\n\n    \"\"\"\n    # Constructor\n    def __init__(self, parent, information):\n        QDialog.__init__(self, parent)\n        # Setting window flags, f.i. this window won't have a close button\n        self.setWindowFlags(\n            QtCore.Qt.Window |\n            QtCore.Qt.CustomizeWindowHint |\n            QtCore.Qt.WindowTitleHint |\n            QtCore.Qt.WindowStaysOnTopHint\n        )\n        self.parent = parent\n\n        # UI elements\n        self.__ui_elements = []\n\n        # Initializing the window\n        self.init_ui(information)\n\n    def init_ui(self, information):\n        \"\"\"Initializes the Graphic User Interface.\n\n        \"\"\"\n        # Loading User Interface\n        general_window_ui = os.path.join(settings.ui_dir, 'GeneralInfoWindow.ui')\n        uic.loadUi(general_window_ui, self)\n\n        # Setting the window icon\n        buttermanager_icon = os.path.join(settings.images_dir, 'buttermanager50.png')\n        self.setWindowIcon(QIcon(buttermanager_icon))\n\n        # Adjusting font scale\n        # UI elements\n        self.__ui_elements = [self.label_info, self.button_box]\n        utils.scale_fonts(self.__ui_elements)\n        # Tooltips\n        self.setStyleSheet(\" QToolTip{font: \" + str(settings.base_font_size) + \"pt}\")\n\n        # Setting size for the window\n        self.resize(420, 285)\n\n        # Centering the window\n        qt_rectangle = self.frameGeometry()\n        center_point = QDesktopWidget().availableGeometry().center()\n        qt_rectangle.moveCenter(center_point)\n        self.move(qt_rectangle.topLeft())\n\n        # Setting information\n        self.label_info.setText(information)\n\n        # Buttons\n        self.button_box.rejected.connect(self.reject)\n\n\nclass ConsolidateSnapshotWindow(QDialog):\n    \"\"\"Window to consolidate or not root snapshot.\n\n    This window will be displayed when user boots his/her system using a snapshot from GRUB different that\n    the default snapshot for root. The user will be asked if he/she wants to consolidate the current\n    snapshot as default snapshot for root.\n\n    \"\"\"\n    # Constructor\n    def __init__(self, parent, snapshot_to_clone_in_root_full_path, root_subvolume):\n        \"\"\" Constructor.\n\n        Arguments:\n            snapshot_to_clone_in_root_full_path (str): Full path of the snapshot booted and the one to use for\n            consolidating as default root subvolume.\n            root_subvolume (filesyste.snapshot.Subvolume): Subvolume representing system's root\n        \"\"\"\n        QDialog.__init__(self, parent)\n        # Setting window flags, f.i. this window won't have a close button\n        self.setWindowFlags(\n            QtCore.Qt.Window |\n            QtCore.Qt.CustomizeWindowHint |\n            QtCore.Qt.WindowTitleHint |\n            QtCore.Qt.WindowStaysOnTopHint\n        )\n        self.parent = parent\n\n        # UI elements\n        self.__ui_elements = []\n\n        # Logger\n        self.__logger = utils.Logger(self.__class__.__name__).get()\n\n        # Initializing private attributes\n        self.__snapshot_to_clone_in_root_full_path = snapshot_to_clone_in_root_full_path\n        self.__root_subvolume = root_subvolume\n\n        # Initializing the window\n        self.init_ui()\n\n    def init_ui(self):\n        \"\"\"Initializes the Graphic User Interface.\n\n        \"\"\"\n        # Loading User Interface\n        consolidate_snapshot_window_ui = os.path.join(settings.ui_dir, 'ConsolidateSnapshotWindow.ui')\n        uic.loadUi(consolidate_snapshot_window_ui, self)\n\n        # Setting the window icon\n        buttermanager_icon = os.path.join(settings.images_dir, 'buttermanager50.png')\n        self.setWindowIcon(QIcon(buttermanager_icon))\n\n        # Adjusting font scale\n        # UI elements\n        self.__ui_elements = [self.label_info, self.button_box]\n        utils.scale_fonts(self.__ui_elements)\n        # Tooltips\n        self.setStyleSheet(\" QToolTip{font: \" + str(settings.base_font_size) + \"pt}\")\n\n        # Setting size for the window\n        self.resize(420, 285)\n\n        # Centering the window\n        qt_rectangle = self.frameGeometry()\n        center_point = QDesktopWidget().availableGeometry().center()\n        qt_rectangle.moveCenter(center_point)\n        self.move(qt_rectangle.topLeft())\n\n        # Setting information\n        information = \"You have booted into an alternative snapshot. \\n \" \\\n                      \"Do you want to consolidate it as your default?\"\n        self.label_info.setText(information)\n\n        # Buttons\n        self.button_box.accepted.connect(self.consolidate)\n        self.button_box.rejected.connect(self.cancel)\n\n    def consolidate(self):\n        \"\"\"Accepts root snapshot consolidation.\n\n        \"\"\"\n        self.__logger.info(\"Consolidating default root snapshot. The system has booted in \" +\n                           self.__snapshot_to_clone_in_root_full_path + \" and it will be consolidated into \" +\n                           self.__root_subvolume.subvolume_origin[:-1])\n        # Removes root snapshot\n        try:\n            self.__root_subvolume.delete_origin()\n            # Creates a new snapshot for root\n            command = \"{command} {subvolume_origin} {subvolume_dest}\".format(\n                command=snapshot.BTRFS_CREATE_SNAPSHOT_RW_COMMAND,\n                subvolume_origin=self.__snapshot_to_clone_in_root_full_path,\n                subvolume_dest=self.__root_subvolume.subvolume_origin[:-1]\n            )\n            utils.execute_command(command, console=True, root=True)\n            # Replace /etc/fstab with the default snapshot\n            # Substitute the entry in fstab for root\n\n            # Obtaining the real subvolumes for changing paths in fstab\n            subvolume_origin = self.__snapshot_to_clone_in_root_full_path\n            command_string = \"\"\"sudo btrfs subvolume show {subvolume_origin}\"\"\".format(\n                subvolume_origin=subvolume_origin\n            )\n            command = [command_string]\n            commandline_output = None\n            try:\n                commandline_output = subprocess.check_output(command, shell=True)\n            except subprocess.CalledProcessError as called_process_error_exception:\n                self.__logger.error(\"Error retrieving the real subvolume. Reason: \" +\n                                    str(called_process_error_exception.reason))\n\n            commandline_output = commandline_output.decode('utf-8')\n            for line_output in commandline_output.split(\"\\n\"):\n                # The original subvolume mounted for / will be always the first line\n                # of the output\n                subvolume_origin_real = line_output\n                break\n\n            subvolume_dest_real = self.__root_subvolume.subvolume_origin[:-1]\n            command_string = \"\"\"sudo btrfs subvolume show {subvolume_dest_real}\"\"\".format(\n                subvolume_dest_real=subvolume_dest_real\n            )\n            command = [command_string]\n            commandline_output = None\n            try:\n                commandline_output = subprocess.check_output(command, shell=True)\n            except subprocess.CalledProcessError as called_process_error_exception:\n                self.__logger.error(\"Error retrieving the real subvolume. Reason: \" +\n                                    str(called_process_error_exception.reason))\n\n            commandline_output = commandline_output.decode('utf-8')\n            for line_output in commandline_output.split(\"\\n\"):\n                # The original subvolume mounted for / will be always the first line\n                # of the output\n                subvolume_dest_real = line_output\n                break\n\n            command_string = \"\"\"sudo -S sed -i 's|{subvolume_origin_real}|{subvolume_dest_real}|g' {subvolume_dest}/etc/fstab\"\"\".format(\n                subvolume_origin_real=subvolume_origin_real,\n                subvolume_dest=self.__root_subvolume.subvolume_origin[:-1],\n                subvolume_dest_real=subvolume_dest_real\n            )\n            command = [command_string]\n            try:\n                subprocess.check_output(command, shell=True)\n                # Checks if grub-btrfs integration is enabled\n                if settings.properties_manager.get_property(\"grub_btrfs\"):\n                    # Run grub-btrfs in order to regenerate GRUB entries\n                    utils.execute_command(snapshot.GRUB_BTRFS_COMMAND, console=True, root=True)\n                # The consolidation process was OK so this QDialong window is closed and returns integer 1\n                self.done(1)\n            except subprocess.CalledProcessError as subprocess_exception:\n                self.__logger.error(\"Error trying to substitute the root's path in fstab with the \"\n                                    \"path of the new snapshot created. Reason: \" + str(subprocess_exception.reason))\n                # The consolidation process was KO so this QDialong window is closed and returns integer 2\n                self.done(2)\n        except exception.BtrfsSnapshotDeletion as btrfs_snapshot_exception:\n            self.__logger.error(\"Error removing root snapshot {root_snapshot} because it is not empty and there are \"\n                                \"subvolumes within it \"\n                                .format(root_snapshot=self.__root_subvolume.subvolume_origin[:-1]))\n            # The consolidation process was KO so this QDialong window is closed and returns integer 3\n            self.done(3)\n\n    def cancel(self):\n        \"\"\"Rejects root snapshot consolidation.\n\n        \"\"\"\n        self.__logger.info(\"Rejecting default root snapshot\")\n        self.done(4)\n\n\nclass SnapshotWindow(QMainWindow):\n    \"\"\"Window to select a subvolume to take a snapshot.\n\n    \"\"\"\n    # pyqtSignal that will be emitted when this class requires that main\n    # window refreshes GUI\n    refresh_gui = pyqtSignal()\n    # pyqtSignal that will be emitted when this class requires that main\n    # window enables all the buttons\n    enable_buttons = pyqtSignal()\n\n    # Constructor\n    def __init__(self, parent):\n        QMainWindow.__init__(self, parent)\n        self.parent = parent\n\n        # UI elements\n        self.__ui_elements = []\n\n        # Logger\n        self.__logger = utils.Logger(self.__class__.__name__).get()\n\n        # Initializing the window\n        self.init_ui()\n\n    def init_ui(self):\n        \"\"\"Initializes the Graphic User Interface.\n\n        \"\"\"\n        # Loading User Interface\n        snapshot_window_ui = os.path.join(settings.ui_dir, 'SnapshotWindow.ui')\n        uic.loadUi(snapshot_window_ui, self)\n\n        # Setting the window icon\n        buttermanager_icon = os.path.join(settings.images_dir, 'buttermanager50.png')\n        self.setWindowIcon(QIcon(buttermanager_icon))\n\n        # Adjusting font scale\n        # UI elements\n        self.__ui_elements = [self.radiobutton_all_subvolumes, self.radiobutton_one_subvolume,\n                              self.label_take_snapshots, self.combobox_subvolumes, self.button_ok,\n                              self.button_cancel]\n        utils.scale_fonts(self.__ui_elements)\n        # Tooltips\n        self.setStyleSheet(\" QToolTip{font: \" + str(settings.base_font_size) + \"pt}\")\n\n        # Setting size for the window\n        self.resize(500, 200)\n\n        # Centering the window\n        qt_rectangle = self.frameGeometry()\n        center_point = QDesktopWidget().availableGeometry().center()\n        qt_rectangle.moveCenter(center_point)\n        self.move(qt_rectangle.topLeft())\n\n        # Loading GUI components\n        self.enable_all_subvolumes()\n\n        # Retrieveing subvolumes\n        subvolumes = []\n        for subvolume in settings.subvolumes:\n            subvolumes.append(subvolume)\n        self.combobox_subvolumes.addItems(subvolumes)\n\n        # Button events\n        self.radiobutton_all_subvolumes.clicked.connect(self.enable_all_subvolumes)\n        self.radiobutton_one_subvolume.clicked.connect(self.enable_one_subvolume)\n        self.button_ok.clicked.connect(self.take_snapshot)\n        self.button_cancel.clicked.connect(self.cancel)\n\n    def enable_all_subvolumes(self):\n        \"\"\"Enables all subvolumes option.\n\n        \"\"\"\n        self.radiobutton_all_subvolumes.setEnabled(True)\n        self.radiobutton_all_subvolumes.setChecked(True)\n        self.radiobutton_one_subvolume.setEnabled(True)\n        self.radiobutton_one_subvolume.setChecked(False)\n        self.combobox_subvolumes.setEnabled(False)\n\n    def enable_one_subvolume(self):\n        \"\"\"Enables one subvolume option.\n\n        \"\"\"\n        self.radiobutton_all_subvolumes.setEnabled(True)\n        self.radiobutton_all_subvolumes.setChecked(False)\n        self.radiobutton_one_subvolume.setEnabled(True)\n        self.radiobutton_one_subvolume.setChecked(True)\n        self.combobox_subvolumes.setEnabled(True)\n\n    def take_snapshot(self):\n        \"\"\"Takes a snapshot of the selected subvolume.\n\n        \"\"\"\n        # Disabling window buttons\n        self.__disable_buttons()\n\n        # Waiting 10 msec in order to let self.__disable_buttons to take effect\n        QtTest.QTest.qWait(10)\n\n        if self.radiobutton_all_subvolumes.isChecked():\n            for subvolume in settings.subvolumes:\n                settings.subvolumes[subvolume].create_snapshot()\n        else:\n            subvolume_selected = self.combobox_subvolumes.currentText()\n            settings.subvolumes[subvolume_selected].create_snapshot()\n\n        # Refreshing GUI\n        self.on_refresh_gui()\n\n        # Enabling main window buttons\n        self.on_enable_buttons()\n\n        # Closes the window\n        self.cancel()\n\n    def cancel(self):\n        \"\"\"Closes the window.\n\n        \"\"\"\n        # Enabling main window buttons\n        self.on_enable_buttons()\n\n        # Refreshing GUI\n        self.on_refresh_gui()\n\n        self.close()\n\n    def on_refresh_gui(self):\n        \"\"\"Emits a QT Signal to refresh main window GUI.\n\n        \"\"\"\n        self.refresh_gui.emit()\n\n    def on_enable_buttons(self):\n        \"\"\"Emits a QT Signal for main window enabling all the buttons.\n\n        \"\"\"\n        self.enable_buttons.emit()\n\n    def on_disable_buttons(self):\n        \"\"\"Emits a QT Signal for main window disabling all the buttons.\n\n        \"\"\"\n        self.disable_buttons.emit()\n\n    def __disable_buttons(self):\n        \"\"\"Disables all the buttons of the GUI.\n\n        \"\"\"\n        self.combobox_subvolumes.setEnabled(False)\n        self.radiobutton_all_subvolumes.setEnabled(False)\n        self.radiobutton_one_subvolume.setEnabled(False)\n        self.button_ok.setEnabled(False)\n        self.button_cancel.setEnabled(False)\n\n    def __enable_buttons(self):\n        \"\"\"Enable all the buttons of the GUI.\n\n        \"\"\"\n        self.combobox_subvolumes.setEnabled(True)\n        self.radiobutton_all_subvolumes.setEnabled(True)\n        self.radiobutton_one_subvolume.setEnabled(True)\n        self.button_ok.setEnabled(True)\n        self.button_cancel.setEnabled(True)\n\n\nclass SubvolumeWindow(QMainWindow):\n    \"\"\"Window to add a new subvolume to be managed byt the application.\n\n    \"\"\"\n    # pyqtSignal that will be emitted when this class requires that main\n    # window refreshes GUI\n    refresh_gui = pyqtSignal()\n\n    # Constructor\n    def __init__(self, parent):\n        QMainWindow.__init__(self, parent)\n        self.parent = parent\n\n        # UI elements\n        self.__ui_elements = []\n\n        # Logger\n        self.__logger = utils.Logger(self.__class__.__name__).get()\n\n        # Initializing the window\n        self.init_ui()\n\n    def init_ui(self):\n        \"\"\"Initializes the Graphic User Interface.\n\n        \"\"\"\n        # Loading User Interface\n        subvolume_window_ui = os.path.join(settings.ui_dir, 'SubvolumeWindow.ui')\n        uic.loadUi(subvolume_window_ui, self)\n\n        # Setting the window icon\n        buttermanager_icon = os.path.join(settings.images_dir, 'buttermanager50.png')\n        self.setWindowIcon(QIcon(buttermanager_icon))\n\n        # Adjusting font scale\n        # UI elements\n        self.__ui_elements = [self.button_ok, self.button_cancel, self.button_add_subvolume_orig,\n                              self.button_add_subvolume_dest, self.label_subvolume_origin, self.label_subvolume_dest,\n                              self.label_subvolume_prefix, self.line_subvolume_origin, self.line_subvolume_dest,\n                              self.line_snapshot_name, self.label_subvolume_snapshots_to_keep,\n                              self.spinbox_snapshots_to_keep, self.checkbox_dont_remove_snapshots,\n                              self.label_add_subvolume]\n        utils.scale_fonts(self.__ui_elements)\n        # Tooltips\n        self.setStyleSheet(\" QToolTip{font: \" + str(settings.base_font_size) + \"pt}\")\n\n        # Setting size for the window\n        self.resize(640, 300)\n\n        # Centering the window\n        qt_rectangle = self.frameGeometry()\n        center_point = QDesktopWidget().availableGeometry().center()\n        qt_rectangle.moveCenter(center_point)\n        self.move(qt_rectangle.topLeft())\n\n        # Loading icons\n        folder_icon = os.path.join(settings.images_dir, 'folder_16px_icon.png')\n        self.button_add_subvolume_orig.setIcon(QIcon(folder_icon))\n        self.button_add_subvolume_orig.setIconSize(QSize(16, 16))\n        self.button_add_subvolume_dest.setIcon(QIcon(folder_icon))\n        self.button_add_subvolume_dest.setIconSize(QSize(16, 16))\n\n        # Snapshots to keep by default will be 1\n        self.spinbox_snapshots_to_keep.setValue(1)\n\n        # Button events\n        self.button_add_subvolume_orig.clicked.connect(self.add_subvolume_orig)\n        self.button_add_subvolume_dest.clicked.connect(self.add_subvolume_dest)\n        self.checkbox_dont_remove_snapshots.clicked.connect(self.dont_remove_snapshots)\n        self.button_ok.clicked.connect(self.add_subvolume)\n        self.button_cancel.clicked.connect(self.cancel)\n\n    def add_subvolume_orig(self):\n        \"\"\"Adds the origin path for the subvolume to manage.\n\n        \"\"\"\n        selected_path = utils.open_file_browser_directory(self)\n        self.line_subvolume_origin.setText(selected_path)\n\n    def add_subvolume_dest(self):\n        \"\"\"Adds the destination where the snapshot of the subvolume will be stored.\n\n        \"\"\"\n        selected_path = utils.open_file_browser_directory(self)\n        self.line_subvolume_dest.setText(selected_path)\n\n    def add_subvolume(self):\n        \"\"\"Adds a new subvolume to be managed by the application.\n\n        \"\"\"\n        # All the fields must be filled\n        origin = self.line_subvolume_origin.text()\n        dest = self.line_subvolume_dest.text()\n        name = self.line_snapshot_name.text()\n        snapshots_to_keep = \"-1\"\n        if not self.checkbox_dont_remove_snapshots.isChecked():\n            snapshots_to_keep = str(self.spinbox_snapshots_to_keep.value())\n\n        if not origin or not dest or not name or not snapshots_to_keep:\n            info_dialog = GeneralInfoWindow(self, \"Please, fill all the fields.\")\n            info_dialog.show()\n        else:\n            # Adding a new subvolume\n            settings.properties_manager.set_subvolume(origin, dest, name, snapshots_to_keep)\n\n            # Refreshing GUI\n            self.on_refresh_gui()\n\n            # Closes the window\n            self.cancel()\n\n    def dont_remove_snapshots(self):\n        \"\"\"Actions when user checks don't remove snapshots.\n        \"\"\"\n        if self.checkbox_dont_remove_snapshots.isChecked():\n            self.spinbox_snapshots_to_keep.hide()\n            self.label_subvolume_snapshots_to_keep.hide()\n        else:\n            self.spinbox_snapshots_to_keep.show()\n            self.label_subvolume_snapshots_to_keep.show()\n            self.spinbox_snapshots_to_keep.setValue(1)\n\n    def cancel(self):\n        \"\"\"Closes the window.\n\n        \"\"\"\n        self.close()\n\n    def on_refresh_gui(self):\n        \"\"\"Emits a QT Signal to refresh main window GUI.\n\n        \"\"\"\n        self.refresh_gui.emit()\n\n\nclass UpdatesWindow(QMainWindow):\n    \"\"\"Window to check new updates and start the upgrading process.\n\n    \"\"\"\n    # pyqtSignal that will be emitted when this class requires to upgrade\n    # the system with snapshots\n    upgrade_system = pyqtSignal()\n\n    # pyqtSignal that will be emitted when this class requires to upgrade\n    # the system without snapshots\n    upgrade_system_without_snanpshots = pyqtSignal()\n\n    # Constructor\n    def __init__(self, parent, command_line_text):\n        \"\"\" Constructor.\n\n        Arguments:\n            command_line_text (list(:obj:`str`)): Packages obtained from command line to be updated. One per line.\n        \"\"\"\n        QMainWindow.__init__(self, parent)\n        self.parent = parent\n\n        # UI elements\n        self.__ui_elements = []\n\n        # Logger\n        self.__logger = utils.Logger(self.__class__.__name__).get()\n\n        # Command line text\n        self.__command_line_text = command_line_text\n\n        # Initializing the window\n        self.init_ui()\n\n    def init_ui(self):\n        \"\"\"Initializes the Graphic User Interface.\n\n        \"\"\"\n        # Loading User Interface\n        updates_window_ui = os.path.join(settings.ui_dir, 'UpdatesWindow.ui')\n        uic.loadUi(updates_window_ui, self)\n\n        # Setting the window icon\n        buttermanager_icon = os.path.join(settings.images_dir, 'buttermanager50.png')\n        self.setWindowIcon(QIcon(buttermanager_icon))\n\n        # Adjusting font scale\n        # UI elements\n        self.__ui_elements = [self.button_upgrade_system, self.button_cancel,\n                              self.button_upgrade_system_without_snapshots, self.label_updates, self.text_edit_console]\n        utils.scale_fonts(self.__ui_elements)\n        # Tooltips\n        self.setStyleSheet(\" QToolTip{font: \" + str(settings.base_font_size) + \"pt}\")\n\n        # Setting size for the window\n        self.resize(767, 442)\n\n        # Centering the window\n        qt_rectangle = self.frameGeometry()\n        center_point = QDesktopWidget().availableGeometry().center()\n        qt_rectangle.moveCenter(center_point)\n        self.move(qt_rectangle.topLeft())\n\n        # Displaying packages to be updated\n        for line in self.__command_line_text.split(\"\\n\"):\n            self.text_edit_console.moveCursor(QTextCursor.End)\n            self.text_edit_console.insertHtml(line + '<br>')\n            self.text_edit_console.moveCursor(QTextCursor.End)\n\n        # Hiding upgrade button with snapshots if there is no subvolume defined\n        if len(settings.subvolumes) == 0:\n            self.button_upgrade_system.hide()\n\n        # Button events\n        self.button_upgrade_system.clicked.connect(self.full_system_upgrade)\n        self.button_upgrade_system_without_snapshots.clicked.connect(self.full_system_upgrade_without_snapshots)\n        self.button_cancel.clicked.connect(self.cancel)\n\n    def full_system_upgrade(self):\n        \"\"\"Upgrades the system doing snapshots.\n\n        \"\"\"\n        # The main window will upgrade the system\n        self.upgrade_system.emit()\n\n        # Closes the window\n        self.cancel()\n\n    def full_system_upgrade_without_snapshots(self):\n        \"\"\"Upgrades the system without doing snapshots.\n\n        \"\"\"\n        # The main window will upgrade the system\n        self.upgrade_system_without_snanpshots.emit()\n\n        # Closes the window\n        self.cancel()\n\n    def cancel(self):\n        \"\"\"Closes the window.\n\n        \"\"\"\n        self.close()\n\n\nclass ProblemsFoundWindow(QMainWindow):\n    \"\"\"Window to display problems found.\n\n    Those problems will cause the application exits.\n    \"\"\"\n\n    # Constructor\n    def __init__(self, parent, information):\n        QMainWindow.__init__(self, parent)\n        self.setWindowFlags(\n            QtCore.Qt.Window |\n            QtCore.Qt.CustomizeWindowHint |\n            QtCore.Qt.WindowTitleHint |\n            QtCore.Qt.WindowStaysOnTopHint\n        )\n        self.parent = parent\n\n        # UI elements\n        self.__ui_elements = []\n\n        # Initializing the window\n        self.init_ui(information)\n\n    def init_ui(self, information):\n        \"\"\"Initializes the Graphic User Interface.\n\n        \"\"\"\n        # Loading User Interface\n        problems_found_window_ui = os.path.join(settings.ui_dir, 'ProblemsFoundWindow.ui')\n        uic.loadUi(problems_found_window_ui, self)\n\n        # Setting the window icon\n        buttermanager_icon = os.path.join(settings.images_dir, 'buttermanager50.png')\n        self.setWindowIcon(QIcon(buttermanager_icon))\n\n        # Adjusting font scale\n        # UI elements\n        self.__ui_elements = [self.label_info, self.button_ok]\n        utils.scale_fonts(self.__ui_elements)\n        # Tooltips\n        self.setStyleSheet(\" QToolTip{font: \" + str(settings.base_font_size) + \"pt}\")\n\n        # Setting size for the window\n        self.resize(420, 285)\n\n        # Centering the window\n        qt_rectangle = self.frameGeometry()\n        center_point = QDesktopWidget().availableGeometry().center()\n        qt_rectangle.moveCenter(center_point)\n        self.move(qt_rectangle.topLeft())\n\n        # Setting information\n        self.label_info.setText(information)\n\n        # Button events\n        self.button_ok.clicked.connect(self.exit)\n\n    def exit(self):\n        \"\"\"Exits the application.\n\n        \"\"\"\n        self.close()\n        sys.exit()\n\n\nclass LogViewWindow(QMainWindow):\n    \"\"\"Window display a log.\n\n    \"\"\"\n    # Constructor\n    def __init__(self, parent, log_path):\n        \"\"\" Constructor.\n\n        Arguments:\n            log_path (string): Path of the log that the user wants to see.\n        \"\"\"\n        QMainWindow.__init__(self, parent)\n        self.parent = parent\n        # UI elements\n        self.__ui_elements = []\n        # Logger\n        self.__logger = utils.Logger(self.__class__.__name__).get()\n\n        # Command line text\n        self.__log_path = log_path\n\n        # Initializing the window\n        self.init_ui()\n\n    def init_ui(self):\n        \"\"\"Initializes the Graphic User Interface.\n\n        \"\"\"\n        # Loading User Interface\n        log_view_window_ui = os.path.join(settings.ui_dir, 'LogViewWindow.ui')\n        uic.loadUi(log_view_window_ui, self)\n\n        # Setting the window icon\n        buttermanager_icon = os.path.join(settings.images_dir, 'buttermanager50.png')\n        self.setWindowIcon(QIcon(buttermanager_icon))\n\n        # Adjusting font scale\n        # UI elements\n        self.__ui_elements = [self.label_log, self.text_log]\n        utils.scale_fonts(self.__ui_elements)\n        # Tooltips\n        self.setStyleSheet(\" QToolTip{font: \" + str(settings.base_font_size) + \"pt}\")\n\n        # Setting size for the window\n        self.resize(767, 442)\n\n        # Centering the window\n        qt_rectangle = self.frameGeometry()\n        center_point = QDesktopWidget().availableGeometry().center()\n        qt_rectangle.moveCenter(center_point)\n        self.move(qt_rectangle.topLeft())\n\n        # Displaying the log\n        log_file = open(self.__log_path, 'r')\n\n        for line in log_file:\n            self.text_log.moveCursor(QTextCursor.End)\n            self.text_log.insertHtml(line + '<br>')\n            self.text_log.moveCursor(QTextCursor.End)\n\n\nclass DiffWindow(QDialog):\n    \"\"\"Window to select the level of details when obtaining differences between two subvolumes.\n\n    This window will be displayed when user wants to get the differences between two different subvolumes.\n    If user choose Yes, ButterManager will perform a full process to obtain diferences, so it will take a lot\n    of time to complete but it will obtain files with differences in bot subolumes and files which are present\n    only in one subvolume or the other. If user chooses No, ButterManager will only obtain those files which\n    have been modified but this operation will be done quickly.\n\n    \"\"\"\n    # Constructor\n    def __init__(self):\n        \"\"\" Constructor.\n        \"\"\"\n        QDialog.__init__(self)\n\n        self.setWindowFlags(\n            QtCore.Qt.Window |\n            QtCore.Qt.CustomizeWindowHint |\n            QtCore.Qt.WindowTitleHint |\n            QtCore.Qt.WindowStaysOnTopHint\n        )\n\n        # UI elements\n        self.__ui_elements = []\n\n        # Logger\n        self.__logger = utils.Logger(self.__class__.__name__).get()\n\n        self.__label_info = QLabel()\n        self.__label_info.setAlignment(QtCore.Qt.AlignCenter)\n\n        self.__button_partial = QPushButton('Partial diff')\n        self.__button_full = QPushButton('Full diff')\n\n        layout = QVBoxLayout()\n        layout.addWidget(self.__label_info)\n        layout.addWidget(self.__button_partial)\n        layout.addWidget(self.__button_full)\n\n        self.setLayout(layout)\n\n        # Initializing the window\n        self.init_ui()\n\n    def init_ui(self):\n        \"\"\"Initializes the Graphic User Interface.\n\n        \"\"\"\n        # Setting the window icon\n        buttermanager_icon = os.path.join(settings.images_dir, 'buttermanager50.png')\n        self.setWindowIcon(QIcon(buttermanager_icon))\n        self.setWindowTitle('Calculating differences')\n\n        # Adjusting font scale\n        # UI elements\n        self.__ui_elements = [self.__label_info, self.__button_partial, self.__button_full]\n        utils.scale_fonts(self.__ui_elements)\n        # Tooltips\n        self.setStyleSheet(\" QToolTip{font: \" + str(settings.base_font_size) + \"pt}\")\n\n        # Setting maximum and minimum  size for the main window\n        self.setMinimumHeight(285)\n        self.setMinimumWidth(420)\n        self.setMaximumHeight(285)\n        self.setMaximumWidth(420)\n\n        # Centering the window\n        qt_rectangle = self.frameGeometry()\n        center_point = QDesktopWidget().availableGeometry().center()\n        qt_rectangle.moveCenter(center_point)\n        self.move(qt_rectangle.topLeft())\n\n        # Setting information\n        information = \"Partial diff will calculate only modified files. \\n \" \\\n                      \"This operation will be done quickly. Full diff \\n \" \\\n                      \"will take long but it will obtain modified files \\n \" \\\n                      \"and those which are only in one of the subvolumes.\"\n        self.__label_info.setText(information)\n\n        # Buttons\n        self.__button_full.clicked.connect(self.full_operation)\n        self.__button_partial.clicked.connect(self.partial_operation)\n\n    def full_operation(self):\n        \"\"\"User selects Full diff, so a full diff operation will be done.\n\n        \"\"\"\n        self.__logger.info(\"Starting the process to obtain full differences between subvolumes. Please wait...\")\n        self.done(1)\n\n    def partial_operation(self):\n        \"\"\"User selects Partial diff, so a partial diff operation will be done.\n\n        \"\"\"\n        self.__logger.info(\"Starting the process to obtain partial differences between subvolumes. Please wait...\")\n        self.done(2)\n"
  },
  {
    "path": "buttermanager/main.py",
    "content": "from buttermanager.buttermanager import PasswordWindow\nfrom PyQt5.QtWidgets import QApplication\nimport sys\n\n\ndef main():\n    \"\"\"Main wrapper for starting the program\n\n    \"\"\"\n    # Creating application instance\n    application = QApplication(sys.argv)\n    # Creating main window instance\n    PasswordWindow(None)\n    # Launching the application\n    application.exec_()\n\n\nif __name__ == \"__main__\":\n    main()\n"
  },
  {
    "path": "doc/README.md",
    "content": "# Documentation\nThis is the documentation related to [Buttermanager](https://github.com/egara/buttermanager) GUI tool for easily management of BTRFS snapshots and system upgrades.\n\n## BTRFS filesystem initial layout\nFor the purpose of this documentation, we are going to suppose that we have installed [Manjaro]() using a manual partitioning with this requirements:\n\n- Only one disk: **sda**\n- Only one partition in the disk: **sda1**\n- *sda1* has been formatted using **btrfs**\n- The mount point selected for this partition is **/**\n\nAfter the installation of the operating system, the subvolumes automatically created are two (**@** and **@home**) as you can see in the screenshot below:\n\n<img src=\"screen-1.png\" alt=\"drawing\" width=\"1420\"/>\n\nSo the layout is something like this\n\n```\nMain Volume (ID 5)\n|\n|--- @ (Subvolume ID 257)\n|\n|--- @home (Subvolume ID 258)\n```\n\n**Important Note: If you are installing Arch from scratch or want to reshape your default BTRFS layout, you can check out this tips [https://github.com/egara/arch-btrfs-installation](https://github.com/egara/arch-btrfs-installation).**\n\n## Mounting main volume (ID 5)\nIn order to manage in a proper way all the snapshots created and make things easier if you want to rollback your system to a previous snapshot, we are going to mount the main BTRFS volume in **/mnt/defvol** directory. For this, you first has to create this directory.\n\n<img src=\"screen-2.png\" alt=\"drawing\" width=\"1420\"/>\n\nInclude this new mounting point in **/etc/fstab** just to automount it when the system boots. Please, change the UID to the appropriate one or use labels if it is your case.\n\n<img src=\"screen-3.png\" alt=\"drawing\" width=\"1420\"/>\n\nOnce **fstab** is changed you can type\n    \n    sudo mount -a\n\nand go to **/mnt/defvol**. You should see something like this:\n\n<img src=\"screen-4.png\" alt=\"drawing\" width=\"1420\"/>\n\nCreate a new subvolume called **snapshots** at top level (as you can see above) using the command:\n\n    sudo btrfs subvolume create snapshots\n    \nThe final layout will be:\n\n```\nMain Volume (ID 5)\n|\n|--- @ (Subvolume ID 257)\n|\n|--- @home (Subvolume ID 258)\n|\n|--- snapshots (Subvolume ID 271)\n```\n\n<img src=\"screen-5.png\" alt=\"drawing\" width=\"1420\"/>\n\n## Setting up Buttermanager\nYes, finally we are going to configure **Buttermanager**!. The first time you open the application, you will be warned because no subvolumes to create snapshots has been defined yet. You could use the application, but if you upgrade your system, **Buttermanager** won't create any snapshot.\n\n<img src=\"screen-6.png\" alt=\"drawing\" width=\"1420\"/>\n\nGo to **Settings** tab and click on **Add subvolume** button.\n\n<img src=\"screen-7.png\" alt=\"drawing\" width=\"1420\"/>\n\nNow, using the layout defined in this example, we are going to configure two subvolumes to create snapshots of **root** and **home**.\n\n### Subvolume 1 (root)\nIf you want **Buttermanager** creates a snapshot of your **root** partition everytime it upgrades the system, then you should fill the **Add a subvolume** window like this:\n\n- *Subvolume to manage*: **/mnt/defvol/@**\n- *Path where the snapshot will be stored*: **/mnt/defvol/snapshots**\n- *Snapshot prefix*: **root**\n\n>Please, use always different prefixes for different subvolumes (prefixes shouldn't even include words contained in other prefixes, i.e. in this example, you should never include root word in other prefixes).\n\n<img src=\"screen-8.png\" alt=\"drawing\" width=\"1420\"/>\n\nThis way, everytime **Buttermanager** upgrades the system, it will automatically create a snapshot of the **root** mounted subvolume called **root-[date]-[number]** within **/mnt/defvol/snapshots/** directory. This snapshot will be **read only** by default.\n\n### Subvolume 2 (/home)\nIf you want **Buttermanager** creates a snapshot of your **home** partition everytime it upgrades the system, then you should fill the **Add a subvolume** window like this:\n\n- *Subvolume to manage*: **/mnt/defvol/@home**\n- *Path where the snapshot will be stored*: **/mnt/defvol/snapshots**\n- *Snapshot prefix*: **home**\n\n<img src=\"screen-9.png\" alt=\"drawing\" width=\"1420\"/>\n\nThis way, everytime **Buttermanager** upgrades the system, it will automatically create a snapshot of the **home** mounted subvolume called **home-[date]-[number]** within **/mnt/defvol/snapshots/** directory. This snapshot will be **read only** by default.\n\n## Integrating Buttermanager with GRUB\nSince version **1.9**, Buttermanager can be integrated with GRUB using the awesome package **grub-btrfs**. If you have installed Buttermanager via your package manager, this depency is installed automatically, if don't, please install it manually. When the integration is enabled, all the root snapshots created since then, will be bootable directly from the GRUB menu.\n\nTo enable this feature, go to **Settings** and check **Boot the system from GRUB using snapshots**.\n\n<img src=\"screen-10.png\" alt=\"drawing\" width=\"1420\"/>\n\nWhen this option is checked, **all the snapshots created will have read and write permissions** and the **/etc/fstab** file within the snapshot created will be modified in order to let GRUB to boot from it.\n\n### Consolidating the snapshot booted\nButtermanager cannot properly work from a snapshot selected from the GRUB menu. Because of this, when you run Buttermanager again in this situation, you will see a message like this.\n\n<img src=\"screen-11.png\" alt=\"drawing\" width=\"1420\"/>\n\nIf you want to consolidate the current state of your filesystem (the snapshot in which you have booted) reverting all the changes done since then, then click button **Ok**.\n\nIf you don't want to consolidate this snapshot and you want to boot your system using the default root, then restart your computer and don't select any snapshot.\n\n>After consolidating the current snapshot and rebooting the system, run Buttermanager again and click on button **Regenerate GRUB** in order to rebuild GRUB menu with all the snapshots present in the filesystem.\n\n<img src=\"screen-16.png\" alt=\"drawing\" width=\"1420\"/>\n\n### Common problems\nThe integration of Buttermanager with GRUB can only be done if there is not any subvolume defined inside the root file system. As an example, take the case of the automatic installation using BTRFS in some distros.\n\nBy default, some distros (or more precisely systemd) create this BTRFS layout when the system is installed for the first time:\n\n```\nMain Volume (ID 5)\n|\n|--- @\n|      |\n|      |--- @/var/lib/portables\n|      |--- @/var/lib/machines\n|\n|--- @home\n```\n\nYou can see this layout in EndevourOS (MATE online installation) for example:\n\n<img src=\"screen-12.png\" alt=\"drawing\" width=\"1420\"/>\n\nIn this case, if you boot the system using an alternate snapshot, run Buttermanager and try to consolidate this snapshot as the default, you will receive this message:\n\n<img src=\"screen-13.png\" alt=\"drawing\" width=\"1420\"/>\n\nIf you want to fix this problem, first execute these two commands in a terminal (please, adjust this command to your needs. In this case, main volume with ID 5 is mounted on /defvol):\n\n<img src=\"screen-14.png\" alt=\"drawing\" width=\"1420\"/>\n\nThose subvolumes (**@/var/lib/portables** and **@/var/lib/machines**) will be probably empty as you can see in the picture above. If this is the case, you can remove them without any problem. To do this, take a look at the commands you have to type in the picture below please, adjust this commands to your needs. In this case, main volume with ID 5 is mounted on /defvol):\n\n<img src=\"screen-15.png\" alt=\"drawing\" width=\"1420\"/>\n\n\n\n"
  },
  {
    "path": "install/native_install.sh",
    "content": "#!/bin/bash\n\n# Script for installing ButterManager\n# -----------------------------------\n#\n# @author: Eloy García Almadén\n# @email: eloy.garcia.pca@gmail.com\n# -------------------------------------\n\n\n# Displaying requirements\necho \"You are about to install ButterManager natively.\"\necho \"\"\necho \"These packages MUST be installed before executing this script: 'python-setuptools' and 'tkinter'. The name of these packages can be different depending on the distro you are using. Example: On Arch -> 'python-setuptools' and 'tk'. On Fedora 'python3-setuptools' and 'python3-tkinter'. In addition, if you are on Ubuntu or derivative, 'libxcb-xinerama0' needs to be installed too.\"\necho \"\"\necho \"Do you want to proceed with the installation? [y/n]\"\nread installButterManager\n\nif [[ \"$installButterManager\" == \"y\" ]]; then\n    # Installing ButterManager\n    # Variables\n    python_bin=\"python\"\n\n    # Getting python3 binary\n    if hash python3 2>/dev/null; then\n        python_bin=\"python3\"\n    fi\n\n    # Removing old installations\n    echo \"Removing old installation...\"\n    sudo rm -rf /opt/buttermanager/\n\n    # Creating installation directory\n    echo \"Creating installation directory in /opt/buttermanager\"\n    sudo mkdir /opt/buttermanager/\n    sudo mkdir /opt/buttermanager/buttermanager\n    sudo mkdir /opt/buttermanager/gui\n    sudo chown ${USER:=$(/usr/bin/id -run)}:$USER -R /opt/buttermanager\n\n    # Copying all the files needed\n    echo \"Copying all the files needed into /opt/buttermanager\"\n    cp -ar ../buttermanager/* /opt/buttermanager/buttermanager\n    cp -ar ../setup.py /opt/buttermanager/\n    cp -ar ../README.md /opt/buttermanager\n    cp -ar ../packaging/buttermanager.svg /opt/buttermanager/gui/\n\n    # Creating desktop launcher\n    echo -e \"Creating desktop launcher...\"\n    if [ ! -d \"${HOME}/.local/share/applications/\" ]\n    then\n        echo \"Directory ${HOME}/.local/share/applications/ doesn't exist. Creating it to store ButterManager desktop launcher.\"\n        mkdir -p ${HOME}/.local/share/applications/\n    fi\n    cp ../packaging/buttermanager.desktop ${HOME}/.local/share/applications/\n\n    # Installing libraries and ButterManager natively\n    echo \"Installing libraries and ButterManager natively...\"\n    cd /opt/buttermanager/\n    sudo $python_bin setup.py install --record installed_files.txt\n    echo \"\"\n    echo \"\"\n    echo '@@@@@@@@@@@@@@@@@@&&&&&&&&&&&&&&&&&&&@@@@@@@@@@@@@+\n    @@@@@@@@@@@@&&%%#########%%%%%#########%%&&@@@@@@@+\n    @@@@@@@&&&#((%&&#(/*****************/(%&&%((%&&@@@+\n    @@@@@@&%(#%#/*****************************/#%##%&@+\n    @@@@@&#(&(*****************/%%%%/************#%(%&+\n    @@@@&&##&/***************#%#****%%***********(&(%&+\n    @@@@@&&#(#%%%%%*******/%%/******#&******%%%%%#(%&&+\n    @@@@@@@&&&%%(#&*****(%(*******(%#*******&#(%%&&&@@+\n    @@@@@@@@@@&&(#&**/%%*,.****/%%/*********&##&&@@@@@+\n    @@@@@@@@@@&&((/(%#**.,.**(%%************&##&&@@@@@+\n    @@@@@@@@@@&&#%%(****.,,#%/**************&##&&@@@@@+\n    @@@@@@@@@@&&%/*******%%*****************&##&&@@@@@+\n    @@@@@@@&&%#(#%%(*/#%(*******************&##&&@@@@@+\n    @@@@@&%%((((#%&%%%**********************&##&&@@@@@+\n    @@&&%#(((#%&##&**********************%#*&##&&@@@@@+\n    &%%((((#&&&&(#&*******************//*%#*&##&&@@@@@+\n    %#((#%&@@@&&(#&*******************#%*%#*&##&&@@@@@+\n    @&%%%@@@@@&&(#&///////////////////#%/%#/&##&&@@@@@+\n    @@@@@@@@@@&&###############################&&@@@@@'\n    echo \"\"\n    echo \"\"\n    echo \"The installation has finished. Please, review the logs in order to see if everything was OK\"\n    echo \"\"\n    echo \"\"\n    echo \"You should find a new icon and desktop launcher called ButterManager. You are good to go.\"\nelse\n    # Exit\n    echo \"Ok. Bye!\"\nfi\n"
  },
  {
    "path": "install/uninstall.sh",
    "content": "#!/bin/bash\n\n# Script for uninstalling ButterManager\n# -------------------------------------\n#\n# @author: Eloy García Almadén\n# @email: eloy.garcia.pca@gmail.com\n# -------------------------------------\n\n# Removing old installations\necho \"Removing old installation...\"\n\ninstalled_files=/opt/buttermanager/installed_files.txt\n\nif test -f \"$installed_files\"; then\n    echo \"ButterManager was installed natively. Removing libraries...\"\n    cat $installed_files | xargs sudo rm -rf\nfi\n\nsudo rm -rf /opt/buttermanager/\nrm ${HOME}/.local/share/applications/buttermanager.desktop\n\necho \"Uninstallation process has been successfully completed. You are good to go!\"\n"
  },
  {
    "path": "install/venv_install.sh",
    "content": "#!/bin/bash\n\n# Script for installing ButterManager\n# -----------------------------------\n#\n# @author: Eloy García Almadén\n# @email: eloy.garcia.pca@gmail.com\n# -------------------------------------\n\n# Displaying requirements\necho \"You are about to install ButterManager in a virtual environment.\"\necho \"These packages MUST be installed before executing this script: 'python-setuptools', 'python-virtualenv' and 'tkinter'. The name of these packages can be different depending on the distro you are using. Example: On Arch -> 'python-setuptools', 'python-virtualenv' and 'tk'. On Fedora 'python3-setuptools', 'python3-virtualenv' and 'python3-tkinter'. In addition, if you are on Ubuntu or derivative, 'libxcb-xinerama0' needs to be installed too.\"\necho \"Do you want to proceed with the installation? [y/n]\"\nread installButterManager\n\nif [[ \"$installButterManager\" == \"y\" ]]; then\n    # Installing ButterManager\n    # Variables\n    python_bin=\"python\"\n\n    # Getting python3 binary\n    if hash python3 2>/dev/null; then\n        python_bin=\"python3\"\n    fi\n\n    # Removing old installations\n    echo \"Removing old installation...\"\n    sudo rm -rf /opt/buttermanager/\n\n    # Creating installation directory\n    echo \"Creating installation directory in /opt/buttermanager\"\n    sudo mkdir /opt/buttermanager/\n    sudo mkdir /opt/buttermanager/buttermanager\n    sudo mkdir /opt/buttermanager/gui\n    sudo chown ${USER:=$(/usr/bin/id -run)}:$USER -R /opt/buttermanager\n\n    # Copying all the files needed\n    echo \"Copying all the files needed into /opt/buttermanager\"\n    cp -ar ../buttermanager/* /opt/buttermanager/buttermanager\n    cp -ar ../requirements.txt /opt/buttermanager/\n    cp -ar ../packaging/buttermanager.svg /opt/buttermanager/gui/\n\n    # Creating desktop launcher\n    echo -e \"Creating desktop launcher...\"\n    if [ ! -d \"${HOME}/.local/share/applications/\" ]\n    then\n        echo \"Directory ${HOME}/.local/share/applications/ doesn't exist. Creating it to store ButterManager desktop launcher.\"\n        mkdir -p ${HOME}/.local/share/applications/\n    fi\n    cp ../packaging/buttermanager_venv.desktop ${HOME}/.local/share/applications/buttermanager.desktop\n\n    # Creating virtual environment\n    echo \"Creating virtual environment...\"\n    cd /opt/buttermanager/\n    $python_bin -m venv env\n\n    # Enabling virtual environment\n    echo -e \"Enabling virtual environment...\"\n    source env/bin/activate\n\n    # Installing requirements\n    echo -e \"Installing all the required modules into the virtual environment. Please wait...\"\n    pip install --upgrade pip\n    pip install -r requirements.txt\n    echo \"\"\n    echo \"\"\n    echo '@@@@@@@@@@@@@@@@@@&&&&&&&&&&&&&&&&&&&@@@@@@@@@@@@@+\n    @@@@@@@@@@@@&&%%#########%%%%%#########%%&&@@@@@@@+\n    @@@@@@@&&&#((%&&#(/*****************/(%&&%((%&&@@@+\n    @@@@@@&%(#%#/*****************************/#%##%&@+\n    @@@@@&#(&(*****************/%%%%/************#%(%&+\n    @@@@&&##&/***************#%#****%%***********(&(%&+\n    @@@@@&&#(#%%%%%*******/%%/******#&******%%%%%#(%&&+\n    @@@@@@@&&&%%(#&*****(%(*******(%#*******&#(%%&&&@@+\n    @@@@@@@@@@&&(#&**/%%*,.****/%%/*********&##&&@@@@@+\n    @@@@@@@@@@&&((/(%#**.,.**(%%************&##&&@@@@@+\n    @@@@@@@@@@&&#%%(****.,,#%/**************&##&&@@@@@+\n    @@@@@@@@@@&&%/*******%%*****************&##&&@@@@@+\n    @@@@@@@&&%#(#%%(*/#%(*******************&##&&@@@@@+\n    @@@@@&%%((((#%&%%%**********************&##&&@@@@@+\n    @@&&%#(((#%&##&**********************%#*&##&&@@@@@+\n    &%%((((#&&&&(#&*******************//*%#*&##&&@@@@@+\n    %#((#%&@@@&&(#&*******************#%*%#*&##&&@@@@@+\n    @&%%%@@@@@&&(#&///////////////////#%/%#/&##&&@@@@@+\n    @@@@@@@@@@&&###############################&&@@@@@'\n    echo \"\"\n    echo \"\"\n    echo \"The installation has finished. Please, review the logs in order to see if everything was OK\"\n    echo \"\"\n    echo \"You should find a new icon and desktop launcher called ButterManager. You are good to go.\"\nelse\n    # Exit\n    echo \"Ok. Bye!\"\nfi\n"
  },
  {
    "path": "packaging/buttermanager.desktop",
    "content": "[Desktop Entry]\nName=ButterManager\nGenericName=ButterManager\nComment=ButterManager, a BTRFS tool for snapshoting, balancing and managing safe system upgrades.\nKeywords=BTRFS;btrfs;system;filesystem;snapshot;balance;tool;gui\nExec=buttermanager\nIcon=/opt/buttermanager/gui/buttermanager.svg\nTerminal=false\nType=Application\nCategories=Utility;System;\n"
  },
  {
    "path": "packaging/buttermanager_venv.desktop",
    "content": "[Desktop Entry]\nName=ButterManager\nGenericName=ButterManager\nComment=ButterManager, a BTRFS tool for snapshoting, balancing and managing safe system upgrades.\nKeywords=BTRFS;btrfs;system;filesystem;snapshot;balance;tool;gui\nExec=/opt/buttermanager/env/bin/python3 /opt/buttermanager/buttermanager/main.py\nPath=/opt/buttermanager/buttermanager\nIcon=/opt/buttermanager/gui/buttermanager.svg\nTerminal=false\nType=Application\nCategories=Utility;System;\n"
  },
  {
    "path": "requirements.txt",
    "content": "PyQt5>=5.10.1\nPyQt5-sip>=12.7.0\nPyYAML>=4.2b1\nsip>=4.19.8\n"
  },
  {
    "path": "rpm/README.txt",
    "content": "This directory contains all the files needed to package ButterManager application for RPM based distributions.\n\nThis packaging was validated for Fedora 33, and should work for newer releases of Fedora or similar distributions.\n"
  },
  {
    "path": "rpm/buttermanager.spec",
    "content": "Name:           buttermanager\nVersion:        2.5.2\nRelease:        0%{?dist}\nSummary:        Tool for managing Btrfs snapshots, balancing filesystems and more\n\nLicense:        GPLv3\nURL:            https://github.com/egara/buttermanager\nSource0:        %{url}/archive/%{version}/%{name}-%{version}.tar.gz\n\nBuildArch:      noarch\nBuildRequires:  python3-devel\nBuildRequires:  python3dist(setuptools)\nRequires:       btrfs-progs\nRecommends:     grub2-btrfs\n\n%description\nButterManager is a BTRFS tool for managing snapshots, balancing filesystems\nand upgrading the system safely.\n\n%prep\n%autosetup -p1\n\n\n%build\n%py3_build\n\n\n%install\n%py3_install\n\ninstall -Dpm 644 packaging/%{name}.desktop %{buildroot}%{_datadir}/applications/%{name}.desktop\ninstall -Dpm 644 packaging/%{name}.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/%{name}.svg\n\n# Fix the desktop file\nsed -e \"s/^Exec=.*/Exec=%{name}/\" \\\n    -e \"/^Path=.*/d\" \\\n    -e \"s/Icon=.*/Icon=%{name}/\" \\\n    -i %{buildroot}%{_datadir}/applications/%{name}.desktop\n\n\n%files\n%license LICENSE\n%doc README.md doc\n%{_bindir}/buttermanager\n%{python3_sitelib}/buttermanager*\n%{_datadir}/applications/%{name}.desktop\n%{_datadir}/icons/hicolor/scalable/%{name}.svg\n\n%changelog\n* Thu Aug 15 2024 Eloy García Almadén <eloy.garcia.pca@gmail.com> - 2.5.2-0\n- New release 2.5.2\n\n* Mon Feb 19 2024 Eloy García Almadén <eloy.garcia.pca@gmail.com> - 2.5.1-0\n- New release 2.5.1\n\n* Sun Sept 18 2022 Eloy García Almadén <eloy.garcia.pca@gmail.com> - 2.5.0-0\n- New release 2.5.0\n\n* Sat Apr 7 2022 Eloy García Almadén <eloy.garcia.pca@gmail.com> - 2.4.3-0\n- New release 2.4.3\n\n* Sat July 3 2021 Eloy García Almadén <eloy.garcia.pca@gmail.com> - 2.4.2-0\n- New release 2.4.2\n\n* Sat May 1 2021 Eloy García Almadén <eloy.garcia.pca@gmail.com> - 2.4.1-0\n- New release 2.4.1\n\n* Mon Mar 31 2021 Eloy García Almadén <eloy.garcia.pca@gmail.com> - 2.4-0\n- New release 2.4\n\n* Mon Feb 15 2021 Neal Gompa <ngompa13@gmail.com> - 2.3-0\n- New release 2.3\n\n* Wed Dec 30 2020 Neal Gompa <ngompa13@gmail.com> - 2.2-0\n- New release 2.2\n\n* Wed Jun 17 2020 Neal Gompa <ngompa13@gmail.com> - 1.9-0\n- Initial package\n"
  },
  {
    "path": "setup.py",
    "content": "import setuptools\n\nwith open(\"README.md\", \"r\") as fh:\n    long_description = fh.read()\n\nsetuptools.setup(\n    name=\"buttermanager\",\n    version=\"2.5.2\",\n    author=\"Eloy García Almadén\",\n    author_email=\"eloy.garcia.pca@gmail.com\",\n    description=\"BTRFS tool for managing snapshots, balancing filesystems and upgrading the system safetly\",\n    long_description=long_description,\n    long_description_content_type=\"text/markdown\",\n    url=\"https://github.com/egara/buttermanager\",\n    packages=['buttermanager', 'buttermanager.buttermanager', 'buttermanager.buttermanager.exception', 'buttermanager.buttermanager.filesystem', 'buttermanager.buttermanager.manager', 'buttermanager.buttermanager.util', 'buttermanager.buttermanager.window'],\n    package_data= {'buttermanager.buttermanager': ['ui/*', 'images/*']},\n    install_requires=[\n       'PyQt5>=5.10.1',\n       'PyYAML>=4.2b1',\n    ],\n    classifiers=[\n        \"Programming Language :: Python :: 3\",\n        \"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)\",\n        \"Operating System :: POSIX :: Linux\",\n        \"Development Status :: 4 - Beta\",\n        \"Environment :: X11 Applications :: Qt\",\n        \"Intended Audience :: End Users/Desktop\",\n        \"Topic :: System :: Filesystems\",\n        \"Topic :: Utilities\"\n    ],\n    entry_points={\n        \"console_scripts\": [\n            \"buttermanager = buttermanager.bm_main:main\",\n        ],\n    },\n\n)\n"
  },
  {
    "path": "version.txt",
    "content": "2.5.2\n"
  }
]