From 731710bba3de2b3d4ee2f54b0a82c6ac5d4765cf Mon Sep 17 00:00:00 2001 From: bjosch Date: Wed, 28 Aug 2024 09:55:49 +0200 Subject: [PATCH] Adding more status message updates to improve user information. --- plugins/table_viewer/overview.py | 5 ++++- plugins/table_viewer/pagination.py | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/table_viewer/overview.py b/plugins/table_viewer/overview.py index 09a641b..08d32a3 100644 --- a/plugins/table_viewer/overview.py +++ b/plugins/table_viewer/overview.py @@ -1,5 +1,6 @@ from pathlib import Path from typing import TYPE_CHECKING +from .helpers import status_message import wx @@ -26,7 +27,7 @@ class Overview(wx.Panel): __base_info (wx.TextCtrl): The text control that displays the overview information. """ - def __init__(self, parent: wx.Panel) -> None: + def __init__(self, parent: wx.Panel, plugin: "TableViewer") -> None: """ Initialize the Overview Panel. @@ -34,12 +35,14 @@ def __init__(self, parent: wx.Panel) -> None: parent (wx.Panel): The parent panel for the Overview Panel. """ super().__init__(parent) + self.status_bar = plugin.status_bar self.__sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(self.__sizer) self.__base_info = wx.TextCtrl(self, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH2) self.__sizer.Add(self.__base_info, 1, wx.EXPAND) + @status_message(f"Updating overview") def update(self, plugin: "TableViewer", append: bool = False) -> None: """ Update the Overview Panel with the information from the Table Viewer. diff --git a/plugins/table_viewer/pagination.py b/plugins/table_viewer/pagination.py index b57f2a8..3a89aaa 100644 --- a/plugins/table_viewer/pagination.py +++ b/plugins/table_viewer/pagination.py @@ -4,6 +4,7 @@ import wx from .components.button import PVButton +from .helpers import status_message if TYPE_CHECKING: from . import TableViewer @@ -61,6 +62,7 @@ def __init__(self, parent: wx.Panel, plugin: 'TableViewer') -> None: """ super().__init__(parent) self.logger = plugin.logger.getChild("pagination") + self.status_bar = plugin.status_bar self.__plugin = plugin self.__setup_ui() @@ -92,6 +94,7 @@ def __create_button(self, name: ButtonNames) -> None: setattr(self, f"__{name}_button", button) self.__sizer.Add(button, 1, wx.EXPAND) + @status_message(f"Loading previous page") def prev(self, event: wx.Event) -> None: """ Go back one page. @@ -108,6 +111,7 @@ def prev(self, event: wx.Event) -> None: self.__plugin.OFFSET -= self.__plugin.SAMPLE_SIZE self.__plugin.load_data() + @status_message(f"Loading next page") def next(self, event: wx.Event) -> None: """ Go forward one page. @@ -137,6 +141,7 @@ def first(self, event: wx.Event) -> None: self.__plugin.OFFSET = 0 self.__plugin.load_data() + @status_message(f"Loading last page") def last(self, event: wx.Event) -> None: """ Go to the last page.