From 5933a7ea2d71e716c0ca6070abf598e379083f1d Mon Sep 17 00:00:00 2001 From: Ramon Figueiredo Date: Wed, 18 Sep 2024 18:07:18 -0700 Subject: [PATCH] Add configurable search behavior to Job Monitor - Introduced a new configuration option `search_jobs.append_results` in cuegui.yaml to control job search behavior. - If `search_jobs.append_results` is set to true, search results will be appended to the current list of monitored jobs. - If `search_jobs.append_results` is set to false, the existing jobs will be cleared before displaying the search results. - Updated Constants.py to include the new configuration parameter. - Modified MonitorJobsPlugin.py to conditionally clear the job monitor based on the config setting. --- cuegui/cuegui/Constants.py | 2 ++ cuegui/cuegui/config/cuegui.yaml | 5 +++++ cuegui/cuegui/plugins/MonitorJobsPlugin.py | 8 +++++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/cuegui/cuegui/Constants.py b/cuegui/cuegui/Constants.py index ff45e85d4..fef8da08f 100644 --- a/cuegui/cuegui/Constants.py +++ b/cuegui/cuegui/Constants.py @@ -195,6 +195,8 @@ def __packaged_version(): for action_type in __config.get('filter_dialog.disabled_action_types', "").split(",")] +SEARCH_JOBS_APPEND_RESULTS = __config.get('search_jobs.append_results', True) + TYPE_JOB = QtWidgets.QTreeWidgetItem.UserType + 1 TYPE_LAYER = QtWidgets.QTreeWidgetItem.UserType + 2 TYPE_FRAME = QtWidgets.QTreeWidgetItem.UserType + 3 diff --git a/cuegui/cuegui/config/cuegui.yaml b/cuegui/cuegui/config/cuegui.yaml index e210cfc20..fa32a2cd8 100644 --- a/cuegui/cuegui/config/cuegui.yaml +++ b/cuegui/cuegui/config/cuegui.yaml @@ -152,3 +152,8 @@ finished_jobs_readonly.layer: True # MOVE_JOB_TO_GROUP, SET_ALL_RENDER_LAYER_MAX_CORES) # An empty string means all actions are active. filter_dialog.disabled_action_types: '' + +# A flag for search job with appended results +# true to appended to the current list of monitored jobs, +# false to clear the current job list and show only the new search results +search_jobs.append_results: True diff --git a/cuegui/cuegui/plugins/MonitorJobsPlugin.py b/cuegui/cuegui/plugins/MonitorJobsPlugin.py index 00e217fbc..744603088 100644 --- a/cuegui/cuegui/plugins/MonitorJobsPlugin.py +++ b/cuegui/cuegui/plugins/MonitorJobsPlugin.py @@ -193,12 +193,14 @@ def _loadFinishedJobsSetup(self, layout): self.__loadFinishedJobsCheckBox.stateChanged.connect(self._regexLoadJobsHandle) # pylint: disable=no-member def _regexLoadJobsHandle(self): - """This will select all jobs that have a name that contain the substring - in self.__regexLoadJobsEditBox.text() and scroll to the first match""" + """This will select all jobs that have a name that contains the substring + in self.__regexLoadJobsEditBox.text() and scroll to the first match.""" substring = str(self.__regexLoadJobsEditBox.text()).strip() load_finished_jobs = self.__loadFinishedJobsCheckBox.isChecked() - self.jobMonitor.removeAllItems() + # Only clear the existing jobs if SEARCH_JOBS_APPEND_RESULTS is False + if not cuegui.Constants.SEARCH_JOBS_APPEND_RESULTS: + self.jobMonitor.removeAllItems() if substring: # Load job if a uuid is provided