mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-14 16:27:13 +03:00
Move "plugins need migrating" popup to plug.py
Where it was in EDMarketConnector.py caused issues because then the main thread was blocking on the popup when other threads expected it to be running: --------------------------------------------------------------------- Exception in thread Journal worker: Traceback (most recent call last): File "C:\Users\Athan\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 926, in _bootstrap_inner self.run() File "C:\Users\Athan\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "C:\Users\Athan\Documents\Devel\EDMarketConnector-python3\monitor.py", line 273, in worker self.root.event_generate('<<JournalEvent>>', when="tail") File "C:\Users\Athan\AppData\Local\Programs\Python\Python37-32\lib\tkinter\__init__.py", line 1673, in event_generate self.tk.call(args) RuntimeError: main thread is not in main loop --------------------------------------------------------------------- However *now* it pops up before the main UI is running properly at all, so the EDMC window is likely out of position, and won't be painted/themed yet. This is deemed acceptable for a 'once a day at most' popup. The popup title now has 'EDMC: ' at the start to be sure users know what it's talking about. It also has some brief advice about how to disable a plugin.
This commit is contained in:
parent
3178ad1b6f
commit
558392d21b
@ -300,14 +300,6 @@ class AppWindow(object):
|
||||
|
||||
self.postprefs(False) # Companion login happens in callback from monitor
|
||||
|
||||
plugins_not_py3_last = config.getint('plugins_not_py3_last') or int(time())
|
||||
if (plugins_not_py3_last + 86400) < int(time()) and 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 need to update the code for Python 3.x"
|
||||
)
|
||||
config.set('plugins_not_py3_last', int(time()))
|
||||
|
||||
|
||||
# callback after the Preferences dialog is applied
|
||||
def postprefs(self, dologin=True):
|
||||
@ -822,4 +814,12 @@ if __name__ == "__main__":
|
||||
|
||||
root = tk.Tk(className=appname.lower())
|
||||
app = AppWindow(root)
|
||||
|
||||
plugins_not_py3_last = config.getint('plugins_not_py3_last') or 0
|
||||
if (plugins_not_py3_last + 86400) < int(time()) and len(plug.PLUGINS_not_py3):
|
||||
tkinter.messagebox.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 need to update the code for Python 3.x\r\n\r\nYou can disable a plugin by renaming its folder to have '.disabled' on the end of the name."
|
||||
)
|
||||
config.set('plugins_not_py3_last', int(time()))
|
||||
|
||||
root.mainloop()
|
||||
|
15
plug.py
15
plug.py
@ -14,6 +14,7 @@ import tkinter as tk
|
||||
import myNotebook as nb
|
||||
|
||||
from config import config
|
||||
from time import time as time
|
||||
|
||||
|
||||
# Dashboard Flags constants
|
||||
@ -100,6 +101,7 @@ class Plugin(object):
|
||||
self.module = module
|
||||
elif getattr(module, 'plugin_start', None):
|
||||
sys.stdout.write('plugin %s needs migrating\n' % name)
|
||||
PLUGINS_not_py3.append(self)
|
||||
else:
|
||||
sys.stdout.write('plugin %s has no plugin_start3() function\n' % name)
|
||||
except:
|
||||
@ -197,13 +199,12 @@ def load_plugins(master):
|
||||
pass
|
||||
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)
|
||||
#########################################################
|
||||
plugins_not_py3_last = config.getint('plugins_not_py3_last') or 0
|
||||
if (plugins_not_py3_last + 86400) < int(time()) and len(PLUGINS_not_py3):
|
||||
tk.messagebox.showinfo('EDMC: 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 need to update the code for Python 3.x\r\n\r\nYou can disable a plugin by renaming its folder to have '.disabled' on the end of the name."
|
||||
)
|
||||
config.set('plugins_not_py3_last', int(time()))
|
||||
|
||||
def provides(fn_name):
|
||||
"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user