mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-17 17:42:20 +03:00
[#519] Framework Beta Update Track
This commit is contained in:
parent
4a1a107e03
commit
b6e373decd
@ -829,7 +829,7 @@ class AppWindow:
|
|||||||
self.suit.grid_forget()
|
self.suit.grid_forget()
|
||||||
self.suit_shown = False
|
self.suit_shown = False
|
||||||
|
|
||||||
def postprefs(self, dologin: bool = True):
|
def postprefs(self, dologin: bool = True, **postargs):
|
||||||
"""Perform necessary actions after the Preferences dialog is applied."""
|
"""Perform necessary actions after the Preferences dialog is applied."""
|
||||||
self.prefsdialog = None
|
self.prefsdialog = None
|
||||||
self.set_labels() # in case language has changed
|
self.set_labels() # in case language has changed
|
||||||
@ -853,6 +853,11 @@ class AppWindow:
|
|||||||
if dologin and monitor.cmdr:
|
if dologin and monitor.cmdr:
|
||||||
self.login() # Login if not already logged in with this Cmdr
|
self.login() # Login if not already logged in with this Cmdr
|
||||||
|
|
||||||
|
if postargs.get('Update') and postargs.get('Track'):
|
||||||
|
# LANG: Inform the user the Update Track has changed
|
||||||
|
self.status['text'] = tr.tl('Update Track Changed to {TRACK}').format(TRACK=postargs.get('Track'))
|
||||||
|
self.updater.check_for_updates()
|
||||||
|
|
||||||
def set_labels(self):
|
def set_labels(self):
|
||||||
"""Set main window labels, e.g. after language change."""
|
"""Set main window labels, e.g. after language change."""
|
||||||
self.cmdr_label['text'] = tr.tl('Cmdr') + ':' # LANG: Label for commander name in main window
|
self.cmdr_label['text'] = tr.tl('Cmdr') + ':' # LANG: Label for commander name in main window
|
||||||
|
@ -17,7 +17,6 @@ __all__ = [
|
|||||||
'applongname',
|
'applongname',
|
||||||
'appcmdname',
|
'appcmdname',
|
||||||
'copyright',
|
'copyright',
|
||||||
'update_feed',
|
|
||||||
'update_interval',
|
'update_interval',
|
||||||
'debug_senders',
|
'debug_senders',
|
||||||
'trace_on',
|
'trace_on',
|
||||||
@ -29,7 +28,9 @@ __all__ = [
|
|||||||
'user_agent',
|
'user_agent',
|
||||||
'appversion_nobuild',
|
'appversion_nobuild',
|
||||||
'AbstractConfig',
|
'AbstractConfig',
|
||||||
'config'
|
'config',
|
||||||
|
'get_update_feed',
|
||||||
|
'update_feed'
|
||||||
]
|
]
|
||||||
|
|
||||||
import abc
|
import abc
|
||||||
@ -58,7 +59,7 @@ _static_appversion = '5.10.4'
|
|||||||
_cached_version: semantic_version.Version | None = None
|
_cached_version: semantic_version.Version | None = None
|
||||||
copyright = '© 2015-2019 Jonathan Harris, 2020-2024 EDCD'
|
copyright = '© 2015-2019 Jonathan Harris, 2020-2024 EDCD'
|
||||||
|
|
||||||
update_feed = 'https://raw.githubusercontent.com/EDCD/EDMarketConnector/releases/edmarketconnector.xml'
|
|
||||||
update_interval = 8*60*60 # 8 Hours
|
update_interval = 8*60*60 # 8 Hours
|
||||||
# Providers marked to be in debug mode. Generally this is expected to switch to sending data to a log file
|
# Providers marked to be in debug mode. Generally this is expected to switch to sending data to a log file
|
||||||
debug_senders: list[str] = []
|
debug_senders: list[str] = []
|
||||||
@ -479,3 +480,17 @@ def get_config(*args, **kwargs) -> AbstractConfig:
|
|||||||
|
|
||||||
|
|
||||||
config = get_config()
|
config = get_config()
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: Set Proper Beta XML, Bring XML from Releases to Live, Translations, wiki on Updates (WILL NOT DOWNGRADE), link in label
|
||||||
|
def get_update_feed() -> str:
|
||||||
|
"""Select the proper update feed for the current update track."""
|
||||||
|
if config.get_bool('beta_optin'):
|
||||||
|
print("Checking Using Beta")
|
||||||
|
return 'https://raw.githubusercontent.com/EDCD/EDMarketConnector/releases/edmarketconnector.xml'
|
||||||
|
print("Checking Live")
|
||||||
|
return 'https://raw.githubusercontent.com/EDCD/EDMarketConnector/releases/edmarketconnector.xml'
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: Add Dep Warning
|
||||||
|
update_feed = get_update_feed()
|
||||||
|
30
prefs.py
30
prefs.py
@ -494,10 +494,29 @@ class PreferencesDialog(tk.Toplevel):
|
|||||||
|
|
||||||
self.hotkey_play_btn.grid(columnspan=4, padx=self.BUTTONX, pady=self.PADY, sticky=tk.W, row=row.get())
|
self.hotkey_play_btn.grid(columnspan=4, padx=self.BUTTONX, pady=self.PADY, sticky=tk.W, row=row.get())
|
||||||
|
|
||||||
# Option to disabled Automatic Check For Updates whilst in-game
|
# Options to select the Update Path and Disable Automatic Checks For Updates whilst in-game
|
||||||
ttk.Separator(config_frame, orient=tk.HORIZONTAL).grid(
|
ttk.Separator(config_frame, orient=tk.HORIZONTAL).grid(
|
||||||
columnspan=4, padx=self.PADX, pady=self.SEPY, sticky=tk.EW, row=row.get()
|
columnspan=4, padx=self.PADX, pady=self.SEPY, sticky=tk.EW, row=row.get()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
with row as curr_row:
|
||||||
|
nb.Label(config_frame, text=tr.tl('Update Track')).grid( # LANG: Select the Update Track (Beta, Stable)
|
||||||
|
padx=self.PADX, pady=self.PADY, sticky=tk.W, row=curr_row
|
||||||
|
)
|
||||||
|
self.curr_update_track = "Beta" if config.get_bool('beta_optin') else "Stable"
|
||||||
|
self.update_paths = tk.StringVar(value=self.curr_update_track)
|
||||||
|
# TODO: LANG
|
||||||
|
update_paths = [
|
||||||
|
tr.tl("Stable"), # LANG: Stable Version of EDMC
|
||||||
|
tr.tl("Beta") # LANG: Beta Version of EDMC
|
||||||
|
]
|
||||||
|
self.update_track = nb.OptionMenu(
|
||||||
|
config_frame, self.update_paths, self.update_paths.get(), *update_paths
|
||||||
|
)
|
||||||
|
|
||||||
|
self.update_track.configure(width=15)
|
||||||
|
self.update_track.grid(column=1, pady=self.BOXY, sticky=tk.W, row=curr_row)
|
||||||
|
|
||||||
self.disable_autoappupdatecheckingame = tk.IntVar(value=config.get_int('disable_autoappupdatecheckingame'))
|
self.disable_autoappupdatecheckingame = tk.IntVar(value=config.get_int('disable_autoappupdatecheckingame'))
|
||||||
self.disable_autoappupdatecheckingame_btn = nb.Checkbutton(
|
self.disable_autoappupdatecheckingame_btn = nb.Checkbutton(
|
||||||
config_frame,
|
config_frame,
|
||||||
@ -1196,7 +1215,7 @@ class PreferencesDialog(tk.Toplevel):
|
|||||||
config.set('hotkey_mods', self.hotkey_mods)
|
config.set('hotkey_mods', self.hotkey_mods)
|
||||||
config.set('hotkey_always', int(not self.hotkey_only.get()))
|
config.set('hotkey_always', int(not self.hotkey_only.get()))
|
||||||
config.set('hotkey_mute', int(not self.hotkey_play.get()))
|
config.set('hotkey_mute', int(not self.hotkey_play.get()))
|
||||||
|
config.set('beta_optin', 0 if self.update_paths.get() == "Stable" else 1)
|
||||||
config.set('shipyard_provider', self.shipyard_provider.get())
|
config.set('shipyard_provider', self.shipyard_provider.get())
|
||||||
config.set('system_provider', self.system_provider.get())
|
config.set('system_provider', self.system_provider.get())
|
||||||
config.set('station_provider', self.station_provider.get())
|
config.set('station_provider', self.station_provider.get())
|
||||||
@ -1220,9 +1239,14 @@ class PreferencesDialog(tk.Toplevel):
|
|||||||
config.set('dark_highlight', self.theme_colors[1])
|
config.set('dark_highlight', self.theme_colors[1])
|
||||||
theme.apply(self.parent)
|
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()
|
||||||
|
}
|
||||||
# Notify
|
# Notify
|
||||||
if self.callback:
|
if self.callback:
|
||||||
self.callback()
|
self.callback(**post_flags)
|
||||||
|
|
||||||
plug.notify_prefs_changed(monitor.cmdr, monitor.is_beta)
|
plug.notify_prefs_changed(monitor.cmdr, monitor.is_beta)
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ from typing import TYPE_CHECKING
|
|||||||
from xml.etree import ElementTree
|
from xml.etree import ElementTree
|
||||||
import requests
|
import requests
|
||||||
import semantic_version
|
import semantic_version
|
||||||
from config import appname, appversion_nobuild, config, update_feed
|
from config import appname, appversion_nobuild, config, get_update_feed
|
||||||
from EDMCLogging import get_main_logger
|
from EDMCLogging import get_main_logger
|
||||||
from l10n import translations as tr
|
from l10n import translations as tr
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ class Updater:
|
|||||||
self.updater: ctypes.CDLL | None = ctypes.cdll.WinSparkle
|
self.updater: ctypes.CDLL | None = ctypes.cdll.WinSparkle
|
||||||
|
|
||||||
# Set the appcast URL
|
# Set the appcast URL
|
||||||
self.updater.win_sparkle_set_appcast_url(update_feed.encode())
|
self.updater.win_sparkle_set_appcast_url(get_update_feed().encode())
|
||||||
|
|
||||||
# Set the appversion *without* build metadata, as WinSparkle
|
# Set the appversion *without* build metadata, as WinSparkle
|
||||||
# doesn't do proper Semantic Version checks.
|
# doesn't do proper Semantic Version checks.
|
||||||
@ -146,7 +146,7 @@ class Updater:
|
|||||||
newversion = None
|
newversion = None
|
||||||
items = {}
|
items = {}
|
||||||
try:
|
try:
|
||||||
request = requests.get(update_feed, timeout=10)
|
request = requests.get(get_update_feed(), timeout=10)
|
||||||
|
|
||||||
except requests.RequestException as ex:
|
except requests.RequestException as ex:
|
||||||
logger.exception(f'Error retrieving update_feed file: {ex}')
|
logger.exception(f'Error retrieving update_feed file: {ex}')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user