Example #1
0
    def initUI(self):
        """ Cria todos os componentes referentes as transformações. """

        self.setWindowTitle('Filtros Passa-Baixa')

        # Filtros (F).
        self.labels = {}
        # F: Passa-Baixa
        self.labels[low_pass.Filter.BOX] = QLabel('Box')
        self.labels[low_pass.Filter.MEDIAN] = QLabel('Mediana')
        self.labels[low_pass.Filter.GAUSSIAN] = QLabel('Gaussiano')

        labelsLayout = QVBoxLayout()
        labelsLayout.setContentsMargins(0, 0, 0, 0)
        for key, label in self.labels.items():
            if key != low_pass.Filter.BOX:
                label.setEnabled(False)
                
            labelsLayout.addWidget(label)

        labelsWidget = QWidget()
        labelsWidget.setLayout(labelsLayout)

        # Máscaras(M).
        self.opts = {}
        # M: Passa-Baixa
        self.opts[low_pass.Filter.BOX] = QComboBox()
        self.opts[low_pass.Filter.BOX].addItems(['3x3', '5x5', '7x7', '9x9', '11x11'])

        self.opts[low_pass.Filter.MEDIAN] = QComboBox()
        self.opts[low_pass.Filter.MEDIAN].addItems(['3x3', '5x5', '7x7', '9x9', '11x11'])

        self.opts[low_pass.Filter.GAUSSIAN] = DoubleTextSpinBox()
        self.opts[low_pass.Filter.GAUSSIAN].setSingleStep(0.5)
        self.opts[low_pass.Filter.GAUSSIAN].setRange(1, 11)
                
        optsLayout = QVBoxLayout()
        optsLayout.setContentsMargins(0, 0, 0, 0)
        for key, opt in self.opts.items():
            if key != low_pass.Filter.BOX:
                opt.setEnabled(False)
                
            optsLayout.addWidget(opt)

        optsWidget = QWidget()
        optsWidget.setLayout(optsLayout)

        # Seleção do Filtro (S).
        self.radioButtons = {}
        # S: Passa-Baixa
        self.radioButtons[low_pass.Filter.BOX] = QRadioButton()
        self.radioButtons[low_pass.Filter.BOX].setChecked(True)
        self.radioButtons[low_pass.Filter.BOX]. \
            clicked.connect(lambda: self.selectFilter(low_pass.Filter.BOX))

        self.radioButtons[low_pass.Filter.MEDIAN] = QRadioButton()
        self.radioButtons[low_pass.Filter.MEDIAN].setChecked(False)
        self.radioButtons[low_pass.Filter.MEDIAN]. \
            clicked.connect(lambda: self.selectFilter(low_pass.Filter.MEDIAN))

        self.radioButtons[low_pass.Filter.GAUSSIAN] = QRadioButton()
        self.radioButtons[low_pass.Filter.GAUSSIAN].setChecked(False)
        self.radioButtons[low_pass.Filter.GAUSSIAN]. \
            clicked.connect(lambda: self.selectFilter(low_pass.Filter.GAUSSIAN))
        
        radioButtonsLayout = QVBoxLayout()
        radioButtonsLayout.setContentsMargins(0, 0, 0, 0)
        for key, button in self.radioButtons.items():
            radioButtonsLayout.addWidget(button)
            
        radioButtonsWidget = QWidget()
        radioButtonsWidget.setLayout(radioButtonsLayout)
        
        # Layout.
        sublayout = QHBoxLayout()
        sublayout.addWidget(labelsWidget)
        sublayout.addWidget(optsWidget)
        sublayout.addWidget(radioButtonsWidget)

        # Botões de OK e Cancel.
        buttons = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel,
            Qt.Horizontal, self)
        buttons.accepted.connect(self.getFilter)
        buttons.rejected.connect(self.reject)

        subwidget = QWidget()
        subwidget.setLayout(sublayout)

        # Layout principal.
        mainLayout = QVBoxLayout()
        mainLayout.addWidget(subwidget)
        mainLayout.addWidget(buttons)
        
        self.setLayout(mainLayout)
 def initUI(self):
     # 以下是pyqt5初始化设置窗口
     self.move(300, 200)
     self.setFixedSize(350, 450)
     self.setWindowTitle('设置')
     self.setWindowIcon(QIcon('GCap.ico'))
     self.dial1 = QSlider(Qt.Horizontal, self)
     self.edit1 = QLineEdit(self)
     self.edit1.setEnabled(False)
     self.edit1.setMaximumWidth(50)
     self.lmin1 = QLabel('1316', self)
     self.lmax1 = QLabel('8996', self)
     self.dial2 = QSlider(Qt.Horizontal, self)
     self.edit2 = QLineEdit(self)
     self.edit2.setEnabled(False)
     self.edit2.setMaximumWidth(50)
     self.lmin2 = QLabel('0', self)
     self.lmax2 = QLabel('65536', self)
     self.check = QCheckBox(self)
     self.labelOn = QLabel('打开触发模式', self)
     self.labelMode = QLabel('触发源', self)
     self.comboMode = QComboBox(self)
     self.comboMode.addItem('软触发')
     self.comboMode.addItem('外触发')
     self.labelDi = QLabel('触发沿', self)
     self.comboAct = QComboBox(self)
     self.comboAct.addItem('上升沿')
     self.comboAct.addItem('下降沿')
     groupBox1 = QGroupBox('包大小')
     gbox1 = QGridLayout()
     gbox1.addWidget(self.dial1, 0, 0, 1, 9)
     gbox1.addWidget(self.edit1, 0, 10)
     gbox1.addWidget(self.lmin1, 1, 0)
     gbox1.addWidget(self.lmax1, 1, 8)
     groupBox1.setLayout(gbox1)
     groupBox2 = QGroupBox('包延迟')
     gbox2 = QGridLayout()
     gbox2.addWidget(self.dial2, 0, 0, 1, 9)
     gbox2.addWidget(self.edit2, 0, 10)
     gbox2.addWidget(self.lmin2, 1, 0)
     gbox2.addWidget(self.lmax2, 1, 8)
     groupBox2.setLayout(gbox2)
     groupBox3 = QGroupBox('触发')
     gbox3 = QGridLayout()
     gbox3.setSpacing(35)
     gbox3.addWidget(self.check, 0, 0)
     gbox3.addWidget(self.labelOn, 0, 1)
     gbox3.addWidget(self.labelMode, 1, 0)
     gbox3.addWidget(self.comboMode, 1, 1)
     gbox3.addWidget(self.labelDi, 3, 0)
     gbox3.addWidget(self.comboAct, 3, 1)
     gbox3.setColumnStretch(0, 1)
     gbox3.setColumnStretch(1, 11)
     groupBox3.setLayout(gbox3)
     vlayout = QVBoxLayout()
     vlayout.addWidget(groupBox1)
     vlayout.addWidget(groupBox2)
     vlayout.addWidget(groupBox3)
     vlayout.addStretch()
     self.setLayout(vlayout)
     # 获取获取当前相机数据,来初始化窗口界面
     self.packetSize = MVGetPacketSize(self.hCam)  # 获取当前相机包大小
     self.packetDelay = MVGetPacketDelay(self.hCam)  # 获取当前相机包延迟
     self.mode = MVGetTriggerMode(self.hCam)  # 获取当前相机采集模式
     self.source = MVGetTriggerSource(self.hCam)  # 获取当前相机信号源
     self.active = MVGetTriggerActivation(
         self.hCam)  # 当采集模式为外采集时,获取信号的上升沿或者下降沿
     self.edit1.setText(str(self.packetSize.psize))
     self.edit2.setText(str(self.packetDelay.time_us))
     value1 = (self.packetSize.psize - 1316) / (8996 - 1316) * 99
     self.dial1.setValue(value1)
     value2 = self.packetDelay.time_us / 65536 * 99
     self.dial2.setValue(value2)
     if (self.source.source == TriggerSourceEnums.TriggerSource_Software
         ):  # 将当前信号源类型显示在界面上
         self.comboMode.setCurrentIndex(0)
     else:
         self.comboMode.setCurrentIndex(1)
     if (self.active.act == TriggerActivationEnums.
             TriggerActivation_RisingEdge):  # 将当前外采集模式信号模式显示在界面上
         self.comboAct.setCurrentIndex(0)
     else:
         self.comboAct.setCurrentIndex(1)
     if (self.mode.pMode == TriggerModeEnums.TriggerMode_Off
         ):  # 将当前采集模式开关状态显示在界面上
         self.check.setCheckState(Qt.Unchecked)
         self.comboMode.setEnabled(False)
         self.comboAct.setEnabled(False)
     else:
         self.check.setCheckState(Qt.Checked)
         self.comboMode.setEnabled(True)
         if (self.source.source == TriggerSourceEnums.TriggerSource_Software
             ):  # 只有当选择外触发模式时,才可选择触发沿
             self.comboAct.setEnabled(False)
         else:
             self.comboAct.setEnabled(True)
     # 以下是到部件的触发事件
     self.dial1.valueChanged.connect(self.changeEdit1)
     self.dial2.valueChanged.connect(self.changeEdit2)
     self.check.clicked.connect(self.changeStatus)
     self.comboMode.activated[str].connect(self.changeMode)
     self.comboAct.activated[str].connect(self.changeAct)
    def initUI(self):

        # 레이아웃 첫째 줄
        Name = QLabel('Name :', self)
        self.NameInput = QLineEdit()
        Age = QLabel('Age :', self)
        self.AgeInput = QLineEdit()
        Score = QLabel('Score :', self)
        self.ScoreInput = QLineEdit()

        hbox = QHBoxLayout()
        hbox.addWidget(Name)
        hbox.addWidget(self.NameInput)
        hbox.addWidget(Age)
        hbox.addWidget(self.AgeInput)
        hbox.addWidget(Score)
        hbox.addWidget(self.ScoreInput)

        # 레이아웃 둘째 줄
        Amount = QLabel('Amount :', self)
        self.AmountInput = QLineEdit()
        Key = QLabel('Key :')
        self.KeyList = QComboBox()
        self.KeyList.addItem("Name")
        self.KeyList.addItem("Score")
        self.KeyList.addItem("Age")

        hbox2 = QHBoxLayout()
        hbox2.addStretch()
        hbox2.addWidget(Amount)
        hbox2.addWidget(self.AmountInput)
        hbox2.addWidget(Key)
        hbox2.addWidget(self.KeyList)

        # 레이아웃 셋째 줄
        AddButton = QPushButton('Add', self)
        DelButton = QPushButton('Del', self)
        FindButton = QPushButton('Find', self)
        IncButton = QPushButton('Inc', self)
        ShowButton = QPushButton('Show', self)

        AddButton.clicked.connect(self.AddButtonClicked)
        DelButton.clicked.connect(self.DelButtonClicked)
        FindButton.clicked.connect(self.FindButtonClicked)
        IncButton.clicked.connect(self.IncButtonClicked)
        ShowButton.clicked.connect(self.ShowButtonClicked)

        hbox3 = QHBoxLayout()
        hbox3.addStretch()
        hbox3.addWidget(AddButton)
        hbox3.addWidget(DelButton)
        hbox3.addWidget(FindButton)
        hbox3.addWidget(IncButton)
        hbox3.addWidget(ShowButton)


        # 레이아웃 넷쨰 줄
        Result = QLabel('Result :')

        hbox4 = QHBoxLayout()
        # hbox4.addStretch()
        hbox4.addWidget(Result)

        # 레이아웃 다섯쨰 줄
        self.ResultBox = QTextEdit(self)

        hbox5 = QHBoxLayout()
        hbox5.addWidget(self.ResultBox)

        # 수평 정렬 레이아웃을 수직 정렬
        vbox = QVBoxLayout()
        vbox.addLayout(hbox)
        vbox.addLayout(hbox2)
        vbox.addLayout(hbox3)
        vbox.addLayout(hbox4)
        vbox.addLayout(hbox5)

        self.setLayout(vbox)

        self.setGeometry(300, 300, 500, 250)
        self.setWindowTitle('Assignment6')    
        self.show()
    def __init__(self, parent=None):
        super(Window, self).__init__(parent)

        self.setWindowTitle('Feedback Interactive Analysis')

        self.enzyme = E_PIP5K
        self.f_type = FEEDBACK_POSITIVE
        self.f_carry = 1
        self.f_multi = 1
        self.f_hill = 1
        self.f_sub = I_PIP2
        self.carry_factor = 1
        self.lipids_to_analyze = [I_PIP2]
        self.mutant_enzyme = E_NONE
        self.enz_box = None
        self.show_standard = True

        # a figure instance to plot on
        self.figure = plt.figure()
        # this is the Canvas Widget that displays the `figure`
        self.canvas = FigureCanvas(self.figure)
        # it takes the Canvas widget and a parent
        self.toolbar = NavigationToolbar(self.canvas, self)

        grid = QGridLayout()
        widget = QWidget(self)  # central widget

        s_box = QHBoxLayout()

        substrate_group = QButtonGroup(widget)  # Substrate group
        s_box.addStretch()
        s_box.setContentsMargins(1, 15, 1, 1)
        s_box.addWidget(QLabel("Feedback From"))
        self.substrates = []
        for l in LIPID_NAMES:
            b = QRadioButton(l, self)
            b.setObjectName(l)
            b.setCheckable(True)
            if l == L_PIP2:
                b.setChecked(True)
            b.clicked.connect(partial(self.substrate_clicked, l))
            self.substrates.append(b)
            substrate_group.addButton(b)
            s_box.addWidget(b)

        display_box = QVBoxLayout()
        display_box.setContentsMargins(30, 1, 1, 1)
        display_box.addStretch()
        self.display_lipids = []
        for l in LIPID_NAMES:
            b = QCheckBox(l)
            b.setObjectName(l)
            b.setCheckable(True)
            if l == L_PIP2:
                b.setChecked(True)
            b.clicked.connect(partial(self.on_display_lipid_changed, l))
            self.display_lipids.append(b)
            display_box.addWidget(b)
        display_box.addStretch()

        feedback_group = QButtonGroup(widget)  # Number group
        f_box = QVBoxLayout()
        f_box.setContentsMargins(30, 1, 1, 1)
        f_box.addStretch()
        f_box.addWidget(QLabel("Feedback Type"))
        self.b_pos_feed = QRadioButton("Positive", self)
        self.b_pos_feed.setObjectName("p")
        self.b_pos_feed.setCheckable(True)
        self.b_pos_feed.setChecked(True)
        self.b_pos_feed.clicked.connect(partial(self.feedback_changed, "p"))
        feedback_group.addButton(self.b_pos_feed)
        f_box.addWidget(self.b_pos_feed)

        self.b_neg_feed = QRadioButton("Negative", self)
        self.b_neg_feed.setObjectName("n")
        self.b_neg_feed.setCheckable(True)
        self.b_neg_feed.clicked.connect(partial(self.feedback_changed, "n"))
        feedback_group.addButton(self.b_neg_feed)
        f_box.addWidget(self.b_neg_feed)
        f_box.addStretch()

        a_box = QVBoxLayout()
        a_box.setContentsMargins(30, 30, 30, 15)
        a_slider = QSlider(Qt.Horizontal, self)
        a_slider.setMinimum(1)
        a_slider.setMaximum(100)
        a_slider.setTickInterval(1)
        self.a_label = QLabel("Multiplication Factor : 1")
        a_slider.valueChanged[int].connect(self.multi_changed)
        a_slider.setValue(1)
        a_box.addWidget(self.a_label)
        a_box.addWidget(a_slider)

        c_box = QVBoxLayout()
        c_box.setContentsMargins(30, 0, 30, 15)
        c_slider = QSlider(Qt.Horizontal, self)
        c_slider.setMinimum(1)
        c_slider.setMaximum(10)
        c_slider.setTickInterval(1)
        self.c_label = QLabel("Carrying Capacity : 1")
        c_slider.valueChanged[int].connect(self.carry_changed)
        c_slider.setValue(1)

        c_sub_box = QHBoxLayout()
        c_sub_box.addWidget(self.c_label)

        carry_factor = QComboBox(self)
        for c in CARRY_FACTORS:
            carry_factor.addItem(c)
        carry_factor.activated[str].connect(self.on_carry_factor)
        c_sub_box.addWidget(carry_factor)
        c_sub_box.addStretch()

        c_box.addLayout(c_sub_box, 1)
        c_box.addWidget(c_slider)

        h_box = QVBoxLayout()
        h_box.setContentsMargins(30, 0, 30, 15)
        h_slider = QSlider(Qt.Horizontal, self)
        h_slider.setMinimum(0)
        h_slider.setMaximum(5)
        h_slider.setTickInterval(1)
        self.h_label = QLabel("Hill Coefficient")
        h_slider.valueChanged[int].connect(self.hill_changed)
        h_slider.setValue(1)
        h_box.addWidget(self.h_label)
        h_box.addWidget(h_slider)

        e_box = QVBoxLayout()
        e_box.setContentsMargins(30, 1, 1, 1)
        e_box.addStretch()
        e_box.addWidget(QLabel("Feedback to"))
        enz_box = QComboBox(self)
        for e in ENZYME_NAMES:
            enz_box.addItem(e)
        enz_box.activated[str].connect(self.on_enzyme_selection)
        e_box.addWidget(enz_box)
        e_box.addStretch()

        hill_box = QHBoxLayout()
        hill_box.addLayout(h_box)
        hill_box.addWidget(self.toggle_plot)

        grid.addWidget(self.toolbar, 1, 0)
        grid.addWidget(self.canvas, 2, 0)
        grid.addLayout(display_box, 1, 1, 2, 2)
        grid.addLayout(s_box, 4, 0)
        grid.addLayout(f_box, 5, 1, 2, 2)
        grid.addLayout(self.mutant_list, 4, 1)
        grid.addLayout(a_box, 5, 0)
        grid.addLayout(c_box, 6, 0)
        grid.addLayout(hill_box, 7, 0)
        grid.addLayout(e_box, 7, 1)
        self.setLayout(grid)
    def __init__(self, parent, box_type='select'):
        super().__init__()
        self.parent = parent
        self.box_type = box_type
        self.material = MaterialProperties()
        self.material_name = ''

        self.boxGroup = QGroupBox('Material Settings', self.parent)
        self.gridLayout = QGridLayout(self.boxGroup)

        self.materialBoxGroup = QGroupBox('', self.boxGroup)
        self.miniLayout = QHBoxLayout(self.materialBoxGroup)
        self.label_mat_name = QLabel(self.materialBoxGroup)
        self.label_mat_name.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.material_name_widget = QComboBox()

        self.miniLayout.addWidget(self.label_mat_name)
        # self.miniLayout.addWidget(self.material_name_wid)
        self.materialBoxGroup.setLayout(self.miniLayout)

        self.label_Density = QLabel('Density (kg/m^3)', self.boxGroup)
        self.label_Density.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.entry_Density = QLineEdit(self.boxGroup)

        self.label_spHeat = QLabel('Specific Heat (J/kg.K)', self.boxGroup)
        self.label_spHeat.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.entry_spHeat = QLineEdit(self.boxGroup)

        self.label_Conductivity = QLabel('Thermal Conductivity (W/m.K)',
                                         self.boxGroup)
        self.label_Conductivity.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.entry_Conductivity = QLineEdit(self.boxGroup)

        self.label_meltPt = QLabel('Melting Temperature (K)', self.boxGroup)
        self.label_meltPt.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.entry_meltPt = QLineEdit(self.boxGroup)

        self.label_Emissivity = QLabel('Emissivity (0-1)', self.boxGroup)
        self.label_Emissivity.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.entry_Emissivity = QLineEdit(self.boxGroup)

        self.label_Reflect = QLabel('Reflectivity (0-1)', self.boxGroup)
        self.label_Reflect.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.entry_Reflect = QLineEdit(self.boxGroup)

        self.label_blank = QLabel(' ', self.boxGroup)
        self.label_blank.setFixedWidth(60)

        self.gridLayout.addWidget(self.materialBoxGroup, 0, 0, 1, 3)

        self.gridLayout.addWidget(self.label_Density, 1, 0)
        self.gridLayout.addWidget(self.entry_Density, 1, 1)
        self.gridLayout.addWidget(self.label_blank, 1, 2)
        self.gridLayout.addWidget(self.label_spHeat, 1, 3)
        self.gridLayout.addWidget(self.entry_spHeat, 1, 4)

        self.gridLayout.addWidget(self.label_Conductivity, 2, 0)
        self.gridLayout.addWidget(self.entry_Conductivity, 2, 1)
        self.gridLayout.addWidget(self.label_meltPt, 2, 3)
        self.gridLayout.addWidget(self.entry_meltPt, 2, 4)

        self.gridLayout.addWidget(self.label_Emissivity, 3, 0)
        self.gridLayout.addWidget(self.entry_Emissivity, 3, 1)
        self.gridLayout.addWidget(self.label_Reflect, 3, 3)
        self.gridLayout.addWidget(self.entry_Reflect, 3, 4)

        self.boxGroup.setLayout(self.gridLayout)
        if self.box_type == 'entry':
            self.new_material_entry()
        else:
            self.material_select_box()
            self.material_name_widget.activated[str].connect(
                self.on_material_select)
