Skip to content

Commit fb35cdf

Browse files
committed
Fix Remaining Linter Warnings
1 parent 3fa24ce commit fb35cdf

File tree

2 files changed

+71
-54
lines changed

2 files changed

+71
-54
lines changed

launch.pyw

+46-36
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,61 @@
11
#! /usr/bin/python3
22

33
from UI import launch_dialog
4-
import sys, ctypes
4+
import sys
5+
import ctypes
56
from PyQt5 import QtCore, QtGui
67
from PyQt5.QtWidgets import QDialog, QApplication
78

8-
myappid = 'VodBox.pyWinContext.1.0' # arbitrary string
9+
myappid = 'VodBox.pyWinContext.1.0'
910
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
1011

1112
if not hasattr(sys, "_MEIPASS"):
12-
sys._MEIPASS = "."
13+
sys._MEIPASS = "."
14+
1315

1416
class LaunchDialog(QDialog, launch_dialog.Ui_Dialog):
15-
def __init__(self):
16-
super(self.__class__, self).__init__()
17-
self.setupUi(self)
18-
import wincontext
19-
self.win = wincontext.WinContextApp(False)
20-
self.win.hide()
21-
self.initUI()
22-
23-
def initUI(self):
24-
app_icon = QtGui.QIcon()
25-
app_icon.addFile(sys._MEIPASS+ '/' + 'images/icon_16.png', QtCore.QSize(16,16))
26-
app_icon.addFile(sys._MEIPASS+ '/' + 'images/icon_24.png', QtCore.QSize(24,24))
27-
app_icon.addFile(sys._MEIPASS+ '/' + 'images/icon_32.png', QtCore.QSize(32,32))
28-
app_icon.addFile(sys._MEIPASS+ '/' + 'images/icon_48.png', QtCore.QSize(48,48))
29-
app_icon.addFile(sys._MEIPASS+ '/' + 'images/icon.png', QtCore.QSize(256,256))
30-
self.setWindowIcon(app_icon)
31-
self.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.CustomizeWindowHint | QtCore.Qt.WindowTitleHint);
32-
self.pushButton.clicked.connect(self.launch)
33-
34-
def launch(self):
35-
if self.radioButton.isChecked():
36-
self.hide()
37-
self.win.show()
38-
else:
39-
self.hide()
40-
self.win.show()
41-
self.win.direct = True
42-
17+
def __init__(self):
18+
super(self.__class__, self).__init__()
19+
self.setupUi(self)
20+
import wincontext
21+
self.win = wincontext.WinContextApp(False)
22+
self.win.hide()
23+
self.initUI()
24+
25+
def initUI(self):
26+
app_icon = QtGui.QIcon()
27+
app_icon.addFile(
28+
sys._MEIPASS + '/' + 'images/icon_16.png', QtCore.QSize(16, 16))
29+
app_icon.addFile(
30+
sys._MEIPASS + '/' + 'images/icon_24.png', QtCore.QSize(24, 24))
31+
app_icon.addFile(
32+
sys._MEIPASS + '/' + 'images/icon_32.png', QtCore.QSize(32, 32))
33+
app_icon.addFile(
34+
sys._MEIPASS + '/' + 'images/icon_48.png', QtCore.QSize(48, 48))
35+
app_icon.addFile(
36+
sys._MEIPASS + '/' + 'images/icon.png', QtCore.QSize(256, 256))
37+
self.setWindowIcon(app_icon)
38+
self.setWindowFlags(
39+
QtCore.Qt.Dialog | QtCore.Qt.CustomizeWindowHint
40+
| QtCore.Qt.WindowTitleHint)
41+
self.pushButton.clicked.connect(self.launch)
42+
43+
def launch(self):
44+
if self.radioButton.isChecked():
45+
self.hide()
46+
self.win.show()
47+
else:
48+
self.hide()
49+
self.win.show()
50+
self.win.direct = True
51+
52+
4353
def main():
44-
app = QApplication(sys.argv)
45-
ui = LaunchDialog()
46-
ui.show()
47-
app.exec_()
54+
app = QApplication(sys.argv)
55+
ui = LaunchDialog()
56+
ui.show()
57+
app.exec_()
4858

4959

5060
if __name__ == '__main__':
51-
main()
61+
main()

uac_wrapper.pyw

+25-18
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,34 @@
11
#! /usr/bin/python3
22

3-
import ctypes, sys, time
3+
import ctypes
4+
import sys
5+
46

57
def is_admin():
6-
try:
7-
return ctypes.windll.shell32.IsUserAnAdmin()
8-
except:
9-
return False
8+
try:
9+
return ctypes.windll.shell32.IsUserAnAdmin()
10+
except:
11+
return False
12+
1013

1114
def run():
12-
if is_admin():
13-
return True
14-
else:
15-
ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, ' '.join(sys.argv[1:]), None, 1)
16-
sys.exit()
17-
15+
if is_admin():
16+
return True
17+
else:
18+
ctypes.windll.shell32.ShellExecuteW(
19+
None, "runas", sys.executable, ' '.join(sys.argv[1:]), None, 1)
20+
sys.exit()
21+
22+
1823
def run_as_admin(file):
19-
ctypes.windll.shell32.ShellExecuteW(None, "open", file, "", None, 1)
20-
24+
ctypes.windll.shell32.ShellExecuteW(None, "open", file, "", None, 1)
25+
26+
2127
def main():
22-
run()
23-
import launch
24-
win = launch.main()
25-
28+
run()
29+
import launch
30+
launch.main()
31+
32+
2633
if __name__ == '__main__':
27-
main()
34+
main()

0 commit comments

Comments
 (0)