Ejemplo n.º 1
0
    def __init__(self, ris_widget, menu):
        self.masks = dict(self.DEFAULT_MASKS)
        self.layer_stack = ris_widget.layer_stack
        self.mask_circle = centered_circle.CenteredCircle(ris_widget)
        self.mask_circle.hide()
        self.mask_circle.geometry_change_callbacks.append(
            self.geometry_changed)

        self.display_mask = _MaskRegion(ris_widget)

        hist_mask = menu.addMenu('Histogram Mask')
        mask_actions = Qt.QActionGroup(menu)
        no_mask = Qt.QAction('No Mask', mask_actions)
        no_mask.setCheckable(True)
        no_mask.toggled.connect(
            lambda checked: self.mask_toggled(checked, None))

        mask_07 = Qt.QAction('0.7\N{MULTIPLICATION SIGN} Coupler',
                             mask_actions)
        mask_07.setCheckable(True)
        mask_07.toggled.connect(
            lambda checked: self.mask_toggled(checked, 0.7))

        mask_1 = Qt.QAction('1\N{MULTIPLICATION SIGN} Coupler', mask_actions)
        mask_1.setCheckable(True)
        mask_1.toggled.connect(lambda checked: self.mask_toggled(checked, 1))

        self.custom_mask = Qt.QAction('Custom Mask', mask_actions)
        self.custom_mask.setCheckable(True)
        self.custom_mask.toggled.connect(
            lambda checked: self.mask_toggled(checked, 'custom'))

        hist_mask.addActions(mask_actions.actions())
        hist_mask.addSeparator()
        self.show_action = Qt.QAction('Show Mask')
        hist_mask.addAction(self.show_action)
        self.show_action.setCheckable(True)
        self.show_action.setChecked(False)
        self.show_action.toggled.connect(self.mask_circle.setVisible)

        no_mask.setChecked(True)
Ejemplo n.º 2
0
    def createActions(self):
        self.openFileAct = Qt.QAction("Open File", self)
        self.openFileAct.setShortcut("Ctrl+O")
        self.openFileAct.setStatusTip("Open File")

        self.setOutputFilePathAct = Qt.QAction("Set Output File Path", self)
        self.setOutputFilePathAct.setShortcut("Ctrl+P")
        self.setOutputFilePathAct.setStatusTip("Set Output File Path")

        self.addPathAct = Qt.QAction("Add Path", self)
        self.addPathAct.setShortcut("Ctrl+A")
        self.addPathAct.setStatusTip("Add Path")

        self.deletePathAct = Qt.QAction("Delete Path", self)
        self.deletePathAct.setShortcut("Ctrl+D")
        self.deletePathAct.setStatusTip("Delete Path")

        # Toggle Deep Scan On
        self.deepScanOnAct = Qt.QAction("On", self)
        self.deepScanOnAct.setStatusTip("Turn Deep Scan On")
        self.deepScanOnAct.setCheckable(True)
        # Toggle Deep Scan Off
        self.deepScanOffAct = Qt.QAction("Off", self)
        self.deepScanOffAct.setStatusTip("Turn Deep Scan Off")
        self.deepScanOffAct.setCheckable(True)
        # Toggle Deep Scan On/Off
        self.deepScanGroupAct = Qt.QActionGroup(self)
        self.deepScanGroupAct.addAction(self.deepScanOnAct)
        self.deepScanGroupAct.addAction(self.deepScanOffAct)
        self.deepScanOffAct.setChecked(True)

        self.runAct = Qt.QAction("Run Scan", self)
        self.runAct.setShortcut("Ctrl+R")
        self.runAct.setStatusTip("Run Scan")

        self.exitAct = Qt.QAction("Exit", self)
        self.exitAct.setShortcut("Ctrl+Q")
        self.exitAct.setStatusTip("Exit Application")