Example #6
0
    def createGeneralOptionsGroupBox(self):
        self.generalOptionsGroupBox = QGroupBox("General Options")

        self.localeCombo = QComboBox()

        curLocaleIndex = -1
        index = 0

        for lid in range(QLocale.C, QLocale.LastLanguage + 1):
            lang = QLocale.Language(lid)
            countries = QLocale.countriesForLanguage(lang)
            for country in countries:
                label = "%s/%s" % (QLocale.languageToString(lang),
                                   QLocale.countryToString(country))
                locale = QLocale(lang, country)
                if self.locale().language() == lang and self.locale().country(
                ) == country:
                    curLocaleIndex = index

                self.localeCombo.addItem(label, locale)
                index += 1

        if curLocaleIndex != -1:
            self.localeCombo.setCurrentIndex(curLocaleIndex)

        self.localeLabel = QLabel("&Locale")
        self.localeLabel.setBuddy(self.localeCombo)

        self.firstDayCombo = QComboBox()
        self.firstDayCombo.addItem("Sunday", Qt.Sunday)
        self.firstDayCombo.addItem("Monday", Qt.Monday)
        self.firstDayCombo.addItem("Tuesday", Qt.Tuesday)
        self.firstDayCombo.addItem("Wednesday", Qt.Wednesday)
        self.firstDayCombo.addItem("Thursday", Qt.Thursday)
        self.firstDayCombo.addItem("Friday", Qt.Friday)
        self.firstDayCombo.addItem("Saturday", Qt.Saturday)

        self.firstDayLabel = QLabel("Wee&k starts on:")
        self.firstDayLabel.setBuddy(self.firstDayCombo)

        self.selectionModeCombo = QComboBox()
        self.selectionModeCombo.addItem("Single selection",
                                        QCalendarWidget.SingleSelection)
        self.selectionModeCombo.addItem("None", QCalendarWidget.NoSelection)
        self.selectionModeLabel = QLabel("&Selection mode:")
        self.selectionModeLabel.setBuddy(self.selectionModeCombo)

        self.gridCheckBox = QCheckBox("&Grid")
        self.gridCheckBox.setChecked(self.calendar.isGridVisible())

        self.navigationCheckBox = QCheckBox("&Navigation bar")
        self.navigationCheckBox.setChecked(True)

        self.horizontalHeaderCombo = QComboBox()
        self.horizontalHeaderCombo.addItem(
            "Single letter day names", QCalendarWidget.SingleLetterDayNames)
        self.horizontalHeaderCombo.addItem("Short day names",
                                           QCalendarWidget.ShortDayNames)
        self.horizontalHeaderCombo.addItem("Long day names",
                                           QCalendarWidget.LongDayNames)
        self.horizontalHeaderCombo.addItem("None",
                                           QCalendarWidget.NoHorizontalHeader)
        self.horizontalHeaderCombo.setCurrentIndex(1)

        self.horizontalHeaderLabel = QLabel("&Horizontal header:")
        self.horizontalHeaderLabel.setBuddy(self.horizontalHeaderCombo)

        self.verticalHeaderCombo = QComboBox()
        self.verticalHeaderCombo.addItem("ISO week numbers",
                                         QCalendarWidget.ISOWeekNumbers)
        self.verticalHeaderCombo.addItem("None",
                                         QCalendarWidget.NoVerticalHeader)

        self.verticalHeaderLabel = QLabel("&Vertical header:")
        self.verticalHeaderLabel.setBuddy(self.verticalHeaderCombo)

        self.localeCombo.currentIndexChanged.connect(self.localeChanged)
        self.firstDayCombo.currentIndexChanged.connect(self.firstDayChanged)
        self.selectionModeCombo.currentIndexChanged.connect(
            self.selectionModeChanged)
        self.gridCheckBox.toggled.connect(self.calendar.setGridVisible)
        self.navigationCheckBox.toggled.connect(
            self.calendar.setNavigationBarVisible)
        self.horizontalHeaderCombo.currentIndexChanged.connect(
            self.horizontalHeaderChanged)
        self.verticalHeaderCombo.currentIndexChanged.connect(
            self.verticalHeaderChanged)

        checkBoxLayout = QHBoxLayout()
        checkBoxLayout.addWidget(self.gridCheckBox)
        checkBoxLayout.addStretch()
        checkBoxLayout.addWidget(self.navigationCheckBox)

        outerLayout = QGridLayout()
        outerLayout.addWidget(self.localeLabel, 0, 0)
        outerLayout.addWidget(self.localeCombo, 0, 1)
        outerLayout.addWidget(self.firstDayLabel, 1, 0)
        outerLayout.addWidget(self.firstDayCombo, 1, 1)
        outerLayout.addWidget(self.selectionModeLabel, 2, 0)
        outerLayout.addWidget(self.selectionModeCombo, 2, 1)
        outerLayout.addLayout(checkBoxLayout, 3, 0, 1, 2)
        outerLayout.addWidget(self.horizontalHeaderLabel, 4, 0)
        outerLayout.addWidget(self.horizontalHeaderCombo, 4, 1)
        outerLayout.addWidget(self.verticalHeaderLabel, 5, 0)
        outerLayout.addWidget(self.verticalHeaderCombo, 5, 1)
        self.generalOptionsGroupBox.setLayout(outerLayout)

        self.firstDayChanged(self.firstDayCombo.currentIndex())
        self.selectionModeChanged(self.selectionModeCombo.currentIndex())
        self.horizontalHeaderChanged(self.horizontalHeaderCombo.currentIndex())
        self.verticalHeaderChanged(self.verticalHeaderCombo.currentIndex())
Example #7
0
    def createToolbars(self):
        self.editToolBar = self.addToolBar("Edit")
        self.editToolBar.addAction(self.deleteAction)
        self.editToolBar.addAction(self.toFrontAction)
        self.editToolBar.addAction(self.sendBackAction)

        self.fontCombo = QFontComboBox()
        self.fontCombo.currentFontChanged.connect(self.currentFontChanged)

        self.fontSizeCombo = QComboBox()
        self.fontSizeCombo.setEditable(True)
        for i in range(8, 30, 2):
            self.fontSizeCombo.addItem(str(i))
        validator = QIntValidator(2, 64, self)
        self.fontSizeCombo.setValidator(validator)
        self.fontSizeCombo.currentIndexChanged.connect(self.fontSizeChanged)

        self.fontColorToolButton = QToolButton()
        self.fontColorToolButton.setPopupMode(QToolButton.MenuButtonPopup)
        self.fontColorToolButton.setMenu(
            self.createColorMenu(self.textColorChanged, Qt.black))
        self.textAction = self.fontColorToolButton.menu().defaultAction()
        self.fontColorToolButton.setIcon(
            self.createColorToolButtonIcon(':/images/textpointer.png',
                                           Qt.black))
        self.fontColorToolButton.setAutoFillBackground(True)
        self.fontColorToolButton.clicked.connect(self.textButtonTriggered)

        self.fillColorToolButton = QToolButton()
        self.fillColorToolButton.setPopupMode(QToolButton.MenuButtonPopup)
        self.fillColorToolButton.setMenu(
            self.createColorMenu(self.itemColorChanged, Qt.white))
        self.fillAction = self.fillColorToolButton.menu().defaultAction()
        self.fillColorToolButton.setIcon(
            self.createColorToolButtonIcon(':/images/floodfill.png', Qt.white))
        self.fillColorToolButton.clicked.connect(self.fillButtonTriggered)

        self.lineColorToolButton = QToolButton()
        self.lineColorToolButton.setPopupMode(QToolButton.MenuButtonPopup)
        self.lineColorToolButton.setMenu(
            self.createColorMenu(self.lineColorChanged, Qt.black))
        self.lineAction = self.lineColorToolButton.menu().defaultAction()
        self.lineColorToolButton.setIcon(
            self.createColorToolButtonIcon(':/images/linecolor.png', Qt.black))
        self.lineColorToolButton.clicked.connect(self.lineButtonTriggered)

        self.textToolBar = self.addToolBar("Font")
        self.textToolBar.addWidget(self.fontCombo)
        self.textToolBar.addWidget(self.fontSizeCombo)
        self.textToolBar.addAction(self.boldAction)
        self.textToolBar.addAction(self.italicAction)
        self.textToolBar.addAction(self.underlineAction)

        self.colorToolBar = self.addToolBar("Color")
        self.colorToolBar.addWidget(self.fontColorToolButton)
        self.colorToolBar.addWidget(self.fillColorToolButton)
        self.colorToolBar.addWidget(self.lineColorToolButton)

        pointerButton = QToolButton()
        pointerButton.setCheckable(True)
        pointerButton.setChecked(True)
        pointerButton.setIcon(QIcon(':/images/pointer.png'))
        linePointerButton = QToolButton()
        linePointerButton.setCheckable(True)
        linePointerButton.setIcon(QIcon(':/images/linepointer.png'))

        self.pointerTypeGroup = QButtonGroup()
        self.pointerTypeGroup.addButton(pointerButton, DiagramScene.MoveItem)
        self.pointerTypeGroup.addButton(linePointerButton,
                                        DiagramScene.InsertLine)
        self.pointerTypeGroup.buttonClicked[int].connect(
            self.pointerGroupClicked)

        self.sceneScaleCombo = QComboBox()
        self.sceneScaleCombo.addItems(["50%", "75%", "100%", "125%", "150%"])
        self.sceneScaleCombo.setCurrentIndex(2)
        self.sceneScaleCombo.currentIndexChanged[str].connect(
            self.sceneScaleChanged)

        self.pointerToolbar = self.addToolBar("Pointer type")
        self.pointerToolbar.addWidget(pointerButton)
        self.pointerToolbar.addWidget(linePointerButton)
        self.pointerToolbar.addWidget(self.sceneScaleCombo)
