Пример #1
0
    def init_ui(self):
        # ================变量================
        # self.export_type = 'Hexo'
        # self.display_comments = True  # 是否在博文中显示历史评论

        # self.GitHubPathStr = '你的GitHub主文件夹路径'
        # self.owner = '你的GitHub账号名'
        # self.repo_name = '你存放图片的GitHub库名称'

        # ================组件================
        self.button = QPushButton('执行任务')
        self.button.setToolTip('点击此按钮')
        self.button.clicked.connect(self.onStartButton)

        self.label = QLabel('迁移到')
        self.rbtn1 = QRadioButton('Hexo')
        self.rbtn2 = QRadioButton('Hugo')
        self.rbtn3 = QRadioButton('Jekyll')
        self.rbtn4 = QRadioButton('Gridea')
        self.rbtn5 = QRadioButton('Wordpress')
        self.rbtn5.setChecked(True)

        self.cb1 = QCheckBox('在输出文件中包含评论', self)
        self.cb1.setChecked(True)
        # self.cb.stateChanged.connect(self.show_comments)
        self.cb2 = QCheckBox('强制转换图片网址到GitHub图床', self)

        self.label1 = QLabel('GitHub主文件夹')
        self.label2 = QLabel('GitHub账号名')
        self.label3 = QLabel('GitHub库名称')
        self.label4 = QLabel('当前文件夹')
        self.label5 = QLabel('读取自')
        self.label6 = QLabel('保存到文件夹')
        self.label7 = QLabel('调试信息')
        self.label8 = QLabel('调试日志')
        self.label9 = QLabel('进度')

        self.qle1 = QLineEdit(self)
        self.qle2 = QLineEdit(self)
        self.qle3 = QLineEdit(self)
        self.qle4 = QLineEdit(self)
        self.qle5 = QLineEdit(self)
        self.qle6 = QLineEdit(self)
        self.qle7 = QLineEdit(self)
        self.textEdit = QTextEdit()

        # self.qle7.setStyleSheet("QCustomLineEdit{color: gray;}")

        # self.qle4.setEnabled(False)
        # self.qle5.setEnabled(False)
        # self.qle6.setEnabled(False)
        # self.qle7.setEnabled(False)
        # self.textEdit.setEnabled(False)

        self.qle4.setReadOnly(True)
        self.qle5.setReadOnly(True)
        self.qle6.setReadOnly(True)
        self.qle7.setReadOnly(True)
        self.textEdit.setReadOnly(True)

        self.qle1.setPlaceholderText("你的GitHub主文件夹路径")
        self.qle2.setPlaceholderText("你的GitHub账号名")
        self.qle3.setPlaceholderText("你存放图片的GitHub库名称")
        self.qle4.setText(dirpath)

        self.pbar = QProgressBar(self)

        # ================状态栏================
        self.statusBar().showMessage('准备就绪')

        # ================菜单栏================
        helloAction = QAction('你好', self)
        helloAction.setShortcut('Ctrl+H')
        helloAction.setStatusTip('程序问候')
        helloAction.triggered.connect(self.onHello)

        # exitAction = QAction(QIcon('exit.png'), '&Exit', self)
        exitAction = QAction('退出', self)
        exitAction.setShortcut('Ctrl+Q')
        exitAction.setStatusTip('退出程序')
        exitAction.triggered.connect(qApp.quit)

        aboutAction = QAction('关于', self)
        aboutAction.setShortcut('Ctrl+A')
        aboutAction.setStatusTip('关于程序')
        aboutAction.triggered.connect(self.onAbout)

        # 创建一个菜单栏
        menubar = self.menuBar()
        # 添加菜单
        fileMenu = menubar.addMenu('文件')
        otherMenu = menubar.addMenu('其他')

        # 添加事件
        fileMenu.addAction(helloAction)
        fileMenu.addAction(exitAction)
        otherMenu.addAction(aboutAction)

        # ================工具栏================
        self.toolbar = self.addToolBar('工具')
        self.toolbar.addAction(exitAction)
        self.toolbar.addAction(helloAction)
        self.toolbar.addAction(aboutAction)

        # ================多选框组================
        self.btngroup = QButtonGroup()
        self.btngroup.setExclusive(True)
        self.btngroup.addButton(self.rbtn1)
        self.btngroup.addButton(self.rbtn2)
        self.btngroup.addButton(self.rbtn3)
        self.btngroup.addButton(self.rbtn4)
        self.btngroup.addButton(self.rbtn5)
        self.btngroup.buttonClicked.connect(self.on_click)

        # ================绑定================

        # ================布局================
        rbtnlayout = QHBoxLayout()
        rbtnlayout.addWidget(self.label)

        rbtnlayout.addWidget(self.rbtn1)
        rbtnlayout.addWidget(self.rbtn2)
        rbtnlayout.addWidget(self.rbtn3)
        rbtnlayout.addWidget(self.rbtn4)
        rbtnlayout.addWidget(self.rbtn5)
        rbtnlayout.addStretch(1)

        buttonlayout = QHBoxLayout()
        # buttonlayout.addStretch(1)
        buttonlayout.addWidget(self.button)
        buttonlayout.addStretch(1)

        grid = QGridLayout()
        grid.setSpacing(10)

        grid.addWidget(self.label1, 1, 0)
        grid.addWidget(self.qle1, 1, 1)
        grid.addWidget(self.label2, 2, 0)
        grid.addWidget(self.qle2, 2, 1)
        grid.addWidget(self.label3, 3, 0)
        grid.addWidget(self.qle3, 3, 1)
        grid.addWidget(self.label4, 4, 0)
        grid.addWidget(self.qle4, 4, 1)
        grid.addWidget(self.label5, 5, 0)
        grid.addWidget(self.qle5, 5, 1)
        grid.addWidget(self.label6, 6, 0)
        grid.addWidget(self.qle6, 6, 1)
        grid.addWidget(self.label7, 7, 0)
        grid.addWidget(self.qle7, 7, 1)
        grid.addWidget(self.label8, 8, 0)
        # grid.addWidget(self.textEdit, 8, 1, 2, 1)
        grid.addWidget(self.textEdit, 8, 1)
        grid.addWidget(self.label9, 9, 0)
        grid.addWidget(self.pbar, 9, 1)

        # ================主布局================
        vbox = QVBoxLayout()

        vbox.addLayout(buttonlayout)

        vbox.addWidget(self.cb1)
        vbox.addWidget(self.cb2)

        vbox.addLayout(rbtnlayout)

        # vbox.addWidget(self.label2)

        vbox.addLayout(grid)

        # vbox.addStretch(1)

        # ================窗口设置================
        # self.setGeometry(200, 200, 300, 300)
        layout_widget = QWidget()  # create QWidget object
        layout_widget.setLayout(vbox)  # set layout
        self.setCentralWidget(layout_widget)  # make QWidget the central widget
        self.setWindowTitle(app_name)

        # self.resize(250, 150)
        self.center()
        self.show()
Пример #2
0
def RadioButton(text: str,
                owner: QWidget = None,
                name: str = None) -> QRadioButton:
    return QRadioButton(text)
Пример #3
0
    def initUI(self, file_size: int):
        bayerGroup = QGroupBox('bayer')
        bayerLayout = QGridLayout()
        self.rg = QRadioButton('RG', bayerGroup)
        self.gr = QRadioButton('GR', bayerGroup)
        self.gb = QRadioButton('GB', bayerGroup)
        self.bg = QRadioButton('BG', bayerGroup)
        bayerLayout.addWidget(self.rg, 0, 0, 1, 1)
        bayerLayout.addWidget(self.gr, 0, 1, 1, 1)
        bayerLayout.addWidget(self.gb, 1, 0, 1, 1)
        bayerLayout.addWidget(self.bg, 1, 1, 1, 1)
        bayerGroup.setLayout(bayerLayout)

        width_validator = QIntValidator(0, 10000)
        hlayout_1 = QHBoxLayout()
        width_label = QLabel('width:')
        width_label.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.width_textEdit = QLineEdit()
        self.width_textEdit.setValidator(width_validator)
        hlayout_1.addWidget(width_label, 1)
        hlayout_1.addWidget(self.width_textEdit, 1)

        height_validator = QIntValidator(0, 7500)
        hlayout_2 = QHBoxLayout()
        height_label = QLabel('height:')
        height_label.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.height_textEdit = QLineEdit()
        self.height_textEdit.setValidator(height_validator)
        hlayout_2.addWidget(height_label, 1)
        hlayout_2.addWidget(self.height_textEdit, 1)

        unit_len = sqrt(file_size / 24)
        if unit_len - int(unit_len) == 0.0:
            self.width_textEdit.setText(str(4 * int(unit_len)))
            self.height_textEdit.setText(str(3 * int(unit_len)))

        bit_validator = QIntValidator(0, 16)
        hlayout_3 = QHBoxLayout()
        bitDepth_label = QLabel('bit depth:')
        bitDepth_label.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.bitDepth_textEdit = QLineEdit()
        self.bitDepth_textEdit.setValidator(bit_validator)
        hlayout_3.addWidget(bitDepth_label, 1)
        hlayout_3.addWidget(self.bitDepth_textEdit, 1)

        hline = QFrame(self)
        hline.setFrameShape(QFrame.HLine)

        ok_btn = QPushButton('OK')
        cancel_btn = QPushButton('Cancel')
        hlayout_4 = QHBoxLayout()
        hlayout_4.addStretch(2)
        hlayout_4.addWidget(ok_btn, 1)
        hlayout_4.addWidget(cancel_btn, 1)

        verticalLayout = QVBoxLayout()
        verticalLayout.addWidget(bayerGroup)
        verticalLayout.addLayout(hlayout_1)
        verticalLayout.addLayout(hlayout_2)
        verticalLayout.addLayout(hlayout_3)
        verticalLayout.addWidget(hline)
        verticalLayout.addLayout(hlayout_4)
        verticalLayout.setContentsMargins(50, 20, 50, 20)
        self.setLayout(verticalLayout)
        self.resize(400, 300)
        self.setWindowTitle('raw info')
        ok_btn.clicked.connect(self.on_OK_btn)
        cancel_btn.clicked.connect(self.on_Cancel_btn)
Пример #4
0
    def __init__(self,
                 parent=None,
                 imgPaths=None,
                 fov_id_list=None,
                 training_dir=None):
        super(Window, self).__init__(parent)

        top = 400
        left = 400
        width = 400
        height = 1200

        self.setWindowTitle("You got this!")
        self.setGeometry(top, left, width, height)

        self.ImgsWidget = OverlayImgsWidget(self,
                                            imgPaths=imgPaths,
                                            fov_id_list=fov_id_list,
                                            training_dir=training_dir)
        self.setCentralWidget(self.ImgsWidget)

        brushSizeGroup = QButtonGroup()
        onePxButton = QRadioButton("1px")
        onePxButton.setShortcut("Ctrl+1")
        onePxButton.clicked.connect(self.ImgsWidget.mask_widget.onePx)
        brushSizeGroup.addButton(onePxButton)

        threePxButton = QRadioButton("3px")
        threePxButton.setShortcut("Ctrl+3")
        threePxButton.clicked.connect(self.ImgsWidget.mask_widget.threePx)
        brushSizeGroup.addButton(threePxButton)

        fivePxButton = QRadioButton("5px")
        fivePxButton.setShortcut("Ctrl+5")
        fivePxButton.clicked.connect(self.ImgsWidget.mask_widget.fivePx)
        brushSizeGroup.addButton(fivePxButton)

        sevenPxButton = QRadioButton("7px")
        sevenPxButton.setShortcut("Ctrl+7")
        sevenPxButton.clicked.connect(self.ImgsWidget.mask_widget.sevenPx)
        brushSizeGroup.addButton(sevenPxButton)

        ninePxButton = QRadioButton("9px")
        ninePxButton.setShortcut("Ctrl+9")
        ninePxButton.clicked.connect(self.ImgsWidget.mask_widget.ninePx)
        brushSizeGroup.addButton(ninePxButton)

        brushSizeLayout = QVBoxLayout()
        brushSizeLayout.addWidget(onePxButton)
        brushSizeLayout.addWidget(threePxButton)
        brushSizeLayout.addWidget(fivePxButton)
        brushSizeLayout.addWidget(sevenPxButton)
        brushSizeLayout.addWidget(ninePxButton)

        brushSizeGroupWidget = QWidget()
        brushSizeGroupWidget.setLayout(brushSizeLayout)

        brushSizeDockWidget = QDockWidget()
        brushSizeDockWidget.setWidget(brushSizeGroupWidget)
        self.addDockWidget(Qt.LeftDockWidgetArea, brushSizeDockWidget)

        brushColorGroup = QButtonGroup()
        # whiteButton = QRadioButton("White")
        # whiteButton.setShortcut("Ctrl+W")
        # whiteButton.clicked.connect(self.ImgsWidget.mask_widget.whiteColor)
        # brushColorGroup.addButton(whiteButton)

        cellButton = QRadioButton("Cell")
        cellButton.setShortcut("Ctrl+C")
        cellButton.clicked.connect(self.ImgsWidget.mask_widget.redColor)
        brushColorGroup.addButton(cellButton)

        notCellButton = QRadioButton("Not cell")
        notCellButton.setShortcut("Ctrl+N")
        notCellButton.clicked.connect(self.ImgsWidget.mask_widget.blackColor)
        brushColorGroup.addButton(notCellButton)

        resetButton = QPushButton("Reset mask")
        resetButton.setShortcut("Ctrl+R")
        resetButton.clicked.connect(self.ImgsWidget.mask_widget.reset)

        clearButton = QPushButton("Clear mask")
        clearButton.clicked.connect(self.ImgsWidget.mask_widget.clear)

        brushColorLayout = QVBoxLayout()
        # brushColorLayout.addWidget(whiteButton)
        brushColorLayout.addWidget(cellButton)
        brushColorLayout.addWidget(notCellButton)
        brushColorLayout.addWidget(resetButton)
        brushColorLayout.addWidget(clearButton)

        brushColorGroupWidget = QWidget()
        brushColorGroupWidget.setLayout(brushColorLayout)

        brushColorDockWidget = QDockWidget()
        brushColorDockWidget.setWidget(brushColorGroupWidget)
        self.addDockWidget(Qt.LeftDockWidgetArea, brushColorDockWidget)

        advanceFrameButton = QPushButton("Next frame")
        advanceFrameButton.setShortcut("Ctrl+F")
        advanceFrameButton.clicked.connect(
            self.ImgsWidget.mask_widget.next_frame)
        advanceFrameButton.clicked.connect(
            self.ImgsWidget.img_widget.next_frame)

        priorFrameButton = QPushButton("Prior frame")
        priorFrameButton.clicked.connect(
            self.ImgsWidget.mask_widget.prior_frame)
        priorFrameButton.clicked.connect(
            self.ImgsWidget.img_widget.prior_frame)

        advancePeakButton = QPushButton("Next peak")
        advancePeakButton.setShortcut("Ctrl+P")
        advancePeakButton.clicked.connect(
            self.ImgsWidget.mask_widget.next_peak)
        advancePeakButton.clicked.connect(self.ImgsWidget.img_widget.next_peak)

        priorPeakButton = QPushButton("Prior peak")
        priorPeakButton.clicked.connect(self.ImgsWidget.mask_widget.prior_peak)
        priorPeakButton.clicked.connect(self.ImgsWidget.img_widget.prior_peak)

        advanceFOVButton = QPushButton("Next FOV")
        advanceFOVButton.clicked.connect(self.ImgsWidget.mask_widget.next_fov)
        advanceFOVButton.clicked.connect(self.ImgsWidget.img_widget.next_fov)

        priorFOVButton = QPushButton("Prior FOV")
        priorFOVButton.clicked.connect(self.ImgsWidget.mask_widget.prior_fov)
        priorFOVButton.clicked.connect(self.ImgsWidget.img_widget.prior_fov)

        saveAndNextButton = QPushButton("Save and next frame")
        saveAndNextButton.setShortcut("Ctrl+S")
        saveAndNextButton.clicked.connect(
            self.ImgsWidget.mask_widget.buttonSave)
        saveAndNextButton.clicked.connect(
            self.ImgsWidget.img_widget.buttonSave)
        saveAndNextButton.clicked.connect(
            self.ImgsWidget.mask_widget.next_frame)
        saveAndNextButton.clicked.connect(
            self.ImgsWidget.img_widget.next_frame)

        fileAdvanceLayout = QVBoxLayout()
        fileAdvanceLayout.addWidget(advanceFrameButton)
        fileAdvanceLayout.addWidget(priorFrameButton)
        fileAdvanceLayout.addWidget(advancePeakButton)
        fileAdvanceLayout.addWidget(priorPeakButton)
        fileAdvanceLayout.addWidget(advanceFOVButton)
        fileAdvanceLayout.addWidget(priorFOVButton)
        fileAdvanceLayout.addWidget(saveAndNextButton)

        fileAdvanceGroupWidget = QWidget()
        fileAdvanceGroupWidget.setLayout(fileAdvanceLayout)

        fileAdvanceDockWidget = QDockWidget()
        fileAdvanceDockWidget.setWidget(fileAdvanceGroupWidget)
        self.addDockWidget(Qt.RightDockWidgetArea, fileAdvanceDockWidget)
    def show_settings_dialog(self, window, success):
        if not success:
            window.show_message(_('Server not reachable.'))
            return

        wallet = window.wallet
        d = WindowModalDialog(window, _("TrustedCoin Information"))
        d.setMinimumSize(500, 200)
        vbox = QVBoxLayout(d)
        hbox = QHBoxLayout()

        logo = QLabel()
        logo.setPixmap(QPixmap(icon_path("trustedcoin-status.png")))
        msg = _('This wallet is protected by TrustedCoin\'s two-factor authentication.') + '<br/>'\
              + _("For more information, visit") + " <a href=\"https://api.trustedcoin.com/#/electrum-help\">https://api.trustedcoin.com/#/electrum-help</a>"
        label = QLabel(msg)
        label.setOpenExternalLinks(1)

        hbox.addStretch(10)
        hbox.addWidget(logo)
        hbox.addStretch(10)
        hbox.addWidget(label)
        hbox.addStretch(10)

        vbox.addLayout(hbox)
        vbox.addStretch(10)

        msg = _(
            'TrustedCoin charges a small fee to co-sign transactions. The fee depends on how many prepaid transactions you buy. An extra output is added to your transaction every time you run out of prepaid transactions.'
        ) + '<br/>'
        label = QLabel(msg)
        label.setWordWrap(1)
        vbox.addWidget(label)

        vbox.addStretch(10)
        grid = QGridLayout()
        vbox.addLayout(grid)

        price_per_tx = wallet.price_per_tx
        n_prepay = wallet.num_prepay(self.config)
        i = 0
        for k, v in sorted(price_per_tx.items()):
            if k == 1:
                continue
            grid.addWidget(QLabel("Pay every %d transactions:" % k), i, 0)
            grid.addWidget(
                QLabel(
                    window.format_amount(v / k) + ' ' + window.base_unit() +
                    "/tx"), i, 1)
            b = QRadioButton()
            b.setChecked(k == n_prepay)
            b.clicked.connect(lambda b, k=k: self.config.set_key(
                'trustedcoin_prepay', k, True))
            grid.addWidget(b, i, 2)
            i += 1

        n = wallet.billing_info.get('tx_remaining', 0)
        grid.addWidget(
            QLabel(_("Your wallet has {} prepaid transactions.").format(n)), i,
            0)
        vbox.addLayout(Buttons(CloseButton(d)))
        d.exec_()
