Fixes to resizing in Qube Manager

Change column resize mode to interactive and stretch last column, so there's no useless space on the right. Also minor fix to sorting last_timestamp column, for more readability and also to fix a rare bug.
This commit is contained in:
Marta Marczykowska-Górecka 2018-01-23 20:28:19 +01:00
parent 6a927271b5
commit cd8a243f5c
No known key found for this signature in database
GPG Key ID: 9A752C30B26FD04B
2 changed files with 11 additions and 6 deletions

View File

@ -291,7 +291,10 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
self.table.setColumnWidth(self.columns_indices["Backups"], 60)
self.table.setColumnWidth(self.columns_indices["Last backup"], 90)
self.table.horizontalHeader().setResizeMode(QtGui.QHeaderView.Fixed)
self.table.horizontalHeader().setResizeMode(
QtGui.QHeaderView.Interactive)
self.table.horizontalHeader().setStretchLastSection(True)
self.table.sortItems(self.columns_indices[self.sort_by_column],
self.sort_order)

View File

@ -505,7 +505,9 @@ class VmLastBackupItem(QtGui.QTableWidgetItem):
self.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.vm = vm
if getattr(self.vm, 'backup_timestamp', None):
self.backup_timestamp = getattr(self.vm, 'backup_timestamp', None)
if self.backup_timestamp:
self.setText(
str(datetime.datetime.fromtimestamp(self.vm.backup_timestamp)))
else:
@ -516,10 +518,10 @@ class VmLastBackupItem(QtGui.QTableWidgetItem):
return True
elif other.vm.qid == 0:
return False
elif self.vm.backup_timestamp == other.vm.backup_timestamp:
elif self.backup_timestamp == other.backup_timestamp:
return self.vm.name < other.vm.name
elif not self.vm.backup_timestamp:
elif not self.backup_timestamp:
return False
elif not other.vm.backup_timestamp:
elif not other.backup_timestamp:
return True
return self.vm.backup_timestamp < other.vm.backup_timestamp
return self.backup_timestamp < other.backup_timestamp