Exemple #1
0
    def __set_options_ui(self):
        group_box = QGroupBox('Training Options')
        inner_layout = QFormLayout()
        group_box.setLayout(inner_layout)

        self.iter_times = QSpinBox()
        self.iter_times.setRange(1, 1000000)
        self.iter_times.setValue(300)
        self.iter_times.setStatusTip('The total iterating times for training.')

        self.population_size = QSpinBox()
        self.population_size.setRange(1, 100000000)
        self.population_size.setValue(100)
        self.population_size.setStatusTip('The population size for genetic '
                                          'algorithm.')

        self.reproduction = QHBoxLayout()
        self.roulette_wheel_selection = QRadioButton('Roulette Wheel')
        self.tournament_selection = QRadioButton('Tournament')
        self.reproduction.addWidget(self.roulette_wheel_selection)
        self.reproduction.addWidget(self.tournament_selection)
        self.roulette_wheel_selection.toggle()

        self.score_amplifier = QDoubleSpinBox()
        self.score_amplifier.setRange(1, 3)
        self.score_amplifier.setValue(1.7)
        self.score_amplifier.setSingleStep(0.01)
        self.score_amplifier.setStatusTip('Amplify the winner score in '
                                          'selection (exponentially).')

        self.p_crossover = QDoubleSpinBox()
        self.p_crossover.setRange(0, 1)
        self.p_crossover.setValue(0.5)
        self.p_crossover.setSingleStep(0.1)
        self.p_crossover.setStatusTip('The probability of crossover for '
                                      'genetic algorithm.')

        self.p_mutation = QDoubleSpinBox()
        self.p_mutation.setRange(0, 1)
        self.p_mutation.setValue(0.5)
        self.p_mutation.setSingleStep(0.1)
        self.p_mutation.setStatusTip('The probability of mutation for '
                                     'genetic algorithm.')

        self.mutation_scale = QDoubleSpinBox()
        self.mutation_scale.setDecimals(3)
        self.mutation_scale.setRange(0.001, 0.5)
        self.mutation_scale.setValue(0.1)
        self.mutation_scale.setSingleStep(0.1)
        self.mutation_scale.setStatusTip(
            'The scale of random noise in '
            'mutation for genetic algorithm. Full '
            'scale (s=1) creates the noise which '
            'range is the domain of parameter of '
            'chromosome itself.')

        self.nneuron = QSpinBox()
        self.nneuron.setRange(1, 1000)
        self.nneuron.setValue(6)
        self.nneuron.setStatusTip('The number of RBFN neuron.')

        self.sd_max = QDoubleSpinBox()
        self.sd_max.setRange(0.01, 20)
        self.sd_max.setValue(10)
        self.sd_max.setSingleStep(0.1)
        self.sd_max.setStatusTip('The maximum of standard deviation of each '
                                 'neuron in RBFN (only for initialization).')

        inner_layout.addRow('Iterating Times:', self.iter_times)
        inner_layout.addRow('Population Size:', self.population_size)
        inner_layout.addRow('Reproduction:', self.reproduction)
        inner_layout.addRow('Score Amplifier:', self.score_amplifier)
        inner_layout.addRow('Crossover Probability:', self.p_crossover)
        inner_layout.addRow('Mutation Probability:', self.p_mutation)
        inner_layout.addRow('Mutation Scale:', self.mutation_scale)
        inner_layout.addRow('Number of Neuron:', self.nneuron)
        inner_layout.addRow('Maximum of SD:', self.sd_max)

        self._layout.addWidget(group_box)
Exemple #2
0
    def build_contents(self):
        """Initialize all the ui components."""
        # self.setLayout(QGridLayout())
        # self.layout().setContentsMargins(0,0,0,0)
        self.setLayout(QVBoxLayout())

        # --- POSITION ---
        position_frame = QFrame()
        grid_layout = QGridLayout()
        grid_layout.setContentsMargins(0, 0, 0, 0)
        position_frame.setLayout(grid_layout)
        col = 0
        for p in position_params:
            if p != '.':
                value = self.cs8.get(p)
                label_text = p
                label = QLabel(label_text)
                label.font().setPointSize(8)
                widget = QDoubleSpinBox()
                widget.setFixedWidth(100)
                widget.setMinimum(-99999)
                widget.setMaximum(99999)
                widget.setValue(float(value))
                controller = WidgetController(self, p, widget)
                widget.setEnabled(False)
                grid_layout.addWidget(label, 0, col)
                grid_layout.addWidget(widget, 1, col)
                col += 1
                self.widget_controllers[p] = controller
        # self.layout().addWidget(position_frame,0,0)
        self.layout().addWidget(position_frame)

        # --- STATE ---
        state_frame = QFrame()
        grid_layout = QGridLayout()
        grid_layout.setContentsMargins(0, 0, 0, 0)
        state_frame.setLayout(grid_layout)
        row = 0
        col = 0
        for p in state_params:
            value = self.cs8.get(p)
            label_text = None
            if len(p) < 30:
                label_text = p
            elif len(p) < 50:
                label_text = p[:25] + '\n' + p[25:]
            elif len(p) < 75:
                label_text = p[:25] + '\n' + p[25:50] + '\n' + p[50:]
            elif len(p) < 100:
                label_text = p[:25] + '\n' + p[25:50] + \
                    '\n' + p[50:75] + '\n' + p[75:]
            label = QLabel(label_text)
            label.font().setPointSize(8)
            controller = None

            if p.endswith('NAME'):
                widget = QLineEdit()
                widget.setFixedWidth(100)
                controller = WidgetController(self, p, widget)
                widget.setEnabled(False)
            elif p.endswith('1_0'):
                # It is a boolean flag
                widget = QCheckBox()
                widget.setFixedSize(15, 15)
                checked = (value == '1')
                widget.setChecked(checked)
                controller = WidgetController(self, p, widget)
                widget.setEnabled(False)
            else:
                widget = QDoubleSpinBox()
                widget.setFixedWidth(100)
                widget.setMinimum(-99999.0)
                widget.setMaximum(99999.0)
                widget.setValue(float(value))
                controller = WidgetController(self, p, widget)
                widget.setEnabled(False)
            grid_layout.addWidget(label, row, col)
            grid_layout.addWidget(widget, row, col + 1)
            col += 2
            if col == 8:
                col = 0
                row += 1
            self.widget_controllers[p] = controller
        state_sa = QScrollArea(self)
        state_sa.setWidget(state_frame)
        state_label = QLabel('State')
        # self.layout().addWidget(state_sa,1,0)
        self.layout().addWidget(state_sa)

        # --- DI ---
        di_frame = QFrame()
        grid_layout = QGridLayout()
        grid_layout.setContentsMargins(0, 0, 0, 0)
        di_frame.setLayout(grid_layout)
        row = 0
        col = 0
        for p in di_params:
            if p != '.':
                value = self.cs8.get(p)
                label_text = p
                label = QLabel(label_text)
                label.font().setPointSize(8)
                if label_text.startswith('PRI'):
                    label.font().setBold(True)
                widget = QCheckBox()
                widget.setFixedSize(15, 15)
                checked = (value == '1')
                widget.setChecked(checked)
                param_help = di_help[p]
                tooltip = 'Unchecked: %s\nChecked: %s' % (
                    param_help[0], param_help[1])
                widget.setToolTip(tooltip)
                label.setToolTip(tooltip)
                controller = WidgetController(self, p, widget)
                widget.setEnabled(False)
                di_frame.layout().addWidget(widget, row, col)
                di_frame.layout().addWidget(label, row, col + 1)
                col += 2
                if col == 12:
                    col = 0
                    row += 1
                self.widget_controllers[p] = controller

        di_sa = QScrollArea(self)
        di_sa.setWidget(di_frame)
        di_label = QLabel('Digital Inputs')
        # self.layout().addWidget(di_sa,2,0)
        self.layout().addWidget(di_sa)

        # --- DO ---
        do_frame = QFrame()
        grid_layout = QGridLayout()
        grid_layout.setContentsMargins(0, 0, 0, 0)
        do_frame.setLayout(grid_layout)
        row = 0
        col = 0
        for p in do_params:
            if p != '.':
                value = self.cs8.get(p)
                label_text = p
                label = QLabel(label_text)
                label.font().setPointSize(8)
                # 01/06/2011 JJ requirement, for USED PROs, set it bold
                if label_text.startswith(
                        'PRO') and not label_text.startswith('PROCESS'):
                    label.font().setBold(True)
                widget = QCheckBox()
                widget.setFixedSize(15, 15)
                checked = (value == '1')
                widget.setChecked(checked)
                param_help = do_help[p]
                tooltip = 'Unchecked: %s\nChecked: %s' % (
                    param_help[0], param_help[1])
                widget.setToolTip(tooltip)
                label.setToolTip(tooltip)
                controller = WidgetController(self, p, widget)
                widget.setEnabled(False)
                grid_layout.addWidget(widget, row, col)
                grid_layout.addWidget(label, row, col + 1)
                col += 2
                if col == 14:
                    col = 0
                    row += 1
                self.widget_controllers[p] = controller
        do_sa = QScrollArea(self)
        do_sa.setWidget(do_frame)
        do_label = QLabel('Digital Outputs')
        # self.layout().addWidget(do_sa,3,0)
        self.layout().addWidget(do_sa)

        # --- LOG ---
        self.log = QTextEdit()
        # self.layout().addWidget(self.log,4,0)
        self.layout().addWidget(self.log)

        # --- STATUS MESSAGE ---
        self.msg_lbl = QLabel()
        p = 'message'
        controller = WidgetController(self, p, self.msg_lbl)
        self.widget_controllers[p] = controller
        # self.layout().addWidget(self.msg_lbl,5,0)
        self.layout().addWidget(self.msg_lbl)
    def setupUi(self, Dialog):
        self.source_dir = ''
        self.result_dir = ''
        self.color_map = '' 
        self.scale = ''

        self.CM =['AUTUMN','BONE','JET','WINTER','RAINBOW','OCEAN',
        'SUMMER','SPRING','COOL','HSV','PINK','HOT']
        self.dataList = [*range(12)]
        Dialog.setObjectName("Dialog")
        Dialog.resize(446, 316)
        self.buttonBox = QDialogButtonBox(Dialog)
        self.buttonBox.setGeometry(QRect(20, 250, 381, 32))
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.gridLayoutWidget = QWidget(Dialog)
        self.gridLayoutWidget.setGeometry(QRect(20, 10, 381, 211))
        self.gridLayoutWidget.setObjectName("gridLayoutWidget")
        self.gridLayout = QGridLayout(self.gridLayoutWidget)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setObjectName("gridLayout")
        self.sourceDirectoryLineEdit = QLineEdit(self.gridLayoutWidget)
        self.sourceDirectoryLineEdit.setObjectName("sourceDirectoryLineEdit")
        self.gridLayout.addWidget(self.sourceDirectoryLineEdit, 0, 1, 1, 1)
        self.resultDirectoryLineEdit = QLineEdit(self.gridLayoutWidget)
        self.resultDirectoryLineEdit.setObjectName("resultDirectoryLineEdit")
        self.gridLayout.addWidget(self.resultDirectoryLineEdit, 1, 1, 1, 1)
        self.resultsDirectoryLabel = QLabel(self.gridLayoutWidget)
        self.resultsDirectoryLabel.setObjectName("resultsDirectoryLabel")
        self.gridLayout.addWidget(self.resultsDirectoryLabel, 1, 0, 1, 1)
        self.sourceDirectoryToolButton = QToolButton(self.gridLayoutWidget)
        self.sourceDirectoryToolButton.setObjectName("sourceDirectoryToolButton")
        self.gridLayout.addWidget(self.sourceDirectoryToolButton, 0, 2, 1, 1)
        self.resultDirectoryToolButton = QToolButton(self.gridLayoutWidget)
        self.resultDirectoryToolButton.setObjectName("resultDirectoryToolButton")
        self.gridLayout.addWidget(self.resultDirectoryToolButton, 1, 2, 1, 1)
        self.scaleSpinBox = QDoubleSpinBox(self.gridLayoutWidget)
        self.scaleSpinBox.setMaximumSize(QSize(50, 20))
        font = QFont()
        font.setBold(True)
        font.setWeight(75)
        self.scaleSpinBox.setFont(font)
        self.scaleSpinBox.setMinimum(0.01)
        self.scaleSpinBox.setMaximum(10.0)
        self.scaleSpinBox.setSingleStep(0.05)
        self.scaleSpinBox.setProperty("value", 1.0)
        self.scaleSpinBox.setObjectName("scaleSpinBox")
        self.gridLayout.addWidget(self.scaleSpinBox, 4, 1, 1, 1)
        self.sourceDirectoryLabel = QLabel(self.gridLayoutWidget)
        self.sourceDirectoryLabel.setObjectName("sourceDirectoryLabel")
        self.gridLayout.addWidget(self.sourceDirectoryLabel, 0, 0, 1, 1)
        self.scaleLabel = QLabel(self.gridLayoutWidget)
        self.scaleLabel.setObjectName("scaleLabel")
        self.gridLayout.addWidget(self.scaleLabel, 4, 0, 1, 1)
        self.colorMapLabel = QLabel(self.gridLayoutWidget)
        self.colorMapLabel.setObjectName("colorMapLabel")
        self.gridLayout.addWidget(self.colorMapLabel, 2, 0, 1, 1)
        self.CMcomboBox = CheckableComboBox(self.gridLayoutWidget)
        self.CMcomboBox.setObjectName("CMcomboBox")
        self.gridLayout.addWidget(self.CMcomboBox, 2, 1, 1, 1)
        
        self.retranslateUi(Dialog)
        self.buttonBox.accepted.connect(self.acceptAndSave)
        self.buttonBox.rejected.connect(Dialog.reject)
        QMetaObject.connectSlotsByName(Dialog)

        self.sourceDirectoryToolButton.clicked.connect(self._source_dir_dialog)
        self.resultDirectoryToolButton.clicked.connect(self._result_dir_dialog)
        
        self.readINI()
Exemple #4
0
 def get_number_display(self):
     spin_box = QDoubleSpinBox()
     spin_box.setDecimals(2)
     spin_box.setSingleStep(0.01)
     return spin_box
Exemple #5
0
    def __init__(self):
        super(MainWindow, self).__init__()
        """Overall layout of the main window."""
        self.setWindowTitle('Plot segmentation')
        self.resize(self.sizeHint())
        
        ## initialization
        self.field_image = None
        self.displaySize = 400
        self.threshold = 0.20
        self.noise = 200
        self.pix4D = None
        self.rawImgFold = None

        ## definition
        self.text_intro = QLabel('LOAD FIELD IMAGE')
        self.text_intro.setAlignment(Qt.AlignCenter)
        self.text_screenSize = QLabel('Select your screen resolution:')
        self.text_screenSize2 = QLabel('(If the size is not in the list, please choose a smaller size.)')
        self.comboBox_screenSize = QComboBox()
        self.comboBox_screenSize.addItem('1024 x 640 pixels')
        self.comboBox_screenSize.addItem('1280 x 800 pixels')
        self.comboBox_screenSize.addItem('1440 x 900 pixels')
        self.comboBox_screenSize.addItem('1680 x 1050 pixels')        
        self.comboBox_screenSize.addItem('2048 x 1152 pixels')
        self.comboBox_screenSize.addItem('2560 x 1140 pixels')
        self.comboBox_screenSize.addItem('3200 x 1800 pixels')
        self.text_fieldImage = QLabel('Choose the field image: ')
        self.button_fieldImage = QPushButton('Choose')
        self.text_image = QLabel('Image chosen:')
        self.text_imagePath = QLabel(str(self.field_image))
        self.button_drawField = QPushButton('Draw field shape')
        self.button_getBinary = QPushButton('Convert to binary')
        self.check_binary = QCheckBox('Check this if the chosen image is already a binary')
        self.text_threshold = QLabel('ExG threshold to create binary:')
        self.text_threshold2 = QLabel('0.20 usually works. Set to 1.00 for automatic.')
        self.spinbox_threshold = QDoubleSpinBox()
        self.spinbox_threshold.setRange(0.00, 1.00)
        self.spinbox_threshold.setSingleStep(0.05)
        self.spinbox_threshold.setValue(0.20)
        self.text_noise = QLabel('Minimum feature size for noise removal (px):')
        self.spinbox_noise = QSpinBox()
        self.spinbox_noise.setRange(1, 10000)
        self.spinbox_noise.setValue(200)
        
        self.text_plot = QLabel('PLOT PARAMETERS')
        self.text_plot.setAlignment(Qt.AlignCenter)
        self.text_nbOfRowPerPlot = QLabel('Number of plant rows per plot:')
        self.spinbox_nbOfRowPerPlot = QSpinBox()
        self.spinbox_nbOfRowPerPlot.setRange(1, 100)
        self.spinbox_nbOfRowPerPlot.setSingleStep(1)
        self.spinbox_nbOfRowPerPlot.setValue(1)
        self.text_nbOfColumnPerPlot = QLabel('Number of ranges per plot:')
        self.spinbox_nbOfColumnPerPlot = QSpinBox()
        self.spinbox_nbOfColumnPerPlot.setRange(1, 100)
        self.spinbox_nbOfColumnPerPlot.setSingleStep(1)
        self.spinbox_nbOfColumnPerPlot.setValue(1)
        self.text_plotArrangment = QLabel('Global orientation of the ranges:')
        self.radio_horizontal = QRadioButton('Horizontal\t\t\t')
        self.radio_horizontal.setChecked(True)
        self.radio_vertical = QRadioButton('Vertical')
        self.radio_vertical.setChecked(False)
        self.button_apply = QPushButton('Identify plots')

        self.text_intro_revCal = QLabel('CALCULATE PLOT COORDINATES IN RAW IMAGES')
        self.text_intro_revCal.setAlignment(Qt.AlignCenter)
        self.text_pix4D = QLabel('Pix4D project folder:')
        self.button_pix4D = QPushButton('Choose')
        self.text_rawImgFold = QLabel('Raw images folder:')
        self.button_rawImgFold = QPushButton('Choose')
        self.button_apply_revCal = QPushButton('Apply')
        
        ## connections
        self.button_fieldImage.clicked.connect(self.fieldImage_clicked)
        self.button_drawField.clicked.connect(self.drawField_clicked)
        self.comboBox_screenSize.activated.connect(self.ScreenSizeFunction)
        self.button_getBinary.clicked.connect(self.getBinary_clicked)
        self.button_apply.clicked.connect(self.application)
        self.button_pix4D.clicked.connect(self.button_pix4D_clicked)
        self.button_rawImgFold.clicked.connect(self.button_rawImgFold_clicked)
        self.button_apply_revCal.clicked.connect(self.button_apply_revCal_clicked)
        
        ## options
        self.text_screenSize.hide()
        self.text_screenSize2.hide()
        self.comboBox_screenSize.hide()
        self.check_binary.hide()
        self.text_threshold.hide()
        self.text_threshold2.hide()
        self.spinbox_threshold.hide()
        self.text_noise.hide()
        self.spinbox_noise.hide()
        self.button_drawField.hide()
        self.text_imagePath.hide()
        self.text_image.hide()
        self.text_plot.hide()
        self.button_getBinary.hide()
        self.text_nbOfColumnPerPlot.hide()
        self.spinbox_nbOfColumnPerPlot.hide()
        self.text_nbOfRowPerPlot.hide()
        self.spinbox_nbOfRowPerPlot.hide()
        self.button_apply.hide()
        self.text_plotArrangment.hide()
        self.radio_horizontal.hide()
        self.radio_vertical.hide()
        self.text_intro_revCal.hide()
        self.text_pix4D.hide()
        self.button_pix4D.hide()
        self.text_rawImgFold.hide()
        self.button_rawImgFold.hide()
        self.button_apply_revCal.hide()
        
        ## layout
        self.layout = QGridLayout()
        self.layout.addWidget(self.text_intro, 1, 0, 1, -1)
        self.layout.addWidget(self.text_fieldImage, 2, 0)
        self.layout.addWidget(self.button_fieldImage, 2, 1, 1, -1)
        self.layout.addWidget(self.text_image, 3, 0)
        self.layout.addWidget(self.text_imagePath, 3, 1, 1, -1)
        self.layout.addWidget(self.check_binary, 4, 1, 1, -1)
        self.layout.addWidget(self.text_noise, 5, 0)
        self.layout.addWidget(self.spinbox_noise, 5, 1)
        self.layout.addWidget(self.text_screenSize, 6, 0)
        self.layout.addWidget(self.comboBox_screenSize, 6, 1)
        self.layout.addWidget(self.text_screenSize2, 6, 2, 1, 3)
        self.layout.addWidget(self.button_drawField, 7, 0, 1, -1)
        
        self.layout.addWidget(self.text_threshold, 8, 0)
        self.layout.addWidget(self.spinbox_threshold, 8, 1)
        self.layout.addWidget(self.text_threshold2, 8, 2, 1, -1)
        self.layout.addWidget(self.button_getBinary, 9, 0, 1, -1)
        
        self.layout.addWidget(self.text_plot,10, 0, 1, -1)
        self.layout.addWidget(self.text_nbOfRowPerPlot, 11, 0)
        self.layout.addWidget(self.spinbox_nbOfRowPerPlot, 11, 1, 1, -1)
        self.layout.addWidget(self.text_nbOfColumnPerPlot, 12, 0)
        self.layout.addWidget(self.spinbox_nbOfColumnPerPlot, 12, 1, 1, -1)
        self.layout.addWidget(self.text_plotArrangment, 13, 0)
        self.layout.addWidget(self.radio_horizontal, 13, 1)
        self.layout.addWidget(self.radio_vertical, 13, 2)
        self.layout.addWidget(self.button_apply, 14, 0, 1, -1)
        
        self.layout.addWidget(self.text_intro_revCal, 15, 0, 1, -1)
        self.layout.addWidget(self.text_pix4D, 16, 0)
        self.layout.addWidget(self.button_pix4D, 16, 1, 1, -1)
        self.layout.addWidget(self.text_rawImgFold, 17, 0)
        self.layout.addWidget(self.button_rawImgFold, 17, 1, 1, -1)
        self.layout.addWidget(self.button_apply_revCal, 18, 0, 1, -1)
        self.setLayout(self.layout)  
        
        self.show()