Пример #6
0
    def request_trezor_init_settings(self, wizard, method, device_id):
        vbox = QVBoxLayout()
        next_enabled = True

        devmgr = self.device_manager()
        client = devmgr.client_by_id(device_id)
        if not client:
            raise Exception(_("The device was disconnected."))
        model = client.get_trezor_model()
        fw_version = client.client.version

        # label
        label = QLabel(_("Enter a label to name your device:"))
        name = QLineEdit()
        hl = QHBoxLayout()
        hl.addWidget(label)
        hl.addWidget(name)
        hl.addStretch(1)
        vbox.addLayout(hl)

        # word count
        gb = QGroupBox()
        hbox1 = QHBoxLayout()
        gb.setLayout(hbox1)
        vbox.addWidget(gb)
        gb.setTitle(_("Select your seed length:"))
        bg_numwords = QButtonGroup()
        word_counts = (12, 18, 24)
        for i, count in enumerate(word_counts):
            rb = QRadioButton(gb)
            rb.setText(_("{:d} words").format(count))
            bg_numwords.addButton(rb)
            bg_numwords.setId(rb, i)
            hbox1.addWidget(rb)
            rb.setChecked(True)

        # PIN
        cb_pin = QCheckBox(_('Enable PIN protection'))
        cb_pin.setChecked(True)
        vbox.addWidget(WWLabel(RECOMMEND_PIN))
        vbox.addWidget(cb_pin)

        # "expert settings" button
        expert_vbox = QVBoxLayout()
        expert_widget = QWidget()
        expert_widget.setLayout(expert_vbox)
        expert_widget.setVisible(False)
        expert_button = QPushButton(_("Show expert settings"))
        def show_expert_settings():
            expert_button.setVisible(False)
            expert_widget.setVisible(True)
        expert_button.clicked.connect(show_expert_settings)
        vbox.addWidget(expert_button)

        # passphrase
        passphrase_msg = WWLabel(PASSPHRASE_HELP_SHORT)
        passphrase_warning = WWLabel(PASSPHRASE_NOT_PIN)
        passphrase_warning.setStyleSheet("color: red")
        cb_phrase = QCheckBox(_('Enable passphrases'))
        cb_phrase.setChecked(False)
        expert_vbox.addWidget(passphrase_msg)
        expert_vbox.addWidget(passphrase_warning)
        expert_vbox.addWidget(cb_phrase)

        # ask for recovery type (random word order OR matrix)
        bg_rectype = None
        if method == TIM_RECOVER and not model == 'T':
            gb_rectype = QGroupBox()
            hbox_rectype = QHBoxLayout()
            gb_rectype.setLayout(hbox_rectype)
            expert_vbox.addWidget(gb_rectype)
            gb_rectype.setTitle(_("Select recovery type:"))
            bg_rectype = QButtonGroup()

            rb1 = QRadioButton(gb_rectype)
            rb1.setText(_('Scrambled words'))
            bg_rectype.addButton(rb1)
            bg_rectype.setId(rb1, RECOVERY_TYPE_SCRAMBLED_WORDS)
            hbox_rectype.addWidget(rb1)
            rb1.setChecked(True)

            rb2 = QRadioButton(gb_rectype)
            rb2.setText(_('Matrix'))
            bg_rectype.addButton(rb2)
            bg_rectype.setId(rb2, RECOVERY_TYPE_MATRIX)
            hbox_rectype.addWidget(rb2)

        # no backup
        cb_no_backup = None
        if method == TIM_NEW:
            cb_no_backup = QCheckBox(f'''{_('Enable seedless mode')}''')
            cb_no_backup.setChecked(False)
            if (model == '1' and fw_version >= (1, 7, 1)
                    or model == 'T' and fw_version >= (2, 0, 9)):
                cb_no_backup.setToolTip(SEEDLESS_MODE_WARNING)
            else:
                cb_no_backup.setEnabled(False)
                cb_no_backup.setToolTip(_('Firmware version too old.'))
            expert_vbox.addWidget(cb_no_backup)

        vbox.addWidget(expert_widget)
        wizard.exec_layout(vbox, next_enabled=next_enabled)

        return TrezorInitSettings(
            word_count=word_counts[bg_numwords.checkedId()],
            label=name.text(),
            pin_enabled=cb_pin.isChecked(),
            passphrase_enabled=cb_phrase.isChecked(),
            recovery_type=bg_rectype.checkedId() if bg_rectype else None,
            no_backup=cb_no_backup.isChecked() if cb_no_backup else False,
        )
Пример #7
0
    def createMidTopGroupBox(self):
        self.midTopGroupBox = QGroupBox('Auto White Balance Modes')

        self.autoAwb = QRadioButton()
        self.autoAwb.setText('auto')
        self.autoAwb.toggled.connect(lambda: self.abtnstate(self.autoAwb))

        self.fluorAwb = QRadioButton()
        self.fluorAwb.setText('fluorescent')
        self.fluorAwb.toggled.connect(lambda: self.abtnstate(self.fluorAwb))

        self.incanAwb = QRadioButton()
        self.incanAwb.setText('incandescent')
        self.incanAwb.toggled.connect(lambda: self.abtnstate(self.incanAwb))

        self.offAwb = QRadioButton()
        self.offAwb.setText('off')
        self.offAwb.toggled.connect(lambda: self.abtnstate(self.offAwb))

        self.defaultAwb = QRadioButton()
        self.defaultAwb.setText('default')
        self.defaultAwb.toggled.connect(
            lambda: self.abtnstate(self.defaultAwb))

        self.sunAwb = QRadioButton()
        self.sunAwb.setText('sun')
        self.sunAwb.toggled.connect(lambda: self.abtnstate(self.sunAwb))

        self.cloudAwb = QRadioButton()
        self.cloudAwb.setText('cloud')
        self.cloudAwb.toggled.connect(lambda: self.abtnstate(self.cloudAwb))

        self.shadeAwb = QRadioButton()
        self.shadeAwb.setText('shade')
        self.shadeAwb.toggled.connect(lambda: self.abtnstate(self.shadeAwb))

        self.tungsAwb = QRadioButton()
        self.tungsAwb.setText('tungsten')
        self.tungsAwb.toggled.connect(lambda: self.abtnstate(self.tungsAwb))

        self.flashAwb = QRadioButton()
        self.flashAwb.setText('flash')
        self.flashAwb.toggled.connect(lambda: self.abtnstate(self.flashAwb))

        self.horizonAwb = QRadioButton()
        self.horizonAwb.setText('horizon')
        self.horizonAwb.toggled.connect(
            lambda: self.abtnstate(self.horizonAwb))

        self.defaultAwb.setChecked(True)

        hbox1 = QHBoxLayout()
        hbox1.addWidget(self.autoAwb)
        hbox1.addWidget(self.fluorAwb)
        hbox1.addWidget(self.incanAwb)
        hbox1.addWidget(self.offAwb)
        hbox1.addWidget(self.defaultAwb)

        hbox2 = QHBoxLayout()
        hbox2.addWidget(self.sunAwb)
        hbox2.addWidget(self.cloudAwb)
        hbox2.addWidget(self.shadeAwb)
        hbox2.addWidget(self.tungsAwb)
        hbox2.addWidget(self.flashAwb)
        hbox2.addWidget(self.horizonAwb)

        layout = QVBoxLayout()
        layout.addLayout(hbox1)
        layout.addLayout(hbox2)
        layout.addStretch(1)
        self.midTopGroupBox.setLayout(layout)
Пример #8
0
    def __init__(self):
        Menu.__init__(self, "Chat")

        self.widget = QWidget()

        self.hosts = {}

        qtMainLayout = QGridLayout(self.widget)
        qtText = QTextBrowser()
        qtInput = QLineEdit()

        qtConfigLayout = QVBoxLayout()

        qtPeers = QGroupBox("Recipients")
        qtPeersLayout = QVBoxLayout(qtPeers)

        def onBroadcastChange(state):
            self.setBroadcast(state > 0)

        qtBroadcast = QCheckBox("Broadcast")
        qtBroadcast.stateChanged.connect(onBroadcastChange)

        qtNetworkBox = QGroupBox("Network")
        qtNetworkLayout = QVBoxLayout(qtNetworkBox)

        def onNetworkChange():
            if self.qtNetworkTcp.isChecked():
                self.qtPeers.setEnabled(True)

                self.qtBroadcast.setEnabled(False)
                self.qtBroadcast.setCheckState(0)
            elif self.qtNetworkUdp.isChecked():
                self.qtBroadcast.setEnabled(True)

        qtNetworkTcp = QRadioButton("TCP")
        qtNetworkUdp = QRadioButton("UDP")
        qtNetworkBox.setSizePolicy(
            QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Maximum))

        qtNetworkLayout.addWidget(qtNetworkTcp)
        qtNetworkLayout.addWidget(qtNetworkUdp)

        qtNetworkUdp.toggle()

        qtConfigLayout.addWidget(qtBroadcast)
        qtConfigLayout.addWidget(qtPeers)
        qtConfigLayout.addWidget(qtNetworkBox)

        qtMainLayout.addWidget(qtText, 0, 0, 1, 1)
        qtMainLayout.addWidget(qtInput, 1, 0, 1, 1)
        qtMainLayout.addLayout(qtConfigLayout, 0, 1, 2, 1)

        qtText.setText("")

        qtSettingsLayout = QGridLayout()

        qtNameLabel = QLabel("Name")
        qtName = QLineEdit()
        qtNameLabel.setMaximumWidth(40)
        qtName.setMaximumWidth(100)

        qtAesLabel = QLabel("AES")
        qtAes = QLineEdit()
        qtAesLabel.setMaximumWidth(40)
        qtAes.setMaximumWidth(100)

        qtSettingsLayout.addWidget(qtNameLabel, 0, 0, 1, 1)
        qtSettingsLayout.addWidget(qtName, 0, 1, 1, 1)
        #qtSettingsLayout.addWidget(qtAesLabel,1,0,1,1)
        #qtSettingsLayout.addWidget(qtAes,1,1,1,1)

        qtConfigLayout.addLayout(qtSettingsLayout)

        self.qtInput = qtInput
        self.qtText = qtText
        self.qtPeers = qtPeers
        self.qtNetworkBox = qtNetworkBox
        self.qtNetworkTcp = qtNetworkTcp
        self.qtNetworkUdp = qtNetworkUdp
        self.qtPeersLayout = qtPeersLayout
        self.qtBroadcast = qtBroadcast
        self.qtName = qtName

        def onReturn():
            msg = self.qtInput.text().strip()
            if (msg):
                self.onInput(msg)
            self.qtInput.setText("")

        qtInput.returnPressed.connect(onReturn)
        qtNetworkTcp.toggled.connect(onNetworkChange)
        qtNetworkUdp.toggled.connect(onNetworkChange)

        def aes_update():
            self.aes_key = self.qtAes.text()
            self.chatUdp.loop.call_soon_threadsafe(self.chatUdp.update_aes,
                                                   self.aes_key)

        qtName.editingFinished.connect(
            lambda: self.setName(self.qtName.text().strip()))
        qtAes.editingFinished.connect(aes_update)

        qtBroadcast.setCheckState(2)

        self.local_peer = ChatPeer(local=True)
        self.peers = {}
        self.peers_checkboxes = {}
        self.peers[self.local_peer.uuid] = self.local_peer
        self.aes_key = ""

        self.setupTcp()
        self.setupUdp()

        qtName.setText(socket.gethostname())
        self.local_peer.name = socket.gethostname()
