diff --git a/qubesmanager/qube_manager.py b/qubesmanager/qube_manager.py index 9cb6ef1..1a23e7f 100755 --- a/qubesmanager/qube_manager.py +++ b/qubesmanager/qube_manager.py @@ -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) diff --git a/qubesmanager/table_widgets.py b/qubesmanager/table_widgets.py index efa3fe6..1a426de 100644 --- a/qubesmanager/table_widgets.py +++ b/qubesmanager/table_widgets.py @@ -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