Example #8
0
    def __init__(self, parent=None):
        super().__init__()
        self.parent = parent
        self.setWindowTitle(self.tr("Keyboard Layout"))
        self.setLayout(QVBoxLayout())
        self.layout().setAlignment(Qt.AlignCenter)

        centerLayout = QHBoxLayout()
        self.layout().addLayout(centerLayout)

        keyLabel = QLabel()
        keyLabel.setFixedSize(283*3.5, 80*3.5)
        keyLabel.setScaledContents(True)
        keyLabel.setPixmap(QPixmap(":/images/keyboard.svg"))
        centerLayout.addWidget(keyLabel)

        hlayoutx = QHBoxLayout()
        self.layout().addLayout(hlayoutx)

        modelLabel = QLabel()
        modelLabel.setFixedWidth(150)
        modelLabel.setText(self.tr("Keyboard Model:"))
        hlayoutx.addWidget(modelLabel)

        self.modelList = QComboBox()
        hlayoutx.addWidget(self.modelList)

        hlayout = QHBoxLayout()
        self.layout().addLayout(hlayout)

        countryLabel = QLabel()
        countryLabel.setText(self.tr("Language:"))
        hlayout.addWidget(countryLabel)

        self.countryList = QComboBox()
        self.countryList.setFixedWidth(325)
        hlayout.addWidget(self.countryList)

        hlayout.addSpacerItem(QSpacerItem(40, 20, QSizePolicy.Preferred, QSizePolicy.Expanding))

        keyboardLabel = QLabel()
        keyboardLabel.setText(self.tr("Keyboard Kind:"))
        hlayout.addWidget(keyboardLabel)

        self.keyboardVList = QComboBox()
        self.keyboardVList.setFixedWidth(325)
        hlayout.addWidget(self.keyboardVList)

        self.testEdit = QLineEdit()
        self.testEdit.setPlaceholderText(self.tr("Test out your keyboard."))
        #self.testEdit.setFixedWidth(800)
        self.layout().addWidget(self.testEdit)

        self.keyboard_list = None
        if os.path.isfile("/usr/share/lilii/data/models.json"):
            self.keyboard_list = json.loads(open("/usr/share/lilii/data/models.json").read())

        self.layout_list = None
        if os.path.isfile("/usr/share/lilii/data/layouts.json"):
            self.layout_list = json.loads(open("/usr/share/lilii/data/layouts.json").read())

        self.variant_list = None
        if os.path.isfile("/usr/share/lilii/data/variants.json"):
            self.variant_list = json.loads(open("/usr/share/lilii/data/variants.json").read())

        model = list(self.keyboard_list.keys())
        model.sort()
        for i in model:
            self.modelList.addItem(self.keyboard_list[i])
            if i == "pc105":
                self.modelList.setCurrentText(self.keyboard_list[i])
                self.parent.lilii_settings["keyboard_model"] = i, self.keyboard_list[i]

        keys = list(self.layout_list.keys())
        keys.sort()
        for i in keys:
            self.countryList.addItem(self.layout_list[i])

        default = self.layout_list.get(self.parent.lilii_settings["lang"][:2], "us")
        if default == "us":
            self.countryList.setCurrentText(self.layout_list[default])
            self.parent.lilii_settings["keyboard_layout"] = default, self.layout_list[default]

        else:
            self.countryList.setCurrentText(default)
            self.parent.lilii_settings["keyboard_layout"] = self.parent.lilii_settings["lang"][:2], default

        self.keyboardVList.addItem("Default")
        for k, v in self.variant_list.items():
            if k == self.parent.lilii_settings["keyboard_layout"][0]:
                for i in v:
                    self.keyboardVList.addItems(i.values())
        self.parent.lilii_settings["keyboard_variant"] = None

        self.modelList.currentTextChanged.connect(self.keyboardModelSelect)
        self.countryList.currentTextChanged.connect(self.countrySelect)
        self.keyboardVList.currentTextChanged.connect(self.keyboardTypeSelect)
Example #9
0
    def runInputDialog(self, title, c1Text, c2Text, opText,
                       outText, cell1, cell2, outCell):
        rows = []
        cols = []
        for r in range(self.table.rowCount()):
            rows.append(str(r + 1))
        for c in range(self.table.columnCount()):
            cols.append(chr(ord('A') + c))
        addDialog = QDialog(self)
        addDialog.setWindowTitle(title)
        group = QGroupBox(title, addDialog)
        group.setMinimumSize(250, 100)
        cell1Label = QLabel(c1Text, group)
        cell1RowInput = QComboBox(group)
        c1Row, c1Col = decode_pos(cell1)
        cell1RowInput.addItems(rows)
        cell1RowInput.setCurrentIndex(c1Row)
        cell1ColInput = QComboBox(group)
        cell1ColInput.addItems(cols)
        cell1ColInput.setCurrentIndex(c1Col)
        operatorLabel = QLabel(opText, group)
        operatorLabel.setAlignment(Qt.AlignHCenter)
        cell2Label = QLabel(c2Text, group)
        cell2RowInput = QComboBox(group)
        c2Row, c2Col = decode_pos(cell2)
        cell2RowInput.addItems(rows)
        cell2RowInput.setCurrentIndex(c2Row)
        cell2ColInput = QComboBox(group)
        cell2ColInput.addItems(cols)
        cell2ColInput.setCurrentIndex(c2Col)
        equalsLabel = QLabel("=", group)
        equalsLabel.setAlignment(Qt.AlignHCenter)
        outLabel = QLabel(outText, group)
        outRowInput = QComboBox(group)
        outRow, outCol = decode_pos(outCell)
        outRowInput.addItems(rows)
        outRowInput.setCurrentIndex(outRow)
        outColInput = QComboBox(group)
        outColInput.addItems(cols)
        outColInput.setCurrentIndex(outCol)

        cancelButton = QPushButton("Cancel", addDialog)
        cancelButton.clicked.connect(addDialog.reject)
        okButton = QPushButton("OK", addDialog)
        okButton.setDefault(True)
        okButton.clicked.connect(addDialog.accept)
        buttonsLayout = QHBoxLayout()
        buttonsLayout.addStretch(1)
        buttonsLayout.addWidget(okButton)
        buttonsLayout.addSpacing(10)
        buttonsLayout.addWidget(cancelButton)

        dialogLayout = QVBoxLayout(addDialog)
        dialogLayout.addWidget(group)
        dialogLayout.addStretch(1)
        dialogLayout.addItem(buttonsLayout)

        cell1Layout = QHBoxLayout()
        cell1Layout.addWidget(cell1Label)
        cell1Layout.addSpacing(10)
        cell1Layout.addWidget(cell1ColInput)
        cell1Layout.addSpacing(10)
        cell1Layout.addWidget(cell1RowInput)

        cell2Layout = QHBoxLayout()
        cell2Layout.addWidget(cell2Label)
        cell2Layout.addSpacing(10)
        cell2Layout.addWidget(cell2ColInput)
        cell2Layout.addSpacing(10)
        cell2Layout.addWidget(cell2RowInput)
        outLayout = QHBoxLayout()
        outLayout.addWidget(outLabel)
        outLayout.addSpacing(10)
        outLayout.addWidget(outColInput)
        outLayout.addSpacing(10)
        outLayout.addWidget(outRowInput)
        vLayout = QVBoxLayout(group)
        vLayout.addItem(cell1Layout)
        vLayout.addWidget(operatorLabel)
        vLayout.addItem(cell2Layout)
        vLayout.addWidget(equalsLabel)
        vLayout.addStretch(1)
        vLayout.addItem(outLayout)
        if addDialog.exec_():
            cell1 = cell1ColInput.currentText() + cell1RowInput.currentText()
            cell2 = cell2ColInput.currentText() + cell2RowInput.currentText()
            outCell = outColInput.currentText() + outRowInput.currentText()
            return True, cell1, cell2, outCell

        return False, None, None, None
Example #10
0
    def __init__(self, handler, data):
        '''Ask user for 2nd factor authentication. Support text, security card and paired mobile methods.
        Use last method from settings, but support new pairing and downgrade.
        '''
        QDialog.__init__(self, handler.top_level_window())
        self.handler = handler
        self.txdata = data
        self.idxs = self.txdata[
            'keycardData'] if self.txdata['confirmationType'] > 1 else ''
        self.setMinimumWidth(650)
        self.setWindowTitle(_("Ledger Wallet Authentication"))
        self.cfg = copy.deepcopy(self.handler.win.wallet.get_keystore().cfg)
        self.dongle = self.handler.win.wallet.get_keystore().get_client(
        ).dongle
        self.ws = None
        self.pin = ''

        self.devmode = self.getDevice2FAMode()
        if self.devmode == 0x11 or self.txdata['confirmationType'] == 1:
            self.cfg['mode'] = 0

        vbox = QVBoxLayout()
        self.setLayout(vbox)

        def on_change_mode(idx):
            if idx < 2 and self.ws:
                self.ws.stop()
                self.ws = None
            self.cfg[
                'mode'] = 0 if self.devmode == 0x11 else idx if idx > 0 else 1
            if self.cfg['mode'] > 1 and self.cfg['pair'] and not self.ws:
                self.req_validation()
            if self.cfg['mode'] > 0:
                self.handler.win.wallet.get_keystore().cfg = self.cfg
                self.handler.win.wallet.save_keystore()
            self.update_dlg()

        def add_pairing():
            self.do_pairing()

        def return_pin():
            self.pin = self.pintxt.text(
            ) if self.txdata['confirmationType'] == 1 else self.cardtxt.text()
            if self.cfg['mode'] == 1:
                self.pin = ''.join(chr(int(str(i), 16)) for i in self.pin)
            self.accept()

        self.modebox = QWidget()
        modelayout = QHBoxLayout()
        self.modebox.setLayout(modelayout)
        modelayout.addWidget(QLabel(_("Method:")))
        self.modes = QComboBox()
        modelayout.addWidget(self.modes, 2)
        self.addPair = QPushButton(_("Pair"))
        self.addPair.setMaximumWidth(60)
        modelayout.addWidget(self.addPair)
        modelayout.addStretch(1)
        self.modebox.setMaximumHeight(50)
        vbox.addWidget(self.modebox)

        self.populate_modes()
        self.modes.currentIndexChanged.connect(on_change_mode)
        self.addPair.clicked.connect(add_pairing)

        self.helpmsg = QTextEdit()
        self.helpmsg.setStyleSheet(
            "QTextEdit { background-color: lightgray; }")
        self.helpmsg.setReadOnly(True)
        vbox.addWidget(self.helpmsg)

        self.pinbox = QWidget()
        pinlayout = QHBoxLayout()
        self.pinbox.setLayout(pinlayout)
        self.pintxt = QLineEdit()
        self.pintxt.setEchoMode(2)
        self.pintxt.setMaxLength(4)
        self.pintxt.returnPressed.connect(return_pin)
        pinlayout.addWidget(QLabel(_("Enter PIN:")))
        pinlayout.addWidget(self.pintxt)
        pinlayout.addWidget(QLabel(_("NOT DEVICE PIN - see above")))
        pinlayout.addStretch(1)
        self.pinbox.setVisible(self.cfg['mode'] == 0)
        vbox.addWidget(self.pinbox)

        self.cardbox = QWidget()
        card = QVBoxLayout()
        self.cardbox.setLayout(card)
        self.addrtext = QTextEdit()
        self.addrtext.setStyleSheet(
            "QTextEdit { color:blue; background-color:lightgray; padding:15px 10px; border:none; font-size:20pt; font-family:monospace; }"
        )
        self.addrtext.setReadOnly(True)
        self.addrtext.setMaximumHeight(130)
        card.addWidget(self.addrtext)

        def pin_changed(s):
            if len(s) < len(self.idxs):
                i = self.idxs[len(s)]
                addr = self.txdata['address']
                if not constants.net.TESTNET:
                    text = addr[:i] + '<u><b>' + addr[
                        i:i + 1] + '</u></b>' + addr[i + 1:]
                else:
                    # pin needs to be created from mainnet address
                    addr_mainnet = bitcoin.script_to_address(
                        bitcoin.address_to_script(addr),
                        net=constants.BitcoinMainnet)
                    addr_mainnet = addr_mainnet[:i] + '<u><b>' + addr_mainnet[
                        i:i + 1] + '</u></b>' + addr_mainnet[i + 1:]
                    text = str(addr) + '\n' + str(addr_mainnet)
                self.addrtext.setHtml(str(text))
            else:
                self.addrtext.setHtml(_("Press Enter"))

        pin_changed('')
        cardpin = QHBoxLayout()
        cardpin.addWidget(QLabel(_("Enter PIN:")))
        self.cardtxt = QLineEdit()
        self.cardtxt.setEchoMode(2)
        self.cardtxt.setMaxLength(len(self.idxs))
        self.cardtxt.textChanged.connect(pin_changed)
        self.cardtxt.returnPressed.connect(return_pin)
        cardpin.addWidget(self.cardtxt)
        cardpin.addWidget(QLabel(_("NOT DEVICE PIN - see above")))
        cardpin.addStretch(1)
        card.addLayout(cardpin)
        self.cardbox.setVisible(self.cfg['mode'] == 1)
        vbox.addWidget(self.cardbox)

        self.pairbox = QWidget()
        pairlayout = QVBoxLayout()
        self.pairbox.setLayout(pairlayout)
        pairhelp = QTextEdit(helpTxt[5])
        pairhelp.setStyleSheet("QTextEdit { background-color: lightgray; }")
        pairhelp.setReadOnly(True)
        pairlayout.addWidget(pairhelp, 1)
        self.pairqr = QRCodeWidget()
        pairlayout.addWidget(self.pairqr, 4)
        self.pairbox.setVisible(False)
        vbox.addWidget(self.pairbox)
        self.update_dlg()

        if self.cfg['mode'] > 1 and not self.ws:
            self.req_validation()
    def add_denoms_tab(self):
        self.denoms_tab = QWidget()
        psman = self.psman
        g = QGridLayout()

        method_help = psman.calc_denoms_method_data(full_txt=True)
        method_lb_txt = psman.calc_denoms_method_data()
        method_hlb = HelpLabel(method_lb_txt + ':', method_help)
        self.method_cb = QComboBox()
        for m in psman.CalcDenomsMethod:
            m_str = psman.calc_denoms_method_str(m)
            self.method_cb.addItem(m_str, m)
        self.method_cb.setCurrentIndex(psman.calc_denoms_method)

        def on_method_changed(x):
            psman.calc_denoms_method = method = self.method_cb.currentData()
            self.update_abs_cnt()
            self.update_keep_amount()

        self.method_cb.currentIndexChanged.connect(on_method_changed)

        g.addWidget(method_hlb, 0, 0, 1, 2)
        g.addWidget(self.method_cb, 0, 2, 1, -1)

        keep_amount_help = psman.keep_amount_data(full_txt=True)
        keep_amount_txt = psman.keep_amount_data()
        keep_amount_label = HelpLabel(keep_amount_txt + ':', keep_amount_help)
        self.keep_amount_sb2 = DashSpinBox()
        self.keep_amount_sb2.setMinimum(psman.min_keep_amount)
        self.keep_amount_sb2.setMaximum(psman.max_keep_amount)
        self.keep_amount_sb2.setValue(psman.keep_amount)
        self.keep_amount_lb2 = QLineEdit()
        self.keep_amount_lb2.setAlignment(Qt.AlignRight)
        self.keep_amount_lb2.setEnabled(False)

        def on_keep_amount_change():
            psman.keep_amount = self.keep_amount_sb2.value()
            self.update_balances()
            self.update_keep_amount()

        self.keep_amount_sb2.valueChanged.connect(on_keep_amount_change)

        g.addWidget(keep_amount_label, 1, 0, 1, 2)
        g.addWidget(self.keep_amount_sb2, 1, 2, 1, -1)
        g.addWidget(self.keep_amount_lb2, 1, 2, 1, -1)

        denoms_help = _('Count of denoms by value')
        denoms_lb_txt = _('Denoms count')
        denoms_hlb = HelpLabel(denoms_lb_txt + ':', denoms_help)
        g.addWidget(denoms_hlb, 2, 0, 1, 2)

        h_lb = QLabel(_('Existing count:'))
        g.addWidget(h_lb, 3, 3)
        self.abs_h_lb = QLabel(_('Absolute count:'))
        g.addWidget(self.abs_h_lb, 3, 4)

        self.denoms_le = {}
        self.abs_sb = {}

        def on_abs_sb_changed(d, val):
            abs_cnt = psman.abs_denoms_cnt
            if abs_cnt[d] == val:
                return
            abs_cnt[d] = val
            psman.abs_denoms_cnt = abs_cnt
            self.update_keep_amount()

        for i, d in enumerate(PS_DENOMS_VALS[::-1]):
            d_le = QLineEdit(self.format_amount(d) + ' DASH')
            d_le.setAlignment(Qt.AlignRight)
            d_le.setEnabled(False)
            g.addWidget(d_le, 4 + i, 2)
            d_le = QLineEdit('0')
            d_le.setEnabled(False)
            self.denoms_le[d] = d_le
            g.addWidget(d_le, 4 + i, 3)
            abs_sb = QSpinBox()
            abs_sb.setMinimum(0)
            abs_sb.setValue(0)
            abs_sb.valueChanged.connect(partial(on_abs_sb_changed, d))
            self.abs_sb[d] = abs_sb
            g.addWidget(abs_sb, 4 + i, 4)

        g.setRowStretch(20, 10)
        self.denoms_tab.setLayout(g)
        self.tabs.addTab(self.denoms_tab, _('Denoms'))
    def initUI(self):
        self.resize(800,800)
        self.setWindowTitle('特征选择窗口')
        self.setWindowIcon(QIcon('./image/选择.png'))
        self.all_dict = None
        self.model = None
        self.y_predict = None
        self.df = None
        self.res_list = None
        self.var_list = []


        self.tool_bar = QToolBar()
        self.set_parameter = QAction(QIcon('./image/参数.png'),'设置参数',self)
        self.run = QAction(QIcon('./image/运行程序.png'),'运行程序',self)
        self.save = QAction(QIcon('./image/下载保存.png'),'保存结果',self)
        self.analysis = QAction(QIcon('./image/对比分析.png'),'分析预测',self)
        self.tool_bar.addAction(self.set_parameter)
        self.tool_bar.addAction(self.run)
        self.tool_bar.addAction(self.analysis)
        self.tool_bar.addAction(self.save)

        self.status_bar = QStatusBar()

        self.lable = QLabel('选择算法:')
        self.comb1 = QComboBox()
        algorithm_list = ['FSFS','Lasso']
        self.comb1.addItems(algorithm_list)
        # self.comb2 = QComboBox()
        # self.comb2.addItems(['算法','内容'])
        self.completer = QCompleter(algorithm_list)
        self.completer.setCompletionMode(QCompleter.UnfilteredPopupCompletion)
        self.line_edit = QLineEdit()
        self.line_edit.setCompleter(self.completer)
        self.button = QPushButton('搜索')

        hlayout = QHBoxLayout()
        hlayout.addWidget(self.lable)
        hlayout.addWidget(self.comb1)

        # hlayout.addWidget(self.comb2)
        hlayout.addWidget(self.line_edit)
        hlayout.addWidget(self.button)
        hlayout.addWidget(self.tool_bar)
        hlayout.addStretch(3)
        hlayout.setSpacing(10)
        self.text_edit = QTextEdit()
        file_name = "./other/aboutFSFS.txt"
        with open(file_name, 'r', encoding='utf-8') as f:
            text = f.read()
        self.text_edit.setText(text)
        self.text_edit.setReadOnly(True)
        self.run.setEnabled(False)

        vlayout = QVBoxLayout()
        vlayout.addItem(hlayout)
        vlayout.addWidget(self.text_edit)
        vlayout.addWidget(self.status_bar)
        self.setLayout(vlayout)

        self.comb1.currentIndexChanged.connect(self.selectionChange1)
        # self.comb2.currentIndexChanged(self.selecttionChange2)
        self.button.clicked.connect(self.clickSearch)
        self.set_parameter.triggered.connect(self.getParameter)
        self.run.triggered.connect(self.runProcess)
        self.analysis.triggered.connect(self.runAnalysis)
        self.save.triggered.connect(self.triggeredSave)
