def __init__(self, parent=None, database=None):
        super(InstallationTab, self).__init__(parent)
        Form.__init__(self, parent)
        self._database = database
        self._table_name = "INSTALLATION"
        self._table = Installation
        self._layout = QFormLayout(self)
        self._child_widgets_not_set = True

        self._scroll = QScrollArea(self)
        self._scroll.setWidgetResizable(True)
        self._layout.addRow(self._scroll)
        self._scroll_contents = QWidget(self)
        self._scroll_contents.setObjectName("iscroll")
        self._scroll_contents.setStyleSheet(
            'QWidget[objectName^="iscroll"] {background-color: #FFFFFF;}')
        self._scroll_contents.setSizePolicy(QSizePolicy.Expanding,
                                            QSizePolicy.Expanding)

        self._scroll.setWidget(self._scroll_contents)
        self._scroll_layout = QFormLayout(self._scroll_contents)

        self.connectWidgets()
        self.setInstallInfoArea()
        self.setSupscriptionArea()
        self.setDeviceSetupArea()
    def __init__(self, parent=None, database=None):
        super(RepLeakTab, self).__init__(parent)
        Form.__init__(self, parent)
        self._database = database
        self._table_name = "REP_LEAK"
        self._table = RepLeak
        self._layout = QFormLayout(self)
        self._child_widgets_not_set = True

        self._scroll = QScrollArea(self)
        self._scroll.setWidgetResizable(True)
        self._layout.addRow(self._scroll)
        self._scroll_contents = QWidget(self)
        self._scroll_contents.setSizePolicy(QSizePolicy.Expanding,
                                            QSizePolicy.Expanding)
        self._scroll_contents.setObjectName("rplscroll")
        self._scroll_contents.setStyleSheet(
            'QWidget[objectName^="rplscroll"] {background-color: #FFFFFF;}')
        self._scroll.setWidget(self._scroll_contents)
        self._scroll_layout = QFormLayout(self._scroll_contents)

        self.connectWidgets()
        RepLeak.MET_DEV_AGREE.value.setChecked(True)
        RepLeak.CUS_INFORM.value.setChecked(True)
        self.setRepLeakArea()
        self._scroll_layout.addRow(VerticalFiller(self))
Beispiel #3
0
    def __init__(self, parent=None, database=None):
        super(MotivationsTab, self).__init__(parent)
        Form.__init__(self, parent)
        self._database = database
        self._table_name = "MOTIVATIONS"
        self._table = Motivations
        self._layout = QFormLayout(self)
        self._child_widgets_not_set = True

        self._scroll = QScrollArea(self)
        self._scroll.setWidgetResizable(True)
        self._layout.addRow(self._scroll)
        self._scroll_contents = QWidget(self)
        self._scroll_contents.setSizePolicy(QSizePolicy.Expanding,
                                            QSizePolicy.Expanding)
        self._scroll_contents.setObjectName("mscroll")
        self._scroll_contents.setStyleSheet(
            'QWidget[objectName^="mscroll"] {background-color: #FFFFFF;}')
        self._scroll.setWidget(self._scroll_contents)
        self._scroll_layout = QFormLayout(self._scroll_contents)

        reason_combos = [
            Motivations.REASON_1.value, Motivations.REASON_2.value,
            Motivations.REASON_3.value
        ]
        for combo in reason_combos:
            combo.setReasonCombos(reason_combos)
            combo.activated.connect(combo.reasonCombos)

        self.connectWidgets()
        self.setReasonsArea()
        self.setGeneralMotivationsArea()
        self._scroll_layout.addRow(VerticalFiller(self))
    def init_ui(self):
        # self.setFixedWidth(500)
        self.setWindowTitle(_('Teamwork'))
        # self.setWindowIcon(QIcon(icon_dir('sportident.png')))
        self.setSizeGripEnabled(False)
        self.setModal(True)

        self.tab_widget = QTabWidget()

        # client/server
        self.teamwork_tab = QWidget()
        self.teamwork_layout = QFormLayout()
        self.teamwork_item_host = QLineEdit()
        self.teamwork_item_port = QSpinBox()
        self.teamwork_item_port.setMinimum(0)
        self.teamwork_item_port.setMaximum(65535)
        self.teamwork_item_token = QLineEdit()
        self.teamwork_groupbox = QGroupBox()
        self.teamwork_groupbox.setTitle(_('Type connection'))
        self.teamwork_groupbox_layout = QFormLayout()
        self.teamwork_item_client = QRadioButton(_('Client'))
        self.teamwork_item_server = QRadioButton(_('Server'))
        self.teamwork_groupbox_layout.addRow(self.teamwork_item_client)
        self.teamwork_groupbox_layout.addRow(self.teamwork_item_server)
        self.teamwork_groupbox.setLayout(self.teamwork_groupbox_layout)

        self.teamwork_layout.addRow(QLabel(_('Host')), self.teamwork_item_host)
        self.teamwork_layout.addRow(QLabel(_('Port')), self.teamwork_item_port)
        # self.teamwork_layout.addRow(QLabel(_('Token')), self.teamwork_item_token)
        self.teamwork_layout.addRow(self.teamwork_groupbox)
        self.teamwork_tab.setLayout(self.teamwork_layout)

        self.tab_widget.addTab(self.teamwork_tab, _('Client/Server'))

        def cancel_changes():
            self.close()

        def apply_changes():
            try:
                self.apply_changes_impl()
            except Exception as e:
                logging.error(str(e))
            self.close()

        button_box = QDialogButtonBox(QDialogButtonBox.Ok
                                      | QDialogButtonBox.Cancel)
        self.button_ok = button_box.button(QDialogButtonBox.Ok)
        self.button_ok.setText(_('OK'))
        self.button_ok.clicked.connect(apply_changes)
        self.button_cancel = button_box.button(QDialogButtonBox.Cancel)
        self.button_cancel.setText(_('Cancel'))
        self.button_cancel.clicked.connect(cancel_changes)

        self.layout = QFormLayout(self)
        self.layout.addRow(self.tab_widget)
        self.layout.addRow(button_box)

        self.set_values_from_model()

        self.show()
    def __init__(self, parent=None, database=None):
        super(PrevLeakTab, self).__init__(parent)
        Form.__init__(self, parent)
        self._database = database
        self._table_name = "PREV_LEAK"
        self._table = PrevLeak
        self._layout = QFormLayout(self)
        self._child_widgets_not_set = True

        self._scroll = QScrollArea(self)
        self._scroll.setWidgetResizable(True)
        self._layout.addRow(self._scroll)
        self._scroll_contents = QWidget(self)
        self._scroll_contents.setSizePolicy(QSizePolicy.Expanding,
                                            QSizePolicy.Expanding)
        self._scroll_contents.setObjectName("prevleakscroll")
        self._scroll_contents.setStyleSheet(
            'QWidget[objectName^="prevleakscroll"] {background-color: #FFFFFF;}'
        )
        self._scroll.setWidget(self._scroll_contents)
        self._scroll_layout = QFormLayout(self._scroll_contents)

        self.connectWidgets()
        self.setPrevLeakArea()
        self._scroll_layout.addRow(QWidget(self))
        self._scroll_layout.addRow(VerticalFiller(self))
    def __init__(self, parent=None, database=None):
        super(DeviceDetectionTab, self).__init__(parent)
        Form.__init__(self, parent)
        self._database = database
        self._table_name = "DEVICE_DETECTION"
        self._table = DeviceDetection
        self._layout = QFormLayout(self)

        self._scroll = QScrollArea(self)
        self._scroll.setWidgetResizable(True)
        self._layout.addRow(self._scroll)
        self._scroll_contents = QWidget(self)
        self._scroll_contents.setObjectName("ddscroll")
        self._scroll_contents.setStyleSheet(
            'QWidget[objectName^="ddscroll"] {background-color: #FFFFFF;}')
        self._scroll_contents.setSizePolicy(QSizePolicy.Expanding,
                                            QSizePolicy.Expanding)

        self._scroll.setWidget(self._scroll_contents)
        self._scroll_layout = QFormLayout(self._scroll_contents)

        self._child_widgets_not_set = True

        self.connectWidgets()
        self.setDeviceStatusArea()
        self.setDetectedLeakArea()
        self.setLeakDiscoveredArea()
        self._scroll_layout.addRow(VerticalFiller(self))
