|
8 | 8 | import multiprocessing.managers as m |
9 | 9 | from PyQt5.QtGui import QKeySequence, QGuiApplication |
10 | 10 | from PyQt5.QtCore import ( |
11 | | - QThread, Qt, QCoreApplication, QUrl, QRect, QTimer, |
| 11 | + QThread, Qt, QCoreApplication, QUrl, QRect, |
12 | 12 | pyqtSignal |
13 | 13 | ) |
| 14 | +from GUI.core.timer import safe_single_shot |
14 | 15 | from PyQt5.QtWidgets import QMainWindow, QCompleter, QShortcut |
15 | 16 | from qfluentwidgets import InfoBar, InfoBarPosition |
16 | 17 |
|
@@ -99,7 +100,7 @@ def setupUi(self, MainWindow): |
99 | 100 | self.task_mgr = TaskProgressManager(self) |
100 | 101 | self.task_mgr.init_native_panel() |
101 | 102 | setupTheme(self) |
102 | | - QTimer.singleShot(10, self.setupUi_) |
| 103 | + safe_single_shot(10, self.setupUi_) |
103 | 104 | self.first_init = False |
104 | 105 | else: |
105 | 106 | self.apply_translations() |
@@ -243,7 +244,7 @@ def showAggrWin(self): |
243 | 244 | self.rvBtn.click() |
244 | 245 | def _jump(): |
245 | 246 | self.toolWin.stackedWidget.setCurrentWidget(self.toolWin.asInterface) |
246 | | - QTimer.singleShot(10, _jump) |
| 247 | + safe_single_shot(10, _jump) |
247 | 248 |
|
248 | 249 | def set_tool_win(self): |
249 | 250 | self.toolWin = ToolWindow(self) |
@@ -410,6 +411,8 @@ def _show_preview(self): |
410 | 411 | self.BrowserWindow.second_init() |
411 | 412 | self.previewSecondInit = False |
412 | 413 | self.BrowserWindow.set_ensure_handler() |
| 414 | + self.pageFrame.setEnabled(True) |
| 415 | + self.pageFrame.setStyleSheet("QToolButton { background-color: rgb(255, 255, 255); }") |
413 | 416 | final_rect = self.BrowserWindow.geometry() |
414 | 417 | PopupAnimator.show(self.BrowserWindow, final_rect, duration_ms=220, direction="right") |
415 | 418 |
|
@@ -450,14 +453,14 @@ def retry_all(): |
450 | 453 | self.BrowserWindow = None |
451 | 454 | def safe_setup(): |
452 | 455 | if hasattr(self, 'p_crawler') and self.p_crawler and self.p_crawler.is_alive(): |
453 | | - QTimer.singleShot(70, safe_setup) |
| 456 | + safe_single_shot(70, safe_setup) |
454 | 457 | else: |
455 | 458 | self.Q('InputFieldQueue').clear() |
456 | 459 | self.setupUi(self) |
457 | | - QTimer.singleShot(10, safe_setup) |
| 460 | + safe_single_shot(10, safe_setup) |
458 | 461 |
|
459 | 462 | self.say(font_color(f"{self.res.reboot_tip}", cls='theme-highlight', size=4)) |
460 | | - QTimer.singleShot(50, retry_all) |
| 463 | + safe_single_shot(50, retry_all) |
461 | 464 | self.retrybtn.setDisabled(True) |
462 | 465 | self.log.info('===--→ retry_schedule end\n') |
463 | 466 |
|
|
0 commit comments