Example #13
0
    def initUI(self):
        if self.diplomname == '':
            self.setWindowTitle("Create diplom")
        else:
            self.setWindowTitle("Edit diplom "+self.diplomname)

            #rules = diplom.get_rules(diplom, self.diplomname+".rules")
        self.setGeometry(300, 500, 500, 300)
        #self.setFixedWidth(450)
        #self.setFixedHeight(450)
        self.setWindowIcon(QIcon('logo.png'))
        style = "QWidget{background-color:" + self.settingsDict['background-color'] + "; color:" + self.settingsDict[
            'color'] + ";}"
        styleform = "background :" + self.settingsDict['form-background'] + "; font-weight: bold; color:"+ self.settingsDict['color-table']+";"
        self.setGeometry(int(self.settingsDict['log-form-window-left']), int(self.settingsDict['log-form-window-top']),
                         int(self.settingsDict['log-form-window-width']), int(self.settingsDict['log-form-window-height']))

        self.setStyleSheet(style)
        self.name_layout = QHBoxLayout()
        self.name_label = QLabel("Name diploma:")
        self.name_label.setFixedWidth(150)
        self.name_input = QLineEdit()
        self.name_input.setStyleSheet(styleform)
        self.name_input.setFixedWidth(200)
        self.name_layout.addWidget(self.name_label)
        self.name_layout.addWidget(self.name_input)
        self.name_layout.addStretch(300)
        #

        self.score_layout = QHBoxLayout()
        score_text = QLabel("How many points do you need")
        score_text.setStyleSheet(style)
        self.score_input = QLineEdit()
        self.score_input.setStyleSheet(styleform)
        self.score_input.setText("0")
        self.score_layout.addWidget(score_text)
        self.score_layout.addWidget(self.score_input)
        #
        self.repeat_layout = QHBoxLayout()
        self.text_repeat = QLabel("Repeats:")
        self.repeat_combo = QComboBox()
        self.repeat_combo.setFixedWidth(200)
        self.repeat_combo.addItems(["resolved other bands", "resolved others mod", "resolving other mods and bands", "not resolving"])
        self.repeat_layout.addWidget(self.text_repeat)
        self.repeat_layout.addWidget(self.repeat_combo)
        self.repeat_layout.addStretch(100)
        #
        self.sps_layout = QHBoxLayout()


        self.sps_text = QLabel("Special calls \n or prefix:")
        self.sps_table_widget = QTableWidget()
        self.sps_table_widget.setStyleSheet(styleform)
        self.sps_table_widget.setFixedWidth(260)
        self. sps_table_widget.setFixedHeight(200)
        self.sps_table_widget.setColumnCount(3)
        self.sps_table_widget.setColumnWidth(0, 80)
        self.sps_table_widget.setColumnWidth(1, 50)
        self.sps_table_widget.setColumnWidth(2, 80)
        self.sps_table_widget.setRowCount(10)
        self.sps_table_widget.setHorizontalHeaderLabels(['call', 'score', 'mode'])
        self.sps_table_widget.horizontalHeaderItem(0).setToolTip("Enter special call")
        self.sps_table_widget.horizontalHeaderItem(1).setToolTip("Enter scores for QSO")
        self.sps_table_widget.horizontalHeaderItem(2).setToolTip("Select mode")
        #self.combo_mode = QComboBox()
        #self.combo_mode2 = QComboBox()
        #self.combo_mode.addItems(['SSB', 'CW', 'DIGI'])
        #self.combo_mode2.addItems(['SSB', 'CW', 'DIGI'])
        row_count = self.sps_table_widget.rowCount()
        self.combo_mode_list = []
        if self.diplomname == '':


            for row in range(row_count):
                self.combo_mode_list.append({'combo'+str(row): QComboBox()})
                self.combo_mode_list[row]['combo' + str(row)].addItems(['SSB', 'CW', 'DIGI'])
                self.combo_mode_list[row]['combo' + str(row)].setFixedWidth(80)
                self.sps_table_widget.setCellWidget(row, 2, self.combo_mode_list[row]['combo'+str(row)])



        add_row = QPushButton("Add rows")
        add_row.clicked.connect(self.add_row)
        self.prefix_lay = QVBoxLayout()
        #self.prefix_lay.addWidget(self.prefix_check_box)
        self.prefix_lay.addWidget(self.sps_text)
        self.sps_layout.addLayout(self.prefix_lay)
        self.sps_layout.addWidget(self.sps_table_widget)
        self.sps_layout.addWidget(add_row)
        #
        self.button_layout = QHBoxLayout()
        self.cancel_button = QPushButton("Cancel")
        self.cancel_button.clicked.connect(self.close)
        self.ok_button = QPushButton("Create diploma")
        self.ok_button.clicked.connect(self.save_diplom)
        self.button_layout.addWidget(self.cancel_button)
        self.button_layout.addWidget(self.ok_button)
        #
        self.color_label = QLabel()
        self.color_label.setStyleSheet(style)
        self.color_label.setText("Select color for telnet highlight")
        self.color_button = QPushButton()
        #self.color_button.setFixedWidth(100)
        self.color_button.clicked.connect(self.select_color)
        if self.diplomname == '':
            self.color_button.setText("Select color")

        self.color_layout = QHBoxLayout()
        self.color_layout.addWidget(self.color_label)
        self.color_layout.addWidget(self.color_button)
        #
        self.global_layout = QVBoxLayout()
        self.global_layout.addLayout(self.name_layout)
        #self.global_layout.addLayout(self.date_layout)
        #self.spaceItem = QSpacerItem(15, 10)
        #self.global_layout.addSpacerItem(self.spaceItem)
        self.global_layout.addLayout(self.color_layout)
        #self.global_layout.addSpacerItem(self.spaceItem)
        self.global_layout.addLayout(self.score_layout)
        self.global_layout.addLayout(self.repeat_layout)
        self.global_layout.addLayout(self.sps_layout)
        self.global_layout.addLayout(self.button_layout)
        self.setLayout(self.global_layout)
        if self.diplomname != '':
            self.add_info(self.list_data)
Example #14
0
    def create_filters(self, parent, code, lang=False, area=False, sal=True):
        if sal:
            label_sal = QLabel(parent)
            label_sal.setText('Зарплата от')
            label_sal.resize(100, 15)
            label_sal.move(5, 125)

            label_sal_val = QLabel(parent)
            label_sal_val.move(FRAME_WIDTH - 50, 125)
            label_sal_val.resize(45, 15)
            label_sal_val.setAlignment(Qt.AlignRight)
            label_sal_val.setText(str(self.start_sal))

            sld_sal = QSlider(Qt.Horizontal, parent)
            sld_sal.setMinimum(int(self.start_sal / 5000))
            sld_sal.setMaximum(40)
            sld_sal.setPageStep(1)
            sld_sal.move(5, 145)
            sld_sal.resize(FRAME_WIDTH - 10, 20)
            sld_sal.valueChanged[int].connect(
                lambda val, tab=code: self.sld_action(val, tab))
        else:
            label_sal_val = None
            sld_sal = None

        if lang:
            combo_lang = QComboBox(parent)
            combo_lang.setMaxVisibleItems(20)
            combo_lang.addItem("Все языки")
            combo_lang.resize(FRAME_WIDTH - 10, 20)
            combo_lang.move(5, 10)
            combo_lang.addItems(LANGUAGES)
            combo_lang.activated.connect(
                lambda val, tab=code: self.refresh_plot(tab))
        else:
            combo_lang = None

        if area:
            combo_area = QComboBox(parent)
            combo_area.setMaxVisibleItems(20)
            combo_area.addItem("Все города")
            combo_area.resize(FRAME_WIDTH - 10, 20)
            combo_area.move(5, 10)
            combo_area.addItems(
                [work_with_data.decode_param(val) for val in AREA])
            combo_area.activated.connect(
                lambda val, tab=code: self.refresh_plot(tab))
        else:
            combo_area = None

        combo_sizecomp = QComboBox(parent)
        combo_sizecomp.setMaxVisibleItems(5)
        combo_sizecomp.addItem("Все компании")
        combo_sizecomp.resize(FRAME_WIDTH - 10, 20)
        combo_sizecomp.move(5, 40)
        combo_sizecomp.addItems([
            work_with_data.decode_param(size_comp)
            for size_comp in SIZE_COMPANY
        ])
        combo_sizecomp.activated.connect(
            lambda val, tab=code: self.refresh_plot(tab))

        combo_exp = QComboBox(parent)
        combo_exp.setMaxVisibleItems(10)
        combo_exp.addItem("Любой опыт")
        combo_exp.resize(FRAME_WIDTH - 10, 20)
        combo_exp.move(5, 70)
        combo_exp.addItems([
            work_with_data.decode_param(experience)
            for experience in EXPERIENCE
        ])
        combo_exp.activated.connect(
            lambda val, tab=code: self.refresh_plot(tab))

        combo_empl = QComboBox(parent)
        combo_empl.setMaxVisibleItems(10)
        combo_empl.addItem("Любой график")
        combo_empl.resize(FRAME_WIDTH - 10, 20)
        combo_empl.move(5, 100)
        combo_empl.addItems([
            work_with_data.decode_param(employment)
            for employment in EMPLOYMENT
        ])
        combo_empl.activated.connect(
            lambda val, tab=code: self.refresh_plot(tab))

        items = {
            'Lang': combo_lang,
            'Area': combo_area,
            'MinSal': sld_sal,
            'SizeComp': combo_sizecomp,
            'Employment': combo_empl,
            'Experience': combo_exp,
            'lbl_min': label_sal_val
        }
        return items
Example #15
0
	def openWindow(self):
		self.setWindowIcon(QIcon('caen.png'))
		sub_box = QHBoxLayout(self)

		# Q1
		splitter1 = QSplitter(Qt.Horizontal)
		Q1 = QLabel("Is the problem with this computer?")
		self.A1 = QComboBox(self)
		self.A1.addItem("Yes")
		self.A1.addItem("No")
		Q1.resize(self.width()/2, 50)
		self.A1.resize(self.width()/2, 50)
		splitter1.addWidget(Q1)
		splitter1.addWidget(self.A1)
		splitter1.resize(self.width(), 50)

		# Q2
		splitter2 = QSplitter(Qt.Horizontal)
		Q2 = QLabel("Please describe this issue:")
		Q2.resize(self.width()/2,200)
		self.A2 = QPlainTextEdit(self)
		self.A2.resize(self.width()/2,200)
		splitter2.addWidget(Q2)
		splitter2.addWidget(self.A2)
		splitter2.resize(self.width(),200)
		
		# Q3
		splitter3 = QSplitter(Qt.Horizontal)
		Q3 = QLabel("Attach any useful information:\n(Files have to be under 10MB \nincluding the screenshots)")
		A3 = QPushButton("Select files")
		A3.clicked.connect(self.getfile)
		Q3.resize(self.width()/2, 50)
		A3.resize(self.width()/2, 50)
		splitter3.addWidget(Q3)
		splitter3.addWidget(A3)
		splitter3.resize(self.width(), 50)

		# Q4
		splitter4 = QSplitter(Qt.Horizontal)
		Q4 = QLabel("Press this button to take a screenshot \nof the entire screen.\nOnly the two screenshots are sent.")
		A4 = QPushButton("Take a screenshot")
		A4.clicked.connect(self.showScreenshotWindow)
		Q4.resize(self.width()/2, 50)
		A4.resize(self.width()/2, 50)
		splitter4.addWidget(Q4)
		splitter4.addWidget(A4)
		splitter4.resize(self.width(), 50)

		# Submit
		splitter5 = QSplitter(Qt.Horizontal)
		submit = QPushButton("Submit Report")
		submit.clicked.connect(self.submitReport)
		splitter5.addWidget(submit)
		splitter5.resize(self.width(), 50)

		splitter = QSplitter(Qt.Vertical)  
		splitter.addWidget(splitter1) 
		splitter.addWidget(splitter2) 
		splitter.addWidget(splitter3) 
		splitter.addWidget(splitter4) 
		splitter.addWidget(splitter5) 

		sub_box.addWidget(splitter)
		self.setGeometry(300,300,600,400)
		self.setWindowTitle("Report Window")
