Skip to content

Commit 8873c06

Browse files
authored
Merge pull request #85 from AresValley:UI-refactor
UI refactor
2 parents 04ec3bc + 99b5cf8 commit 8873c06

37 files changed

Lines changed: 3787 additions & 3666 deletions

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99

1010
- Added indicator if a DB and/or Artemis update is available on the main menu
1111
- Added native support and official packages for Arch Linux and derived distributions utilizing the pacman package manager.
12+
- Added official support and binaries (.pkg.tar.zst) for x64 arch-based distros along rpm and deb packages. Fix [#83](https://github.com/AresValley/Artemis/issues/83)
13+
14+
### Changed
15+
16+
- Completely overhauled the GUI for a more modern and fluid user experience.
17+
- Filters have been moved to the top menu for future implementation of new filtering functions
18+
- Minor chnages to the settings for logging and system-specific environement variables
1219

1320
### Fixed
1421

artemis.qrc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<file>data/images/icons/open.svg</file>
2121
<file>data/images/icons/browser.svg</file>
2222
<file>data/images/icons/documents.svg</file>
23-
<file>data/images/icons/abort.svg</file>
23+
<file>data/images/icons/cancel.svg</file>
2424
<file>data/images/icons/settings.svg</file>
2525
<file>data/images/spectrum_not_available.svg</file>
2626
<file>data/images/artemis_not_available.svg</file>
@@ -35,7 +35,6 @@
3535
<file>ui/SignalEditor.qml</file>
3636
<file>ui/CategoryEditor.qml</file>
3737

38-
<file>ui/FilterPage.qml</file>
3938
<file>ui/SignalPage.qml</file>
4039
<file>ui/SpaceWeatherCurrentPage.qml</file>
4140
<file>ui/SpaceWeatherForecastPage.qml</file>
@@ -50,5 +49,9 @@
5049
<file>ui/components/AIndexLight.qml</file>
5150
<file>ui/components/AudioPlayer.qml</file>
5251
<file>ui/components/BandBar.qml</file>
52+
<file>ui/components/FilterListDialog.qml</file>
53+
<file>ui/components/FilterRangeDialog.qml</file>
54+
<file>ui/components/ArtemisButton.qml</file>
55+
<file>ui/components/ArtemisListView.qml</file>
5356
</qresource>
5457
</RCC>

artemis/resources.py

Lines changed: 1899 additions & 1695 deletions
Large diffs are not rendered by default.

artemis/ui/artemis.py

Lines changed: 7 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from artemis.utils.sys_utils import open_directory, make_tar, unpack_tar
88
from artemis.utils.sql_utils import ArtemisDatabase, ArtemisSignal
99
from artemis.utils.update_utils import UpdateManager
10-
from artemis.utils.generic_utils import generate_filter_query
1110
from artemis.utils.path_utils import normalize_dialog_path
1211
from artemis.utils.path_utils import DATA_DIR
1312
from artemis.utils.config_utils import CONFIGURE_QT
@@ -19,6 +18,7 @@
1918
from artemis.ui.spaceweather import UIspaceweather
2019
from artemis.ui.documentsmanager import UIdocumentsmanager
2120
from artemis.ui.categoryeditor import UIcategoryeditor
21+
from artemis.ui.filters import FiltersManager
2222

2323
import 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
"""

artemis/ui/filters.py

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
from PySide6.QtCore import QObject, Slot, Signal
2+
3+
from artemis.utils.generic_utils import generate_filter_query
4+
5+
6+
class FiltersManager(QObject):
7+
# Python > QML Signals
8+
populate_filter_list = Signal(list)
9+
10+
def __init__(self, parent):
11+
super().__init__()
12+
self._parent = parent
13+
14+
self._window = self._parent._window
15+
self.location_filter = self._window.findChild(QObject, "locationDialogObj")
16+
self.category_filter = self._window.findChild(QObject, "categoryDialogObj")
17+
self.modulation_filter = self._window.findChild(QObject, "moculationDialogObj")
18+
19+
self._connect()
20+
21+
22+
def _connect(self):
23+
# QML > Python connections
24+
self._window.applyFilter.connect(self.apply_filter)
25+
26+
# Python > QML connections
27+
self.populate_filter_list.connect(self._window.populateFilterLists)
28+
29+
30+
def load_filter_lists(self):
31+
locations = self._parent.loaded_db.all_location
32+
modulations = self._parent.loaded_db.all_modulation
33+
categories = self._parent.loaded_db.all_category_labels
34+
35+
self.populate_filter_list.emit([{
36+
'location': locations,
37+
'modulation': modulations,
38+
'category': categories
39+
}])
40+
41+
42+
@Slot(dict)
43+
def apply_filter(self, filter_status):
44+
""" Update the signal list according to the selected filters.
45+
46+
Args:
47+
filter_status (dict): dictionary containing the active filters with all
48+
the details to generate a search query
49+
"""
50+
filter_status = filter_status.toVariant()
51+
52+
if self._parent.loaded_db is not None:
53+
if filter_status != {}:
54+
55+
############### TEMPORARY CODE UNTIL ORM IMPLEMENTATION (to be deleted asap) ############
56+
if 'category' in filter_status:
57+
all_categories = self._parent.loaded_db.all_category_labels
58+
category_lookup = {item['value']: item['clb_id'] for item in all_categories}
59+
60+
category_list = filter_status['category']
61+
category_list = [category_lookup.get(i) for i in category_list]
62+
63+
filter_status['category'] = category_list
64+
############### TEMPORARY CODE UNTIL ORM IMPLEMENTATION ############
65+
66+
filter_query = generate_filter_query(filter_status)
67+
self._parent.loaded_db.select_by_filter(filter_query)
68+
69+
self._parent.clear_signal_page.emit()
70+
self._parent.populate_sig_list.emit(self._parent.loaded_db.all_signals)
71+
72+
total_signals = len(self._parent.loaded_db.all_signals)
73+
self._parent.bottom_info_bar("FILTERS ACTIVE: {} signals found".format(total_signals), "warning")
74+
else:
75+
self._parent.load_db(self._parent.loaded_db.db_dir_name)

artemis/utils/ui_utils.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,36 @@
11
import os
22

3-
from artemis.utils.sys_utils import is_windows, is_linux, is_macos
3+
from artemis.utils.sys_utils import is_windows, is_linux
44
from artemis.utils.config_utils import CONFIGURE_QT
55

66

77
def set_ui():
8+
# Style and aspect
89
os.environ['QT_QUICK_CONTROLS_STYLE'] = CONFIGURE_QT.value('Controls', 'style', 'Material')
910
os.environ['QT_QUICK_CONTROLS_MATERIAL_VARIANT'] = CONFIGURE_QT.value('Material', 'variant', 'Dense')
1011
os.environ['QT_QUICK_CONTROLS_MATERIAL_THEME'] = CONFIGURE_QT.value('Material', 'theme', 'System')
1112
os.environ['QT_QUICK_CONTROLS_MATERIAL_ACCENT'] = CONFIGURE_QT.value('Material', 'accent', 'Green')
1213

14+
# High DPI
15+
os.environ['QT_AUTO_SCREEN_SCALE_FACTOR'] = '1'
16+
os.environ['QT_ENABLE_HIGHDPI_SCALING'] = '1'
17+
os.environ['QT_SCALE_FACTOR_ROUNDING_POLICY'] = 'PassThrough'
18+
19+
# GUI Backend
1320
if is_windows():
1421
os.environ['QSG_RHI_BACKEND'] = 'opengl'
1522

1623
if is_linux():
17-
# os.environ['GDK_BACKEND'] = 'x11'
1824
os.environ['QT_QPA_PLATFORM'] = 'wayland;xcb'
1925

26+
# Optimizations and workarounds
2027
os.environ['QT_ENABLE_GLYPH_CACHE_WORKAROUND'] = '1'
2128
os.environ['QML_USE_GLYPHCACHE_WORKAROUND'] = '1'
2229

30+
# Debug and loggings
31+
debug = CONFIGURE_QT.value('Develop', 'debug', '0')
32+
2333
os.environ['QT_DEBUG_PLUGINS'] = CONFIGURE_QT.value('Develop', 'debug_plugin', '0')
34+
35+
if debug != '1':
36+
os.environ["QT_LOGGING_RULES"] = "qt.multimedia.ffmpeg*=false"

config/qtquickcontrols2.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ accent=Green
1010
autoload=0
1111

1212
[Develop]
13+
debug=0
1314
debug_plugin=0

data/images/icons/abort.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

data/images/icons/add.svg

Lines changed: 1 addition & 1 deletion
Loading

data/images/icons/cancel.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)