|
12 | 12 | import os
|
13 | 13 | import webbrowser
|
14 | 14 |
|
15 |
| -from PyQt5.QtCore import pyqtSlot, QUrl |
| 15 | +from PyQt5.QtCore import pyqtSlot, QUrl, QLocale, QTranslator |
16 | 16 | from PyQt5.QtGui import QColor
|
17 | 17 | from PyQt5.QtWebKit import QWebSettings
|
18 | 18 | from PyQt5.QtWebKitWidgets import QWebPage
|
| 19 | +from PyQt5.QtWidgets import QApplication |
19 | 20 |
|
20 | 21 | from Utils import Constants
|
21 | 22 | from Utils.CommonUtil import Signals, Setting, AppLog
|
@@ -43,7 +44,7 @@ def _initUi(self):
|
43 | 44 | ThemeManager.loadCursor(self.widgetMain)
|
44 | 45 | ThemeManager.setPointerCursors([
|
45 | 46 | self.buttonHead, # 主界面头像
|
46 |
| - self.buttonSearch, # 主界面搜索按钮 |
| 47 | + self.buttonClear, # 主界面清空按钮 |
47 | 48 | self.buttonGithub, # Github按钮
|
48 | 49 | self.buttonQQ, # QQ按钮
|
49 | 50 | self.buttonGroup, # 群按钮
|
@@ -89,6 +90,15 @@ def _initSignals(self):
|
89 | 90 | Signals.progressUpdated.connect(self.widgetCatalogs.setValue)
|
90 | 91 | Signals.updateDialogShowed.connect(self._initUpdate)
|
91 | 92 |
|
| 93 | + def _initLanguage(self): |
| 94 | + """加载国际化翻译 |
| 95 | + """ |
| 96 | + if QLocale.system().language() in (QLocale.China, QLocale.Chinese, QLocale.Taiwan, QLocale.HongKong): |
| 97 | + # 加载中文 |
| 98 | + translator = QTranslator(self) |
| 99 | + translator.load('translations/pyqtclient_zh_CN.qm') |
| 100 | + QApplication.instance().installTranslator(translator) |
| 101 | + |
92 | 102 | def _initWebView(self):
|
93 | 103 | """初始化网页"""
|
94 | 104 | settings = self.webViewContent.settings()
|
@@ -157,14 +167,13 @@ def on_buttonHead_clicked(self):
|
157 | 167 | def on_lineEditSearch_textChanged(self, text):
|
158 | 168 | """过滤筛选
|
159 | 169 | """
|
160 |
| - return |
161 | 170 | Signals.filterChanged.emit(text)
|
162 | 171 |
|
163 | 172 | @pyqtSlot()
|
164 |
| - def on_buttonSearch_clicked(self): |
165 |
| - """点击搜索按钮 |
| 173 | + def on_buttonClear_clicked(self): |
| 174 | + """点击清空按钮 |
166 | 175 | """
|
167 |
| - pass |
| 176 | + self.lineEditSearch.setText('') |
168 | 177 |
|
169 | 178 | @pyqtSlot()
|
170 | 179 | def on_buttonGithub_clicked(self):
|
|
0 commit comments