Пример #9
0
def widgets(P, W):
    #widgets
    W.ctLabel = QLabel('Cut Type')
    W.ctGroup = QButtonGroup(W)
    W.cExt = QRadioButton('External')
    W.cExt.setChecked(True)
    W.ctGroup.addButton(W.cExt)
    W.cInt = QRadioButton('Internal')
    W.ctGroup.addButton(W.cInt)
    W.koLabel = QLabel('Offset')
    W.kOffset = QPushButton('Kerf Width')
    W.kOffset.setCheckable(True)
    W.xsLabel = QLabel('X origin')
    W.xsEntry = QLineEdit(objectName='xsEntry')
    W.ysLabel = QLabel('Y origin')
    W.ysEntry = QLineEdit(objectName='ysEntry')
    W.liLabel = QLabel('Lead In')
    W.liEntry = QLineEdit(objectName='liEntry')
    W.loLabel = QLabel('Lead Out')
    W.loEntry = QLineEdit(objectName='loEntry')
    W.ALabel = QLabel('A angle')
    W.AEntry = QLineEdit()
    W.BLabel = QLabel('B angle')
    W.BEntry = QLineEdit()
    W.CLabel = QLabel('C angle')
    W.CEntry = QLineEdit()
    W.aLabel = QLabel('a length')
    W.aEntry = QLineEdit()
    W.bLabel = QLabel('b length')
    W.bEntry = QLineEdit()
    W.cLabel = QLabel('c length')
    W.cEntry = QLineEdit()
    W.angLabel = QLabel('Angle')
    W.angEntry = QLineEdit()
    W.preview = QPushButton('Preview')
    W.add = QPushButton('Add')
    W.undo = QPushButton('Undo')
    W.lDesc = QLabel('Creating Triangle')
    W.iLabel = QLabel()
    pixmap = QPixmap('{}conv_triangle_l.png'.format(
        P.IMAGES)).scaledToWidth(240)
    W.iLabel.setPixmap(pixmap)
    #alignment and size
    rightAlign = ['ctLabel', 'koLabel', 'xsLabel', 'xsEntry', 'ysLabel', 'ysEntry', \
                  'liLabel', 'liEntry', 'loLabel', 'loEntry', 'ALabel', 'AEntry', \
                  'BLabel', 'BEntry', 'CLabel', 'CEntry', 'aLabel', 'aEntry',
                  'bLabel', 'bEntry', 'cLabel', 'cEntry', 'angLabel', 'angEntry']
    centerAlign = ['lDesc']
    rButton = ['cExt', 'cInt']
    pButton = ['preview', 'add', 'undo', 'kOffset']
    for widget in rightAlign:
        W[widget].setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        W[widget].setFixedWidth(80)
        W[widget].setFixedHeight(24)
    for widget in centerAlign:
        W[widget].setAlignment(Qt.AlignCenter | Qt.AlignBottom)
        W[widget].setFixedWidth(240)
        W[widget].setFixedHeight(24)
    for widget in rButton:
        W[widget].setFixedWidth(80)
        W[widget].setFixedHeight(24)
    for widget in pButton:
        W[widget].setFixedWidth(80)
        W[widget].setFixedHeight(24)
    #starting parameters
    W.add.setEnabled(False)
    W.liEntry.setText('{}'.format(P.leadIn))
    W.loEntry.setText('{}'.format(P.leadOut))
    W.xsEntry.setText('{}'.format(P.xSaved))
    W.ysEntry.setText('{}'.format(P.ySaved))
    W.angEntry.setText('0.0')
    if not W.liEntry.text() or float(W.liEntry.text()) == 0:
        W.kOffset.setChecked(False)
        W.kOffset.setEnabled(False)
    P.conv_undo_shape('add')
    W.AEntry.setFocus()
    #connections
    W.conv_material.currentTextChanged.connect(lambda: auto_preview(P, W))
    W.cExt.toggled.connect(lambda: auto_preview(P, W))
    W.kOffset.toggled.connect(lambda: auto_preview(P, W))
    W.preview.pressed.connect(lambda: preview(P, W))
    W.add.pressed.connect(lambda: add_shape_to_file(P, W))
    W.undo.pressed.connect(lambda: P.conv_undo_shape('add'))
    entries = ['xsEntry', 'ysEntry', 'liEntry', 'loEntry', 'AEntry', 'BEntry', \
               'CEntry', 'aEntry', 'bEntry', 'cEntry', 'angEntry']
    for entry in entries:
        W[entry].textChanged.connect(lambda: entry_changed(P, W, W.sender()))
        W[entry].editingFinished.connect(lambda: auto_preview(P, W))
    #add to layout
    if P.landscape:
        W.entries.addWidget(W.ctLabel, 0, 0)
        W.entries.addWidget(W.cExt, 0, 1)
        W.entries.addWidget(W.cInt, 0, 2)
        W.entries.addWidget(W.koLabel, 0, 3)
        W.entries.addWidget(W.kOffset, 0, 4)
        W.entries.addWidget(W.xsLabel, 1, 0)
        W.entries.addWidget(W.xsEntry, 1, 1)
        W.entries.addWidget(W.ysLabel, 2, 0)
        W.entries.addWidget(W.ysEntry, 2, 1)
        W.entries.addWidget(W.liLabel, 3, 0)
        W.entries.addWidget(W.liEntry, 3, 1)
        W.entries.addWidget(W.loLabel, 4, 0)
        W.entries.addWidget(W.loEntry, 4, 1)
        W.entries.addWidget(W.ALabel, 5, 0)
        W.entries.addWidget(W.AEntry, 5, 1)
        W.entries.addWidget(W.BLabel, 6, 0)
        W.entries.addWidget(W.BEntry, 6, 1)
        W.entries.addWidget(W.CLabel, 7, 0)
        W.entries.addWidget(W.CEntry, 7, 1)
        W.entries.addWidget(W.aLabel, 8, 0)
        W.entries.addWidget(W.aEntry, 8, 1)
        W.entries.addWidget(W.bLabel, 9, 0)
        W.entries.addWidget(W.bEntry, 9, 1)
        W.entries.addWidget(W.cLabel, 10, 0)
        W.entries.addWidget(W.cEntry, 10, 1)
        W.entries.addWidget(W.angLabel, 11, 0)
        W.entries.addWidget(W.angEntry, 11, 1)
        W.entries.addWidget(W.preview, 12, 0)
        W.entries.addWidget(W.add, 12, 2)
        W.entries.addWidget(W.undo, 12, 4)
        W.entries.addWidget(W.lDesc, 13, 1, 1, 3)
        W.entries.addWidget(W.iLabel, 2, 2, 9, 3)
    else:
        W.entries.addWidget(W.conv_material, 0, 0, 1, 5)
        W.entries.addWidget(W.ctLabel, 1, 0)
        W.entries.addWidget(W.cExt, 1, 1)
        W.entries.addWidget(W.cInt, 1, 2)
        W.entries.addWidget(W.koLabel, 1, 3)
        W.entries.addWidget(W.kOffset, 1, 4)
        W.entries.addWidget(W.xsLabel, 2, 0)
        W.entries.addWidget(W.xsEntry, 2, 1)
        W.entries.addWidget(W.ysLabel, 2, 2)
        W.entries.addWidget(W.ysEntry, 2, 3)
        W.entries.addWidget(W.liLabel, 3, 0)
        W.entries.addWidget(W.liEntry, 3, 1)
        W.entries.addWidget(W.loLabel, 3, 2)
        W.entries.addWidget(W.loEntry, 3, 3)
        W.entries.addWidget(W.ALabel, 4, 0)
        W.entries.addWidget(W.AEntry, 4, 1)
        W.entries.addWidget(W.BLabel, 4, 2)
        W.entries.addWidget(W.BEntry, 4, 3)
        W.entries.addWidget(W.CLabel, 5, 0)
        W.entries.addWidget(W.CEntry, 5, 1)
        W.entries.addWidget(W.aLabel, 6, 0)
        W.entries.addWidget(W.aEntry, 6, 1)
        W.entries.addWidget(W.bLabel, 6, 2)
        W.entries.addWidget(W.bEntry, 6, 3)
        W.entries.addWidget(W.cLabel, 7, 0)
        W.entries.addWidget(W.cEntry, 7, 1)
        W.entries.addWidget(W.angLabel, 8, 0)
        W.entries.addWidget(W.angEntry, 8, 1)
        W.entries.addWidget(W.preview, 9, 0)
        W.entries.addWidget(W.add, 9, 2)
        W.entries.addWidget(W.undo, 9, 4)
        W.entries.addWidget(W.lDesc, 10, 1, 1, 3)
        W.entries.addWidget(W.iLabel, 0, 5, 9, 3)
Пример #10
0
    def _getExtractionTab(self):
        extractDeckLabel = QLabel('Extracts Deck')
        self.extractDeckComboBox = QComboBox()
        self.extractDeckComboBox.setFixedWidth(400)
        deckNames = sorted([d['name'] for d in mw.col.decks.all()])
        self.extractDeckComboBox.addItem('[Current Deck]')
        self.extractDeckComboBox.addItems(deckNames)

        if self.settings['extractDeck']:
            setComboBoxItem(self.extractDeckComboBox,
                            self.settings['extractDeck'])
        else:
            setComboBoxItem(self.extractDeckComboBox, '[Current Deck]')

        extractDeckLayout = QHBoxLayout()
        extractDeckLayout.addWidget(extractDeckLabel)
        extractDeckLayout.addWidget(self.extractDeckComboBox)
        extractDeckLayout.addStretch()

        self.editExtractButton = QRadioButton('Edit Extracted Note')
        enterTitleButton = QRadioButton('Enter Title Only')

        if self.settings['editExtract']:
            self.editExtractButton.setChecked(True)
        else:
            enterTitleButton.setChecked(True)

        radioButtonsLayout = QHBoxLayout()
        radioButtonsLayout.addWidget(self.editExtractButton)
        radioButtonsLayout.addWidget(enterTitleButton)
        radioButtonsLayout.addStretch()

        self.editSourceCheckBox = QCheckBox('Edit Source Note')
        self.plainTextCheckBox = QCheckBox('Extract as Plain Text')
        self.copyTitleCheckBox = QCheckBox('Copy Title')
        self.scheduleExtractCheckBox = QCheckBox('Schedule Extracts')

        if self.settings['editSource']:
            self.editSourceCheckBox.setChecked(True)

        if self.settings['plainText']:
            self.plainTextCheckBox.setChecked(True)

        if self.settings['copyTitle']:
            self.copyTitleCheckBox.setChecked(True)

        if self.settings['scheduleExtract']:
            self.scheduleExtractCheckBox.setChecked(True)

        layout = QVBoxLayout()
        layout.addLayout(extractDeckLayout)
        layout.addLayout(radioButtonsLayout)
        layout.addWidget(self.editSourceCheckBox)
        layout.addWidget(self.plainTextCheckBox)
        layout.addWidget(self.copyTitleCheckBox)
        layout.addWidget(self.scheduleExtractCheckBox)
        layout.addStretch()

        tab = QWidget()
        tab.setLayout(layout)

        return tab
Пример #11
0
    def _getSchedulingTab(self):
        modeLabel = QLabel('Scheduling Mode')
        manualButton = QRadioButton('Manual')
        self.prioButton = QRadioButton('Priorities')

        soonLabel = QLabel('Soon Button')
        laterLabel = QLabel('Later Button')
        extractLabel = QLabel('Extracts')

        self.soonPercentButton = QRadioButton('Percent')
        soonPositionButton = QRadioButton('Position')
        self.laterPercentButton = QRadioButton('Percent')
        laterPositionButton = QRadioButton('Position')
        self.extractPercentButton = QRadioButton('Percent')
        extractPositionButton = QRadioButton('Position')

        self.soonRandomCheckBox = QCheckBox('Randomize')
        self.laterRandomCheckBox = QCheckBox('Randomize')
        self.extractRandomCheckBox = QCheckBox('Randomize')

        self.soonValueEditBox = QLineEdit()
        self.soonValueEditBox.setFixedWidth(100)
        self.laterValueEditBox = QLineEdit()
        self.laterValueEditBox.setFixedWidth(100)
        self.extractValueEditBox = QLineEdit()
        self.extractValueEditBox.setFixedWidth(100)

        if self.settings['prioEnabled']:
            self.prioButton.setChecked(True)
        else:
            manualButton.setChecked(True)

        if self.settings['soonMethod'] == 'percent':
            self.soonPercentButton.setChecked(True)
        else:
            soonPositionButton.setChecked(True)

        if self.settings['laterMethod'] == 'percent':
            self.laterPercentButton.setChecked(True)
        else:
            laterPositionButton.setChecked(True)

        if self.settings['extractMethod'] == 'percent':
            self.extractPercentButton.setChecked(True)
        else:
            extractPositionButton.setChecked(True)

        if self.settings['soonRandom']:
            self.soonRandomCheckBox.setChecked(True)

        if self.settings['laterRandom']:
            self.laterRandomCheckBox.setChecked(True)

        if self.settings['extractRandom']:
            self.extractRandomCheckBox.setChecked(True)

        self.soonValueEditBox.setText(str(self.settings['soonValue']))
        self.laterValueEditBox.setText(str(self.settings['laterValue']))
        self.extractValueEditBox.setText(str(self.settings['extractValue']))

        formatLabel = QLabel('Organizer Format')
        self.organizerFormatEditBox = QLineEdit()
        self.organizerFormatEditBox.setFixedWidth(400)
        self.organizerFormatEditBox.setText(
            self.settings['organizerFormat'].replace('\t', r'\t'))
        font = QFont('Lucida Sans Typewriter')
        font.setStyleHint(QFont.Monospace)
        self.organizerFormatEditBox.setFont(font)

        modeLayout = QHBoxLayout()
        modeLayout.addWidget(modeLabel)
        modeLayout.addStretch()
        modeLayout.addWidget(manualButton)
        modeLayout.addWidget(self.prioButton)

        soonLayout = QHBoxLayout()
        soonLayout.addWidget(soonLabel)
        soonLayout.addStretch()
        soonLayout.addWidget(self.soonValueEditBox)
        soonLayout.addWidget(self.soonPercentButton)
        soonLayout.addWidget(soonPositionButton)
        soonLayout.addWidget(self.soonRandomCheckBox)

        laterLayout = QHBoxLayout()
        laterLayout.addWidget(laterLabel)
        laterLayout.addStretch()
        laterLayout.addWidget(self.laterValueEditBox)
        laterLayout.addWidget(self.laterPercentButton)
        laterLayout.addWidget(laterPositionButton)
        laterLayout.addWidget(self.laterRandomCheckBox)

        extractLayout = QHBoxLayout()
        extractLayout.addWidget(extractLabel)
        extractLayout.addStretch()
        extractLayout.addWidget(self.extractValueEditBox)
        extractLayout.addWidget(self.extractPercentButton)
        extractLayout.addWidget(extractPositionButton)
        extractLayout.addWidget(self.extractRandomCheckBox)

        modeButtonGroup = QButtonGroup(modeLayout)
        modeButtonGroup.addButton(manualButton)
        modeButtonGroup.addButton(self.prioButton)

        soonButtonGroup = QButtonGroup(soonLayout)
        soonButtonGroup.addButton(self.soonPercentButton)
        soonButtonGroup.addButton(soonPositionButton)

        laterButtonGroup = QButtonGroup(laterLayout)
        laterButtonGroup.addButton(self.laterPercentButton)
        laterButtonGroup.addButton(laterPositionButton)

        extractButtonGroup = QButtonGroup(extractLayout)
        extractButtonGroup.addButton(self.extractPercentButton)
        extractButtonGroup.addButton(extractPositionButton)

        formatLayout = QHBoxLayout()
        formatLayout.addWidget(formatLabel)
        formatLayout.addWidget(self.organizerFormatEditBox)

        layout = QVBoxLayout()
        layout.addLayout(modeLayout)
        layout.addLayout(soonLayout)
        layout.addLayout(laterLayout)
        layout.addLayout(extractLayout)
        layout.addLayout(formatLayout)
        layout.addStretch()

        tab = QWidget()
        tab.setLayout(layout)

        return tab
Пример #12
0
    def onWidgetSettings(self, parent):
        root = QWidget()
        rootLayout = QVBoxLayout()
        rootLayout.setContentsMargins(0, 0, 0, 0)
        root.setLayout(rootLayout)
        setingGroup = QGroupBox(_("En-decoding settings"))
        layout = QGridLayout()
        setingGroup.setLayout(layout)
        self.codeItems = ComboBox()
        self.codeItemCustomStr = _("Custom, input name")
        self.codeItemLoadDefaultsStr = _("Load defaults")
        self.codeItems.setEditable(True)
        self.codeWidget = PlainTextEdit()
        self.saveCodeBtn = QPushButton(_("Save"))
        self.saveCodeBtn.setEnabled(False)
        self.deleteCodeBtn = QPushButton(_("Delete"))
        btnLayout = QHBoxLayout()
        btnLayout.addWidget(self.saveCodeBtn)
        btnLayout.addWidget(self.deleteCodeBtn)
        layout.addWidget(QLabel(_("Defaults")), 0, 0, 1, 1)
        layout.addWidget(self.codeItems, 0, 1, 1, 1)
        layout.addWidget(QLabel(_("Code")), 1, 0, 1, 1)
        layout.addWidget(self.codeWidget, 1, 1, 1, 1)
        layout.addLayout(btnLayout, 2, 1, 1, 1)
        serialSendSettingsLayout = QGridLayout()
        sendGroup = QGroupBox(_("Send settings"))
        sendGroup.setLayout(serialSendSettingsLayout)
        self.sendSettingsAscii = QRadioButton(_("ASCII"))
        self.sendSettingsHex = QRadioButton(_("HEX"))
        self.sendSettingsAscii.setToolTip(
            _("Get send data as visible format, select encoding method at top right corner"
              ))
        self.sendSettingsHex.setToolTip(
            _("Get send data as hex format, e.g. hex '31 32 33' equal to ascii '123'"
              ))
        self.sendSettingsAscii.setChecked(True)
        self.sendSettingsCRLF = QCheckBox(_("<CRLF>"))
        self.sendSettingsCRLF.setToolTip(
            _("Select to send \\r\\n instead of \\n"))
        self.sendSettingsCRLF.setChecked(False)
        self.sendSettingsEscape = QCheckBox(_("Escape"))
        self.sendSettingsEscape.setToolTip(
            _("Enable escape characters support like \\t \\r \\n \\x01 \\001"))
        serialSendSettingsLayout.addWidget(self.sendSettingsAscii, 0, 0, 1, 1)
        serialSendSettingsLayout.addWidget(self.sendSettingsHex, 0, 1, 1, 1)
        serialSendSettingsLayout.addWidget(self.sendSettingsCRLF, 1, 0, 1, 1)
        serialSendSettingsLayout.addWidget(self.sendSettingsEscape, 1, 1, 1, 1)

        rootLayout.addWidget(sendGroup)
        rootLayout.addWidget(setingGroup)
        # event
        self.sendSettingsAscii.clicked.connect(lambda: self.bindVar(
            self.sendSettingsAscii, self.config, "sendAscii", bool))
        self.sendSettingsHex.clicked.connect(lambda: self.bindVar(
            self.sendSettingsHex, self.config, "sendAscii", bool, invert=True))
        self.sendSettingsCRLF.clicked.connect(lambda: self.bindVar(
            self.sendSettingsCRLF, self.config, "useCRLF", bool))
        self.sendSettingsEscape.clicked.connect(lambda: self.bindVar(
            self.sendSettingsEscape, self.config, "sendEscape", bool))
        self.saveCodeBtn.clicked.connect(self.saveCode)
        self.deleteCodeBtn.clicked.connect(self.deleteCode)
        self.codeWidget.onSave = self.saveCode
        return root
