@ -76,7 +76,6 @@ class ClientItem(QtWidgets.QTreeWidgetItem):
def updateData ( self , clientDict : dict ) :
""" Arrives via parenTreeWidget api callback """
self . clientDict = clientDict
for index , key in enumerate ( self . parentController . clientsTreeWidgetColumns ) :
if clientDict [ key ] is None :
t = " "
@ -97,7 +96,7 @@ class ClientItem(QtWidgets.QTreeWidgetItem):
t = self . parentController . clientOverrideNamesCache [ clientDict [ " clientId " ] ]
logger . info ( f " Update Data: custom name for id { self . clientDict [ ' clientId ' ] } { self . clientDict [ ' reportedName ' ] } : { t } " )
else :
t = str ( value )
t = str ( value )
else :
t = str ( value )
self . setText ( index , t )
@ -109,9 +108,9 @@ class ClientItem(QtWidgets.QTreeWidgetItem):
icon = programIcons [ clientDict [ " executable " ] ]
self . setIcon ( self . parentController . clientsTreeWidgetColumns . index ( " reportedName " ) , icon ) #reported name is correct here. this is just the column.
#TODO: this should be an nsmd status. Check if excecutable exists. nsmd just reports "stopped", and worse: after a long timeout.
nameColumn = self . parentController . clientsTreeWidgetColumns . index ( " reportedName " )
nameColumn = self . parentController . clientsTreeWidgetColumns . index ( " reportedName " )
if not self . text ( nameColumn ) : #Empty string because program not found
self . setText ( nameColumn , clientDict [ " executable " ] )
self . setText ( self . parentController . clientsTreeWidgetColumns . index ( " lastStatus " ) , QtCore . QCoreApplication . translate ( " OpenSession " , " (command not found) " ) )
@ -194,11 +193,11 @@ class ClientTable(object):
def _startEditingName ( self , * args ) :
currentItem = self . clientsTreeWidget . currentItem ( )
currentItem = self . clientsTreeWidget . currentItem ( )
self . editableItem = currentItem
column = self . clientsTreeWidgetColumns . index ( " reportedName " )
self . clientsTreeWidget . editItem ( currentItem , column )
def _reactSignal_itemEditingFinished ( self , qLineEdit , returnCode ) :
""" This is a hacky signal. It arrives every change, programatically or manually.
We therefore only connect this signal right after a double click and disconnect it
@ -208,7 +207,7 @@ class ClientTable(object):
returnCode : no clue ? Integers all over the place . . .
"""
treeWidgetItem = self . editableItem
self . editableItem = None
self . editableItem = None
self . clientsTreeWidget . blockSignals ( True )
if treeWidgetItem :
#We send the signal directly. Updating is done via callback.
@ -343,16 +342,16 @@ class ClientTable(object):
#Only rename when dataclient is present
#None or dict, even empty dict
if self . clientOverrideNamesCache is None :
ui . actionClientRename . setEnabled ( False )
ui . actionClientRename . setEnabled ( False )
else :
ui . actionClientRename . setEnabled ( True )
def _reactSignal_rememberSorting ( self , * args ) :
self . sortByColumn = self . clientsTreeWidget . header ( ) . sortIndicatorSection ( )
self . sortDescending = self . clientsTreeWidget . header ( ) . sortIndicatorOrder ( )
def _reactSignal_rememberSorting ( self , * args ) :
self . sortByColumn = self . clientsTreeWidget . header ( ) . sortIndicatorSection ( )
self . sortDescending = self . clientsTreeWidget . header ( ) . sortIndicatorOrder ( )
def _reactSignal_restoreSorting ( self , * args ) :
self . clientsTreeWidget . sortByColumn ( self . sortByColumn , self . sortDescending )
def _reactSignal_restoreSorting ( self , * args ) :
self . clientsTreeWidget . sortByColumn ( self . sortByColumn , self . sortDescending )
class LauncherProgram ( QtWidgets . QTreeWidgetItem ) :
"""
@ -421,7 +420,7 @@ class LauncherTable(object):
self . launcherWidget . setHeaderLabels ( self . headerLables )
self . launcherWidget . setSortingEnabled ( True )
self . launcherWidget . setAlternatingRowColors ( True )
#The actual program entries are handled by the LauncherProgram item class
self . buildPrograms ( )
@ -449,7 +448,7 @@ class LauncherTable(object):
"""
self . launcherWidget . clear ( )
programs = api . getSystemPrograms ( )
for entry in programs :
item = LauncherProgram ( parentController = self , launcherDict = entry )
self . launcherWidget . addTopLevelItem ( item )
@ -465,15 +464,15 @@ class OpenSessionController(object):
self . clientTabe = ClientTable ( mainWindow = mainWindow , parent = self )
self . launcherTable = LauncherTable ( mainWindow = mainWindow , parent = self )
self . descriptionController = DescriptionController ( mainWindow , self . mainWindow . ui . loadedSessionDescriptionGroupBox , self . mainWindow . ui . loadedSessionDescription )
self . descriptionController = DescriptionController ( mainWindow , self . mainWindow . ui . loadedSessionDescriptionGroupBox , self . mainWindow . ui . loadedSessionDescription )
self . sessionLoadedPanel = mainWindow . ui . session_loaded #groupbox
self . sessionProgramsPanel = mainWindow . ui . session_programs #groupbox
#API Callbacks
api . callbacks . sessionOpenReady . append ( self . _reactCallback_sessionOpen )
api . callbacks . sessionOpenReady . append ( self . _reactCallback_sessionOpen )
logger . info ( " Full View Open Session Controller ready " )
def _reactCallback_sessionOpen ( self , nsmSessionExportDict : dict ) :
""" Open does not mean we come from the session chooser. Switching does not close a session """
#self.description.clear() #Deletes the placesholder and text!