1313class Window (QMainWindow , WSClient ):
1414
1515 m_signal_update_ui = Signal (bool )
16- m_signal_update_status = Signal (str , color_t )
16+ m_signal_status = Signal (str , color_t )
17+ m_signal_log = Signal (str , color_t , icon_t )
1718
1819 def __init__ (self , app ):
1920 super (Window , self ).__init__ ()
@@ -39,7 +40,8 @@ def setup_ui(self):
3940 self .btn_clear_list_log .clicked .connect (self .on_clicked_button_clear_list_log )
4041 self .btn_save_list_log .clicked .connect (self .on_clicked_button_save_list_log )
4142 self .m_signal_update_ui .connect (self .slot_update_ui )
42- self .m_signal_update_status .connect (self .slot_status )
43+ self .m_signal_status .connect (self .slot_status )
44+ self .m_signal_log .connect (self .slot_log )
4345 # set others
4446 self .txt_message .setFont (get_default_font ())
4547 self .list_log .setIconSize (QSize (16 , 16 ))
@@ -54,6 +56,10 @@ def closeEvent(self, event):
5456 event .accept ()
5557
5658 def log (self , text , color = color_t .normal , icon = icon_t .none ):
59+ self .m_signal_log .emit (text , color , icon )
60+
61+ @Slot (str , color_t , icon_t )
62+ def slot_log (self , text , color = color_t .normal , icon = icon_t .none ):
5763 item = QListWidgetItem (text )
5864 item .setFont (get_default_font ())
5965 item .setForeground (QColor (color ))
@@ -67,7 +73,7 @@ def log(self, text, color=color_t.normal, icon=icon_t.none):
6773 self .list_log .scrollToBottom ()
6874
6975 def status (self , text , color = color_t .normal ):
70- self .m_signal_update_status .emit (text , color )
76+ self .m_signal_status .emit (text , color )
7177
7278 @Slot (str , color_t )
7379 def slot_status (self , text , color = color_t .normal ):
0 commit comments