@@ -100,7 +100,7 @@ def set_paths(self, filename='dummy', isscreen=False):
100100 local = []
101101 if self .IS_SCREEN :
102102 # builtin screen folder
103- default_handler_path = os .path .join (self .SCREENDIR , self .BASEPATH , handler_fn )
103+ self . _default_handler_path = os .path .join (self .SCREENDIR , self .BASEPATH , handler_fn )
104104 # relative to configuration folder
105105 local .append ( os .path .join (self .CONFIGPATH , handler_fn ))
106106 # in standard folder
@@ -113,7 +113,7 @@ def set_paths(self, filename='dummy', isscreen=False):
113113 # relative to configuration folder
114114 local .append ( os .path .join (self .WORKINGDIR , handler_fn ))
115115 # builtin panel folder
116- default_handler_path = os .path .join (self .PANELDIR , self .BASEPATH , handler_fn )
116+ self . _default_handler_path = os .path .join (self .PANELDIR , self .BASEPATH , handler_fn )
117117
118118 for local_handler_path in local :
119119 LOG .debug ("Checking for handler file in: yellow<{}>" .format (local_handler_path ))
@@ -123,9 +123,9 @@ def set_paths(self, filename='dummy', isscreen=False):
123123 break
124124 # if no break
125125 else :
126- LOG .debug ("Checking for default handler file in: yellow<{}>" .format (default_handler_path ))
127- if os .path .exists (default_handler_path ):
128- self .HANDLER = default_handler_path
126+ LOG .debug ("Checking for default handler file in: yellow<{}>" .format (self . _default_handler_path ))
127+ if os .path .exists (self . _default_handler_path ):
128+ self .HANDLER = self . _default_handler_path
129129 LOG .info ("Using DEFAULT handler file path: yellow<{}>" .format (self .HANDLER ))
130130 else :
131131 self .HANDLER = None
@@ -419,3 +419,43 @@ def find_vismach_files(self):
419419 tmp .append (file )
420420
421421 return tmp
422+
423+ def isUsingDefaultHandler (self ):
424+ return bool (self .HANDLER == self ._default_handler_path )
425+
426+ def getQSSPaths (self ):
427+ '''
428+ Search for qss files in default builtin directories,
429+ in the configuration expected directory CONFIG DIR/qtvcp/screen/SCREEN NAME, or
430+ CONFIG DIR/qtvcp/panel/PANEL NAME or finally the legacy location in the configuration directory.
431+ Returns two lists of a list of directory/filename pairs. The first list is default
432+ builtin paths, the second is local configuration paths
433+ '''
434+ local = []
435+ if self .IS_SCREEN :
436+ default = os .path .join (self .SCREENDIR , self .BASEPATH )
437+ local .append ( os .path .join (self .CONFIGPATH ))
438+ local .append ( os .path .join (self .CONFIGPATH , 'qtvcp/screens' ,self .BASEPATH ))
439+ local .append ( os .path .join (self .CONFIGPATH , self .BASEPATH ))
440+ else :
441+ local .append ( os .path .join (self .WORKINGDIR , 'qtvcp/panels' ,self .BASEPATH ))
442+ local .append ( os .path .join (self .WORKINGDIR ))
443+ default = os .path .join (self .PANELDIR , self .BASEPATH )
444+
445+ temp = []
446+ for group in ([default ],local ):
447+ child = []
448+ for qsspath in group :
449+ if not os .path .exists (qsspath ):
450+ continue
451+ try :
452+ fileNames = [f for f in os .listdir (qsspath ) if f .endswith ('.qss' )]
453+ for i in fileNames :
454+ child .append ([qsspath ,i ])
455+
456+ except Exception as e :
457+ print (e )
458+ temp .append (child )
459+
460+ return temp [0 ], temp [1 ]
461+
0 commit comments