Exemple #6
0
    def __init__(self):
        super().__init__()
        """
        =======================================================================
        ----------------------------- Start of GUI ----------------------------
        =======================================================================
        """
        """
        # ---------------------- General widget settings ---------------------
        """
        self.setWindowTitle("Smartpatcher")
        """
        -------------------------- Hardware container -------------------------
        """
        hardwareContainer = QGroupBox("Hardware devices")
        hardwareLayout = QGridLayout()

        # Button to (dis)connect camera
        self.connect_camerathread_button = QPushButton(
            text="Camera", clicked=self.connect_camerathread)
        self.connect_camerathread_button.setCheckable(True)

        # Button to (dis)connect objective motor
        self.connect_objectivemotor_button = QPushButton(
            text="Objective motor", clicked=self.connect_objectivemotor)
        self.connect_objectivemotor_button.setCheckable(True)

        # Button to (dis)connect micromanipulator
        self.connect_micromanipulator_button = QPushButton(
            text="Micromanipulator", clicked=self.connect_micromanipulator)
        self.connect_micromanipulator_button.setCheckable(True)

        # Button to (dis)connect XYstage
        self.connect_XYstage_button = QPushButton(text="XY stage",
                                                  clicked=self.connect_XYstage)
        self.connect_XYstage_button.setCheckable(True)

        # Button to (dis)connect NIDAQ for sealtest
        self.connect_sealtestthread_button = QPushButton(
            text="NIDAQ/Sealtest", clicked=self.connect_sealtestthread)
        self.connect_sealtestthread_button.setCheckable(True)

        # Button to (dis)connect pressure controller
        self.connect_pressurecontroller_button = QPushButton(
            text="Pressure controller", clicked=self.connect_pressurethread)
        self.connect_pressurecontroller_button.setCheckable(True)

        hardwareLayout.addWidget(self.connect_camerathread_button, 0, 0, 1, 1)
        hardwareLayout.addWidget(self.connect_objectivemotor_button, 1, 0, 1,
                                 1)
        hardwareLayout.addWidget(self.connect_micromanipulator_button, 2, 0, 1,
                                 1)
        hardwareLayout.addWidget(self.connect_XYstage_button, 3, 0, 1, 1)
        hardwareLayout.addWidget(self.connect_sealtestthread_button, 4, 0, 1,
                                 1)
        hardwareLayout.addWidget(self.connect_pressurecontroller_button, 5, 0,
                                 1, 1)
        hardwareContainer.setLayout(hardwareLayout)
        """
        --------------------------- Stage movements ---------------------------
        """
        stagemoveContainer = QGroupBox("Stage move")
        stagemoveLayout = QGridLayout()

        # Stage translation
        request_stage_up_button = QPushButton(text="up",
                                              clicked=self.request_stage_up)
        request_stage_down_button = QPushButton(
            text="down", clicked=self.request_stage_down)
        request_stage_right_button = QPushButton(
            text="right", clicked=self.request_stage_right)
        request_stage_left_button = QPushButton(
            text="left", clicked=self.request_stage_left)

        # Button for moving target to center
        request_target2center_button = QPushButton(
            text="Target to center", clicked=self.request_target2center)
        request_target2center_button.setToolTip("Brings target ROI to the center of the field-of-view.\n"+ \
                                                "Make sure that a target is set.")

        stagemoveLayout.addWidget(request_stage_up_button, 0, 1, 1, 1)
        stagemoveLayout.addWidget(request_stage_down_button, 2, 1, 1, 1)
        stagemoveLayout.addWidget(request_stage_right_button, 1, 2, 1, 1)
        stagemoveLayout.addWidget(request_stage_left_button, 1, 0, 1, 1)
        stagemoveLayout.addWidget(request_target2center_button, 3, 0, 1, 3)
        stagemoveContainer.setLayout(stagemoveLayout)
        """
        ------------------------- Calibration options -------------------------
        """
        calibrationContainer = QGroupBox("Calibration options")
        calibrationLayout = QGridLayout()

        # Calibration algorithms
        request_calibrate_xy_button = QPushButton(
            text="Calibrate XY", clicked=self.request_calibrate_xy)
        request_calibrate_pixelsize_button = QPushButton(
            text="Calibrate pixelsize",
            clicked=self.request_calibrate_pixelsize)
        request_calibrate_xy_button.setToolTip("Aligns the micromanipulator axes with the pixel rows and columns on screen.\n"+ \
                                               "Performs best with the pipette tip ~10μm below focus")
        request_calibrate_pixelsize_button.setToolTip("Calibrates the pixelsize. Use this if 'Target to center' and"+ \
                                                      " 'Start target approach' miss their target. \nPerforms best with the pipette tip ~10μm below focus")

        # Calibration statistics
        rotation_angles_label = QLabel("Rotation axes (α,β,γ):")
        self.rotation_angles_value_label = QLabel("-")
        self.rotation_angles_value_label.setFont(
            QFont("Times", weight=QFont.Bold))
        rotation_angles_units_label = QLabel("degrees")
        pixelsize_label = QLabel("Pixelsize (hxw):")
        self.pixelsize_unit_label = QLabel("-")
        self.pixelsize_unit_label.setFont(QFont("Times", weight=QFont.Bold))
        pixelsize_units_label = QLabel("nm")

        calibrationLayout.addWidget(request_calibrate_xy_button, 0, 0, 1, 4)
        calibrationLayout.addWidget(request_calibrate_pixelsize_button, 1, 0,
                                    1, 4)
        calibrationLayout.addWidget(rotation_angles_label, 2, 0, 1, 1)
        calibrationLayout.addWidget(self.rotation_angles_value_label, 2, 1, 1,
                                    2)
        calibrationLayout.addWidget(rotation_angles_units_label, 2, 3, 1, 1)
        calibrationLayout.addWidget(pixelsize_label, 3, 0, 1, 1)
        calibrationLayout.addWidget(self.pixelsize_unit_label, 3, 1, 1, 2)
        calibrationLayout.addWidget(pixelsize_units_label, 3, 3, 1, 1)
        calibrationContainer.setLayout(calibrationLayout)
        """
        ------------------------- Camera view display -------------------------
        """
        liveContainer = QGroupBox("Field-of-view")
        liveContainer.setMinimumWidth(700)
        liveLayout = QGridLayout()

        # Display to project live camera view
        liveWidget = pg.ImageView()
        liveWidget.ui.roiBtn.hide()
        liveWidget.ui.menuBtn.hide()
        liveWidget.ui.histogram.hide()
        self.liveView = liveWidget.getView()
        self.liveImageItem = liveWidget.getImageItem()
        self.liveImageItem.setAutoDownsample(True)

        # Button for pausing camera view
        self.request_pause_button = QPushButton(text="Pause live",
                                                clicked=self.toggle_pauselive)
        self.request_pause_button.setCheckable(True)

        # Button for clearing phantoms
        request_clear_drawings = QPushButton(text="Clear phantoms",
                                             clicked=self.clearROIs)

        # Button for reseting the field of view
        request_reset_fov = QPushButton(text="Reset view",
                                        clicked=self.reset_imageview)

        # Button for snapshotting
        self.request_snap_button = QPushButton(text="Take snap",
                                               clicked=self.request_snap)

        liveLayout.addWidget(liveWidget, 0, 0, 1, 4)
        liveLayout.addWidget(self.request_pause_button, 1, 0, 1, 1)
        liveLayout.addWidget(request_clear_drawings, 1, 1, 1, 1)
        liveLayout.addWidget(request_reset_fov, 1, 2, 1, 1)
        liveLayout.addWidget(self.request_snap_button, 1, 3, 1, 1)
        liveContainer.setLayout(liveLayout)
        """
        ---------------------- Autopatch control buttons ----------------------
        """
        autopatchContainer = QGroupBox("Autoptach algorithms")
        autopatchLayout = QGridLayout()

        # Buttons for autopatch algorithms
        request_prechecks_button = QPushButton(text="Pre-checks",
                                               clicked=self.request_prechecks)
        request_selecttarget_button = QPushButton(
            text="Select target", clicked=self.request_selecttarget)
        request_confirmtarget_button = QPushButton(
            text="Confirm target", clicked=self.request_confirmtarget)
        request_start_autopatch_button = QPushButton(
            text="Start autopatch", clicked=self.request_start_autopatch)
        request_manual_adjustment_button = QPushButton(
            text="Correct tip", clicked=self.request_manual_adjustment)
        request_adjustment_confirm_button = QPushButton(
            text="Confirm tip", clicked=self.request_adjustment_confirm)
        request_start_approach_button = QPushButton(
            text="Start target approach", clicked=self.request_start_approach)
        request_start_gigaseal_button = QPushButton(
            text="Start gigaseal", clicked=self.request_start_gigaseal)
        request_start_breakin_button = QPushButton(
            text="Start break-in", clicked=self.request_start_breakin)
        self.request_stop_button = QPushButton(
            text="STOP!", clicked=self.request_emergency_stop)
        self.request_stop_button.setCheckable(True)
        self.request_stop_button.setToolTip("Do not spam! Leave it checked and the algorithm will\n"+ \
                                            " safely stop while stopping all motion devices.")

        # Labels for autopatch status and progress updates
        autopatch_status_label = QLabel("Autopatch status:")
        autopatch_progress_label = QLabel("Progress updates:")
        self.autopatch_status = QLabel("Ready")
        self.autopatch_progress = QLabel("-")
        self.autopatch_status.setFont(QFont("Times", weight=QFont.Bold))
        self.autopatch_progress.setFont(QFont("Times", weight=QFont.Bold))

        autopatchLayout.addWidget(request_prechecks_button, 0, 0, 1, 2)
        autopatchLayout.addWidget(request_selecttarget_button, 1, 0, 1, 1)
        autopatchLayout.addWidget(request_confirmtarget_button, 1, 1, 1, 1)
        autopatchLayout.addWidget(request_start_autopatch_button, 2, 0, 1, 2)
        autopatchLayout.addWidget(request_manual_adjustment_button, 3, 0, 1, 1)
        autopatchLayout.addWidget(request_adjustment_confirm_button, 3, 1, 1,
                                  1)
        autopatchLayout.addWidget(request_start_approach_button, 4, 0, 1, 2)
        autopatchLayout.addWidget(request_start_gigaseal_button, 5, 0, 1, 2)
        autopatchLayout.addWidget(request_start_breakin_button, 6, 0, 1, 2)
        autopatchLayout.addWidget(self.request_stop_button, 7, 0, 1, 2)
        autopatchLayout.addWidget(autopatch_status_label, 8, 0, 1, 2)
        autopatchLayout.addWidget(self.autopatch_status, 9, 0, 1, 2)
        autopatchLayout.addWidget(autopatch_progress_label, 10, 0, 1, 2)
        autopatchLayout.addWidget(self.autopatch_progress, 11, 0, 1, 2)
        autopatchContainer.setLayout(autopatchLayout)
        """
        ----------------------- Pressure control layout -----------------------
        """
        pressurecontrolContainer = QGroupBox(title="Pressure control")
        pressurecontrolLayout = QGridLayout()

        # Labels set and read pressure
        pressure_set_label = QLabel("Request pressure:")
        pressure_read_label = QLabel("Readout pressure:")
        pressure_units_label1 = QLabel("mBar")
        pressure_units_label2 = QLabel("mBar")

        # Spinbox to set pressure
        self.set_pressure_spinbox = QDoubleSpinBox()
        self.set_pressure_spinbox.setMinimum(-300)
        self.set_pressure_spinbox.setMaximum(200)
        self.set_pressure_spinbox.setDecimals(0)
        self.set_pressure_spinbox.setValue(0)
        self.set_pressure_spinbox.setSingleStep(10)

        # Label pressure readout value
        self.pressure_value_Label = QLabel("-")
        self.pressure_value_Label.setFont(QFont("Times", weight=QFont.Bold))

        # Label pressure status
        pressure_statustext_label = QLabel("Pressure status:")
        self.pressure_status_label = QLabel("-")
        self.pressure_status_label.setFont(QFont("Times", weight=QFont.Bold))

        # Buttons for relatively valued pressures
        low_positive_button = QPushButton(text="Low +",
                                          clicked=self.request_low_positive)
        low_negative_button = QPushButton(text="Low -",
                                          clicked=self.request_low_negative)
        high_positive_button = QPushButton(text="High +",
                                           clicked=self.request_high_positive)
        high_negative_button = QPushButton(text="High -",
                                           clicked=self.request_high_negative)
        stop_regulating_button = QPushButton(
            text="Set once", clicked=self.request_stop_regulating)
        atmoshpere_button = QPushButton(text="ATM",
                                        clicked=self.request_atmosphere)

        # Buttons for operating modes
        apply_pressure_button = QPushButton(
            text="Apply pressure", clicked=self.request_apply_pressure)
        spike_pulse_button = QPushButton(text="Apply pulse",
                                         clicked=self.request_apply_pulse)
        self.toggle_lcd_button = QPushButton(text="LCD off",
                                             clicked=self.toggle_lcd)
        self.toggle_lcd_button.setCheckable(True)

        pressurecontrolLayout.addWidget(pressure_set_label, 0, 0, 1, 2)
        pressurecontrolLayout.addWidget(self.set_pressure_spinbox, 0, 2, 1, 1)
        pressurecontrolLayout.addWidget(pressure_units_label1, 0, 3, 1, 1)
        pressurecontrolLayout.addWidget(pressure_read_label, 1, 0, 1, 2)
        pressurecontrolLayout.addWidget(self.pressure_value_Label, 1, 2, 1, 1)
        pressurecontrolLayout.addWidget(pressure_units_label2, 1, 3, 1, 1)
        pressurecontrolLayout.addWidget(pressure_statustext_label, 2, 0, 1, 2)
        pressurecontrolLayout.addWidget(self.pressure_status_label, 2, 2, 1, 2)
        pressurecontrolLayout.addWidget(low_positive_button, 3, 0, 1, 1)
        pressurecontrolLayout.addWidget(low_negative_button, 3, 1, 1, 1)
        pressurecontrolLayout.addWidget(high_positive_button, 4, 0, 1, 1)
        pressurecontrolLayout.addWidget(high_negative_button, 4, 1, 1, 1)
        pressurecontrolLayout.addWidget(stop_regulating_button, 5, 0, 1, 1)
        pressurecontrolLayout.addWidget(atmoshpere_button, 5, 1, 1, 1)
        pressurecontrolLayout.addWidget(apply_pressure_button, 3, 2, 1, 2)
        pressurecontrolLayout.addWidget(spike_pulse_button, 4, 2, 1, 2)
        pressurecontrolLayout.addWidget(self.toggle_lcd_button, 5, 2, 1, 2)
        pressurecontrolContainer.setLayout(pressurecontrolLayout)
        """
        -------------------------- Electrophysiology --------------------------
        """
        electrophysiologyContainer = QGroupBox("Electrophysiology")
        electrophysiologyLayout = QGridLayout()

        # Labels for electrophysiology
        resistance_label = QLabel("Resistance: ")
        self.resistance_value_label = QLabel("-")
        self.resistance_value_label.setFont(QFont("Times", weight=QFont.Bold))
        resistance_unit_label = QLabel("MΩ")
        capacitance_label = QLabel("Capacitance: ")
        self.capacitance_value_label = QLabel("-")
        self.capacitance_value_label.setFont(QFont("Times", weight=QFont.Bold))
        capacitance_unit_label = QLabel("F")
        ratio_label = QLabel("Ratio: ")
        self.ratio_value_label = QLabel("-")
        membranevoltage_label = QLabel("Membrane potential:")
        self.membranevoltage_value_label = QLabel("-")
        membranevoltage_unit_label = QLabel("V")

        request_zap_button = QPushButton(text="ZAP!", clicked=self.request_zap)

        electrophysiologyLayout.addWidget(resistance_label, 0, 0, 1, 1)
        electrophysiologyLayout.addWidget(self.resistance_value_label, 0, 1, 1,
                                          1)
        electrophysiologyLayout.addWidget(resistance_unit_label, 0, 2, 1, 1)
        electrophysiologyLayout.addWidget(capacitance_label, 1, 0, 1, 1)
        electrophysiologyLayout.addWidget(self.capacitance_value_label, 1, 1,
                                          1, 1)
        electrophysiologyLayout.addWidget(capacitance_unit_label, 1, 2, 1, 1)
        electrophysiologyLayout.addWidget(ratio_label, 2, 0, 1, 1)
        electrophysiologyLayout.addWidget(self.ratio_value_label, 2, 1, 1, 1)
        electrophysiologyLayout.addWidget(membranevoltage_label, 3, 0, 1, 1)
        electrophysiologyLayout.addWidget(self.membranevoltage_value_label, 3,
                                          1, 1, 1)
        electrophysiologyLayout.addWidget(membranevoltage_unit_label, 3, 2, 1,
                                          1)
        electrophysiologyLayout.addWidget(request_zap_button, 4, 0, 1, 1)
        electrophysiologyContainer.setLayout(electrophysiologyLayout)
        """
        --------------------------- Sensor display ----------------------------
        """
        sensorContainer = QGroupBox()
        sensorLayout = QGridLayout()

        # Algorithm plot
        algorithmPlotWidget = pg.PlotWidget()
        algorithmPlotWidget.setTitle("Sharpness graph")
        algorithmPlotWidget.setLabel("left", text="a.u.")
        algorithmPlotWidget.setLabel("bottom", text="height", units="μm")
        self.algorithmPlot = algorithmPlotWidget.plot(pen=(1, 4))

        # Current plot
        currentPlotWidget = pg.PlotWidget()
        currentPlotWidget.setTitle("Current")
        currentPlotWidget.setLabel("left", units="A")
        currentPlotWidget.setLabel("bottom", text="20 ms")
        self.currentPlot = currentPlotWidget.plot(pen=(2, 4))

        # Resistance plot
        resistancePlotWidget = pg.PlotWidget()
        resistancePlotWidget.setTitle("Resistance")
        resistancePlotWidget.setLabel("left", units="Ω")
        resistancePlotWidget.setLabel("bottom", text="20 ms")
        self.resistancePlot = resistancePlotWidget.plot(pen=(3, 4))

        # Pressure plot
        pressurePlotWidget = pg.PlotWidget()
        pressurePlotWidget.setTitle("Pressure")
        pressurePlotWidget.setLabel("left", units="mBar")
        pressurePlotWidget.setLabel("bottom", text="time", units="s")
        self.pressurePlot = pressurePlotWidget.plot(pen=(4, 4))

        # Reset plot button
        request_resetplots_button = QPushButton(text="Reset all plots",
                                                clicked=self.reset_plots)

        # Create plot tabs
        self.displayWidget = QTabWidget()
        self.displayWidget.addTab(algorithmPlotWidget, "Algorithm")
        self.displayWidget.addTab(resistancePlotWidget, "Resistance")
        self.displayWidget.addTab(currentPlotWidget, "Current")
        self.displayWidget.addTab(pressurePlotWidget, "Pressure")

        sensorLayout.addWidget(self.displayWidget, 0, 0, 1, 1)
        sensorLayout.addWidget(request_resetplots_button, 1, 0, 1, 1)
        sensorContainer.setLayout(sensorLayout)
        """
        ---------------------- Add widgets and set Layout ---------------------
        """
        layout = QGridLayout()
        layout.addWidget(hardwareContainer, 0, 0, 2, 1)
        layout.addWidget(stagemoveContainer, 2, 0, 2, 1)
        layout.addWidget(calibrationContainer, 4, 0, 1, 1)
        layout.addWidget(liveContainer, 0, 1, 5, 5)
        layout.addWidget(autopatchContainer, 0, 6, 2, 1)
        layout.addWidget(pressurecontrolContainer, 0, 7, 1, 1)
        layout.addWidget(electrophysiologyContainer, 1, 7, 1, 1)
        layout.addWidget(sensorContainer, 2, 6, 3, 2)
        self.setLayout(layout)
        """
        --------------------------- Stack old GUI's ---------------------------
        """
        """
        =======================================================================
        ------------------------ Start up roi manager -------------------------
        =======================================================================
        """
        self.roimanager = ROIManagerGUI(offset=len(self.liveView.addedItems))
        """
        =======================================================================
        -------------- Start up backend and connect signals/slots -------------
        =======================================================================
        """
        self.backend = SmartPatcher()
        self.backend.worker.draw.connect(self.draw_roi)
        self.backend.worker.graph1.connect(self.update_algorithmplot)
        self.backend.worker.graph2.connect(self.update_resistanceplot)
        self.backend.worker.status.connect(self.update_autopatch_status)
        self.backend.worker.progress.connect(self.update_autopatch_progress)
        self.backend.worker.finished.connect(
            self.update_constants_from_backend)
        """
        =======================================================================
        --------------------- Update constant from backend --------------------
        =======================================================================
        """
        self.update_constants_from_backend()
        """
Exemple #7
0
 def setupUi(self, SweepAllDlg):
     SweepAllDlg.setModal(True)
     layout = QVBoxLayout(SweepAllDlg)
     layout.setContentsMargins(8, 8, 8, 8)
     title = QLabel("<b><i>Sweep Rewards From All Masternodes</i></b>")
     title.setAlignment(Qt.AlignCenter)
     layout.addWidget(title)
     self.lblMessage = QLabel(SweepAllDlg)
     self.lblMessage.setText("Loading rewards...")
     self.lblMessage.setWordWrap(True)
     layout.addWidget(self.lblMessage)
     self.tableW = QTableWidget(SweepAllDlg)
     self.tableW.setSizeAdjustPolicy(QAbstractScrollArea.AdjustToContents)
     self.tableW.setShowGrid(True)
     self.tableW.setColumnCount(4)
     self.tableW.setRowCount(0)
     self.tableW.horizontalHeader().setSectionResizeMode(
         0, QHeaderView.Stretch)
     self.tableW.verticalHeader().hide()
     item = QTableWidgetItem()
     item.setText("Name")
     item.setTextAlignment(Qt.AlignCenter)
     self.tableW.setHorizontalHeaderItem(0, item)
     item = QTableWidgetItem()
     item.setText("Address")
     item.setTextAlignment(Qt.AlignCenter)
     self.tableW.setHorizontalHeaderItem(1, item)
     item = QTableWidgetItem()
     item.setText("Rewards")
     item.setTextAlignment(Qt.AlignCenter)
     self.tableW.setHorizontalHeaderItem(2, item)
     item = QTableWidgetItem()
     item.setText("n. of UTXOs")
     item.setTextAlignment(Qt.AlignCenter)
     self.tableW.setHorizontalHeaderItem(3, item)
     layout.addWidget(self.tableW)
     myForm = QFormLayout()
     myForm.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)
     hBox = QHBoxLayout()
     self.totalLine = QLabel("<b>0 PIV</b>")
     hBox.addWidget(self.totalLine)
     self.loadingLine = QLabel(
         "<b style='color:red'>Preparing TX.</b> Completed: ")
     self.loadingLinePercent = QProgressBar()
     self.loadingLinePercent.setMaximumWidth(200)
     self.loadingLinePercent.setMaximumHeight(15)
     self.loadingLinePercent.setRange(0, 100)
     hBox.addWidget(self.loadingLine)
     hBox.addWidget(self.loadingLinePercent)
     self.loadingLine.hide()
     self.loadingLinePercent.hide()
     myForm.addRow(QLabel("Total Rewards: "), hBox)
     self.noOfUtxosLine = QLabel("<b>0</b>")
     myForm.addRow(QLabel("Total number of UTXOs: "), self.noOfUtxosLine)
     hBox = QHBoxLayout()
     self.edt_destination = QLineEdit()
     self.edt_destination.setToolTip("PIVX address to transfer rewards to")
     hBox.addWidget(self.edt_destination)
     hBox.addWidget(QLabel("Fee"))
     self.feeLine = QDoubleSpinBox()
     self.feeLine.setDecimals(8)
     self.feeLine.setPrefix("PIV  ")
     self.feeLine.setToolTip("Insert a small fee amount")
     self.feeLine.setFixedWidth(120)
     self.feeLine.setSingleStep(0.001)
     hBox.addWidget(self.feeLine)
     myForm.addRow(QLabel("Destination Address"), hBox)
     layout.addLayout(myForm)
     hBox = QHBoxLayout()
     self.buttonCancel = QPushButton("Cancel")
     hBox.addWidget(self.buttonCancel)
     self.buttonSend = QPushButton("Send")
     hBox.addWidget(self.buttonSend)
     layout.addLayout(hBox)
     SweepAllDlg.resize(700, 300)
Exemple #8
0
    def _createZoneControls(self, layout=None, index=None):
        if layout is None:
            layout = self.layout()

        self.prevColor = ColorPreview(QColor(), self)
        self.prevColor.setFixedSize(32, 32)
        self.prevColorLabel = QLabel("—", self)

        self.nextColor = ColorPreview(QColor(), self)
        self.nextColor.setFixedSize(32, 32)
        self.nextColorLabel = QLabel("—", self)

        self.transitionCheckBox = QCheckBox("Transition Zone", self)
        self.transitionCheckBox.stateChanged.connect(
            self.setCurrentZoneTransition)

        self.analyzeBtn = QPushButton("Anal&yze Zone", self)
        self.analyzeBtn.clicked.connect(self.analyzeZone)  # 162523

        self.gammaLabel = QLabel("Gamma:", self)

        self.gammaSpinBox = QDoubleSpinBox(self)
        self.gammaSpinBox.setSingleStep(0.1)
        self.gammaSpinBox.setDecimals(2)
        self.gammaSpinBox.setMinimum(0.25)
        self.gammaSpinBox.setMaximum(4)
        self.gammaSpinBox.valueChanged.connect(self.widgetValuesChanged)

        self.suggBtn = QPushButton("&Suggestion", self)
        self.suggBtn.clicked.connect(self.useAutoGamma)  # 162523

        inpLabel = QLabel("Input", self)
        outLabel = QLabel("Output", self)

        self.redAvgIntensIn = QLabel("Avg Red Intensity: —", self)
        self.greenAvgIntensIn = QLabel("Avg Green Intensity: —", self)
        self.blueAvgIntensIn = QLabel("Avg Blue Intensity: —", self)

        self.redAvgIntensOut = QLabel("Avg Red Intensity: —", self)
        self.greenAvgIntensOut = QLabel("Avg Green Intensity: —", self)
        self.blueAvgIntensOut = QLabel("Avg Blue Intensity: —", self)

        sublayout = QHBoxLayout()
        sublayout.addStretch()
        sublayout.addWidget(self.prevColor)
        sublayout.addWidget(self.prevColorLabel)
        sublayout.addStretch()
        sublayout.addWidget(self.nextColor)
        sublayout.addWidget(self.nextColorLabel)
        sublayout.addStretch()
        sublayout.addWidget(self.transitionCheckBox)
        sublayout.addStretch()
        sublayout.addWidget(self.analyzeBtn)
        sublayout.addStretch()
        sublayout.addWidget(self.gammaLabel)
        sublayout.addWidget(self.gammaSpinBox)
        sublayout.addWidget(self.suggBtn)
        sublayout.addStretch()

        layout.addLayout(sublayout)

        sublayout = QHBoxLayout()
        sublayout.addStretch()
        sublayout.addWidget(inpLabel)
        sublayout.addStretch()
        sublayout.addWidget(self.redAvgIntensIn)
        sublayout.addStretch()
        sublayout.addWidget(self.greenAvgIntensIn)
        sublayout.addStretch()
        sublayout.addWidget(self.blueAvgIntensIn)
        sublayout.addStretch()

        layout.addLayout(sublayout)

        sublayout = QHBoxLayout()
        sublayout.addStretch()
        sublayout.addWidget(outLabel)
        sublayout.addStretch()
        sublayout.addWidget(self.redAvgIntensOut)
        sublayout.addStretch()
        sublayout.addWidget(self.greenAvgIntensOut)
        sublayout.addStretch()
        sublayout.addWidget(self.blueAvgIntensOut)
        sublayout.addStretch()

        layout.addLayout(sublayout)

        self.currentFrame = None
        self.setFocus(None, None)
Exemple #9
0
    def buildUI(self):
        self.setMinimumSize(100, 100)
        self.plotLayoutWidget = pg.GraphicsLayoutWidget()
        self.psdPlot = IPPlotWidget(mode='PSD')

        self.psdPlot.enableAutoRange(self.psdPlot.xaxis(), enable=True)
        self.psdPlot.enableAutoRange(self.psdPlot.yaxis(), enable=True)

        self.psdPlot.getAxis('bottom').setRange(.1, 10)

        self.psdPlot.setLabel('bottom', 'f (Hz)')
        self.psdPlot.setLabel('left', 'Power Spectral Density (dB)')
        self.psdPlot.setTitle("...")

        self.psdPlot.setLogMode(x=True, y=False)

        initdata = np.array([1])

        self.noiseCurve = self.psdPlot.plot(x=initdata,
                                            y=initdata,
                                            pen=self.red_pen,
                                            name="Noise")
        self.signalCurve = self.psdPlot.plot(x=initdata,
                                             y=initdata,
                                             pen=self.blue_pen,
                                             name="Signal")

        self.plotLayoutWidget.addItem(self.psdPlot, 0, 0)

        label_fft_N = QLabel(self.tr('fft window (N): '))
        label_fft_N.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
        self.fft_N_Spin = QSpinBox()
        self.fft_N_Spin.setMinimum(4)
        self.fft_N_Spin.setMaximum(2**20)
        self.fft_N_Spin.setValue(1024)

        label_fs = QLabel(self.tr('Sampling Freq.: '))
        label_fs.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
        self.fs_Spin = QDoubleSpinBox()
        self.fs_Spin.setMaximum(1000000.0)
        self.fs_Spin.setMinimum(0.0)
        self.fs_Spin.setValue(20.0)
        self.fs_Spin.setReadOnly(True)
        self.fs_Spin.setSuffix(' Hz')
        self.fs_Spin.setButtonSymbols(QAbstractSpinBox.NoButtons)
        self.fs_Spin.setEnabled(False)

        label_fft_time = QLabel(self.tr('fft window: '))
        label_fft_time.setAlignment(QtCore.Qt.AlignRight
                                    | QtCore.Qt.AlignVCenter)
        self.fft_T_Spin = QDoubleSpinBox()
        self.fft_T_Spin.setMaximum(10000.)
        self.fft_T_Spin.setMinimum(0.1)
        self.fft_T_Spin.setValue(1.0)
        self.fft_T_Spin.setSuffix(' s')

        label_window = QLabel(self.tr('Window: '))
        label_window.setAlignment(QtCore.Qt.AlignRight
                                  | QtCore.Qt.AlignVCenter)
        self.window_cb = QComboBox()
        for window in self.windows:
            self.window_cb.addItem(window)

        label_f1 = QLabel('f1')
        label_f1.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
        self.f1_Spin = QDoubleSpinBox()
        self.f1_Spin.setDecimals(3)
        self.f1_Spin.setMinimum(0.001)
        self.f1_Spin.setMaximum(10000)
        self.f1_Spin.setSingleStep(0.1)
        self.f1_Spin.setSuffix(' Hz')
        self.f1_Spin.setValue(
            10**(self.psdPlot.getFreqRegion().getRegion()[0]))

        label_f2 = QLabel('f2')
        label_f2.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
        self.f2_Spin = QDoubleSpinBox()
        self.f2_Spin.setDecimals(3)
        self.f2_Spin.setMinimum(0.001)
        self.f2_Spin.setMaximum(10000)
        self.f2_Spin.setSingleStep(0.1)
        self.f2_Spin.setSuffix(' Hz')
        self.f2_Spin.setValue(
            10**(self.psdPlot.getFreqRegion().getRegion()[1]))

        set_filter_button = QPushButton('<- Set filter to ->')
        set_filter_button.clicked.connect(self.setFilterFromPSD)

        f_indicator_layout = QHBoxLayout()
        f_indicator_layout.addWidget(label_f1)
        f_indicator_layout.addWidget(self.f1_Spin)
        f_indicator_layout.addStretch()
        f_indicator_layout.addWidget(set_filter_button)
        f_indicator_layout.addStretch()
        f_indicator_layout.addWidget(label_f2)
        f_indicator_layout.addWidget(self.f2_Spin)

        parametersLayout = QGridLayout()
        parametersLayout.addWidget(label_fft_N, 0, 0)
        parametersLayout.addWidget(self.fft_N_Spin, 0, 1)
        parametersLayout.addWidget(label_fs, 0, 2)
        parametersLayout.addWidget(self.fs_Spin, 0, 3)
        parametersLayout.addWidget(label_fft_time, 1, 0)
        parametersLayout.addWidget(self.fft_T_Spin, 1, 1)
        parametersLayout.addWidget(label_window, 1, 2)
        parametersLayout.addWidget(self.window_cb, 1, 3)

        self.parametersGroup = QGroupBox()
        self.parametersGroup.setLayout(parametersLayout)

        mainLayout = QVBoxLayout()
        mainLayout.addWidget(self.plotLayoutWidget)
        mainLayout.addLayout(f_indicator_layout)
        mainLayout.addWidget(self.parametersGroup)

        self.setLayout(mainLayout)

        self.connectSignalsAndSlots()
Exemple #10
0
    def __init__(self):
        super().__init__()
        self.main_widget = QWidget()
        self.main_widget.setGeometry(450, 100, 950, 800)
        self.main_widget.setWindowTitle("MULTI-STIMULI PROCESS")
        self.main_widget.setFont((QFont("Amble", 11)))
        self.main_widget.setFixedSize(1000, 650)
        # self.main_widget.setMinimumSize(900, 900)
        # self.main_widget.setMaximumSize(900, 600)

        # CREATING SELECTIONS...

        self.stimodour1 = QCheckBox()
        self.stimodour2 = QCheckBox()
        self.whisker = QCheckBox()
        self.auditory = QCheckBox()
        self.visual = QCheckBox()
        self.check_list = [
            self.stimodour1, self.stimodour2, self.whisker, self.auditory,
            self.visual
        ]
        self.odour1_flag = 0  # Creating check flag for experiments
        self.odour2_flag = 0
        self.whisker_flag = 0
        self.auditory_flag = 0
        self.visual_flag = 0
        # CREATING GUI...

        self.titlebox = QHBoxLayout()
        self.gap = QLabel("")
        self.types = QLabel("Types of Stimulations")
        self.types.setFont(QFont("Amble", 11, QFont.Bold))
        self.types.setAlignment(Qt.AlignLeft)
        self.delay = QLabel("Delay")
        self.delay.setFont(QFont("Amble", 11, QFont.Bold))
        self.delay.setAlignment(Qt.AlignHCenter)
        self.stim_length = QLabel("Length of Stim")
        self.stim_length.setFont(QFont("Amble", 11, QFont.Bold))
        self.stim_length.setAlignment(Qt.AlignCenter)
        self.offtime = QLabel("Off Time")
        self.offtime.setFont(QFont("Amble", 11, QFont.Bold))
        self.offtime.setAlignment(Qt.AlignHCenter)
        self.frequency = QLabel("Frequency")
        self.frequency.setFont(QFont("Amble", 11, QFont.Bold))
        self.frequency.setAlignment(Qt.AlignHCenter)
        self.amplitude = QLabel("Amplitude")
        self.amplitude.setFont(QFont("Amble", 11, QFont.Bold))
        self.amplitude.setAlignment(Qt.AlignHCenter)
        self.repetition = QLabel("Repetition")
        self.repetition.setFont(QFont("Amble", 11, QFont.Bold))
        self.repetition.setAlignment(Qt.AlignHCenter)

        # CREATING GUI...

        self.titlebox.addWidget(self.types)
        self.titlebox.addWidget(self.delay)
        self.titlebox.addWidget(self.stim_length)
        self.titlebox.addWidget(self.offtime)
        self.titlebox.addWidget(self.frequency)
        self.titlebox.addWidget(self.amplitude)
        self.titlebox.addWidget(self.repetition)

        # CREATING GUI...

        self.boxodour1 = QHBoxLayout()
        self.odour1 = QLabel("   Odour 1")
        self.odour1.setFont(QFont("Amble", 11))
        self.odour2 = QLabel("   Odour 2")
        self.odour2.setFont(QFont("Amble", 11))
        self.odour1buton1 = QSpinBox()
        self.odour1buton2 = QSpinBox()
        self.odour1buton3 = QSpinBox()
        self.odour1buton4 = QSpinBox()
        self.odour1buton5 = QDoubleSpinBox()
        self.odour1buton6 = QSpinBox()
        self.odour1buton4.setEnabled(0)
        self.odour1buton5.setEnabled(0)

        self.boxodour1.addWidget(self.odour1)
        self.boxodour1.addWidget(self.odour1buton1)
        self.boxodour1.addWidget(self.odour1buton2)
        self.boxodour1.addWidget(self.odour1buton3)
        self.boxodour1.addWidget(self.odour1buton4)
        self.boxodour1.addWidget(self.odour1buton5)
        self.boxodour1.addWidget(self.odour1buton6)

        # CREATING GUI...

        self.odour2buton1 = QSpinBox()
        self.odour2buton2 = QSpinBox()
        self.odour2buton3 = QSpinBox()
        self.odour2buton4 = QSpinBox()
        self.odour2buton5 = QDoubleSpinBox()
        self.odour2buton6 = QSpinBox()
        self.odour2buton4.setEnabled(0)
        self.odour2buton5.setEnabled(0)

        self.boxodour2 = QHBoxLayout()
        self.boxodour2.addWidget(self.odour2)
        self.boxodour2.addWidget(self.odour2buton1)
        self.boxodour2.addWidget(self.odour2buton2)
        self.boxodour2.addWidget(self.odour2buton3)
        self.boxodour2.addWidget(self.odour2buton4)
        self.boxodour2.addWidget(self.odour2buton5)
        self.boxodour2.addWidget(self.odour2buton6)

        # CREATING GUI...

        self.boxwhisker = QHBoxLayout()
        self.label2 = QLabel("   Whisker")
        self.label2.setFont(QFont("Amble", 11))
        self.buton2 = QSpinBox()
        self.buton6 = QSpinBox()
        self.buton9 = QSpinBox()
        self.buton12 = QSpinBox()
        self.buton15 = QDoubleSpinBox()
        self.buton18 = QSpinBox()

        self.boxwhisker.addWidget(self.label2)
        self.boxwhisker.addWidget(self.buton2)
        self.boxwhisker.addWidget(self.buton6)
        self.boxwhisker.addWidget(self.buton9)
        self.boxwhisker.addWidget(self.buton12)
        self.boxwhisker.addWidget(self.buton15)
        self.boxwhisker.addWidget(self.buton18)

        # CREATING GUI...

        self.box_auditory = QHBoxLayout()
        self.label3 = QLabel("   Auditory")
        self.label3.setFont(QFont("Amble", 11))
        self.buton3 = QSpinBox()
        self.buton7 = QSpinBox()
        self.buton10 = QSpinBox()
        self.buton13 = QSpinBox()
        self.buton16 = QDoubleSpinBox()
        self.buton19 = QSpinBox()

        self.box_auditory.addWidget(self.label3)
        self.box_auditory.addWidget(self.buton3)
        self.box_auditory.addWidget(self.buton7)
        self.box_auditory.addWidget(self.buton10)
        self.box_auditory.addWidget(self.buton13)
        self.box_auditory.addWidget(self.buton16)
        self.box_auditory.addWidget(self.buton19)

        # CREATING GUI...

        self.visual_box = QHBoxLayout()
        self.label4 = QLabel("   Visual")
        self.label4.setFont(QFont("Amble", 11))
        self.buton4 = QSpinBox()
        self.buton8 = QSpinBox()
        self.buton11 = QSpinBox()
        self.buton14 = QSpinBox()
        self.buton17 = QDoubleSpinBox()
        self.buton20 = QSpinBox()

        self.butonlist = [
            self.odour1buton1, self.odour1buton2, self.odour1buton3,
            self.odour1buton6, self.odour2buton1, self.odour2buton2,
            self.odour2buton3, self.odour2buton6, self.buton2, self.buton6,
            self.buton9, self.buton12, self.buton15, self.buton18, self.buton3,
            self.buton7, self.buton10, self.buton13, self.buton16,
            self.buton19, self.buton4, self.buton8, self.buton11, self.buton14,
            self.buton17, self.buton20
        ]

        self.visual_box.addWidget(self.label4)
        self.visual_box.addWidget(self.buton4)
        self.visual_box.addWidget(self.buton8)
        self.visual_box.addWidget(self.buton11)
        self.visual_box.addWidget(self.buton14)
        self.visual_box.addWidget(self.buton17)
        self.visual_box.addWidget(self.buton20)

        # CREATING START-CANCEL BUTTONS

        self.boxofcontrol = QHBoxLayout()
        self.start = QPushButton("START")
        self.start.setFixedSize(100, 28)
        self.cancel = QPushButton("CANCEL")
        self.cancel.setFixedSize(100, 28)
        self.cancel.clicked.connect(self.click_cancel)
        self.start.clicked.connect(self.function_start)
        self.boxofcontrol.addWidget(self.start)
        self.boxofcontrol.addWidget(self.cancel)

        # LAYOUT of BOXES (RELATED TO GUI)

        self.form = QFormLayout()
        self.form.addRow(self.gap)
        self.form.addRow(self.titlebox)
        self.form.addRow(self.gap)
        self.form.addRow(self.stimodour1, self.boxodour1)
        self.form.addRow(self.gap)
        self.form.addRow(self.stimodour2, self.boxodour2)
        self.form.addRow(self.gap)
        self.form.addRow(self.whisker, self.boxwhisker)
        self.form.addRow(self.gap)
        self.form.addRow(self.visual, self.box_auditory)
        self.form.addRow(self.gap)
        self.form.addRow(self.auditory, self.visual_box)
        self.form.addRow(self.gap)
        self.form.addRow(self.gap)
        self.form.addRow(self.gap)
        self.form.addRow(self.gap)
        self.form.addRow(self.boxofcontrol)
        self.main_widget.setLayout(self.form)
        self.finished_signal.connect(self.plotting_figure)

        self.main_widget.show()
Exemple #11
0
    def __init__(self, parent=None):

        super(Lines, self).__init__()

        self.setObjectName('lines')  # should be plugin name

        # declare all parameter widgets below
        vbox1 = QVBoxLayout()
        hbox1 = QHBoxLayout()
        grid1 = QGridLayout()
        lblRho = QLabel('rho')
        self.dblRho = QDoubleSpinBox()
        self.dblRho.setObjectName('dblRho')
        self.dblRho.setValue(1.0)
        self.dblRho.setSingleStep(0.1)
        tt = 'Distance resolution of the accumulator in pixels'
        lblRho.setToolTip(tt)
        self.dblRho.setToolTip(tt)
        lblTheta = QLabel('theta')
        self.dblTheta = QDoubleSpinBox()
        self.dblTheta.setObjectName('dblTheta')
        tt = 'Angle resolution of the accumulator in degrees'
        lblTheta.setToolTip(tt)
        self.dblTheta.setToolTip(tt)
        self.dblTheta.setSingleStep(5)
        self.dblTheta.setMinimum(0)
        self.dblTheta.setMaximum(360)
        self.dblTheta.setValue(1)
        grid1.addWidget(lblRho, 0, 0)
        grid1.addWidget(self.dblRho, 0, 1)
        grid1.addWidget(lblTheta, 0, 2)
        grid1.addWidget(self.dblTheta, 0, 3)

        lblThreshold = QLabel('threshold')
        self.dblThreshold = QDoubleSpinBox()
        self.dblThreshold.setObjectName('dblThreshold')
        self.dblThreshold.setSingleStep(1)
        self.dblThreshold.setValue(50)
        self.dblThreshold.setMaximum(1000)
        tt = '<FONT COLOR = black>Accumulator threshold parameter. Only those lines are returned that get enough votes ( >threshold )</FONT>'
        lblThreshold.setToolTip(tt)
        self.dblThreshold.setToolTip(tt)
        lblMinLineLength = QLabel('minLineLength')
        self.dblMinLineLength = QDoubleSpinBox()
        self.dblMinLineLength.setObjectName('dblMinLineLength')
        self.dblMinLineLength.setSingleStep(10)
        self.dblMinLineLength.setValue(100)
        self.dblMinLineLength.setMaximum(2000)
        tt = '<FONT COLOR = black>Minimum line length. Line segments shorter than that are rejected.</FONT>'
        lblMinLineLength.setToolTip(tt)
        self.dblMinLineLength.setToolTip(tt)
        grid1.addWidget(lblThreshold, 1, 0)
        grid1.addWidget(self.dblThreshold, 1, 1)
        grid1.addWidget(lblMinLineLength, 1, 2)
        grid1.addWidget(self.dblMinLineLength, 1, 3)

        hbox3 = QHBoxLayout()
        lblMaxLineGap = QLabel('maxLineGap')
        self.dblMaxLineGap = QDoubleSpinBox()
        self.dblMaxLineGap.setObjectName('dblMaxLineGap')
        self.dblMaxLineGap.setSingleStep(10)
        self.dblMaxLineGap.setMaximum(2000)
        self.dblMaxLineGap.setValue(10)
        tt = '<FONT COLOR = black>Maximum allowed gap between points on the same line to link them</FONT>'
        self.dblMaxLineGap.setToolTip(tt)
        grid1.addWidget(lblMaxLineGap, 2, 0)
        grid1.addWidget(self.dblMaxLineGap, 2, 1)

        self.setLayout(grid1)
Exemple #12
0
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.setLayout(QVBoxLayout())
        #self.layout().setAlignment(Qt.AlignTop)

        self.behaviorsGroup = QGroupBox(self)
        self.behaviorsGroup.setLayout(QVBoxLayout())
        self.layout().addWidget(self.behaviorsGroup)

        self.showPlaying = QCheckBox(self.behaviorsGroup)
        self.behaviorsGroup.layout().addWidget(self.showPlaying)

        self.showDbMeters = QCheckBox(self.behaviorsGroup)
        self.behaviorsGroup.layout().addWidget(self.showDbMeters)

        self.showAccurate = QCheckBox(self.behaviorsGroup)
        self.behaviorsGroup.layout().addWidget(self.showAccurate)

        self.showSeek = QCheckBox(self.behaviorsGroup)
        self.behaviorsGroup.layout().addWidget(self.showSeek)

        self.autoNext = QCheckBox(self.behaviorsGroup)
        self.behaviorsGroup.layout().addWidget(self.autoNext)

        self.endListLayout = QHBoxLayout()
        self.behaviorsGroup.layout().addLayout(self.endListLayout)
        self.endListLabel = QLabel(self.behaviorsGroup)
        self.endListLayout.addWidget(self.endListLabel)
        self.endListBehavior = QComboBox(self.behaviorsGroup)
        self.endListBehavior.addItem(translate('ListLayout', 'Stop'), 'Stop')
        self.endListBehavior.addItem(translate('ListLayout', 'Restart'),
                                     'Restart')
        self.endListLayout.addWidget(self.endListBehavior)
        self.endListLayout.setStretch(0, 2)
        self.endListLayout.setStretch(1, 5)

        self.goKeyLayout = QHBoxLayout()
        self.behaviorsGroup.layout().addLayout(self.goKeyLayout)
        self.goKeyLabel = QLabel(self.behaviorsGroup)
        self.goKeyLayout.addWidget(self.goKeyLabel)
        self.goKeyEdit = QKeySequenceEdit(self.behaviorsGroup)
        self.goKeyLayout.addWidget(self.goKeyEdit)
        self.goKeyLayout.setStretch(0, 2)
        self.goKeyLayout.setStretch(1, 5)

        self.useFadeGroup = QGroupBox(self)
        self.useFadeGroup.setLayout(QGridLayout())
        self.layout().addWidget(self.useFadeGroup)

        # per-cue
        self.stopCueFade = QCheckBox(self.useFadeGroup)
        self.useFadeGroup.layout().addWidget(self.stopCueFade, 0, 0)
        self.pauseCueFade = QCheckBox(self.useFadeGroup)
        self.useFadeGroup.layout().addWidget(self.pauseCueFade, 1, 0)
        self.restartCueFade = QCheckBox(self.useFadeGroup)
        self.useFadeGroup.layout().addWidget(self.restartCueFade, 2, 0)
        self.interruptCueFade = QCheckBox(self.useFadeGroup)
        self.useFadeGroup.layout().addWidget(self.interruptCueFade, 3, 0)

        # all
        self.stopAllFade = QCheckBox(self.useFadeGroup)
        self.useFadeGroup.layout().addWidget(self.stopAllFade, 0, 1)
        self.pauseAllFade = QCheckBox(self.useFadeGroup)
        self.useFadeGroup.layout().addWidget(self.pauseAllFade, 1, 1)
        self.restartAllFade = QCheckBox(self.useFadeGroup)
        self.useFadeGroup.layout().addWidget(self.restartAllFade, 2, 1)
        self.interruptAllFade = QCheckBox(self.useFadeGroup)
        self.useFadeGroup.layout().addWidget(self.interruptAllFade, 3, 1)

        # Fade settings
        self.fadeGroup = QGroupBox(self)
        self.fadeGroup.setLayout(QGridLayout())
        self.layout().addWidget(self.fadeGroup)

        self.fadeDurationSpin = QDoubleSpinBox(self.fadeGroup)
        self.fadeDurationSpin.setRange(0, 3600)
        self.fadeGroup.layout().addWidget(self.fadeDurationSpin, 0, 0)

        self.fadeDurationLabel = QLabel(self.fadeGroup)
        self.fadeDurationLabel.setAlignment(Qt.AlignCenter)
        self.fadeGroup.layout().addWidget(self.fadeDurationLabel, 0, 1)

        self.fadeTypeCombo = FadeComboBox(self.fadeGroup)
        self.fadeGroup.layout().addWidget(self.fadeTypeCombo, 1, 0)

        self.fadeTypeLabel = QLabel(self.fadeGroup)
        self.fadeTypeLabel.setAlignment(Qt.AlignCenter)
        self.fadeGroup.layout().addWidget(self.fadeTypeLabel, 1, 1)

        self.retranslateUi()
Exemple #13
0
    def createFormGroupIntro(self):
        """Create forms for websocket connection to intro."""
        self.formGroupIntro = QWidget()
        mainLayout = QVBoxLayout()

        box = QGroupBox(_("Style"))
        layout = QHBoxLayout()
        styleqb = StyleComboBox(
            scctool.settings.casting_html_dir + "/src/css/intro", "intro")
        styleqb.connect2WS(self.controller, 'intro')
        button = QPushButton(_("Show in Browser"))
        button.clicked.connect(lambda: self.openHTML(
            scctool.settings.casting_html_dir + "/intro.html"))
        layout.addWidget(styleqb, 2)
        layout.addWidget(button, 1)
        box.setLayout(layout)
        mainLayout.addWidget(box)

        self.behaviorIntroBox = QGroupBox(_("Behavior"))
        layout = QVBoxLayout()
        self.cb_hardcode_players = QCheckBox(
            _("Read player names and order in 1vs1 mode from SCCT instead of SC2"
              ))
        self.cb_hardcode_players.setChecked(
            scctool.settings.config.parser.getboolean("Intros",
                                                      "hardcode_players"))
        self.cb_hardcode_players.stateChanged.connect(self.changed)
        layout.addWidget(self.cb_hardcode_players)
        self.behaviorIntroBox.setLayout(layout)
        mainLayout.addWidget(self.behaviorIntroBox)

        self.hotkeyBox = QGroupBox(_("Hotkeys"))
        layout = QVBoxLayout()
        self.controller.websocketThread.unregister_hotkeys(force=True)

        self.cb_single_hotkey = QCheckBox(
            _("Use a single hotkey for both players"))
        self.cb_single_hotkey.stateChanged.connect(self.singleHotkeyChanged)
        layout.addWidget(self.cb_single_hotkey)

        self.hotkeys = dict()
        layout.addLayout(self.addHotkey("hotkey_player1", _("Player 1")))
        layout.addLayout(self.addHotkey("hotkey_player2", _("Player 2")))
        layout.addLayout(self.addHotkey("hotkey_debug", _("Debug")))

        self.cb_single_hotkey.setChecked(self.hotkeys['hotkey_player1'].getKey(
        ) == self.hotkeys['hotkey_player2'].getKey())
        self.connectHotkeys()
        label = QLabel(
            _("Player 1 is always the player your observer"
              " camera is centered on at start of a game."))
        layout.addWidget(label)
        self.hotkeyBox.setLayout(layout)
        mainLayout.addWidget(self.hotkeyBox)

        self.introBox = QGroupBox(_("Animation"))
        layout = QFormLayout()
        self.cb_animation = QComboBox()
        animation = scctool.settings.config.parser.get("Intros", "animation")
        currentIdx = 0
        idx = 0
        options = dict()
        options['Fly-In'] = _("Fly-In")
        options['Slide'] = _("Slide")
        options['Fanfare'] = _("Fanfare")
        for key, item in options.items():
            self.cb_animation.addItem(item, key)
            if (key == animation):
                currentIdx = idx
            idx += 1
        self.cb_animation.setCurrentIndex(currentIdx)
        self.cb_animation.currentIndexChanged.connect(self.changed)
        label = QLabel(_("Animation:") + " ")
        label.setMinimumWidth(120)
        layout.addRow(label, self.cb_animation)
        self.sb_displaytime = QDoubleSpinBox()
        self.sb_displaytime.setRange(0, 10)
        self.sb_displaytime.setDecimals(1)
        self.sb_displaytime.setValue(
            scctool.settings.config.parser.getfloat("Intros", "display_time"))
        self.sb_displaytime.setSuffix(" " + _("Seconds"))
        self.sb_displaytime.valueChanged.connect(self.changed)
        layout.addRow(QLabel(_("Display Duration:") + " "),
                      self.sb_displaytime)
        self.sl_sound = QSlider(Qt.Horizontal)
        self.sl_sound.setMinimum(0)
        self.sl_sound.setMaximum(20)
        self.sl_sound.setValue(
            scctool.settings.config.parser.getint("Intros", "sound_volume"))
        self.sl_sound.setTickPosition(QSlider.TicksBothSides)
        self.sl_sound.setTickInterval(1)
        self.sl_sound.valueChanged.connect(self.changed)
        layout.addRow(QLabel(_("Sound Volume:") + " "), self.sl_sound)
        self.introBox.setLayout(layout)
        mainLayout.addWidget(self.introBox)

        self.ttsBox = QGroupBox(_("Text-to-Speech"))
        layout = QFormLayout()

        self.cb_tts_active = QCheckBox()
        self.cb_tts_active.setChecked(
            scctool.settings.config.parser.getboolean("Intros", "tts_active"))
        self.cb_tts_active.stateChanged.connect(self.changed)
        label = QLabel(_("Activate Text-to-Speech:") + " ")
        label.setMinimumWidth(120)
        layout.addRow(label, self.cb_tts_active)

        self.icons = {}
        self.icons['MALE'] = QIcon(scctool.settings.getResFile('male.png'))
        self.icons['FEMALE'] = QIcon(scctool.settings.getResFile('female.png'))
        self.cb_tts_voice = QComboBox()

        currentIdx = 0
        idx = 0
        tts_voices = self.controller.tts.getVoices()
        tts_voice = scctool.settings.config.parser.get("Intros", "tts_voice")
        for voice in tts_voices:
            self.cb_tts_voice.addItem(self.icons[voice['ssmlGender']],
                                      '   ' + voice['name'], voice['name'])
            if (voice['name'] == tts_voice):
                currentIdx = idx
            idx += 1
        self.cb_tts_voice.setCurrentIndex(currentIdx)
        self.cb_tts_voice.currentIndexChanged.connect(self.changed)
        layout.addRow(QLabel(_("Voice:") + " "), self.cb_tts_voice)
        self.ttsBox.setStyleSheet("QComboBox { combobox-popup: 0; }")
        self.ttsBox.setLayout(layout)
        mainLayout.addWidget(self.ttsBox)

        self.sb_tts_pitch = QDoubleSpinBox()
        self.sb_tts_pitch.setRange(-20, 20)
        self.sb_tts_pitch.setDecimals(2)
        self.sb_tts_pitch.setValue(
            scctool.settings.config.parser.getfloat("Intros", "tts_pitch"))
        self.sb_tts_pitch.valueChanged.connect(self.changed)
        layout.addRow(QLabel(_("Pitch:") + " "), self.sb_tts_pitch)

        self.sb_tts_rate = QDoubleSpinBox()
        self.sb_tts_rate.setRange(0.25, 4.00)
        self.sb_tts_rate.setSingleStep(0.1)
        self.sb_tts_rate.setDecimals(2)
        self.sb_tts_rate.setValue(
            scctool.settings.config.parser.getfloat("Intros", "tts_rate"))
        self.sb_tts_rate.valueChanged.connect(self.changed)
        layout.addRow(QLabel(_("Rate:") + " "), self.sb_tts_rate)

        self.cb_tts_scope = QComboBox()
        scope = scctool.settings.config.parser.get("Intros", "tts_scope")
        currentIdx = 0
        idx = 0
        options = self.controller.tts.getOptions()
        for key, item in options.items():
            self.cb_tts_scope.addItem(item['desc'], key)
            if (key == scope):
                currentIdx = idx
            idx += 1
        self.cb_tts_scope.setCurrentIndex(currentIdx)
        self.cb_tts_scope.currentIndexChanged.connect(self.changed)
        layout.addRow(QLabel(_("Line:") + " "), self.cb_tts_scope)

        self.sl_tts_sound = QSlider(Qt.Horizontal)
        self.sl_tts_sound.setMinimum(0)
        self.sl_tts_sound.setMaximum(20)
        self.sl_tts_sound.setValue(
            scctool.settings.config.parser.getint("Intros", "tts_volume"))
        self.sl_tts_sound.setTickPosition(QSlider.TicksBothSides)
        self.sl_tts_sound.setTickInterval(1)
        self.sl_tts_sound.valueChanged.connect(self.changed)
        layout.addRow(QLabel(_("Sound Volume:") + " "), self.sl_tts_sound)

        text = _(
            "Text-to-Speech provided by Google-Cloud is paid for "
            "by StarCraft Casting Tool Patrons. To keep this service up "
            "consider becoming a <a href='{patreon}'>Patron</a> yourself. "
            "You can test all voices at {tts}.")

        patreon = 'https://www.patreon.com/StarCraftCastingTool'

        url = 'https://cloud.google.com/text-to-speech/'
        tts = "<a href='{}'>cloud.google.com/text-to-speech</a>"
        tts = tts.format(url)

        label = QLabel(text.format(patreon=patreon, tts=tts))
        label.setAlignment(Qt.AlignJustify)
        label.setOpenExternalLinks(True)
        label.setWordWrap(True)
        label.setMargin(5)
        layout.addRow(label)

        mainLayout.addItem(
            QSpacerItem(0, 0, QSizePolicy.Minimum, QSizePolicy.Expanding))
        self.formGroupIntro.setLayout(mainLayout)
Exemple #14
0
    def __init__(self):
        super().__init__()

        self.ssbGroup = QGroupBox("Sensirion Sensorbridge control")
        self.portLabel = QLabel("Serial port: not connected")
        self.device: SensorBridgeShdlcDevice = None

        self.portOnePowerEnabled = False
        self.portOnePowerButton = QPushButton("Enable supply")
        self.portOnePowerButton.clicked.connect(self.port_one_supply_clicked)
        self.portOnePowerLabel = QLabel("Unknown state")

        self.portTwoPowerEnabled = False
        self.portTwoPowerButton = QPushButton("Enable supply")
        self.portTwoPowerButton.clicked.connect(self.port_two_supply_clicked)
        self.portTwoPowerLabel = QLabel("Unknown state")

        self.sht85device: SHT85 = None

        self.sht85PortDropdown = QComboBox()
        self.sht85PortDropdown.addItems(SensirionSensor.PORTS.keys())
        self.sht85PortDropdown.setCurrentIndex(1)
        self.sht85PortDropdown.currentTextChanged.connect(self.sht85_port_changed)

        self.sht85compensationEnabled = False
        self.sht85compensationCheckbox = QCheckBox("Compensate STC31 on measurement")
        self.sht85compensationCheckbox.clicked.connect(self.compensate_changed)

        self.sht85TemperatureLabel = QLabel("Temp: ? ℃")
        self.sht85HumidityLabel = QLabel("Humidity: ? % RH")
        self.sht85AnalogLabel = QLabel("Analog: ? V")

        self.sht85BlinkButton = QPushButton("Blink")
        self.sht85BlinkButton.clicked.connect(lambda: self.sht85device.blink())

        self.stc31device: STC31 = None

        self.stc31PortDropdown = QComboBox()
        self.stc31PortDropdown.addItems(SensirionSensor.PORTS.keys())
        self.stc31PortDropdown.setCurrentIndex(1)
        self.stc31PortDropdown.currentTextChanged.connect(self.stc31_port_changed)

        self.stc31BinaryGasDropdown = QComboBox()
        self.stc31BinaryGasDropdown.addItems(STC31.BINARY_GAS.keys())
        self.stc31BinaryGasDropdown.currentTextChanged.connect(
            lambda: self.stc31device.set_binary_gas(self.stc31BinaryGasDropdown.currentText()))

        self.stc31RelativeHumidityEdit = QDoubleSpinBox()
        self.stc31RelativeHumidityEdit.setRange(0.0, 100.0)
        self.stc31RelativeHumidityEdit.setValue(0.0)
        self.stc31RelativeHumidityEdit.setSuffix("  % RH")
        self.stc31RelativeHumidityEdit.editingFinished.connect(
            lambda: self.stc31device.set_relative_humidity(self.stc31RelativeHumidityEdit.value()))

        self.stc31TemperatureEdit = QDoubleSpinBox()
        self.stc31TemperatureEdit.setRange(-163.84, 163.835)
        self.stc31TemperatureEdit.setSuffix("  ℃")
        self.stc31TemperatureEdit.editingFinished.connect(
            lambda: self.stc31device.set_temperature(self.stc31TemperatureEdit.value()))

        self.stc31PressureEdit = QSpinBox()
        self.stc31PressureEdit.setRange(0, 65535)
        self.stc31PressureEdit.setValue(1013)
        self.stc31PressureEdit.setSuffix("  mbar")
        self.stc31PressureEdit.editingFinished.connect(
            lambda: self.stc31device.set_pressure(self.stc31PressureEdit.value()))

        self.stc31ForcedRecalibrationEdit = QSpinBox()
        self.stc31ForcedRecalibrationEdit.setRange(0, 65535)
        self.stc31ForcedRecalibrationEdit.setValue(0)
        self.stc31ForcedRecalibrationEdit.setSuffix(" % vol")
        self.stc31ForcedRecalibrationEdit.editingFinished.connect(
            lambda: self.stc31device.forced_recalibration(self.stc31ForcedRecalibrationEdit.value()))

        self.stc31GasConcentrationLabel = QLabel("Gas concentration: ? %")
        self.stc31AnalogLabel = QLabel("Analog: ? V")

        self.stc31AutoSelfCalibrationCheckbox = QCheckBox("Automatic self calibration")
        self.stc31AutoSelfCalibrationCheckbox.setChecked(False)
        self.stc31AutoSelfCalibrationCheckbox.clicked.connect(
            lambda: self.stc31device.automatic_self_calibration(self.stc31AutoSelfCalibrationCheckbox.isChecked()))

        self.stc31SelfTestButton = QPushButton("Self test")
        self.stc31SelfTestButton.clicked.connect(self.stc31_self_test)

        self.stc31SoftResetButton = QPushButton("Soft reset")
        self.stc31SoftResetButton.clicked.connect(lambda: self.stc31device.soft_reset())

        self.stc31BlinkButton = QPushButton("Blink")
        self.stc31BlinkButton.clicked.connect(lambda: self.stc31device.blink())

        self.timer = QTimer()
        self.timer.timeout.connect(self.on_timeout)

        self.intervalEdit = QLineEdit("1")
        self.intervalEdit.setValidator(QRegExpValidator(QRegExp("[0-9]*(|\\.[0-9]*)")))
        self.intervalEdit.setMaximumWidth(150)
        self.intervalEdit.editingFinished.connect(
            lambda: self.timer.setInterval(int(60 * 1000 * float(self.intervalEdit.text()))))

        self.csvFile = None
        self.savingEnabled = False
        self.savingButton = QPushButton("Start saving to file")
        self.savingButton.clicked.connect(self.saving_button_clicked)

        self.bufferSizeEdit = QLineEdit()
        self.bufferSizeEdit.setValidator(QIntValidator())
        self.bufferSizeEdit.setText("128")
        self.bufferSizeEdit.editingFinished.connect(self.update_buffer_sizes)

        self.sht85TemperaturePlotWidget = SensirionSBPlot("SHT85 temperature", (255, 32, 0), 128)
        self.sht85HumidityPlotWidget = SensirionSBPlot("SHT85 relative humidity", (0, 127, 255), 128)
        self.sht85AnalogPlotWidget = SensirionSBPlot("SHT85 analog", (255, 127, 0), 128)
        self.stc31ConcentrationPlotWidget = SensirionSBPlot("STC31 concentration", (200, 200, 200), 128)
        self.stc31AnalogPlotWidget = SensirionSBPlot("STC31 analog", (255, 127, 0), 128)

        self.sht85TemperatureReady.connect(self.sht85TemperaturePlotWidget.update_plot)
        self.sht85HumidityReady.connect(self.sht85HumidityPlotWidget.update_plot)
        self.sht85AnalogReady.connect(self.sht85AnalogPlotWidget.update_plot)
        self.stc31ConcentrationReady.connect(self.stc31ConcentrationPlotWidget.update_plot)
        self.stc31AnalogReady.connect(self.stc31AnalogPlotWidget.update_plot)

        self.setLayout(self.create_layout())
Exemple #15
0
    def __init__(self, persepolis_setting):
        super().__init__()
        self.persepolis_setting = persepolis_setting

        # add support for other languages
        locale = str(self.persepolis_setting.value('settings/locale'))
        QLocale.setDefault(QLocale(locale))
        self.translator = QTranslator()
        if self.translator.load(':/translations/locales/ui_' + locale, 'ts'):
            QCoreApplication.installTranslator(self.translator)

        # set ui direction
        ui_direction = self.persepolis_setting.value('ui_direction')

        if ui_direction == 'rtl':
            self.setLayoutDirection(Qt.RightToLeft)

        elif ui_direction in 'ltr':
            self.setLayoutDirection(Qt.LeftToRight)

        # get icons name
        icons = ':/' + \
            str(self.persepolis_setting.value('settings/icons')) + '/'

        self.setMinimumSize(QtCore.QSize(520, 425))
        self.setWindowIcon(
            QIcon.fromTheme('persepolis', QIcon(':/persepolis.svg')))

        window_verticalLayout = QVBoxLayout()

        # add link tab widget
        self.add_link_tabWidget = QTabWidget(self)
        window_verticalLayout.addWidget(self.add_link_tabWidget)

        # link tab
        self.link_tab = QWidget()

        link_tab_verticalLayout = QVBoxLayout(self.link_tab)
        link_tab_verticalLayout.setContentsMargins(21, 21, 21, 81)

        self.link_frame = QFrame(self.link_tab)
        self.link_frame.setFrameShape(QFrame.StyledPanel)
        self.link_frame.setFrameShadow(QFrame.Raised)

        horizontalLayout_2 = QHBoxLayout(self.link_frame)

        self.link_verticalLayout = QVBoxLayout()

        # link ->
        self.link_horizontalLayout = QHBoxLayout()
        self.link_label = QLabel(self.link_frame)
        self.link_horizontalLayout.addWidget(self.link_label)

        self.link_lineEdit = QLineEdit(self.link_frame)
        self.link_horizontalLayout.addWidget(self.link_lineEdit)

        self.link_verticalLayout.addLayout(self.link_horizontalLayout)

        horizontalLayout_2.addLayout(self.link_verticalLayout)
        link_tab_verticalLayout.addWidget(self.link_frame)

        # add change_name field ->
        change_name_horizontalLayout = QHBoxLayout()
        self.change_name_checkBox = QCheckBox(self.link_frame)
        change_name_horizontalLayout.addWidget(self.change_name_checkBox)

        self.change_name_lineEdit = QLineEdit(self.link_frame)
        change_name_horizontalLayout.addWidget(self.change_name_lineEdit)

        self.link_verticalLayout.addLayout(change_name_horizontalLayout)

        # add_category ->
        queue_horizontalLayout = QHBoxLayout()

        self.queue_frame = QFrame(self)
        self.queue_frame.setFrameShape(QFrame.StyledPanel)
        self.queue_frame.setFrameShadow(QFrame.Raised)

        add_queue_horizontalLayout = QHBoxLayout(self.queue_frame)

        self.add_queue_label = QLabel(self.queue_frame)
        add_queue_horizontalLayout.addWidget(self.add_queue_label)

        self.add_queue_comboBox = QComboBox(self.queue_frame)
        add_queue_horizontalLayout.addWidget(self.add_queue_comboBox)

        queue_horizontalLayout.addWidget(self.queue_frame)
        queue_horizontalLayout.addStretch(1)

        self.size_label = QLabel(self)
        queue_horizontalLayout.addWidget(self.size_label)

        link_tab_verticalLayout.addLayout(queue_horizontalLayout)

        self.add_link_tabWidget.addTab(self.link_tab, '')

        # proxy tab
        self.proxy_tab = QWidget(self)

        proxy_verticalLayout = QVBoxLayout(self.proxy_tab)
        proxy_verticalLayout.setContentsMargins(21, 21, 21, 171)

        proxy_horizontalLayout = QHBoxLayout()

        self.proxy_checkBox = QCheckBox(self.proxy_tab)
        self.detect_proxy_pushButton = QPushButton(self.proxy_tab)
        self.detect_proxy_label = QLabel(self.proxy_tab)

        proxy_horizontalLayout.addWidget(self.proxy_checkBox)
        proxy_horizontalLayout.addWidget(self.detect_proxy_label)
        proxy_horizontalLayout.addWidget(self.detect_proxy_pushButton)

        proxy_verticalLayout.addLayout(proxy_horizontalLayout)

        self.proxy_frame = QFrame(self.proxy_tab)
        self.proxy_frame.setFrameShape(QFrame.StyledPanel)
        self.proxy_frame.setFrameShadow(QFrame.Raised)

        gridLayout = QGridLayout(self.proxy_frame)

        self.ip_label = QLabel(self.proxy_frame)
        gridLayout.addWidget(self.ip_label, 0, 0, 1, 1)

        self.ip_lineEdit = QLineEdit(self.proxy_frame)
        self.ip_lineEdit.setInputMethodHints(QtCore.Qt.ImhNone)
        gridLayout.addWidget(self.ip_lineEdit, 0, 1, 1, 1)

        self.port_label = QLabel(self.proxy_frame)
        gridLayout.addWidget(self.port_label, 0, 2, 1, 1)

        self.port_spinBox = QSpinBox(self.proxy_frame)
        self.port_spinBox.setMaximum(65535)
        self.port_spinBox.setSingleStep(1)
        gridLayout.addWidget(self.port_spinBox, 0, 3, 1, 1)

        self.proxy_user_label = QLabel(self.proxy_frame)
        gridLayout.addWidget(self.proxy_user_label, 2, 0, 1, 1)

        self.proxy_user_lineEdit = QLineEdit(self.proxy_frame)
        gridLayout.addWidget(self.proxy_user_lineEdit, 2, 1, 1, 1)

        self.proxy_pass_label = QLabel(self.proxy_frame)
        gridLayout.addWidget(self.proxy_pass_label, 2, 2, 1, 1)

        self.proxy_pass_lineEdit = QLineEdit(self.proxy_frame)
        self.proxy_pass_lineEdit.setEchoMode(QLineEdit.Password)
        gridLayout.addWidget(self.proxy_pass_lineEdit, 2, 3, 1, 1)

        proxy_verticalLayout.addWidget(self.proxy_frame)

        self.add_link_tabWidget.addTab(self.proxy_tab, '')

        # more options tab
        self.more_options_tab = QWidget(self)

        more_options_tab_verticalLayout = QVBoxLayout(self.more_options_tab)

        # download UserName & Password ->
        download_horizontalLayout = QHBoxLayout()
        download_horizontalLayout.setContentsMargins(-1, 10, -1, -1)

        download_verticalLayout = QVBoxLayout()
        self.download_checkBox = QCheckBox(self.more_options_tab)
        download_verticalLayout.addWidget(self.download_checkBox)

        self.download_frame = QFrame(self.more_options_tab)
        self.download_frame.setFrameShape(QFrame.StyledPanel)
        self.download_frame.setFrameShadow(QFrame.Raised)

        gridLayout_2 = QGridLayout(self.download_frame)

        self.download_user_lineEdit = QLineEdit(self.download_frame)
        gridLayout_2.addWidget(self.download_user_lineEdit, 0, 1, 1, 1)

        self.download_user_label = QLabel(self.download_frame)
        gridLayout_2.addWidget(self.download_user_label, 0, 0, 1, 1)

        self.download_pass_label = QLabel(self.download_frame)
        gridLayout_2.addWidget(self.download_pass_label, 1, 0, 1, 1)

        self.download_pass_lineEdit = QLineEdit(self.download_frame)
        self.download_pass_lineEdit.setEchoMode(QLineEdit.Password)
        gridLayout_2.addWidget(self.download_pass_lineEdit, 1, 1, 1, 1)
        download_verticalLayout.addWidget(self.download_frame)
        download_horizontalLayout.addLayout(download_verticalLayout)

        # select folder ->
        self.folder_frame = QFrame(self.more_options_tab)
        self.folder_frame.setFrameShape(QFrame.StyledPanel)
        self.folder_frame.setFrameShadow(QFrame.Raised)

        gridLayout_3 = QGridLayout(self.folder_frame)

        self.download_folder_lineEdit = QLineEdit(self.folder_frame)
        gridLayout_3.addWidget(self.download_folder_lineEdit, 2, 0, 1, 1)

        self.folder_pushButton = QPushButton(self.folder_frame)
        gridLayout_3.addWidget(self.folder_pushButton, 3, 0, 1, 1)
        self.folder_pushButton.setIcon(QIcon(icons + 'folder'))

        self.folder_label = QLabel(self.folder_frame)
        self.folder_label.setAlignment(QtCore.Qt.AlignCenter)
        gridLayout_3.addWidget(self.folder_label, 1, 0, 1, 1)
        download_horizontalLayout.addWidget(self.folder_frame)
        more_options_tab_verticalLayout.addLayout(download_horizontalLayout)

        # start time ->
        time_limit_horizontalLayout = QHBoxLayout()
        time_limit_horizontalLayout.setContentsMargins(-1, 10, -1, -1)

        start_verticalLayout = QVBoxLayout()
        self.start_checkBox = QCheckBox(self.more_options_tab)
        start_verticalLayout.addWidget(self.start_checkBox)

        self.start_frame = QFrame(self.more_options_tab)
        self.start_frame.setFrameShape(QFrame.StyledPanel)
        self.start_frame.setFrameShadow(QFrame.Raised)

        horizontalLayout_5 = QHBoxLayout(self.start_frame)

        self.start_time_qDataTimeEdit = QDateTimeEdit(self.start_frame)
        self.start_time_qDataTimeEdit.setDisplayFormat('H:mm')
        horizontalLayout_5.addWidget(self.start_time_qDataTimeEdit)

        start_verticalLayout.addWidget(self.start_frame)
        time_limit_horizontalLayout.addLayout(start_verticalLayout)

        # end time ->
        end_verticalLayout = QVBoxLayout()

        self.end_checkBox = QCheckBox(self.more_options_tab)
        end_verticalLayout.addWidget(self.end_checkBox)

        self.end_frame = QFrame(self.more_options_tab)
        self.end_frame.setFrameShape(QFrame.StyledPanel)
        self.end_frame.setFrameShadow(QFrame.Raised)

        horizontalLayout_6 = QHBoxLayout(self.end_frame)

        self.end_time_qDateTimeEdit = QDateTimeEdit(self.end_frame)
        self.end_time_qDateTimeEdit.setDisplayFormat('H:mm')
        horizontalLayout_6.addWidget(self.end_time_qDateTimeEdit)

        end_verticalLayout.addWidget(self.end_frame)
        time_limit_horizontalLayout.addLayout(end_verticalLayout)

        # limit Speed ->
        limit_verticalLayout = QVBoxLayout()

        self.limit_checkBox = QCheckBox(self.more_options_tab)
        limit_verticalLayout.addWidget(self.limit_checkBox)

        self.limit_frame = QFrame(self.more_options_tab)
        self.limit_frame.setFrameShape(QFrame.StyledPanel)
        self.limit_frame.setFrameShadow(QFrame.Raised)

        horizontalLayout_4 = QHBoxLayout(self.limit_frame)

        self.limit_spinBox = QDoubleSpinBox(self.limit_frame)
        self.limit_spinBox.setMinimum(1)
        self.limit_spinBox.setMaximum(1023)
        horizontalLayout_4.addWidget(self.limit_spinBox)

        self.limit_comboBox = QComboBox(self.limit_frame)
        self.limit_comboBox.addItem("")
        self.limit_comboBox.addItem("")
        horizontalLayout_4.addWidget(self.limit_comboBox)
        limit_verticalLayout.addWidget(self.limit_frame)
        time_limit_horizontalLayout.addLayout(limit_verticalLayout)
        more_options_tab_verticalLayout.addLayout(time_limit_horizontalLayout)

        # number of connections ->
        connections_horizontalLayout = QHBoxLayout()
        connections_horizontalLayout.setContentsMargins(-1, 10, -1, -1)

        self.connections_frame = QFrame(self.more_options_tab)
        self.connections_frame.setFrameShape(QFrame.StyledPanel)
        self.connections_frame.setFrameShadow(QFrame.Raised)

        horizontalLayout_3 = QHBoxLayout(self.connections_frame)
        self.connections_label = QLabel(self.connections_frame)
        horizontalLayout_3.addWidget(self.connections_label)

        self.connections_spinBox = QSpinBox(self.connections_frame)
        self.connections_spinBox.setMinimum(1)
        self.connections_spinBox.setMaximum(16)
        self.connections_spinBox.setProperty("value", 16)
        horizontalLayout_3.addWidget(self.connections_spinBox)
        connections_horizontalLayout.addWidget(self.connections_frame)
        connections_horizontalLayout.addStretch(1)

        more_options_tab_verticalLayout.addLayout(connections_horizontalLayout)

        self.add_link_tabWidget.addTab(self.more_options_tab, '')

        # advance options
        self.advance_options_tab = QWidget(self)

        advance_options_tab_verticalLayout = QVBoxLayout(
            self.advance_options_tab)

        # referer
        referer_horizontalLayout = QHBoxLayout()

        self.referer_label = QLabel(self.advance_options_tab)
        referer_horizontalLayout.addWidget(self.referer_label)

        self.referer_lineEdit = QLineEdit(self.advance_options_tab)
        referer_horizontalLayout.addWidget(self.referer_lineEdit)

        advance_options_tab_verticalLayout.addLayout(referer_horizontalLayout)

        # header
        header_horizontalLayout = QHBoxLayout()

        self.header_label = QLabel(self.advance_options_tab)
        header_horizontalLayout.addWidget(self.header_label)

        self.header_lineEdit = QLineEdit(self.advance_options_tab)
        header_horizontalLayout.addWidget(self.header_lineEdit)

        advance_options_tab_verticalLayout.addLayout(header_horizontalLayout)

        # user_agent
        user_agent_horizontalLayout = QHBoxLayout()

        self.user_agent_label = QLabel(self.advance_options_tab)
        user_agent_horizontalLayout.addWidget(self.user_agent_label)

        self.user_agent_lineEdit = QLineEdit(self.advance_options_tab)
        user_agent_horizontalLayout.addWidget(self.user_agent_lineEdit)

        advance_options_tab_verticalLayout.addLayout(
            user_agent_horizontalLayout)

        # load_cookies
        load_cookies_horizontalLayout = QHBoxLayout()

        self.load_cookies_label = QLabel(self.advance_options_tab)
        load_cookies_horizontalLayout.addWidget(self.load_cookies_label)

        self.load_cookies_lineEdit = QLineEdit(self.advance_options_tab)
        load_cookies_horizontalLayout.addWidget(self.load_cookies_lineEdit)

        advance_options_tab_verticalLayout.addLayout(
            load_cookies_horizontalLayout)

        self.add_link_tabWidget.addTab(self.advance_options_tab, '')

        # ok cancel download_later buttons ->
        buttons_horizontalLayout = QHBoxLayout()
        buttons_horizontalLayout.addStretch(1)

        self.download_later_pushButton = QPushButton(self)
        self.download_later_pushButton.setIcon(QIcon(icons + 'stop'))

        self.cancel_pushButton = QPushButton(self)
        self.cancel_pushButton.setIcon(QIcon(icons + 'remove'))

        self.ok_pushButton = QPushButton(self)
        self.ok_pushButton.setIcon(QIcon(icons + 'ok'))

        buttons_horizontalLayout.addWidget(self.download_later_pushButton)
        buttons_horizontalLayout.addWidget(self.cancel_pushButton)
        buttons_horizontalLayout.addWidget(self.ok_pushButton)

        window_verticalLayout.addLayout(buttons_horizontalLayout)

        self.setLayout(window_verticalLayout)

        # labels ->
        self.setWindowTitle(
            QCoreApplication.translate("addlink_ui_tr", "Enter Your Link"))

        self.link_label.setText(
            QCoreApplication.translate("addlink_ui_tr", "Download Link: "))

        self.add_queue_label.setText(
            QCoreApplication.translate("addlink_ui_tr", "Add to category: "))

        self.change_name_checkBox.setText(
            QCoreApplication.translate("addlink_ui_tr", "Change File Name: "))

        self.detect_proxy_pushButton.setText(
            QCoreApplication.translate("addlink_ui_tr",
                                       "Detect system proxy setting"))
        self.proxy_checkBox.setText(
            QCoreApplication.translate("addlink_ui_tr", "Proxy"))
        self.proxy_pass_label.setText(
            QCoreApplication.translate("addlink_ui_tr", "Proxy PassWord: "******"addlink_ui_tr", "IP: "))
        self.proxy_user_label.setText(
            QCoreApplication.translate("addlink_ui_tr", "Proxy UserName: "******"addlink_ui_tr", "Port:"))

        self.download_checkBox.setText(
            QCoreApplication.translate("addlink_ui_tr",
                                       "Download UserName and PassWord"))
        self.download_user_label.setText(
            QCoreApplication.translate("addlink_ui_tr", "Download UserName: "******"addlink_ui_tr", "Download PassWord: "******"addlink_ui_tr",
                                       "Change Download Folder"))
        self.folder_label.setText(
            QCoreApplication.translate("addlink_ui_tr", "Download Folder: "))

        self.start_checkBox.setText(
            QCoreApplication.translate("addlink_ui_tr", "Start Time"))
        self.end_checkBox.setText(
            QCoreApplication.translate("addlink_ui_tr", "End Time"))

        self.limit_checkBox.setText(
            QCoreApplication.translate("addlink_ui_tr", "Limit Speed"))
        self.limit_comboBox.setItemText(0, "KiB/s")
        self.limit_comboBox.setItemText(1, "MiB/s")

        self.connections_label.setText(
            QCoreApplication.translate("addlink_ui_tr",
                                       "Number Of Connections:"))

        self.cancel_pushButton.setText(
            QCoreApplication.translate("addlink_ui_tr", "Cancel"))
        self.ok_pushButton.setText(
            QCoreApplication.translate("addlink_ui_tr", "OK"))

        self.download_later_pushButton.setText(
            QCoreApplication.translate("addlink_ui_tr", "Download later"))

        self.add_link_tabWidget.setTabText(
            self.add_link_tabWidget.indexOf(self.link_tab),
            QCoreApplication.translate("addlink_ui_tr", "Link"))

        self.add_link_tabWidget.setTabText(
            self.add_link_tabWidget.indexOf(self.proxy_tab),
            QCoreApplication.translate("addlink_ui_tr", "Proxy"))

        self.add_link_tabWidget.setTabText(
            self.add_link_tabWidget.indexOf(self.more_options_tab),
            QCoreApplication.translate("addlink_ui_tr", "More Options"))

        self.add_link_tabWidget.setTabText(
            self.add_link_tabWidget.indexOf(self.advance_options_tab),
            QCoreApplication.translate("addlink_ui_tr", "Advanced Options"))

        self.referer_label.setText(
            QCoreApplication.translate("addlink_ui_tr", 'Referrer: '))

        self.header_label.setText(
            QCoreApplication.translate("addlink_ui_tr", 'Header: '))

        self.load_cookies_label.setText(
            QCoreApplication.translate("addlink_ui_tr", 'Load cookies: '))

        self.user_agent_label.setText(
            QCoreApplication.translate("addlink_ui_tr", 'User agent: '))
    def _gen_unit_selector(self):

        # Unit selection box
        self.unit_layout = QHBoxLayout()
        self.unit_layout.setContentsMargins(0, 0, 0, 0)

        # Generate unit box (double value)
        if self.config['unit'] == "__DOUBLE__":

            # Unit select first (see below)
            self.unit_select = None
            self._selected = None

            # Unit value Spinbox
            self.unit_value = QDoubleSpinBox()
            self.unit_value.setDecimals(3)
            self.unit_value.setSingleStep(0.1)
            self._update_unit_selector()
            self.unit_value.setValue(self.config["default"][0])
            self.unit_value.setFixedWidth(200)

        # Generate unit box (int value)
        elif self.config['unit'] == "__INT__":

            # Unit select first (see below)
            self.unit_select = None
            self._selected = None

            # Unit value Spinbox
            self.unit_value = QSpinBox()
            self.unit_value.setFixedWidth(200)
            self.unit_value.setValue(int(self.config["default"][0]))
            self._update_unit_selector()  # for limits on init

        # General case (physical units)
        else:

            # Unit selection combobox: needs to be first so self.unit_select
            # exists on _update_unit_limits call
            self.unit_select = QComboBox()
            self.unit_select.setFixedWidth(80)
            self.unit_select.addItems(list(self._units.keys()))
            self.unit_select.setCurrentText(self.config["default"][1] +
                                            self.config["unit"])
            self.unit_select.currentTextChanged.connect(
                self._update_unit_selector)

            # Cache current value of base
            self._selected = self.unit_select.currentText()

            # Unit value Spinbox
            self.unit_value = QDoubleSpinBox()
            self.unit_value.setDecimals(3)
            self.unit_value.setSingleStep(0.1)
            self._update_unit_selector()  # for limits on init
            self.unit_value.setValue(self.config["default"][0])
            self.unit_value.setFixedWidth(200)

        # Add widgets to hbox
        self.unit_label = QLabel(self.config["label"])  # Pack this last

        # Pack units
        self.unit_layout.addWidget(self.unit_value)
        if self.unit_select is not None:
            self.unit_layout.addWidget(self.unit_select)
        self.unit_layout.addWidget(self.unit_label)
        self.unit_layout.setContentsMargins(0, 0, 0, 0)

        # Return layout
        return self.unit_layout
Exemple #17
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(533, 388)
        self.centralwidget = QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.gridLayout = QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.mainGridLayout = QGridLayout()
        self.mainGridLayout.setObjectName(_fromUtf8("mainGridLayout"))
        self.z_Spin = QSpinBox(self.centralwidget)
        self.z_Spin.setMinimum(1)
        self.z_Spin.setObjectName(_fromUtf8("z_Spin"))
        self.mainGridLayout.addWidget(self.z_Spin, 2, 0, 1, 2)
        self.time_Spin = QSpinBox(self.centralwidget)
        self.time_Spin.setMinimum(1)
        self.time_Spin.setObjectName(_fromUtf8("time_Spin"))
        self.mainGridLayout.addWidget(self.time_Spin, 2, 2, 1, 1)
        self.openFile_Button = QPushButton(self.centralwidget)
        self.openFile_Button.setObjectName(_fromUtf8("openFile_Button"))
        self.mainGridLayout.addWidget(self.openFile_Button, 0, 0, 1, 1)
        self.DIC_Spin = QSpinBox(self.centralwidget)
        self.DIC_Spin.setMinimum(1)
        self.DIC_Spin.setObjectName(_fromUtf8("DIC_Spin"))
        self.mainGridLayout.addWidget(self.DIC_Spin, 2, 4, 1, 1)
        self.Z_Label = QLabel(self.centralwidget)
        self.Z_Label.setObjectName(_fromUtf8("Z_Label"))
        self.mainGridLayout.addWidget(self.Z_Label, 1, 0, 1, 2)
        self.correctAtt_Check = QCheckBox(self.centralwidget)
        self.correctAtt_Check.setObjectName(_fromUtf8("correctAtt_Check"))
        self.mainGridLayout.addWidget(self.correctAtt_Check, 3, 4, 1, 1)
        self.Ch_label = QLabel(self.centralwidget)
        self.Ch_label.setObjectName(_fromUtf8("Ch_label"))
        self.mainGridLayout.addWidget(self.Ch_label, 1, 3, 1, 1)
        self.Bkgd_horizontalLayout = QHBoxLayout()
        self.Bkgd_horizontalLayout.setObjectName(
            _fromUtf8("Bkgd_horizontalLayout"))
        self.removeBG_Check = QCheckBox(self.centralwidget)
        self.removeBG_Check.setObjectName(_fromUtf8("removeBG_Check"))
        self.Bkgd_horizontalLayout.addWidget(self.removeBG_Check)
        self.customize_Check = QCheckBox(self.centralwidget)
        self.customize_Check.setObjectName(_fromUtf8("customize_Check"))
        self.Bkgd_horizontalLayout.addWidget(self.customize_Check)
        self.mainGridLayout.addLayout(self.Bkgd_horizontalLayout, 3, 2, 1, 2)
        self.comboBox = QComboBox(self.centralwidget)
        self.comboBox.setObjectName(_fromUtf8("comboBox"))
        self.comboBox.addItem(_fromUtf8(""))
        self.comboBox.addItem(_fromUtf8(""))
        self.mainGridLayout.addWidget(self.comboBox, 4, 0, 3, 2)
        self.fileName_Line = QLineEdit(self.centralwidget)
        self.fileName_Line.setObjectName(_fromUtf8("fileName_Line"))
        self.mainGridLayout.addWidget(self.fileName_Line, 0, 1, 1, 4)
        self.correctDrift_Check = QCheckBox(self.centralwidget)
        self.correctDrift_Check.setObjectName(_fromUtf8("correctDrift_Check"))
        self.mainGridLayout.addWidget(self.correctDrift_Check, 3, 0, 1, 2)
        self.T_Label = QLabel(self.centralwidget)
        self.T_Label.setObjectName(_fromUtf8("T_Label"))
        self.mainGridLayout.addWidget(self.T_Label, 1, 2, 1, 1)
        self.DIC_label = QLabel(self.centralwidget)
        self.DIC_label.setObjectName(_fromUtf8("DIC_label"))
        self.mainGridLayout.addWidget(self.DIC_label, 1, 4, 1, 1)
        self.channel_Spin = QSpinBox(self.centralwidget)
        self.channel_Spin.setMinimum(1)
        self.channel_Spin.setMaximum(5)
        self.channel_Spin.setObjectName(_fromUtf8("channel_Spin"))
        self.mainGridLayout.addWidget(self.channel_Spin, 2, 3, 1, 1)
        self.run_Button = QPushButton(self.centralwidget)
        self.run_Button.setObjectName(_fromUtf8("run_Button"))
        self.mainGridLayout.addWidget(self.run_Button, 9, 0, 1, 1)
        self.horizontalLayout = QHBoxLayout()
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.resolution_Spin = QDoubleSpinBox(self.centralwidget)
        self.resolution_Spin.setSingleStep(0.01)
        self.resolution_Spin.setProperty("value", 0.21)
        self.resolution_Spin.setObjectName(_fromUtf8("resolution_Spin"))
        self.horizontalLayout.addWidget(self.resolution_Spin)
        self.resolution_Label = QLabel(self.centralwidget)
        self.resolution_Label.setObjectName(_fromUtf8("resolution_Label"))
        self.horizontalLayout.addWidget(self.resolution_Label)
        self.mainGridLayout.addLayout(self.horizontalLayout, 7, 0, 2, 2)
        self.verticalLayout = QVBoxLayout()
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.correctAtt_Spin = QDoubleSpinBox(self.centralwidget)
        self.correctAtt_Spin.setMaximum(1.0)
        self.correctAtt_Spin.setMinimum(0.01)
        self.correctAtt_Spin.setValue(0.1)
        self.correctAtt_Spin.setSingleStep(0.01)
        self.correctAtt_Spin.setObjectName(_fromUtf8("correctAtt_Spin"))
        self.verticalLayout.addWidget(self.correctAtt_Spin)
        spacerItem = QSpacerItem(88, 37, QSizePolicy.Minimum,
                                 QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)
        self.mainGridLayout.addLayout(self.verticalLayout, 4, 4, 5, 1)
        self.featureSize_verticalLayout = QVBoxLayout()
        self.featureSize_verticalLayout.setObjectName(
            _fromUtf8("featureSize_verticalLayout"))
        self.horizontalLayout_1 = QHBoxLayout()
        self.horizontalLayout_1.setObjectName(_fromUtf8("horizontalLayout_1"))
        self.featureSize1_Label = QLabel(self.centralwidget)
        self.featureSize1_Label.setEnabled(True)
        self.featureSize1_Label.setObjectName(_fromUtf8("featureSize1_Label"))
        self.horizontalLayout_1.addWidget(self.featureSize1_Label)
        self.featureSize1_Spin = oddSpinBox(self.centralwidget)
        self.featureSize1_Spin.setEnabled(True)
        self.featureSize1_Spin.setMaximum(999)
        self.featureSize1_Spin.setSingleStep(2)
        self.featureSize1_Spin.setObjectName(_fromUtf8("featureSize1_Spin"))
        self.horizontalLayout_1.addWidget(self.featureSize1_Spin)
        self.featureSize_verticalLayout.addLayout(self.horizontalLayout_1)
        self.horizontalLayout_2 = QHBoxLayout()
        self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
        self.featureSize2_Label = QLabel(self.centralwidget)
        self.featureSize2_Label.setEnabled(True)
        self.featureSize2_Label.setObjectName(_fromUtf8("featureSize2_Label"))
        self.horizontalLayout_2.addWidget(self.featureSize2_Label)
        self.featureSize2_Spin = oddSpinBox(self.centralwidget)
        self.featureSize2_Spin.setEnabled(True)
        self.featureSize2_Spin.setMaximum(999)
        self.featureSize2_Spin.setSingleStep(2)
        self.featureSize2_Spin.setObjectName(_fromUtf8("featureSize2_Spin"))
        self.horizontalLayout_2.addWidget(self.featureSize2_Spin)
        self.featureSize_verticalLayout.addLayout(self.horizontalLayout_2)
        self.horizontalLayout_3 = QHBoxLayout()
        self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
        self.featureSize3_Label = QLabel(self.centralwidget)
        self.featureSize3_Label.setEnabled(True)
        self.featureSize3_Label.setObjectName(_fromUtf8("featureSize3_Label"))
        self.horizontalLayout_3.addWidget(self.featureSize3_Label)
        self.featureSize3_Spin = oddSpinBox(self.centralwidget)
        self.featureSize3_Spin.setEnabled(True)
        self.featureSize3_Spin.setMaximum(999)
        self.featureSize3_Spin.setSingleStep(2)
        self.featureSize3_Spin.setObjectName(_fromUtf8("featureSize3_Spin"))
        self.horizontalLayout_3.addWidget(self.featureSize3_Spin)
        self.featureSize_verticalLayout.addLayout(self.horizontalLayout_3)
        self.horizontalLayout_5 = QHBoxLayout()
        self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5"))
        self.featureSize4_Label = QLabel(self.centralwidget)
        self.featureSize4_Label.setEnabled(True)
        self.featureSize4_Label.setObjectName(_fromUtf8("featureSize4_Label"))
        self.horizontalLayout_5.addWidget(self.featureSize4_Label)
        self.featureSize4_Spin = oddSpinBox(self.centralwidget)
        self.featureSize4_Spin.setEnabled(True)
        self.featureSize4_Spin.setMaximum(999)
        self.featureSize4_Spin.setSingleStep(2)
        self.featureSize4_Spin.setObjectName(_fromUtf8("featureSize4_Spin"))
        self.horizontalLayout_5.addWidget(self.featureSize4_Spin)
        self.featureSize_verticalLayout.addLayout(self.horizontalLayout_5)
        self.horizontalLayout_8 = QHBoxLayout()
        self.horizontalLayout_8.setObjectName(_fromUtf8("horizontalLayout_8"))
        self.featureSize5_Label = QLabel(self.centralwidget)
        self.featureSize5_Label.setEnabled(True)
        self.featureSize5_Label.setObjectName(_fromUtf8("featureSize5_Label"))
        self.horizontalLayout_8.addWidget(self.featureSize5_Label)
        self.featureSize5_Spin = oddSpinBox(self.centralwidget)
        self.featureSize5_Spin.setEnabled(True)
        self.featureSize5_Spin.setMaximum(999)
        self.featureSize5_Spin.setSingleStep(2)
        self.featureSize5_Spin.setObjectName(_fromUtf8("featureSize5_Spin"))
        self.horizontalLayout_8.addWidget(self.featureSize5_Spin)
        self.featureSize_verticalLayout.addLayout(self.horizontalLayout_8)
        spacerItem1 = QSpacerItem(20, 40, QSizePolicy.Minimum,
                                  QSizePolicy.Expanding)
        self.featureSize_verticalLayout.addItem(spacerItem1)
        self.mainGridLayout.addLayout(self.featureSize_verticalLayout, 4, 2, 5,
                                      2)
        self.gridLayout.addLayout(self.mainGridLayout, 0, 0, 1, 1)
        self.resolution_Label.raise_()
        MainWindow.setCentralWidget(self.centralwidget)
        self.statusBar = QStatusBar(MainWindow)
        self.statusBar.setObjectName(_fromUtf8("statusBar"))
        MainWindow.setStatusBar(self.statusBar)

        self.featureSpins = [
            self.featureSize1_Spin, self.featureSize2_Spin,
            self.featureSize3_Spin, self.featureSize4_Spin,
            self.featureSize5_Spin
        ]
        self.featureLabels = [
            self.featureSize1_Label, self.featureSize2_Label,
            self.featureSize3_Label, self.featureSize4_Label,
            self.featureSize5_Label
        ]
        self.defaultFeatureValue = 301
        self.initialSetup()

        self.retranslateUi(MainWindow)
        self.connectUI()
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
Exemple #18
0
    def init_UI(self):
        self.setWindowIcon(QIcon('./icons/ciao.png'))
        self.setWindowTitle('CIAO')

        self.setMinimumWidth(ccfg.ui_width_px)
        self.setMinimumHeight(ccfg.ui_height_px)

        layout = QGridLayout()
        imax = 2**ccfg.bit_depth - 1
        imin = 0

        self.boxes_coords = []
        for x1, x2, y1, y2 in zip(self.loop.sensor.search_boxes.x1,
                                  self.loop.sensor.search_boxes.x2,
                                  self.loop.sensor.search_boxes.y1,
                                  self.loop.sensor.search_boxes.y2):
            self.boxes_coords.append((x1, x2, y1, y2))

        self.overlay_boxes = Overlay(coords=self.boxes_coords,
                                     mode='rects',
                                     color=ccfg.search_box_color,
                                     thickness=ccfg.search_box_thickness)

        self.overlay_slopes = Overlay(coords=[],
                                      mode='lines',
                                      color=ccfg.slope_line_color,
                                      thickness=ccfg.slope_line_thickness)

        self.id_spots = ZoomDisplay(
            'Spots',
            clim=ccfg.spots_contrast_limits,
            colormap=ccfg.spots_colormap,
            zoom=0.25,
            overlays=[self.overlay_boxes, self.overlay_slopes],
            downsample=ccfg.spots_image_downsampling)

        layout.addWidget(self.id_spots, 0, 0, 3, 3)

        self.id_mirror = ZoomDisplay('Mirror',
                                     clim=ccfg.mirror_contrast_limits,
                                     colormap=ccfg.mirror_colormap,
                                     zoom=1.0)
        self.id_wavefront = ZoomDisplay('Wavefront',
                                        clim=ccfg.wavefront_contrast_limits,
                                        colormap=ccfg.wavefront_colormap,
                                        zoom=1.0)

        self.id_zoomed_spots = ZoomDisplay('Zoomed spots',
                                           clim=ccfg.spots_contrast_limits,
                                           colormap=ccfg.spots_colormap,
                                           zoom=5.0)

        layout.addWidget(self.id_mirror, 0, 3, 1, 1)
        layout.addWidget(self.id_wavefront, 1, 3, 1, 1)
        layout.addWidget(self.id_zoomed_spots, 2, 3, 1, 1)

        column_2 = QVBoxLayout()
        column_2.setAlignment(Qt.AlignTop)
        self.cb_closed = QCheckBox('Loop &closed')
        self.cb_closed.setChecked(self.loop.closed)
        self.cb_closed.stateChanged.connect(self.loop.set_closed)

        self.cb_paused = QCheckBox('Loop &paused')
        self.cb_paused.setChecked(self.loop.paused)
        self.cb_paused.stateChanged.connect(self.loop.set_paused)

        self.cb_safe = QCheckBox('Loop safe')
        self.cb_safe.setChecked(self.loop.safe)
        self.cb_safe.stateChanged.connect(self.loop.set_safe)

        loop_control_layout = QHBoxLayout()
        loop_control_layout.addWidget(self.cb_closed)
        loop_control_layout.addWidget(self.cb_paused)
        loop_control_layout.addWidget(self.cb_safe)

        self.cb_draw_boxes = QCheckBox('Draw boxes')
        self.cb_draw_boxes.setChecked(self.draw_boxes)
        self.cb_draw_boxes.stateChanged.connect(self.set_draw_boxes)

        self.cb_draw_lines = QCheckBox('Draw lines')
        self.cb_draw_lines.setChecked(self.draw_lines)
        self.cb_draw_lines.stateChanged.connect(self.set_draw_lines)

        self.cb_logging = QCheckBox('Logging')
        self.cb_logging.setChecked(False)
        self.cb_logging.stateChanged.connect(self.loop.sensor.set_logging)
        self.cb_logging.stateChanged.connect(self.loop.mirror.set_logging)

        self.pb_poke = QPushButton('Measure poke matrix')
        self.pb_poke.clicked.connect(self.loop.run_poke)
        self.pb_record_reference = QPushButton('Record reference')
        self.pb_record_reference.clicked.connect(
            self.loop.sensor.record_reference)

        self.pb_flatten = QPushButton('&Flatten')
        self.pb_flatten.clicked.connect(self.loop.mirror.flatten)

        self.pb_restore_flat = QPushButton('Restore flat')
        self.pb_restore_flat.clicked.connect(self.restore_flat)
        self.pb_restore_flat.setEnabled(False)

        self.pb_set_flat = QPushButton('Set flat')
        self.pb_set_flat.clicked.connect(self.set_flat)
        self.pb_set_flat.setCheckable(True)
        #print dir(self.pb_set_flat)
        #sys.exit()

        self.pb_quit = QPushButton('&Quit')
        self.pb_quit.clicked.connect(self.quit)

        poke_layout = QHBoxLayout()
        poke_layout.addWidget(QLabel('Modes:'))
        self.modes_spinbox = QSpinBox()
        n_actuators = int(np.sum(self.loop.mirror.mirror_mask))
        self.modes_spinbox.setMaximum(n_actuators)
        self.modes_spinbox.setMinimum(0)
        self.modes_spinbox.valueChanged.connect(self.loop.set_n_modes)
        self.modes_spinbox.setValue(self.loop.get_n_modes())
        poke_layout.addWidget(self.modes_spinbox)
        self.pb_invert = QPushButton('Invert')
        self.pb_invert.clicked.connect(self.loop.invert)
        poke_layout.addWidget(self.pb_invert)

        modal_layout = QHBoxLayout()
        modal_layout.addWidget(QLabel('Corrected Zernike orders:'))
        self.corrected_order_spinbox = QSpinBox()
        max_order = self.loop.sensor.reconstructor.N_orders
        self.corrected_order_spinbox.setMaximum(max_order)
        self.corrected_order_spinbox.setMinimum(0)
        self.corrected_order_spinbox.valueChanged.connect(
            self.loop.sensor.set_n_zernike_orders_corrected)
        self.corrected_order_spinbox.setValue(
            self.loop.sensor.get_n_zernike_orders_corrected())
        modal_layout.addWidget(self.corrected_order_spinbox)
        modal_layout.addWidget(QLabel('(%d -> no filtering)' % max_order))

        dark_layout = QHBoxLayout()
        self.cb_dark_subtraction = QCheckBox('Subtract dark')
        self.cb_dark_subtraction.setChecked(self.loop.sensor.dark_subtract)
        self.cb_dark_subtraction.stateChanged.connect(
            self.loop.sensor.set_dark_subtraction)
        dark_layout.addWidget(self.cb_dark_subtraction)

        dark_layout.addWidget(QLabel('Dark subtract N:'))
        self.n_dark_spinbox = QSpinBox()
        self.n_dark_spinbox.setMinimum(1)
        self.n_dark_spinbox.setMaximum(9999)
        self.n_dark_spinbox.valueChanged.connect(self.loop.sensor.set_n_dark)
        self.n_dark_spinbox.setValue(self.loop.sensor.n_dark)
        dark_layout.addWidget(self.n_dark_spinbox)

        self.pb_set_dark = QPushButton('Set dark')
        self.pb_set_dark.clicked.connect(self.loop.sensor.set_dark)
        dark_layout.addWidget(self.pb_set_dark)

        centroiding_layout = QHBoxLayout()
        centroiding_layout.addWidget(QLabel('Centroiding:'))
        self.cb_fast_centroiding = QCheckBox('Fast centroiding')
        self.cb_fast_centroiding.setChecked(self.loop.sensor.fast_centroiding)
        self.cb_fast_centroiding.stateChanged.connect(
            self.loop.sensor.set_fast_centroiding)
        centroiding_layout.addWidget(self.cb_fast_centroiding)
        self.centroiding_width_spinbox = QSpinBox()
        self.centroiding_width_spinbox.setMaximum(
            self.loop.sensor.search_boxes.half_width)
        self.centroiding_width_spinbox.setMinimum(0)
        self.centroiding_width_spinbox.valueChanged.connect(
            self.loop.sensor.set_centroiding_half_width)
        self.centroiding_width_spinbox.setValue(
            self.loop.sensor.centroiding_half_width)
        centroiding_layout.addWidget(self.centroiding_width_spinbox)

        bg_layout = QHBoxLayout()
        bg_layout.addWidget(QLabel('Background correction:'))
        self.bg_spinbox = QSpinBox()
        self.bg_spinbox.setValue(self.loop.sensor.background_correction)
        self.bg_spinbox.setMaximum(500)
        self.bg_spinbox.setMinimum(-500)
        self.bg_spinbox.valueChanged.connect(
            self.loop.sensor.set_background_correction)
        bg_layout.addWidget(self.bg_spinbox)

        f_layout = QHBoxLayout()
        f_layout.addWidget(QLabel('Defocus:'))
        self.f_spinbox = QDoubleSpinBox()
        self.f_spinbox.setValue(0.0)
        self.f_spinbox.setSingleStep(0.01)
        self.f_spinbox.setMaximum(10.0)
        self.f_spinbox.setMinimum(-10.0)
        self.f_spinbox.valueChanged.connect(self.loop.sensor.set_defocus)
        f_layout.addWidget(self.f_spinbox)

        e_layout = QHBoxLayout()
        e_layout.addWidget(QLabel('Exposure:'))
        self.e_spinbox = QSpinBox()
        self.e_spinbox.setValue(self.loop.sensor.cam.get_exposure())
        self.e_spinbox.setSingleStep(1000)
        self.e_spinbox.setMaximum(1000000)
        self.e_spinbox.setMinimum(1000)
        self.e_spinbox.valueChanged.connect(self.loop.sensor.cam.set_exposure)
        e_layout.addWidget(self.e_spinbox)

        self.stripchart_error = StripChart(
            ylim=ccfg.error_plot_ylim,
            ytick_interval=ccfg.error_plot_ytick_interval,
            print_function=ccfg.error_plot_print_func,
            hlines=[0.0, ccfg.wavelength_m / 14.0],
            buffer_length=ccfg.error_plot_buffer_length)
        self.stripchart_error.setAlignment(Qt.AlignRight)

        #self.stripchart_defocus = StripChart(ylim=ccfg.zernike_plot_ylim,ytick_interval=ccfg.zernike_plot_ytick_interval,print_function=ccfg.zernike_plot_print_func,buffer_length=ccfg.zernike_plot_buffer_length)
        #self.stripchart_defocus.setAlignment(Qt.AlignRight)

        self.lbl_tip = QLabel()
        self.lbl_tip.setAlignment(Qt.AlignRight)

        self.lbl_tilt = QLabel()
        self.lbl_tilt.setAlignment(Qt.AlignRight)

        self.lbl_cond = QLabel()
        self.lbl_cond.setAlignment(Qt.AlignRight)

        self.lbl_sensor_fps = QLabel()
        self.lbl_sensor_fps.setAlignment(Qt.AlignRight)

        self.ind_centroiding_time = Indicator(
            buffer_length=50,
            print_function=lambda x: '%0.0f us (centroiding)' % (x * 1e6))
        self.ind_centroiding_time.setAlignment(Qt.AlignRight)

        self.ind_image_max = Indicator(
            buffer_length=10, print_function=lambda x: '%d ADU (max)' % x)
        self.ind_image_mean = Indicator(
            buffer_length=10, print_function=lambda x: '%d ADU (mean)' % x)
        self.ind_image_min = Indicator(
            buffer_length=10, print_function=lambda x: '%d ADU (min)' % x)
        self.ind_image_max.setAlignment(Qt.AlignRight)
        self.ind_image_mean.setAlignment(Qt.AlignRight)
        self.ind_image_min.setAlignment(Qt.AlignRight)

        self.lbl_mirror_fps = QLabel()
        self.lbl_mirror_fps.setAlignment(Qt.AlignRight)

        self.lbl_ui_fps = QLabel()
        self.lbl_ui_fps.setAlignment(Qt.AlignRight)

        flatten_layout = QHBoxLayout()
        flatten_layout.addWidget(self.pb_flatten)
        flatten_layout.addWidget(self.pb_restore_flat)
        flatten_layout.addWidget(self.pb_set_flat)

        column_2.addLayout(flatten_layout)

        column_2.addLayout(loop_control_layout)
        #column_2.addWidget(self.cb_fast_centroiding)
        column_2.addLayout(f_layout)
        column_2.addLayout(e_layout)
        column_2.addLayout(centroiding_layout)
        column_2.addLayout(bg_layout)
        column_2.addLayout(poke_layout)
        column_2.addLayout(modal_layout)
        column_2.addLayout(dark_layout)
        column_2.addWidget(self.cb_draw_boxes)
        column_2.addWidget(self.cb_draw_lines)
        column_2.addWidget(self.pb_quit)

        column_2.addWidget(self.stripchart_error)
        #column_2.addWidget(self.stripchart_defocus)
        column_2.addWidget(self.lbl_tip)
        column_2.addWidget(self.lbl_tilt)
        column_2.addWidget(self.lbl_cond)
        column_2.addWidget(self.ind_image_max)
        column_2.addWidget(self.ind_image_mean)
        column_2.addWidget(self.ind_image_min)
        column_2.addWidget(self.ind_centroiding_time)

        column_2.addWidget(self.lbl_sensor_fps)
        column_2.addWidget(self.lbl_mirror_fps)
        column_2.addWidget(self.lbl_ui_fps)

        column_2.addWidget(self.pb_poke)
        column_2.addWidget(self.pb_record_reference)

        column_2.addWidget(self.cb_logging)

        layout.addLayout(column_2, 0, 6, 3, 1)

        self.setLayout(layout)
Exemple #19
0
 def initRewardsForm(self):
     self.collateralHidden = True
     self.rewardsForm = QGroupBox()
     self.rewardsForm.setTitle("Transfer Rewards")
     layout = QFormLayout()
     layout.setContentsMargins(10, 10, 10, 10)
     layout.setSpacing(13)
     layout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)
     ##--- ROW 1
     hBox = QHBoxLayout()
     self.mnSelect = QComboBox()
     self.mnSelect.setToolTip("Select Masternode")
     hBox.addWidget(self.mnSelect)
     self.btn_ReloadUTXOs = QPushButton()
     self.btn_ReloadUTXOs.setToolTip("Reload UTXOs")
     refresh_icon = QIcon(os.path.join(self.imgDir, 'icon_refresh.png'))
     self.btn_ReloadUTXOs.setIcon(refresh_icon)
     hBox.addWidget(self.btn_ReloadUTXOs)
     hBox.addStretch(1)
     label = QLabel("Total Address Balance")
     label.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
     hBox.addWidget(label)
     self.addrAvailLine = QLabel()
     self.addrAvailLine.setToolTip("PIVX Address total balance")
     self.addrAvailLine.setText("--")
     hBox.addWidget(self.addrAvailLine)
     self.btn_toggleCollateral = QPushButton("Show Collateral")
     hBox.addWidget(self.btn_toggleCollateral)
     layout.addRow(QLabel("Masternode"), hBox)
     ## --- ROW 2: REWARDS
     self.rewardsList = QVBoxLayout()
     self.rewardsList.statusLabel = QLabel()
     self.rewardsList.statusLabel.setMinimumWidth(116)
     self.resetStatusLabel('<b style="color:red">Reload Rewards</b>')
     self.rewardsList.addWidget(self.rewardsList.statusLabel)
     self.rewardsList.box = QTableWidget()
     self.rewardsList.box.setMinimumHeight(140)
     #self.rewardsList.box.setMaximumHeight(140)
     self.rewardsList.box.setHorizontalScrollBarPolicy(
         Qt.ScrollBarAlwaysOff)
     self.rewardsList.box.setSelectionMode(QAbstractItemView.MultiSelection)
     self.rewardsList.box.setSelectionBehavior(QAbstractItemView.SelectRows)
     self.rewardsList.box.setShowGrid(True)
     self.rewardsList.box.setColumnCount(4)
     self.rewardsList.box.setRowCount(0)
     self.rewardsList.box.horizontalHeader().setSectionResizeMode(
         2, QHeaderView.Stretch)
     self.rewardsList.box.verticalHeader().hide()
     item = QTableWidgetItem()
     item.setText("PIVs")
     item.setTextAlignment(Qt.AlignCenter)
     self.rewardsList.box.setHorizontalHeaderItem(0, item)
     item = QTableWidgetItem()
     item.setText("Confirmations")
     item.setTextAlignment(Qt.AlignCenter)
     self.rewardsList.box.setHorizontalHeaderItem(1, item)
     item = QTableWidgetItem()
     item.setText("TX Hash")
     item.setTextAlignment(Qt.AlignCenter)
     self.rewardsList.box.setHorizontalHeaderItem(2, item)
     item = QTableWidgetItem()
     item.setText("TX Output N")
     item.setTextAlignment(Qt.AlignCenter)
     self.rewardsList.box.setHorizontalHeaderItem(3, item)
     item = QTableWidgetItem()
     self.rewardsList.addWidget(self.rewardsList.box)
     layout.addRow(self.rewardsList)
     ##--- ROW 3
     hBox2 = QHBoxLayout()
     self.btn_selectAllRewards = QPushButton("Select All")
     self.btn_selectAllRewards.setToolTip("Select all available UTXOs")
     hBox2.addWidget(self.btn_selectAllRewards)
     self.btn_deselectAllRewards = QPushButton("Deselect all")
     self.btn_deselectAllRewards.setToolTip("Deselect current selection")
     hBox2.addWidget(self.btn_deselectAllRewards)
     hBox2.addWidget(QLabel("Selected rewards"))
     self.selectedRewardsLine = QLabel()
     self.selectedRewardsLine.setMinimumWidth(200)
     self.selectedRewardsLine.setStyleSheet("color: purple")
     self.selectedRewardsLine.setToolTip("PIVX to move away")
     hBox2.addWidget(self.selectedRewardsLine)
     hBox2.addStretch(1)
     layout.addRow(hBox2)
     ##--- ROW 4
     hBox3 = QHBoxLayout()
     self.destinationLine = QLineEdit()
     self.destinationLine.setToolTip("PIVX address to transfer rewards to")
     hBox3.addWidget(self.destinationLine)
     hBox3.addWidget(QLabel("Fee"))
     self.feeLine = QDoubleSpinBox()
     self.feeLine.setDecimals(8)
     self.feeLine.setPrefix("PIV  ")
     self.feeLine.setToolTip("Insert a small fee amount")
     self.feeLine.setFixedWidth(150)
     self.feeLine.setSingleStep(0.001)
     hBox3.addWidget(self.feeLine)
     self.btn_sendRewards = QPushButton("Send")
     hBox3.addWidget(self.btn_sendRewards)
     layout.addRow(QLabel("Destination Address"), hBox3)
     ##--- ROW 5
     hBox4 = QHBoxLayout()
     hBox4.addStretch(1)
     self.loadingLine = QLabel(
         "<b style='color:red'>Preparing TX.</b> Completed: ")
     self.loadingLinePercent = QProgressBar()
     self.loadingLinePercent.setMaximumWidth(200)
     self.loadingLinePercent.setMaximumHeight(10)
     self.loadingLinePercent.setRange(0, 100)
     hBox4.addWidget(self.loadingLine)
     hBox4.addWidget(self.loadingLinePercent)
     self.loadingLine.hide()
     self.loadingLinePercent.hide()
     layout.addRow(hBox4)
     #--- Set Layout
     self.rewardsForm.setLayout(layout)
     #--- ROW 5
     self.btn_Cancel = QPushButton("Clear/Reload")
Exemple #20
0
    def __init__(self, persepolis_setting):
        super().__init__()
        self.persepolis_setting = persepolis_setting

        # get icons name
        icons = ':/' + \
            str(self.persepolis_setting.value('settings/icons')) + '/'

        self.setMinimumSize(QtCore.QSize(520, 425))
        self.setWindowIcon(
            QIcon.fromTheme('persepolis', QIcon(':/persepolis.svg')))

        window_verticalLayout = QVBoxLayout()

        # add link tab widget
        self.add_link_tabWidget = QTabWidget(self)
        window_verticalLayout.addWidget(self.add_link_tabWidget)

        # link tab
        self.link_tab = QWidget()

        link_tab_verticalLayout = QVBoxLayout(self.link_tab)
        link_tab_verticalLayout.setContentsMargins(21, 21, 21, 81)

        self.link_frame = QFrame(self.link_tab)
        self.link_frame.setFrameShape(QFrame.StyledPanel)
        self.link_frame.setFrameShadow(QFrame.Raised)

        horizontalLayout_2 = QHBoxLayout(self.link_frame)

        self.link_verticalLayout = QVBoxLayout()

        # link ->
        self.link_horizontalLayout = QHBoxLayout()
        self.link_label = QLabel(self.link_frame)
        self.link_horizontalLayout.addWidget(self.link_label)

        self.link_lineEdit = QLineEdit(self.link_frame)
        self.link_horizontalLayout.addWidget(self.link_lineEdit)

        self.link_verticalLayout.addLayout(self.link_horizontalLayout)

        horizontalLayout_2.addLayout(self.link_verticalLayout)
        link_tab_verticalLayout.addWidget(self.link_frame)

        # add change_name field ->
        change_name_horizontalLayout = QHBoxLayout()
        self.change_name_checkBox = QCheckBox(self.link_frame)
        change_name_horizontalLayout.addWidget(self.change_name_checkBox)

        self.change_name_lineEdit = QLineEdit(self.link_frame)
        change_name_horizontalLayout.addWidget(self.change_name_lineEdit)

        self.link_verticalLayout.addLayout(change_name_horizontalLayout)

        # add_category ->
        queue_horizontalLayout = QHBoxLayout()

        self.queue_frame = QFrame(self)
        self.queue_frame.setFrameShape(QFrame.StyledPanel)
        self.queue_frame.setFrameShadow(QFrame.Raised)

        add_queue_horizontalLayout = QHBoxLayout(self.queue_frame)

        self.add_queue_label = QLabel(self.queue_frame)
        add_queue_horizontalLayout.addWidget(self.add_queue_label)

        self.add_queue_comboBox = QComboBox(self.queue_frame)
        add_queue_horizontalLayout.addWidget(self.add_queue_comboBox)

        queue_horizontalLayout.addWidget(self.queue_frame)
        queue_horizontalLayout.addStretch(1)

        self.size_label = QLabel(self)
        queue_horizontalLayout.addWidget(self.size_label)

        link_tab_verticalLayout.addLayout(queue_horizontalLayout)

        self.add_link_tabWidget.addTab(self.link_tab, '')

        # proxy tab
        self.proxy_tab = QWidget(self)

        proxy_verticalLayout = QVBoxLayout(self.proxy_tab)
        proxy_verticalLayout.setContentsMargins(21, 21, 21, 171)

        proxy_horizontalLayout = QHBoxLayout()

        self.proxy_checkBox = QCheckBox(self.proxy_tab)
        self.detect_proxy_pushButton = QPushButton(self.proxy_tab)
        self.detect_proxy_label = QLabel(self.proxy_tab)

        proxy_horizontalLayout.addWidget(self.proxy_checkBox)
        proxy_horizontalLayout.addWidget(self.detect_proxy_label)
        proxy_horizontalLayout.addWidget(self.detect_proxy_pushButton)

        proxy_verticalLayout.addLayout(proxy_horizontalLayout)

        self.proxy_frame = QFrame(self.proxy_tab)
        self.proxy_frame.setFrameShape(QFrame.StyledPanel)
        self.proxy_frame.setFrameShadow(QFrame.Raised)

        gridLayout = QGridLayout(self.proxy_frame)

        self.ip_label = QLabel(self.proxy_frame)
        gridLayout.addWidget(self.ip_label, 0, 0, 1, 1)

        self.ip_lineEdit = QLineEdit(self.proxy_frame)
        self.ip_lineEdit.setInputMethodHints(QtCore.Qt.ImhNone)
        gridLayout.addWidget(self.ip_lineEdit, 0, 1, 1, 1)

        self.port_label = QLabel(self.proxy_frame)
        gridLayout.addWidget(self.port_label, 0, 2, 1, 1)

        self.port_spinBox = QSpinBox(self.proxy_frame)
        self.port_spinBox.setMaximum(65535)
        self.port_spinBox.setSingleStep(1)
        gridLayout.addWidget(self.port_spinBox, 0, 3, 1, 1)

        self.proxy_user_label = QLabel(self.proxy_frame)
        gridLayout.addWidget(self.proxy_user_label, 2, 0, 1, 1)

        self.proxy_user_lineEdit = QLineEdit(self.proxy_frame)
        gridLayout.addWidget(self.proxy_user_lineEdit, 2, 1, 1, 1)

        self.proxy_pass_label = QLabel(self.proxy_frame)
        gridLayout.addWidget(self.proxy_pass_label, 2, 2, 1, 1)

        self.proxy_pass_lineEdit = QLineEdit(self.proxy_frame)
        self.proxy_pass_lineEdit.setEchoMode(QLineEdit.Password)
        gridLayout.addWidget(self.proxy_pass_lineEdit, 2, 3, 1, 1)

        proxy_verticalLayout.addWidget(self.proxy_frame)

        self.add_link_tabWidget.addTab(self.proxy_tab, '')

        # more options tab
        self.more_options_tab = QWidget(self)

        more_options_tab_verticalLayout = QVBoxLayout(self.more_options_tab)

        # download UserName & Password ->
        download_horizontalLayout = QHBoxLayout()
        download_horizontalLayout.setContentsMargins(-1, 10, -1, -1)

        download_verticalLayout = QVBoxLayout()
        self.download_checkBox = QCheckBox(self.more_options_tab)
        download_verticalLayout.addWidget(self.download_checkBox)

        self.download_frame = QFrame(self.more_options_tab)
        self.download_frame.setFrameShape(QFrame.StyledPanel)
        self.download_frame.setFrameShadow(QFrame.Raised)

        gridLayout_2 = QGridLayout(self.download_frame)

        self.download_user_lineEdit = QLineEdit(self.download_frame)
        gridLayout_2.addWidget(self.download_user_lineEdit, 0, 1, 1, 1)

        self.download_user_label = QLabel(self.download_frame)
        gridLayout_2.addWidget(self.download_user_label, 0, 0, 1, 1)

        self.download_pass_label = QLabel(self.download_frame)
        gridLayout_2.addWidget(self.download_pass_label, 1, 0, 1, 1)

        self.download_pass_lineEdit = QLineEdit(self.download_frame)
        self.download_pass_lineEdit.setEchoMode(QLineEdit.Password)
        gridLayout_2.addWidget(self.download_pass_lineEdit, 1, 1, 1, 1)
        download_verticalLayout.addWidget(self.download_frame)
        download_horizontalLayout.addLayout(download_verticalLayout)

        # select folder ->
        self.folder_frame = QFrame(self.more_options_tab)
        self.folder_frame.setFrameShape(QFrame.StyledPanel)
        self.folder_frame.setFrameShadow(QFrame.Raised)

        gridLayout_3 = QGridLayout(self.folder_frame)

        self.download_folder_lineEdit = QLineEdit(self.folder_frame)
        gridLayout_3.addWidget(self.download_folder_lineEdit, 2, 0, 1, 1)

        self.folder_pushButton = QPushButton(self.folder_frame)
        gridLayout_3.addWidget(self.folder_pushButton, 3, 0, 1, 1)
        self.folder_pushButton.setIcon(QIcon(icons + 'folder'))

        self.folder_label = QLabel(self.folder_frame)
        self.folder_label.setAlignment(QtCore.Qt.AlignCenter)
        gridLayout_3.addWidget(self.folder_label, 1, 0, 1, 1)
        download_horizontalLayout.addWidget(self.folder_frame)
        more_options_tab_verticalLayout.addLayout(download_horizontalLayout)

        # start time ->
        time_limit_horizontalLayout = QHBoxLayout()
        time_limit_horizontalLayout.setContentsMargins(-1, 10, -1, -1)

        start_verticalLayout = QVBoxLayout()
        self.start_checkBox = QCheckBox(self.more_options_tab)
        start_verticalLayout.addWidget(self.start_checkBox)

        self.start_frame = QFrame(self.more_options_tab)
        self.start_frame.setFrameShape(QFrame.StyledPanel)
        self.start_frame.setFrameShadow(QFrame.Raised)

        horizontalLayout_5 = QHBoxLayout(self.start_frame)

        self.start_time_qDataTimeEdit = QDateTimeEdit(self.start_frame)
        self.start_time_qDataTimeEdit.setDisplayFormat('H:mm')
        horizontalLayout_5.addWidget(self.start_time_qDataTimeEdit)

        start_verticalLayout.addWidget(self.start_frame)
        time_limit_horizontalLayout.addLayout(start_verticalLayout)

        # end time ->
        end_verticalLayout = QVBoxLayout()

        self.end_checkBox = QCheckBox(self.more_options_tab)
        end_verticalLayout.addWidget(self.end_checkBox)

        self.end_frame = QFrame(self.more_options_tab)
        self.end_frame.setFrameShape(QFrame.StyledPanel)
        self.end_frame.setFrameShadow(QFrame.Raised)

        horizontalLayout_6 = QHBoxLayout(self.end_frame)

        self.end_time_qDateTimeEdit = QDateTimeEdit(self.end_frame)
        self.end_time_qDateTimeEdit.setDisplayFormat('H:mm')
        horizontalLayout_6.addWidget(self.end_time_qDateTimeEdit)

        end_verticalLayout.addWidget(self.end_frame)
        time_limit_horizontalLayout.addLayout(end_verticalLayout)

        # limit Speed ->
        limit_verticalLayout = QVBoxLayout()

        self.limit_checkBox = QCheckBox(self.more_options_tab)
        limit_verticalLayout.addWidget(self.limit_checkBox)

        self.limit_frame = QFrame(self.more_options_tab)
        self.limit_frame.setFrameShape(QFrame.StyledPanel)
        self.limit_frame.setFrameShadow(QFrame.Raised)

        horizontalLayout_4 = QHBoxLayout(self.limit_frame)

        self.limit_spinBox = QDoubleSpinBox(self.limit_frame)
        self.limit_spinBox.setMinimum(1)
        self.limit_spinBox.setMaximum(1023)
        horizontalLayout_4.addWidget(self.limit_spinBox)

        self.limit_comboBox = QComboBox(self.limit_frame)
        self.limit_comboBox.addItem("")
        self.limit_comboBox.addItem("")
        horizontalLayout_4.addWidget(self.limit_comboBox)
        limit_verticalLayout.addWidget(self.limit_frame)
        time_limit_horizontalLayout.addLayout(limit_verticalLayout)
        more_options_tab_verticalLayout.addLayout(time_limit_horizontalLayout)

        # number of connections ->
        connections_horizontalLayout = QHBoxLayout()
        connections_horizontalLayout.setContentsMargins(-1, 10, -1, -1)

        self.connections_frame = QFrame(self.more_options_tab)
        self.connections_frame.setFrameShape(QFrame.StyledPanel)
        self.connections_frame.setFrameShadow(QFrame.Raised)

        horizontalLayout_3 = QHBoxLayout(self.connections_frame)
        self.connections_label = QLabel(self.connections_frame)
        horizontalLayout_3.addWidget(self.connections_label)

        self.connections_spinBox = QSpinBox(self.connections_frame)
        self.connections_spinBox.setMinimum(1)
        self.connections_spinBox.setMaximum(16)
        self.connections_spinBox.setProperty("value", 16)
        horizontalLayout_3.addWidget(self.connections_spinBox)
        connections_horizontalLayout.addWidget(self.connections_frame)
        connections_horizontalLayout.addStretch(1)

        more_options_tab_verticalLayout.addLayout(connections_horizontalLayout)

        self.add_link_tabWidget.addTab(self.more_options_tab, '')

        # ok cancel download_later buttons ->
        buttons_horizontalLayout = QHBoxLayout()
        buttons_horizontalLayout.addStretch(1)

        self.download_later_pushButton = QPushButton(self)
        self.download_later_pushButton.setIcon(QIcon(icons + 'stop'))

        self.cancel_pushButton = QPushButton(self)
        self.cancel_pushButton.setIcon(QIcon(icons + 'remove'))

        self.ok_pushButton = QPushButton(self)
        self.ok_pushButton.setIcon(QIcon(icons + 'ok'))

        buttons_horizontalLayout.addWidget(self.download_later_pushButton)
        buttons_horizontalLayout.addWidget(self.cancel_pushButton)
        buttons_horizontalLayout.addWidget(self.ok_pushButton)

        window_verticalLayout.addLayout(buttons_horizontalLayout)

        self.setLayout(window_verticalLayout)

        # labels ->
        self.setWindowTitle("Enter Your Link")

        self.link_label.setText("Download Link : ")

        self.add_queue_label.setText("Add to category : ")

        self.change_name_checkBox.setText("Change File Name : ")

        self.detect_proxy_pushButton.setText("Detect system proxy setting")
        self.proxy_checkBox.setText("Proxy")
        self.proxy_pass_label.setText("Proxy PassWord : "******"IP : ")
        self.proxy_user_label.setText("Proxy UserName : "******"Port:")

        self.download_checkBox.setText("Download UserName and PassWord")
        self.download_user_label.setText("Download UserName : "******"Download PassWord : "******"Change Download Folder")
        self.folder_label.setText("Download Folder : ")

        self.start_checkBox.setText("Start Time")
        self.end_checkBox.setText("End Time")

        self.limit_checkBox.setText("Limit Speed")
        self.limit_comboBox.setItemText(0, "KB/S")
        self.limit_comboBox.setItemText(1, "MB/S")

        self.connections_label.setText("Number Of Connections :")

        self.cancel_pushButton.setText("Cancel")
        self.ok_pushButton.setText("OK")

        self.download_later_pushButton.setText("Download later")

        self.add_link_tabWidget.setTabText(
            self.add_link_tabWidget.indexOf(self.link_tab), "Link")

        self.add_link_tabWidget.setTabText(
            self.add_link_tabWidget.indexOf(self.proxy_tab), "Proxy")

        self.add_link_tabWidget.setTabText(
            self.add_link_tabWidget.indexOf(self.more_options_tab),
            "More Options")
Exemple #21
0
    def __init__(self, parent=None):
        super(ResultHandler, self).__init__()
        self.setWindowTitle('Dash results')
        self.control_label = QLabel()
        self.rendered_label = QLabel()
        self.diff_label = QLabel()

        self.mask_label = QLabel()
        self.new_mask_label = QLabel()

        self.scrollArea = QScrollArea()
        self.widget = QWidget()

        self.test_name_label = QLabel()
        grid = QGridLayout()
        grid.addWidget(self.test_name_label, 0, 0)
        grid.addWidget(QLabel('Control'), 1, 0)
        grid.addWidget(QLabel('Rendered'), 1, 1)
        grid.addWidget(QLabel('Difference'), 1, 2)
        grid.addWidget(self.control_label, 2, 0)
        grid.addWidget(self.rendered_label, 2, 1)
        grid.addWidget(self.diff_label, 2, 2)
        grid.addWidget(QLabel('Current Mask'), 3, 0)
        grid.addWidget(QLabel('New Mask'), 3, 1)
        grid.addWidget(self.mask_label, 4, 0)
        grid.addWidget(self.new_mask_label, 4, 1)

        self.widget.setLayout(grid)
        self.scrollArea.setWidget(self.widget)
        v_layout = QVBoxLayout()
        v_layout.addWidget(self.scrollArea, 1)

        next_image_button = QPushButton()
        next_image_button.setText('Skip')
        next_image_button.pressed.connect(self.load_next)

        self.overload_spin = QDoubleSpinBox()
        self.overload_spin.setMinimum(1)
        self.overload_spin.setMaximum(255)
        self.overload_spin.setValue(1)
        self.overload_spin.valueChanged.connect(
            lambda: save_mask_button.setEnabled(False))

        preview_mask_button = QPushButton()
        preview_mask_button.setText('Preview New Mask')
        preview_mask_button.pressed.connect(self.preview_mask)
        preview_mask_button.pressed.connect(
            lambda: save_mask_button.setEnabled(True))

        save_mask_button = QPushButton()
        save_mask_button.setText('Save New Mask')
        save_mask_button.pressed.connect(self.save_mask)

        button_layout = QHBoxLayout()
        button_layout.addWidget(next_image_button)
        button_layout.addWidget(QLabel('Mask diff multiplier:'))
        button_layout.addWidget(self.overload_spin)
        button_layout.addWidget(preview_mask_button)
        button_layout.addWidget(save_mask_button)
        button_layout.addStretch()
        v_layout.addLayout(button_layout)
        self.setLayout(v_layout)
Exemple #22
0
    def __init__(self, chan_name, group_name, config_value, s_freq):
        super().__init__()

        self.chan_name = chan_name
        self.group_name = group_name

        self.idx_l0 = QListWidget()
        self.idx_l1 = QListWidget()

        self.add_channels_to_list(self.idx_l0, add_ref=True)
        self.add_channels_to_list(self.idx_l1)

        self.idx_hp = QDoubleSpinBox()
        hp = config_value['hp']
        if hp is None:
            hp = 0
        self.idx_hp.setValue(hp)
        self.idx_hp.setSuffix(' Hz')
        self.idx_hp.setDecimals(1)
        self.idx_hp.setMaximum(s_freq / 2)
        self.idx_hp.setToolTip('0 means no filter')

        self.idx_lp = QDoubleSpinBox()
        lp = config_value['lp']
        if lp is None:
            lp = 0
        self.idx_lp.setValue(lp)
        self.idx_lp.setSuffix(' Hz')
        self.idx_lp.setDecimals(1)
        self.idx_lp.setMaximum(s_freq / 2)
        self.idx_lp.setToolTip('0 means no filter')

        self.idx_notch = QDoubleSpinBox()
        if 'notch' in config_value:  # for backward compatibility
            notch = config_value['notch']
        else:
            notch = None
        if notch is None:
            notch = 0
        self.idx_notch.setValue(notch)
        self.idx_notch.setSuffix(' Hz')
        self.idx_notch.setDecimals(1)
        self.idx_notch.setMaximum(s_freq / 2)
        self.idx_notch.setToolTip(
            '50Hz or 60Hz depending on the power line frequency. 0 means no filter'
        )

        self.idx_scale = QDoubleSpinBox()
        self.idx_scale.setValue(config_value['scale'])
        self.idx_scale.setSuffix('x')

        self.idx_reref = QPushButton('Average')
        self.idx_reref.clicked.connect(self.rereference)

        self.idx_color = QColor(config_value['color'])

        self.idx_demean = QCheckBox()
        self.idx_demean.setCheckState(Qt.Unchecked)
        if 'demean' in config_value:  # for backward compatibility
            if config_value['demean']:
                self.idx_demean.setCheckState(Qt.Checked)

        l_form = QFormLayout()
        l_form.addRow('High-Pass', self.idx_hp)
        l_form.addRow('Low-Pass', self.idx_lp)
        l_form.addRow('Notch Filter', self.idx_notch)

        r_form = QFormLayout()
        r_form.addRow('Reference', self.idx_reref)
        r_form.addRow('Scaling', self.idx_scale)
        r_form.addRow('Demean', self.idx_demean)

        l0_layout = QVBoxLayout()
        l0_layout.addWidget(QLabel('Active'))
        l0_layout.addWidget(self.idx_l0)

        l1_layout = QVBoxLayout()
        l1_layout.addWidget(QLabel('Reference'))
        l1_layout.addWidget(self.idx_l1)

        l_layout = QHBoxLayout()
        l_layout.addLayout(l0_layout)
        l_layout.addLayout(l1_layout)

        lr_form = QHBoxLayout()
        lr_form.addLayout(l_form)
        lr_form.addLayout(r_form)

        layout = QVBoxLayout()
        layout.addLayout(l_layout)
        layout.addLayout(lr_form)

        self.setLayout(layout)
Exemple #23
0
    def __init__(self, parent=None):
        super(Window, self).__init__(parent)

        np.set_printoptions(suppress=True)
        np.set_printoptions(linewidth=np.inf)

        # Tabs
        self.create_tab = QWidget()
        self.addTab(self.create_tab, "Create")

        self.train_tab = QWidget()
        self.addTab(self.train_tab, "Train")

        self.error_tab = QWidget()
        self.addTab(self.error_tab, "Error")

        self.summary_tab = QWidget()
        self.addTab(self.summary_tab, "Summary")

        self.error_list = []
        self.test_error = []

        # Create Tab

        #train tab

        self.learning_rate = QDoubleSpinBox()
        self.learning_rate.setRange(0.0001, 0.9999)
        self.learning_rate.setValue(0.1)
        self.learning_rate.setSingleStep(0.01)
        self.learning_rate.setDecimals(4)

        self.epochs_number = QSpinBox()
        self.epochs_number.setRange(1, 100000)
        self.epochs_number.setValue(100)
        self.epochs_number.setSingleStep(1)
        self.max_error = QDoubleSpinBox()
        self.max_error.setRange(0.0001, 0.9999)
        self.max_error.setValue(0.09)

        self.epoch_sum = 0

        self.epoch_label = QLabel("Epoch: ")
        self.error_label = QLabel("Error: ")

        self.canvas_train = FigureCanvas(plt.figure(1))
        self.stop = False
        self.stop_button = QPushButton("Stop")
        self.stop_button.clicked.connect(self.change_stop)
        self.randomize_button = QPushButton('Initialize weights')
        self.randomize_button.clicked.connect(self.randomize)
        self.train_by_steps_button = QPushButton('Train ' +
                                                 self.epochs_number.text() +
                                                 ' epochs')

        #error tab

        self.epoch_label_error = QLabel("Epoch: ")
        self.error_label_error = QLabel("Error: ")

        self.error_figure = plt.figure(num=2, figsize=(100, 100))
        self.canvas_error = FigureCanvas(self.error_figure)

        self.stop = False
        self.stop_button_error = QPushButton("Stop")
        self.stop_button_error.clicked.connect(self.change_stop)
        self.randomize_button_error = QPushButton('Initialize weights')
        self.randomize_button_error.clicked.connect(self.randomize)
        self.train_by_steps_button_error = QPushButton(
            'Train ' + self.epochs_number.text() + ' epochs')

        #summary tab
        self.summary = QPlainTextEdit()
        self.get_summary_button = QPushButton("Predict test & get summary")
        self.get_summary_button.clicked.connect(self.write_summary)

        self.train_tab_ui()
        self.create_tab_ui()
        self.error_tab_ui()
        self.summary_tab_ui()
Exemple #24
0
    def __init__(self, parent = None):
        
        super(Circles, self).__init__()
        
        self.setObjectName('circles') # should be plugin name
    
        # declare all parameter widgets below
        vbox1 = QVBoxLayout()
        hbox1 = QHBoxLayout()
        lblDp = QLabel('dp')
        self.dblDp = QDoubleSpinBox()
        self.dblDp.setObjectName('dblDp')
        self.dblDp.setValue(1.0)
        self.dblDp.setSingleStep(0.1)
        tt = '''Inverse ratio of the accumulator resolution to the image resolution. 
                For example, if dp=1 , the accumulator has the same resolution as the 
                input image. If dp=2 , the accumulator has half as big width and height.'''
        lblDp.setToolTip(tt)
        self.dblDp.setToolTip(tt)
        lblMinDist = QLabel('minDist')
        self.dblMinDist = QDoubleSpinBox()
        self.dblMinDist.setObjectName('dblMinDist')
        tt = '''Minimum distance between the centers of the detected circles. 
                If the parameter is too small, multiple neighbor circles may be falsely 
                detected in addition to a true one. If it is too large, some circles 
                may be missed.'''
        lblMinDist.setToolTip(tt)
        self.dblMinDist.setToolTip(tt)
        self.dblMinDist.setSingleStep(5)
        self.dblMinDist.setMaximum(2000)
        self.dblMinDist.setValue(150)
        hbox1.addWidget(lblDp)
        hbox1.addWidget(self.dblDp)
        hbox1.addWidget(lblMinDist)
        hbox1.addWidget(self.dblMinDist)
        
        hbox2 = QHBoxLayout()
        lblParam1 = QLabel('param1')
        self.dblParam1 = QDoubleSpinBox()
        self.dblParam1.setObjectName('dblParam1')
        self.dblParam1.setSingleStep(1)
        self.dblParam1.setValue(50)
        tt = '''First method-specific parameter. In case of HOUGH_GRADIENT , it is the higher 
                threshold of the two passed to the Canny edge detector (the lower one is twice smaller).'''
        lblParam1.setToolTip(tt)
        self.dblParam1.setToolTip(tt)
        lblParam2 = QLabel('param2')
        self.dblParam2 = QDoubleSpinBox()
        self.dblParam2.setObjectName('dblParam2')
        self.dblParam2.setSingleStep(1)
        self.dblParam2.setValue(45)
        tt = '''Second method-specific parameter. In case of HOUGH_GRADIENT , it is the accumulator
                threshold for the circle centers at the detection stage. The smaller it is,
                the more false circles may be detected. Circles, corresponding to the larger
                accumulator values, will be returned first.'''
        lblParam2.setToolTip(tt)
        self.dblParam2.setToolTip(tt)
        hbox2.addWidget(lblParam1)
        hbox2.addWidget(self.dblParam1)
        hbox2.addWidget(lblParam2)
        hbox2.addWidget(self.dblParam2)
        
        hbox3 = QHBoxLayout()
        lblMinRadius = QLabel('minRadius')
        self.dblMinRadius = QDoubleSpinBox()
        self.dblMinRadius.setObjectName('dblMinRadius')
        self.dblMinRadius.setSingleStep(1)
        self.dblMinRadius.setMaximum(2000)
        self.dblMinRadius.setValue(150)
        tt = '''Inverse ratio of the accumulator resolution to the image resolution. 
                For example, if dp=1 , the accumulator has the same resolution as the 
                input image. If dp=2 , the accumulator has half as big width and height.'''
        lblMinRadius.setToolTip(tt)
        self.dblMinRadius.setToolTip(tt)
        lblMaxRadius = QLabel('maxRadius')
        self.dblMaxRadius = QDoubleSpinBox()
        self.dblMaxRadius.setObjectName('dblMaxRadius')
        self.dblMaxRadius.setSingleStep(1)
        self.dblMaxRadius.setMaximum(2000)
        self.dblMaxRadius.setValue(200)
        
        tt = '''Minimum distance between the centers of the detected circles. 
                If the parameter is too small, multiple neighbor circles may be falsely 
                detected in addition to a true one. If it is too large, some circles 
                may be missed.'''
        lblMaxRadius.setToolTip(tt)
        self.dblMaxRadius.setToolTip(tt)
        hbox3.addWidget(lblMinRadius)
        hbox3.addWidget(self.dblMinRadius)
        hbox3.addWidget(lblMaxRadius)
        hbox3.addWidget(self.dblMaxRadius)
        
        hbox4 = QHBoxLayout()
        self.chkCrop = QCheckBox('Crop ', 
                                 objectName = 'chkCrop')
        labels = ['black', 'white']
        groupBox1, self.bgrpBackground = radio_filler('Background Color', labels, 2)
        self.bgrpBackground.button(0).setChecked(True)
        hbox4.addWidget(self.chkCrop)
        hbox4.addWidget(groupBox1)
        hbox4.setStretch(0,1)
        hbox4.setStretch(1,3)
        
        
        vbox1.addLayout(hbox1)
        vbox1.addLayout(hbox2)
        vbox1.addLayout(hbox3)
        vbox1.addLayout(hbox4)
        vbox1.setSpacing(2)

        self.setLayout(vbox1)
    def __init__(self, parent=None, controller=None):
        super().__init__(parent=parent, controller=controller)

        self._params = 0

        self._spinPowIn = QDoubleSpinBox(parent=self)
        self._spinPowIn.setMinimum(-50)
        self._spinPowIn.setMaximum(50)
        self._spinPowIn.setSingleStep(1)
        self._spinPowIn.setValue(-10)
        self._spinPowIn.setSuffix(' дБм')
        self._devices._layout.addRow('Pвх=', self._spinPowIn)

        self._spinFreqStart = QDoubleSpinBox(parent=self)
        self._spinFreqStart.setMinimum(0)
        self._spinFreqStart.setMaximum(20)
        self._spinFreqStart.setSingleStep(1)
        self._spinFreqStart.setValue(4)
        self._spinFreqStart.setSuffix(' ГГц')
        self._devices._layout.addRow('Fнач=', self._spinFreqStart)

        self._spinFreqEnd = QDoubleSpinBox(parent=self)
        self._spinFreqEnd.setMinimum(0)
        self._spinFreqEnd.setMaximum(20)
        self._spinFreqEnd.setSingleStep(1)
        self._spinFreqEnd.setValue(8)
        self._spinFreqEnd.setSuffix(' ГГц')
        self._devices._layout.addRow('Fкон=', self._spinFreqEnd)

        self._spinVoltStart = QDoubleSpinBox(parent=self)
        self._spinVoltStart.setMinimum(0)
        self._spinVoltStart.setMaximum(20)
        self._spinVoltStart.setSingleStep(0.1)
        self._spinVoltStart.setValue(0)
        self._spinVoltStart.setSuffix(' В')
        self._devices._layout.addRow('U1=', self._spinVoltStart)

        self._spinVoltEnd = QDoubleSpinBox(parent=self)
        self._spinVoltEnd.setMinimum(0)
        self._spinVoltEnd.setMaximum(20)
        self._spinVoltEnd.setSingleStep(0.1)
        self._spinVoltEnd.setValue(10)
        self._spinVoltEnd.setSuffix(' В')
        self._devices._layout.addRow('U2=', self._spinVoltEnd)

        self._spinVoltStep = QDoubleSpinBox(parent=self)
        self._spinVoltStep.setMinimum(0)
        self._spinVoltStep.setMaximum(20)
        self._spinVoltStep.setSingleStep(0.1)
        self._spinVoltStep.setValue(1)
        self._spinVoltStep.setSuffix(' В')
        self._devices._layout.addRow('Uшаг=', self._spinVoltStep)

        self._spinKp = QDoubleSpinBox(parent=self)
        self._spinKp.setMinimum(-100)
        self._spinKp.setMaximum(100)
        self._spinKp.setSingleStep(1)
        self._spinKp.setValue(-20)
        self._spinKp.setSuffix(' дБ')
        self._devices._layout.addRow('Кп=', self._spinKp)

        self._spinFreq1 = QDoubleSpinBox(parent=self)
        self._spinFreq1.setMinimum(0)
        self._spinFreq1.setMaximum(20)
        self._spinFreq1.setSingleStep(1)
        self._spinFreq1.setValue(self._spinFreqStart.value())
        self._spinFreq1.setSuffix(' ГГц')
        self._devices._layout.addRow('Fгр1=', self._spinFreq1)

        self._spinFreq2 = QDoubleSpinBox(parent=self)
        self._spinFreq2.setMinimum(0)
        self._spinFreq2.setMaximum(20)
        self._spinFreq2.setSingleStep(1)
        self._spinFreq2.setValue(self._spinFreqEnd.value())
        self._spinFreq2.setSuffix(' ГГц')
        self._devices._layout.addRow('Fгр2=', self._spinFreq2)

        self._connectSignals()
Exemple #26
0
    def __init__(self, val, cb):
        self.old_val = None
        self.fto100mul = 100
        self.cb = cb

        self.sba = QDoubleSpinBox()
        self.sba.setMinimum(-1000)
        self.sba.setMaximum(1000)
        self.sba.setDecimals(6)
        self.sba.setToolTip('Effective value')
        self.sba.setValue(val)
        self.sba_color(val)
        self.sba.setSingleStep(1.25e-3)

        self.qsr = QSlider(Qt.Horizontal)
        self.qsr.setMinimum(-100)
        self.qsr.setMaximum(100)
        self.qsr.setValue(0)
        self.qsr.setToolTip('Drag to apply relative delta')

        self.sbm = QDoubleSpinBox()
        self.sbm.setMinimum(0.01)
        self.sbm.setMaximum(1000)
        self.sbm.setSingleStep(1.25e-3)
        self.sbm.setToolTip('Maximum relative delta')
        self.sbm.setDecimals(2)
        self.sbm.setValue(4.0)

        def sba_cb():
            def f():
                self.block()
                val = self.sba.value()
                self.sba_color(val)
                self.cb(val)
                self.unblock()

            return f

        def qs1_cb():
            def f(t):
                self.block()

                if self.old_val is None:
                    self.qsr.setValue(0)
                    self.unblock()
                    return

                val = self.old_val + self.qsr.value() / 100 * self.sbm.value()
                self.sba.setValue(val)
                self.sba_color(val)
                self.cb(val)

                self.unblock()

            return f

        def qs1_end():
            def f():
                self.block()
                self.qsr.setValue(0)
                self.old_val = None
                self.unblock()

            return f

        def qs1_start():
            def f():
                self.block()
                self.old_val = self.get_value()
                self.unblock()

            return f

        self.sba_cb = sba_cb()
        self.qs1_cb = qs1_cb()
        self.qs1_start = qs1_start()
        self.qs1_end = qs1_end()

        self.sba.valueChanged.connect(self.sba_cb)
        self.qsr.valueChanged.connect(self.qs1_cb)
        self.qsr.sliderPressed.connect(self.qs1_start)
        self.qsr.sliderReleased.connect(self.qs1_end)
Exemple #27
0
    def initUI(self):
        btn1 = QPushButton('&Button1', self)
        btn1.setCheckable(True)
        btn1.toggle()

        btn2 = QPushButton(self)
        btn2.setText('Button&2')

        btn3 = QPushButton('Button3', self)
        btn3.setEnabled(False)

        #label
        label = QLabel('나는 라벨', self)
        label.setAlignment(Qt.AlignCenter)
        font = label.font()
        font.setPointSize(10)
        font.setFamily('Times New Roman')
        font.setBold(True)
        label.setFont(font)

        #QCheckBox
        cb = QCheckBox('Show title', self)
        cb.move(20, 20)
        cb.toggle()
        #cb.stateChanged.connect(self.changeTitle)
        #여기선 제목을 바꿀 수 없는듯

        rbtn1 = QRadioButton('동구란 버튼', self)
        rbtn1.setChecked(True)
        rbtn2 = QRadioButton(self)
        rbtn2.setText('도옹구란 버튼')

        #ComboBox 생성
        #self.lbl = QLabel('Option1', self)
        cob = QComboBox(self)
        cob.addItem('Option1')
        cob.addItem('Option2')
        cob.addItem('Option3')
        cob.addItem('Option4')
        #cob.activated[str].connect(self.onActivated)

        #LineEdit 생성
        qle = QLineEdit(self)
        #qle.textChanged[str].connect(self.onChanged)

        #ProgressBar 진행상황 막대기
        self.pbar = QProgressBar(self)
        #self.pbar.setGeometry(30, 40, 200, 25)

        self.btnS = QPushButton('Start', self)
        self.btnS.clicked.connect(self.doAction)

        self.timer = QBasicTimer()
        self.step = 0

        #QSlider, QDial
        self.slider = QSlider(Qt.Horizontal, self)
        self.slider.setRange(0, 50)
        self.slider.setSingleStep(2)
        self.dial = QDial(self)
        self.dial.setRange(0, 50)
        self.slider.valueChanged.connect(self.dial.setValue)
        self.dial.valueChanged.connect(self.slider.setValue)

        pixmap = QPixmap('Hanabi.PNG')

        lbl_img = QLabel()
        lbl_img.setPixmap(pixmap)
        lbl_size = QLabel('Width: ' + str(pixmap.width()) + ', Height: ' +
                          str(pixmap.height()))
        lbl_size.setAlignment(Qt.AlignCenter)

        self.lbl1 = QLabel('QSpinBox')
        self.spinbox = QSpinBox()
        self.spinbox.setMinimum(-10)
        self.spinbox.setMaximum(30)
        self.spinbox.setSingleStep(2)
        self.lbl2 = QLabel('0')

        self.spinbox.valueChanged.connect(self.value_changed)

        #doubleSpinBox
        self.lbl3 = QLabel('QDoubleSpinBox')
        self.dspinbox = QDoubleSpinBox()
        self.dspinbox.setRange(0, 100)
        self.dspinbox.setSingleStep(0.5)
        self.dspinbox.setPrefix('$ ')
        self.dspinbox.setDecimals(1)
        self.lbl4 = QLabel('$ 0.0')

        self.dspinbox.valueChanged.connect(self.value_changed)

        layout1 = QHBoxLayout()
        layout2 = QHBoxLayout()
        layout3 = QHBoxLayout()
        layout4 = QHBoxLayout()
        layout5 = QHBoxLayout()

        vlayout = QVBoxLayout()
        vlayout2 = QVBoxLayout()

        layout1.addWidget(btn1)
        layout1.addWidget(btn2)
        layout1.addWidget(cob)

        layout2.addWidget(label)
        layout2.addWidget(cb)
        layout2.addWidget(rbtn1)
        layout2.addWidget(rbtn2)

        layout3.addWidget(btn3)
        layout3.addWidget(qle)

        layout4.addWidget(self.slider)
        layout4.addWidget(self.dial)

        vlayout2.addWidget(self.lbl1)
        vlayout2.addWidget(self.spinbox)
        vlayout2.addWidget(self.lbl2)
        vlayout2.addWidget(self.lbl3)
        vlayout2.addWidget(self.dspinbox)
        vlayout2.addWidget(self.lbl4)

        layout5.addWidget(lbl_img)
        layout5.addLayout(vlayout2)

        vlayout.addLayout(layout1)
        vlayout.addLayout(layout3)
        vlayout.addLayout(layout2)
        vlayout.addWidget(self.pbar)
        vlayout.addWidget(self.btnS)
        vlayout.addLayout(layout4)
        vlayout.addLayout(layout5)
        self.setLayout(vlayout)
Exemple #28
0
    def setupTab1(self, tab1):
        """Basic widgets for preview panel"""
        scrollContainer = QVBoxLayout()
        scrollArea = QScrollArea()
        scrollArea.setWidgetResizable(True)
        mainWidget = QWidget()
        layout = QVBoxLayout()
        mainWidget.setLayout(layout)
        mainWidget.setMinimumSize(QSize(420, 800))
        scrollArea.setWidget(mainWidget)
        scrollContainer.addWidget(scrollArea)
        tab1.setLayout(scrollContainer)

        # Label TextBox
        group1 = QGroupBox("Text")
        group1.setCheckable(True)
        group1layout = QHBoxLayout()
        group1.setLayout(group1layout)
        layout.addWidget(group1)
        layoutCol1 = QFormLayout()
        layoutCol2 = QFormLayout()
        group1layout.addLayout(layoutCol1)
        group1layout.addLayout(layoutCol2)

        label1 = QLabel(self.tr("User Name(&Id):"))
        text1 = QLineEdit("default")
        label1.setBuddy(text1)
        label2 = QLabel(self.tr("data 1:"))
        text2 = QLineEdit()
        text2.setPlaceholderText(self.tr("input"))
        lebel3 = QLabel(self.tr("<b>Pasword</b>:"))
        text3 = QLineEdit("******")
        text3.setEchoMode(QLineEdit.Password)
        label4 = QLabel(self.tr("link label:"))
        label5 = QLabel(
            self.
            tr("<a href='https://github.com/hustlei/'>github.com/hustlei</a>"))
        label5.setOpenExternalLinks(True)
        label6 = QLabel(self.tr("icon label:"))
        label7 = QLabel("icon")
        label7.setPixmap(QPixmap(":appres.img/book_address.png"))
        layoutCol1.addRow(label1, text1)
        layoutCol1.addRow(label2, text2)
        layoutCol1.addRow(lebel3, text3)
        layoutCol1.addRow(label4, label5)
        layoutCol1.addRow(label6, label7)

        text4 = QLineEdit()
        text4.setInputMask("0000-00-00")
        text5 = QLineEdit()
        text5.setInputMask("HH:HH:HH:HH:HH:HH;_")
        text6 = QLineEdit()
        text6.setInputMask("XXXXXX")
        text7 = QLineEdit()
        validator1 = QDoubleValidator()
        validator1.setRange(0, 100)
        validator1.setDecimals(2)
        text7.setValidator(validator1)
        text8 = QLineEdit()
        validator2 = QRegExpValidator()
        reg = QRegExp("[a-zA-Z0-9]+$")
        validator2.setRegExp(reg)
        text8.setValidator(validator2)
        layoutCol2.addRow(self.tr("Date Mask:"), text4)
        layoutCol2.addRow(self.tr("Mac Mask"), text5)
        layoutCol2.addRow(self.tr("String Mask"), text6)
        layoutCol2.addRow(self.tr("Double Validate:"), text7)
        layoutCol2.addRow(self.tr("Regexp Validate:"), text8)

        text9 = QLineEdit()
        text9.setPlaceholderText("input email")
        text9.setToolTip("please input a email address.")
        model = QStandardItemModel(0, 1, self)
        completer = QCompleter(model, self)
        text9.setCompleter(completer)

        def textch(texts):
            if "@" in texts:
                return
            strList = [
                "@163.com", "@qq.com", "@gmail.com", "@hotmail.com", "@126.com"
            ]
            model.removeRows(0, model.rowCount())
            for i in strList:
                model.insertRow(0)
                model.setData(model.index(0, 0), texts + i)

        text9.textChanged.connect(textch)
        text10 = QLineEdit("ReadOnly")
        text10.setReadOnly(True)
        layoutCol1.addRow(self.tr("auto complete:"), text9)
        layoutCol2.addRow("Readonly:", text10)

        # Button
        group2 = QGroupBox("Button")
        group2.setCheckable(True)
        group2layout = QVBoxLayout()
        group2.setLayout(group2layout)
        layout.addWidget(group2)
        layoutRow1 = QHBoxLayout()
        layoutRow2 = QHBoxLayout()
        group2layout.addLayout(layoutRow1)
        group2layout.addLayout(layoutRow2)

        btn1 = QPushButton("Button")
        btn2 = QPushButton("IconBtn")
        btn2.setIcon(QIcon(":appres.img/yes.png"))
        btn3 = QPushButton("Disabled")
        btn3.setEnabled(False)
        btn4 = QPushButton("Default")
        btn4.setDefault(True)

        btn5 = QPushButton("Switch")
        btn5.setCheckable(True)
        btn6 = QToolButton()
        # btn6.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
        btn6.setText("ToolButton")
        btn6.setPopupMode(QToolButton.MenuButtonPopup)
        m = QMenu()
        m.addAction("action1")
        m.addAction("action2")
        m.addAction("action3")
        btn6.setMenu(m)
        btn7 = QCommandLinkButton("LinkBtn")
        layoutRow1.addWidget(btn1)
        layoutRow1.addWidget(btn2)
        layoutRow1.addWidget(btn3)
        layoutRow1.addWidget(btn4)
        layoutRow2.addWidget(btn5)
        layoutRow2.addWidget(btn6)
        layoutRow2.addWidget(btn7)

        # Checkable Item
        group3 = QGroupBox("Checkable")
        group3Layout = QVBoxLayout()
        layoutRow1 = QHBoxLayout()
        layoutRow2 = QHBoxLayout()
        group3Layout.addLayout(layoutRow1)
        group3Layout.addLayout(layoutRow2)
        group3.setLayout(group3Layout)
        layout.addWidget(group3)

        group3.setCheckable(True)
        ch1 = QRadioButton("Radio")
        ch2 = QRadioButton("Iconradio")
        ch2.setIcon(QIcon(":appres.img/Flag_blueHS.png"))
        ch3 = QRadioButton("Iconradio")
        ch3.setIcon(QIcon(":appres.img/Flag_greenHS.png"))
        ch4 = QRadioButton("Disable")
        ch4.setEnabled(False)
        ch5 = QCheckBox("CheckBox")
        ch6 = QCheckBox("CheckBox")
        ch6.setIcon(QIcon(":appres.img/Flag_blueHS.png"))
        ch7 = QCheckBox("TriState")
        ch7.setTristate(True)
        ch7.setCheckState(Qt.PartiallyChecked)
        ch8 = QCheckBox("Disable")
        ch8.setEnabled(False)
        layoutRow1.addWidget(ch1)
        layoutRow1.addWidget(ch2)
        layoutRow1.addWidget(ch3)
        layoutRow1.addWidget(ch4)
        layoutRow2.addWidget(ch5)
        layoutRow2.addWidget(ch6)
        layoutRow2.addWidget(ch7)
        layoutRow2.addWidget(ch8)

        # Selecting Input
        group4 = QGroupBox("Selectable")
        group4.setCheckable(True)
        group4Layout = QVBoxLayout()
        layoutRow1 = QHBoxLayout()
        group4Layout.addLayout(layoutRow1)
        group4.setLayout(group4Layout)
        layout.addWidget(group4)

        s1 = QSpinBox()
        s1.setValue(50)
        s2 = QDoubleSpinBox()
        s2.setRange(0, 1)
        s2.setValue(0.5)
        s3 = QComboBox()
        s3.addItems(["aaa", "bbb", "ccc"])
        s3.setEditable(True)
        s3.setCurrentIndex(2)
        s4 = QComboBox()
        s4.addItems(["aaa", "bbb", "ccc"])
        layoutRow1.addWidget(s1)
        layoutRow1.addWidget(s2)
        layoutRow1.addWidget(s3)
        layoutRow1.addWidget(s4)

        # TextEdit
        group5 = QGroupBox("TextEdit")
        group5.setCheckable(True)
        group5Layout = QVBoxLayout()
        group5.setLayout(group5Layout)
        layout.addWidget(group5)

        group5Layout.addWidget(
            QTextEdit(
                self.
                tr("If you do not leave me, I will be by your side until the end."
                   )))

        layout.addStretch(1)
Exemple #29
0
    def __init__(self, persepolis_setting):
        super().__init__()
        self.persepolis_setting = persepolis_setting
        icons = ':/' + str(persepolis_setting.value('settings/icons')) + '/'

        # add support for other languages
        locale = str(self.persepolis_setting.value('settings/locale'))
        QLocale.setDefault(QLocale(locale))
        self.translator = QTranslator()
        if self.translator.load(':/translations/locales/ui_' + locale, 'ts'):
            QCoreApplication.installTranslator(self.translator)

        # set ui direction
        ui_direction = self.persepolis_setting.value('ui_direction')

        if ui_direction == 'rtl':
            self.setLayoutDirection(Qt.RightToLeft)

        elif ui_direction in 'ltr':
            self.setLayoutDirection(Qt.LeftToRight)

# window
        self.setMinimumSize(QtCore.QSize(595, 284))

        self.setWindowIcon(
            QIcon.fromTheme('persepolis', QIcon(':/persepolis.svg')))
        self.setWindowTitle(
            QCoreApplication.translate("progress_ui_tr",
                                       "Persepolis Download Manager"))

        verticalLayout = QVBoxLayout(self)

        # progress_tabWidget
        self.progress_tabWidget = QTabWidget(self)

        # information_tab
        self.information_tab = QWidget()
        information_verticalLayout = QVBoxLayout(self.information_tab)

        # link_label
        self.link_label = QLabel(self.information_tab)
        information_verticalLayout.addWidget(self.link_label)

        # status_label
        self.status_label = QLabel(self.information_tab)
        information_verticalLayout.addWidget(self.status_label)

        # downloaded_label
        self.downloaded_label = QLabel(self.information_tab)
        information_verticalLayout.addWidget(self.downloaded_label)

        # rate_label
        self.rate_label = QLabel(self.information_tab)
        information_verticalLayout.addWidget(self.rate_label)

        # time_label
        self.time_label = QLabel(self.information_tab)
        information_verticalLayout.addWidget(self.time_label)

        # connections_label
        self.connections_label = QLabel(self.information_tab)
        information_verticalLayout.addWidget(self.connections_label)

        # add information_tab to progress_tabWidget
        self.progress_tabWidget.addTab(self.information_tab, "")

        # options_tab
        self.options_tab = QWidget()
        options_tab_horizontalLayout = QHBoxLayout(self.options_tab)
        options_tab_horizontalLayout.setContentsMargins(11, 11, 11, 11)

        # limit_checkBox
        self.limit_checkBox = QCheckBox(self.options_tab)

        limit_verticalLayout = QVBoxLayout()
        limit_verticalLayout.addWidget(self.limit_checkBox)

        # limit_frame
        self.limit_frame = QFrame(self.options_tab)
        self.limit_frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.limit_frame.setFrameShadow(QtWidgets.QFrame.Raised)
        limit_frame_verticalLayout = QVBoxLayout(self.limit_frame)
        limit_frame_horizontalLayout = QHBoxLayout()

        # limit_spinBox
        self.limit_spinBox = QDoubleSpinBox(self.options_tab)
        self.limit_spinBox.setMinimum(1)
        self.limit_spinBox.setMaximum(1023)
        limit_frame_horizontalLayout.addWidget(self.limit_spinBox)

        # limit_comboBox
        self.limit_comboBox = QComboBox(self.options_tab)
        self.limit_comboBox.addItem("")
        self.limit_comboBox.addItem("")

        limit_frame_horizontalLayout.addWidget(self.limit_comboBox)

        # limit_pushButton
        self.limit_pushButton = QPushButton(self.options_tab)

        limit_frame_verticalLayout.addLayout(limit_frame_horizontalLayout)
        limit_frame_verticalLayout.addWidget(self.limit_pushButton)

        limit_verticalLayout.addWidget(self.limit_frame)

        limit_verticalLayout.setContentsMargins(11, 11, 11, 11)

        options_tab_horizontalLayout.addLayout(limit_verticalLayout)

        # after_checkBox
        self.after_checkBox = QCheckBox(self.options_tab)

        after_verticalLayout = QVBoxLayout()
        after_verticalLayout.addWidget(self.after_checkBox)

        # after_frame
        self.after_frame = QFrame(self.options_tab)
        self.after_frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.after_frame.setFrameShadow(QtWidgets.QFrame.Raised)

        after_frame_verticalLayout = QVBoxLayout(self.after_frame)

        # after_comboBox
        self.after_comboBox = QComboBox(self.options_tab)
        self.after_comboBox.addItem("")

        after_frame_verticalLayout.addWidget(self.after_comboBox)

        # after_pushButton
        self.after_pushButton = QPushButton(self.options_tab)
        after_frame_verticalLayout.addWidget(self.after_pushButton)

        after_verticalLayout.addWidget(self.after_frame)

        after_verticalLayout.setContentsMargins(11, 11, 11, 11)
        options_tab_horizontalLayout.addLayout(after_verticalLayout)

        self.progress_tabWidget.addTab(self.options_tab, "")

        verticalLayout.addWidget(self.progress_tabWidget)

        # download_progressBar
        self.download_progressBar = QProgressBar(self)
        verticalLayout.addWidget(self.download_progressBar)

        # buttons
        button_horizontalLayout = QHBoxLayout()
        button_horizontalLayout.addStretch(1)

        # resume_pushButton
        self.resume_pushButton = QPushButton(self)
        self.resume_pushButton.setIcon(QIcon(icons + 'play'))
        button_horizontalLayout.addWidget(self.resume_pushButton)

        # pause_pushButton
        self.pause_pushButton = QtWidgets.QPushButton(self)
        self.pause_pushButton.setIcon(QIcon(icons + 'pause'))
        button_horizontalLayout.addWidget(self.pause_pushButton)

        # stop_pushButton
        self.stop_pushButton = QtWidgets.QPushButton(self)
        self.stop_pushButton.setIcon(QIcon(icons + 'stop'))
        button_horizontalLayout.addWidget(self.stop_pushButton)

        verticalLayout.addLayout(button_horizontalLayout)

        self.progress_tabWidget.setCurrentIndex(0)
        # labels
        self.link_label.setText(
            QCoreApplication.translate("progress_ui_tr", "Link :"))
        self.status_label.setText(
            QCoreApplication.translate("progress_ui_tr", "Status : "))
        self.downloaded_label.setText(
            QCoreApplication.translate("progress_ui_tr", "Downloaded :"))
        self.rate_label.setText(
            QCoreApplication.translate("progress_ui_tr", "Transfer rate : "))
        self.time_label.setText(
            QCoreApplication.translate("progress_ui_tr",
                                       "Estimated time left :"))
        self.connections_label.setText(
            QCoreApplication.translate("progress_ui_tr",
                                       "Number of connections : "))
        self.progress_tabWidget.setTabText(
            self.progress_tabWidget.indexOf(self.information_tab),
            QCoreApplication.translate("progress_ui_tr",
                                       "Download information"))
        self.limit_checkBox.setText(
            QCoreApplication.translate("progress_ui_tr", "Limit Speed"))
        self.after_checkBox.setText(
            QCoreApplication.translate("progress_ui_tr", "After download"))
        self.limit_comboBox.setItemText(
            0, QCoreApplication.translate("progress_ui_tr", "KB/S"))
        self.limit_comboBox.setItemText(
            1, QCoreApplication.translate("progress_ui_tr", "MB/S"))
        self.limit_pushButton.setText(
            QCoreApplication.translate("progress_ui_tr", "Apply"))

        self.after_comboBox.setItemText(
            0, QCoreApplication.translate("progress_ui_tr", "Shut Down"))

        self.progress_tabWidget.setTabText(
            self.progress_tabWidget.indexOf(self.options_tab),
            QCoreApplication.translate("progress_ui_tr", "Download Options"))
        self.resume_pushButton.setText(
            QCoreApplication.translate("progress_ui_tr", "Resume"))
        self.pause_pushButton.setText(
            QCoreApplication.translate("progress_ui_tr", "Pause"))
        self.stop_pushButton.setText(
            QCoreApplication.translate("progress_ui_tr", "Stop"))
        self.after_pushButton.setText(
            QCoreApplication.translate("progress_ui_tr", "Apply"))
Exemple #30
0
    def createandmove(self, label, value, text, value_type, box):
        lbl = label.replace('_', ' ')
        lbl = lbl.title()
        w = QWidget(self)
        h = QHBoxLayout()
        vbtn = None
        qbtn = QLabel(lbl, self)

        if value_type == int:
            if label == 'button_border_radius' or label == 'button_border_size' \
             or label == 'deadzone_border_size' or label == 'sticks_border_size' \
             or label == 'dpad_border_radius' or label == 'dpad_border_size' \
             or label == 'dpad_background_border_radius' or label == 'dpad_background_border_size':
                vbtn = QSpinBox()
                vbtn.setMinimum(0)
                vbtn.setMaximum(1000)
                vbtn.setSingleStep(1)
                vbtn.setValue(value)
                vbtn.valueChanged.connect(
                    lambda: self.write_widget_value(label, vbtn.value()))
            if label == 'autorepeat_count':
                vbtn = QSpinBox()
                vbtn.setMinimum(1)
                vbtn.setMaximum(10)
                vbtn.setSingleStep(1)
                vbtn.setValue(value)
                vbtn.valueChanged.connect(
                    lambda: self.write_widget_value(label, vbtn.value()))
            if label == 'button_width' or label == 'button_height':
                vbtn = QSpinBox()
                vbtn.setMinimum(1)
                vbtn.setMaximum(1000)
                vbtn.setSingleStep(10)
                vbtn.setValue(value)
                vbtn.valueChanged.connect(
                    lambda: self.write_widget_value(label, vbtn.value()))
            if label == 'overlay_x_position' or label == 'overlay_y_position' \
             or label == 'overlay_width' or label == 'overlay_height' \
             or label == 'dpad_background_opacity' or label == 'deadzone' \
             or label == 'button_opacity':
                vbtn = QSpinBox()
                vbtn.setMinimum(0)
                vbtn.setMaximum(100)
                vbtn.setSingleStep(1)
                vbtn.setValue(value)
                vbtn.valueChanged.connect(
                    lambda: self.write_widget_value(label, vbtn.value()))

        if value_type == float:
            if label == 'autorepeat_interval' or label == 'combo_interval':
                vbtn = QDoubleSpinBox()
                vbtn.setDecimals(3)
                vbtn.setMinimum(0.001)
                vbtn.setMaximum(10.0)
                vbtn.setSingleStep(0.01)
                vbtn.setValue(value)
                vbtn.valueChanged.connect(
                    lambda: self.write_widget_value(label, vbtn.value()))

        if label == 'current_layout_file':
            vbtn = QComboBox()
            items = list(profiles_filelist)
            item1 = read_settings('User_Settings', 'current_layout_file')
            if items:
                if item1 in items:
                    vbtn.addItem(item1)
                    items.remove(item1)
            for p in items:
                vbtn.addItem(p)
            vbtn.currentIndexChanged.connect(
                lambda: self.write_widget_value(label, vbtn.currentText()))

        if value_type == str and value.startswith('#'):
            if len(value) == 7:
                vbtn = QPushButton()
                color_name = read_settings('User_Settings', label)
                stl = "background-color:%s;" % color_name
                vbtn.setStyleSheet(stl)
                vbtn.clicked.connect(lambda: self.get_color(label, vbtn))

        if value_type == bool:
            vbtn = QCheckBox()
            status = read_settings('User_Settings', label)
            vbtn.setChecked(status)
            vbtn.minimumSizeHint()
            vbtn.stateChanged.connect(
                lambda: self.write_widget_value(label, vbtn.isChecked()))

        if label == 'input_method':
            vbtn = QComboBox()
            item1 = read_settings('User_Settings', 'input_method')
            vbtn.addItem(item1)
            if item1 == 'xdotool':
                item2 = 'pyuserinput'
            else:
                item2 = 'xdotool'
            vbtn.addItem(item2)
            vbtn.currentIndexChanged.connect(
                lambda: self.write_widget_value(label, vbtn.currentText()))

        if label == 'New Layout File':
            vbtn = QPushButton()
            vbtn.setText(value)
            vbtn.clicked.connect(self.create_new_layout_file)

        ibtn = QPushButton()
        ibtn.setIcon(QIcon.fromTheme("dialog-information"))
        ibtn.setMinimumSize(QtCore.QSize(50, 50))
        ibtn.clicked.connect(lambda: self.show_dialog(text))
        h.addWidget(qbtn)

        if vbtn != None:
            vbtn.setMinimumSize(QtCore.QSize(200, 50))
            if value_type == bool:
                vbtn.setMinimumSize(QtCore.QSize(125, 50))
                vbtn.setStyleSheet(
                    'QCheckBox::indicator {min-width:50;min-height:50;border-radius:25px;border:4px solid #555555;}'
                    'QCheckBox::indicator:checked {background-color:green;}'
                    'QCheckBox::indicator:unchecked {background-color:grey;}')
            h.addStretch(1)
            h.addWidget(vbtn)

        h.addWidget(ibtn)
        w.setLayout(h)
        w.setMinimumHeight(70)
        w.setObjectName('SettingsRow')
        w.setStyleSheet('#SettingsRow { \
			background-color:#eeeeee;border: 1px solid #bbbbbb; \
			border-radius:5px; \
		}')
        box.addWidget(w)