1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-18 09:57:40 +03:00

Added a config to use the new file based shipyard

This also reverts commenting out the old solution for long URLs
This commit is contained in:
A_D 2020-07-23 13:27:38 +02:00 committed by Athanasius
parent b818922193
commit 99014dd970
2 changed files with 33 additions and 29 deletions

View File

@ -671,6 +671,10 @@ class AppWindow(object):
hotkeymgr.play_bad() hotkeymgr.play_bad()
def shipyard_url(self, shipname): def shipyard_url(self, shipname):
if not bool(config.getint("use_alt_shipyard_open")):
return plug.invoke(config.get('shipyard_provider'), 'EDSY', 'shipyard_url', monitor.ship(), monitor.is_beta)
# Avoid file length limits if possible
provider = config.get('shipyard_provider') or 'EDSY' provider = config.get('shipyard_provider') or 'EDSY'
target = plug.invoke(config.get('shipyard_provider'), 'EDSY', 'shipyard_url', monitor.ship(), monitor.is_beta) target = plug.invoke(config.get('shipyard_provider'), 'EDSY', 'shipyard_url', monitor.ship(), monitor.is_beta)
file_name = join(config.app_dir, "last_shipyard.html") file_name = join(config.app_dir, "last_shipyard.html")

View File

@ -112,36 +112,36 @@ class HyperlinkLabel(platform == 'darwin' and tk.Label or ttk.Label, object):
def openurl(url): def openurl(url):
# if platform == 'win32': if platform == 'win32':
# # On Windows webbrowser.open calls os.startfile which calls ShellExecute which can't handle long arguments, # On Windows webbrowser.open calls os.startfile which calls ShellExecute which can't handle long arguments,
# # so discover and launch the browser directly. # so discover and launch the browser directly.
# # https://blogs.msdn.microsoft.com/oldnewthing/20031210-00/?p=41553 # https://blogs.msdn.microsoft.com/oldnewthing/20031210-00/?p=41553
# try: try:
# hkey = OpenKeyEx(HKEY_CURRENT_USER, r'Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice') hkey = OpenKeyEx(HKEY_CURRENT_USER, r'Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice')
# (value, typ) = QueryValueEx(hkey, 'ProgId') (value, typ) = QueryValueEx(hkey, 'ProgId')
# CloseKey(hkey) CloseKey(hkey)
# if value in ['IE.HTTP', 'AppXq0fevzme2pys62n3e0fbqa7peapykr8v']: if value in ['IE.HTTP', 'AppXq0fevzme2pys62n3e0fbqa7peapykr8v']:
# # IE and Edge can't handle long arguments so just use webbrowser.open and hope # IE and Edge can't handle long arguments so just use webbrowser.open and hope
# # https://blogs.msdn.microsoft.com/ieinternals/2014/08/13/url-length-limits/ # https://blogs.msdn.microsoft.com/ieinternals/2014/08/13/url-length-limits/
# cls = None cls = None
# else: else:
# cls = value cls = value
# except: except:
# cls = 'https' cls = 'https'
# if cls: if cls:
# try: try:
# hkey = OpenKeyEx(HKEY_CLASSES_ROOT, r'%s\shell\open\command' % cls) hkey = OpenKeyEx(HKEY_CLASSES_ROOT, r'%s\shell\open\command' % cls)
# (value, typ) = QueryValueEx(hkey, None) (value, typ) = QueryValueEx(hkey, None)
# CloseKey(hkey) CloseKey(hkey)
# if 'iexplore' not in value.lower(): if 'iexplore' not in value.lower():
# if '%1' in value: if '%1' in value:
# subprocess.Popen(buf.value.replace('%1', url)) subprocess.Popen(buf.value.replace('%1', url))
# else: else:
# subprocess.Popen('%s "%s"' % (buf.value, url)) subprocess.Popen('%s "%s"' % (buf.value, url))
# return return
# except: except:
# pass pass
webbrowser.open(url) webbrowser.open(url)