Beispiel #7
0
    def __init__(self, parent=None, database=None):
        super(ClientTab, self).__init__(parent)
        Form.__init__(self, parent)
        self._database = database
        self._table_name = "CLIENT"
        self._table = Client
        self._layout = QFormLayout(self)
        self._child_widgets_not_set = True

        self._scroll = QScrollArea()
        self._scroll.setWidgetResizable(True)
        self._layout.addRow(self._scroll)
        self._scroll_contents = QWidget()

        self._scroll_contents.setSizePolicy(QSizePolicy.Expanding,
                                            QSizePolicy.Expanding)
        self._scroll_contents.setObjectName("cscroll")
        self._scroll_contents.setStyleSheet(
            'QWidget[objectName^="cscroll"] {background-color: #FFFFFF;}')
        self._scroll.setWidget(self._scroll_contents)
        self._scroll_layout = QFormLayout(self._scroll_contents)

        self.connectWidgets()
        self.setEvaluationArea()
        self.setRepArea()
        self.setClientArea()
    def setupFilterLayout(self):
        filterLayout = QVBoxLayout(self)
        filterSettLayout = QHBoxLayout()

        self.filterBandChooser = QComboBox()
        self.filterTypeChooser = QComboBox()
        filterTypeLayout = QFormLayout()

        filterTypeLayout.addWidget(QLabel('Type'))
        filterTypeLayout.addWidget(self.filterBandChooser)
        bandTypes = {
            'Low Pass': '******',
            'Band Pass': '******',
            'High Pass': '******',
            'Band Stop': 'bandstop'
        }
        [self.filterBandChooser.addItem(i, bandTypes[i]) for i in bandTypes]
        self.filterBandChooser.setCurrentText('Band Pass')
        filterTypeLayout.addWidget(self.filterTypeChooser)
        filterTypes = {'Butter': 'butter', 'Bessel': 'bessel'}
        [
            self.filterTypeChooser.addItem(i, filterTypes[i])
            for i in filterTypes
        ]

        self.lowFreqEdit = QDoubleSpinBox()
        self.lowFreqEdit.setSuffix(' Hz')
        self.lowFreqEdit.setDecimals(1)
        self.lowFreqEdit.setRange(0.1, self.fs / 2 - 0.1)
        self.highFreqEdit = QDoubleSpinBox()
        self.highFreqEdit.setSuffix(' Hz')
        self.highFreqEdit.setDecimals(1)
        self.highFreqEdit.setLocale(
            QLocale(QLocale.Polish, QLocale.EuropeanUnion))
        self.highFreqEdit.setRange(0.1, self.fs / 2 - 0.1)
        self.filterBandChooser.currentTextChanged.connect(self.setFilterBand)
        filterFreqLayout = QFormLayout()
        filterFreqLayout.addRow(QLabel('Cutoff Frequencies'))
        filterFreqLayout.addRow('Low', self.lowFreqEdit)
        filterFreqLayout.addRow('High', self.highFreqEdit)

        filterOrdLayout = QFormLayout()
        self.filterOrdEdit = QSpinBox()
        self.filterOrdEdit.setMinimum(1)
        self.filterOrdEdit.setValue(5)
        filterOrdLayout.addRow(QLabel('Order'))
        filterOrdLayout.addRow(self.filterOrdEdit)

        filterSettLayout.addLayout(filterTypeLayout)
        filterSettLayout.addSpacing(10)
        filterSettLayout.addLayout(filterFreqLayout)
        filterSettLayout.addSpacing(10)
        filterSettLayout.addLayout(filterOrdLayout)

        btn = QPushButton('Show filter response')
        btn.clicked.connect(self.showFilterResponse)

        filterLayout.addLayout(filterSettLayout)
        filterLayout.addWidget(btn, 0, Qt.AlignRight)
