77from artemis .utils .sys_utils import open_directory , make_tar , unpack_tar
88from artemis .utils .sql_utils import ArtemisDatabase , ArtemisSignal
99from artemis .utils .update_utils import UpdateManager
10- from artemis .utils .generic_utils import generate_filter_query
1110from artemis .utils .path_utils import normalize_dialog_path
1211from artemis .utils .path_utils import DATA_DIR
1312from artemis .utils .config_utils import CONFIGURE_QT
1918from artemis .ui .spaceweather import UIspaceweather
2019from artemis .ui .documentsmanager import UIdocumentsmanager
2120from artemis .ui .categoryeditor import UIcategoryeditor
21+ from artemis .ui .filters import FiltersManager
2222
2323import artemis .resources
2424
@@ -28,11 +28,9 @@ class UIArtemis(QObject):
2828 close_ui = Signal ()
2929 populate_sig_list = Signal (list )
3030 populate_sig_details = Signal (list )
31- populate_filter_modulation = Signal (list )
3231
3332 clear_list = Signal ()
3433 clear_signal_page = Signal ()
35- clear_filter_page = Signal ()
3634 lock_audio_player = Signal ()
3735 lock_menu = Signal (bool )
3836
@@ -53,8 +51,8 @@ def __init__(self):
5351 self ._engine .load ('qrc:/ui/Artemis.qml' )
5452 self ._window = self ._engine .rootObjects ()[0 ]
5553
56- self ._window_filter = self ._window .findChild (QObject , "filterPageObj" )
5754 self ._window_signal = self ._window .findChild (QObject , "signalPageObj" )
55+ self ._window_signal_list = self ._window .findChild (QObject , "signalListObj" ) # <--- MODIFICATO (Nuovo riferimento)
5856
5957 self .loaded_db = None
6058
@@ -69,6 +67,7 @@ def __init__(self):
6967 self .cateditor = UIcategoryeditor (self )
7068 self .downloader = UIDownloader (self )
7169
70+ self .filters_manager = FiltersManager (self )
7271 self .update_manager = UpdateManager (self )
7372
7473 self .autoload_db ()
@@ -91,30 +90,25 @@ def _connect(self):
9190 self ._window .exportDb .connect (self .export_db )
9291 self ._window .importDb .connect (self .import_db )
9392
94- self ._window_filter .applyFilter .connect (self .apply_filter )
95- self ._window_filter .sendBottomAlert .connect (self .bottom_info_bar )
96-
9793 self ._window_signal .openDocManager .connect (self .show_documentsmanager_ui )
9894 self ._window_signal .openSigEditor .connect (self .open_sig_editor )
9995 self ._window_signal .deleteCatTag .connect (self .delete_cat_tag )
10096 self ._window_signal .addCatTag .connect (self .add_cat_tag )
10197
10298 # Python > QML connections
10399 self .close_ui .connect (self ._window .close )
104- self .populate_sig_list .connect (self ._window .populateList )
105- self .clear_list .connect (self ._window .clearList )
106100 self .update_info_bar .connect (self ._window .bottomInfoBar )
107101 self .show_dialog_popup .connect (self ._window .openGeneralDialog )
108102 self .show_dialog_download_db .connect (self ._window .openDialogDownloadDb )
109103 self .show_dialog_update_artemis .connect (self ._window .openDialogUpdateArtemis )
110104 self .lock_menu .connect (self ._window .lockMenu )
111105
106+ self .populate_sig_list .connect (self ._window_signal_list .populateList )
107+ self .clear_list .connect (self ._window_signal_list .clearList )
108+
112109 self .populate_sig_details .connect (self ._window_signal .populateSignalParam )
113110 self .lock_audio_player .connect (self ._window_signal .lockPlayer )
114111 self .clear_signal_page .connect (self ._window_signal .resetAll )
115-
116- self .clear_filter_page .connect (self ._window_filter .resetAll )
117- self .populate_filter_modulation .connect (self ._window_filter .loadLists )
118112
119113
120114 def load_db (self , db_dir_name ):
@@ -129,9 +123,8 @@ def load_db(self, db_dir_name):
129123 # Clearing UI
130124 self .lock_menu .emit (False )
131125 self .clear_signal_page .emit ()
132- self .clear_filter_page .emit ()
133126 # Populating UI
134- self .load_filter_lists ()
127+ self .filters_manager . load_filter_lists ()
135128 self .populate_sig_list .emit (self .loaded_db .all_signals )
136129 # Updating status bar
137130 total_signals = len (self .loaded_db .all_signals )
@@ -152,39 +145,6 @@ def load_sig(self, sig_id):
152145 self .populate_sig_details .emit ([sig_dic ])
153146
154147
155- def load_filter_lists (self ):
156- """ Populates the 3 listviews in the FilterPage
157- """
158- self .populate_filter_modulation .emit ([{
159- 'modulation' : self .loaded_db .all_modulation ,
160- 'location' : self .loaded_db .all_location ,
161- 'category' : self .loaded_db .all_category_labels
162- }])
163-
164-
165- @Slot (dict )
166- def apply_filter (self , filter_status ):
167- """ Update the signal list according to the selected filters in the FilterPage.
168-
169- Args:
170- filter_status (dic): dictionary containing the active filters with all
171- the details to generate a search query
172- """
173- filter_status = filter_status .toVariant ()
174- if self .loaded_db is not None :
175- if filter_status != {}:
176- filter_query = generate_filter_query (filter_status )
177- self .loaded_db .select_by_filter (filter_query )
178-
179- self .clear_signal_page .emit ()
180- self .populate_sig_list .emit (self .loaded_db .all_signals )
181-
182- total_signals = len (self .loaded_db .all_signals )
183- self .bottom_info_bar ("FILTERS ACTIVE: {} signals found" .format (total_signals ), "warning" )
184- else :
185- self .load_db (self .loaded_db .db_dir_name )
186-
187-
188148 def show_pref_ui (self ):
189149 """ Load the preference windows
190150 """
0 commit comments