Skip to content

Commit

Permalink
ENH: enable / disable pagination and sort order buttons depending on …
Browse files Browse the repository at this point in the history
…view
  • Loading branch information
jotelha committed Nov 8, 2024
1 parent 54c148c commit 0b04ea7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions dtool_lookup_gui/views/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ class MainWindow(Gtk.ApplicationWindow):
main_statusbar = Gtk.Template.Child()
contents_per_page_combo_box = Gtk.Template.Child()
sort_field_combo_box = Gtk.Template.Child()
sort_order_switch = Gtk.Template.Child()

linting_errors_button = Gtk.Template.Child()

Expand Down Expand Up @@ -1262,10 +1263,23 @@ async def _select_base_uri():
self.main_stack.set_visible_child(self.main_spinner)
self.create_dataset_button.set_sensitive(not isinstance(row, DtoolSearchResultsRow) and
row.base_uri.editable)
self._set_lookup_gui_widgets_state(isinstance(row, DtoolSearchResultsRow))

if row.task is None:
_logger.debug("Spawn select_base_uri task.")
row.task = asyncio.create_task(_select_base_uri())

def _set_lookup_gui_widgets_state(self, state=False):
self.search_entry.set_sensitive(state)
self.contents_per_page_combo_box.set_sensitive(state)
self.sort_field_combo_box.set_sensitive(state)
self.sort_order_switch.set_sensitive(state)
if state is True:
self._enable_pagination_buttons()
else:
self._disable_pagination_buttons()


def _select_and_load_first_uri(self):
"""
This function automatically reloads the data and selects the first URI.
Expand Down

0 comments on commit 0b04ea7

Please sign in to comment.