Skip to content

Commit

Permalink
Improve qubemanager Toolbar on smaller screens
Browse files Browse the repository at this point in the history
  • Loading branch information
alimirjamali committed Aug 1, 2024
1 parent 4011bc6 commit acb6cf0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
12 changes: 11 additions & 1 deletion qubesmanager/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,16 @@ def valueFromText(self, text: str) -> int:
return int(float(value) * multiplier)


class QubeManagerToolBar(QtWidgets.QToolBar): # pylint: disable=too-few-public-methods
"""a toolbar that does not collapse immediately on mouse leave event"""
def __init__(self, parent=None):
super().__init__(parent)
def event(self, e):
if e.type() == QtCore.QEvent.Leave:
return True
return super().event(e)


def get_feature(vm, feature_name, default_value):
try:
return vm.features.get(feature_name, default_value)
Expand All @@ -112,7 +122,7 @@ def get_feature(vm, feature_name, default_value):


def get_boolean_feature(vm, feature_name):
"""heper function to get a feature converted to a Bool if it does exist.
"""helper function to get a feature converted to a Bool if it does exist.
Necessary because of the true/false in features being coded as 1/empty
string."""
result = get_feature(vm, feature_name, None)
Expand Down
9 changes: 8 additions & 1 deletion ui/qubemanager.ui
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ template</string>
<addaction name="menu_view"/>
<addaction name="menu_about"/>
</widget>
<widget class="QToolBar" name="toolbar">
<widget class="QubeManagerToolBar" name="toolbar">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -1002,6 +1002,13 @@ template</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
<class>QubeManagerToolBar</class>
<extends>QToolBar</extends>
<header>qubesmanager/utils.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../resources.qrc"/>
</resources>
Expand Down

0 comments on commit acb6cf0

Please sign in to comment.