@@ -42,6 +42,7 @@ def __init__(self, halcomp, path, window, debug):
4242 self .window ['panel_' ] = self
4343 self ._screenOptions = None
4444 self ._geo_string = ''
45+ self .PATH = path
4546
4647 # see if a screenoptions widget is present
4748 # if it is then initiate the preference file
@@ -88,13 +89,20 @@ def __init__(self, halcomp, path, window, debug):
8889 pName = name .replace (' ' ,'_' )
8990 window [pName ] = window .makeMainPage (name )
9091
91- hndlr = os .path .join (path .PANELDIR , cmd , cmd + '_handler.py' )
92- if os .path .exists (hndlr ):
92+ # search for handler path and load if available
93+ hndlr = self .PATH .find_embed_handler_path (cmd )
94+ if hndlr is not True and os .path .exists (hndlr ):
9395 window [pName ].load_extension (hndlr )
9496
95- window [pName ].instance (os .path .join (path .PANELDIR , cmd , cmd + '.ui' ))
96- window [pName ].handler_instance .initialized__ ()
97+ # search for ui path and load if available
98+ uipath = self .PATH .find_embed_panel_path (cmd )
99+ window [pName ].instance (uipath )
97100
101+ # initialize handler if available
102+ if hndlr is not True and os .path .exists (hndlr ):
103+ window [pName ].handler_instance .initialized__ ()
104+
105+ # record HAL component base name because we are going to change it
98106 oldname = halcomp .comp .getprefix ()
99107 halcomp .comp .setprefix ('{}.{}' .format (oldname ,cmd ))
100108
@@ -105,6 +113,8 @@ def __init__(self, halcomp, path, window, debug):
105113 LOG .verbose ('{}: HAL-ified widget: {}' .format (name .upper (), idname ))
106114 if not isinstance (widget , ScreenOptions ):
107115 widget .hal_init ()
116+
117+ # restore HAL component name
108118 halcomp .comp .setprefix (oldname )
109119
110120 # parse for HAL objects:
0 commit comments