1313from PyQt5 .QtCore import QUrl , Qt
1414from qfluentwidgets import (
1515 FluentIcon as FIF , PushButton , PrimaryPushButton , TransparentPushButton ,
16- PushSettingCard , InfoBarPosition , TransparentToggleToolButton , InfoBar
16+ PushSettingCard , InfoBarPosition , TransparentToggleToolButton , InfoBar , ComboBox
1717)
1818import uncurl
1919
@@ -69,12 +69,18 @@ def setupUi(self, Dialog):
6969 self ._repaint_textEdit ()
7070
7171 def retranslateUiAgain (self , Dialog ):
72+ self .langBox = ComboBox (Dialog )
73+ self .langBox .setObjectName ("langBox" )
74+ self .langBox .setCurrentIndex (- 1 )
75+ self .pypiSourceBox = ComboBox (Dialog )
76+ self .pypiSourceBox .setObjectName ("pypiSourceBox" )
7277 _translate = QtCore .QCoreApplication .translate
7378 self .label_2 .setText (_translate ("Dialog" , res .GUI .Uic .confDia_labelLogLevel ))
7479 self .label_4 .setText (_translate ("Dialog" , res .GUI .Uic .confDia_labelProxy ))
7580 self .label_completer .setText (_translate ("Dialog" , res .GUI .Uic .confDia_labelPreset ))
7681 self .label_6 .setText (_translate ("Dialog" , res .GUI .Uic .confDia_labelClipDb ))
7782 self .label_7 .setText (_translate ("Dialog" , res .GUI .Uic .confDia_labelClipNum ))
83+ self .metaTypeLabel .setText (_translate ("Dialog" , res .GUI .Uic .confDia_metaType ))
7884 self .concurr_numLabel .setText (_translate ("Dialog" , res .GUI .Uic .confDia_labelConcurrNum ))
7985 # 添加cookie类型选项
8086 support = list (COOKIES_PLACEHOLDER .keys ())
@@ -88,6 +94,11 @@ def retranslateUiAgain(self, Dialog):
8894 self .pypiSourceBox .setItemText (1 , _translate ("Dialog" , "清华源" ))
8995 self .pypiSourceBox .setItemText (2 , _translate ("Dialog" , "阿里源" ))
9096 self .pypiSourceBox .setItemText (3 , _translate ("Dialog" , "华为源" ))
97+ self .metaTypeBox .addItem ("" )
98+ self .metaTypeBox .addItem ("" )
99+ self .metaTypeBox .setItemText (0 , _translate ("Dialog" , "-" ))
100+ self .metaTypeBox .setItemText (1 , _translate ("Dialog" , "ComicInfo.xml" ))
101+ self .metaTypeBox .setCurrentIndex (0 )
91102 self .cookiesBox .setCurrentText (support [0 ])
92103
93104 for k , ui_key in LANG .items ():
@@ -182,6 +193,19 @@ def _tip_lang_change(idx):
182193 duration = 5000 , parent = self
183194 )
184195 self .langBox .activated .connect (_tip_lang_change )
196+ def _tip_meta_change (idx ):
197+ match self .metaTypeBox .itemText (idx ):
198+ case "ComicInfo.xml" :
199+ _meta_tip = "适配平台例如:ComicRack, Komga, kavita"
200+ case _:
201+ _meta_tip = ""
202+ if _meta_tip :
203+ InfoBar .success (
204+ title = "" , content = _meta_tip ,
205+ orient = Qt .Horizontal , isClosable = True , position = InfoBarPosition .TOP ,
206+ duration = 5000 , parent = self
207+ )
208+ self .metaTypeBox .activated .connect (_tip_meta_change )
185209 self .cookiesBox .currentTextChanged .connect (self ._on_cookie_type_changed )
186210 def _tip_on (is_checked : bool , tip_content = None ):
187211 if is_checked :
@@ -213,6 +237,7 @@ def show_self(self): # can't naming `show`. If done, just run code once
213237 self .logLevelComboBox .setCurrentIndex (self .logLevelComboBox .findText (getattr (conf , "log_level" )))
214238 self .pypiSourceBox .setCurrentIndex (getattr (conf , "pypi_source" ))
215239 self .langBox .setCurrentIndex (self .langBox .findData (getattr (conf , "lang" )))
240+ self .metaTypeBox .setCurrentIndex (self .metaTypeBox .findText (getattr (conf , "meta_type" )))
216241 # 仅当 初次confdia ui创建 & conf值设入ui后,才绑定槽函数
217242 if self ._init_flag :
218243 self .bind_logic ()
@@ -254,6 +279,7 @@ def save_conf(self):
254279 "sv_path" : sv_path ,
255280 "log_level" : getattr (self , "logLevelComboBox" ).currentText (),
256281 "lang" : getattr (self , "langBox" ).currentData (),
282+ "meta_type" : getattr (self , "metaTypeBox" ).currentText (),
257283 "concurr_num" : getattr (self , "concurr_numEdit" ).value (),
258284 "isDeduplicate" : getattr (self , "isDeduplicate" ).isChecked (),
259285 "addUuid" : getattr (self , "addUuid" ).isChecked (),
0 commit comments