Skip to content

Commit

Permalink
Fixed bug with hiding last visible column
Browse files Browse the repository at this point in the history
Removed old buggy code, replaced it with disabling hiding the 'name'
column (because manager is useless without VM name).
  • Loading branch information
marmarta committed May 3, 2019
1 parent ddb70fe commit 0bb9231
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 24 deletions.
31 changes: 8 additions & 23 deletions qubesmanager/qube_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,15 +604,16 @@ def on_domain_changed(self, vm, event, **_kwargs):
return # the VM was deleted before its status could be updated

def load_manager_settings(self):
# visible columns
self.visible_columns_count = 0
for col in self.columns_indices:
col_no = self.columns_indices[col]
visible = self.manager_settings.value(
'columns/%s' % col,
defaultValue="true")
self.columns_actions[col_no].setChecked(visible == "true")
self.visible_columns_count += 1
if col == 'Name':
# 'Name' column should be always visible
self.columns_actions[col_no].setChecked(True)
else:
visible = self.manager_settings.value(
'columns/%s' % col,
defaultValue="true")
self.columns_actions[col_no].setChecked(visible == "true")

self.sort_by_column = str(
self.manager_settings.value("view/sort_column",
Expand Down Expand Up @@ -1161,22 +1162,6 @@ def showhide_toolbar(self, checked):
def showhide_column(self, col_num, show):
self.table.setColumnHidden(col_num, not show)

val = 1 if show else -1
self.visible_columns_count += val

if self.visible_columns_count == 1:
# disable hiding the last one
for col in self.columns_actions:
if self.columns_actions[col].isChecked():
self.columns_actions[col].setEnabled(False)
break
elif self.visible_columns_count == 2 and val == 1:
# enable hiding previously disabled column
for col in self.columns_actions:
if not self.columns_actions[col].isEnabled():
self.columns_actions[col].setEnabled(True)
break

if self.settings_loaded:
col_name = [name for name in self.columns_indices if
self.columns_indices[name] == col_num][0]
Expand Down
1 change: 0 additions & 1 deletion ui/qubemanager.ui
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ DisposableVMs</string>
</property>
<addaction name="action_vm_type"/>
<addaction name="action_label"/>
<addaction name="action_name"/>
<addaction name="action_state"/>
<addaction name="action_template"/>
<addaction name="action_netvm"/>
Expand Down

0 comments on commit 0bb9231

Please sign in to comment.