Fixed errors that I introduced in last commit.
This commit is contained in:
parent
ee8e9f8f4b
commit
66901041d9
|
@ -26,11 +26,11 @@ def register_all_commands(app, commands):
|
||||||
"""
|
"""
|
||||||
Static method which register all known commands.
|
Static method which register all known commands.
|
||||||
|
|
||||||
Command should be for now in directory test_tclCommands and module should start with TCLCommand
|
Command should be for now in directory tclCommands and module should start with TCLCommand
|
||||||
Class have to follow same name as module.
|
Class have to follow same name as module.
|
||||||
|
|
||||||
we need import all modules in top section:
|
we need import all modules in top section:
|
||||||
import test_tclCommands.TclCommandExteriors
|
import tclCommands.TclCommandExteriors
|
||||||
at this stage we can include only wanted commands with this, auto loading may be implemented in future
|
at this stage we can include only wanted commands with this, auto loading may be implemented in future
|
||||||
I have no enough knowledge about python's anatomy. Would be nice to include all classes which are descendant etc.
|
I have no enough knowledge about python's anatomy. Would be nice to include all classes which are descendant etc.
|
||||||
|
|
||||||
|
@ -39,10 +39,10 @@ def register_all_commands(app, commands):
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
|
|
||||||
tcl_modules = {k: v for k, v in sys.modules.items() if k.startswith('test_tclCommands.TclCommand')}
|
tcl_modules = {k: v for k, v in sys.modules.items() if k.startswith('tclCommands.TclCommand')}
|
||||||
|
|
||||||
for key, mod in tcl_modules.items():
|
for key, mod in tcl_modules.items():
|
||||||
if key != 'test_tclCommands.TclCommand':
|
if key != 'tclCommands.TclCommand':
|
||||||
class_name = key.split('.')[1]
|
class_name = key.split('.')[1]
|
||||||
class_type = getattr(mod, class_name)
|
class_type = getattr(mod, class_name)
|
||||||
command_instance = class_type(app)
|
command_instance = class_type(app)
|
||||||
|
|
Loading…
Reference in New Issue