@@ -212,6 +212,7 @@ class TableFlyoutView(FlyoutViewBase):
212212 def __init__ (self , data , parent = None ):
213213 super ().__init__ (parent )
214214 self .rvInterface = parent
215+ self .gui = parent .toolWin .gui
215216 p_width = parent .width ()
216217 p_height = parent .height ()
217218 self .width = int (p_width * 0.8 )
@@ -231,10 +232,10 @@ def __init__(self, data, parent=None):
231232 self .closeBtn .clicked .connect (self .closed )
232233 self .delBtn = PrimaryPushButton (FluentIcon .DELETE , "删除选中记录" , self )
233234 self .delBtn .clicked .connect (self .delete_selected_record )
234- self .sendBtn = PrimaryPushButton (FluentIcon .SEND , "发送选中记录至输入框 " , self )
235- self .sendBtn .clicked .connect (self .send_selected_record )
235+ self .searchBtn = PrimaryPushButton (FluentIcon .SEARCH , "搜索选中记录 " , self )
236+ self .searchBtn .clicked .connect (self .send_selected_record )
236237 second_row .addWidget (self .delBtn )
237- second_row .addWidget (self .sendBtn )
238+ second_row .addWidget (self .searchBtn )
238239 second_row .addItem (spacerItem )
239240 second_row .addWidget (self .closeBtn )
240241
@@ -243,7 +244,7 @@ def __init__(self, data, parent=None):
243244 # 必须设置视图尺寸
244245 self .setFixedSize (self .width , self .height )
245246
246- def set_table (self , data : t .List [ BookShow ]):
247+ def set_table (self , data : t .Dict [ str , BookShow ]):
247248 self .tableView = TableView (self )
248249 self .tableView .setBorderRadius (15 )
249250 self .tableView .setWordWrap (False )
@@ -254,14 +255,16 @@ def set_table(self, data: t.List[BookShow]):
254255 # 设置数据模型
255256 model = QStandardItemModel ()
256257 model .setHorizontalHeaderLabels (["漫画" , "已阅最新章节" , "已下载最新章节" ])
257- for book in data :
258+ for book in data . values () :
258259 row = [
259260 QStandardItem (book .name ),
260261 QStandardItem (book .show_max ),
261262 QStandardItem (book .dl_max )
262263 ]
263264 model .appendRow (row )
264265 self .tableView .setModel (model )
266+ self .tableView .setSortingEnabled (True )
267+ self .tableView .horizontalHeader ().setSortIndicatorShown (True )
265268 self .tableView .horizontalHeader ().setStretchLastSection (True )
266269 # 调整列宽
267270 self .tableView .setColumnWidth (0 , int (tb_width * 0.5 ))
@@ -291,21 +294,29 @@ def send_selected_record(self):
291294 selection_model = self .tableView .selectionModel ()
292295 if not selection_model .hasSelection ():
293296 InfoBar .warning (
294- title = '' , content = '请先选择要发送的记录' ,
295- orient = Qt .Horizontal , isClosable = True , position = InfoBarPosition .BOTTOM_LEFT ,
296- duration = 5000 , parent = self .rvInterface
297+ title = '' , content = '请先选择行' ,
298+ orient = Qt .Horizontal , isClosable = True , position = InfoBarPosition .BOTTOM_RIGHT ,
299+ duration = 5000 , parent = self .rvInterface .table_fv
300+ )
301+ return
302+ elif self .gui .chooseBox .currentIndex () == 0 :
303+ InfoBar .warning (
304+ title = '' , content = '请先选择搜索源' ,
305+ orient = Qt .Horizontal , isClosable = True , position = InfoBarPosition .BOTTOM_RIGHT ,
306+ duration = 5000 , parent = self .rvInterface .table_fv
297307 )
298308 return
299309 selected_indexes = selection_model .selectedRows ()
300310 row = selected_indexes [0 ].row ()
301311 model = self .tableView .model ()
302312 book_name = model .item (row , 0 ).text ()
303313 def do ():
304- self .rvInterface .toolWin .gui .searchinput .setText (book_name )
314+ self .gui .searchinput .setText (book_name )
315+ self .gui .next_btn .click ()
305316 InfoBar .info (
306- title = '' , content = f'「{ book_name } 」已发至输入框 ' ,
317+ title = '' , content = f'「{ book_name } 」已发至输入框进行搜索中 ' ,
307318 orient = Qt .Horizontal , isClosable = True , position = InfoBarPosition .BOTTOM ,
308- duration = 2000 , parent = self .rvInterface . toolWin . gui .textBrowser
319+ duration = 2000 , parent = self .gui .textBrowser
309320 )
310321 QTimer .singleShot (10 , do )
311322 self .rvInterface .table_fv .close ()
0 commit comments