mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-03 17:39:42 +02:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 43cbfe056c | |||
| 12df32f72a |
@@ -134,24 +134,6 @@ SVG_PAUSE = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect x
|
||||
SVG_FOLDER = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2 6c0-1.1.9-2 2-2h5l2 2h7c1.1 0 2 .9 2 2v10c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6z" fill="{color}"/></svg>'
|
||||
|
||||
|
||||
def _find_install_path():
|
||||
uninstall_key = r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
|
||||
for hive in (winreg.HKEY_CURRENT_USER, winreg.HKEY_LOCAL_MACHINE):
|
||||
try:
|
||||
with winreg.OpenKey(hive, uninstall_key) as key:
|
||||
for i in range(winreg.QueryInfoKey(key)[0]):
|
||||
with winreg.OpenKey(key, winreg.EnumKey(key, i)) as subkey:
|
||||
try:
|
||||
name = winreg.QueryValueEx(subkey, "DisplayName")[0]
|
||||
if "SoftwareManager" in name:
|
||||
return winreg.QueryValueEx(subkey, "InstallLocation")[0]
|
||||
except OSError:
|
||||
continue
|
||||
except OSError:
|
||||
continue
|
||||
return None
|
||||
|
||||
|
||||
def download_update(latest_version):
|
||||
import tempfile
|
||||
import time
|
||||
@@ -195,8 +177,6 @@ def download_update(latest_version):
|
||||
progress.setValue(100)
|
||||
QtWidgets.QApplication.processEvents()
|
||||
|
||||
# Launch installer and exit — the installer will close this process,
|
||||
# install the update, and relaunch the app via its [Run] section.
|
||||
subprocess.Popen([installer_path, "/VERYSILENT", "/SUPPRESSMSGBOXES", "/SP-", "/CLOSEAPPLICATIONS"])
|
||||
time.sleep(1)
|
||||
sys.exit(0)
|
||||
@@ -265,15 +245,6 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
||||
self.searchbar.setMinimumHeight(30)
|
||||
self.searchbar.returnPressed.connect(self._start_search)
|
||||
|
||||
self._spinner_label = QLabel()
|
||||
self._spinner_label.setFixedSize(20, 20)
|
||||
self._spinner_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
||||
self._spinner_label.hide()
|
||||
self._spinner_angle = 0
|
||||
self._spinner_timer = QTimer()
|
||||
self._spinner_timer.setInterval(80)
|
||||
self._spinner_timer.timeout.connect(self._update_spinner)
|
||||
|
||||
self.dlbutton = QtWidgets.QPushButton("Download")
|
||||
self.dlbutton.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||
self.libraryList = QListWidget()
|
||||
@@ -358,7 +329,6 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
||||
|
||||
search_row = QHBoxLayout()
|
||||
search_row.addWidget(self.searchbar)
|
||||
search_row.addWidget(self._spinner_label)
|
||||
containerLayout.addLayout(search_row)
|
||||
containerLayout.addWidget(state.tracker_list[state.tracker])
|
||||
|
||||
@@ -723,10 +693,6 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
||||
self.context_menu.addAction("Delete File", self.deleteFileAction)
|
||||
|
||||
def _start_search(self):
|
||||
self._spinner_label.show()
|
||||
self._spinner_angle = 0
|
||||
self._spinner_timer.start()
|
||||
self._update_spinner()
|
||||
self.searchbar.setEnabled(False)
|
||||
def _search_thread():
|
||||
try:
|
||||
@@ -736,18 +702,9 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
||||
run_thread(threading.Thread(target=_search_thread))
|
||||
|
||||
def _on_search_finished(self):
|
||||
self._spinner_timer.stop()
|
||||
self._spinner_label.hide()
|
||||
self.searchbar.setEnabled(True)
|
||||
self.searchbar.setFocus()
|
||||
|
||||
def _update_spinner(self):
|
||||
frames = ["◐", "◓", "◑", "◒"]
|
||||
idx = (self._spinner_angle // 1) % len(frames)
|
||||
self._spinner_label.setText(frames[idx])
|
||||
self._spinner_label.setStyleSheet("font-size: 16px; color: gray;")
|
||||
self._spinner_angle += 1
|
||||
|
||||
@staticmethod
|
||||
def add_log(text):
|
||||
if MainWindow._instance:
|
||||
|
||||
Reference in New Issue
Block a user