Пример #13
0
def widgets(P, W):
    #widgets
    W.lType = QComboBox()
    W.label1 = QLabel()
    W.entry1 = QLineEdit()
    W.label2 = QLabel()
    W.entry2 = QLineEdit()
    W.label3 = QLabel()
    W.entry3 = QLineEdit()
    W.label4 = QLabel()
    W.entry4 = QLineEdit()
    W.label5 = QLabel()
    W.entry5 = QLineEdit()
    W.label6 = QLabel()
    W.entry6 = QLineEdit()
    W.label7 = QLabel()
    W.entry7 = QLineEdit()
    W.label8 = QLabel()
    W.entry8 = QLineEdit()
    W.preview = QPushButton('Preview')
    W.continu = QPushButton('Continue')
    W.add = QPushButton('Add')
    W.undo = QPushButton('Undo')
    W.lDesc = QLabel('Creating Line or Arc')
    W.g2Arc = QRadioButton('Clock')
    W.g3Arc = QRadioButton('Counter')
    W.iLabel = QLabel()
    W.pixLinePoint = QPixmap('{}conv_line_point.png'.format(
        P.IMAGES)).scaledToWidth(240)
    W.pixLineAngle = QPixmap('{}conv_line_angle.png'.format(
        P.IMAGES)).scaledToWidth(240)
    W.pixArc3p = QPixmap('{}conv_arc_3p.png'.format(
        P.IMAGES)).scaledToWidth(240)
    W.pixArc2pr = QPixmap('{}conv_arc_2pr.png'.format(
        P.IMAGES)).scaledToWidth(240)
    W.pixArcAngle = QPixmap('{}conv_arc_angle.png'.format(
        P.IMAGES)).scaledToWidth(240)
    #alignment and size
    rightAlign = ['label1', 'entry1', 'label2', 'entry2', 'label3', 'entry3', \
                  'label4', 'entry4', 'label5', 'entry5', 'label6', 'entry6', \
                  'label7', 'entry7', 'label8', 'entry8']
    centerAlign = ['lDesc']
    rButton = ['g2Arc', 'g3Arc']
    pButton = ['preview', 'continu', 'add', 'undo']
    for widget in rightAlign:
        W[widget].setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        W[widget].setFixedWidth(80)
        W[widget].setFixedHeight(24)
    for widget in centerAlign:
        W[widget].setAlignment(Qt.AlignCenter | Qt.AlignBottom)
        W[widget].setFixedWidth(240)
        W[widget].setFixedHeight(24)
    for widget in rButton:
        W[widget].setFixedWidth(80)
        W[widget].setFixedHeight(24)
    for widget in pButton:
        W[widget].setFixedWidth(80)
        W[widget].setFixedHeight(24)
    #starting parameters
    W.lType.addItem('line point to point')
    W.lType.addItem('line by angle')
    W.lType.addItem('arc 3p')
    W.lType.addItem('arc 2p & radius')
    W.lType.addItem('arc angle & radius')
    W.continu.setEnabled(False)
    W.add.setEnabled(False)
    W.add_segment = 0
    W.gcodeSave = ''
    W.savedX = ''
    W.savedY = ''
    if not W.g2Arc.isChecked() and not W.g3Arc.isChecked():
        W.g2Arc.setChecked(True)
    P.conv_undo_shape('add')
    #connections
    W.conv_material.currentTextChanged.connect(lambda: auto_preview(P, W))
    W.preview.pressed.connect(lambda: preview(P, W))
    W.continu.pressed.connect(lambda: continu_shape(P, W))
    W.add.pressed.connect(lambda: add_shape_to_file(P, W))
    W.undo.pressed.connect(lambda: undo_shape('add'))
    W.lType.currentTextChanged.connect(lambda: line_type_changed(P, W))
    W.g2Arc.toggled.connect(lambda: auto_preview(P, W))
    entries = [
        'entry1', 'entry2', 'entry3', 'entry4', 'entry5', 'entry6', 'entry7',
        'entry8'
    ]
    for entry in entries:
        W[entry].textChanged.connect(
            lambda w: entry_changed(P, W, W.sender(), w))
        W[entry].editingFinished.connect(lambda: auto_preview(P, W))
    #add to layout
    W.entries.addWidget(W.lType, 0, 0, 1, 2)
    W.entries.addWidget(W.label1, 1, 0)
    W.entries.addWidget(W.entry1, 1, 1)
    W.entries.addWidget(W.label2, 2, 0)
    W.entries.addWidget(W.entry2, 2, 1)
    W.entries.addWidget(W.label3, 3, 0)
    W.entries.addWidget(W.entry3, 3, 1)
    W.entries.addWidget(W.label4, 4, 0)
    W.entries.addWidget(W.entry4, 4, 1)
    W.entries.addWidget(W.label5, 5, 0)
    W.entries.addWidget(W.entry5, 5, 1)
    W.entries.addWidget(W.label6, 6, 0)
    W.entries.addWidget(W.entry6, 6, 1)
    W.entries.addWidget(W.label7, 7, 0)
    W.entries.addWidget(W.entry7, 7, 1)
    W.entries.addWidget(W.label8, 8, 0)
    W.entries.addWidget(W.entry8, 8, 1)
    for blank in range(3):
        W['{}'.format(blank)] = QLabel('')
        W['{}'.format(blank)].setFixedHeight(24)
        W.entries.addWidget(W['{}'.format(blank)], 9 + blank, 0)
    W.entries.addWidget(W.preview, 12, 0)
    W.entries.addWidget(W.continu, 12, 1)
    W.entries.addWidget(W.add, 12, 2)
    W.entries.addWidget(W.undo, 12, 4)
    W.entries.addWidget(W.lDesc, 13, 1, 1, 3)
    W.entries.addWidget(W.iLabel, 2, 2, 7, 3)
    set_line_point_to_point(P, W)
    def initUI(self):

        saveButton = QPushButton("SAVE", self)
        clearButton = QPushButton("CLEAR", self)
        saveButton.setFont(QtGui.QFont("Calibri", 13))
        clearButton.setFont(QtGui.QFont("Calibri", 13))

        saveButton.move(100, 680)
        clearButton.move(260, 680)

        comboBoxyopass = QtWidgets.QComboBox(self)
        comboBoxyopass.addItem("SELECT")
        i = 2050
        while i >= 2000:
            comboBoxyopass.addItem(str(i))
            i -= 1
        comboBoxyopass.setMinimumHeight(35)
        comboBoxyopass.setFixedWidth(150)
        comboBoxyopass.setFont(QtGui.QFont("Calibri", 14))

        comboBoxtrcentr = QtWidgets.QComboBox(self)
        comboBoxtrcentr.addItem("SELECT CENTER")
        comboBoxtrcentr.addItem('Jaipur   ')
        comboBoxtrcentr.addItem('Hyderabad')
        comboBoxtrcentr.addItem('Raipur   ')
        comboBoxtrcentr.addItem('Lucknow  ')
        comboBoxtrcentr.addItem('Pune     ')
        comboBoxtrcentr.addItem('Vizag    ')
        comboBoxtrcentr.addItem('Bhopal   ')
        comboBoxtrcentr.addItem('Delhi    ')
        comboBoxtrcentr.setMinimumHeight(35)
        comboBoxtrcentr.setFixedWidth(180)
        comboBoxtrcentr.setFont(QtGui.QFont("Calibri", 14))

        comboBoxcourse = QtWidgets.QComboBox(self)
        comboBoxcourse.addItem("SELECT COURSE")
        comboBoxcourse.addItem('ESR    (30 Days)     ')
        comboBoxcourse.addItem('ESR    (45 Days)     ')
        comboBoxcourse.addItem('Matlab   (30 Days)   ')
        comboBoxcourse.addItem('IOT   (15 Days)      ')
        comboBoxcourse.addItem('IOT   (30 Days)      ')
        comboBoxcourse.addItem('JAVA   (30 Days)     ')
        comboBoxcourse.addItem('Python   (30 Days)   ')
        comboBoxcourse.addItem('PLC-SCADA   (30 Days)')
        comboBoxcourse.addItem('C/C++   (45 Days)    ')
        comboBoxcourse.addItem('Android   (15 Days)  ')
        comboBoxcourse.addItem('Android   (30 Days)  ')
        comboBoxcourse.setMinimumHeight(35)
        comboBoxcourse.setFixedWidth(200)
        comboBoxcourse.setFont(QtGui.QFont("Calibri", 14))

        comboBoxsem = QtWidgets.QComboBox(self)
        comboBoxsem.addItem("SELECT")
        i = 1
        while i <= 8:
            comboBoxsem.addItem(str(i))
            i += 1
        comboBoxsem.addItem("Passed Out")
        comboBoxsem.setMinimumHeight(35)
        comboBoxsem.setFixedWidth(100)
        comboBoxsem.setFont(QtGui.QFont("Calibri", 14))

        comboBoxstate = QtWidgets.QComboBox(self)
        comboBoxstate.addItem("SELECT")
        comboBoxstate.addItem('Andhra Pradesh')
        comboBoxstate.addItem('Arunachal Pradesh')
        comboBoxstate.addItem('Assam')
        comboBoxstate.addItem('Bihar')
        comboBoxstate.addItem('Goa')
        comboBoxstate.addItem('Gujarat')
        comboBoxstate.addItem('Haryana')
        comboBoxstate.addItem('Himachal Pradesh')
        comboBoxstate.addItem('Jammu & Kashmir')
        comboBoxstate.addItem('Karnataka')
        comboBoxstate.addItem('Kerala')
        comboBoxstate.addItem('Madhya Pradesh')
        comboBoxstate.addItem('Maharashtra')
        comboBoxstate.addItem('Manipur')
        comboBoxstate.addItem('Meghalaya')
        comboBoxstate.addItem('Mizoram')
        comboBoxstate.addItem('Nagaland')
        comboBoxstate.addItem('Orissa')
        comboBoxstate.addItem('Punjab')
        comboBoxstate.addItem('Rajasthan')
        comboBoxstate.addItem('Sikkim')
        comboBoxstate.addItem('Tamil Nadu')
        comboBoxstate.addItem('Tripura')
        comboBoxstate.addItem('Uttar Pradesh')
        comboBoxstate.addItem('West Bengal')
        comboBoxstate.addItem('Chhattisgarh')
        comboBoxstate.addItem('Uttarakhand')
        comboBoxstate.addItem('Jharkhand')
        comboBoxstate.addItem('Telangana')
        comboBoxstate.setMinimumHeight(35)
        comboBoxstate.setFixedWidth(250)
        comboBoxstate.setFont(QtGui.QFont("Calibri", 14))

        hboxsex = QHBoxLayout()
        hboxsex.setSpacing(60)
        r1 = QRadioButton("Male")
        r1.setFont(QtGui.QFont("Calibri", 10.5, QtGui.QFont.Bold))
        r1.setMinimumHeight(30)
        r2 = QRadioButton("Female")
        r2.setFont(QtGui.QFont("Calibri", 10.5, QtGui.QFont.Bold))
        r2.setMinimumHeight(30)
        widgetsex = QWidget(self)
        groupsex = QButtonGroup(widgetsex)
        groupsex.addButton(r1)
        groupsex.addButton(r2)
        hboxsex.addWidget(r1)
        hboxsex.addWidget(r2)
        hboxsex.addStretch()

        headerfont = QtGui.QFont("Cambria", 13, QtGui.QFont.Bold)
        saveloc = str("Student_List.xlsx")

        l1 = QLabel("Name: ")
        l1.setFont(headerfont)
        l1.setMinimumHeight(30)
        l1.setFixedWidth(180)
        text1 = QLineEdit()
        text1.setFixedWidth(600)
        text1.setMinimumHeight(30)
        text1.setFont(QtGui.QFont("Times", 11))

        l2 = QLabel("Email Id: ")
        l2.setFont(headerfont)
        l2.setMinimumHeight(30)
        l2.setFixedWidth(180)
        text2 = QLineEdit()
        text2.setFixedWidth(600)
        text2.setMinimumHeight(30)
        text2.setFont(QtGui.QFont("Times", 11))

        l3 = QLabel("Contact No.: ")
        l3.setFont(headerfont)
        l3.setMinimumHeight(30)
        l3.setFixedWidth(180)
        text3 = QLineEdit()
        text3.setFixedWidth(600)
        text3.setMinimumHeight(30)
        text3.setFont(QtGui.QFont("Times", 11))

        l4 = QLabel("City: ")
        l4.setFont(headerfont)
        l4.setMinimumHeight(30)
        l4.setFixedWidth(180)
        text4 = QLineEdit()
        text4.setFixedWidth(600)
        text4.setMinimumHeight(30)
        text4.setFont(QtGui.QFont("Times", 11))

        l5 = QLabel("State: ")
        l5.setFont(headerfont)
        l5.setMinimumHeight(30)
        l5.setFixedWidth(180)

        l6 = QLabel("College: ")
        l6.setFont(headerfont)
        l6.setMinimumHeight(30)
        l6.setFixedWidth(180)
        text6 = QLineEdit()
        text6.setFixedWidth(600)
        text6.setMinimumHeight(30)
        text6.setFont(QtGui.QFont("Times", 11))

        l7 = QLabel("Branch: ")
        l7.setFont(headerfont)
        l7.setMinimumHeight(30)
        l7.setFixedWidth(180)
        text7 = QLineEdit()
        text7.setFixedWidth(600)
        text7.setMinimumHeight(30)
        text7.setFont(QtGui.QFont("Times", 11))

        l8 = QLabel("Semester: ")
        l8.setFont(headerfont)
        l8.setMinimumHeight(30)
        l8.setFixedWidth(180)

        l9 = QLabel("Year Of Passing: ")
        l9.setFont(headerfont)
        l9.setFixedWidth(180)

        l10 = QLabel("Course: ")
        l10.setFont(headerfont)
        l10.setMinimumHeight(30)
        l10.setFixedWidth(180)

        l11 = QLabel("Batch: ")
        l11.setFont(headerfont)
        l11.setMinimumHeight(30)
        l11.setFixedWidth(180)
        text11 = QLineEdit()
        text11.setFixedWidth(600)
        text11.setMinimumHeight(30)
        text11.setFont(QtGui.QFont("Times", 11))

        l12 = QLabel("Training Center: ")
        l12.setFont(headerfont)
        l12.setMinimumHeight(30)
        l12.setFixedWidth(180)

        l13 = QLabel("SEX: ")
        l13.setFont(headerfont)
        l13.setFixedWidth(180)

        l14 = QLabel("Save File As: ")
        l14.setFont(headerfont)
        l14.setMinimumHeight(30)
        l14.setFixedWidth(180)
        text14 = QLineEdit()
        text14.setFixedWidth(600)
        text14.setMinimumHeight(30)
        text14.setFont(QtGui.QFont("Times", 11, QtGui.QFont.Bold))
        text14.setText(saveloc)

        l15 = QLabel("Query/Regarding What: ")
        l15.setFont(QtGui.QFont("Cambria", 12, QtGui.QFont.Bold))
        l15.setMinimumHeight(30)
        l15.setFixedWidth(200)
        text15 = QLineEdit()
        text15.setFixedWidth(600)
        text15.setMinimumHeight(30)
        text15.setFont(QtGui.QFont("Times", 11))

        hboxcourse = QHBoxLayout()
        hboxcourse.setSpacing(25)
        l16 = QLabel("Others: ")
        l16.setFont(headerfont)
        l16.setMinimumHeight(30)
        l16.setFixedWidth(100)
        text16 = QLineEdit()
        text16.setFixedWidth(250)
        text16.setMinimumHeight(30)
        text16.setFont(QtGui.QFont("Times", 11))
        hboxcourse.addWidget(comboBoxcourse)
        hboxcourse.addWidget(l16)
        hboxcourse.addWidget(text16)
        hboxcourse.addStretch()

        hboxstate = QHBoxLayout()
        hboxstate.setSpacing(25)
        l17 = QLabel("Others: ")
        l17.setFont(headerfont)
        l17.setMinimumHeight(30)
        l17.setFixedWidth(70)
        text17 = QLineEdit()
        text17.setFixedWidth(230)
        text17.setMinimumHeight(30)
        text17.setFont(QtGui.QFont("Times", 11))
        hboxstate.addWidget(comboBoxstate)
        hboxstate.addWidget(l17)
        hboxstate.addWidget(text17)
        hboxstate.addStretch()

        fbox = QFormLayout()
        fbox.setVerticalSpacing(10)

        fbox.addRow(l1, text1)
        fbox.addRow(l2, text2)
        fbox.addRow(l3, text3)
        fbox.addRow(l4, text4)
        fbox.addRow(l5, hboxstate)
        fbox.addRow(l6, text6)
        fbox.addRow(l7, text7)
        fbox.addRow(l8, comboBoxsem)
        fbox.addRow(l9, comboBoxyopass)
        fbox.addRow(l10, hboxcourse)
        fbox.addRow(l11, text11)
        fbox.addRow(l12, comboBoxtrcentr)

        l18 = QLabel("Training Session: ")
        l18.setFont(headerfont)
        l18.setMinimumHeight(30)
        l18.setFixedWidth(200)

        hboxperiod = QHBoxLayout()
        hboxperiod.setSpacing(70)
        r3 = QRadioButton("Summer Training")
        r3.setFont(QtGui.QFont("Calibri", 10, QtGui.QFont.Bold))
        r3.setMinimumHeight(30)
        r4 = QRadioButton("Winter Training")
        r4.setFont(QtGui.QFont("Calibri", 10, QtGui.QFont.Bold))
        r4.setMinimumHeight(30)
        r5 = QRadioButton("Project Based")
        r5.setFont(QtGui.QFont("Calibri", 10, QtGui.QFont.Bold))
        r5.setMinimumHeight(30)
        r6 = QRadioButton("Other")
        r6.setFont(QtGui.QFont("Calibri", 10, QtGui.QFont.Bold))
        r6.setMinimumHeight(30)
        widgetperiod = QWidget(self)
        groupperiod = QButtonGroup(widgetperiod)
        groupperiod.addButton(r3)
        groupperiod.addButton(r4)
        groupperiod.addButton(r5)
        groupperiod.addButton(r6)
        hboxperiod.addWidget(r3)
        hboxperiod.addWidget(r4)
        hboxperiod.addWidget(r5)
        hboxperiod.addWidget(r6)
        hboxperiod.addStretch()
        fbox.addRow(l18, hboxperiod)
        fbox.addRow(l13, hboxsex)
        fbox.addRow(l15, text15)
        fbox.addRow(l14, text14)

        self.lineedits = [
            text1, text2, text3, text4, text6, text7, text11, text14, text15,
            text16, text17
        ]
        self.saveedit = [text14]
        self.comboBox = [
            comboBoxstate, comboBoxsem, comboBoxyopass, comboBoxtrcentr,
            comboBoxcourse
        ]
        self.radiobutton = [r1, r2, r3, r4, r5, r6]
        saveButton.clicked.connect(self.saveClicked)
        clearButton.clicked.connect(self.clearClicked)

        self.setLayout(fbox)

        try:
            self.setWindowState(QtCore.Qt.WindowMaximized)
        except:
            self.setGeometry(10, 30, 1350, 750)

        self.setWindowTitle('Managemet System Software ')
        self.setWindowIcon(
            QIcon('logso.png'))  # Enter your Icon Image url here
        oImage = QImage("image2.jpg")  # Enter your Background Image url here
        sImage = oImage.scaled(QSize(1350, 750))
        palette = QPalette()
        palette.setBrush(10, QBrush(sImage))
        self.setPalette(palette)
        self.show()