Beispiel #9
0
    def init_ui(self):
        self.setWindowTitle(_('Telegram'))
        self.setWindowIcon(QIcon(config.ICON))
        self.setSizeGripEnabled(False)
        self.setModal(True)

        self.layout = QFormLayout(self)

        self.label_token = QLabel(_('Token'))
        self.item_token = QLineEdit()
        self.layout.addRow(self.label_token, self.item_token)

        self.label_chat_id = QLabel(_('Chat id'))
        self.item_chat_id = QLineEdit()
        self.layout.addRow(self.label_chat_id, self.item_chat_id)

        self.label_template = QLabel(_('Template'))
        self.item_template = QTextEdit()
        self.item_template.setMinimumHeight(150)
        self.layout.addRow(self.label_template, self.item_template)

        self.item_enabled = QCheckBox(_('Enabled'))
        self.layout.addRow(self.item_enabled)

        self.parse_mode_groupbox = QGroupBox()
        self.parse_mode_groupbox.setTitle(_('Parse mode'))
        self.parse_mode_groupbox_layout = QFormLayout()
        self.parse_mode_item_text = QRadioButton(_('Text'))
        self.parse_mode_item_markdown = QRadioButton(_('Markdown'))
        self.parse_mode_item_html = QRadioButton(_('HTML'))
        self.parse_mode_groupbox_layout.addRow(self.parse_mode_item_text)
        self.parse_mode_groupbox_layout.addRow(self.parse_mode_item_markdown)
        self.parse_mode_groupbox_layout.addRow(self.parse_mode_item_html)
        self.parse_mode_groupbox.setLayout(self.parse_mode_groupbox_layout)
        self.layout.addRow(self.parse_mode_groupbox)

        def cancel_changes():
            self.close()

        def apply_changes():
            try:
                self.apply_changes_impl()
            except Exception as e:
                logging.error(str(e))
            self.close()

        button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        self.button_ok = button_box.button(QDialogButtonBox.Ok)
        self.button_ok.setText(_('OK'))
        self.button_ok.clicked.connect(apply_changes)
        self.button_cancel = button_box.button(QDialogButtonBox.Cancel)
        self.button_cancel.setText(_('Cancel'))
        self.button_cancel.clicked.connect(cancel_changes)
        self.layout.addRow(button_box)

        self.show()
