1
0
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:
David Sangrey 2024-06-10 12:55:58 -04:00
parent b10548da57
commit c198108700
No known key found for this signature in database
GPG Key ID: 3AEADBB0186884BC
2 changed files with 22 additions and 8 deletions

View File

@ -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."""

View File

@ -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."""