Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pr/272'
Browse files Browse the repository at this point in the history
* origin/pr/272:
  Save 'compactview' state
  Added 'Compact View' Action
  • Loading branch information
marmarek committed Dec 10, 2020
2 parents c44880f + 1c7494e commit 3d1ff3e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
14 changes: 14 additions & 0 deletions qubesmanager/qube_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,7 @@ def __init__(self, qt_app, qubes_app, dispatcher, _parent=None):
lambda pos: self.open_tools_context_menu(self.toolbar, pos))
self.action_menubar.toggled.connect(self.showhide_menubar)
self.action_toolbar.toggled.connect(self.showhide_toolbar)
self.action_compact_view.toggled.connect(self.set_compactview)
self.logs_menu.triggered.connect(self.show_log)

self.table.resizeColumnsToContents()
Expand Down Expand Up @@ -752,6 +753,8 @@ def __init__(self, qt_app, qubes_app, dispatcher, _parent=None):
self.menu_view.addSeparator()
self.menu_view.addAction(self.action_toolbar)
self.menu_view.addAction(self.action_menubar)
self.menu_view.addSeparator()
self.menu_view.addAction(self.action_compact_view)

try:
self.load_manager_settings()
Expand Down Expand Up @@ -997,6 +1000,9 @@ def load_manager_settings(self):
if not self.manager_settings.value("view/toolbar_visible",
defaultValue=True):
self.action_toolbar.setChecked(False)
if self.manager_settings.value("view/compactview",
defaultValue="false") != "false":
self.action_compact_view.setChecked(True)

# Restore show checkboxes
self.show_running.setChecked(self.manager_settings.value(
Expand Down Expand Up @@ -1457,6 +1463,14 @@ def action_backup_triggered(self):
def action_exit_triggered(self):
self.close()

def set_compactview(self, checked):
if checked:
self.toolbar.setToolButtonStyle(Qt.ToolButtonIconOnly)
else:
self.toolbar.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
if self.settings_loaded:
self.manager_settings.setValue('view/compactview', checked)

def showhide_menubar(self, checked):
self.menubar.setVisible(checked)
if not checked:
Expand Down
8 changes: 8 additions & 0 deletions ui/qubemanager.ui
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,14 @@ Template</string>
<string>Open a secure Xen console in the qube. Useful chiefly for debugging purposes: for normal operation, use &quot;Run Terminal&quot; from the Domains widget. </string>
</property>
</action>
<action name="action_compact_view">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Compact View</string>
</property>
</action>
</widget>
<resources>
<include location="../resources.qrc"/>
Expand Down

0 comments on commit 3d1ff3e

Please sign in to comment.