예제 #1
0
 def _updateRestoreList(self):
     store = self._combo.get_model()
     store.clear()
     for x in domain_backup.getBackupList():
         store.append([x])
예제 #2
0
    def _getRestoreBox(self):
        hbox = gtk.HBox(False, 5)
        
        vbox = gtk.VBox(False, 5)
        
        self._combo = gtk.combo_box_new_text()
        for x in domain_backup.getBackupList():
            self._combo.append_text(x)
        self._combo.connect('changed', self._comboSelected)

        vbox.pack_start(self._combo, False, True, 5)

        scrolled_window = gtk.ScrolledWindow()
        scrolled_window.set_border_width(10)
        scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_ALWAYS)
        vbox.pack_start(scrolled_window, True, True, 0)
        
        store = gtk.ListStore(gobject.TYPE_BOOLEAN, gobject.TYPE_STRING)

        self._restoreTable = gtk.TreeView(model=store)
        cell = gtk.CellRendererToggle()
        cell.set_property('activatable', True)
        cell.connect( 'toggled', self._restore_toggled_cb, store)
        col = gtk.TreeViewColumn("Include", cell)
        col.add_attribute(cell, "active", 0)
        col.pack_start(cell, False)
        self._restoreTable.append_column(col)
        
        cell = gtk.CellRendererText()
        col = gtk.TreeViewColumn("Filename", cell, text=1)
        col.pack_start(cell, False)
        self._restoreTable.append_column(col)
        self._restoreTable.get_selection().set_mode(gtk.SELECTION_SINGLE)
        scrolled_window.add_with_viewport(self._restoreTable)

        hbox.pack_start(vbox, True, True,  5)
        
        separator = gtk.VSeparator()
        hbox.pack_start(separator, False, True, 5)
        
        bButtons = gtk.VBox(False, 5)
        bButtons.set_size_request(180, -1)
        b = gtk.Button("Delete selected Backup")
        bButtons.pack_start(b, False, False,  5)
        b.connect('clicked', self._doDeleteBackup)
        separator = gtk.HSeparator()
        bButtons.pack_start(separator, False, True, 5)
        
        b = gtk.Button("Select All")
        b.connect('clicked', self._doSelectAll, store)
        bButtons.pack_start(b, False, False,  5)
        b = gtk.Button("Deselect All")
        b.connect('clicked', self._doDeselectAll, store)
        bButtons.pack_start(b, False, False,  5)
        b = gtk.Button("Invert Selection")
        b.connect('clicked', self._doInvert, store)
        bButtons.pack_start(b, False, False,  5)
        
        b = gtk.Button("Restore selected Files")
        b.connect('clicked', self._doRestore)
        bButtons.pack_end(b, False, False,  5)
        separator = gtk.HSeparator()
        bButtons.pack_end(separator, False, True, 5)
        
        hbox.pack_end(bButtons, False, True,  5)
        return hbox