mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-19 02:17:38 +03:00
Detect plugins without Python 3.x support and warn user.
To allow users to sort out their plugins before EDMC itself moves to Python 3.x warn them if any of their enabled, non-stock, plugins do not have a plugin_start3() method. * If any are found without support there's a popup triggered at the end of AppWindow initialisation. * Then the user can check Settings > Plugins to see a list of the plugins without Python 3.x support.
This commit is contained in:
parent
2aa5154a1a
commit
d3abb6fa1f
@ -299,6 +299,13 @@ class AppWindow:
|
||||
|
||||
self.postprefs(False) # Companion login happens in callback from monitor
|
||||
|
||||
if len(plug.PLUGINS_not_py3):
|
||||
import tkMessageBox
|
||||
tkMessageBox.showinfo('Plugins Without Python 3.x Support',
|
||||
"One or more of your enabled plugins do not yet have support for Python 3.x. Please see the list on the 'Plugins' tab of 'File' > 'Settings'. You should check if there is an updated version available, else alert the developer that they will need to update the code when EDMC moves to Python 3.x"
|
||||
)
|
||||
|
||||
|
||||
# callback after the Preferences dialog is applied
|
||||
def postprefs(self, dologin=True):
|
||||
self.prefsdialog = None
|
||||
|
9
plug.py
9
plug.py
@ -65,6 +65,7 @@ GuiFocusCodex = 11
|
||||
|
||||
# List of loaded Plugins
|
||||
PLUGINS = []
|
||||
PLUGINS_not_py3 = []
|
||||
|
||||
# For asynchronous error display
|
||||
last_error = {
|
||||
@ -195,6 +196,14 @@ def load_plugins(master):
|
||||
print_exc()
|
||||
PLUGINS.extend(sorted(found, key = lambda p: operator.attrgetter('name')(p).lower()))
|
||||
|
||||
#########################################################
|
||||
# Detect plugins that aren't yet ready for Python 3.x
|
||||
#########################################################
|
||||
for p in PLUGINS:
|
||||
if p.module and p.folder and not p._get_func('plugin_start3'):
|
||||
PLUGINS_not_py3.append(p)
|
||||
#########################################################
|
||||
|
||||
imp.release_lock()
|
||||
|
||||
def provides(fn_name):
|
||||
|
12
prefs.py
12
prefs.py
@ -273,6 +273,18 @@ class PreferencesDialog(tk.Toplevel):
|
||||
label = nb.Label(plugsframe, text='%s (%s)' % (plugin.folder, plugin.name))
|
||||
label.grid(columnspan=2, padx=PADX*2, sticky=tk.W)
|
||||
|
||||
############################################################
|
||||
# Show which plugins don't have Python 3.x support
|
||||
############################################################
|
||||
if len(plug.PLUGINS_not_py3):
|
||||
ttk.Separator(plugsframe, orient=tk.HORIZONTAL).grid(columnspan=3, padx=PADX, pady=PADY * 8, sticky=tk.EW)
|
||||
nb.Label(plugsframe, text=_('Plugins Without Python 3.x Support')+':').grid(padx=PADX, sticky=tk.W) # List of plugins in settings
|
||||
for plugin in plug.PLUGINS_not_py3:
|
||||
if plugin.folder: # 'system' ones have this set to None to suppress listing in Plugins prefs tab
|
||||
nb.Label(plugsframe, text=plugin.name).grid(columnspan=2, padx=PADX*2, sticky=tk.W)
|
||||
|
||||
############################################################
|
||||
|
||||
disabled_plugins = [x for x in plug.PLUGINS if x.folder and not x.module]
|
||||
if len(disabled_plugins):
|
||||
ttk.Separator(plugsframe, orient=tk.HORIZONTAL).grid(columnspan=3, padx=PADX, pady=PADY * 8, sticky=tk.EW)
|
||||
|
Loading…
x
Reference in New Issue
Block a user