From bc2d036a884e5747a6f666fc4d7784582d6789f7 Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Tue, 12 Jul 2011 19:49:35 +0200 Subject: [PATCH] Revert "appmenu-editor: Remove 'Reload' button" (#266) This reverts commit df061a2ecdc899a98d182828c3350500231d0ad5. Restore 'Reload' button, even if no one will ever need it... --- qubesmanager/appmenu_select.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/qubesmanager/appmenu_select.py b/qubesmanager/appmenu_select.py index f0800b3..05c8478 100755 --- a/qubesmanager/appmenu_select.py +++ b/qubesmanager/appmenu_select.py @@ -82,12 +82,25 @@ class AppmenuSelectWindow(QDialog): def __init__(self, vm, parent=None): super(AppmenuSelectWindow, self).__init__(parent) +# self.action_reload = self.createAction ("Reload", slot=self.reload_templates, +# icon="root", tip="Reload application list from VM") +# self.action_save = self.createAction ("Save", slot=self.save_and_apply, +# icon="updateable", tip="Save and apply setting") +# self.toolbar = self.addToolBar ("Toolbar") +# self.toolbar.setFloatable(False) +# self.addActions (self.toolbar, (self.action_reload, self.action_save, +# )) + + self.gridLayout = QGridLayout(self) + self.reload_button = QPushButton("Reload") self.buttonBox = QDialogButtonBox(self) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok) + self.connect(self.reload_button, SIGNAL("clicked()"), self.reload_templates) self.connect(self.buttonBox, SIGNAL("accepted()"), self.save_and_apply) self.connect(self.buttonBox, SIGNAL("rejected()"), self.reject) + self.buttonBox.addButton(self.reload_button, QDialogButtonBox.ActionRole) self.table = QTableWidget(self) self.table.clear() @@ -145,6 +158,16 @@ class AppmenuSelectWindow(QDialog): action.setCheckable(True) return action + def reload_templates(self): + if not self.source_vm.is_running(): + QMessageBox.warning(None, "Qubes Appmenu Select Warning", + "VM must '{0}' be running to retrieve applications list from it.".format(self.source_vm.name)) + return + + subprocess.check_call(['qvm-sync-appmenus', self.source_vm.name]) + self.fill_table() + self.load_list_of_selected() + def fill_table(self): template_dir = self.source_vm.appmenus_templates_dir