Skip to content

Commit

Permalink
I1476 (#1502)
Browse files Browse the repository at this point in the history
* skyfield_data updated

* search items based on open views
  • Loading branch information
ReimarBauer authored Jul 4, 2022
1 parent 8ae56dd commit dc9fcca
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
23 changes: 23 additions & 0 deletions mslib/msui/_tests/test_msui.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,29 @@ def test_shortcuts_present(self):
break
assert self.shortcuts.treeWidget.topLevelItemCount() == 2

def test_available_shortcuts_level(self):
initial_locations = [msui.ft.Waypoint(40., 25., 0),
msui.ft.Waypoint(60., -10., 0),
msui.ft.Waypoint(40., 10, 0)]
waypoints_model = msui.ft.WaypointsTableModel(name="", waypoints=initial_locations)
self.shortcuts.fill_list()
assert self.shortcuts.treeWidget.topLevelItemCount() == 1
# open topview
self.main_window.create_view("topview", waypoints_model)
# open config_editor
self.main_window.open_config_editor()
self.shortcuts.fill_list()
assert self.shortcuts.treeWidget.topLevelItemCount() == 3
self.shortcuts.reset_highlight()
# close topview
self.main_window.listViews.item(0).window.handle_force_close()
self.shortcuts.reset_highlight()
assert self.shortcuts.treeWidget.topLevelItemCount() == 2
# destroy config_editor window
self.main_window.config_editor.destroy()
self.shortcuts.reset_highlight()
assert self.shortcuts.treeWidget.topLevelItemCount() == 1


class Test_MSSSideViewWindow(object):
# temporary file paths to test open feature
Expand Down
3 changes: 2 additions & 1 deletion mslib/msui/msui.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ def reset_highlight(self):
"""
Iterates through all shortcuts and resets the stylesheet
"""
self.fill_list()
if self.current_shortcuts:
for shortcuts in self.current_shortcuts.values():
for shortcut in shortcuts.values():
Expand Down Expand Up @@ -212,7 +213,6 @@ def fill_list(self):
"""
Fills the treeWidget with all relevant windows as top level items and their shortcuts as children
"""
self.reset_highlight()
self.treeWidget.clear()
self.current_shortcuts = self.get_shortcuts()
for widget in self.current_shortcuts:
Expand Down Expand Up @@ -923,6 +923,7 @@ def show_shortcuts(self, search_mode=False):
self.shortcuts_dlg = MSUI_ShortcutsDialog()

self.shortcuts_dlg.setParent(QtWidgets.QApplication.activeWindow(), QtCore.Qt.Dialog)
self.shortcuts_dlg.reset_highlight()
self.shortcuts_dlg.fill_list()
self.shortcuts_dlg.show()
if search_mode:
Expand Down

0 comments on commit dc9fcca

Please sign in to comment.