Example #16
0
from PyQt5.QtGui import QIcon, QFont
import math

### Form 1 Setup
app = QApplication(sys.argv)
window = QWidget()
window.setWindowTitle('DSD Sorting Layout Optimizer')
layout = QFormLayout()

### create combo boxes
stores = [
    "423", "435", "450", "665", "694", "6082", "6093", "6105", "6161", "6258",
    "6279"
]

combo1 = QComboBox()
for store in stores:
    combo1.addItem(store)

combo2 = QComboBox()
for store in stores:
    combo2.addItem(store)

combo3 = QComboBox()
for store in stores:
    combo3.addItem(store)

#### create demand spin boxes
store_1_demand_input = QSpinBox()
store_1_demand_input.setRange(0, 1000000)
Example #17
0
    def Setting(self):
        groupbox = QGroupBox('Setting')

        self.groupbox1 = QGroupBox('검색 범위')
        self.groupbox1.setFlat(True)
        self.groupbox2 = QGroupBox('결과 갯수')
        self.groupbox2.setFlat(True)
        self.groupbox1.setCheckable(True)
        self.groupbox1.setChecked(False)
        self.groupbox2.setCheckable(True)
        self.groupbox2.setChecked(False)

        self.cb1 = QComboBox(self)
        self.cb1.addItem('3.2.11')
        self.cb1.addItem('3.2.12')
        self.cb1.addItem('3.2.13')
        self.cb1.addItem('3.2.14')
        label1 = QLabel('~', self)
        self.cb2 = QComboBox(self)
        self.cb2.addItem('3.2.11')
        self.cb2.addItem('3.2.12')
        self.cb2.addItem('3.2.13')
        self.cb2.addItem('3.2.14')
        hbox1 = QHBoxLayout()
        hbox1.addWidget(self.cb1)
        hbox1.addWidget(label1)
        hbox1.addWidget(self.cb2)
        self.groupbox1.setLayout(hbox1)

        self.cb2.setCurrentText('3.2.14')

        self.SearchR11 = int(self.cb1.currentText()[0])
        self.SearchR12 = int(self.cb1.currentText()[2])
        self.SearchR13 = int(self.cb1.currentText()[4:])
        self.SearchR21 = 3
        self.SearchR22 = 2
        self.SearchR23 = 14

        self.qle3 = QLineEdit(self)
        self.qle3.setText('1')
        label2 = QLabel('개', self)

        self.outputnum = int(self.qle3.text())

        hbox2 = QHBoxLayout()
        hbox2.addWidget(self.qle3)
        hbox2.addWidget(label2)
        self.groupbox2.setLayout(hbox2)

        self.setBtn = QPushButton('Set', self)
        self.setBtn.setCheckable(True)
        self.setBtn.clicked.connect(self.Set_clicked)

        hbox = QHBoxLayout()
        hbox.addWidget(self.groupbox1)
        hbox.addWidget(self.groupbox2)
        hbox.addStretch(1)
        hbox.addWidget(self.setBtn)
        groupbox.setLayout(hbox)

        return groupbox
Example #18
0
    def initUI(self):
        label1 = QLabel("选择功能:")
        self.cb = QComboBox(self, minimumWidth=350)
        self.cb.addItem("子域名爆破")
        self.cb.addItem("dns域传送漏洞检测")
        self.cb.setStyleSheet("height:30px;")
        label2 = QLabel("URL地址:")
        label2.setStyleSheet("min-width:72px;height:30px;")
        # 显示字典文件
        self.label3 = QLabel("暂未选择字典文件")
        self.label3.setStyleSheet("min-width:72px;height:50px;")

        self.edit2 = QLineEdit()
        self.edit2.setText('baidu.com')  # 设置域名
        self.edit2.setStyleSheet("height:30px;")

        self.button41 = QPushButton("字典文件")

        self.button41.clicked.connect(self.showFileDialogUser)
        self.button3 = QPushButton("点击执行")
        self.button3.setStyleSheet('''
                        background-color: lightblue;
                        height:30px;
                        border-style: outset;
                        border-width: 2px;
                        border-radius: 10px;
                        border-color: beige;
                        font: bold 14px;
                        min-width: 8em;
                        padding: 6px;
                ''')
        self.button3.clicked.connect(self.func)
        self.edit3 = QTextEdit()

        # 添加一个竖直盒子,两个水平盒子
        vbox = QVBoxLayout()
        hbox1 = QHBoxLayout()
        hbox2 = QHBoxLayout()
        hbox3 = QHBoxLayout()
        hbox4 = QHBoxLayout()
        hbox6 = QHBoxLayout()
        hbox7 = QHBoxLayout()

        # 把按钮放在盒子里
        hbox1.addWidget(label1)
        hbox1.addWidget(self.cb)
        hbox2.addWidget(label2)
        hbox2.addWidget(self.edit2)
        hbox6.addWidget(self.button41)
        hbox3.addWidget(self.button3)
        hbox4.addWidget(self.edit3)
        # 增加一个显示文件的label3
        hbox7.addWidget(self.label3)

        # 把竖直盒子和水平盒子嵌套在水平盒子中
        vbox.addLayout(hbox1)
        vbox.addLayout(hbox2)
        vbox.addLayout(hbox6)
        # 增加一个显示文件的label3
        vbox.addLayout(hbox7)
        vbox.addLayout(hbox3)
        vbox.addLayout(hbox4)
        self.setLayout(vbox)
