Fixed bug with hiding last visible column

Removed old buggy code, replaced it with disabling hiding the 'name'
column (because manager is useless without VM name).
This commit is contained in:
Marta Marczykowska-Górecka 2019-04-30 16:24:30 +02:00
parent ddb70fe8ea
commit 0bb92311ba
No known key found for this signature in database
GPG Key ID: 9A752C30B26FD04B
2 changed files with 8 additions and 24 deletions

View File

@ -604,15 +604,16 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
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",
@ -1161,22 +1162,6 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
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]

View File

@ -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"/>