Skip to content

Commit 0037d8d

Browse files
committed
qtvcp -pstat: add ability to import the default handler class for subclassing
subclassing the handler file makes customizations much easier/safer
1 parent 61b25c6 commit 0037d8d

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

lib/python/qtvcp/qt_pstat.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,3 +419,14 @@ def find_vismach_files(self):
419419
tmp.append(file)
420420

421421
return tmp
422+
423+
# tempararily adds the screen directory to path
424+
# so the handler can be imported to be used for subclassing
425+
def importDefaultHandler(self, module=None):
426+
import importlib
427+
sys.path.insert(0, self.SCREENDIR)
428+
if module is None:
429+
module = "{}.{}_handler".format(self.BASEPATH,self.BASEPATH)
430+
mod = importlib.import_module(module, self.SCREENDIR)
431+
sys.path.remove(self.SCREENDIR)
432+
return mod.HandlerClass

0 commit comments

Comments
 (0)