Rev1817, Fix windows crash on trayicon shutdown
This commit is contained in:
parent
d3fc1cf897
commit
0a3a71f634
2 changed files with 12 additions and 9 deletions
|
@ -1,4 +1,3 @@
|
||||||
import time
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import atexit
|
import atexit
|
||||||
|
@ -12,6 +11,7 @@ allow_reload = False # No source reload supported in this plugin
|
||||||
if "_" not in locals():
|
if "_" not in locals():
|
||||||
_ = Translate("plugins/Trayicon/languages/")
|
_ = Translate("plugins/Trayicon/languages/")
|
||||||
|
|
||||||
|
|
||||||
@PluginManager.registerTo("Actions")
|
@PluginManager.registerTo("Actions")
|
||||||
class ActionsPlugin(object):
|
class ActionsPlugin(object):
|
||||||
|
|
||||||
|
@ -54,23 +54,26 @@ class ActionsPlugin(object):
|
||||||
(_["ZeroNet Github"], lambda: self.opensite("https://github.com/HelloZeroNet/ZeroNet")),
|
(_["ZeroNet Github"], lambda: self.opensite("https://github.com/HelloZeroNet/ZeroNet")),
|
||||||
(_["Report bug/request feature"], lambda: self.opensite("https://github.com/HelloZeroNet/ZeroNet/issues")),
|
(_["Report bug/request feature"], lambda: self.opensite("https://github.com/HelloZeroNet/ZeroNet/issues")),
|
||||||
"--",
|
"--",
|
||||||
(_["!Open ZeroNet"], lambda: self.opensite("http://%s:%s/%s" % (ui_ip, config.ui_port, config.homepage) )),
|
(_["!Open ZeroNet"], lambda: self.opensite("http://%s:%s/%s" % (ui_ip, config.ui_port, config.homepage))),
|
||||||
"--",
|
"--",
|
||||||
(_["Quit"], self.quit),
|
(_["Quit"], self.quit),
|
||||||
|
|
||||||
)
|
)
|
||||||
|
icon.clicked = lambda: self.opensite("http://%s:%s/%s" % (ui_ip, config.ui_port, config.homepage))
|
||||||
icon.clicked = lambda: self.opensite("http://%s:%s/%s" % (ui_ip, config.ui_port, config.homepage) )
|
self.quit_servers_event = gevent.threadpool.ThreadResult(
|
||||||
|
lambda res: gevent.spawn_later(0.1, self.quitServers)
|
||||||
|
) # Fix gevent thread switch error
|
||||||
gevent.threadpool.start_new_thread(icon._run, ()) # Start in real thread (not gevent compatible)
|
gevent.threadpool.start_new_thread(icon._run, ()) # Start in real thread (not gevent compatible)
|
||||||
super(ActionsPlugin, self).main()
|
super(ActionsPlugin, self).main()
|
||||||
icon._die = True
|
icon._die = True
|
||||||
|
|
||||||
def quit(self):
|
def quit(self):
|
||||||
self.icon.die()
|
self.icon.die()
|
||||||
time.sleep(0.1)
|
self.quit_servers_event.set(True)
|
||||||
sys.exit()
|
|
||||||
# self.main.ui_server.stop()
|
def quitServers(self):
|
||||||
# self.main.file_server.stop()
|
self.main.ui_server.stop()
|
||||||
|
self.main.file_server.stop()
|
||||||
|
|
||||||
def opensite(self, url):
|
def opensite(self, url):
|
||||||
import webbrowser
|
import webbrowser
|
||||||
|
|
|
@ -9,7 +9,7 @@ class Config(object):
|
||||||
|
|
||||||
def __init__(self, argv):
|
def __init__(self, argv):
|
||||||
self.version = "0.5.1"
|
self.version = "0.5.1"
|
||||||
self.rev = 1816
|
self.rev = 1817
|
||||||
self.argv = argv
|
self.argv = argv
|
||||||
self.action = None
|
self.action = None
|
||||||
self.config_file = "zeronet.conf"
|
self.config_file = "zeronet.conf"
|
||||||
|
|
Loading…
Reference in a new issue