Optimize plugin loading
This commit is contained in:
parent
490fec0dfb
commit
40cba2bb53
|
@ -4,6 +4,7 @@
|
|||
#define MyAppName "%APPNAME%"
|
||||
#define MyAppExec "%APPEXEC%"
|
||||
#define MyAppVersion "%APPVERSION%"
|
||||
#define MyAppBuildDate "%APPBUILDDATE%"
|
||||
|
||||
[Code]
|
||||
function IsProcessRunning(ExeFileName: string): Boolean;
|
||||
|
@ -38,7 +39,7 @@ end;
|
|||
AppId={{225A7526-BAB4-4DBE-B5F6-9CE1BEACCB36}
|
||||
AppName={#MyAppName}
|
||||
AppVersion={#MyAppVersion}
|
||||
AppVerName={#MyAppName} {#MyAppVersion}
|
||||
AppVerName={#MyAppName} {#MyAppVersion} ({#MyAppBuildDate})
|
||||
VersionInfoProductName={#MyAppName}
|
||||
VersionInfoProductTextVersion={#MyAppVersion}
|
||||
VersionInfoProductVersion={#MyAppVersion}
|
||||
|
|
40
Galactic.py
40
Galactic.py
|
@ -1648,24 +1648,25 @@ class BrowserManager:
|
|||
plugin_dict[plugin_id] = plugin_class
|
||||
|
||||
def load_plugins_from_external_module(self):
|
||||
module_home = os.path.join(os.path.dirname(__file__), 'Packages')
|
||||
if (not os.path.exists(module_home)) == 1:
|
||||
return None
|
||||
try:
|
||||
plugins_classes_site = []
|
||||
module_list = glob.glob(os.path.join(module_home, 'Plugin*.py'))
|
||||
for module_path in module_list:
|
||||
try:
|
||||
print('Load plugins from \"%s\"' % (module_path,), file=sys.stderr)
|
||||
plugins_modules = import_module(module_path)
|
||||
plugins_classes = [type(name, (cls, BrowserPluginParent), {}) for name, cls in plugins_modules.__dict__.items() if
|
||||
name.startswith('BrowserPlugin') and inspect.isclass(cls)]
|
||||
plugins_classes_site.append(plugins_classes)
|
||||
except Exception as e:
|
||||
print(e, file=sys.stderr)
|
||||
self.load_plugins([element for sublist in plugins_classes_site for element in sublist], is_external=1)
|
||||
except Exception as e:
|
||||
print(e, file=sys.stderr)
|
||||
module_home_list = [os.path.join(os.path.dirname(__file__), 'Packages'), os.path.join(self.runner.app_data, 'Packages')]
|
||||
for module_home in module_home_list:
|
||||
if (not os.path.exists(module_home)) == 1:
|
||||
continue
|
||||
try:
|
||||
plugins_classes_site = []
|
||||
module_list = glob.glob(os.path.join(module_home, 'Plugin*.py'))
|
||||
for module_path in module_list:
|
||||
try:
|
||||
print('Load plugins from \"%s\"' % (module_path,), file=sys.stderr)
|
||||
plugins_modules = import_module(module_path)
|
||||
plugins_classes = [type(name, (cls, BrowserPluginParent), {}) for name, cls in plugins_modules.__dict__.items() if
|
||||
name.startswith('BrowserPlugin') and inspect.isclass(cls)]
|
||||
plugins_classes_site.append(plugins_classes)
|
||||
except Exception as e:
|
||||
print(e, file=sys.stderr)
|
||||
self.load_plugins([element for sublist in plugins_classes_site for element in sublist], is_external=1)
|
||||
except Exception as e:
|
||||
print(e, file=sys.stderr)
|
||||
|
||||
def update_geometry_config(self, screen_w: int, screen_h: int, window_w: int, window_h: int, window_x: int, window_y: int):
|
||||
self.geometry_config = {
|
||||
|
@ -2397,6 +2398,9 @@ class MainRunner:
|
|||
).replace(
|
||||
'%APPVERSION%',
|
||||
self.app_version
|
||||
).replace(
|
||||
'%APPBUILDDATE%',
|
||||
time.strftime('%Y%m%d', time.localtime())
|
||||
).replace(
|
||||
'%DISABLEX64%',
|
||||
'' if platform.architecture()[0] == '64bit' else '; '
|
||||
|
|
Loading…
Reference in New Issue