Пример #15
0
    def createElement(line: str, widget_gallery) -> 'AbstractClass':
        els = line.split('"')
        els = [el.strip() for el in els]

        button_type, button_label, _discard, button_text, other = els

        try:
            button_type = ButtonType(button_type)
        except:
            button_type = None

        if button_label != "":
            label = QLabel(button_label)
        else:
            label = None

        var_name, val_value, initial_setting, ticked_state = other.split(' ')

        if val_value == "None":
            val_value = None
        elif val_value.find('/'):
            val_value = val_value.split('/')

        if button_type == ButtonType.RADIO_BUTTON:
            inputButton = None
            button = QRadioButton(button_text)
            if initial_setting == "off":
                button.setEnabled(False)

        elif button_type == ButtonType.TEXT_EDIT_BUTTON:
            inputButton = QLineEdit(widget_gallery)
            inputButton.setPlaceholderText(var_name)
            button = QRadioButton(button_text)
            if initial_setting == "off":
                button.setEnabled(False)
                inputButton.setEnabled(False)

        elif button_type == ButtonType.TEXT_EDIT_BOX:
            inputButton = QLineEdit(widget_gallery)
            inputButton.setPlaceholderText(var_name)
            button = None
            if initial_setting == "off":
                inputButton.setEnabled(False)

        elif button_type == ButtonType.FILE_INPUT:
            inputButton = QLineEdit(widget_gallery)
            inputButton.setPlaceholderText(var_name)
            button = QPushButton(button_text)
            if initial_setting == "off":
                inputButton.setEnabled(False)
                button.setEnabled(False)

        elif button_type == ButtonType.TOGGLE_BUTTON:
            inputButton = None
            button = QCheckBox(button_text)
            if initial_setting == "off":
                button.setEnabled(False)
            if ticked_state == "ticked":
                button.setChecked(True)

        elif button_type == ButtonType.DROPDOWN_LIST:
            inputButton = None
            button = QComboBox(widget_gallery)
            for _value in val_value:
                button.addItem(_value)
            button.move(50, 250)
            if initial_setting == "off":
                button.setEnabled(False)

        elif button_type == ButtonType.PUSH_BUTTON:
            inputButton = None
            pixmap = QPixmap('images/audioicon.png')
            button = QPushButton(button_text)
            button.setGeometry(200, 150, 50, 50)
            button.setIcon(QIcon(pixmap))
            button.setIconSize(QSize(50, 50))

        elif button_type == ButtonType.AUDIO_INPUT:
            inputButton = None
            pixmap = QPixmap('images/audioicon.png')
            button = QPushButton(button_text)
            button.setGeometry(200, 150, 50, 50)
            button.setIcon(QIcon(pixmap))
            button.setIconSize(QSize(50, 50))

        return OptionButton(button_type.value, button, var_name, inputButton,
                            val_value, label)
Пример #16
0
    def __init__(self, conf, conffile, icn):
        self.conf = conf
        self.conffile = conffile
        self.icon = icn
        self.scroll = QScrollArea()
        self.window = QWidget()
        self.separator = QFrame()
        self.scroll.setWindowIcon(QIcon(icn))
        self.layoutV = QVBoxLayout()
        self.layoutH0 = QHBoxLayout()
        self.layoutH0a = QHBoxLayout()
        self.layoutH1 = QHBoxLayout()
        self.layoutH2 = QHBoxLayout()
        self.layoutH3 = QHBoxLayout()
        self.layoutH4 = QHBoxLayout()
        self.layoutH5 = QHBoxLayout()
        self.layoutH6a = QHBoxLayout()
        self.layoutH6b = QHBoxLayout()
        self.layoutH6c = QHBoxLayout()
        self.layoutH6d = QHBoxLayout()
        self.fBold = QFont()
        self.fBold.setBold(True)
        self.scroll.setWindowTitle('Now Playing v1.4.0 - Settings')

        self.scroll.setWidgetResizable(True)
        self.scroll.setWindowFlag(Qt.CustomizeWindowHint, True)
        self.scroll.setWindowFlag(Qt.WindowCloseButtonHint, False)
        # self.scroll.setWindowFlag(Qt.WindowMinMaxButtonsHint, False)
        self.scroll.setWindowFlag(Qt.WindowMinimizeButtonHint, False)
        self.scroll.setWidget(self.window)
        self.scroll.setMinimumWidth(625)
        self.scroll.resize(625, 825)

        # error section
        self.errLabel = QLabel()
        self.errLabel.setStyleSheet('color: red')
        # remote
        self.localLabel = QLabel('Track Retrieval Mode')
        self.localLabel.setFont(self.fBold)
        self.layoutV.addWidget(self.localLabel)
        self.remoteDesc = QLabel(
            'Local mode (default) uses Serato\'s local history log for track data.\
\nRemote mode retrieves remote track data from Serato Live Playlists.')
        self.remoteDesc.setStyleSheet('color: grey')
        self.layoutV.addWidget(self.remoteDesc)
        # radios
        self.localRadio = QRadioButton('Local')
        self.localRadio.setChecked(True)
        self.localRadio.toggled.connect(
            lambda: self.on_radiobutton_select(self.localRadio))
        self.localRadio.setMaximumWidth(60)

        self.remoteRadio = QRadioButton('Remote')
        self.remoteRadio.toggled.connect(
            lambda: self.on_radiobutton_select(self.remoteRadio))
        self.layoutH0.addWidget(self.localRadio)
        self.layoutH0.addWidget(self.remoteRadio)
        self.layoutV.addLayout(self.layoutH0)

        # library path
        self.libLabel = QLabel('Serato Library Path')
        self.libLabel.setFont(self.fBold)
        self.libDesc = QLabel(
            'Location of Serato library folder.\ni.e., \\THE_PATH_TO\\_Serato_'
        )
        self.libDesc.setStyleSheet('color: grey')
        self.layoutV.addWidget(self.libLabel)
        self.layoutV.addWidget(self.libDesc)
        self.libButton = QPushButton('Browse for folder')
        self.layoutH0a.addWidget(self.libButton)
        self.libButton.clicked.connect(self.on_libbutton_clicked)
        self.libEdit = QLineEdit()
        self.layoutH0a.addWidget(self.libEdit)
        self.layoutV.addLayout(self.layoutH0a)
        # url
        self.urlLabel = QLabel('URL')
        self.urlLabel.setFont(self.fBold)
        self.urlDesc = QLabel(
            'Web address of your Serato Playlist.\ne.g., https://serato.com/playlists/USERNAME/live'
        )
        self.urlDesc.setStyleSheet('color: grey')
        self.layoutV.addWidget(self.urlLabel)
        self.urlEdit = QLineEdit()
        self.layoutV.addWidget(self.urlDesc)
        self.layoutV.addWidget(self.urlEdit)
        self.urlLabel.setHidden(True)
        self.urlEdit.setHidden(True)
        self.urlDesc.setHidden(True)
        # separator line
        self.separator.setFrameShape(QFrame.HLine)
        # self.separator.setFrameShadow(QFrame.Sunken)
        self.layoutV.addWidget(self.separator)
        # file
        self.fileLabel = QLabel('File')
        self.fileLabel.setFont(self.fBold)
        self.fileDesc = QLabel(
            'The file to which current track info is written. (Must be plain text: .txt)'
        )
        self.fileDesc.setStyleSheet('color: grey')
        self.layoutV.addWidget(self.fileLabel)
        self.layoutV.addWidget(self.fileDesc)
        self.fileButton = QPushButton('Browse for file')
        self.layoutH1.addWidget(self.fileButton)
        self.fileButton.clicked.connect(self.on_filebutton_clicked)
        self.fileEdit = QLineEdit()
        self.layoutH1.addWidget(self.fileEdit)
        self.layoutV.addLayout(self.layoutH1)
        # interval
        self.intervalLabel = QLabel('Polling Interval')
        self.intervalLabel.setFont(self.fBold)
        self.intervalDesc = QLabel('Amount of time, in seconds, \
that must elapse before checking for new track info. (Default = 10.0)')
        self.intervalDesc.setStyleSheet('color: grey')
        self.layoutV.addWidget(self.intervalLabel)
        self.layoutV.addWidget(self.intervalDesc)
        self.intervalEdit = QLineEdit()
        self.intervalEdit.setMaximumSize(40, 35)
        self.layoutV.addWidget(self.intervalEdit)
        self.intervalLabel.setHidden(True)
        self.intervalDesc.setHidden(True)
        self.intervalEdit.setHidden(True)
        # delay
        self.delayLabel = QLabel('Write Delay')
        self.delayLabel.setFont(self.fBold)
        self.delayDesc = QLabel('Amount of time, in seconds, \
to delay writing the new track info once it\'s retrieved. (Default = 0)')
        self.delayDesc.setStyleSheet('color: grey')
        self.layoutV.addWidget(self.delayLabel)
        self.layoutV.addWidget(self.delayDesc)
        self.delayEdit = QLineEdit()
        self.delayEdit.setMaximumWidth(40)
        self.layoutV.addWidget(self.delayEdit)
        # multi-line
        self.multiLabel = QLabel('Multiple Line Indicator')
        self.multiLabel.setFont(self.fBold)
        self.layoutV.addWidget(self.multiLabel)
        self.multiCbox = QCheckBox()
        self.multiCbox.setMaximumWidth(25)
        self.layoutH2.addWidget(self.multiCbox)
        self.multiDesc = QLabel('Write Artist and Song \
data on separate lines.')
        self.multiDesc.setStyleSheet('color: grey')
        self.layoutH2.addWidget(self.multiDesc)
        self.layoutV.addLayout(self.layoutH2)
        # quotes
        self.quoteLabel = QLabel('Song Quote Indicator')
        self.quoteLabel.setFont(self.fBold)
        self.layoutV.addWidget(self.quoteLabel)
        self.quoteCbox = QCheckBox()
        self.quoteCbox.setMaximumWidth(25)
        self.layoutH3.addWidget(self.quoteCbox)
        self.quoteDesc = QLabel('Surround the song title \
with quotes.')
        self.quoteDesc.setStyleSheet('color: grey')
        self.layoutH3.addWidget(self.quoteDesc)
        self.layoutV.addLayout(self.layoutH3)
        # prefixes
        self.prefixLabel = QLabel('Prefixes')
        self.prefixLabel.setFont(self.fBold)
        self.layoutV.addWidget(self.prefixLabel)
        self.a_prefixDesc = QLabel(
            'Artist - String to be written before artist info.')
        self.a_prefixDesc.setStyleSheet('color: grey')
        self.s_prefixDesc = QLabel(
            'Song - String to be written before song info.')
        self.s_prefixDesc.setStyleSheet('color: grey')
        self.layoutH6a.addWidget(self.a_prefixDesc)
        self.layoutH6a.addWidget(self.s_prefixDesc)
        self.a_prefixEdit = QLineEdit()
        self.s_prefixEdit = QLineEdit()
        self.layoutH6b.addWidget(self.a_prefixEdit)
        self.layoutH6b.addWidget(self.s_prefixEdit)
        self.layoutV.addLayout(self.layoutH6a)
        self.layoutV.addLayout(self.layoutH6b)
        # suffixes
        self.suffixLabel = QLabel('Suffixes')
        self.suffixLabel.setFont(self.fBold)
        self.layoutV.addWidget(self.suffixLabel)
        self.a_suffixDesc = QLabel(
            'Artist - String to be written after artist info.')
        self.a_suffixDesc.setStyleSheet('color: grey')
        self.s_suffixDesc = QLabel(
            'Song - String to be written after song info.')
        self.s_suffixDesc.setStyleSheet('color: grey')
        self.layoutH6c.addWidget(self.a_suffixDesc)
        self.layoutH6c.addWidget(self.s_suffixDesc)
        self.a_suffixEdit = QLineEdit()
        self.s_suffixEdit = QLineEdit()
        self.layoutH6d.addWidget(self.a_suffixEdit)
        self.layoutH6d.addWidget(self.s_suffixEdit)
        self.layoutV.addLayout(self.layoutH6c)
        self.layoutV.addLayout(self.layoutH6d)
        # notify
        self.notifLabel = QLabel('Notification Indicator')
        self.notifLabel.setFont(self.fBold)
        self.layoutV.addWidget(self.notifLabel)
        self.notifCbox = QCheckBox()
        self.notifCbox.setMaximumWidth(25)
        self.layoutH5.addWidget(self.notifCbox)
        self.notifDesc = QLabel('Show OS system notification \
when new song is retrieved.')
        self.notifDesc.setStyleSheet('color: grey')
        self.layoutH5.addWidget(self.notifDesc)
        self.layoutV.addLayout(self.layoutH5)
        # error area
        self.layoutV.addWidget(self.errLabel)
        # cancel btn
        self.cancelButton = QPushButton('Cancel')
        self.cancelButton.setMaximumSize(80, 35)
        self.layoutH4.addWidget(self.cancelButton)
        self.cancelButton.clicked.connect(self.on_cancelbutton_clicked)
        # save btn
        self.saveButton = QPushButton('Save')
        self.saveButton.setMaximumSize(80, 35)
        self.layoutH4.addWidget(self.saveButton)
        self.saveButton.clicked.connect(self.on_savebutton_clicked)
        self.layoutV.addLayout(self.layoutH4)

        self.window.setLayout(self.layoutV)
Пример #17
0
    def initUi(self):
        #::--------------------------------------------------------------
        #  We create the type of layout QVBoxLayout (Vertical Layout )
        #  This type of layout comes from QWidget
        #::--------------------------------------------------------------
        self.v = "24 Categories"
        self.setWindowTitle(self.Title)
        self.main_widget = QWidget(self)
        self.layout = QVBoxLayout(self.main_widget)  # Creates vertical layout

        self.groupBox1 = QGroupBox('Number of Categories')
        self.groupBox1Layout = QHBoxLayout()
        self.groupBox1.setLayout(self.groupBox1Layout)

        self.groupBox2 = QGroupBox('Accuracy and MSE')
        self.groupBox2Layout = QGridLayout()
        self.groupBox2.setLayout(self.groupBox2Layout)

        self.label1 = QLabel("Accuracy: ")
        self.label2 = QLabel("MSE: ")
        self.label3 = QLabel("Accuracy: ")
        #self.label4 = QLabel("MSE: 0.05")

        self.groupBox2Layout.addWidget(self.label1, 0, 0)
        self.groupBox2Layout.addWidget(self.label2, 1, 0)
        self.groupBox2Layout.addWidget(self.label3, 0, 1)
        #self.groupBox2Layout.addWidget(self.label4, 1, 1)

        self.groupBox3 = QGroupBox('Graphic')
        self.groupBox3Layout = QVBoxLayout()
        self.groupBox3.setLayout(self.groupBox3Layout)

        # Radio buttons are create to be added to the second group

        self.b1 = QRadioButton("24 Categories")
        self.b1.setChecked(True)
        self.b1.toggled.connect(self.onClicked)

        self.b2 = QRadioButton("3 Categories")
        self.b2.toggled.connect(self.onClicked)

        self.buttonlabel = QLabel(self.v + ' is selected')

        self.groupBox1Layout.addWidget(self.b1)
        self.groupBox1Layout.addWidget(self.b2)
        self.groupBox1Layout.addWidget(self.buttonlabel)

        # figure and canvas figure to draw the graph is created to
        self.fig = Figure()
        self.ax1 = self.fig.add_subplot(111)
        self.canvas = FigureCanvas(self.fig)

        self.canvas.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)

        self.canvas.updateGeometry()

        # Canvas is added to the third group box
        self.groupBox3Layout.addWidget(self.canvas)

        # Adding to the main layout the groupboxes
        self.layout.addWidget(self.groupBox1)
        self.layout.addWidget(self.groupBox2)
        self.layout.addWidget(self.groupBox3)

        self.setCentralWidget(
            self.main_widget)  # Creates the window with all the elements
        self.resize(600, 500)  # Resize the window
        self.onClicked()