Example #19
0
    def __init__(self, persepolis_setting):
        super().__init__()
        # MainWindow
        self.persepolis_setting = persepolis_setting

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

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

        self.centralwidget = QWidget(self)
        self.verticalLayout = QVBoxLayout(self.centralwidget)
        # enable drag and drop
        self.setAcceptDrops(True)
        # frame
        self.frame = QFrame(self.centralwidget)

        # download_table_horizontalLayout
        download_table_horizontalLayout = QHBoxLayout()
        tabels_splitter = QSplitter(Qt.Horizontal)
        # category_tree
        self.category_tree_qwidget = QWidget(self)
        category_tree_verticalLayout = QVBoxLayout()
        self.category_tree = CategoryTreeView(self)
        category_tree_verticalLayout.addWidget(self.category_tree)

        self.category_tree_model = QStandardItemModel()
        self.category_tree.setModel(self.category_tree_model)
        category_table_header = ['Category']
        self.category_tree_model.setHorizontalHeaderLabels(
            category_table_header)
        self.category_tree.header().setStretchLastSection(True)

        # queue_panel
        self.queue_panel_widget = QWidget(self)

        queue_panel_verticalLayout_main = QVBoxLayout(self.queue_panel_widget)
        # queue_panel_show_button
        self.queue_panel_show_button = QPushButton(self)

        queue_panel_verticalLayout_main.addWidget(self.queue_panel_show_button)
        # queue_panel_widget_frame
        self.queue_panel_widget_frame = QFrame(self)
        self.queue_panel_widget_frame.setFrameShape(QFrame.StyledPanel)
        self.queue_panel_widget_frame.setFrameShadow(QFrame.Raised)

        queue_panel_verticalLayout_main.addWidget(
            self.queue_panel_widget_frame)

        queue_panel_verticalLayout = QVBoxLayout(self.queue_panel_widget_frame)
        queue_panel_verticalLayout_main.setContentsMargins(50, -1, 50, -1)

        # start_end_frame
        self.start_end_frame = QFrame(self)

        # start time
        start_verticalLayout = QVBoxLayout(self.start_end_frame)
        self.start_checkBox = QCheckBox(self)
        start_verticalLayout.addWidget(self.start_checkBox)

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

        start_frame_verticalLayout = QVBoxLayout(self.start_frame)

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

        start_verticalLayout.addWidget(self.start_frame)
        # end time

        self.end_checkBox = QCheckBox(self)
        start_verticalLayout.addWidget(self.end_checkBox)

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

        end_frame_verticalLayout = QVBoxLayout(self.end_frame)

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

        start_verticalLayout.addWidget(self.end_frame)

        self.reverse_checkBox = QCheckBox(self)
        start_verticalLayout.addWidget(self.reverse_checkBox)

        queue_panel_verticalLayout.addWidget(self.start_end_frame)

        # limit_after_frame
        self.limit_after_frame = QFrame(self)
        # limit_checkBox
        limit_verticalLayout = QVBoxLayout(self.limit_after_frame)
        self.limit_checkBox = QCheckBox(self)
        limit_verticalLayout.addWidget(self.limit_checkBox)
        # limit_frame
        self.limit_frame = QFrame(self)
        self.limit_frame.setFrameShape(QFrame.StyledPanel)
        self.limit_frame.setFrameShadow(QFrame.Raised)
        limit_verticalLayout.addWidget(self.limit_frame)

        limit_frame_verticalLayout = QVBoxLayout(self.limit_frame)
        # limit_spinBox
        limit_frame_horizontalLayout = QHBoxLayout()
        self.limit_spinBox = QDoubleSpinBox(self)
        self.limit_spinBox.setMinimum(1)
        self.limit_spinBox.setMaximum(1023)
        limit_frame_horizontalLayout.addWidget(self.limit_spinBox)
        # limit_comboBox
        self.limit_comboBox = QComboBox(self)
        self.limit_comboBox.addItem("")
        self.limit_comboBox.addItem("")
        limit_frame_horizontalLayout.addWidget(self.limit_comboBox)
        limit_frame_verticalLayout.addLayout(limit_frame_horizontalLayout)
        # limit_pushButton
        self.limit_pushButton = QPushButton(self)
        limit_frame_verticalLayout.addWidget(self.limit_pushButton)

        # after_checkBox
        self.after_checkBox = QtWidgets.QCheckBox(self)
        limit_verticalLayout.addWidget(self.after_checkBox)
        # after_frame
        self.after_frame = QtWidgets.QFrame(self)
        self.after_frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.after_frame.setFrameShadow(QtWidgets.QFrame.Raised)
        limit_verticalLayout.addWidget(self.after_frame)

        after_frame_verticalLayout = QVBoxLayout(self.after_frame)
        # after_comboBox
        self.after_comboBox = QComboBox(self)
        self.after_comboBox.addItem("")

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

        queue_panel_verticalLayout.addWidget(self.limit_after_frame)
        category_tree_verticalLayout.addWidget(self.queue_panel_widget)

        # keep_awake_checkBox
        self.keep_awake_checkBox = QCheckBox(self)
        queue_panel_verticalLayout.addWidget(self.keep_awake_checkBox)

        self.category_tree_qwidget.setLayout(category_tree_verticalLayout)
        tabels_splitter.addWidget(self.category_tree_qwidget)

        # download table widget
        self.download_table_content_widget = QWidget(self)
        download_table_content_widget_verticalLayout = QVBoxLayout(
            self.download_table_content_widget)

        self.download_table = DownloadTableWidget(self)
        download_table_content_widget_verticalLayout.addWidget(
            self.download_table)
        tabels_splitter.addWidget(self.download_table_content_widget)

        self.download_table.setColumnCount(13)
        self.download_table.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.download_table.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.download_table.verticalHeader().hide()

        # hide gid and download dictioanry section
        self.download_table.setColumnHidden(8, True)
        self.download_table.setColumnHidden(9, True)

        download_table_header = [
            'File Name', 'Status', 'Size', 'Downloaded', 'Percentage',
            'Connections', 'Transfer rate', 'Estimate time left', 'Gid',
            'Link', 'First try date', 'Last try date', 'Category'
        ]
        self.download_table.setHorizontalHeaderLabels(download_table_header)

        # fixing the size of download_table when window is Maximized!
        self.download_table.horizontalHeader().setSectionResizeMode(0)
        self.download_table.horizontalHeader().setStretchLastSection(True)

        tabels_splitter.setStretchFactor(0, 3)  # category_tree width
        tabels_splitter.setStretchFactor(1, 10)  # ratio of tables's width
        download_table_horizontalLayout.addWidget(tabels_splitter)
        self.frame.setLayout(download_table_horizontalLayout)
        self.verticalLayout.addWidget(self.frame)
        self.setCentralWidget(self.centralwidget)

        # menubar
        self.menubar = QMenuBar(self)
        self.menubar.setGeometry(QRect(0, 0, 600, 24))
        self.setMenuBar(self.menubar)
        fileMenu = self.menubar.addMenu('&File')
        editMenu = self.menubar.addMenu('&Edit')
        viewMenu = self.menubar.addMenu('&View')
        downloadMenu = self.menubar.addMenu('&Download')
        queueMenu = self.menubar.addMenu('&Queue')
        videoFinderMenu = self.menubar.addMenu('&Video Finder')
        helpMenu = self.menubar.addMenu('&Help')

        # viewMenu submenus
        sortMenu = viewMenu.addMenu('Sort by')
        # statusbar
        self.statusbar = QStatusBar(self)
        self.setStatusBar(self.statusbar)
        self.statusbar.showMessage("Persepolis Download Manager")
        # toolBar
        self.toolBar2 = QToolBar(self)
        self.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar2)
        self.toolBar2.setWindowTitle('Menu')
        self.toolBar2.setFloatable(False)
        self.toolBar2.setMovable(False)

        self.toolBar = QToolBar(self)
        self.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)
        self.toolBar.setWindowTitle('Toolbar')
        self.toolBar.setFloatable(False)
        self.toolBar.setMovable(False)

        #toolBar and menubar and actions
        self.youtubeAddLinkAction = QAction(
            QIcon(icons + 'video_finder'),
            'Find Video Links',
            self,
            statusTip='Download video or audio from youtube and ...',
            triggered=self.showYoutubeAddLinkWindow)
        videoFinderMenu.addAction(self.youtubeAddLinkAction)

        self.stopAllAction = QAction(QIcon(icons + 'stop_all'),
                                     'Stop all active downloads',
                                     self,
                                     statusTip='Stop all active downloads',
                                     triggered=self.stopAllDownloads)
        downloadMenu.addAction(self.stopAllAction)

        self.sort_file_name_Action = QAction('File name',
                                             self,
                                             triggered=self.sortByName)
        sortMenu.addAction(self.sort_file_name_Action)

        self.sort_file_size_Action = QAction('File size',
                                             self,
                                             triggered=self.sortBySize)
        sortMenu.addAction(self.sort_file_size_Action)

        self.sort_first_try_date_Action = QAction(
            'First try date', self, triggered=self.sortByFirstTry)
        sortMenu.addAction(self.sort_first_try_date_Action)

        self.sort_last_try_date_Action = QAction('Last try date',
                                                 self,
                                                 triggered=self.sortByLastTry)
        sortMenu.addAction(self.sort_last_try_date_Action)

        self.sort_download_status_Action = QAction('Download status',
                                                   self,
                                                   triggered=self.sortByStatus)
        sortMenu.addAction(self.sort_download_status_Action)

        self.trayAction = QAction('Show system tray icon',
                                  self,
                                  statusTip="Show/Hide system tray icon",
                                  triggered=self.showTray)
        self.trayAction.setCheckable(True)
        viewMenu.addAction(self.trayAction)

        self.showMenuBarAction = QAction('Show menubar',
                                         self,
                                         statusTip='Show menubar',
                                         triggered=self.showMenuBar)
        self.showMenuBarAction.setCheckable(True)
        viewMenu.addAction(self.showMenuBarAction)

        self.showSidePanelAction = QAction('Show side panel',
                                           self,
                                           statusTip='Show side panel',
                                           triggered=self.showSidePanel)
        self.showSidePanelAction.setCheckable(True)
        viewMenu.addAction(self.showSidePanelAction)

        self.minimizeAction = QAction(QIcon(icons + 'minimize'),
                                      'Minimize to system tray',
                                      self,
                                      shortcut="Ctrl+W",
                                      statusTip="Minimize to system tray",
                                      triggered=self.minMaxTray)
        viewMenu.addAction(self.minimizeAction)

        self.addlinkAction = QAction(QIcon(icons + 'add'),
                                     'Add New Download Link',
                                     self,
                                     shortcut="Ctrl+N",
                                     statusTip="Add New Download Link",
                                     triggered=self.addLinkButtonPressed)
        fileMenu.addAction(self.addlinkAction)

        self.addtextfileAction = QAction(
            QIcon(icons + 'file'),
            'Import links from text file',
            self,
            statusTip='Create a Text file and put links in it.line by line!',
            triggered=self.importText)
        fileMenu.addAction(self.addtextfileAction)

        self.resumeAction = QAction(QIcon(icons + 'play'),
                                    'Resume Download',
                                    self,
                                    shortcut="Ctrl+R",
                                    statusTip="Resume Download",
                                    triggered=self.resumeButtonPressed)
        downloadMenu.addAction(self.resumeAction)

        self.pauseAction = QAction(QIcon(icons + 'pause'),
                                   'Pause Download',
                                   self,
                                   shortcut="Ctrl+C",
                                   statusTip="Pause Download",
                                   triggered=self.pauseButtonPressed)
        downloadMenu.addAction(self.pauseAction)

        self.stopAction = QAction(QIcon(icons + 'stop'),
                                  'Stop Download',
                                  self,
                                  shortcut="Ctrl+S",
                                  statusTip="Stop/Cancel Download",
                                  triggered=self.stopButtonPressed)
        downloadMenu.addAction(self.stopAction)

        self.propertiesAction = QAction(QIcon(icons + 'setting'),
                                        'Properties',
                                        self,
                                        shortcut="Ctrl+P",
                                        statusTip="Properties",
                                        triggered=self.propertiesButtonPressed)
        downloadMenu.addAction(self.propertiesAction)

        self.progressAction = QAction(QIcon(icons + 'window'),
                                      'Progress',
                                      self,
                                      shortcut="Ctrl+Z",
                                      statusTip="Progress",
                                      triggered=self.progressButtonPressed)
        downloadMenu.addAction(self.progressAction)

        self.openFileAction = QAction(QIcon(icons + 'file'),
                                      'Open file',
                                      self,
                                      statusTip='Open file',
                                      triggered=self.openFile)
        fileMenu.addAction(self.openFileAction)

        self.openDownloadFolderAction = QAction(
            QIcon(icons + 'folder'),
            'Open download folder',
            self,
            statusTip='Open download folder',
            triggered=self.openDownloadFolder)
        fileMenu.addAction(self.openDownloadFolderAction)

        self.openDefaultDownloadFolderAction = QAction(
            QIcon(icons + 'folder'),
            'Open default download folder',
            self,
            statusTip='Open default download folder',
            triggered=self.openDefaultDownloadFolder)
        fileMenu.addAction(self.openDefaultDownloadFolderAction)

        self.exitAction = QAction(QIcon(icons + 'exit'),
                                  'Exit',
                                  self,
                                  shortcut="Ctrl+Q",
                                  statusTip="Exit",
                                  triggered=self.closeEvent)
        fileMenu.addAction(self.exitAction)

        self.clearAction = QAction(
            QIcon(icons + 'multi_remove'),
            'Clear download list',
            self,
            statusTip='Clear all items in download list',
            triggered=self.clearDownloadList)
        editMenu.addAction(self.clearAction)

        self.removeSelectedAction = QAction(
            QIcon(icons + 'remove'),
            'Remove selected downloads form list',
            self,
            statusTip='Remove selected downloads form list',
            triggered=self.removeSelected)
        editMenu.addAction(self.removeSelectedAction)
        self.removeSelectedAction.setEnabled(False)

        self.deleteSelectedAction = QAction(
            QIcon(icons + 'trash'),
            'Delete selected download files',
            self,
            statusTip='Delete selected download files',
            triggered=self.deleteSelected)
        editMenu.addAction(self.deleteSelectedAction)
        self.deleteSelectedAction.setEnabled(False)

        self.createQueueAction = QAction(QIcon(icons + 'add_queue'),
                                         'Create new queue',
                                         self,
                                         statusTip='Create new download queue',
                                         triggered=self.createQueue)
        queueMenu.addAction(self.createQueueAction)

        self.removeQueueAction = QAction(QIcon(icons + 'remove_queue'),
                                         'Remove this queue',
                                         self,
                                         statusTip='Remove this queue',
                                         triggered=self.removeQueue)
        queueMenu.addAction(self.removeQueueAction)

        self.startQueueAction = QAction(QIcon(icons + 'start_queue'),
                                        'Start this queue',
                                        self,
                                        statusTip='Start this queue',
                                        triggered=self.startQueue)
        queueMenu.addAction(self.startQueueAction)

        self.stopQueueAction = QAction(QIcon(icons + 'stop_queue'),
                                       'Stop this queue',
                                       self,
                                       statusTip='Stop this queue',
                                       triggered=self.stopQueue)
        queueMenu.addAction(self.stopQueueAction)

        self.moveUpSelectedAction = QAction(
            QIcon(icons + 'multi_up'),
            'Move up selected items',
            self,
            statusTip='Move currently selected items up by one row',
            triggered=self.moveUpSelected)
        queueMenu.addAction(self.moveUpSelectedAction)

        self.moveDownSelectedAction = QAction(
            QIcon(icons + 'multi_down'),
            'Move down selected items',
            self,
            statusTip='Move currently selected items down by one row',
            triggered=self.moveDownSelected)
        queueMenu.addAction(self.moveDownSelectedAction)

        self.preferencesAction = QAction(QIcon(icons + 'preferences'),
                                         'Preferences',
                                         self,
                                         statusTip='Preferences',
                                         triggered=self.openPreferences,
                                         menuRole=5)
        editMenu.addAction(self.preferencesAction)

        self.aboutAction = QAction(QIcon(icons + 'about'),
                                   'About',
                                   self,
                                   statusTip='About',
                                   triggered=self.openAbout,
                                   menuRole=4)
        helpMenu.addAction(self.aboutAction)

        self.issueAction = QAction(QIcon(icons + 'about'),
                                   'Report an issue',
                                   self,
                                   statusTip='Report an issue',
                                   triggered=self.reportIssue)
        helpMenu.addAction(self.issueAction)

        self.updateAction = QAction(QIcon(icons + 'about'),
                                    'Check for newer version',
                                    self,
                                    statusTip='Check for newer release',
                                    triggered=self.newUpdate)
        helpMenu.addAction(self.updateAction)

        self.logAction = QAction(QIcon(icons + 'about'),
                                 'Show log file',
                                 self,
                                 statusTip='Help',
                                 triggered=self.showLog)
        helpMenu.addAction(self.logAction)

        self.helpAction = QAction(QIcon(icons + 'about'),
                                  'Help',
                                  self,
                                  statusTip='Help',
                                  triggered=self.persepolisHelp)
        helpMenu.addAction(self.helpAction)

        self.qmenu = MenuWidget(self)

        self.toolBar2.addWidget(self.qmenu)

        # labels
        self.queue_panel_show_button.setText("Hide options")
        self.start_checkBox.setText("Start Time")

        self.end_checkBox.setText("End Time")

        self.reverse_checkBox.setText("Download bottom of\n the list first")

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

        self.after_checkBox.setText("After download")
        self.after_comboBox.setItemText(0, "Shut Down")

        self.keep_awake_checkBox.setText("Keep system awake!")
        self.keep_awake_checkBox.setToolTip(
            "<html><head/><body><p>This option is preventing system from going to sleep.\
            This is necessary if your power manager is suspending system automatically. </p></body></html>"
        )

        self.after_pushButton.setText("Apply")
Example #20
0
def get_alg_combobox():
	alg_combo = QComboBox()
	alg_combo.addItem(vc.P_AND_O)
	alg_combo.addItem(vc.INC_COND)
	alg_combo.addItem(vc.FUZ_LOGIC)
	return alg_combo
    def __init__(self, network: Network, config: 'SimpleConfig', wizard=False):
        self.network = network
        self.config = config
        self.tor_proxy = None

        self.tabs = tabs = QTabWidget()
        proxy_tab = QWidget()
        blockchain_tab = QWidget()
        tabs.addTab(blockchain_tab, _('Overview'))
        tabs.addTab(proxy_tab, _('Proxy'))

        fixed_width_hostname = 24 * char_width_in_lineedit()
        fixed_width_port = 6 * char_width_in_lineedit()

        # Proxy tab
        grid = QGridLayout(proxy_tab)
        grid.setSpacing(8)

        # proxy setting
        self.proxy_cb = QCheckBox(_('Use proxy'))
        self.proxy_cb.clicked.connect(self.check_disable_proxy)
        self.proxy_cb.clicked.connect(self.set_proxy)

        self.proxy_mode = QComboBox()
        self.proxy_mode.addItems(['SOCKS4', 'SOCKS5'])
        self.proxy_host = QLineEdit()
        self.proxy_host.setFixedWidth(fixed_width_hostname)
        self.proxy_port = QLineEdit()
        self.proxy_port.setFixedWidth(fixed_width_port)
        self.proxy_user = QLineEdit()
        self.proxy_user.setPlaceholderText(_("Proxy user"))
        self.proxy_password = PasswordLineEdit()
        self.proxy_password.setPlaceholderText(_("Password"))
        self.proxy_password.setFixedWidth(fixed_width_port)

        self.proxy_mode.currentIndexChanged.connect(self.set_proxy)
        self.proxy_host.editingFinished.connect(self.set_proxy)
        self.proxy_port.editingFinished.connect(self.set_proxy)
        self.proxy_user.editingFinished.connect(self.set_proxy)
        self.proxy_password.editingFinished.connect(self.set_proxy)

        self.proxy_mode.currentIndexChanged.connect(
            self.proxy_settings_changed)
        self.proxy_host.textEdited.connect(self.proxy_settings_changed)
        self.proxy_port.textEdited.connect(self.proxy_settings_changed)
        self.proxy_user.textEdited.connect(self.proxy_settings_changed)
        self.proxy_password.textEdited.connect(self.proxy_settings_changed)

        self.tor_cb = QCheckBox(_("Use Tor Proxy"))
        self.tor_cb.setIcon(read_QIcon("tor_logo.png"))
        self.tor_cb.hide()
        self.tor_cb.clicked.connect(self.use_tor_proxy)

        grid.addWidget(self.tor_cb, 1, 0, 1, 3)
        grid.addWidget(self.proxy_cb, 2, 0, 1, 3)
        grid.addWidget(
            HelpButton(
                _('Proxy settings apply to all connections: with Electrum servers, but also with third-party services.'
                  )), 2, 4)
        grid.addWidget(self.proxy_mode, 4, 1)
        grid.addWidget(self.proxy_host, 4, 2)
        grid.addWidget(self.proxy_port, 4, 3)
        grid.addWidget(self.proxy_user, 5, 2)
        grid.addWidget(self.proxy_password, 5, 3)
        grid.setRowStretch(7, 1)

        # Blockchain Tab
        grid = QGridLayout(blockchain_tab)
        msg = ' '.join([
            _("Electrum connects to several nodes in order to download block headers and find out the longest blockchain."
              ),
            _("This blockchain is used to verify the transactions sent by your transaction server."
              )
        ])
        self.status_label = QLabel('')
        grid.addWidget(QLabel(_('Status') + ':'), 0, 0)
        grid.addWidget(self.status_label, 0, 1, 1, 3)
        grid.addWidget(HelpButton(msg), 0, 4)

        self.autoconnect_cb = QCheckBox(_('Select server automatically'))
        self.autoconnect_cb.setEnabled(
            self.config.is_modifiable('auto_connect'))
        self.autoconnect_cb.clicked.connect(self.set_server)
        self.autoconnect_cb.clicked.connect(self.update)
        msg = ' '.join([
            _("If auto-connect is enabled, Electrum will always use a server that is on the longest blockchain."
              ),
            _("If it is disabled, you have to choose a server you want to use. Electrum will warn you if your server is lagging."
              )
        ])
        grid.addWidget(self.autoconnect_cb, 1, 0, 1, 3)
        grid.addWidget(HelpButton(msg), 1, 4)

        self.server_e = QLineEdit()
        self.server_e.setFixedWidth(fixed_width_hostname + fixed_width_port)
        self.server_e.editingFinished.connect(self.set_server)
        msg = _(
            "Electrum sends your wallet addresses to a single server, in order to receive your transaction history."
        )
        grid.addWidget(QLabel(_('Server') + ':'), 2, 0)
        grid.addWidget(self.server_e, 2, 1, 1, 3)
        grid.addWidget(HelpButton(msg), 2, 4)

        self.height_label = QLabel('')
        msg = _('This is the height of your local copy of the blockchain.')
        grid.addWidget(QLabel(_('Blockchain') + ':'), 3, 0)
        grid.addWidget(self.height_label, 3, 1)
        grid.addWidget(HelpButton(msg), 3, 4)

        self.split_label = QLabel('')
        grid.addWidget(self.split_label, 4, 0, 1, 3)

        self.nodes_list_widget = NodesListWidget(self)
        grid.addWidget(self.nodes_list_widget, 6, 0, 1, 5)

        vbox = QVBoxLayout()
        vbox.addWidget(tabs)
        self.layout_ = vbox
        # tor detector
        self.td = td = TorDetector()
        td.found_proxy.connect(self.suggest_proxy)
        td.start()

        self.fill_in_proxy_settings()
        self.update()
