Esempio n. 1
0
    def _fork_toolbar_buttons(self):
        """Custom toolbar buttons be here.
        """
        # But first, let's play around with the existing MatPlotLib buttons.
        _, self._button_drag, self._button_zoom = \
            mpl_utils.get_toolbar_elements(
                self.mpl_toolbar, drag_callback=self._uncheck_custom_buttons,
                zoom_callback=self._uncheck_custom_buttons)

        self.limButton = QtWidgets.QToolButton(self)
        self.limButton.clicked.connect(self._toggle_lim_lines)
        self.limButton.setCheckable(True)
        self.limButton.setToolTip(
            "Toggle the view of the limit lines on and off")
        self._icon_manager.set_icon(self.limButton, "amarok_edit.svg")
        self.mpl_toolbar.addWidget(self.limButton)

        self.modeButton = QtWidgets.QToolButton(self)
        self.modeButton.clicked.connect(self._toggle_lim_mode)
        self.modeButton.setToolTip(
            "Toggles between selecting the entire " +
            "histogram, area included in the limits and " +
            "areas included of the limits")
        self._icon_manager.set_icon(self.modeButton,
                                    "depth_profile_lim_all.svg")
        self.mpl_toolbar.addWidget(self.modeButton)

        self.viewButton = QtWidgets.QToolButton(self)
        self.viewButton.clicked.connect(self._toggle_rel)
        self.viewButton.setToolTip("Switch between relative and absolute view")
        self._icon_manager.set_icon(self.viewButton, "depth_profile_abs.svg")
        self.mpl_toolbar.addWidget(self.viewButton)

        # Log scale & ignore elements button
        self.mpl_toolbar.addSeparator()
        self._button_toggle_log = QtWidgets.QToolButton(self)
        self._button_toggle_log.clicked.connect(self._toggle_log_scale)
        self._button_toggle_log.setCheckable(True)
        self._button_toggle_log.setToolTip(
            "Toggle logarithmic Y axis scaling.")
        self._icon_manager.set_icon(self._button_toggle_log,
                                    "monitoring_section.svg")
        self.mpl_toolbar.addWidget(self._button_toggle_log)

        self._button_toggle_absolute = QtWidgets.QToolButton(self)
        self._button_toggle_absolute.clicked.connect(
            self._toggle_absolute_values)
        self._button_toggle_absolute.setCheckable(True)
        self._button_toggle_absolute.setToolTip(
            "Toggle absolute values for elements.")
        self._icon_manager.set_icon(self._button_toggle_absolute, "color.svg")
        self.mpl_toolbar.addWidget(self._button_toggle_absolute)

        self._button_ignores = QtWidgets.QToolButton(self)
        self._button_ignores.clicked.connect(self._ignore_elements_dialog)
        self._button_ignores.setToolTip(
            "Select elements which are included in "
            "ratio calculation.")
        self._icon_manager.set_icon(self._button_ignores, "gear.svg")
        self.mpl_toolbar.addWidget(self._button_ignores)
Esempio n. 2
0
    def __fork_toolbar_buttons(self):
        self.mpl_toolbar.mode_tool = 0
        self.__tool_label, self.__button_drag, self.__button_zoom = \
            mpl_utils.get_toolbar_elements(
                self.mpl_toolbar, drag_callback=self.__toggle_tool_drag,
                zoom_callback=self.__toggle_tool_zoom)

        # Make own buttons
        self.mpl_toolbar.addSeparator()
        self.elementSelectionButton = QtWidgets.QToolButton(self)
        self.elementSelectionButton.clicked.connect(
            self.enable_element_selection)
        self.elementSelectionButton.setCheckable(True)
        self.__icon_manager.set_icon(self.elementSelectionButton, "select.png")
        self.elementSelectionButton.setToolTip("Select element area")
        self.mpl_toolbar.addWidget(self.elementSelectionButton)

        # Selection undo button
        self.elementSelectUndoButton = QtWidgets.QToolButton(self)
        self.elementSelectUndoButton.clicked.connect(self.undo_point)
        self.__icon_manager.set_icon(self.elementSelectUndoButton, "undo.png")
        self.elementSelectUndoButton.setToolTip(
            "Undo last point in open selection")
        self.elementSelectUndoButton.setEnabled(False)
        self.mpl_toolbar.addWidget(self.elementSelectUndoButton)
        self.mpl_toolbar.addSeparator()

        # Element Selection selecting tool
        self.elementSelectionSelectButton = QtWidgets.QToolButton(self)
        self.elementSelectionSelectButton.clicked.connect(
            self.enable_selection_select)
        self.elementSelectionSelectButton.setCheckable(True)
        self.elementSelectionSelectButton.setEnabled(False)
        self.__icon_manager.set_icon(self.elementSelectionSelectButton,
                                     "selectcursor.png")
        self.elementSelectionSelectButton.setToolTip(
            "Select element selection")
        self.mpl_toolbar.addWidget(self.elementSelectionSelectButton)

        # Selection delete button
        self.elementSelectDeleteButton = QtWidgets.QToolButton(self)
        self.elementSelectDeleteButton.setEnabled(False)
        self.elementSelectDeleteButton.clicked.connect(self.remove_selected)
        self.__icon_manager.set_icon(self.elementSelectDeleteButton, "del.png")
        self.elementSelectDeleteButton.setToolTip("Delete selected selection")
        self.mpl_toolbar.addWidget(self.elementSelectDeleteButton)
        self.mpl_toolbar.addSeparator()

        # Selection delete all -button
        self.elementSelectionDeleteButton = QtWidgets.QToolButton(self)
        self.elementSelectionDeleteButton.clicked.connect(
            self.remove_all_selections)
        self.__icon_manager.set_icon(self.elementSelectionDeleteButton,
                                     "delall.png")
        self.elementSelectionDeleteButton.setToolTip("Delete all selections")
        self.mpl_toolbar.addWidget(self.elementSelectionDeleteButton)