Beispiel #10
0
    def _init_ui(self):
        vmlayout=QVBoxLayout()
        self._tabGeneral.setLayout(vmlayout)

        general_group_box=QGroupBox(self.tr("General"))
        vmlayout.addWidget(general_group_box)

        # general_hmlayout = QHBoxLayout()

        general_left_formlayout = QFormLayout()
        general_group_box.setLayout(general_left_formlayout)

        general_left_formlayout.addRow(self.tr("Show Window on Start"), self._ckb_show_window_on_start)
        general_left_formlayout.addRow(self.tr("Show Indicator"), self._ckb_show_indicator)

        general_group_index=QGroupBox(self.tr("Index"))
        vmlayout.addWidget(general_group_index)

        general_index_formlayout=QFormLayout()
        general_group_index.setLayout(general_index_formlayout)

        self._general_index_update=QPushButton(self.tr("Update Index"))
        self._general_index_reindex=QPushButton(self.tr("Reindex"))

        general_index_formlayout.addWidget(self._general_index_update)
        general_index_formlayout.addWidget(self._general_index_reindex)



        index_vlayout=QVBoxLayout()
        self._tabIndex.setLayout(index_vlayout)

        self._topDir=ConfigListWidget(showGroupName="TopDir",groupName="topdirs")
        self._skipDir=ConfigListWidget(showGroupName="SkipDir",groupName="skippedPaths")
        # self._cigen=ConfigListWidget("CiGen")
        index_vlayout.addWidget(self._topDir)
        index_vlayout.addWidget(self._skipDir)
        # self._index_vlayout.addWidget(self._cigen)


        self._tabIndexSche=IndexSche()

        # self._tabIndex.setLayout(index_vmlayout)

        self._tabWidget.addTab(self._tabGeneral, self.tr("General"))
        self._tabWidget.addTab(self._tabIndex, self.tr("Global Index"))
        self._tabWidget.addTab(self._tabIndexSche,self.tr("Sched"))

        main_layout = QVBoxLayout()
        main_layout.addWidget(self._tabWidget)
        main_layout.addWidget(self._buttonBox)
        self.setLayout(main_layout)
    def init_ui(self):
        self.setWindowTitle(_('Import'))
        self.setWindowIcon(QIcon(config.ICON))
        self.setSizeGripEnabled(False)
        self.setModal(True)

        self.layout = QFormLayout(self)

        self.item_races = AdvComboBox()
        self.layout.addRow(QLabel(_('Choose race')), self.item_races)

        self.unique_id_box = QGroupBox(_('Unique id'))
        self.unique_id_box_layout = QFormLayout()
        self.unique_id_item_id = QRadioButton(_('Id'))
        self.unique_id_item_id.setChecked(True)
        self.unique_id_box_layout.addRow(self.unique_id_item_id)
        self.unique_id_item_name = QRadioButton(_('Name'))
        self.unique_id_item_name.setDisabled(True)
        self.unique_id_box_layout.addRow(self.unique_id_item_name)
        self.unique_id_box.setLayout(self.unique_id_box_layout)
        self.layout.addRow(self.unique_id_box)

        self.import_action_box = QGroupBox(_('Action'))
        self.import_action_box_layout = QFormLayout()
        self.import_action_item_add = QRadioButton(_('Add'))
        self.import_action_box_layout.addRow(self.import_action_item_add)
        self.import_action_item_overwrite = QRadioButton(_('Overwrite'))
        self.import_action_item_overwrite.setChecked(True)
        self.import_action_box_layout.addRow(self.import_action_item_overwrite)
        self.import_action_box.setLayout(self.import_action_box_layout)
        self.layout.addRow(self.import_action_box)

        def cancel_changes():
            self.close()

        def apply_changes():
            try:
                self.apply_changes_impl()
            except Exception as e:
                logging.error(str(e))
            self.close()

        button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        self.button_ok = button_box.button(QDialogButtonBox.Ok)
        self.button_ok.setText(_('OK'))
        self.button_ok.clicked.connect(apply_changes)
        self.button_cancel = button_box.button(QDialogButtonBox.Cancel)
        self.button_cancel.setText(_('Cancel'))
        self.button_cancel.clicked.connect(cancel_changes)
        self.layout.addRow(button_box)

        self.show()
Beispiel #12
0
 def __init__(self, title, parent=None):
     super().__init__(title, parent)
     font = QFont()
     font.setBold(True)
     old_font = QFont()
     old_font.setBold(False)
     frame = QWidget(self)
     frame.setFont(old_font)
     self.frame_layout = QFormLayout(frame)
     self.setFont(font)
     self._layout = QFormLayout(self)
     self._layout.addRow(frame)
     self.setLayout(self._layout)
    def testGetLayoutPosition(self):
        formlayout = QFormLayout()
        layout = QFormLayout()
        row, role = formlayout.getLayoutPosition(layout)
        self.assertTrue(isinstance(row, int))
        self.assertTrue(isinstance(role, QFormLayout.ItemRole))
        self.assertEqual(row, -1)

        formlayout.addRow(layout)
        row, role = formlayout.getLayoutPosition(layout)
        self.assertTrue(isinstance(row, int))
        self.assertTrue(isinstance(role, QFormLayout.ItemRole))
        self.assertEqual(row, 0)
        self.assertEqual(role, QFormLayout.SpanningRole)
Beispiel #14
0
    def _init_ui(self):
        # self._btn_cron=QRadioButton(self.tr("Cron"))
        # self._btn_realtime=QRadioButton(self.tr("RealTime"))
        vlayout = QVBoxLayout()
        self.setLayout(vlayout)

        _group_cron = QGroupBox(self.tr("Cron"))
        vlayout.addWidget(_group_cron)

        _formLayout_Cron = QFormLayout()
        _group_cron.setLayout(_formLayout_Cron)

        _formLayout_Cron.addWidget(QLabel("xxxx"))
        self._label_cron_week = QLineEdit()
        self._label_cron_hour = QLineEdit()
        self._label_cron_minu = QLineEdit()
        _formLayout_Cron.addRow(self.tr("星期日"), self._label_cron_week)
        _formLayout_Cron.addRow(self.tr("小时"), self._label_cron_hour)
        _formLayout_Cron.addRow(self.tr("分钟"), self._label_cron_minu)

        self._btn_enable = QPushButton(self.tr("Enable"))
        self._btn_disable = QPushButton(self.tr("Disable"))
        # self._btn_cancel = QPushButton(self.tr("Cancel"))
        hlayout = QHBoxLayout()
        hlayout.addWidget(self._btn_enable)
        hlayout.addWidget(self._btn_disable)
        # hlayout.addWidget(self._btn_cancel)
        # self._btn_cron=QDialogButtonBox(QDialogButtonBox)

        _formLayout_Cron.addWidget(QLabel("ddd"))
        _formLayout_Cron.addRow(hlayout)

        _group_realtime = QGroupBox(self.tr("RealTime"))
        vlayout.addWidget(_group_realtime)

        formLayout = QFormLayout()
        _group_realtime.setLayout(formLayout)

        formLayout.addWidget(QLabel(self.tr("xxx")))

        self._cbk_startOnStart = QCheckBox()
        self._cbk_startNow = QCheckBox()
        self._cbk_startNow.setEnabled(False)
        formLayout.addRow(self._cbk_startOnStart,
                          QLabel(self.tr("Start on System Start")))
        formLayout.addRow(self._cbk_startNow, QLabel(self.tr("Start Now")))

        pass
