Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
pur1fying committed Oct 29, 2024
2 parents 3d131e2 + 867cd50 commit f0f7558
Show file tree
Hide file tree
Showing 8 changed files with 267 additions and 232 deletions.
38 changes: 32 additions & 6 deletions gui/fragments/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@

from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QVBoxLayout
from qfluentwidgets import (ScrollArea, TitleLabel, SubtitleLabel, ListWidget, StrongBodyLabel)
from qfluentwidgets import (ScrollArea, TitleLabel, SubtitleLabel, ListWidget, StrongBodyLabel, ComboBox)

from gui.components import expand
from gui.util.style_sheet import StyleSheet
from gui.util.translator import baasTranslator as bt


lock = threading.Lock()
DISPLAY_CONFIG_PATH = './config/display.json'

Expand All @@ -23,7 +22,34 @@ def __init__(self, parent, config):
self.displayWidget = QWidget()
self.displayWidget.setFixedHeight(200)
self.settingLabel = TitleLabel(self.tr("调度状态"), self)

# Scheduler switch
self.titleLineLayout = QHBoxLayout()
_scheduler_selector = config.get('new_event_enable_state')
_scheduler_selector_layout = QHBoxLayout()
_scheduler_selector_label = SubtitleLabel(self.tr("调度功能状态"), self)
__dict__for_scheduler_selector = {
'开': 'on',
'关': 'off',
'默认': 'default',
}
__reverse_dict__for_scheduler_selector = {v: k for k, v in __dict__for_scheduler_selector.items()}
_raw_scheduler_selector = __reverse_dict__for_scheduler_selector[_scheduler_selector]
self.scheduler_selector = ComboBox(self)
self.scheduler_selector.addItems([
bt.tr('ConfigTranslation', '开'),
bt.tr('ConfigTranslation', '关'),
bt.tr('ConfigTranslation', '默认'),
])
self.scheduler_selector.setCurrentText(bt.tr('ConfigTranslation', _raw_scheduler_selector))
self.scheduler_selector.currentTextChanged.connect(
lambda x: config.set('new_event_enable_state', __dict__for_scheduler_selector[bt.undo(x)]))
_scheduler_selector_layout.addWidget(_scheduler_selector_label)
_scheduler_selector_layout.addWidget(self.scheduler_selector)

self.titleLineLayout.addWidget(self.settingLabel, 1, Qt.AlignLeft)
self.titleLineLayout.addLayout(_scheduler_selector_layout, 0)

# Process display
self.VBoxWrapperLayout = QVBoxLayout()
self.VBoxLayout = QVBoxLayout()
self.HBoxLayout = QHBoxLayout()
Expand All @@ -38,7 +64,6 @@ def __init__(self, parent, config):
self.vBox1.addWidget(self.label_running)
self.vBox1.addWidget(self.on_status)


self.vBox2 = QVBoxLayout()
self.listWidget = ListWidget(self)
self.label_queuing = SubtitleLabel(self.tr("任务队列"), self)
Expand All @@ -49,7 +74,7 @@ def __init__(self, parent, config):
self.HBoxLayout.addLayout(self.vBox1)
self.HBoxLayout.addLayout(self.vBox2)

self.VBoxLayout.addWidget(self.settingLabel)
self.VBoxLayout.addLayout(self.titleLineLayout)
self.VBoxLayout.addLayout(self.HBoxLayout)
self.displayWidget.setLayout(self.VBoxLayout)

Expand All @@ -75,7 +100,8 @@ def refresh_status(self):
print(crt_task, task_list)

crt_task = crt_task if crt_task else self.tr("暂无正在执行的任务")
task_list = [bt.tr('ConfigTranslation', task) for task in task_list] if task_list else [self.tr("暂无队列中的任务")]
task_list = [bt.tr('ConfigTranslation', task) for task in task_list] if task_list else [
self.tr("暂无队列中的任务")]
self.on_status.setText(bt.tr('ConfigTranslation', crt_task))

self.listWidget.clear()
Expand Down
Binary file modified gui/i18n/en_US.qm
Binary file not shown.
117 changes: 59 additions & 58 deletions gui/i18n/en_US.ts

Large diffs are not rendered by default.

Binary file modified gui/i18n/ja_JP.qm
Binary file not shown.
169 changes: 85 additions & 84 deletions gui/i18n/ja_JP.ts

Large diffs are not rendered by default.

Binary file modified gui/i18n/ko_KR.qm
Binary file not shown.
Loading

0 comments on commit f0f7558

Please sign in to comment.