From 9d4e58c8d4c3203428b7bd03987727c4271af021 Mon Sep 17 00:00:00 2001 From: Agnieszka Kostrzewa Date: Thu, 26 Apr 2012 17:46:41 +0200 Subject: [PATCH] Menu revolution (#549) --- mainwindow.ui | 93 +++++++++++++++++++++++++++++++++++++++++--- qubesmanager/main.py | 34 +++++++--------- 2 files changed, 102 insertions(+), 25 deletions(-) diff --git a/mainwindow.ui b/mainwindow.ui index bfe679b..148dbf6 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -227,15 +227,15 @@ 23 - + - Options + System - + View @@ -249,9 +249,61 @@ + + + + + - - + + + VM + + + + Logs + + + + :/log.png:/log.png + + + + + Block devices + + + + :/mount.png:/mount.png + + + + + + + + + + + + + + + + + + + + + + About + + + + + + + @@ -622,6 +674,37 @@ Name + + + true + + + true + + + Show tool bar + + + + + true + + + true + + + Show menu bar + + + + + + :/qubes.png:/qubes.png + + + Qubes OS + + diff --git a/qubesmanager/main.py b/qubesmanager/main.py index 7c4d85c..8e88a17 100755 --- a/qubesmanager/main.py +++ b/qubesmanager/main.py @@ -678,33 +678,22 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow): self.table.sortItems(self.columns_indices["Type"], Qt.AscendingOrder) self.context_menu = QMenu(self) - self.context_menu.addAction(self.action_settings) self.context_menu.addAction(self.action_removevm) self.context_menu.addAction(self.action_resumevm) self.context_menu.addAction(self.action_pausevm) self.context_menu.addAction(self.action_shutdownvm) self.context_menu.addAction(self.action_killvm) + self.context_menu.addAction(self.action_settings) self.context_menu.addAction(self.action_appmenus) self.context_menu.addAction(self.action_editfwrules) self.context_menu.addAction(self.action_updatevm) self.context_menu.addAction(self.action_set_keyboard_layout) - - self.table_selection_changed() - - self.logs_menu = QMenu("Logs") - log_icon = QtGui.QIcon() - log_icon.addPixmap(QPixmap(":/log.png")) - self.logs_menu.setIcon(log_icon) self.context_menu.addMenu(self.logs_menu) - - - self.blk_menu = QMenu("Block devices") - blk_icon = QtGui.QIcon() - blk_icon.addPixmap(QPixmap(":/mount.png")) - self.blk_menu.setIcon(blk_icon) self.context_menu.addMenu(self.blk_menu) self.context_menu.addSeparator() + self.table_selection_changed() + self.connect(self.table.horizontalHeader(), SIGNAL("sortIndicatorChanged(int, Qt::SortOrder)"), self.sortIndicatorChanged) self.connect(self.table, SIGNAL("customContextMenuRequested(const QPoint&)"), self.open_context_menu) self.connect(self.blk_menu, SIGNAL("triggered(QAction *)"), self.attach_dettach_device_triggered) @@ -714,12 +703,12 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow): self.centralwidget.layout().setContentsMargins(0,0,0,0) self.layout().setContentsMargins(0,0,0,0) - self.action_toolbar = QAction("Show tool bar", None) - self.action_toolbar.setCheckable(True) - self.action_toolbar.setChecked(True) - self.action_menubar = QAction("Show menu bar", None) - self.action_menubar.setCheckable(True) - self.action_menubar.setChecked(True) + #self.action_toolbar = QAction("Show tool bar", None) + #self.action_toolbar.setCheckable(True) + #self.action_toolbar.setChecked(True) + #self.action_menubar = QAction("Show menu bar", None) + #self.action_menubar.setCheckable(True) + #self.action_menubar.setChecked(True) self.connect(self.action_menubar, SIGNAL("toggled(bool)"), self.showhide_menubar) self.connect(self.action_toolbar, SIGNAL("toggled(bool)"), self.showhide_toolbar) @@ -1453,6 +1442,11 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow): self.showhide_column( self.columns_indices['MEM Graph'], checked) + @pyqtSlot(name='on_action_about_qubes_triggered') + def action_about_qubes_triggered(self): + QMessageBox.about(self, "About...", "Qubes OS

Release 1.0") + + def createPopupMenu(self): menu = QMenu() menu.addAction(self.action_toolbar)