Beispiel #15
0
    def initUI(self):

        flo = QFormLayout()
        edit1 = QLineEdit()
        edit2 = QLineEdit()
        edit3 = QLineEdit()
        edit4 = QLineEdit()

        flo.addRow("Normal", edit1)
        flo.addRow("Noecho", edit2)
        flo.addRow("Password", edit3)
        flo.addRow("Passwoedecho", edit4)

        edit1.setPlaceholderText("Normal")
        edit2.setPlaceholderText("Noecho")
        edit3.setPlaceholderText("Password")
        edit4.setPlaceholderText("Passwoedecho")

        edit1.setEchoMode(QLineEdit.Normal)
        edit2.setEchoMode(QLineEdit.NoEcho)
        edit3.setEchoMode(QLineEdit.Password)
        edit4.setEchoMode(QLineEdit.PasswordEchoOnEdit)

        screen = QDesktopWidget().screenGeometry()
        size = self.geometry()
        self.move((screen.width() - size.width()) / 2,
                  (screen.height() - size.height()) / 2)
        self.setLayout(flo)
        self.show()
    def __init__(self, target_property_name, template):
        QGroupBox.__init__(self)
        PropertyWidget.__init__(self, target_property_name)

        main_layout = QVBoxLayout(self)
        button_layout = QHBoxLayout()
        self.make_unique_button = QPushButton("Make Unique")
        self.toggle_button = QPushButton("Toggle Editor")
        button_layout.addWidget(self.make_unique_button)
        button_layout.addWidget(self.toggle_button)
        main_layout.addLayout(button_layout)

        form_layout = QFormLayout()
        self.form_widget = QWidget()
        self.editors = []
        for (key, value) in template.items():
            label = QLabel(key)
            editor = value.create_editor()
            self.editors.append(editor)
            form_layout.addRow(label, editor)
        form_layout.setContentsMargins(0, 0, 0, 0)
        self.form_widget.setLayout(form_layout)
        main_layout.addWidget(self.form_widget)
        self.setLayout(main_layout)
        self.form_widget.setVisible(False)

        self.make_unique_button.clicked.connect(self._on_make_unique_clicked)
        self.toggle_button.clicked.connect(lambda: self.form_widget.setVisible(
            not self.form_widget.isVisible()))
Beispiel #17
0
    def initUI(self):

        formlayout = QFormLayout()
        formlayout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)
        formlayout.setVerticalSpacing(20)

        explain = QLabel("推送小工具请粘贴微博文章详情页链接,并选择类型,提交。")
        url = QLabel('微博链接:')
        data_type = QLabel('选择类型:')

        self.url_edit = QLineEdit()
        self.data_type_edit = QComboBox()
        self.data_type_edit.addItems(['负面', '中性', '正面'])

        button = QPushButton('提交', self)
        button.setStyleSheet("background-color: rgb(255, 255, 255);")

        formlayout.addRow(explain)
        formlayout.addRow(url, self.url_edit)
        formlayout.addRow(data_type, self.data_type_edit)

        hbox = QHBoxLayout()
        hbox.addStretch(0)
        hbox.addWidget(button)
        vbox = QVBoxLayout()
        vbox.addStretch(0)
        vbox.addLayout(hbox)
        formlayout.addRow(vbox)
        self.setLayout(formlayout)
        # x y 宽 高
        self.setGeometry(500, 200, 600, 400)
        self.setWindowTitle('推送小工具')
        self.show()
        # self.data_type_edit.currentIndexChanged[str].connect(self.print_value)  # 条目发生改变,发射信号,传递条目内容
        button.clicked.connect(self.but_click)
    def __init__(self, parent: "QWidget" = None):
        HyperparametersConfigWidget.__init__(self)
        QWidget.__init__(self, parent)

        # Widgets
        self._epoch_spinbox = QSpinBox(parent=self)
        self._epoch_spinbox.setMinimum(1)
        self._epoch_spinbox.setValue(self.get_epochs())

        self._loss_function_combobox = QComboBox(parent=self)
        self._loss_function_combobox.addItems(self.get_available_loss_functions())
        self._loss_function_combobox.setCurrentText(self.get_loss_function())

        self._optimizer_combobox = QComboBox()
        self._optimizer_combobox.addItems(self.get_available_optimizers())
        self._optimizer_combobox.setCurrentText(self.get_optimizer())

        self._batch_size_spinbox = QSpinBox(parent=self)
        self._batch_size_spinbox.setValue(self.get_batch_size())
        self._batch_size_spinbox.setMinimum(1)
        self._batch_size_spinbox.setMaximum(999999)

        # Layouts
        self._main_layout = QFormLayout()
        self._main_layout.addRow("Epochs", self._epoch_spinbox)
        self._main_layout.addRow("Optimizer", self._optimizer_combobox)
        self._main_layout.addRow("Loss function", self._loss_function_combobox)
        self._main_layout.addRow("Batch size", self._batch_size_spinbox)
        self.setLayout(self._main_layout)

        # Hyperparameters dictionary
        self._epoch_spinbox.valueChanged.connect(self.set_epochs)
        self._loss_function_combobox.currentTextChanged.connect(self.set_loss_function)
        self._optimizer_combobox.currentTextChanged.connect(self.set_optimizer)
        self._batch_size_spinbox.valueChanged.connect(self.set_batch_size)
    def initUI(self):
        self.heading=QLabel("Doctor Appointments")
        self.heading.setAlignment(Qt.AlignLeft)
        self.heading.setFont(font2)

        self.vbox=QVBoxLayout()
        self.vbox.addWidget(self.heading)
        self.vbox.setAlignment(Qt.AlignTop)

        self.fbox=QFormLayout()
        self.fbox.setSpacing(10)
        self.fbox.setAlignment(Qt.AlignLeft)

        self.eventLbl=QLabel('')
        self.timeLbl=QLabel('')
        self.eventLbl.setFont(font1)
        self.timeLbl.setFont(font1)

        self.fbox.addRow(self.eventLbl,self.timeLbl)

        self.eventNames=[]
        self.eventTime=[]
        self.noEventLbl=QLabel('No Doctor Appointments Today')

        self.update_check()

        self.vbox.addLayout(self.fbox)
        self.setLayout(self.vbox)
