@ -28,6 +28,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets
#Engine
import engine . api as api
import engine . findicons as findicons
#Qt
from . descriptiontextwidget import DescriptionController
@ -65,6 +66,7 @@ class ClientItem(QtWidgets.QTreeWidgetItem):
self . setFlags ( self . defaultFlags | QtCore . Qt . ItemIsEditable ) #We have editTrigger to none so we can explicitly allow to only edit the name column on menuAction
#self.treeWidget() not ready at this point
self . updateData ( clientDict )
self . updateIcon ( clientDict )
def dataClientNameOverride ( self , name : str ) :
""" Either string or None. If None we reset to nsmd name """
@ -105,6 +107,12 @@ class ClientItem(QtWidgets.QTreeWidgetItem):
t = str ( value )
self . setText ( index , t )
nameColumn = self . parentController . clientsTreeWidgetColumns . index ( " reportedName " )
if clientDict [ " reportedName " ] is None :
self . setText ( nameColumn , clientDict [ " executable " ] )
def updateIcon ( self , clientDict : dict ) :
""" Just called during init """
programIcons = self . parentController . mainWindow . programIcons
assert programIcons
assert " executable " in clientDict , clientDict
@ -114,16 +122,17 @@ class ClientItem(QtWidgets.QTreeWidgetItem):
assert icon , icon
self . setIcon ( iconColumn , icon ) #reported name is correct here. this is just the column.
else : #Not NSM client added by the prompt widget
icon = QtGui . QIcon . fromTheme ( clientDict [ " executable " ] )
result = findicons . findIconPath ( clientDict [ " executable " ] )
if result :
icon = QtGui . QIcon . fromTheme ( str ( result [ 0 ] ) )
else :
icon = QtGui . QIcon . fromTheme ( clientDict [ " executable " ] )
if not icon . isNull ( ) :
self . setIcon ( iconColumn , icon )
else :
self . setIcon ( iconColumn , iconFromString ( clientDict [ " executable " ] ) )
nameColumn = self . parentController . clientsTreeWidgetColumns . index ( " reportedName " )
if clientDict [ " reportedName " ] is None :
self . setText ( nameColumn , clientDict [ " executable " ] )
class ClientTable ( object ) :
""" Controls the QTreeWidget that holds loaded clients """
@ -384,6 +393,11 @@ class LauncherProgram(QtWidgets.QTreeWidgetItem):
' type ' : ' Application ' ,
' version ' : ' 1.0 ' , #desktop spec version, not progra,
' x-nsm-capable ' : ' true ' }
Also :
' argodejoExec ' : the actual nsm exe
' argodejoIconPath ' : a priority path the engine found for us
"""
allItems = { } # clientId : ClientItem