Пример #18
0
    def createFirstGroupBox(self):

        self.firstGroupBox = QGroupBox("Stream")

        serverIpLabel = QLabel("Server IP")
        serverPortLabel = QLabel("Server Port")
        multicastLabel = QLabel("Multicast Addr")
        localIpLabel = QLabel("Local IP Addr")

        self.serverIpLineEdit = QLineEdit(self.serverIpAddress)
        self.serverPortLineEdit = QLineEdit(self.serverPort)
        self.multicastLineEdit = QLineEdit(self.multicastAddress)
        self.localIpAddressEdit = QLineEdit(self.localIpAddress)

        sep = QFrame()
        sep.setFrameShape(QFrame.HLine)
        sep2 = QFrame()
        sep2.setFrameShape(QFrame.HLine)

        sep.setContentsMargins(10, 100, 10, 100)
        sep2.setContentsMargins(10, 100, 10, 100)

        targetIpLabel = QLabel("Target IP")
        targetPortLabel = QLabel("Target Port")

        self.targetIpLineEdit = QLineEdit(self.targetIpAddress)
        self.targetPortLineEdit = QLineEdit(self.targetPort)

        streamStatusLabel = QLabel("Status")

        self.radioButtonStreamConnected = QRadioButton("Connected")
        self.radioButtonStreamDisconnected = QRadioButton("Disconnected")
        self.radioButtonStreamConnected.setEnabled(False)
        self.radioButtonStreamDisconnected.setEnabled(False)
        self.radioButtonStreamDisconnected.setChecked(True)

        toggleStreamButton = QPushButton("Toggle Stream")
        toggleStreamButton.clicked.connect(self.toggleStream)
        toggleStreamButton.setCheckable(True)
        toggleStreamButton.setChecked(False)

        layout = QGridLayout()

        layout.addWidget(serverIpLabel, 0, 0, 1, 1)
        layout.addWidget(self.serverIpLineEdit, 0, 1, 1, 1)
        layout.addWidget(serverPortLabel, 1, 0, 1, 1)
        layout.addWidget(self.serverPortLineEdit, 1, 1, 1, 1)

        layout.addWidget(multicastLabel, 2, 0, 1, 1)
        layout.addWidget(self.multicastLineEdit, 2, 1, 1, 1)

        layout.addWidget(localIpLabel, 3, 0, 1, 1)
        layout.addWidget(self.localIpAddressEdit, 3, 1, 1, 1)

        layout.addWidget(sep, 4, 0, 1, 2)

        layout.addWidget(targetIpLabel, 5, 0, 1, 1)
        layout.addWidget(self.targetIpLineEdit, 5, 1, 1, 1)
        layout.addWidget(targetPortLabel, 6, 0, 1, 1)
        layout.addWidget(self.targetPortLineEdit, 6, 1, 1, 1)

        layout.addWidget(sep2, 7, 0, 1, 2)

        layout.addWidget(streamStatusLabel, 8, 0, 2, 1)
        layout.addWidget(self.radioButtonStreamConnected, 8, 1, 1, 1)
        layout.addWidget(self.radioButtonStreamDisconnected, 9, 1, 1, 1)
        layout.addWidget(toggleStreamButton, 10, 0, 1, 2)

        layout.setRowStretch(7, 1)

        self.firstGroupBox.setLayout(layout)
Пример #19
0
questions_list = [] 
questions_list.append(
        Question('Государственный язык Бразилии', 'Португальский', 'Английский', 'Испанский', 'Бразильский'))
questions_list.append(
        Question('Какого цвета нет на флаге России?', 'Зелёный', 'Красный', 'Белый', 'Синий'))
questions_list.append(
        Question('Национальная хижина якутов', 'Ураса', 'Юрта', 'Иглу', 'Хата'))
 
app = QApplication([])
 
btn_OK = QPushButton('Ответить') # кнопка ответа
lb_Question = QLabel('Самый сложный вопрос в мире!') # текст вопроса
 
RadioGroupBox = QGroupBox("Варианты ответов") # группа на экране для переключателей с ответами
 
rbtn_1 = QRadioButton('Вариант 1')
rbtn_2 = QRadioButton('Вариант 2')
rbtn_3 = QRadioButton('Вариант 3')
rbtn_4 = QRadioButton('Вариант 4')
 
RadioGroup = QButtonGroup() # это для группировки переключателей, чтобы управлять их поведением
RadioGroup.addButton(rbtn_1)
RadioGroup.addButton(rbtn_2)
RadioGroup.addButton(rbtn_3)
RadioGroup.addButton(rbtn_4)
 
layout_ans1 = QHBoxLayout()   
layout_ans2 = QVBoxLayout() # вертикальные будут внутри горизонтального
layout_ans3 = QVBoxLayout()
layout_ans2.addWidget(rbtn_1) # два ответа в первый столбец
layout_ans2.addWidget(rbtn_2)
Пример #20
0
    def _getGeneralTab(self):
        highlightKeyLabel = QLabel('Highlight Key')
        extractKeyLabel = QLabel('Extract Key')
        removeKeyLabel = QLabel('Remove Key')
        undoKeyLabel = QLabel('Undo Key')

        self.extractKeyComboBox = QComboBox()
        self.highlightKeyComboBox = QComboBox()
        self.removeKeyComboBox = QComboBox()
        self.undoKeyComboBox = QComboBox()

        keys = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789')
        for comboBox in [
                self.highlightKeyComboBox, self.extractKeyComboBox,
                self.removeKeyComboBox, self.undoKeyComboBox
        ]:
            comboBox.addItems(keys)

        self._setCurrentKeys()

        highlightKeyLayout = QHBoxLayout()
        highlightKeyLayout.addWidget(highlightKeyLabel)
        highlightKeyLayout.addStretch()
        highlightKeyLayout.addWidget(self.highlightKeyComboBox)

        extractKeyLayout = QHBoxLayout()
        extractKeyLayout.addWidget(extractKeyLabel)
        extractKeyLayout.addStretch()
        extractKeyLayout.addWidget(self.extractKeyComboBox)

        removeKeyLayout = QHBoxLayout()
        removeKeyLayout.addWidget(removeKeyLabel)
        removeKeyLayout.addStretch()
        removeKeyLayout.addWidget(self.removeKeyComboBox)

        undoKeyLayout = QHBoxLayout()
        undoKeyLayout.addWidget(undoKeyLabel)
        undoKeyLayout.addStretch()
        undoKeyLayout.addWidget(self.undoKeyComboBox)

        controlsLayout = QVBoxLayout()
        controlsLayout.addLayout(highlightKeyLayout)
        controlsLayout.addLayout(extractKeyLayout)
        controlsLayout.addLayout(removeKeyLayout)
        controlsLayout.addLayout(undoKeyLayout)
        controlsLayout.addStretch()

        controlsGroupBox = QGroupBox('Basic Controls')
        controlsGroupBox.setLayout(controlsLayout)

        widthLabel = QLabel('Card Width Limit:')
        self.widthEditBox = QLineEdit()
        self.widthEditBox.setFixedWidth(50)
        self.widthEditBox.setText(str(self.settings['maxWidth']))
        pixelsLabel = QLabel('pixels')

        widthEditLayout = QHBoxLayout()
        widthEditLayout.addWidget(widthLabel)
        widthEditLayout.addWidget(self.widthEditBox)
        widthEditLayout.addWidget(pixelsLabel)

        applyLabel = QLabel('Apply to')
        self.limitAllCardsButton = QRadioButton('All Cards')
        self.limitIrCardsButton = QRadioButton('IR Cards')
        limitNoneButton = QRadioButton('None')

        if self.settings['limitWidth'] and self.settings['limitWidthAll']:
            self.limitAllCardsButton.setChecked(True)
        elif self.settings['limitWidth']:
            self.limitIrCardsButton.setChecked(True)
        else:
            limitNoneButton.setChecked(True)

        applyLayout = QHBoxLayout()
        applyLayout.addWidget(applyLabel)
        applyLayout.addWidget(self.limitAllCardsButton)
        applyLayout.addWidget(self.limitIrCardsButton)
        applyLayout.addWidget(limitNoneButton)

        displayLayout = QVBoxLayout()
        displayLayout.addLayout(widthEditLayout)
        displayLayout.addLayout(applyLayout)
        displayLayout.addStretch()

        displayGroupBox = QGroupBox('Display')
        displayGroupBox.setLayout(displayLayout)

        layout = QHBoxLayout()
        layout.addWidget(controlsGroupBox)
        layout.addWidget(displayGroupBox)

        tab = QWidget()
        tab.setLayout(layout)

        return tab
Пример #21
0
    def createMidBottomGroupBox(self):
        self.midBottomGroupBox = QGroupBox('Exposure Modes')

        self.autoExp = QRadioButton()
        self.autoExp.setText('auto')
        self.autoExp.toggled.connect(lambda: self.btnstate(self.autoExp))

        self.nightExp = QRadioButton()
        self.nightExp.setText('night')
        self.nightExp.toggled.connect(lambda: self.btnstate(self.nightExp))

        self.offExp = QRadioButton()
        self.offExp.setText('off')
        self.offExp.toggled.connect(lambda: self.btnstate(self.offExp))

        self.defaultExp = QRadioButton()
        self.defaultExp.setText('default')
        self.defaultExp.toggled.connect(lambda: self.btnstate(self.defaultExp))

        self.sportsExp = QRadioButton()
        self.sportsExp.setText('sports')
        self.sportsExp.toggled.connect(lambda: self.btnstate(self.sportsExp))

        self.longExp = QRadioButton()
        self.longExp.setText('verylong')
        self.longExp.toggled.connect(lambda: self.btnstate(self.longExp))

        self.spotExp = QRadioButton()
        self.spotExp.setText('spotlight')
        self.spotExp.toggled.connect(lambda: self.btnstate(self.spotExp))

        self.backExp = QRadioButton()
        self.backExp.setText('backlight')
        self.backExp.toggled.connect(lambda: self.btnstate(self.backExp))

        self.fireExp = QRadioButton()
        self.fireExp.setText('fireworks')
        self.fireExp.toggled.connect(lambda: self.btnstate(self.fireExp))

        self.antiExp = QRadioButton()
        self.antiExp.setText('antishake')
        self.antiExp.toggled.connect(lambda: self.btnstate(self.antiExp))

        self.fixedExp = QRadioButton()
        self.fixedExp.setText('fixedfps')
        self.fixedExp.toggled.connect(lambda: self.btnstate(self.fixedExp))

        self.beachExp = QRadioButton()
        self.beachExp.setText('beach')
        self.beachExp.toggled.connect(lambda: self.btnstate(self.beachExp))

        self.snowExp = QRadioButton()
        self.snowExp.setText('snow')
        self.snowExp.toggled.connect(lambda: self.btnstate(self.snowExp))

        self.nightpExp = QRadioButton()
        self.nightpExp.setText('nightpreview')
        self.nightpExp.toggled.connect(lambda: self.btnstate(self.nightpExp))

        self.defaultExp.setChecked(True)

        hbox1 = QHBoxLayout()
        hbox1.addWidget(self.autoExp)
        hbox1.addWidget(self.longExp)
        hbox1.addWidget(self.nightExp)
        hbox1.addWidget(self.defaultExp)
        hbox1.addWidget(self.spotExp)
        hbox1.addWidget(self.sportsExp)
        hbox1.addWidget(self.offExp)

        hbox2 = QHBoxLayout()
        hbox2.addWidget(self.backExp)
        hbox2.addWidget(self.fireExp)
        hbox2.addWidget(self.antiExp)
        hbox2.addWidget(self.fixedExp)
        hbox2.addWidget(self.beachExp)
        hbox2.addWidget(self.snowExp)
        hbox2.addWidget(self.nightpExp)

        layout = QVBoxLayout()
        layout.addLayout(hbox1)
        layout.addLayout(hbox2)
        layout.addStretch(1)
        self.midBottomGroupBox.setLayout(layout)
Пример #22
0
    def initUI(self):

    #--- Первый блок ---

        f_b_h = QHBoxLayout()

        f_f_b_v = QVBoxLayout()
         #--- Заключение ---
        zakl = QLabel('Заключение №')
        zaklEdit = QLineEdit()
        zakl_h = QHBoxLayout()
        zakl_h.addWidget(zakl)
        zakl_h.addWidget(zaklEdit)
        f_f_b_v.addLayout(zakl_h)

         #--- Состояние работы ---
        cow = QLabel('Состояние работы')
        cowEdit = QComboBox(self)
        cowEdit.addItem("Все плохло")
        cowEdit.addItem("Все очень плохло")
        cow_h = QHBoxLayout()
        cow_h.addWidget(cow)
        cow_h.addWidget(cowEdit)
        f_f_b_v.addLayout(cow_h)

        s_f_b_v = QVBoxLayout()
         #--- Объект ---
        object = QLabel('Объект')
        objectEdit = QComboBox(self)
        objectEdit.addItem("Все плохло")
        objectEdit.addItem("Все очень плохло")
        object_h = QHBoxLayout()
        object_h.addWidget(object)
        object_h.addWidget(objectEdit)
        s_f_b_v.addLayout(object_h)

         #--- Металловед ---
        meved = QLabel('Металловед')
        mevedEdit = QComboBox(self)
        mevedEdit.addItem("Все плохло")
        mevedEdit.addItem("Все очень плохло")
        meved_h = QHBoxLayout()
        meved_h.addWidget(meved)
        meved_h.addWidget(mevedEdit)
        s_f_b_v.addLayout(meved_h)

        t_f_b_v = QVBoxLayout()
         #--- Исследование ---
        issl = QRadioButton('Исследование')
        t_f_b_v.addWidget(issl)

         #--- Разрушение ---
        destr = QRadioButton('Разрушение')
        t_f_b_v.addWidget(destr)

         #--- Расчет ---
        math = QRadioButton('Расчет')
        t_f_b_v.addWidget(math)

        f_b_h.addLayout(f_f_b_v)
        f_b_h.addLayout(s_f_b_v)
        f_b_h.addLayout(t_f_b_v)

    #--- Второй блок ---

        s_b_h = QHBoxLayout()

        f_s_b_h = QHBoxLayout()
         #--- Дата заявки ---
        dateZ = QLabel('Дата заявки')
        dateZEdit = QLineEdit()
        f_s_b_h.addWidget(dateZ)
        f_s_b_h.addWidget(dateZEdit)

        s_s_b_h = QHBoxLayout()
         #--- Дата выдачи ---
        dateG = QLabel('Дата выдачи')
        dateGEdit = QLineEdit()
        s_s_b_h.addWidget(dateG)
        s_s_b_h.addWidget(dateGEdit)

        t_s_b_h = QHBoxLayout()
         #--- Дата разрушения ---
        dateD = QLabel('Дата разрушения')
        dateDEdit = QLineEdit()
        t_s_b_h.addWidget(dateD)
        t_s_b_h.addWidget(dateDEdit)

        s_b_h.addLayout(f_s_b_h)
        s_b_h.addLayout(s_s_b_h)
        s_b_h.addLayout(t_s_b_h)

    #--- Третий блок ---

        t_b_v = QVBoxLayout

        f_t_b_h = QHBoxLayout()
         #--- Агрегат ---
        agr = QLabel('Агрегат')
        agrEdit = QComboBox(self)
        agrEdit.addItem("Все плохло")
        agrEdit.addItem("Все очень плохло")
        arg_h = QHBoxLayout()
        arg_h.addWidget(agr)
        arg_h.addWidget(agrEdit)

         #--- № ---
        nmbr = QLabel('№')
        nmbrEdit = QLineEdit()
        nmbr_h = QHBoxLayout()
        nmbr_h.addWidget(nmbr)
        nmbr_h.addWidget(nmbrEdit)

         #--- Узел ---
        uzl = QLabel('Узел')
        uzlEdit = QLineEdit()
        uzl_h = QHBoxLayout()
        uzl_h.addWidget(uzl)
        uzl_h.addWidget(uzlEdit)

        t_f_b_v.addLayout(arg_h)
        t_f_b_v.addLayout(nmbr_h)
        t_f_b_v.addLayout(uzl_h)

        s_t_b_h = QHBoxLayout()
         #--- Что-то ---
        smth = QLabel('Что-то')
        smthEdit = QLineEdit()
        smth_h = QHBoxLayout()
        smth_h.addWidget(smth)
        smth_h.addWidget(smthEdit)

         #--- Название ---
        name = QLabel('Название')
        nameEdit = QComboBox(self)
        nameEdit.addItem("Все плохло")
        nameEdit.addItem("Все очень плохло")
        name_h = QHBoxLayout()
        name_h.addWidget(name)
        name_h.addWidget(nameEdit)

        t_b_v.addLayout(f_t_b_h)
        t_b_v.addLayout(s_t_b_h)

    #---#  Четвертый блок ---

        fo_b_h = QHBoxLayout()

        f_fo_b_v = QVBoxLayout()
         #--- Причина ----
        rsn = QLabel('Причина')
        rsnEdit = QTextEdit()
        rsn_v = QVBoxLayout()
        rsn_v.addWidget(rsn)
        rsn_v.addWidget(rsnEdit)

         #--- Рекомендации ----
        dvs = QLabel('Рекомендации')
        dvsEdit = QTextEdit()
        dvs_v = QVBoxLayout()
        dvs_v.addWidget(dvs)
        dvs_v.addWidget(dvsEdit)

        f_fo_b_v.addLayout(rsn_v)
        f_fo_b_v.addLayout(dvs_v)

        s_fo_b_v = QVBoxLayout()
         #--- Выводы ----
        cncl = QLabel('Выводы')
        cnclEdit = QTextEdit()
        cncl_v = QVBoxLayout()
        cncl_v.addWidget(cncl)
        cncl_v.addWidget(cnclEdit)

         #--- Примечание ----
        pls = QLabel('Примечание')
        plsEdit = QTextEdit()
        pls_v = QVBoxLayout()
        pls_v.addWidget(pls)
        pls_v.addWidget(plsEdit)

        s_fo_b_v.addLayout(cncl_v)
        s_fo_b_v.addLayout(pls_v)

        fo_b_h.addLayout(f_fo_b_v)
        fo_b_h.addLayout(s_fo_b_v)


        v_block = QHBoxLayout()
        v_block.addLayout(f_b_h)
        v_block.addLayout(s_b_h)
        v_block.addLayout(t_b_v)
        v_block.addLayout(fo_b_h)

        #okButton.setStyleSheet("background-color: #334761; color: white;"
         #                      "font-family: Verdana; font-size: 16px;"
          #                     "margin: 0px 10px 0px 10px")

        self.setLayout(v_block)
        v_block.setStretch(1)

        self.setAutoFillBackground(True)
        p = self.palette()
        p.setColor(self.backgroundRole(), QColor(192, 192, 192))
        self.setPalette(p)

        self.setGeometry(300, 300, 800, 750)
        self.setWindowTitle('Register form')
        self.show()