Beispiel #20
0
    def setupSettings(self):

        spinBoxLayout = QFormLayout()

        self.removeOffset = QCheckBox('Remove DC offset')
        self.removeOffset.setChecked(self.parameters['offset filter'])
        spinBoxLayout.addRow(self.removeOffset)

        self.removeSupply = QCheckBox('Remove 50Hz')
        self.removeSupply.setChecked(self.parameters['supply filter'])
        spinBoxLayout.addRow(self.removeSupply)

        ##        self.lpfHighcut = QSpinBox()
        ##        self.lpfHighcut.setMaximum(10000)
        ##        self.lpfHighcut.setValue(self.parameters['LPF highcut'])
        ##        spinBoxLayout.addRow('LPF highcut frequency:', self.lpfHighcut)

        self.bpfLowcut = QSpinBox()
        self.bpfLowcut.setMaximum(10000)
        self.bpfLowcut.setValue(self.parameters['BPF lowcut'])
        spinBoxLayout.addRow('BPF lowcut frequency:', self.bpfLowcut)

        self.bpfHighcut = QSpinBox()
        self.bpfHighcut.setMaximum(10000)
        self.bpfHighcut.setValue(self.parameters['BPF highcut'])
        spinBoxLayout.addRow('BPF highcut frequency:', self.bpfHighcut)

        ##        self.ArtefactsThreshold = QSpinBox()
        ##        self.ArtefactsThreshold.setMaximum(10000)
        ##        self.ArtefactsThreshold.setValue(self.parameters['art thres'])
        ##        spinBoxLayout.addRow('Artefacts Threshold:', self.ArtefactsThreshold)

        self.algWindowSize = QSpinBox()
        self.algWindowSize.setMaximum(10000)
        self.algWindowSize.setValue(self.parameters['window'])
        spinBoxLayout.addRow('Window (samples):', self.algWindowSize)

        self.hmtLargerMean = QDoubleSpinBox()
        self.hmtLargerMean.setMinimum(0.1)
        self.hmtLargerMean.setMaximum(10000)
        self.hmtLargerMean.setValue(self.parameters['hmt larger mean'])
        spinBoxLayout.addRow('How many times larger than mean:',
                             self.hmtLargerMean)

        self.prevSeconds = QDoubleSpinBox()
        self.prevSeconds.setMinimum(0.1)
        self.prevSeconds.setMaximum(10000)
        self.prevSeconds.setValue(self.parameters['prev sec'])
        spinBoxLayout.addRow('Number of previous seconds:', self.prevSeconds)

        self.hmtLarger = QDoubleSpinBox()
        self.hmtLarger.setMinimum(0.1)
        self.hmtLarger.setMaximum(10000)
        self.hmtLarger.setValue(self.parameters['hmt larger'])
        spinBoxLayout.addRow('How many times larger than previous:',
                             self.hmtLarger)

        gBox = QGroupBox('Settings')
        gBox.setLayout(spinBoxLayout)
        self.mainLayout.addWidget(gBox)
Beispiel #21
0
    def __init__(self, parent: Optional[QWidget], level_ref: LevelRef):
        super(SpinnerPanel, self).__init__(parent)

        self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)

        self.level_ref = level_ref
        self.level_ref.data_changed.connect(self.update)

        self.spin_domain = Spinner(self, maximum=MAX_DOMAIN)
        self.spin_domain.setEnabled(False)
        self.spin_domain.valueChanged.connect(self.object_change.emit)

        self.spin_type = Spinner(self, maximum=MAX_TYPE)
        self.spin_type.setEnabled(False)
        self.spin_type.valueChanged.connect(self.object_change.emit)

        self.spin_length = Spinner(self, maximum=MAX_LENGTH)
        self.spin_length.setEnabled(False)
        self.spin_length.valueChanged.connect(self.object_change.emit)

        spinner_layout = QFormLayout()
        spinner_layout.addRow("Bank/Domain:", self.spin_domain)
        spinner_layout.addRow("Type:", self.spin_type)
        spinner_layout.addRow("Length:", self.spin_length)

        self.setLayout(spinner_layout)
    def createConnectionStatusGroup(self):
        connectionStatusGroup = QGroupBox("Connection Status")

        self.shaftEncoderConnectionStatusLineEdit = createReadOnlyLineEdit("Disconnected")
        self.motorControllerConnectionStatusLineEdit = createReadOnlyLineEdit("Disconnected")
        self.watchDogConnectionStatusLineEdit = createReadOnlyLineEdit("Disconnected")
        self.tcpServerConnectionStatusLineEdit = createReadOnlyLineEdit("Disconnected")

        self.connectButton = QPushButton("Connect")

        self.disconnectButton = QPushButton("Disconnect")
        self.disconnectButton.setEnabled(False)

        connectionButtonLayout = QHBoxLayout()
        connectionButtonLayout.addWidget(self.connectButton)
        connectionButtonLayout.addWidget(self.disconnectButton)

        connectionStatusLayout = QFormLayout()
        connectionStatusLayout.addRow(QLabel("Shaft Encoder: "), self.shaftEncoderConnectionStatusLineEdit)
        connectionStatusLayout.addRow(QLabel("Motor Controller: "), self.motorControllerConnectionStatusLineEdit)
        connectionStatusLayout.addRow(QLabel("Watchdog: "), self.watchDogConnectionStatusLineEdit)
        connectionStatusLayout.addRow(QLabel("TCP Server: "), self.tcpServerConnectionStatusLineEdit)
        connectionStatusLayout.addRow(connectionButtonLayout)

        connectionStatusGroup.setLayout(connectionStatusLayout)

        return connectionStatusGroup
