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:
parent
6a927271b5
commit
cd8a243f5c
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user