Пример #23
0
    def setupUi(self, Widget):

        # widget rysujący ksztalty, instancja klasy Ksztalt
        self.ksztalt1 = Ksztalt(self, Ksztalty.Polygon)
        self.ksztalt2 = Ksztalt(self, Ksztalty.Ellipse)
        self.ksztaltAktywny = self.ksztalt1

        # przyciski CheckBox
        uklad = QVBoxLayout()  # układ pionowy
        self.grupaChk = QButtonGroup()
        for i, v in enumerate(('Kwadrat', 'Koło', 'Trójkąt', 'Linia')):
            self.chk = QCheckBox(v)
            self.grupaChk.addButton(self.chk, i)
            uklad.addWidget(self.chk)
        self.grupaChk.buttons()[self.ksztaltAktywny.ksztalt].setChecked(True)
        # CheckBox do wyboru aktywnego kształtu
        self.ksztaltChk = QCheckBox('<=')
        self.ksztaltChk.setChecked(True)
        uklad.addWidget(self.ksztaltChk)

        # układ poziomy dla kształtów oraz przycisków CheckBox
        ukladH1 = QHBoxLayout()
        ukladH1.addWidget(self.ksztalt1)
        ukladH1.addLayout(uklad)
        ukladH1.addWidget(self.ksztalt2)
        # koniec CheckBox

        # Slider i LCDNumber
        self.suwak = QSlider(Qt.Horizontal)
        self.suwak.setMinimum(0)
        self.suwak.setMaximum(255)
        self.lcd = QLCDNumber()
        self.lcd.setSegmentStyle(QLCDNumber.Flat)
        # układ poziomy (splitter) dla slajdera i lcd
        ukladH2 = QSplitter(Qt.Horizontal, self)
        ukladH2.addWidget(self.suwak)
        ukladH2.addWidget(self.lcd)
        ukladH2.setSizes((125, 75))

        # przyciski RadioButton
        self.ukladR = QHBoxLayout()
        for v in ('R', 'G', 'B'):
            self.radio = QRadioButton(v)
            self.ukladR.addWidget(self.radio)
        self.ukladR.itemAt(0).widget().setChecked(True)
        # grupujemy przyciski
        self.grupaRBtn = QGroupBox('Opcje RGB')
        self.grupaRBtn.setLayout(self.ukladR)
        self.grupaRBtn.setObjectName('Radio')
        self.grupaRBtn.setCheckable(True)
        # układ poziomy dla grupy Radio
        ukladH3 = QHBoxLayout()
        ukladH3.addWidget(self.grupaRBtn)

        # Lista ComboBox i SpinBox ###
        self.listaRGB = QComboBox(self)
        for v in ('R', 'G', 'B'):
            self.listaRGB.addItem(v)
        self.listaRGB.setEnabled(False)
        # SpinBox
        self.spinRGB = QSpinBox()
        self.spinRGB.setMinimum(0)
        self.spinRGB.setMaximum(255)
        self.spinRGB.setEnabled(False)
        # układ pionowy dla ComboBox i SpinBox
        uklad = QVBoxLayout()
        uklad.addWidget(self.listaRGB)
        uklad.addWidget(self.spinRGB)
        # do układu poziomego grupy Radio dodajemy układ ComboBox i SpinBox
        ukladH3.insertSpacing(1, 25)
        ukladH3.addLayout(uklad)
        # koniec ComboBox i SpinBox ###

        # przyciski PushButton ###
        self.ukladP = QHBoxLayout()
        self.grupaP = QButtonGroup()
        self.grupaP.setExclusive(False)
        for v in ('R', 'G', 'B'):
            self.btn = QPushButton(v)
            self.btn.setCheckable(True)
            self.grupaP.addButton(self.btn)
            self.ukladP.addWidget(self.btn)
        # grupujemy przyciski
        self.grupaPBtn = QGroupBox('Przyciski RGB')
        self.grupaPBtn.setLayout(self.ukladP)
        self.grupaPBtn.setObjectName('Push')
        self.grupaPBtn.setCheckable(True)
        self.grupaPBtn.setChecked(False)
        # koniec PushButton ###

        # etykiety QLabel i pola QLineEdit ###
        ukladH4 = QHBoxLayout()
        self.labelR = QLabel('R')
        self.labelG = QLabel('G')
        self.labelB = QLabel('B')
        self.kolorR = QLineEdit('0')
        self.kolorG = QLineEdit('0')
        self.kolorB = QLineEdit('0')
        for v in ('R', 'G', 'B'):
            label = getattr(self, 'label' + v)
            kolor = getattr(self, 'kolor' + v)
            if v == 'R':
                label.setStyleSheet("QWidget { font-weight: bold }")
                kolor.setEnabled(True)
            else:
                label.setStyleSheet("QWidget { font-weight: normal }")
                kolor.setEnabled(False)
            ukladH4.addWidget(label)
            ukladH4.addWidget(kolor)
            kolor.setMaxLength(3)
        # koniec QLabel i QLineEdit ###

        # główny układ okna, pionowy
        ukladOkna = QVBoxLayout()
        ukladOkna.addLayout(ukladH1)
        ukladOkna.addWidget(ukladH2)
        ukladOkna.addLayout(ukladH3)
        ukladOkna.addWidget(self.grupaPBtn)
        ukladOkna.addLayout(ukladH4)

        self.setLayout(ukladOkna)
        self.setWindowTitle('Widżety')
Пример #24
0
    def __init__(self, parent):
        super(Settings, self).__init__(parent)
        self.parent = parent

        self.setWindowTitle("Settings")
        self.setWindowIcon(QtGui.QIcon("res/icons/leapmymouse.png"))

        self.resize(500, 150)
        self.setFixedSize(self.size())

        layout = QGridLayout()
        self.label_1 = QLabel()
        self.label_1.setText("label1")

        hbox = QHBoxLayout()
        self.label_2 = QLabel()
        self.label_2.setText("Startup folder")
        self.startup_textarea = QLineEdit()
        self.startup_textarea.setText(parent.configuration.startup_path)
        self.startup_textarea.setFocus(False)
        self.button_startup_folder = QPushButton()
        self.button_startup_folder.setText("Set")
        self.button_startup_folder.setStyleSheet("""
            image: none;
            color: black;
            padding-top: 0px;
            padding-bottom: 0px;
            padding-left: 7px;
            padding-right: 7px;
            """)
        self.button_startup_folder.clicked.connect(self.set_startup_folder)
        hbox.addWidget(self.label_2)
        hbox.addWidget(self.startup_textarea)
        hbox.addWidget(self.button_startup_folder)

        hbox2 = QHBoxLayout()
        self.label_3 = QLabel()
        self.label_3.setText("Vertical scroll up/down angles")
        self.combo_box1 = QComboBox()
        self.combo_box1.addItem("47 -13 (default)")
        self.combo_box1.addItem("52 -18")
        self.combo_box1.addItem("57 -23")
        self.combo_box1.currentIndexChanged["int"].connect(
            self.combo_box1_changed)
        hbox2.addWidget(self.label_3)
        hbox2.addWidget(self.combo_box1)

        hbox5 = QHBoxLayout()
        self.label_5 = QLabel()
        self.label_5.setText("Vscroll speed")
        self.combo_box3 = QComboBox()
        self.combo_box3.addItem("slower")
        self.combo_box3.addItem("slow")
        self.combo_box3.addItem("normal (default)")
        self.combo_box3.addItem("fast")
        self.combo_box3.addItem("faster")
        self.combo_box3.currentIndexChanged["int"].connect(
            self.combo_box3_changed)
        hbox5.addWidget(self.label_5)
        hbox5.addWidget(self.combo_box3)

        hbox3 = QHBoxLayout()
        self.label_4 = QLabel()
        self.label_4.setText("Invert mouse")
        rb_group = QButtonGroup(self)
        self.radiobutton_yes = QRadioButton()
        self.radiobutton_no = QRadioButton()
        self.radiobutton_yes.setText("Yes")
        self.radiobutton_no.setText("No")
        self.radiobutton_no.setChecked(True)
        self.radiobutton_yes.toggled.connect(
            lambda: self.radiobutton_ch("yes"))
        self.radiobutton_no.toggled.connect(lambda: self.radiobutton_ch("no"))
        rb_group.addButton(self.radiobutton_yes)
        rb_group.addButton(self.radiobutton_no)
        hbox3.addWidget(self.label_4, 20)
        hbox3.addWidget(self.radiobutton_yes, 10)
        hbox3.addWidget(self.radiobutton_no, 10)

        hbox4 = QHBoxLayout()
        self.label_4 = QLabel()
        self.label_4.setText("Mouse movement speed")
        self.combo_box2 = QComboBox()
        self.combo_box2.addItem("slow")
        self.combo_box2.addItem("normal (default)")
        self.combo_box2.addItem("fast")
        self.combo_box2.currentIndexChanged["int"].connect(
            self.combo_box2_changed)
        hbox4.addWidget(self.label_4)
        hbox4.addWidget(self.combo_box2)

        layout.addLayout(hbox, 1, 0)
        layout.setRowStretch(10, 0)
        layout.addLayout(hbox2, 2, 0)
        layout.addLayout(hbox3, 4, 0)
        layout.addLayout(hbox4, 5, 0)
        layout.addLayout(hbox5, 6, 0)

        self.setLayout(layout)
    def __init__(self):
        super().__init__()
        self.setWindowTitle("Rogudator's speech bubble generator")
        mainLayout = QVBoxLayout()

        self.addOnPage = QPushButton("Add on Page")
        mainLayout.addWidget(self.addOnPage)

        previewLabel = QLabel("Preview")
        mainLayout.addWidget(previewLabel)

        self.preview = QSvgWidget(self)
        self.preview.setMinimumHeight(200)
        #self.preview.setAspectRatioMode(Qt.AspectRatioMode.KeepAspectRatio)
        mainLayout.addWidget(self.preview)

        bubbleTypes = QGroupBox()
        bubbleTypes.setTitle("Bubble type")
        bubbleTypesLayout = QHBoxLayout()
        self.squareBubble = QRadioButton(self)
        self.squareBubble.setText("Square")
        bubbleTypesLayout.addWidget(self.squareBubble)
        self.roundBubble = QRadioButton(self)
        self.roundBubble.setText("Round")
        self.roundBubble.setChecked(True)
        bubbleTypesLayout.addWidget(self.roundBubble)
        bubbleTypes.setLayout(bubbleTypesLayout)
        self.bubbleColorButton = QPushButton(self)
        self.bubbleColor = QColor("white")
        bubbleColorImage = QPixmap(32, 32)
        bubbleColorImage.fill(self.bubbleColor)
        bubbleColorIcon = QIcon(bubbleColorImage)
        self.bubbleColorButton.setIcon(bubbleColorIcon)
        self.bubbleColorButton.setFixedWidth(self.bubbleColorButton.height())
        bubbleTypesLayout.addWidget(self.bubbleColorButton)
        mainLayout.addWidget(bubbleTypes)

        outlineSize = QGroupBox("Outline")
        outlineSliderAndSpinBox = QHBoxLayout()
        self.outlineSlider = QSlider(self)
        self.outlineSlider.setMinimum(0)
        self.outlineSlider.setMaximum(10)
        self.outlineSlider.setValue(3)
        self.outlineSlider.setOrientation(Qt.Orientation.Horizontal)
        outlineSliderAndSpinBox.addWidget(self.outlineSlider)
        self.outlineSpinBox = QSpinBox(self)
        self.outlineSpinBox.setMinimum(0)
        self.outlineSpinBox.setValue(3)
        outlineSliderAndSpinBox.addWidget(self.outlineSpinBox)
        self.outlineColorButton = QPushButton(self)
        self.outlineColor = QColor("black")
        outlineColorImage = QPixmap(32, 32)
        outlineColorImage.fill(self.outlineColor)
        outlineColorIcon = QIcon(outlineColorImage)
        self.outlineColorButton.setIcon(outlineColorIcon)
        self.outlineColorButton.setFixedWidth(self.outlineColorButton.height())
        outlineSliderAndSpinBox.addWidget(self.outlineColorButton)
        outlineSize.setLayout(outlineSliderAndSpinBox)
        mainLayout.addWidget(outlineSize)

        speechGroup = QGroupBox("Speech")
        speechGroupLayout = QVBoxLayout()

        fontRow = QHBoxLayout()

        self.speechFont = QFontComboBox(self)
        fontRow.addWidget(self.speechFont)

        self.speechFontSize = QSpinBox(self)
        self.speechFontSize.setValue(14)
        self.speechFontSize.setMinimum(1)
        fontRow.addWidget(self.speechFontSize)

        self.currentFontColorButton = QPushButton(self)
        self.speechFontColor = QColor("black")
        fontColorImage = QPixmap(32, 32)
        fontColorImage.fill(self.speechFontColor)
        fontColorIcon = QIcon(fontColorImage)
        self.currentFontColorButton.setIcon(fontColorIcon)
        self.currentFontColorButton.setFixedWidth(
            self.currentFontColorButton.height())
        fontRow.addWidget(self.currentFontColorButton)

        speechGroupLayout.addLayout(fontRow)

        self.bubbleText = QTextEdit("Rogudator's speech bubble generator!")
        speechGroupLayout.addWidget(self.bubbleText)

        self.autocenter = QCheckBox(self)
        self.autocenter.setText("Center automatically")
        self.autocenter.setChecked(True)
        speechGroupLayout.addWidget(self.autocenter)

        self.averageLineLength = QGroupBox()
        averageLineLengthSliderAndSpinBox = QHBoxLayout()
        self.averageLineLengthSlider = QSlider(self)
        self.averageLineLengthSlider.setMinimum(0)
        self.averageLineLengthSlider.setMaximum(100)
        self.averageLineLengthSlider.setOrientation(Qt.Orientation.Horizontal)
        averageLineLengthSliderAndSpinBox.addWidget(
            self.averageLineLengthSlider)
        self.averageLineLengthSpinBox = QSpinBox(self)
        self.averageLineLengthSpinBox.setMinimum(0)
        averageLineLengthSliderAndSpinBox.addWidget(
            self.averageLineLengthSpinBox)
        self.averageLineLength.setLayout(averageLineLengthSliderAndSpinBox)
        self.averageLineLength.setDisabled(True)
        speechGroupLayout.addWidget(self.averageLineLength)

        speechGroup.setLayout(speechGroupLayout)
        mainLayout.addWidget(speechGroup)

        tailSize = QGroupBox()
        tailSize.setTitle("Tail size")
        tailSliderAndSpinBox = QHBoxLayout()
        self.tailSlider = QSlider(self)
        self.tailSlider.setMinimum(0)
        self.tailSlider.setMaximum(self.speechFontSize.value() * 10)
        self.tailSlider.setOrientation(Qt.Orientation.Horizontal)
        tailSliderAndSpinBox.addWidget(self.tailSlider)
        self.tailSpinBox = QSpinBox(self)
        self.tailSpinBox.setMinimum(0)
        self.tailSpinBox.setMaximum(self.speechFontSize.value() * 10)
        tailSliderAndSpinBox.addWidget(self.tailSpinBox)
        tailSize.setLayout(tailSliderAndSpinBox)
        mainLayout.addWidget(tailSize)

        self.tailPositions = QGroupBox()
        self.tailPositions.setTitle("Tail position")
        tailPositionsLayout = QHBoxLayout()
        self.tailPosition = []
        for i in range(8):
            self.tailPosition.append(QRadioButton(self))
            self.tailPosition[i].setText(str(i + 1))
            self.tailPosition[i].clicked.connect(self.updatePreview)
            tailPositionsLayout.addWidget(self.tailPosition[i])

        self.tailPositions.setLayout(tailPositionsLayout)
        self.tailPositions.setDisabled(True)
        mainLayout.addWidget(self.tailPositions)

        self.updatePreview()

        self.addOnPage.clicked.connect(self.addOnPageShape)
        self.squareBubble.clicked.connect(self.updatePreview)
        self.roundBubble.clicked.connect(self.updatePreview)
        self.bubbleColorButton.clicked.connect(self.changeBubbleColor)
        self.outlineSlider.valueChanged.connect(self.outlineSpinBoxUpdate)
        self.outlineSpinBox.valueChanged.connect(self.outlineSliderUpdate)
        self.outlineSpinBox.valueChanged.connect(self.updatePreview)
        self.outlineColorButton.clicked.connect(self.changeOutlineColor)
        self.bubbleText.textChanged.connect(self.updatePreview)
        self.speechFontSize.valueChanged.connect(self.updatePreview)
        self.speechFontSize.valueChanged.connect(self.tailSliderUpdateMaximum)
        self.currentFontColorButton.clicked.connect(self.changeFontColor)
        self.speechFont.currentFontChanged.connect(self.updatePreview)
        self.autocenter.stateChanged.connect(self.enableAverageLineLength)
        self.autocenter.clicked.connect(self.updatePreview)
        self.averageLineLengthSlider.valueChanged.connect(
            self.averageLineLengthSpinBoxUpdate)
        self.averageLineLengthSpinBox.valueChanged.connect(self.updatePreview)
        self.averageLineLengthSpinBox.valueChanged.connect(
            self.averageLineLengthSliderUpdate)
        self.tailSlider.valueChanged.connect(self.tailSpinBoxUpdate)
        self.tailSpinBox.valueChanged.connect(self.tailSliderUpdate)
        self.tailSpinBox.valueChanged.connect(self.updatePreview)

        self.scrollMainLayout = QScrollArea(self)
        self.scrollMainLayout.setWidgetResizable(True)
        self.scrollMainLayout.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)

        widget = QWidget()
        widget.setLayout(mainLayout)
        self.scrollMainLayout.setWidget(widget)
        self.setWidget(self.scrollMainLayout)
        self.show()