Example #22
0
    def __init__(self, *args):
        super().__init__(BrickletCompass, *args)

        self.compass = self.device

        self.cbe_mfd = CallbackEmulator(self,
                                        self.compass.get_magnetic_flux_density,
                                        None,
                                        self.cb_mfd,
                                        self.increase_error_count)

        self.calibration = None

        self.compass_widget = CompassWidget()

        self.current_mfd_x = CurveValueWrapper() # int, µT
        self.current_mfd_y = CurveValueWrapper() # int, µT
        self.current_mfd_z = CurveValueWrapper() # int, µT

        self.heading_label = HeadingLabel()
        self.inclination_label = InclinationLabel()

        self.label_widget = QWidget()
        self.label_layout = QVBoxLayout()
        self.label_layout.addWidget(self.heading_label)
        self.label_layout.addWidget(self.inclination_label)
        self.label_widget.setLayout(self.label_layout)

        plots = [('X', Qt.red, self.current_mfd_x, '{0} µT'.format),
                 ('Y', Qt.darkGreen, self.current_mfd_y, '{0} µT'.format),
                 ('Z', Qt.blue, self.current_mfd_z, '{0} µT'.format)]
        self.plot_widget = PlotWidget('Magnetic Flux Density [µT]', plots, extra_key_widgets=[self.compass_widget, self.label_widget],
                                      update_interval=0.1, y_resolution=1)

        self.dr_label = QLabel('Data Rate:')
        self.dr_combo = QComboBox()
        self.dr_combo.addItem("100 Hz")
        self.dr_combo.addItem("200 Hz")
        self.dr_combo.addItem("400 Hz")
        self.dr_combo.addItem("600 Hz")

        self.dr_combo.currentIndexChanged.connect(self.new_config)

        self.button_calibration = QPushButton('Calibrate')
        self.button_calibration.clicked.connect(self.calibration_clicked)

        hlayout = QHBoxLayout()
        hlayout.addStretch()
        hlayout.addWidget(self.dr_label)
        hlayout.addWidget(self.dr_combo)
        hlayout.addStretch()
        hlayout.addWidget(self.button_calibration)
        hlayout.addStretch()

        line = QFrame()
        line.setObjectName("line")
        line.setFrameShape(QFrame.HLine)
        line.setFrameShadow(QFrame.Sunken)

        layout = QVBoxLayout(self)
        layout.addWidget(self.plot_widget)
        layout.addWidget(line)
        layout.addLayout(hlayout)
 def material_select_box(self):
     self.label_mat_name.setText('Select Material')
     self.material_name_widget = QComboBox(self.materialBoxGroup)
     self.miniLayout.addWidget(self.material_name_widget)
     self.update_material_combobox()
Example #24
0
    def initUI(self):
        self.setGeometry(300, 300, 600, 350)
        self.setWindowTitle('SaveScoreProgram')

        vbox = QVBoxLayout()

        #1st QHBoxLayout
        nameLabel = QLabel("Name: ")
        self.nameEdit = QLineEdit(self)
        ageLabel = QLabel("Age: ")
        self.ageEdit = QLineEdit(self)
        scoreLabel = QLabel("Score: ")
        self.scoreEdit = QLineEdit(self)
        firsthbox = QHBoxLayout()
        firsthbox.addStretch(1)
        firsthbox.addWidget(nameLabel)
        firsthbox.addWidget(self.nameEdit)
        firsthbox.addWidget(ageLabel)
        firsthbox.addWidget(self.ageEdit)
        firsthbox.addWidget(scoreLabel)
        firsthbox.addWidget(self.scoreEdit)
        vbox.addLayout(firsthbox)

        #2nd QHBoxLayout
        amountLabel = QLabel("Amount: ")
        self.amountEdit = QLineEdit(self)
        keyLabel = QLabel("key: ")
        self.keyCombo = QComboBox(self)
        self.keyCombo.addItem("Name")
        self.keyCombo.addItem("Age")
        self.keyCombo.addItem("Score")
        secondbox = QHBoxLayout()
        secondbox.addStretch(1)
        secondbox.addWidget(amountLabel)
        secondbox.addWidget(self.amountEdit)
        secondbox.addWidget(keyLabel)
        secondbox.addWidget(self.keyCombo)
        vbox.addLayout(secondbox)

        #3th QHBoxLayout
        addButton = QPushButton("Add")
        delButton = QPushButton("Del")
        findButton = QPushButton("Find")
        incButton = QPushButton("Inc")
        showButton = QPushButton("show")
        thirdBox = QHBoxLayout()
        thirdBox.addStretch(1)
        thirdBox.addWidget(addButton)
        thirdBox.addWidget(delButton)
        thirdBox.addWidget(findButton)
        thirdBox.addWidget(incButton)
        thirdBox.addWidget(showButton)
        vbox.addLayout(thirdBox)

        #4th QHBoxLayout
        resultLabel = QLabel("Result:")
        fourthbox = QHBoxLayout()
        fourthbox.addWidget(resultLabel)
        vbox.addLayout(fourthbox)

        #5th QHBoxLayout
        self.resultTextEdit = QTextEdit(self)
        fifthbox = QHBoxLayout()
        fifthbox.addWidget(self.resultTextEdit)
        vbox.addLayout(fifthbox)

        #수평정렬
        self.setLayout(vbox)

        #각 버튼이벤트 연결
        addButton.clicked.connect(self.addButtonClicked)
        delButton.clicked.connect(self.delButtonClicked)
        findButton.clicked.connect(self.findButtonClicked)
        incButton.clicked.connect(self.incButtonClicked)
        showButton.clicked.connect(self.showButtonClicked)

        self.show()
    def initUI(self):
        #pyqt5初始化UI界面
        self.setGeometry(100, 100, 700, 650)
        self.setWindowTitle('TestCams')
        self.setWindowIcon(QIcon('GCap.ico'))

        #左相机相关
        self.btnOpen = QPushButton('打开左相机', self)
        self.combo = QComboBox(self)
        self.combo.addItem('25%')
        self.combo.addItem('50%')
        self.combo.addItem('100%')
        self.combo.setCurrentIndex(2)
        self.btnStart = QPushButton('开始采集', self)
        self.btnPause = QPushButton('暂停采集', self)
        self.btnSave = QPushButton('保存左图像', self)
        self.btnSetting = QPushButton('设置', self)
        self.btnClose = QPushButton('关闭左相机', self)
        self.combo.setEnabled(False)
        self.btnStart.setEnabled(False)
        self.btnPause.setEnabled(False)
        self.btnSave.setEnabled(False)
        self.btnSetting.setEnabled(False)
        self.btnClose.setEnabled(False)
        self.label = QLabel('Left', self)
        self.QScrollArea = QScrollArea(self)
        self.QScrollArea.setBackgroundRole(QPalette.Dark)
        self.QScrollArea.setWidget(self.label)
        self.winid = self.label.winId()  # 获取label对象的句柄
        self.label.setStyleSheet("QLabel{background:Dark;}")
        hbox = QHBoxLayout()
        hbox.addWidget(self.btnOpen)
        hbox.addWidget(self.combo)
        hbox.addWidget(self.btnStart)
        hbox.addWidget(self.btnPause)
        hbox.addWidget(self.btnSave)
        hbox.addWidget(self.btnSetting)
        hbox.addWidget(self.btnClose)
        hbox.addStretch(1)

        # 使用的信号槽机制连接触发事件
        self.btnOpen.clicked.connect(self.openCam)
        self.combo.activated[str].connect(self.setSize)
        self.btnStart.clicked.connect(self.startGrab)
        self.btnPause.clicked.connect(self.pauseGrab)
        self.btnSave.clicked.connect(self.saveImage)
        self.btnSetting.clicked.connect(self.setting)
        self.btnClose.clicked.connect(self.closeCam)

        #右相机相关
        self.btnOpen2 = QPushButton('打开右相机', self)
        self.combo2 = QComboBox(self)
        self.combo2.addItem('25%')
        self.combo2.addItem('50%')
        self.combo2.addItem('100%')
        self.combo2.setCurrentIndex(2)
        self.btnStart2 = QPushButton('开始采集', self)
        self.btnPause2 = QPushButton('暂停采集', self)
        self.btnSave2 = QPushButton('保存右图像', self)
        self.btnSetting2 = QPushButton('设置', self)
        self.btnClose2 = QPushButton('关闭右相机', self)
        self.combo2.setEnabled(False)
        self.btnStart2.setEnabled(False)
        self.btnPause2.setEnabled(False)
        self.btnSave2.setEnabled(False)
        self.btnSetting2.setEnabled(False)
        self.btnClose2.setEnabled(False)
        self.label2 = QLabel('Right', self)
        self.QScrollArea2 = QScrollArea(self)
        self.QScrollArea2.setBackgroundRole(QPalette.Dark)
        self.QScrollArea2.setWidget(self.label2)
        self.winid2 = self.label2.winId()  # 获取label对象的句柄
        self.label2.setStyleSheet("QLabel{background:Dark;}")
        hbox2 = QHBoxLayout()
        hbox2.addWidget(self.btnOpen2)
        hbox2.addWidget(self.combo2)
        hbox2.addWidget(self.btnStart2)
        hbox2.addWidget(self.btnPause2)
        hbox2.addWidget(self.btnSave2)
        hbox2.addWidget(self.btnSetting2)
        hbox2.addWidget(self.btnClose2)
        hbox2.addStretch(1)
        vbox2 = QVBoxLayout()
        vbox2.addLayout(hbox)
        vbox2.addWidget(self.QScrollArea)
        vbox2.addLayout(hbox2)
        vbox2.addWidget(self.QScrollArea2)
        self.setLayout(vbox2)

        # 使用的信号槽机制连接触发事件
        self.btnOpen2.clicked.connect(self.openCam2)
        self.combo2.activated[str].connect(self.setSize)
        self.btnStart2.clicked.connect(self.startGrab2)
        self.btnPause2.clicked.connect(self.pauseGrab)
        self.btnSave2.clicked.connect(self.saveImage)
        self.btnSetting2.clicked.connect(self.setting)
        self.btnClose2.clicked.connect(self.closeCam)
        self.show()
Example #26
0
    def initUI(self):
        self.C_P = QLabel('CallOrPut')
        self.S01 = QLabel('S1_0')
        self.S02 = QLabel('S2_0')
        self.K = QLabel('K')
        self.T = QLabel('T')
        self.r = QLabel('r')
        self.sigma1 = QLabel('sigma1')
        self.sigma2 = QLabel('sigma2')
        self.cov = QLabel('cov')
        self.I = QLabel('I')
        self.result = QLabel('result')

        self.C_Pcombo = QComboBox(self)
        self.C_Pcombo.addItem("call")
        self.C_Pcombo.addItem("put")
        self.C_Pcombo.activated[str].connect(self.onActivated)

        self.S01ed = QLineEdit()
        self.S02ed = QLineEdit()
        self.Ked = QLineEdit()
        self.Ted = QLineEdit()
        self.red = QLineEdit()
        self.sigma1ed = QLineEdit()
        self.sigma2ed = QLineEdit()
        self.coved = QLineEdit()
        self.Ied = QLineEdit()

        btn = QPushButton("calculate")
        btn.clicked.connect(self.buttonClicked)

        grid = QGridLayout()
        grid.setSpacing(10)

        grid.addWidget(self.C_P, 0, 0)
        grid.addWidget(self.C_Pcombo, 0, 1)
        grid.addWidget(self.S01, 1, 0)
        grid.addWidget(self.S01ed, 1, 1)
        grid.addWidget(self.S02, 1, 2)
        grid.addWidget(self.S02ed, 1, 3)
        grid.addWidget(self.K, 2, 0)
        grid.addWidget(self.Ked, 2, 1)
        grid.addWidget(self.T, 2, 2)
        grid.addWidget(self.Ted, 2, 3)
        grid.addWidget(self.r, 3, 0)
        grid.addWidget(self.red, 3, 1)
        grid.addWidget(self.sigma1, 3, 2)
        grid.addWidget(self.sigma1ed, 3, 3)
        grid.addWidget(self.sigma2, 4, 0)
        grid.addWidget(self.sigma2ed, 4, 1)
        grid.addWidget(self.cov, 4, 2)
        grid.addWidget(self.coved, 4, 3)
        grid.addWidget(self.I, 5, 0)
        grid.addWidget(self.Ied, 5, 1)

        grid.addWidget(btn, 6, 0)
        grid.addWidget(self.result, 6, 1)

        self.setLayout(grid)

        self.setGeometry(300, 300, 350, 300)
        self.setWindowTitle('GPU_mcsBasketOption')
        self.show()
Example #27
0
    def __init__(self, title: str, *args, **kwargs):

        super().__init__(title, *args, **kwargs)
        layout = QGridLayout()
        self.setLayout(layout)

        font_layout = QHBoxLayout(self)
        self.font_size = QSpinBox(self)
        self.font_size.setMinimum(5)
        self.font_size.setMaximum(100)
        self.font_size.setValue(Defaults.FONT_SIZE)

        self.font = QComboBox(self)
        for font in sorted(font_manager.ttflist, key=lambda x: x.face.name):
            self.font.addItem(
                QIcon(appctxt.get_resource("files/font.png")),
                font.face.name.decode("ascii"),
                font,
            )

        font_layout.addWidget(self.font, 3)
        font_layout.addWidget(self.font_size, 1)
        font_layout.setContentsMargins(0, 0, 0, 0)

        font_widget = QWidget(self)
        font_widget.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Minimum)
        font_widget.setMaximumHeight(self.font.height())
        font_widget.setContentsMargins(0, 0, 0, 0)
        font_widget.setLayout(font_layout)
        layout.addWidget(QLabel("Schrift", self), 0, 0)
        layout.addWidget(font_widget, 0, 1, 1, 2)

        layout.addWidget(QLabel("Marker", self), 4, 0)
        self.marker_type_x = QComboBox(self)
        self.marker_type_y = QComboBox(self)

        for name, marker in MARKERS.items():
            marker_icon = QIcon(appctxt.get_resource(f"markers/{name}.png"))
            self.marker_type_x.addItem(marker_icon, name, marker)
            self.marker_type_y.addItem(marker_icon, name, marker)

        layout.addWidget(self.marker_type_x, 4, 1)
        layout.addWidget(self.marker_type_y, 4, 2)

        layout.addWidget(QLabel("Beschriftungen", self), 5, 0)
        self.marker_labels_x = QComboBox(self)
        self.marker_labels_y = QComboBox(self)

        for name, marker_set in MARKER_SETS.items():
            label_icon = QIcon(appctxt.get_resource(f"labels/{name}.png"))
            self.marker_labels_x.addItem(label_icon, name, marker_set)
            self.marker_labels_y.addItem(label_icon, name, marker_set)

        layout.addWidget(self.marker_labels_x, 5, 1)
        layout.addWidget(self.marker_labels_y, 5, 2)

        layout.addWidget(QLabel("Größe innen", self), 6, 0)
        self.marker_inner_size = QSlider(Qt.Horizontal, self)
        self.marker_inner_size.setMinimum(10)
        self.marker_inner_size.setMaximum(240)
        self.marker_inner_size.valueChanged.connect(self.validate_outer_size)
        marker_inner_size_label = QLabel(self)
        self.marker_inner_size.valueChanged.connect(
            lambda x: marker_inner_size_label.setText(f"{x} pt"))
        layout.addWidget(self.marker_inner_size, 6, 1)
        layout.addWidget(marker_inner_size_label, 6, 2)

        layout.addWidget(QLabel("Größe außen", self), 7, 0)
        self.marker_outer_size = QSlider(Qt.Horizontal, self)
        self.marker_outer_size.setMinimum(15)
        self.marker_outer_size.setMaximum(250)
        self.marker_outer_size.valueChanged.connect(self.validate_inner_size)
        marker_outer_size_label = QLabel(self)
        self.marker_outer_size.valueChanged.connect(
            lambda x: marker_outer_size_label.setText(f"{x} pt"))
        layout.addWidget(self.marker_outer_size, 7, 1)
        layout.addWidget(marker_outer_size_label, 7, 2)

        self.marker_inner_size.setValue(35)
        self.marker_outer_size.setValue(45)
