forked from uyitroa/osr2mp4-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdater.py
executable file
·57 lines (45 loc) · 1.41 KB
/
updater.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
50
51
52
53
54
55
56
57
import sys
import subprocess
import threading
import os
import PyQt5
from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import QLabel, QApplication, QSizePolicy, QDesktopWidget, QWidget
class Window(QWidget):
def __init__(self):
super().__init__()
self.left = 0
self.top = 0
self.width = 242
self.height = 242
self.label = QLabel(self)
self.setGeometry(self.left, self.top, self.width, self.height)
self.setFixedSize(self.width, self.height)
self.upgradelist = ["osr2mp4", "osr2mp4app"]
self.setSizePolicy(QSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored))
self.a = threading.Thread(target=self.install)
self.osrLogoUpdater()
def osrLogoUpdater(self):
pixmap = QPixmap('res/OsrUpdater.png')
self.label.setPixmap(pixmap)
self.setAttribute(PyQt5.QtCore.Qt.WA_TranslucentBackground)
self.setWindowFlags(PyQt5.QtCore.Qt.FramelessWindowHint)
self.center()
self.show()
def center(self):
qr = self.frameGeometry()
cp = QDesktopWidget().availableGeometry().center()
qr.moveCenter(cp)
self.move(qr.topLeft())
def install(self):
for i in self.upgradelist:
subprocess.call([sys.executable, "-m", "pip", "install", i, "--upgrade"])
QApplication.quit()
qtpath = os.path.dirname(PyQt5.__file__)
pluginpath = os.path.join(qtpath, "Qt/plugins")
os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = pluginpath
app = QApplication([])
window = Window()
window.a.start()
app.exec_()
window.a.join()