Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def start(browserpath='auto',videoplayback=True):
global enablevideoplayback
enablevideoplayback=videoplayback
try:
if browserpath == 'default':
print("Launched using default system browser")
eel.start('main.html', mode='default', size=(800, 720))
elif browserpath != 'auto' and os.path.exists(browserpath) and not browserpath.endswith('.ink'):
eel.browsers.set_path('chrome', browserpath)
About()
print("Launched using: "+browserpath)
eel.start('main.html', mode='chrome', size=(800, 720))
elif browserpath != 'auto' and browserpath.endswith('.lnk') and sys.platform in ['win32', 'win64']:
chrpath=os.path.join(ztools_dir,'chromium')
chrpath_alt=os.path.join(squirrel_dir,'chromium')
if not os.path.exists(browserpath) and os.path.exists(chrpath):
browserpath=os.path.join(chrpath,browserpath)
elif not os.path.exists(browserpath) and os.path.exists(chrpath_alt):
browserpath=os.path.join(chrpath_alt,browserpath)
elif not os.path.exists(browserpath):
print(".lnk file doesn't exist")
return False
shell = win32com.client.Dispatch("WScript.Shell")
browserpath = shell.CreateShortCut(browserpath)
browserpath=browserpath.Targetpath
eel.browsers.set_path('chrome', browserpath)
About()
print("Launched using: "+browserpath)
eel.start('main.html', mode='chrome', size=(800, 720))
elif os.path.exists(chromiumpath):
eel.browsers.set_path('chrome', chromiumpath)
About()
print("Launched using: "+chromiumpath)
eel.start('main.html', mode='chrome', size=(800, 720))
elif os.path.exists(chromiumpath_alt):
eel.browsers.set_path('chrome', chromiumpath_alt)
About()
print("Launched using: "+chromiumpath_alt)
eel.start('main.html', mode='chrome', size=(800, 720))
elif os.path.exists(slimpath):
eel.browsers.set_path('chrome', slimpath)
About()
print("Launched using: "+slimpath)
eel.start('main.html', mode='chrome', size=(800, 720))
elif os.path.exists(slimpath_alt):
eel.browsers.set_path('chrome', slimpath_alt)
About()
print("Launched using: "+slimpath_alt)
eel.start('main.html', mode='chrome', size=(800, 720))
else:
try:
About()
print("Launched using Chrome Installation")
eel.start('main.html', mode='chrome', size=(800, 720))
except EnvironmentError:
print("Chrome wasn't detected. Launched using Windows Edge with limited compatibility")
if sys.platform in ['win32', 'win64'] and int(platform.release()) >= 10:
eel.browsers.set_path('chrome', chromiumpath)
About()
print("Launched using: "+chromiumpath)
eel.start('main.html', mode='chrome', size=(800, 720))
elif os.path.exists(chromiumpath_alt):
eel.browsers.set_path('chrome', chromiumpath_alt)
About()
print("Launched using: "+chromiumpath_alt)
eel.start('main.html', mode='chrome', size=(800, 720))
elif os.path.exists(slimpath):
eel.browsers.set_path('chrome', slimpath)
About()
print("Launched using: "+slimpath)
eel.start('main.html', mode='chrome', size=(800, 720))
elif os.path.exists(slimpath_alt):
eel.browsers.set_path('chrome', slimpath_alt)
About()
print("Launched using: "+slimpath_alt)
eel.start('main.html', mode='chrome', size=(800, 720))
else:
try:
About()
print("Launched using Chrome Installation")
eel.start('main.html', mode='chrome', size=(800, 720))
except EnvironmentError:
print("Chrome wasn't detected. Launched using Windows Edge with limited compatibility")
if sys.platform in ['win32', 'win64'] and int(platform.release()) >= 10:
# print(platform.release())
eel.start('main.html', mode='edge', size=(800, 720))
else:
raise
except (SystemExit, MemoryError, KeyboardInterrupt):
if not os.path.exists(browserpath) and os.path.exists(chrpath):
browserpath=os.path.join(chrpath,browserpath)
elif not os.path.exists(browserpath) and os.path.exists(chrpath_alt):
browserpath=os.path.join(chrpath_alt,browserpath)
elif not os.path.exists(browserpath):
print(".lnk file doesn't exist")
return False
shell = win32com.client.Dispatch("WScript.Shell")
browserpath = shell.CreateShortCut(browserpath)
browserpath=browserpath.Targetpath
eel.browsers.set_path('chrome', browserpath)
About()
print("Launched using: "+browserpath)
eel.start('main.html', mode='chrome', size=(800, 720))
elif os.path.exists(chromiumpath):
eel.browsers.set_path('chrome', chromiumpath)
About()
print("Launched using: "+chromiumpath)
eel.start('main.html', mode='chrome', size=(800, 720))
elif os.path.exists(chromiumpath_alt):
eel.browsers.set_path('chrome', chromiumpath_alt)
About()
print("Launched using: "+chromiumpath_alt)
eel.start('main.html', mode='chrome', size=(800, 720))
elif os.path.exists(slimpath):
eel.browsers.set_path('chrome', slimpath)
About()
print("Launched using: "+slimpath)
eel.start('main.html', mode='chrome', size=(800, 720))
elif os.path.exists(slimpath_alt):
eel.browsers.set_path('chrome', slimpath_alt)
About()
print("Launched using: "+browserpath)
eel.start('main.html', mode='chrome', size=(800, 720))
elif browserpath != 'auto' and browserpath.endswith('.lnk') and sys.platform in ['win32', 'win64']:
chrpath=os.path.join(ztools_dir,'chromium')
chrpath_alt=os.path.join(squirrel_dir,'chromium')
if not os.path.exists(browserpath) and os.path.exists(chrpath):
browserpath=os.path.join(chrpath,browserpath)
elif not os.path.exists(browserpath) and os.path.exists(chrpath_alt):
browserpath=os.path.join(chrpath_alt,browserpath)
elif not os.path.exists(browserpath):
print(".lnk file doesn't exist")
return False
shell = win32com.client.Dispatch("WScript.Shell")
browserpath = shell.CreateShortCut(browserpath)
browserpath=browserpath.Targetpath
eel.browsers.set_path('chrome', browserpath)
About()
print("Launched using: "+browserpath)
eel.start('main.html', mode='chrome', size=(800, 720))
elif os.path.exists(chromiumpath):
eel.browsers.set_path('chrome', chromiumpath)
About()
print("Launched using: "+chromiumpath)
eel.start('main.html', mode='chrome', size=(800, 720))
elif os.path.exists(chromiumpath_alt):
eel.browsers.set_path('chrome', chromiumpath_alt)
About()
print("Launched using: "+chromiumpath_alt)
eel.start('main.html', mode='chrome', size=(800, 720))
elif os.path.exists(slimpath):
eel.browsers.set_path('chrome', slimpath)
About()