@ -142,8 +142,8 @@ class ClientTable(object):
self . clientOverrideNamesCache = None #None or dict. Dict is never truly empty, it has at least empty categories.
self . sortByColumn = 0 #by name
self . sortAscending = 0 # Qt::SortOrder which is 0 for ascending and 1 for descending
self . sortByColumnValue = 0 #by name
self . sortDescendingValue = 0 # Qt::SortOrder which is 0 for ascending and 1 for descending
self . clientsTreeWidget = self . mainWindow . ui . loadedSessionClients
self . clientsTreeWidget . setContextMenuPolicy ( QtCore . Qt . CustomContextMenu )
@ -172,7 +172,7 @@ class ClientTable(object):
self . clientsTreeWidget . itemDoubleClicked . connect ( self . _reactSignal_itemDoubleClicked ) #This is hide/show and NOT edit
self . clientsTreeWidget . itemDelegate ( ) . closeEditor . connect ( self . _reactSignal_itemEditingFinished )
self . clientsTreeWidget . model ( ) . layoutAboutToBeChanged . connect ( self . _reactSignal_rememberSorting )
self . clientsTreeWidget . model ( ) . layoutChanged . connect ( self . _reactSignal_restoreSorting )
#self.clientsTreeWidget.model().layoutChanged.connect(self._reactSignal_restoreSorting )
#Convenience Signals to directly disable the client messages on gui instruction.
#This is purely for speed and preventing the user from sending a signal while the session is shutting down
self . mainWindow . ui . actionSessionAbort . triggered . connect ( lambda : self . _updateClientMenu ( deactivate = True ) )
@ -186,7 +186,7 @@ class ClientTable(object):
api . callbacks . dataClientNamesChanged . append ( self . _reactCallback_dataClientNamesChanged )
def _adjustColumnSize ( self ) :
self . clientsTreeWidget . sortByColumn ( self . sortByColumn , self . sortAscending )
self . clientsTreeWidget . sortItems ( self . sortByColumnValue , self . sortDescendingValue )
for index in range ( self . clientsTreeWidget . columnCount ( ) ) :
self . clientsTreeWidget . resizeColumnToContents ( index )
@ -373,11 +373,13 @@ class ClientTable(object):
ui . actionClientRename . setEnabled ( True )
def _reactSignal_rememberSorting ( self , * args ) :
self . sortByColumn = self . clientsTreeWidget . header ( ) . sortIndicatorSection ( )
self . sortDescending = self . clientsTreeWidget . header ( ) . sortIndicatorOrder ( )
self . sortByColumnValue = self . clientsTreeWidget . header ( ) . sortIndicatorSection ( )
self . sortDescendingValue = self . clientsTreeWidget . header ( ) . sortIndicatorOrder ( )
def _reactSignal_restoreSorting ( self , * args ) :
self . clientsTreeWidget . sortByColumn ( self . sortByColumn , self . sortDescending )
""" Do not use as signal!!! Will lead to infinite recursion since Qt 5.12.2 """
#self.clientsTreeWidget.sortItems(self.sortByColumnValue, self.sortDescendingValue)
raise RuntimeError ( )
class LauncherProgram ( QtWidgets . QTreeWidgetItem ) :
"""
@ -441,8 +443,8 @@ class LauncherTable(object):
self . mainWindow = mainWindow
self . parent = parent
self . sortByColumn = 0 # by name
self . sortAscending = 0 # Qt::SortOrder which is 0 for ascending and 1 for descending
self . sortByColumnValue = 0 # by name
self . sortDescendingValue = 0 # Qt::SortOrder which is 0 for ascending and 1 for descending
self . launcherWidget = self . mainWindow . ui . loadedSessionsLauncher
self . launcherWidget . setIconSize ( iconSize )
@ -467,7 +469,7 @@ class LauncherTable(object):
def _adjustColumnSize ( self ) :
self . launcherWidget . sortByColumn ( self . sortByColumn , self . sortAscending )
self . launcherWidget . sortItems ( self . sortByColumnValue , self . sortDescendingValue )
for index in range ( self . launcherWidget . columnCount ( ) ) :
self . launcherWidget . resizeColumnToContents ( index )