Beispiel #23
0
    def __init__(self):
        super().__init__()

        self._db = Database()

        self.form = QFormLayout()
        row_1 = QHBoxLayout()
        row_2 = QHBoxLayout()
        row_3 = QHBoxLayout()
        row_4 = QHBoxLayout()

        self.name = QLineEdit()
        row_1.addWidget(QLabel("Name:"))
        row_1.addWidget(self.name)

        self.tag = QLineEdit()
        row_2.addWidget(QLabel("Tag:"))
        row_2.addWidget(self.tag)

        self.url = QLineEdit()
        row_3.addWidget(QLabel("URL:"))
        row_3.addWidget(self.url)

        enter_button = QPushButton()
        enter_button.setText("Save")
        enter_button.clicked.connect(self.save)
        row_4.addWidget(enter_button)

        self.form.addRow(row_1)
        self.form.addRow(row_2)
        self.form.addRow(row_3)
        self.form.addRow(row_4)
        self.setLayout(self.form)
Beispiel #24
0
 def create_new_show(self):
     w = QDialog()
     w.setWindowTitle("Create New Show")
     w.setLayout(QFormLayout())
     show_name = QLineEdit("New Show")
     w.layout().addRow(QLabel("New Show Title:"), show_name)
     prod_days = QSpinBox()
     w.layout().addRow(QLabel("Days of production:"), prod_days)
     calendar_input = QCalendarWidget()
     w.layout().addRow(QLabel("Start date:"))
     w.layout().addRow(calendar_input)
     if self.shows:  # If a show has already been created.
         previous_show = self.shows[-1]
         prod_days.setValue(previous_show.prod_days)
     accept = QPushButton("Create")
     accept.clicked.connect(w.accept)
     reject = QPushButton("Cancel")
     reject.clicked.connect(w.reject)
     w.layout().addRow(accept, reject)
     if w.exec_() == QDialog.Accepted:
         print("New show name:", show_name.text(), "Days of pre-production",
               prod_days.value())
         selected_date = calendar_input.selectedDate()
         start_date = datetime.date(selected_date.year(),
                                    selected_date.month(),
                                    selected_date.day())
         self.shows.append(
             Show(show_name.text(), prod_days.value(), start_date))
    def buildLayout(self):
        layout = QFormLayout()
        if len(self.dropdown_text.text()) > 0:
            layout.addWidget(self.dropdown_text)
            layout.addWidget(self.dropdown)
        if len(self.x_column_text.text()) > 0:
            layout.addWidget(self.x_column_text)
            layout.addWidget(self.x_column)
        if len(self.y_column_text.text()) > 0:
            layout.addWidget(self.y_column_text)
            layout.addWidget(self.y_column)
        if len(self.column_range_text.text()) > 0:
            layout.addWidget(self.column_range_text)
            layout.addWidget(self.column_range)
        if self.mode == 'Statistics':
            layout.addWidget(self.quartile_l)
            layout.addWidget(self.quartile)
            layout.addWidget(self.percentile_l)
            layout.addWidget(self.percentile)
        if self.mode == 'Regression':
            layout.addWidget(self.degree_l)
            layout.addWidget(self.degree)
        layout.addWidget(self.run_button)
        if self.mode != 'Boxplot' and self.mode != "Histogram":
            layout.addWidget(self.results_l)
            layout.addWidget(self.results)

        self.setLayout(layout)
Beispiel #26
0
    def _create_main_widget(self) -> QWidget:
        self.__main_widget = QWidget()
        self.__layout = QVBoxLayout(self.__main_widget)

        self.__method_widget = ChooseOneOfWidget('Method', {
            cv.HOUGH_GRADIENT: 'HOUGH_GRADIENT',
            cv.HOUGH_GRADIENT_ALT: 'HOUGH_GRADIENT_ALT'
        }, checked_index=cv.HOUGH_GRADIENT_ALT)

        self.__layout.addWidget(self.__method_widget)

        params_layout = QFormLayout()
        self.__dp_line_edit = QLineEdit()
        params_layout.addRow(QLabel('dp'), self.__dp_line_edit)
        self.__min_dist_line_edit = QLineEdit()
        params_layout.addRow(QLabel('minDist'), self.__min_dist_line_edit)
        self.__param1_line_edit = QLineEdit()
        params_layout.addRow(QLabel('param1'), self.__param1_line_edit)
        self.__param2_line_edit = QLineEdit()
        params_layout.addRow(QLabel('param2'), self.__param2_line_edit)
        self.__min_radius_line_edit = QLineEdit()
        params_layout.addRow(QLabel('minRadius'), self.__min_radius_line_edit)
        self.__max_radius_line_edit = QLineEdit()
        params_layout.addRow(QLabel('maxRadius'), self.__max_radius_line_edit)

        self.__layout.addLayout(params_layout)

        self.__detect_button = QPushButton('Detect')
        self.__detect_button.clicked.connect(self.__on_detect_button_clicked)
        self.__layout.addWidget(self.__detect_button)

        return self.__main_widget
