diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 97c2c01e70c823c3dcf2120e9d35991ebe0023d2..eec18d5dc6a281b4f2f72eaa012afc0ea449bee5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,7 +12,7 @@ variables: # style check_style: stage: style - image: docker-registry.esrf.fr/dau/ewoks:python_3.9_glx + image: gitlab-registry.esrf.fr/dau/ci/pyci/python_3.9_glx:latest before_script: - pip install black script: @@ -22,7 +22,7 @@ check_style: doc: stage: build - image: docker-registry.esrf.fr/dau/ewoks:python_3.8_doc + image: gitlab-registry.esrf.fr/dau/ci/pyci/python_3.8_doc:latest tags: - linux before_script: @@ -68,7 +68,7 @@ doc: test-3.9: extends: .pytest - image: docker-registry.esrf.fr/dau/ewoks:python_3.9_glx + image: gitlab-registry.esrf.fr/dau/ci/pyci/python_3.9_glx:latest coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/' artifacts: paths: @@ -82,7 +82,7 @@ pages: stage: deploy tags: - linux - image: docker-registry.esrf.fr/dau/ewoks:python_3.8_doc + image: gitlab-registry.esrf.fr/dau/ci/pyci/python_3.8_doc:latest script: - rm -rf public # doc diff --git a/processview/gui/DropDownWidget.py b/processview/gui/DropDownWidget.py new file mode 100644 index 0000000000000000000000000000000000000000..57c4117abffc3f4aa4e67fec93d3aa5c0fe89f09 --- /dev/null +++ b/processview/gui/DropDownWidget.py @@ -0,0 +1,50 @@ +from silx.gui import qt + + +class DropDownWidget(qt.QWidget): + """Simple 'dropdown' widget""" + + _BUTTON_ICON = qt.QStyle.SP_ToolBarVerticalExtensionButton # noqa + + def __init__(self, parent, direction=qt.Qt.LeftToRight): + super().__init__(parent) + + self.setLayout(qt.QVBoxLayout()) + self.setLayoutDirection(direction) + # toggable button + self._toggleButton = qt.QPushButton("", self) + self._toggleButton.setCheckable(True) + self._toggleButton.setSizePolicy(qt.QSizePolicy.Fixed, qt.QSizePolicy.Fixed) + self.layout().addWidget(self._toggleButton) + + self._mainWidget = None + + # set up interface + self.layout().setContentsMargins(2, 2, 2, 2) + self.layout().setSpacing(0) + + self._setButtonIcon(show=True) + self._toggleButton.setChecked(True) + + # connect signal / slot + self._toggleButton.toggled.connect(self._toggleVisibility) + + def setWidget(self, widget: qt.QWidget): + if self._mainWidget is not None: + self.layout().removeWidget(self._mainWidget) + + self._mainWidget = widget + self.layout().addWidget(self._mainWidget) + + def _setButtonIcon(self, show): + style = qt.QApplication.instance().style() + # return a QIcon + icon = style.standardIcon(self._BUTTON_ICON) + if show is True: + pixmap = icon.pixmap(32, 32).transformed(qt.QTransform().scale(1, -1)) + icon = qt.QIcon(pixmap) + self._toggleButton.setIcon(icon) + + def _toggleVisibility(self, visible): + self._setButtonIcon(show=visible) + self._mainWidget.setVisible(visible) diff --git a/processview/gui/processmanager.py b/processview/gui/processmanager.py index 42f724e74f12cd3a74897a92d35b18fd9c488648..3ea86c963ce834721cd8ea2bb06c01bf278a117d 100644 --- a/processview/gui/processmanager.py +++ b/processview/gui/processmanager.py @@ -41,6 +41,7 @@ from processview.core.manager import DatasetState from processview.core.manager import ProcessManager as _ProcessManager from processview.core.sorting import SortType, tooltips from processview.core.superviseprocess import SuperviseProcess +from processview.gui.DropDownWidget import DropDownWidget from processview.gui import icons as icons from processview.gui.messagebox import MessageBox from processview.utils import docstring @@ -199,7 +200,7 @@ class ObservationTable(qt.QTableView): class ProcessManagerWidget(qt.QWidget): """ - Main widget to dispaly dataset vs process metadata + Main widget to display dataset vs process metadata """ def __init__(self, parent): @@ -208,14 +209,17 @@ class ProcessManagerWidget(qt.QWidget): self._manager = ProcessManager() - self._optionsWidget = _ToggleableOptionsWidget(parent=self) - self._optionsWidget.setSizePolicy( + self._optionsWidget = OptionsWidget(parent=self) + self._dropDownOptionsWidget = DropDownWidget(parent=self) + self._dropDownOptionsWidget.setWidget(self._optionsWidget) + + self._dropDownOptionsWidget.setSizePolicy( qt.QSizePolicy.Minimum, qt.QSizePolicy.Minimum ) self.setContentsMargins(0, 0, 0, 0) self.layout().setContentsMargins(0, 0, 0, 0) self.layout().setSpacing(2) - self.layout().addWidget(self._optionsWidget) + self.layout().addWidget(self._dropDownOptionsWidget) self.observationTable = ObservationTable(self) @@ -252,11 +256,11 @@ class ProcessManagerWidget(qt.QWidget): def _filterUpdated(self): self.observationTable.model().process_patterns = ( - self._optionsWidget.getProcessPatterns() + self._dropDownOptionsWidget.getProcessPatterns() ) self._updateProcesses() self.observationTable.model().dataset_patterns = ( - self._optionsWidget.getDatasetPatterns() + self._dropDownOptionsWidget.getDatasetPatterns() ) self._updateDatasetStates() @@ -451,15 +455,11 @@ class _DatasetProcessModel(qt.QAbstractTableModel): self.layoutChanged.emit() -class _ToggleableOptionsWidget(qt.QWidget): - _BUTTON_ICON = qt.QStyle.SP_ToolBarVerticalExtensionButton # noqa +class OptionsWidget(qt.QWidget): def __init__(self, parent): super().__init__(parent) self.setLayout(qt.QGridLayout()) - # toggable button - self._toggleButton = qt.QPushButton("", self) - self.layout().addWidget(self._toggleButton, 0, 0, 1, 1) # dataset ordering self._orderingWidget = _OrderingWidget(parent=self) @@ -473,34 +473,16 @@ class _ToggleableOptionsWidget(qt.QWidget): self.layout().setSpacing(0) self.layout().addWidget(self._filterWidget, 4, 1, 3, 3) - self._toggleButton.setSizePolicy(qt.QSizePolicy.Fixed, qt.QSizePolicy.Fixed) - self._setButtonIcon(show=True) - - # connect signal / slot - self._toggleButton.clicked.connect(self._toggleFilterWidget) - - # expose API - self.getProcessPatterns = self._filterWidget.getProcessPatterns - self.getDatasetPatterns = self._filterWidget.getDatasetPatterns - @property def filterWidget(self): return self._filterWidget - def _setButtonIcon(self, show): - style = qt.QApplication.instance().style() - # return a QIcon - icon = style.standardIcon(self._BUTTON_ICON) - if show is True: - pixmap = icon.pixmap(32, 32).transformed(qt.QTransform().scale(1, -1)) - icon = qt.QIcon(pixmap) - self._toggleButton.setIcon(icon) - - def _toggleFilterWidget(self): - visible = not self._filterWidget.isVisible() - self._setButtonIcon(show=visible) - self._filterWidget.setVisible(visible) - self._orderingWidget.setVisible(visible) + # expose API + def getProcessPatterns(self): + return self._filterWidget.getProcessPatterns() + + def getDatasetPatterns(self): + return self._filterWidget.getDatasetPatterns() class _FilterWidget(qt.QWidget): diff --git a/processview/version.py b/processview/version.py index 874b17ee9c3f61801957e2b17a11e27150fba5c7..d795abe348fa24b5619d0e3e10b0b717b4ec3153 100644 --- a/processview/version.py +++ b/processview/version.py @@ -76,8 +76,8 @@ RELEASE_LEVEL_VALUE = { } MAJOR = 1 -MINOR = 3 -MICRO = 3 +MINOR = 4 +MICRO = 1 RELEV = "final" # <16 SERIAL = 0 # <16