mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-13 15:57:14 +03:00
[748] Establish EDMC Shutdown Mechanism
This commit is contained in:
parent
b10548da57
commit
c198108700
@ -845,9 +845,19 @@ class AppWindow:
|
||||
)
|
||||
update_msg = update_msg.replace('\\n', '\n')
|
||||
update_msg = update_msg.replace('\\r', '\r')
|
||||
stable_popup = tk.messagebox.askyesno(title=title, message=update_msg, parent=postargs.get('Parent'))
|
||||
stable_popup = tk.messagebox.askyesno(title=title, message=update_msg)
|
||||
if stable_popup:
|
||||
webbrowser.open("https://github.com/edCD/eDMarketConnector/releases/latest")
|
||||
if postargs.get('Restart_Req'):
|
||||
restart_msg = tr.tl('A restart of EDMC is required. EDMC will now shut down.')
|
||||
restart_box = tk.messagebox.Message(
|
||||
title=tr.tl('Restart Required'),
|
||||
message=restart_msg,
|
||||
type=tk.messagebox.OK
|
||||
)
|
||||
restart_box.show()
|
||||
if restart_box:
|
||||
app.onexit()
|
||||
|
||||
def set_labels(self):
|
||||
"""Set main window labels, e.g. after language change."""
|
||||
|
18
prefs.py
18
prefs.py
@ -239,6 +239,7 @@ class PreferencesDialog(tk.Toplevel):
|
||||
|
||||
self.parent = parent
|
||||
self.callback = callback
|
||||
self.req_restart = False
|
||||
# LANG: File > Settings (macOS)
|
||||
self.title(tr.tl('Settings'))
|
||||
|
||||
@ -1274,19 +1275,22 @@ class PreferencesDialog(tk.Toplevel):
|
||||
config.set('dark_highlight', self.theme_colors[1])
|
||||
theme.apply(self.parent)
|
||||
|
||||
# Send to the Post Config if we updated the update branch
|
||||
post_flags = {
|
||||
'Update': True if self.curr_update_track != self.update_paths.get() else False,
|
||||
'Track': self.update_paths.get(),
|
||||
'Parent': self
|
||||
}
|
||||
# Notify
|
||||
if self.callback:
|
||||
self.callback(**post_flags)
|
||||
self.callback()
|
||||
|
||||
plug.notify_prefs_changed(monitor.cmdr, monitor.is_beta)
|
||||
|
||||
self._destroy()
|
||||
# Send to the Post Config if we updated the update branch or need to restart
|
||||
post_flags = {
|
||||
'Update': True if self.curr_update_track != self.update_paths.get() else False,
|
||||
'Track': self.update_paths.get(),
|
||||
'Parent': self,
|
||||
'Restart_Req': True if self.req_restart else False
|
||||
}
|
||||
if self.callback:
|
||||
self.callback(**post_flags)
|
||||
|
||||
def _destroy(self) -> None:
|
||||
"""widget.destroy wrapper that does some extra cleanup."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user