Esempio n. 3
0
 def __init__(self, parent):
     super().__init__(parent)
     self.pareto_front = None
     self.automatic_readjustment = True
     self.axes.set_yscale("symlog")
     self.x_range = None, None
     self.y_range = None, None
     self.home_btn = self.mpl_toolbar.children()[4]
     _, self.drag_btn, self.zoom_btn = mpl_utils.get_toolbar_elements(
         self.mpl_toolbar,
         drag_callback=lambda: self.set_autoadjustment(False),
         zoom_callback=lambda: self.set_autoadjustment(False))
     self.home_btn.clicked.connect(lambda: self.set_autoadjustment(True))
Esempio n. 4
0
    def __fork_toolbar_buttons(self):
        """Custom toolbar buttons be here.
        """
        self.__tool_label, self.__button_drag, self.__button_zoom = \
            mpl_utils.get_toolbar_elements(
                self.mpl_toolbar, drag_callback=self.__uncheck_custom_buttons,
                zoom_callback=self.__uncheck_custom_buttons)

        self.limButton = QtWidgets.QToolButton(self)
        self.limButton.clicked.connect(self.__limit_button_click)
        self.limButton.setCheckable(True)
        self.limButton.setToolTip(
            "Change timing's low and high limits for more accurate coincidence "
            "reading.")
        self.icon_manager.set_icon(self.limButton, "amarok_edit.svg")
        self.mpl_toolbar.addWidget(self.limButton)
Esempio n. 5
0
    def __fork_toolbar_buttons(self):
        """
        Forks the toolbar into custom buttons.
        """
        self.mpl_toolbar.mode_tool = 0
        self.__tool_label, self.__button_drag, self.__button_zoom = \
            mpl_utils.get_toolbar_elements(
                self.mpl_toolbar, drag_callback=self.__toggle_tool_drag,
                zoom_callback=self.__toggle_tool_zoom)

        # Make own buttons
        self.mpl_toolbar.addSeparator()

        # Black magic to make the following action work
        temp_button = QtWidgets.QToolButton(self)
        temp_button.clicked.connect(lambda: self.__add_layer())
        self.mpl_toolbar.removeAction(self.mpl_toolbar.addWidget(temp_button))

        # Action for adding a new layer
        action_add_layer = QtWidgets.QAction("Add layer", self)
        action_add_layer.triggered.connect(lambda: self.__add_layer())
        action_add_layer.setToolTip("Add layer")
        # TODO: Change icon!
        self.__icon_manager.set_icon(action_add_layer, "add.png")
        self.mpl_toolbar.addAction(action_add_layer)

        # Action for modifying the selected layer
        action_modify_layer = QtWidgets.QAction("Modify selected layer", self)
        action_modify_layer.triggered.connect(lambda: self.__modify_layer())
        action_modify_layer.setToolTip("Modify selected layer")
        self.__icon_manager.set_icon(action_modify_layer, "amarok_edit.svg")
        action_modify_layer.setEnabled(False)
        self.mpl_toolbar.addAction(action_modify_layer)

        self.__layer_actions.append(action_modify_layer)

        # Action for deleting the selected layer
        action_delete_layer = QtWidgets.QAction("Delete selected layer", self)
        action_delete_layer.triggered.connect(lambda: self.__delete_layer())
        action_delete_layer.setToolTip("Delete the selected layer")
        self.__icon_manager.set_icon(action_delete_layer, "del.png")
        action_delete_layer.setEnabled(False)
        self.mpl_toolbar.addAction(action_delete_layer)

        self.__layer_actions.append(action_delete_layer)
Esempio n. 6
0
    def __fork_toolbar_buttons(self):
        """
        Fork navigation tool bar button into custom ones.
        """
        self.mpl_toolbar.mode_tool = 0

        self.__tool_label, self.__button_drag, self.__button_zoom = \
            mpl_utils.get_toolbar_elements(
                self.mpl_toolbar, drag_callback=self.__toggle_tool_drag,
                zoom_callback=self.__toggle_tool_zoom)

        # Make own buttons
        self.mpl_toolbar.addSeparator()

        # Coordinates widget
        self.coordinates_widget = PointCoordinatesWidget(self, optimize=True)
        self.coordinates_action = self.mpl_toolbar.addWidget(
            self.coordinates_widget)

        self.coordinates_widget.y_coordinate_box.setEnabled(False)
        self.coordinates_widget.x_coordinate_box.setEnabled(False)