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