mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-13 15:57:14 +03:00
plugin_app() can return None
so it can be used as a callback after the main window and all other plugins are initialised.
This commit is contained in:
parent
b45d745ff1
commit
f42d5d7af6
@ -85,9 +85,9 @@ def prefs_changed(cmdr, is_beta):
|
||||
|
||||
## Display
|
||||
|
||||
You can also have your plugin add an item to the EDMC main window and update it if you need to from your event hooks. This works in the same way as `plugin_prefs()`. For a simple one-line item return a tk.Label widget or a pair of widgets as a tuple. For a more complicated item create a tk.Frame widget and populate it with other ttk widgets.
|
||||
You can also have your plugin add an item to the EDMC main window and update from your event hooks. This works in the same way as `plugin_prefs()`. For a simple one-line item return a tk.Label widget or a pair of widgets as a tuple. For a more complicated item create a tk.Frame widget and populate it with other ttk widgets. Return `None` if you just want to use this as a callback after the main window and all other plugins are initialised.
|
||||
|
||||
You can use `stringFromNumber()` from EDMC's `l10n.Locale` object to format numbers in a locale-independent way.
|
||||
You can use `stringFromNumber()` from EDMC's `l10n.Locale` object to format numbers in your widgets in a locale-independent way.
|
||||
|
||||
```python
|
||||
this = sys.modules[__name__] # For holding module globals
|
||||
|
7
plug.py
7
plug.py
@ -107,12 +107,15 @@ class Plugin(object):
|
||||
if plugin_app:
|
||||
try:
|
||||
appitem = plugin_app(parent)
|
||||
if isinstance(appitem, tuple):
|
||||
if appitem is None:
|
||||
return None
|
||||
elif isinstance(appitem, tuple):
|
||||
if len(appitem) != 2 or not isinstance(appitem[0], tk.Widget) or not isinstance(appitem[1], tk.Widget):
|
||||
raise AssertionError
|
||||
elif not isinstance(appitem, tk.Widget):
|
||||
raise AssertionError
|
||||
return appitem
|
||||
else:
|
||||
return appitem
|
||||
except:
|
||||
print_exc()
|
||||
return None
|
||||
|
Loading…
x
Reference in New Issue
Block a user