|
1 | 1 | # -*- coding: utf-8 -*- |
2 | 2 |
|
3 | 3 | import ast |
| 4 | +import asyncio |
4 | 5 | import concurrent.futures |
5 | 6 | import datetime |
6 | 7 | import json |
|
26 | 27 | import send2trash |
27 | 28 | from PySide6.QtCharts import (QChart, QChartView, QPieSeries, QPieSlice) |
28 | 29 | from PySide6.QtCore import (QCoreApplication, QByteArray, QMetaObject, QRect, Qt, Signal, Slot, QSize, QFile, QEvent, |
29 | | - QFileInfo, QTimer, QLocale, QTranslator, QMimeDatabase, QDate, QObject) |
| 30 | + QFileInfo, QLocale, QTranslator, QMimeDatabase, QDate, QObject) |
30 | 31 | from PySide6.QtGui import (QFont, QStandardItem, QStandardItemModel, QDesktopServices, QCursor, QPixmap, QPixmapCache, |
31 | 32 | QIcon, QImage, QGuiApplication, QColor) |
32 | 33 | from PySide6.QtWidgets import (QApplication, QCheckBox, QLabel, QListView, QLineEdit, QMainWindow, QPlainTextEdit, |
@@ -220,20 +221,22 @@ def ShowResult(): |
220 | 221 | class UpdateWidget(QObject): |
221 | 222 | TextSignal = Signal(int) |
222 | 223 | ClockSignal = Signal(int) |
| 224 | + |
223 | 225 | def __init__(self, parent=None): |
224 | 226 | super(UpdateWidget, self).__init__(parent) |
225 | | - self.UpdateTimer = QTimer() |
226 | | - self.UpdateTimer.timeout.connect(self.update) |
227 | | - self.UpdateTimer.start(800) |
228 | | - self.ClockTimer = QTimer() |
229 | | - self.ClockTimer.timeout.connect(self.clock) |
230 | | - self.ClockTimer.start(50) |
231 | | - |
232 | | - def update(self): |
233 | | - self.TextSignal.emit(1) |
234 | | - |
235 | | - def clock(self): |
236 | | - self.ClockSignal.emit(1) |
| 227 | + concurrent.futures.ThreadPoolExecutor().submit(asyncio.run, self._clock_update()) |
| 228 | + concurrent.futures.ThreadPoolExecutor().submit(asyncio.run, self._update()) |
| 229 | + |
| 230 | + async def _clock_update(self): |
| 231 | + while True: |
| 232 | + self.ClockSignal.emit(1) |
| 233 | + time.sleep(0.5) |
| 234 | + |
| 235 | + async def _update(self): |
| 236 | + while True: |
| 237 | + self.TextSignal.emit(1) |
| 238 | + time.sleep(0.8) |
| 239 | + |
237 | 240 |
|
238 | 241 | class SystemInfoWidget(QWidget): # System情報パネル |
239 | 242 | def __init__(self, parent=None): |
|
0 commit comments