pax_global_header00006660000000000000000000000064132604701310014507gustar00rootroot0000000000000052 comment=960a94834f2e84ddeca59ddd11eb26a0548d766e snapper-gui_0git.960a94834f/000077500000000000000000000000001326047013100154705ustar00rootroot00000000000000snapper-gui_0git.960a94834f/.gitignore000066400000000000000000000000301326047013100174510ustar00rootroot00000000000000*.egg-info __pycache__/ snapper-gui_0git.960a94834f/LICENSE000066400000000000000000000431151326047013100165010ustar00rootroot00000000000000GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 2013 ricardo-vieira This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. {signature of Ty Coon}, 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. snapper-gui_0git.960a94834f/README.md000066400000000000000000000032271326047013100167530ustar00rootroot00000000000000snapper-gui =========== Snapper-gui is a graphical user interface for the tool [snapper](http://snapper.io/) for Linux filesystem snapshot management. It can compare snapshots and revert differences between snapshots. In simple terms, this allows root and non-root users to view older versions of files and revert changes. Currently works with btrfs, ext4 and thin-provisioned LVM volumes Dependencies ----------- ### ArchLinux: python3 gtk3 python-dbus python-gobject python-setuptools gtksourceview3 snapper ### openSUSE: python3 dbus-1-python3 python-gtksourceview-devel python3-setuptools ### Ubuntu python3 libgtksourceview-3.0-1 gir1.2-gtksource-3.0 python3-dbus python3-setuptools Installation ----------- $ git clone https://github.com/ricardo-vieira/snapper-gui/ $ cd snapper-gui/ # python3 setup.py install Screenshots ----------- ![](http://i.imgur.com/ck9indK.png) Main window, create delete open submodule forlder and open changes in selected snapshots ![](http://i.imgur.com/RgHX2fN.png) Changes window in diff view Contributors ------------ - Ricardo Vieira - Marek Rusinowski License ------- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. snapper-gui_0git.960a94834f/setup.cfg000066400000000000000000000000771326047013100173150ustar00rootroot00000000000000[install] single_version_externally_managed = 1 record = RECORDsnapper-gui_0git.960a94834f/setup.py000066400000000000000000000014371326047013100172070ustar00rootroot00000000000000try: from setuptools import setup except ImportError: from distutils.core import setup # from options["setup"] in build.vel config = { 'name': 'snappergui', 'version': '0.1', 'packages': ['snappergui'], 'description': 'snapper-gui grafical user interface for snapper btrfs snapshot manager', 'author': 'Ricardo Vieira', 'url': 'https://github.com/ricardo-vieira/snapper-gui', 'download_url': 'https://github.com/ricardo-vieira/snapper-gui', 'author_email': 'ricardo.vieira@ist.utl.pt', 'package_data' : {"snappergui": ["glade/*.glade", "icons/*.svg", "ui/*.ui"]}, 'data_files': [ ('share/applications', ['snapper-gui.desktop'])], 'entry_points' : { 'gui_scripts' : [ 'snapper-gui = snappergui.application:start_ui' ] } } setup(**config) snapper-gui_0git.960a94834f/snapper-gui.desktop000066400000000000000000000002761326047013100213220ustar00rootroot00000000000000[Desktop Entry] Name=Snapper GUI Comment=Frontend for snapper snapshot manager Exec=snapper-gui Icon=drive-harddisk Terminal=false Type=Application StartupNotify=true Categories=Utilities; snapper-gui_0git.960a94834f/snappergui/000077500000000000000000000000001326047013100176455ustar00rootroot00000000000000snapper-gui_0git.960a94834f/snappergui/__init__.py000066400000000000000000000005751326047013100217650ustar00rootroot00000000000000import dbus from dbus.mainloop.glib import DBusGMainLoop import gi gi.require_version("Gtk", "3.0") gi.require_version("GtkSource", "3.0") bus = dbus.SystemBus(mainloop=DBusGMainLoop()) snapper = dbus.Interface(bus.get_object('org.opensuse.Snapper', '/org/opensuse/Snapper'), dbus_interface='org.opensuse.Snapper') snapper-gui_0git.960a94834f/snappergui/application.py000066400000000000000000000035451326047013100225310ustar00rootroot00000000000000import pkg_resources, sys, signal from gi.repository import Gtk, GLib, GdkPixbuf, Gio from snappergui.mainWindow import SnapperGUI from snappergui.propertiesDialog import propertiesDialog def start_ui(): app = Application() signal.signal(signal.SIGINT, signal.SIG_DFL) exit_status = app.run(sys.argv) sys.exit(exit_status) class Application(Gtk.Application): def __init__(self): Gtk.Application.__init__(self) GLib.set_application_name("SnapperGUI") GLib.set_prgname('snappergui') self.snappergui = None def build_app_menu(self): builder = Gtk.Builder() builder.add_from_file(pkg_resources.resource_filename("snappergui", "ui/app-menu.ui")) menu = builder.get_object('app-menu') self.set_app_menu(menu) propertiesAction = Gio.SimpleAction.new('properties', None) propertiesAction.connect('activate', self.show_configs_properties) self.add_action(propertiesAction) aboutAction = Gio.SimpleAction.new('about', None) aboutAction.connect('activate', self.about) self.add_action(aboutAction) quitAction = Gio.SimpleAction.new('quit', None) quitAction.connect('activate', self.quit) self.add_action(quitAction) def show_configs_properties(self, action, param): dialog = propertiesDialog(self, self.snappergui.window) dialog.dialog.run() dialog.dialog.hide() def about(self, action, param): pass def quit(self, action=None, param=None): self.snappergui.window.destroy() def do_startup(self): Gtk.Application.do_startup(self) self.build_app_menu() def do_activate(self): if not self.snappergui: self.snappergui = SnapperGUI(self) self.snappergui.window.present() snapper-gui_0git.960a94834f/snappergui/changesWindow.py000066400000000000000000000220151326047013100230170ustar00rootroot00000000000000from snappergui import snapper import pkg_resources, os, time, difflib, collections from gi.repository import Gtk, GtkSource, GObject, Gdk class StatusFlags(object): """File status flags from https://github.com/openSUSE/snapper/blob/master/snapper/File.h#L39-L51""" CREATED = 1 # created DELETED = 2 # deleted TYPE = 4 # type has changed CONTENT = 8 # content has changed PERMISSIONS = 16 # permissions have changed, see chmod(2) OWNER = 32 # owner has changed, see chown(2) USER = 32 # deprecated - alias for OWNER GROUP = 64 # group has changed, see chown(2) XATTRS = 128 # extended attributes changed, see attr(5) ACL = 256 # access control list changed, see acl(5) class changesWindow(object): """docstring for changesWindow""" TreeNode = collections.namedtuple("TreeNode", "path, children, status, is_dir") def __init__(self, config, begin, end): super(changesWindow, self).__init__() builder = Gtk.Builder() GObject.type_register(GtkSource.View) builder.add_from_file(pkg_resources.resource_filename("snappergui", "glade/changesWindow.glade")) builder.get_object("titlelabel").set_text("%s -> %s"%(begin, end)) self.window = builder.get_object("changesWindow") self.statusbar = builder.get_object("statusbar1") self.pathstreeview = builder.get_object("pathstreeview") self.fileview = builder.get_object("fileview") self.choicesviewgroup = builder.get_object("actiongroup") builder.connect_signals(self) # save mountpoints for begin and end snapshots self.beginpath = snapper.GetMountPoint(config, begin) self.endpath = snapper.GetMountPoint(config, end) self.config = config self.snapshot_begin = begin self.snapshot_end = end self.choicesviewgroup.get_action("begin").set_label(str(begin)) self.choicesviewgroup.get_action("end").set_label(str(end)) self.sourcebuffer = GtkSource.Buffer() self.fileview.set_buffer(self.sourcebuffer) self.window.show_all() GObject.idle_add(self.on_idle_init_paths_tree) def add_path_to_tree(self, path, status, tree): is_dir = os.path.isdir(self.beginpath + path) or os.path.isdir(self.endpath + path) parts = path.split('/') node = tree # Add directories to tree for file_name in parts[1:-1]: if not file_name in node.children: node.children[file_name] = changesWindow.TreeNode("", {}, 0, True) node = node.children[file_name] # Add last part of path to tree if is_dir: node.children[parts[-1]] = changesWindow.TreeNode("", {}, status, True) else: node.children[parts[-1]] = changesWindow.TreeNode(path, None, status, False) def print_tree(self, tree, indent=""): for name, child in tree.children.items(): print(indent + name + ("/" if child.is_dir else "") + " (" + self.file_status_to_string(child.status) + ")") if child.is_dir: self.print_tree(child, indent + " ") def file_status_to_string(self, status): if status & StatusFlags.CREATED: # Created file return "Created" elif status & StatusFlags.DELETED: # Deleted file return "Deleted" elif status > 0: # Modified file modification_types = { StatusFlags.ACL: "acl", StatusFlags.CONTENT: "content", StatusFlags.GROUP: "group", StatusFlags.OWNER: "owner", StatusFlags.XATTRS: "xattrs", StatusFlags.TYPE: "inode type", StatusFlags.PERMISSIONS: "permissions" } modified_list = [] for flag, name in modification_types.items(): if status & flag: modified_list.append(name) return "Modified: " + ", ".join(modified_list) else: return "No changes" def get_treestore_from_tree(self, tree): # Row: [gtk-stock-icon, file name, file complete path, entry color, tooltip] treestore = Gtk.TreeStore(str, str, str, Gdk.RGBA, str) def get_childs(tree, parent=None): for file_name, child in tree.children.items(): color = Gdk.RGBA(0.0, 0.0, 0.0) if child.status & StatusFlags.CREATED: # Created file color = Gdk.RGBA(0.0, 0.57, 0.0) elif child.status & StatusFlags.DELETED: # Deleted file color = Gdk.RGBA(0.6, 0.0, 0.0) elif child.status > 0: # Modified file color = Gdk.RGBA(0.49, 0.47, 0.0) node = treestore.append(parent,[ Gtk.STOCK_DIRECTORY if child.is_dir else Gtk.STOCK_FILE, file_name, child.path, color, self.file_status_to_string(child.status) ]) # if this child is a directory get childs if child.children is not None: get_childs(child, node) get_childs(tree) return treestore def on_query_tooltip(self, widget, x, y, keyboard_tip, tooltip): if not widget.get_tooltip_context(x, y, keyboard_tip): return False else: on_row, x, y, model, path, it = widget.get_tooltip_context(x, y, keyboard_tip) if on_row: tooltip.set_text(model[it][4]) widget.set_tooltip_row(tooltip, path) return True else: return False def on_idle_init_paths_tree(self): snapper.CreateComparison(self.config,self.snapshot_begin,self.snapshot_end) dbus_array = snapper.GetFiles(self.config,self.snapshot_begin,self.snapshot_end) # create structure to sort paths into tree files_tree = changesWindow.TreeNode("/", {}, 0, True) for entry in dbus_array: self.add_path_to_tree(str(entry[0]), int(entry[1]), files_tree) #self.print_tree(files_tree) self.pathstreeview.set_model(self.get_treestore_from_tree(files_tree)) #self.pathstreeview.expand_all() # display in statusbar how many files have changed self.statusbar.push(1,"%d files"%len(dbus_array)) snapper.DeleteComparison(self.config,self.snapshot_begin,self.snapshot_end) # we dont want this function to be called anymore return False def get_lines_from_file(self, path): try: return open(path, 'U').readlines() except IsADirectoryError: pass except FileNotFoundError: return "" except UnicodeDecodeError: pass except PermissionError: print("PermissionError") pass # TODO maybe display a dialog with the error? return None def _on_pathstree_selection_changed(self, selection): (model, treeiter) = selection.get_selected() if treeiter != None and model[treeiter] != "": # append file path to snapshot mountpoint fromfile = self.beginpath+model[treeiter][2] tofile = self.endpath+model[treeiter][2] fromlines = self.get_lines_from_file(fromfile) if fromlines == None: return elif fromlines == "": fromfile = "New File" fromdate = "" else: fromdate = time.ctime(os.stat(fromfile).st_mtime) tolines = self.get_lines_from_file(tofile) if tolines == None: return elif tolines == "": tofile = "Deleted File" todate = "" else: todate = time.ctime(os.stat(tofile).st_mtime) languagemanager = GtkSource.LanguageManager() currentview = self.choicesviewgroup.get_action("end").get_current_value() if currentview == 0: # show file from begin snapshot self.sourcebuffer.set_language(languagemanager.get_language("text")) self.sourcebuffer.set_text("".join(fromlines)) elif currentview == 1: # show diff of file changes between snapshots self.sourcebuffer.set_language(languagemanager.get_language("diff")) difflines = difflib.unified_diff(fromlines, tolines, fromfile=fromfile, tofile=tofile, fromfiledate=fromdate, tofiledate=todate) self.sourcebuffer.set_text("".join(difflines)) elif currentview == 2: # show file from end snapshot self.sourcebuffer.set_language(languagemanager.get_language("text")) self.sourcebuffer.set_text("".join(tolines)) snapper-gui_0git.960a94834f/snappergui/createConfig.py000066400000000000000000000022621326047013100226120ustar00rootroot00000000000000from snappergui import snapper import pkg_resources from gi.repository import Gtk class createConfig(object): """docstring for createConfig""" def __init__(self, parent): super(createConfig, self).__init__() builder = Gtk.Builder() builder.add_from_file(pkg_resources.resource_filename("snappergui", "glade/createConfig.glade")) self.dialog = builder.get_object("createConfig") self.dialog.set_transient_for(parent) builder.connect_signals(self) self.name = "" self.subvolume = "" self.fstype = "btrfs" self.template = "default" builder.get_object("fsTypeCombo").set_active(0) def on_name_changed(self, widget): self.name = widget.get_chars(0,-1) def on_subvolume_changed(self, widget): self.subvolume = widget.get_chars(0,-1) def on_fstype_changed(self, widget): self.fstype = widget.get_active_text() def on_template_changed(self, widget): self.template = widget.get_chars(0,-1) def run(self): return self.dialog.run() def destroy(self): self.dialog.destroy() snapper-gui_0git.960a94834f/snappergui/createSnapshot.py000066400000000000000000000055651326047013100232150ustar00rootroot00000000000000from snappergui import snapper import pkg_resources from gi.repository import Gtk, Gdk class createSnapshot(object): TYPE_HERE = "" """docstring for createSnapshot""" def __init__(self, parent, config_name): super(createSnapshot, self).__init__() builder = Gtk.Builder() builder.add_from_file(pkg_resources.resource_filename("snappergui", "glade/createSnapshot.glade")) self.dialog = builder.get_object("dialogCreate") self.userdataTree = builder.get_object("userdatatreeview") self.userdataTree.get_model().append([self.TYPE_HERE, ""]) self.dialog.set_transient_for(parent) builder.connect_signals(self) self.config = "" self.description = "" self.cleanup = "" self.userdata = {} configscombo = Gtk.ListStore(str) combobox = builder.get_object("configsCombo") combobox.set_model(configscombo) for i, config in enumerate(snapper.ListConfigs()): name = str(config[0]) configscombo.append([name]) if name == config_name: combobox.set_active(i) builder.get_object("cleanupcombo").set_active(0) def on_config_changed(self,widget): self.config = widget.get_model()[widget.get_active()][0] def on_description_changed(self,widget): self.description = widget.get_chars(0,-1) def on_cleanup_changed(self,widget): self.cleanup = widget.get_active_text() if self.cleanup == "None": self.cleanup = "" def _on_key_press(self, widget, event): if event.keyval == Gdk.KEY_Delete: model, selected = self.userdataTree.get_selection().get_selected_rows() if str(selected[0]) != str(len(model) - 1): del model[selected[0]] def _on_editing_started(self, cell, editable, path): if editable.get_text() == self.TYPE_HERE: editable.set_text("") def _on_name_edited(self, renderer, path, new_text): userdatamodel = self.userdataTree.get_model() if userdatamodel[path][0] == self.TYPE_HERE: userdatamodel.append([self.TYPE_HERE, ""]) if new_text == "" or new_text == self.TYPE_HERE: del userdatamodel[path] else: userdatamodel[path][0] = new_text def _on_value_edited(self, renderer, path, new_text): userdatamodel = self.userdataTree.get_model() userdatamodel[path][1] = new_text def get_userdata_from_model(self, model): for row in model: if row[0] != self.TYPE_HERE: self.userdata[row[0]] = row[1] def run(self): response = self.dialog.run() self.get_userdata_from_model( self.userdataTree.get_model() ) return response def destroy(self): self.dialog.destroy() snapper-gui_0git.960a94834f/snappergui/deleteDialog.py000066400000000000000000000050041326047013100226000ustar00rootroot00000000000000from snappergui import snapper import pkg_resources from gi.repository import Gtk from pwd import getpwuid class deleteDialog(object): """docstring for deleteDialog""" def __init__(self, parent, config, snapshots): super(deleteDialog, self).__init__() builder = Gtk.Builder() builder.add_from_file(pkg_resources.resource_filename("snappergui", "glade/deleteSnapshot.glade")) self.dialog = builder.get_object("dialogDelete") self.dialog.set_transient_for(parent) self.deletetreeview = builder.get_object("deletetreeview") builder.connect_signals(self) self.snapshots_list = snapshots self.to_delete = snapshots parents = [] self.deleteTreeStore = Gtk.TreeStore(bool, int, str, str) for snapshot in snapshots: snapinfo = snapper.GetSnapshot(config,snapshot) #self.deleteTreeStore.append(self.get_row(snapinfo)) if (snapinfo[1] == 1): # Pre Snapshot parents.append(self.deleteTreeStore.append(None, self.get_row(snapinfo))) elif (snapinfo[1] == 2): # Post snappshot parent_node = None for parent in parents: if (self.deleteTreeStore.get_value(parent, 1) == snapinfo[2]): parent_node = parent break self.deleteTreeStore.append(parent_node, ) else: # Single snapshot self.deleteTreeStore.append(None , self.get_row(snapinfo)) self.deletetreeview.set_model(self.deleteTreeStore) self.deletetreeview.expand_all() def get_row(self, snapshot): return [True, snapshot[0], getpwuid(snapshot[4])[0], snapshot[5]] def run(self): response = self.dialog.run() self.dialog.destroy() return response def on_toggle_delete_snapshot(self,widget,path): treeiter = self.deleteTreeStore.get_iter(path) self.deleteTreeStore.set_value(treeiter, False, not(self.deleteTreeStore.get_value(treeiter, False))) snapshot_num = self.deleteTreeStore.get_value(treeiter, True) if self.deleteTreeStore.get_value(treeiter,False): if snapshot_num not in self.to_delete: self.to_delete.append(snapshot_num) else: if snapshot_num in self.to_delete: self.to_delete.remove(snapshot_num) snapper-gui_0git.960a94834f/snappergui/glade/000077500000000000000000000000001326047013100207215ustar00rootroot00000000000000snapper-gui_0git.960a94834f/snappergui/glade/changesWindow.glade000066400000000000000000000264711326047013100245310ustar00rootroot00000000000000 Snapshot in the begin of comparison True Snapshot in the end of comparison True 2 begin Diff Display diff of begin and end file True True 1 begin False 700 500 True False vertical True True 100 True True in True True True 1 Paths True 1 0 1 3 True True True False True False vertical True False 0.47999998927116394 False True 0 True True in True True True False 2 2 True 4 True False GTK_SOURCE_DRAW_SPACES_TAB | GTK_SOURCE_DRAW_SPACES_NBSP | GTK_SOURCE_DRAW_SPACES_TRAILING True True 1 True False center begin True True True False True 0 diff True True True False True 1 end True True True False True 2 False True 2 True True 0 True True True True 0 True False vertical 2 False True 2 snapper-gui_0git.960a94834f/snappergui/glade/createConfig.glade000066400000000000000000000157661326047013100243270ustar00rootroot00000000000000 False False dialog True other ok-cancel Create new configuration False vertical 10 False expand False True end 0 True False 5 5 5 5 True 200 True False 0 btrfs ext4 kvm 1 2 True False start True Filesystem: 0 2 True False start True Template 0 3 200 True True default 1 3 200 True True 1 1 True False start True Subvolume: 0 1 200 True True 1 0 True False start True Name: 0 0 True True 2 snapper-gui_0git.960a94834f/snappergui/glade/createSnapshot.glade000066400000000000000000000216441326047013100247110ustar00rootroot00000000000000 False False center-on-parent dialog True other ok-cancel Create new snapshot False vertical 10 False expand False False end 0 True False 5 5 5 5 True True False start True Configuration: 0 0 200 True False center 1 0 200 True True 1 1 True False start True Cleanup: 0 2 True False start True Description: 0 1 200 True False 0 None number timeline empty-pre-post 1 2 True True 2 True True 5 5 never in True True userdatastore False 0 Name True True 0 Value True True 1 True True 3 snapper-gui_0git.960a94834f/snappergui/glade/deleteSnapshot.glade000066400000000000000000000111551326047013100247040ustar00rootroot00000000000000 False center-on-parent dialog True question yes-no Delete the selected snapshots? False vertical 10 False True expand False True end 0 True True 5 5 never 100 True True False Del 0 # 1 User 2 Description 3 True True 2 snapper-gui_0git.960a94834f/snappergui/glade/mainWindow.glade000066400000000000000000000355601326047013100240440ustar00rootroot00000000000000 False 5 dialog SnapperGUI 0.03 2013 A user interface for the program snapper for filesystem snapshot management image-missing gpl-2-0 False vertical 2 False end False True end 0 configsaccelgroup Create Snapshot New Create a new snapshot for the current configuration gtk-add snapsaccelgroup Delete Del Delete selected snapshots gtk-remove Open Open Open snapshot mountpoint gtk-open View changes Changes Show which files have changed between selected snapshots gtk-file 700 600 False drive-harddisk True False vertical True False both create-snapshot True False Create a new snapshot True gtk-add True False create-snapshot True False Create Snapshot True True False Create Configuration False True open-mountpoint True False Open snapshot mountpoint Open True gtk-open False True delete-snapshot True False Del True gtk-remove False True view-changes True False Changes True gtk-file False True False True 1 True True vertical True False none True False slide-left-right True True True True True True True in True True False False treeviewcolumn6 0 Key True 0 Value True 1 True False Userdata False True True True 2 True False vertical 2 False True 3 True False SnapperGUI True True False stack1 snapper-gui_0git.960a94834f/snappergui/glade/propertiesDialog.glade000066400000000000000000001104421326047013100252350ustar00rootroot00000000000000 True False vertical True False 5 5 5 5 2 True True True 1 0 True True 3 0 True True 1 1 True True 3 1 True False start 5 5 5 5 True Subvolume 0 0 True False start 5 5 5 5 Users 0 1 True False start 5 5 5 5 True Filesystem 2 0 True False start 5 5 5 5 Groups 2 1 True False start 5 5 5 5 Timeline 2 2 True True start 5 5 5 5 3 2 False True 0 True False 5 0 in True False vertical True False 5 0 in True False 5 5 5 5 2 True True False start 5 5 5 5 True Hourly 0 0 True False start 5 5 5 5 Daily 0 1 True False start 5 5 5 5 Yearly 2 1 True False start 5 5 5 5 True Monthly 2 0 True True start True 1 0 True True start 1 1 True True start True 3 0 True True start 3 1 True False start 5 5 5 5 Min. Age 2 2 True True start 3 2 True False start 5 5 5 5 Weekly 0 2 True True start 1 2 True False True False 2 Timeline False True 2 0 True True False True 2 1 False True 0 True False 5 0 in True False 5 5 5 5 2 True True False start 5 5 5 5 True Limit 0 0 True False start 5 5 5 5 Min. Age 0 1 True False start 5 5 5 5 True Limit Impor. 2 0 True True start True 1 0 True True start 1 1 True True start True 3 0 True False True False 2 Number False True 2 0 True True False True 2 1 False True 1 True False 5 0 in True False 5 5 5 5 2 True True False start 5 5 5 5 True Min. Age 0 0 True True start True 1 0 True False True False 2 Empty Pre/Post False True 2 0 True True False True 2 1 False True 2 True False Cleanup False True 2 True False 5 5 5 5 True True True False start 5 5 5 5 Backg. Comparison 0 0 True True start 1 0 True True start 3 0 True False start 5 5 5 5 Sync Acl 2 0 False True 3 False False center-on-parent dialog True other ok-cancel Configurations properties False vertical 2 False True expand False False 0 True True False True True 2 snapper-gui_0git.960a94834f/snappergui/glade/snapshotsView.glade000066400000000000000000000077721326047013100246110ustar00rootroot00000000000000 True True in True True False 0 True multiple True # True 0 0 True Date 3 True User True 4 4 True Description True True 5 True 5 True Cleanup True 6 True 6 snapper-gui_0git.960a94834f/snappergui/mainWindow.py000066400000000000000000000212111326047013100223300ustar00rootroot00000000000000from snappergui import snapper import pkg_resources, subprocess, dbus from snappergui.createSnapshot import createSnapshot from snappergui.createConfig import createConfig from snappergui.deleteDialog import deleteDialog from snappergui.changesWindow import changesWindow from snappergui.snapshotsView import snapshotsView from gi.repository import Gtk from time import strftime, localtime from pwd import getpwuid class SnapperGUI(): """docstring for SnapperGUI""" def __init__(self, app): super(SnapperGUI, self).__init__() self.builder = Gtk.Builder() self.builder.add_from_file(pkg_resources.resource_filename("snappergui", "glade/mainWindow.glade")) self.statusbar = self.builder.get_object("statusbar") self.snapshotsTreeView = self.builder.get_object("snapstreeview") self.configsGroup = self.builder.get_object("configsGroup") self.window = self.builder.get_object("applicationwindow1") self.stack = self.builder.get_object("stack1") self.builder.connect_signals(self) self.window.set_application(app) self.configView = {} for config in snapper.ListConfigs(): name = str(config[0]) self.configView[name] = snapshotsView(name) self.stack.add_titled(self.configView[name].scrolledwindow, name, name) self.configView[name].selection.connect("changed", self.on_snapshots_selection_changed) self.init_dbus_signal_handlers() self.window.show() def snapshot_columns(self,snapshot): if(snapshot[3] == -1): date = "Now" else: date = strftime("%a %x %R", localtime(snapshot[3])) return [snapshot[0], snapshot[1], snapshot[2], date, getpwuid(snapshot[4])[0], snapshot[5], snapshot[6]] def get_current_config(self): return self.stack.get_visible_child_name() def on_stack_visible_child_changed(self, stack, property): self.update_controlls_and_userdatatreeview() def on_snapshots_selection_changed(self, selection): self.update_controlls_and_userdatatreeview() def update_controlls_and_userdatatreeview(self): config = self.get_current_config() userdatatreeview = self.builder.get_object("userdatatreeview") if config is not None: model, paths = self.configView[config].selection.get_selected_rows() if config is None or len(paths) == 0: self.builder.get_object("snapshotActions").set_sensitive(False) userdatatreeview.set_model(None) else: self.builder.get_object("snapshotActions").set_sensitive(True) if len(paths) == 1 and not model.iter_has_child(model.get_iter(paths[0])): self.builder.get_object("view-changes").set_sensitive(False) else: self.builder.get_object("view-changes").set_sensitive(True) try: snapshot_data = snapper.GetSnapshot(config,model[model.get_iter(paths[0])][0]) userdata_liststore = Gtk.ListStore(str, str) for key, value in snapshot_data[7].items(): userdata_liststore.append([key, value]) userdatatreeview.set_model(userdata_liststore) except dbus.exceptions.DBusException: pass def on_create_snapshot(self, widget): dialog = createSnapshot(self.window, self.get_current_config()) response = dialog.run() dialog.destroy() if response == Gtk.ResponseType.OK: newSnapshot = snapper.CreateSingleSnapshot(dialog.config, dialog.description, dialog.cleanup, dialog.userdata) elif response == Gtk.ResponseType.CANCEL: pass def on_create_config(self, widget): dialog = createConfig(self.window) response = dialog.run() dialog.destroy() if response == Gtk.ResponseType.OK: snapper.CreateConfig(dialog.name, dialog.subvolume, dialog.fstype, dialog.template) elif response == Gtk.ResponseType.CANCEL: pass def on_delete_snapshot(self, widget): config = self.get_current_config() selection = self.configView[config].selection (model, paths) = selection.get_selected_rows() snapshots = [] for path in paths: treeiter = model.get_iter(path) # avoid duplicates because post snapshots are always added if model[treeiter][0] not in snapshots: snapshots.append(model[treeiter][0]) # if snapshot has post add that to delete if model.iter_has_child(treeiter): child_treeiter = model.iter_children(treeiter) snapshots.append(model[child_treeiter][0]) dialog = deleteDialog(self.window, config,snapshots) response = dialog.run() if response == Gtk.ResponseType.YES and len(dialog.to_delete) > 0: snapper.DeleteSnapshots(config, dialog.to_delete) def on_open_snapshot_folder(self, widget): config = self.get_current_config() selection = self.configView[config].selection model, paths = selection.get_selected_rows() for path in paths: treeiter = model.get_iter(path) mountpoint = snapper.GetMountPoint(config, model[treeiter][0]) if model[treeiter][6] != '': snapper.MountSnapshot(config,model[treeiter][0],'true') subprocess.Popen(['xdg-open', mountpoint]) self.statusbar.push(True, "The mount point for the snapshot %s from %s is %s"% (model[treeiter][0], config, mountpoint)) def on_viewchanges_clicked(self, widget): config = self.get_current_config() selection = self.configView[config].selection model, paths = selection.get_selected_rows() if len(paths) > 1: # open a changes window with the first and the last snapshot selected begin = model[paths[0]][0] end = model[paths[-1]][0] window = changesWindow(config, begin, end) elif len(paths) == 1 and model.iter_has_child(model.get_iter(paths[0])): # open a changes window with the selected pre snapshot and is's post child_iter = model.iter_children(model.get_iter(paths[0])) begin = model[paths[0]][0] end = model.get_value(child_iter,0) window = changesWindow(config, begin, end) def init_dbus_signal_handlers(self): signals = { "SnapshotCreated" : self.on_dbus_snapshot_created, "SnapshotModified" : self.on_dbus_snapshot_modified, "SnapshotsDeleted" : self.on_dbus_snapshots_deleted, "ConfigCreated" : self.on_dbus_config_created, "ConfigModified" : self.on_dbus_config_modified, "ConfigDeleted" : self.on_dbus_config_deleted } for signal, handler in signals.items(): snapper.connect_to_signal(signal,handler) def on_dbus_snapshot_created(self,config,snapshot): self.statusbar.push(True, "Snapshot %s created for %s"% (str(snapshot), config)) self.configView[config].add_snapshot_to_tree(str(snapshot)) def on_dbus_snapshot_modified(self,config,snapshot): print("Snapshot SnapshotModified") def on_dbus_snapshots_deleted(self,config,snapshots): snaps_str = "" for snapshot in snapshots: snaps_str += str(snapshot) + " " self.statusbar.push(True, "Snapshots deleted from %s: %s"% (config, snaps_str)) for deleted in snapshots: self.configView[config].remove_snapshot_from_tree(deleted) def on_dbus_config_created(self, config): self.configView[config] = snapshotsView(config) self.configView[config].update_view() self.stack.add_titled(self.configView[config]._TreeView, config, config) self.statusbar.push(5,"Created new configuration %s"% config) def on_dbus_config_modified(self,args): print("Config Modified") def on_dbus_config_deleted(self,args): print("Config Deleted") def on_main_destroy(self,args): for config in snapper.ListConfigs(): for snapshot in snapper.ListSnapshots(config[0]): if snapshot[6] != '': snapper.UmountSnapshot(config[0],snapshot[0],'true') snapper-gui_0git.960a94834f/snappergui/propertiesDialog.py000066400000000000000000000071461326047013100235430ustar00rootroot00000000000000from snappergui import snapper import pkg_resources, dbus from gi.repository import Gtk class PropertiesTab(object): """docstring for PropertiesTab""" def __init__(self, config): builder = Gtk.Builder() builder.add_from_file(pkg_resources.resource_filename("snappergui", "glade/propertiesDialog.glade")) self.configsGrid = builder.get_object("configsGrid") self.widgets = {} for k, v in config[2].items(): widget = builder.get_object(k) # Values are set here depending on their types if type(widget) == Gtk.Entry: widget.set_text(v) elif type(widget) == Gtk.SpinButton: adjustment = Gtk.Adjustment(value=int(v), lower=0, upper=5000, step_increment=1, page_increment=10, page_size=0) widget.set_adjustment(adjustment) elif type(widget) == Gtk.Switch: if v == "yes": widget.set_active(True) elif v == "no": widget.set_active(False) else: print("ERROR: Could not handle property \"%s\"."% k) self.widgets[k] = widget def get_current_value(self, setting): widget = self.widgets[setting] if type(widget) == Gtk.Entry: return widget.get_text() elif type(widget) == Gtk.Switch: if(widget.get_active()): return "yes" else: return "no" elif type(widget) == Gtk.SpinButton: return str(int(widget.get_value())) class propertiesDialog(object): """docstring for propertiesDialog""" def __init__(self, widget, parent): self.parent = parent builder = Gtk.Builder() builder.add_from_file(pkg_resources.resource_filename("snappergui", "glade/propertiesDialog.glade")) self.dialog = builder.get_object("dialogProperties") self.notebook = builder.get_object("notebookProperties") builder.connect_signals(self) self.dialog.set_transient_for(parent) self.tabs = {} for config in snapper.ListConfigs(): currentTab = PropertiesTab(config) self.tabs[str(config[0])] = currentTab self.notebook.append_page(currentTab.configsGrid, Gtk.Label.new(config[0])) self.notebook.show_all() def get_changed_settings(self, config): changed = {} for k, v in snapper.GetConfig(config)[2].items(): currentValue = self.tabs[config].get_current_value(k) if currentValue and v != currentValue: changed[k] = currentValue return changed def on_response(self, widget, response): if response == Gtk.ResponseType.OK: currentConfig = str(snapper.ListConfigs()[self.notebook.get_current_page()][0]) try: snapper.SetConfig(currentConfig, self.get_changed_settings(currentConfig)) except dbus.exceptions.DBusException as error: if(str(error).find("error.no_permission") != -1): self.dialog.destroy() dialog = Gtk.MessageDialog(self.parent, 0, Gtk.MessageType.WARNING, Gtk.ButtonsType.OK, "You don't have permission to edit configurations") dialog.run() dialog.destroy() snapper-gui_0git.960a94834f/snappergui/snapshotsView.py000066400000000000000000000103261326047013100230760ustar00rootroot00000000000000from snappergui import snapper import pkg_resources, dbus from gi.repository import Gtk from time import strftime, localtime from pwd import getpwuid class snapshotsView(Gtk.Widget): """docstring for snapshotsView""" def __init__(self, config): super(snapshotsView, self).__init__() self.config = config self.builder = Gtk.Builder() self.builder.add_from_file(pkg_resources.resource_filename("snappergui", "glade/snapshotsView.glade")) self.builder.connect_signals(self) self._TreeView = self.builder.get_object("snapstreeview") self.selection = self.builder.get_object("snapshotsSelection") self.scrolledwindow = self.builder.get_object("scrolledwindow1") self.count = 0 self._TreeView.connect("realize", self.update_view) def update_view(self, widget=None, user_data=None): treestore = self.get_config_treestore() if treestore: self._TreeView.set_model(treestore) def snapshot_columns(self,snapshot): if(snapshot[3] == -1): date = "Now" else: date = strftime("%a %x %R", localtime(snapshot[3])) return [snapshot[0], snapshot[1], snapshot[2], date, getpwuid(snapshot[4])[0], snapshot[5], snapshot[6]] def get_config_treestore(self): configstree = Gtk.TreeStore(int, int, int, str, str, str, str) # Check if the user has permission to see/edit this configuration try: snapshots_list = snapper.ListSnapshots(self.config) except dbus.exceptions.DBusException: return parents = [] self.count = len(snapshots_list) for snapshot in snapshots_list: if (snapshot[1] == 1): # Pre Snapshot parents.append(configstree.append(None , self.snapshot_columns(snapshot))) elif (snapshot[1] == 2): # Post snappshot parent_node = None for parent in parents: if (configstree.get_value(parent, 0) == snapshot[2]): parent_node = parent break configstree.append(parent_node , self.snapshot_columns(snapshot)) else: # Single snapshot configstree.append(None , self.snapshot_columns(snapshot)) return configstree def add_snapshot_to_tree(self, snapshot, pre_snapshot=None): treemodel = self._TreeView.get_model() # Ignore if we are notified about snapshot we can't read details about. try: snapinfo = snapper.GetSnapshot(self.config, snapshot) except dbus.exceptions.DBusException: return pre_number = snapinfo[2] if (snapinfo[1] == 2): # if type is post for aux, row in enumerate(treemodel): if(pre_number == row[0]): pre_snapshot = treemodel.get_iter(aux) break treemodel.append(pre_snapshot, self.snapshot_columns(snapinfo)) def remove_snapshot_from_tree(self, snapshot): treemodel = self._TreeView.get_model() for aux, row in enumerate(treemodel): if(snapshot == row[0]): has_child = treemodel.iter_has_child(treemodel.get_iter(aux)) if(has_child): # FIXME meh self.update_view() else: del treemodel[aux] def on_description_edited(self, widget, treepath, text): snapshot_row = self._TreeView.get_model()[treepath] snapshot_num = snapshot_row[0] snapshot_info = snapper.GetSnapshot(self.config,snapshot_num) snapper.SetSnapshot(self.config,snapshot_info[0],text,snapshot_info[6],snapshot_info[7]) snapshot_row[5] = text def on_cleanup_edited(self, widget, treepath, text): snapshot_row = self._TreeView.get_model()[treepath] snapshot_num = snapshot_row[0] snapshot_info = snapper.GetSnapshot(self.config,snapshot_num) snapper.SetSnapshot(self.config,snapshot_info[0],snapshot_info[5],text,snapshot_info[7]) snapshot_row[6] = text snapper-gui_0git.960a94834f/snappergui/ui/000077500000000000000000000000001326047013100202625ustar00rootroot00000000000000snapper-gui_0git.960a94834f/snappergui/ui/app-menu.ui000066400000000000000000000012221326047013100223400ustar00rootroot00000000000000
app.properties Properties
app.about _About app.quit _Quit <Primary>q