Example #28
0
    def __init__(self, tipo):
        super(VistaDisdettaPrenotazione, self).__init__()
        self.controller = ControllerListaClienti()
        self.tipo = tipo

        self.stylesheet_frame = """
                    QFrame{
                        background-color: white;
                        border: 1px solid grey;
                    }
                """

        self.stylesheet_window = """
                    QWidget{
                        background-color: #dfdfdf;
                    }
                """

        self.stylesheet_label = """
                    QLabel{
                        background-color: white
                    }

                    QComboBox{
                        background-color: white;
                        border: 1px solid grey;
                        color: black;
                    }

                """

        self.stylesheet_button_back = """
                    QPushButton{
                        border-radius: 15px;
                        background-color: transparent;
                    }

                    QPushButton::Pressed{
                        background-color: transparent;
                    }
                """

        self.stylesheet_button = """
                    QPushButton{
                        background-color: #cc3234;
                        color: white;
                        border-radius: 15px;
                    }

                    QPushButton::Pressed{
                        background-color: grey
                    }      
                """

        # Inserimento e impostazioni grafiche dell'immagine dello sfondo della finestra.
        self.imagePath = "Image/foto.png"
        self.image = QImage(self.imagePath)
        self.label = QLabel(self)
        self.label.setPixmap(QPixmap.fromImage(self.image))
        self.label.setScaledContents(True)
        self.label.setGeometry(0, 0, 700, 500)

        # Inserimento e impostazioni grafiche dell'etichetta 'Disdetta Prenotazione'.
        self.label_titolo = QLabel(self)
        self.font_titolo = QFont("Times", 18, QFont.Bold)
        self.label_titolo.setText("Disdetta Prenotazione")
        self.label_titolo.setFont(self.font_titolo)
        self.label_titolo.setGeometry(50, 55, 350, 40)

        # Inserimento e impostazioni grafiche del frame nella finestra.
        self.frame = QFrame(self)
        self.frame.setStyleSheet(self.stylesheet_frame)
        self.frame.setGeometry(50, 100, 600, 250)

        # Inserimento e impostazioni grafiche dell'etichetta 'Selezionare il cliente'.
        self.label_id = QLabel(self)
        self.font_id = QFont("Times", 9)
        self.label_id.setFont(self.font_id)
        self.label_id.setText("Selezionare il cliente")
        self.label_id.setGeometry(60, 190, 160, 30)
        self.label_id.setStyleSheet(self.stylesheet_label)

        # Inserimento e impostazioni grafiche del menù a tendina contenente le prenotazioni effettuate
        # dai rispettivi cliente.
        self.selezione_cliente = QComboBox(self)
        for cliente in self.controller.get_lista_clienti():
            self.controller_cliente = ControllerCliente(cliente)
            if self.controller_cliente.get_prenotazione() != "None":
                self.selezione_cliente.addItem(
                    self.controller_cliente.get_nome() + " " +
                    self.controller_cliente.get_cognome())
        self.selezione_cliente.setGeometry(250, 190, 300, 30)
        self.selezione_cliente.setStyleSheet(self.stylesheet_label)

        # Inserimento e impostazioni grafiche del bottone per confermare la disdetta del servizio selezionato.
        self.button_disdici = QPushButton(self)
        self.button_disdici.setText("Disdici")
        self.font_button = QFont("Times", 11)
        self.button_disdici.setFont(self.font_button)
        self.button_disdici.setGeometry(525, 410, 120, 50)
        self.button_disdici.setStyleSheet(self.stylesheet_button)
        self.button_disdici.clicked.connect(self.disdici_prenotazione)

        # Inserimento e impostazioni grafiche del bottone per tornare alla vista precedente.
        self.button_back = QPushButton(self)
        self.button_back.setIcon(QIcon('Image/back.png'))
        self.button_back.setIconSize(QSize(60, 60))
        self.button_back.setGeometry(50, 390, 90, 90)
        self.button_back.setStyleSheet(self.stylesheet_button_back)
        self.button_back.clicked.connect(self.go_back)

        # Impostazioni grafiche generali della finestra del programma.
        self.setWindowTitle("Disdici prenotazione")
        self.setStyleSheet(self.stylesheet_window)
        self.resize(700, 500)
        self.setFixedSize(self.size())
Example #29
0
    def __init__(self, parent):
        super(GeneralConfiguration, self).__init__()
        self._preferences = parent
        vbox = QVBoxLayout(self)

        groupBoxStart = QGroupBox(translations.TR_PREFERENCES_GENERAL_START)
        groupBoxClose = QGroupBox(translations.TR_PREFERENCES_GENERAL_CLOSE)
        groupBoxWorkspace = QGroupBox(
            translations.TR_PREFERENCES_GENERAL_WORKSPACE)
        groupBoxNoti = QGroupBox(translations.TR_NOTIFICATION)
        groupBoxReset = QGroupBox(translations.TR_PREFERENCES_GENERAL_RESET)

        #Start
        vboxStart = QVBoxLayout(groupBoxStart)
        self._checkLastSession = QCheckBox(
            translations.TR_PREFERENCES_GENERAL_LOAD_LAST_SESSION)
        self._checkActivatePlugins = QCheckBox(
            translations.TR_PREFERENCES_GENERAL_ACTIVATE_PLUGINS)
        self._checkNotifyUpdates = QCheckBox(
            translations.TR_PREFERENCES_GENERAL_NOTIFY_UPDATES)
        self._checkShowStartPage = QCheckBox(
            translations.TR_PREFERENCES_GENERAL_SHOW_START_PAGE)
        vboxStart.addWidget(self._checkLastSession)
        vboxStart.addWidget(self._checkActivatePlugins)
        vboxStart.addWidget(self._checkNotifyUpdates)
        vboxStart.addWidget(self._checkShowStartPage)
        #Close
        vboxClose = QVBoxLayout(groupBoxClose)
        self._checkConfirmExit = QCheckBox(
            translations.TR_PREFERENCES_GENERAL_CONFIRM_EXIT)
        vboxClose.addWidget(self._checkConfirmExit)
        #Workspace and Project
        gridWorkspace = QGridLayout(groupBoxWorkspace)
        self._txtWorkspace = QLineEdit()
        ui_tools.LineEditButton(
            self._txtWorkspace,
            self._txtWorkspace.clear,
            self.style().standardPixmap(self.style().SP_TrashIcon))
        self._txtWorkspace.setReadOnly(True)
        self._btnWorkspace = QPushButton(QIcon(':img/openFolder'), '')
        gridWorkspace.addWidget(
            QLabel(translations.TR_PREFERENCES_GENERAL_WORKSPACE), 0, 0,
            Qt.AlignRight)
        gridWorkspace.addWidget(self._txtWorkspace, 0, 1)
        gridWorkspace.addWidget(self._btnWorkspace, 0, 2)
        self._txtExtensions = QLineEdit()
        self._txtExtensions.setToolTip(
            translations.TR_PROJECT_EXTENSIONS_TOOLTIP)
        gridWorkspace.addWidget(QLabel(
            translations.TR_PREFERENCES_GENERAL_SUPPORTED_EXT), 1, 0,
            Qt.AlignRight)
        gridWorkspace.addWidget(self._txtExtensions, 1, 1)
        labelTooltip = QLabel(translations.TR_PROJECT_EXTENSIONS_INSTRUCTIONS)
        gridWorkspace.addWidget(labelTooltip, 2, 1)

        # Notification
        hboxNoti, self._notify_position = QHBoxLayout(groupBoxNoti), QComboBox()
        self._notify_position.addItems(
            [translations.TR_BOTTOM + "-" + translations.TR_LEFT,
             translations.TR_BOTTOM + "-" + translations.TR_RIGHT,
             translations.TR_TOP + "-" + translations.TR_LEFT,
             translations.TR_TOP + "-" + translations.TR_RIGHT])
        self._notify_color = QPushButton(
            translations.TR_EDITOR_SCHEME_PICK_COLOR)
        self._notification_choosed_color = settings.NOTIFICATION_COLOR
        hboxNoti.addWidget(QLabel(translations.TR_POSITION_ON_SCREEN))
        hboxNoti.addWidget(self._notify_position)
        hboxNoti.addWidget(self._notify_color, 0, Qt.AlignRight)

        # Resetting preferences
        vboxReset = QVBoxLayout(groupBoxReset)
        self._btnReset = QPushButton(
            translations.TR_PREFERENCES_GENERAL_RESET_PREFERENCES)
        vboxReset.addWidget(self._btnReset, alignment=Qt.AlignLeft)

        #Settings
        qsettings = IDE.ninja_settings()
        qsettings.beginGroup('preferences')
        qsettings.beginGroup('general')
        self._checkLastSession.setChecked(
            qsettings.value('loadFiles', True, type=bool))
        self._checkActivatePlugins.setChecked(
            qsettings.value('activatePlugins', defaultValue=True, type=bool))
        self._checkNotifyUpdates.setChecked(
            qsettings.value('preferences/general/notifyUpdates',
                            defaultValue=True, type=bool))
        self._checkShowStartPage.setChecked(settings.SHOW_START_PAGE)
        self._checkConfirmExit.setChecked(settings.CONFIRM_EXIT)
        self._txtWorkspace.setText(settings.WORKSPACE)
        extensions = ', '.join(settings.SUPPORTED_EXTENSIONS)
        self._txtExtensions.setText(extensions)
        self._notify_position.setCurrentIndex(settings.NOTIFICATION_POSITION)
        qsettings.endGroup()
        qsettings.endGroup()

        vbox.addWidget(groupBoxStart)
        vbox.addWidget(groupBoxClose)
        vbox.addWidget(groupBoxWorkspace)
        vbox.addWidget(groupBoxNoti)
        vbox.addWidget(groupBoxReset)

        #Signals
        self._btnWorkspace.clicked['bool'].connect(self._load_workspace)
        self._notify_color.clicked['bool'].connect(self._pick_color)
        self._btnReset.clicked['bool'].connect(self._reset_preferences)
        self._preferences.savePreferences.connect(self.save)
Example #30
0
    def setupUi(self):

        ipport = QLabel("TCP/IP port", self)
        self.ipportEdit = QLineEdit(self.guvip, self)

        tcpport = QLabel("TCP port", self)
        self.tcpportEdit = QLineEdit(self.guvport, self)

        guvtype_lbl = QLabel("GUV type", self)
        self.guvtype_cb = QComboBox(self)
        mylist = ["GUV-541", "GUV-2511", "GUV-3511"]
        self.guvtype_cb.addItems(mylist)
        self.guvtype_cb.setCurrentIndex(mylist.index(self.guvtype_str))

        ##############################################

        self.runstopButton = QPushButton("START", self)
        self.clearButton = QPushButton("Clear", self)

        ##############################################

        schroll_lbl = QLabel("Schroll elapsed time ", self)
        self.combo0 = QComboBox(self)
        mylist0 = ["100", "200", "400", "600", "800", "1000", "1500", "2000"]
        self.combo0.addItems(mylist0)
        self.combo0.setCurrentIndex(mylist0.index(str(self.schroll_pts)))

        ##############################################

        self.cb_logdata = QCheckBox('Log data to file', self)
        self.cb_logdata.toggle()
        self.cb_logdata.setChecked(self.log_guv_check)
        #self.cb_logdata.setLayoutDirection(Qt.RightToLeft)
        self.file_edit = QLineEdit(self.log_guv_str, self)
        self.file_edit.setStyleSheet("color: blue")
        if self.cb_logdata.isChecked():
            self.file_edit.setEnabled(True)
        else:
            self.file_edit.setEnabled(False)

        self.lcd = QLCDNumber(self)
        self.lcd.setStyleSheet("color: red")
        self.lcd.setFixedWidth(170)
        self.lcd.setFixedHeight(35)
        self.lcd.setSegmentStyle(QLCDNumber.Flat)
        self.lcd.setNumDigits(11)
        self.time_str = time.strftime("%y%m%d-%H%M")
        self.lcd.display(self.time_str)

        ##############################################

        g0_1 = QGridLayout()
        g0_1.addWidget(ipport, 0, 0)
        g0_1.addWidget(self.ipportEdit, 0, 1)
        g0_1.addWidget(tcpport, 0, 2)
        g0_1.addWidget(self.tcpportEdit, 0, 3)
        g0_1.addWidget(guvtype_lbl, 0, 4)
        g0_1.addWidget(self.guvtype_cb, 0, 5)

        g0_2 = QGridLayout()
        g0_2.addWidget(schroll_lbl, 0, 0)
        g0_2.addWidget(self.combo0, 0, 1)
        g0_2.addWidget(self.runstopButton, 0, 2)
        g0_2.addWidget(self.clearButton, 0, 3)
        g0_2.addWidget(self.cb_logdata, 1, 0)
        g0_2.addWidget(self.lcd, 1, 1)

        g0_4 = QVBoxLayout()
        g0_4.addLayout(g0_1)
        g0_4.addLayout(g0_2)
        g0_4.addWidget(self.file_edit)

        ##############################################

        # set graph  and toolbar to a new vertical group vcan
        self.pw1 = pg.PlotWidget()
        self.pw1.setFixedWidth(600)

        ##############################################

        # create table
        self.tableWidget = self.createTable()

        ##############################################

        # SET ALL VERTICAL COLUMNS TOGETHER
        vbox = QVBoxLayout()
        vbox.addLayout(g0_4)
        vbox.addWidget(self.pw1)

        hbox = QVBoxLayout()
        hbox.addLayout(vbox)
        hbox.addWidget(self.tableWidget)

        self.threadpool = QThreadPool()
        print("Multithreading in the GUV dialog with maximum %d threads" %
              self.threadpool.maxThreadCount())
        self.isRunning = False

        self.setLayout(hbox)
        self.setWindowTitle("Test GUV")

        # PLOT 2 settings
        # create plot and add it to the figure canvas
        self.p1 = self.pw1.plotItem
        self.curves = []
        colors = itertools.cycle(["r", "b", "g", "y", "m", "c", "w"])
        for i in range(20):
            mycol = next(colors)
            self.curves.append(
                self.p1.plot(pen=pg.mkPen(color=mycol),
                             symbol='s',
                             symbolPen=mycol,
                             symbolBrush=mycol,
                             symbolSize=4))
        # create plot and add it to the figure
        self.p0_1 = pg.ViewBox()
        self.curve2 = pg.PlotCurveItem(pen='r')
        self.p0_1.addItem(self.curve2)
        # connect respective axes to the plot
        #self.p1.showAxis('left')
        self.p1.getAxis('left').setLabel("Power density",
                                         units="",
                                         color='yellow')
        self.p1.showAxis('right')
        self.p1.getAxis('right').setLabel("Arb unit", units="", color='red')
        self.p1.scene().addItem(self.p0_1)
        self.p1.getAxis('right').linkToView(self.p0_1)
        self.p0_1.setXLink(self.p1)

        self.p1.getAxis('bottom').setLabel("Time passed",
                                           units="s",
                                           color='yellow')
        # Use automatic downsampling and clipping to reduce the drawing load
        self.pw1.setDownsampling(mode='peak')
        self.pw1.setClipToView(True)

        # Initialize and set titles and axis names for both plots
        self.clear_vars_graphs()
        self.combo0.activated[str].connect(self.onActivated0)
        self.guvtype_cb.activated[str].connect(self.onActivated1)
        self.cb_logdata.toggled.connect(self.logdata)

        # run or cancel the main script
        self.runstopButton.clicked.connect(self.runstop)
        self.clearButton.clicked.connect(self.set_clear)
        self.clearButton.setEnabled(False)