Пример #26
0
from PyQt5.QtWidgets import (QDialog, QPushButton, QGroupBox, QHBoxLayout,
Пример #27
0
    def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(537, 428)
        font = QFont()
        font.setFamily("Cantarell")
        font.setStrikeOut(False)
        Form.setFont(font)
        self.label = QLabel(Form)
        self.label.setGeometry(QRect(20, 60, 101, 31))
        font = QFont()
        font.setPointSize(13)
        font.setBold(False)
        font.setWeight(50)
        self.label.setFont(font)
        self.label.setTextFormat(Qt.AutoText)
        self.label.setObjectName("label")
        self.label_2 = QLabel(Form)
        self.label_2.setGeometry(QRect(20, 120, 91, 21))
        font = QFont()
        font.setPointSize(13)
        font.setBold(False)
        font.setWeight(50)
        self.label_2.setFont(font)
        self.label_2.setObjectName("label_2")
        self.label_3 = QLabel(Form)
        self.label_3.setGeometry(QRect(20, 170, 91, 20))
        font = QFont()
        font.setPointSize(13)
        self.label_3.setFont(font)
        self.label_3.setObjectName("label_3")
        self.comboBox_platform = QComboBox(Form)
        self.comboBox_platform.setGeometry(QRect(130, 60, 181, 31))
        font = QFont()
        font.setStrikeOut(False)
        self.comboBox_platform.setFont(font)
        self.comboBox_platform.setMouseTracking(False)
        self.comboBox_platform.setAutoFillBackground(True)
        self.comboBox_platform.setObjectName("comboBox_platform")
        self.comboBox_platform.addItem("")
        self.comboBox_platform.addItem("")
        self.comboBox_platform.addItem("")
        self.comboBox_platform.addItem("")
        self.comboBox_platform.addItem("")
        self.comboBox_platform.addItem("")
        self.comboBox_platform.addItem("")
        self.pushButton = QPushButton(Form)
        self.pushButton.setGeometry(QRect(170, 340, 111, 41))
        self.pushButton.setObjectName("pushButton")
        self.pushButton_2 = QPushButton(Form)
        self.pushButton_2.setGeometry(QRect(430, 340, 71, 41))
        self.pushButton_2.setObjectName("pushButton_2")
        self.label_4 = QLabel(Form)
        self.label_4.setGeometry(QRect(70, 0, 451, 51))
        font = QFont()
        font.setFamily("Cantarell")
        font.setPointSize(16)
        font.setBold(True)
        font.setWeight(75)
        self.label_4.setFont(font)
        self.label_4.setObjectName("label_4")
        self.comboBox_payload = QComboBox(Form)
        self.comboBox_payload.setGeometry(QRect(130, 110, 271, 31))
        self.comboBox_payload.setObjectName("comboBox_payload")
        self.radioButton_86 = QRadioButton(Form)
        self.radioButton_86.setGeometry(QRect(130, 170, 119, 25))
        self.radioButton_86.setObjectName("radioButton_86")
        self.radioButton_64 = QRadioButton(Form)
        self.radioButton_64.setGeometry(QRect(250, 170, 119, 25))
        self.radioButton_64.setChecked(True)
        self.radioButton_64.setObjectName("radioButton_64")
        self.label_5 = QLabel(Form)
        self.label_5.setGeometry(QRect(20, 210, 91, 31))
        font = QFont()
        font.setPointSize(13)
        self.label_5.setFont(font)
        self.label_5.setObjectName("label_5")
        self.label_6 = QLabel(Form)
        self.label_6.setGeometry(QRect(290, 250, 71, 21))
        self.label_6.setObjectName("label_6")
        self.label_7 = QLabel(Form)
        self.label_7.setGeometry(QRect(290, 280, 71, 20))
        self.label_7.setObjectName("label_7")
        self.label_8 = QLabel(Form)
        self.label_8.setGeometry(QRect(60, 250, 71, 20))
        self.label_8.setObjectName("label_8")
        self.label_9 = QLabel(Form)
        self.label_9.setGeometry(QRect(60, 280, 71, 20))
        self.label_9.setObjectName("label_9")
        self.lineEdit_lhost = QLineEdit(Form)
        self.lineEdit_lhost.setGeometry(QRect(130, 250, 131, 21))
        self.lineEdit_lhost.setObjectName("lineEdit_lhost")
        self.lineEdit_lport = QLineEdit(Form)
        self.lineEdit_lport.setGeometry(QRect(130, 280, 131, 21))
        self.lineEdit_lport.setObjectName("lineEdit_lport")
        self.lineEdit_rhost = QLineEdit(Form)
        self.lineEdit_rhost.setGeometry(QRect(360, 250, 141, 21))
        self.lineEdit_rhost.setObjectName("lineEdit_rhost")
        self.lineEdit_rport = QLineEdit(Form)
        self.lineEdit_rport.setGeometry(QRect(360, 280, 141, 21))
        self.lineEdit_rport.setObjectName("lineEdit_rport")
        self.checkBox = QCheckBox(Form)
        self.checkBox.setGeometry(QRect(30, 350, 161, 25))
        font = QFont()
        font.setPointSize(12)
        self.checkBox.setFont(font)
        self.checkBox.setObjectName("checkBox")
        self.pushButton_3 = QPushButton(Form)
        self.pushButton_3.setGeometry(QRect(300, 340, 111, 41))
        self.pushButton_3.setObjectName("pushButton_3")

        self.retranslateUi(Form)
        self.comboBox_platform.currentIndexChanged['int'].connect(
            Form.setPlatform)
        self.pushButton_2.clicked.connect(Form.ExitTool)
        self.radioButton_86.clicked.connect(Form.setArch)
        self.radioButton_64.clicked.connect(Form.setArch)
        self.pushButton.clicked.connect(Form.GeneratePayload)
        self.pushButton_3.clicked.connect(Form.startMsfListener)
        QMetaObject.connectSlotsByName(Form)
Пример #28
0
    def initUI(self):
        instr = "Type URLs here. e.g. www.google.com/search?q=%s"

        self.searchDropdown = QComboBox(self)
        self.searchBox = QLineEdit(self)
        self.searchBox.setPlaceholderText("Search terms")
        self.searchBox.textEdited.connect(self.checkSearchButtonEnable)
        self.searchBox.returnPressed.connect(self.searchClicked)
        self.searchButton = QPushButton("Search", self)
        self.searchButton.setEnabled(False)
        self.searchButton.clicked.connect(self.searchClicked)

        self.addNewRadio = QRadioButton(self)
        self.addNewRadio.toggled.connect(self.addRadioToggled)
        self.editRadio = QRadioButton(self)
        self.newCatBox = QLineEdit("", self)
        self.newCatBox.setPlaceholderText("New category name")
        self.newCatBox.textEdited.connect(self.checkSaveButtonEnable)
        self.editCatDropdown = QComboBox(self)
        self.editCatDropdown.currentIndexChanged[str].connect(
            self.editDropdownChanged)
        self.saveCatButton = QPushButton("Save", self)
        self.saveCatButton.clicked.connect(self.saveCatClicked)
        self.saveCatButton.setEnabled(False)
        self.deleteCatButton = QPushButton("Delete", self)
        self.deleteCatButton.clicked.connect(self.deleteCatClicked)
        self.urlBox = QPlainTextEdit(self)
        self.urlBox.setLineWrapMode(QPlainTextEdit.NoWrap)
        self.urlBox.setPlaceholderText(instr)
        self.addNewRadio.setChecked(True)
        self.addNewChecked()

        mainWidget = QWidget()
        mainLayout = QGridLayout()
        topGrid = QGridLayout()
        topGroup = QGroupBox("Search")
        topGrid.setSpacing(8)
        topGrid.addWidget(self.searchDropdown, 0, 0, 1, 8)
        topGrid.addWidget(self.searchBox, 1, 0, 1, 8)
        topGrid.addWidget(self.searchButton, 1, 8, 1, 2)
        topGroup.setLayout(topGrid)
        mainLayout.addWidget(topGroup, 0, 0)

        bottomGrid = QGridLayout()
        bottomGroup = QGroupBox("Create or edit categories")
        addNewLayout = QHBoxLayout()
        addNewLayout.addWidget(self.addNewRadio)
        addNewLayout.addWidget(self.newCatBox)
        bottomGrid.addLayout(addNewLayout, 0, 0, 1, 8)
        editCatLayout = QHBoxLayout()
        editCatLayout.addWidget(self.editRadio)
        editCatLayout.addWidget(self.editCatDropdown, Qt.AlignLeft)
        bottomGrid.addLayout(editCatLayout, 1, 0, 1, 8)
        buttonLayout = QHBoxLayout()
        buttonLayout.addWidget(self.saveCatButton)
        buttonLayout.addWidget(self.deleteCatButton)
        bottomGrid.addWidget(self.urlBox, 2, 0, 5, -1)
        bottomGrid.addLayout(buttonLayout, 9, 6, 1, -1)
        bottomGroup.setLayout(bottomGrid)

        mainLayout.addWidget(bottomGroup, 1, 0)
        mainWidget.setLayout(mainLayout)
        self.setCentralWidget(mainWidget)
        self.statusBar().showMessage("")

        exitAction = QAction("E&xit", self)
        exitAction.setShortcut("Esc")  #Ctrl+Q
        exitAction.setStatusTip("Exit MultiSearch")
        exitAction.triggered.connect(qApp.quit)

        helpAction = QAction("&Help", self)
        helpAction.setShortcut("F1")
        helpAction.setStatusTip("Show Help")
        helpAction.triggered.connect(self.showHelp)

        menubar = self.menuBar()
        fileMenu = menubar.addMenu("&File")
        helpMenu = menubar.addMenu("&Help")
        fileMenu.addAction(exitAction)
        helpMenu.addAction(helpAction)

        self.setGeometry(300, 300, 325, 425)
        self.setWindowTitle('MultiSearch')
        self.show()
Пример #29
0
    def __init__(self, parent):
        super(Preference, self).__init__(parent)

        # window
        self.setWindowTitle('Settings')
        self.setWindowIcon(QIcon('./icon/beer.ico'))
        self.setWindowModality(Qt.Qt.WindowModal)

        # layout with tabs
        layout = QVBoxLayout()
        hlayout = QHBoxLayout()
        typetab = QTabWidget()
        tab1 = QWidget()
        typetab.addTab(tab1, "Core")
        tablayout1 = QGridLayout(tab1)
        tab2 = QWidget()
        typetab.addTab(tab2, "Audio")
        tablayout2 = QGridLayout(tab2)

        # bold font
        myFont = QFont()
        myFont.setBold(True)

        # radio button (color themes)
        txttheme = QLabel('Color theme : ', self)
        txttheme.setFont(myFont)
        tablayout1.addWidget(txttheme, 0, 0)
        self.b1 = QRadioButton("Default", self)
        self.b1.toggled.connect(lambda: self.btnstate(self.b1))
        tablayout1.addWidget(self.b1, 0, 1)
        self.b2 = QRadioButton("Dark", self)
        self.b2.toggled.connect(lambda: self.btnstate(self.b2))
        tablayout1.addWidget(self.b2, 0, 2)
        if self.parent().theme == 0:
            self.b1.setChecked(True)
            self.b2.setChecked(False)
        else:
            self.b2.setChecked(True)
            self.b1.setChecked(False)

        # checkbox (view logger)
        txtlog = QLabel('Logger : ', self)
        txtlog.setFont(myFont)
        tablayout1.addWidget(txtlog, 1, 0)
        self.logger = QCheckBox('Display', self)
        tablayout1.addWidget(self.logger, 1, 1)

        # combo (shutdown)
        txtpwoff = QLabel('After conversion : ', self)
        txtpwoff.setFont(myFont)
        tablayout1.addWidget(txtpwoff, 2, 0)
        self.pwoff = QComboBox(self)
        self.pwoff.addItems(['Wait', 'Quit', 'Power-off'])
        self.pwoff.currentIndexChanged['int'].connect(self.poweroff)
        tablayout1.addWidget(self.pwoff, 2, 1)

        # checkbox (tray icon)
        txttray = QLabel('System tray icon : ', self)
        txttray.setFont(myFont)
        tablayout1.addWidget(txttray, 3, 0)
        self.tray = QCheckBox('Use and Show', self)
        self.tray.setToolTip(
            'Keep in the background when the main window is closed')
        tablayout1.addWidget(self.tray, 3, 1)

        # checkbox and combo (sample rate)
        txtsr = QLabel('User-defined sample rate (lossless DSF conversion) :',
                       self)
        txtsr.setFont(myFont)
        tablayout2.addWidget(txtsr, 0, 0)
        self.sr = QCheckBox('Resample', self)
        self.sr.setToolTip(
            'Choose a sample rate frequency when converting from DSF to FLAC/ALAC/WAV/AIFF'
        )
        tablayout2.addWidget(self.sr, 0, 1)
        self.srfreq = QComboBox(self)
        self.srfreq.addItems(
            ['44100 Hz', '88200 Hz', '176400 Hz', '352800 Hz'])
        self.srfreq.currentIndexChanged['int'].connect(self.samplerate)
        tablayout2.addWidget(self.srfreq, 0, 2)

        # combo (channels)
        txtch = QLabel('Number of channels for the output audio files :', self)
        txtch.setFont(myFont)
        tablayout2.addWidget(txtch, 1, 0)
        self.chn = QComboBox(self)
        self.chn.addItems(['Default', 'Mono', 'Stereo'])
        self.chn.currentIndexChanged['int'].connect(self.channels)
        tablayout2.addWidget(self.chn, 1, 1)

        # quit button
        self.btn_ok = QPushButton('OK', self)
        self.btn_ok.setMaximumWidth(100)

        # layout
        layout.addWidget(typetab)
        hlayout.addWidget(self.btn_ok)
        layout.addLayout(hlayout)
        window = QWidget(self)
        window.setLayout(layout)
        self.setCentralWidget(window)

        self.initUI()
Пример #30
0
    def __init__(self, parent=None):
        super(Window, self).__init__(parent)

        # Windows
        self.create_tab = QWidget()
        self.solve_tab = QWidget()
        self.plot_tab = QWidget()
        self.summary_tab = QWidget()

        self.addTab(self.create_tab, "Create")
        self.addTab(self.solve_tab, "Solve")
        self.addTab(self.plot_tab, "Generations plots")
        self.addTab(self.summary_tab, "Summary")

        # Create Window
        self.x_start = QDoubleSpinBox()
        self.x_start.setRange(-1000000, 1000000)
        self.x_start.setValue(-2)
        self.x_end = QDoubleSpinBox()
        self.x_end.setRange(-1000000, 1000000)
        self.x_end.setValue(2)
        self.y_start = QDoubleSpinBox()
        self.y_start.setRange(-1000000, 1000000)
        self.y_start.setValue(-2)
        self.y_end = QDoubleSpinBox()
        self.y_end.setRange(-1000000, 1000000)
        self.y_end.setValue(2)
        self.function = QLineEdit()
        self.figure = plt.figure()
        self.canvas = FigureCanvas(self.figure)

        # Solve Window
        self.crossover_prob = QDoubleSpinBox()
        self.crossover_prob.setMinimum(0)
        self.crossover_prob.setMaximum(1)
        self.crossover_prob.setSingleStep(0.1)
        self.crossover_prob.setValue(0.6)
        self.mutation_prob = QDoubleSpinBox()
        self.mutation_prob.setMinimum(0)
        self.mutation_prob.setMaximum(1)
        self.mutation_prob.setSingleStep(0.1)
        self.mutation_prob.setValue(0.1)
        self.num_ind = QSpinBox()
        self.num_ind.setRange(2, 100)
        self.num_ind.setSingleStep(2)
        self.num_ind.setValue(10)
        self.num_gen = QSpinBox()
        self.num_gen.setRange(1, 100)
        self.num_gen.setValue(5)
        self.command_line = QTextEdit()
        self.command_line.setMinimumHeight(475)
        self.command_line.isReadOnly()
        self.generation_figure = plt.figure()
        self.generation_canvas = FigureCanvas(self.generation_figure)
        self.population_list = []
        self.current_gen = None
        self.min = QRadioButton("Min")
        self.min.toggled.connect(lambda: self.select_option(self.min))
        self.max = QRadioButton("Max")
        self.max.setChecked(True)
        self.max.toggled.connect(lambda: self.select_option(self.max))
        self.find_max = 1

        # Summary Window
        self.best_x = ""
        self.best_y = ""
        self.best_solution = float("nan")
        self.summary_figure = plt.figure()
        self.summary_canvas = FigureCanvas(self.summary_figure)
        self.mean = []
        self.median = []
        self.best = []
        self.best_x_label = QLabel("Best solution x: " + str(self.best_x))
        self.best_y_label = QLabel("y: " + str(self.best_y))
        self.best_f_label = QLabel("f(x,y): " + str(self.best_solution))

        # Initialize app windows
        self.create_tab_ui()
        self.solve_tab_ui()
        self.plot_tab_ui()
        self.summary_tab_ui()
        self.setWindowTitle("Genetic Algorithms")