Beispiel #27
0
    def __init__(self):
        super().__init__()

        self.setTitle("Entrée")
        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Maximum)

        main_layout = QFormLayout(self)
        main_layout.setHorizontalSpacing(20)
        main_layout.setVerticalSpacing(14)

        self._name_text = QLineEdit()
        self._name_validator = QRegExpValidator(
            QRegExp("^[a-zA-Z0-9_-#éèêëàîï ]{5,30}$"))
        self._name_text.setValidator(self._name_validator)
        self._name_text.inputRejected.connect(self._analysisNameError)
        self._name_text.textChanged.connect(self._analysisNameChanged)
        main_layout.addRow("Nom de l'analyse :", self._name_text)

        self._filepath_text = QLineEdit()
        self._filepath_button = QPushButton(" Parcourir... ")

        filepath_layout = QHBoxLayout()
        filepath_layout.setSpacing(8)
        filepath_layout.addWidget(self._filepath_text)
        filepath_layout.addWidget(self._filepath_button)

        main_layout.addRow("Dossier d'images à analyser :", filepath_layout)

        self.setLayout(main_layout)

        # Button slots
        self._filepath_button.clicked.connect(self.filepathBrowse)
def SaveZeroPoint(offset: float, zeroPointManager: ZeroPointManager):
    dialog = QDialog()
    dialog.setWindowTitle("Save Zero Position")

    zeroPositionNameLineEdit = QLineEdit("Default Name: ")
    zeroPositionOffsetLineEdit = QLineEdit(str(offset))
    zeroPositionOffsetLineEdit.setEnabled(False)

    buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)

    def createNewZeroPoint():
        zeroPointManager.createZeroPoint(
            zeroPositionNameLineEdit.text(),
            float(zeroPositionOffsetLineEdit.text()))
        dialog.close()

    buttonBox.accepted.connect(createNewZeroPoint)
    buttonBox.rejected.connect(dialog.reject)

    layout = QFormLayout()
    layout.addRow(QLabel("Name: "), zeroPositionNameLineEdit)
    layout.addRow(QLabel("Offset: "), zeroPositionOffsetLineEdit)
    layout.addRow(buttonBox)

    dialog.setLayout(layout)
    return dialog
Beispiel #29
0
 def addUiExportOptions(self, top_layout, mode):
     if mode == 'material':
         lyt = QFormLayout()
         lyt.FieldGrowthPolicy(QFormLayout.ExpandingFieldsGrow)
         lyt.setContentsMargins(5, 5, 5, 5)
         lyt.setSpacing(5)
         lyt.setLabelAlignment(Qt.AlignRight)
         # BXDF
         self.opt_bxdf = QComboBox()
         self.opt_bxdf.addItems(
             list(self.rules['models'].keys()))
         lyt.addRow('BxDF :', self.opt_bxdf)
         # color space
         self.opt_ocio = QComboBox()
         self.opt_ocio.addItems(
             ['Off', 'ACES-1.2', 'filmic-blender', '$OCIO'])
         lyt.addRow('Color configuration :', self.opt_ocio)
         # add to parent layout
         top_layout.addLayout(lyt)
         # set last used bxdf and ocio config
         last_bxdf = self.prefsobj.get('last bxdf', None)
         if last_bxdf:
             self.opt_bxdf.setCurrentText(last_bxdf)
         ocio_config = self.prefsobj.get('ocio config', None)
         if ocio_config:
             self.opt_ocio.setCurrentText(ocio_config)
 def field_from_value(self, parent, value, field):
     if isinstance(value, bool):
         item = QCheckBox('')
         item.setChecked(value)
         return item
     if isinstance(value, str):
         field.text_type = STRING_SETTING
         return QLineEdit(value)
     if isinstance(value, numbers.Real):
         field.text_type = NUMBER_SETTING
         return QLineEdit(str(value))
     if isinstance(value, list):
         if isinstance(value[0], str):
             field.text_type = STRING_LIST_SETTING
             return QLineEdit(", ".join(value))
         elif isinstance(value[0], numbers.Real):
             field.text_type = NUMBER_LIST_SETTING
             return QLineEdit(", ".join((str(x) for x in value)))
     if isinstance(value, dict):
         subpage = QGroupBox(parent)
         form = QFormLayout()
         for label in sorted(value.keys()):
             subfield = Field(None, label)
             subfield.widget = self.field_from_value(
                 subpage, value[label], subfield)
             field.add_child(subfield)
             form.addRow(QLabel(label), subfield.widget)
         subpage.setLayout(form)
         return subpage
     # This is left for bug reporting purposes.
     printer.out(
         "{} was not assigned to {} because type {} is unknown.".format(
             value, parent, type(value)))
     return None