-
Notifications
You must be signed in to change notification settings - Fork 0
/
musync.py
49 lines (37 loc) · 1.69 KB
/
musync.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from PySide2.QtWidgets import QApplication, QMessageBox
from PySide2.QtGui import QDesktopServices
from PySide2.QtCore import QUrl, QCoreApplication
from os import environ, pathsep
import sys
import gui
from selenium import webdriver
from selenium.common.exceptions import WebDriverException
app = QApplication(sys.argv)
QCoreApplication.setOrganizationName("muSync")
QCoreApplication.setOrganizationDomain("musync.link")
QCoreApplication.setApplicationName("muSync")
QCoreApplication.setApplicationVersion("0.5.0")
try:
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("headless")
chrometest = webdriver.Chrome(executable_path="chromedriver", options=chrome_options)
chrometest.quit()
except WebDriverException as e:
if "executable needs to be in PATH" in e.msg:
d = QMessageBox(QMessageBox.Critical, "Chromedriver not found",
"""Chromedriver was not found in the path.
Please download Chromedriver from the following address and unzip it in any directory in the system PATH:
https://sites.google.com/a/chromium.org/chromedriver/downloads
Do you want to open this address in your browser?
Current PATH:
{}""".format(environ["PATH"].replace(pathsep, "\n")),
QMessageBox.Yes | QMessageBox.No)
if d.exec() == QMessageBox.Yes:
QDesktopServices.openUrl(QUrl("https://sites.google.com/a/chromium.org/chromedriver/downloads", QUrl.StrictMode))
d = QMessageBox(QMessageBox.Information, "Chromedriver not found",
"Please restart this application after downloading Chromedriver",
QMessageBox.Ok)
d.exec()
sys.exit(1)
mainWindow = gui.MainWindow()
sys.exit(app.exec_())