示例#1
0
def get_widget_from_ranking(ranking):
    assert isinstance(ranking, RankingItem)
    qual = ranking.qual.name
    qual_checkbox = QCheckBox(ranking.qual.get_title())
    qual_checkbox.setFixedWidth(50)
    qual_checkbox.setObjectName(qual + '_checkbox')

    type_combo = AdvComboBox()
    type_combo.addItems([_('Rank'), _('Max place'), _('Result time')])
    type_combo.setFixedWidth(150)
    type_combo.setObjectName(qual + '_combo')

    max_place = QSpinBox()
    max_place.setValue(0)
    max_place.setFixedWidth(70)
    max_place.setObjectName(qual + '_place')

    max_time = QTimeEdit()
    max_time.setFixedWidth(70)
    max_time.setDisplayFormat("hh:mm:ss")
    max_time.setObjectName(qual + '_time')

    def select_type():
        text = type_combo.currentText()
        max_place.setVisible(text == _('Max place'))
        max_time.setVisible(text == _('Result time'))

    def set_enabled():
        flag = qual_checkbox.isChecked()
        type_combo.setEnabled(flag)
        max_place.setEnabled(flag)
        max_time.setEnabled(flag)

    type_combo.currentIndexChanged.connect(select_type)
    qual_checkbox.stateChanged.connect(set_enabled)

    if ranking.use_scores:
        type_combo.setCurrentText(_('Rank'))
    elif ranking.max_place:
        type_combo.setCurrentText(_('Max place'))
        max_place.setValue(ranking.max_place)
    else:
        type_combo.setCurrentText(_('Result time'))
        max_time.setTime(time_to_qtime(ranking.max_time))

    qual_checkbox.setChecked(ranking.is_active)
    select_type()
    set_enabled()

    layout = QHBoxLayout()
    layout.addWidget(qual_checkbox)
    layout.addWidget(type_combo)
    layout.addWidget(max_place)
    layout.addWidget(max_time)
    return layout
示例#2
0
    def make_func_groupbox(self):
        func_layout = QHBoxLayout()

        self.encode_widget = RadioBox(encode_dict)
        encode_layout = self.encode_widget.make_radio_box("UTF-8 with BOM")
        self.encode_groupbox = QGroupBox("Encode to: ")
        self.encode_groupbox.setLayout(encode_layout)
        self.encode_groupbox.setCheckable(True)
        self.encode_groupbox.clicked.connect(self.option_set)
        func_layout.addWidget(self.encode_groupbox)

        self.fmt_groupbox = QGroupBox("Convert image format")
        fmt_hbox = QHBoxLayout()
        self.format_widget_from = RadioBox(self.format_dict)
        format_layout_from = self.format_widget_from.make_radio_box("WebP")
        fmt_from_groupbox = QGroupBox("Convert image from: ")
        fmt_from_groupbox.setLayout(format_layout_from)
        fmt_hbox.addWidget(fmt_from_groupbox)

        self.format_widget_to = RadioBox(self.format_dict)
        format_layout_to = self.format_widget_to.make_radio_box("PNG")
        fmt_to_groupbox = QGroupBox("Convert image to: ")
        fmt_to_groupbox.setLayout(format_layout_to)
        fmt_hbox.addWidget(fmt_to_groupbox)
        self.fmt_groupbox.setLayout(fmt_hbox)
        self.fmt_groupbox.setCheckable(True)
        func_layout.addWidget(self.fmt_groupbox)

        option_groupbox = QGroupBox("OPTION: ")
        option_layout = QVBoxLayout()
        self.change_txt_yn = QCheckBox("Change image ext in CSV/ERB", self)
        self.change_txt_yn.toggle()
        self.change_txt_yn.clicked.connect(self.option_set)
        self.backup_yn = QCheckBox("Place files in Result directory", self)
        self.backup_yn.clicked.connect(self.option_set)

        option_layout.addWidget(self.change_txt_yn)
        option_layout.addWidget(self.backup_yn)
        option_groupbox.setLayout(option_layout)
        func_layout.addWidget(option_groupbox)

        self.main_layout.addLayout(func_layout)
    def funcSearchFacilities(self):
        value = self.searchFacilitesEntry.text()
        if value == "":
            QMessageBox.information(self, "Warning",
                                    "Search string cannot be empty")
            self.displayFacilities()
        else:
            # Erase search entry
            self.searchFacilitesEntry.setText("")
            try:
                query = "SELECT * FROM facilities WHERE " \
                        "facility_id LIKE ? " \
                        "OR facility_name LIKE ?" \
                        "OR facility_location LIKE ?" \
                        "OR facility_phone LIKE ?" \
                        "OR facility_email LIKE ?" \
                        "OR facility_supervisor LIKE ?"
                results = db.cur.execute(
                    query, ('%' + value + '%', '%' + value + '%',
                            '%' + value + '%', '%' + value + '%',
                            '%' + value + '%', '%' + value + '%')).fetchall()
                if results == []:
                    QMessageBox.information(self, "Info", "Nothing was found")
                    self.funcDisplayFacilities()
                else:
                    for i in reversed(range(self.facilitiesTable.rowCount())):
                        self.facilitiesTable.removeRow(i)

                    for row_data in results:
                        row_number = self.facilitiesTable.rowCount()
                        self.facilitiesTable.insertRow(row_number)
                        # Add checkboxes to the table
                        qwidget = QWidget()
                        checkbox = QCheckBox()
                        checkbox.setCheckState(Qt.Unchecked)
                        qhboxlayout = QHBoxLayout(qwidget)
                        qhboxlayout.addWidget(checkbox)
                        qhboxlayout.setAlignment(Qt.AlignCenter)
                        self.facilitiesTable.setCellWidget(
                            row_number, 0, qwidget)
                        self.facilitiesTable.setItem(
                            row_number, 0, QTableWidgetItem(row_number))
                        for column_number, data in enumerate(row_data,
                                                             start=1):
                            if column_number == 1:
                                self.facilitiesTable.setItem(
                                    row_number, column_number,
                                    QTableWidgetItem("FCL#" + str(data)))
                            else:
                                self.facilitiesTable.setItem(
                                    row_number, column_number,
                                    QTableWidgetItem(str(data)))
            except:
                QMessageBox.information(self, "Info", "Cannot access database")
示例#4
0
    def displayWidgets(self):
        # create label and button widgets
        title = QLabel("Вечерний опрос")
        title.setFont(QFont('Arial', 17))
        question = QLabel("Насколько плодотворно прошел Ваш день?")
        question.setAlignment(Qt.AlignHCenter)
        # согдание горизонтального layout-а
        title_h_box = QHBoxLayout()
        title_h_box.addStretch()
        title_h_box.addWidget(title)
        title_h_box.addStretch()
        # Варианты выбора
        ratings = ["Ужасно", "Ну, такое", "Нормально", "Отлично"]

        ratings_h_box = QHBoxLayout()
        # Устанавливаем расстояние между виджетами в горизонтальном layout-е
        ratings_h_box.setSpacing(80)

        ratings_h_box.addStretch()
        for rating in ratings:
            rate_label = QLabel(rating, self)
            ratings_h_box.addWidget(rate_label)
        ratings_h_box.addStretch()

        cb_h_box = QHBoxLayout()
        # расстояние между виджетами в горизонтальном layout-е
        cb_h_box.setSpacing(100)

        # Создаем контейнер для групировки QCheckBox
        scale_bg = QButtonGroup(self)

        cb_h_box.addStretch()
        for cb in range(len(ratings)):
            scale_cb = QCheckBox(str(cb), self)
            cb_h_box.addWidget(scale_cb)
            scale_bg.addButton(scale_cb)
        cb_h_box.addStretch()

        # устанавливаем функцию отработки варианта выбора
        scale_bg.buttonClicked.connect(self.checkboxClicked)
        close_button = QPushButton("Закрыть", self)
        close_button.clicked.connect(self.close)
        # Компануем вертикальный layout последовательно
        # добавляя виджеты and элементы h_box layout
        v_box = QVBoxLayout()
        v_box.addLayout(title_h_box)
        v_box.addWidget(question)
        v_box.addStretch(1)
        v_box.addLayout(ratings_h_box)
        v_box.addLayout(cb_h_box)
        v_box.addStretch(2)
        v_box.addWidget(self.label)
        v_box.addWidget(close_button)
        self.setLayout(v_box)
示例#5
0
    def __init__(self, image, parent=None):
        super(FrequencyWidget, self).__init__(parent)

        self.ampl_radio = QRadioButton(self.tr('Amplitude'))
        self.ampl_radio.setChecked(True)
        self.phase_radio = QRadioButton(self.tr('Phase'))
        self.dct_radio = QRadioButton(self.tr('DCT Map'))
        self.last_radio = self.ampl_radio
        self.thr_spin = QSpinBox()
        self.thr_spin.setRange(0, 255)
        self.thr_spin.setSpecialValueText(self.tr('Off'))
        self.ratio_label = QLabel()
        self.filter_check = QCheckBox(self.tr('Filter'))

        self.ampl_radio.clicked.connect(self.process)
        self.phase_radio.clicked.connect(self.process)
        self.dct_radio.clicked.connect(self.process)
        self.thr_spin.valueChanged.connect(self.process)
        self.filter_check.stateChanged.connect(self.process)

        gray = cv.cvtColor(image, cv.COLOR_BGR2GRAY)
        rows, cols = gray.shape
        height = cv.getOptimalDFTSize(rows)
        width = cv.getOptimalDFTSize(cols)
        padded = cv.copyMakeBorder(gray, 0, height - rows, 0, width - cols,
                                   cv.BORDER_CONSTANT).astype(np.float32)
        planes = cv.merge([padded, np.zeros_like(padded)])
        dft = cv.split(np.fft.fftshift(cv.dft(planes)))
        mag, phase = cv.cartToPolar(dft[0], dft[1])
        dct = cv.dct(padded)
        self.result = [
            normalize_mat(img)
            for img in [cv.log(mag), phase, cv.log(dct)]
        ]

        self.image = image
        self.viewer = ImageViewer(self.image, None)
        self.process()

        top_layout = QHBoxLayout()
        top_layout.addWidget(QLabel(self.tr('Coefficients:')))
        top_layout.addWidget(self.ampl_radio)
        top_layout.addWidget(self.phase_radio)
        top_layout.addWidget(self.dct_radio)
        top_layout.addWidget(self.filter_check)
        top_layout.addStretch()
        top_layout.addWidget(QLabel(self.tr('Threshold:')))
        top_layout.addWidget(self.thr_spin)
        top_layout.addWidget(self.ratio_label)

        main_layout = QVBoxLayout()
        main_layout.addLayout(top_layout)
        main_layout.addWidget(self.viewer)
        self.setLayout(main_layout)
示例#6
0
    def draw(self):
        # Create widgets, table and configure them.
        self.update_button = QPushButton("Refresh")
        self.options_button = QPushButton("Configure")
        self.refresh_bool = QCheckBox("Automatically refresh?")
        self.refresh_freq = QComboBox()
        self.refresh_freq.addItem("1 hour")
        self.refresh_freq.addItem("6 hours")
        self.refresh_freq.addItem("12 hour")
        self.refresh_freq.addItem("24 hour")
        self.refresh_freq.addItem("3 days")
        self.refresh_freq.addItem("7 days")

        self.refresh_bool.nextCheckState()

        button_width = 150
        button_height = 20

        combo_box_width = 150
        combo_box_height = 20

        self.update_button.setStyleSheet("max-width:%dpx;height:%dpx;" %
                                         (button_width, button_height))
        self.options_button.setStyleSheet("max-width:%dpx;height:%dpx;" %
                                          (button_width, button_height))
        self.refresh_freq.setStyleSheet("max-width:%dpx;height:%dpx;" %
                                        (combo_box_width, combo_box_height))

        self.tableWidget = QTableWidget(1, 3)
        self.tableWidget.setHorizontalHeaderItem(0, QTableWidgetItem('Ship'))
        self.tableWidget.setHorizontalHeaderItem(1, QTableWidgetItem('Price'))
        self.tableWidget.setHorizontalHeaderItem(
            2, QTableWidgetItem('Availability'))

        # Size columns.
        header = self.tableWidget.horizontalHeader()
        header.setSectionResizeMode(0, QHeaderView.Stretch)
        header.setSectionResizeMode(1, QHeaderView.ResizeToContents)
        header.setSectionResizeMode(2, QHeaderView.ResizeToContents)

        # Set layout and add widgets to it.
        self.layout = QVBoxLayout()
        self.layout.addWidget(self.tableWidget)
        self.layout.addWidget(self.update_button, 0)
        # self.layout.addWidget(self.options_button, 1)
        self.setLayout(self.layout)

        # Connecting the signal.
        self.update_button.clicked.connect(self.refresh)
        #TODO self.options_button.clicked.connect(self.show_options)
        # Draw the UI to the screen.
        self.resize(600, 1400)
        self.setWindowTitle("Star Citizen Ship Prices")
        self.show()
示例#7
0
    def create_tool_bars(self):
        """Creates the necessary toolbars.
        """

        # File Toolbar
        self.fileToolBar = self.addToolBar("File Toolbar")
        self.fileToolBar.setObjectName('fileToolbar')
        self.fileToolBar.addAction(self.newAct)
        self.fileToolBar.addAction(self.openAct)
        self.fileToolBar.addAction(self.saveAct)
        self.fileToolBar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)

        # Edit Toolbar
        self.editToolBar = self.addToolBar("Edit Toolbar")
        self.editToolBar.setObjectName('editToolbar')
        self.editToolBar.addAction(self.undoAct)
        self.editToolBar.addAction(self.redoAct)
        self.editToolBar.addAction(self.newObjAct)
        self.editToolBar.addAction(self.dupObjAct)
        self.editToolBar.addAction(self.delObjAct)
        self.editToolBar.addAction(self.cutObjAct)
        self.editToolBar.addAction(self.copyObjAct)
        self.editToolBar.addAction(self.pasteObjAct)
        self.editToolBar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)

        # Object history navigation toolbar
        # self.navToolBar = self.addToolBar("Navigation Toolbar")
        # self.navToolBar.setObjectName('viewToolBar')
        # self.navToolBar.addAction(self.navForwardAct)
        # self.navToolBar.addAction(self.navBackAct)
        # self.navToolBar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)

        # Object filter toolbar
        self.filterToolBar = self.addToolBar("Filter Toolbar")
        self.filterToolBar.setObjectName('filterToolBar')
        self.filterBox = QLineEdit()
        self.filterBox.setPlaceholderText("Filter Objects")
        self.filterBox.setMaximumWidth(160)
        self.filterBox.setFixedWidth(160)
        # filterLabel = QLabel("Filter Obj:", self)
        # filterLabel.setBuddy(self.filterBox)
        # self.filterToolBar.addWidget(filterLabel)
        self.filterBox.textChanged.connect(self.tableFilterRegExpChanged)
        self.filterBox.textChanged.connect(self.treeFilterRegExpChanged)
        clearFilterButton = QPushButton('Clear')
        clearFilterButton.setMaximumWidth(45)
        clearFilterButton.clicked.connect(self.clearFilterClicked)
        self.filterToolBar.addWidget(self.filterBox)
        self.filterToolBar.addWidget(clearFilterButton)
        self.caseSensitivity = QCheckBox('Case Sensitive')
        self.caseSensitivity.stateChanged.connect(self.caseSensitivityChanged)
        self.filterToolBar.addWidget(self.caseSensitivity)
        self.filterToolBar.addSeparator()
        self.filterToolBar.addAction(self.transposeAct)
示例#8
0
    def __init__(self, path, owner):
        QWidget.__init__(self)
        self.path = path
        self.scroll_area = QScrollArea()
        self.num_columns = 3
        self.owner = owner
        # self.checkboxes_widget = QWidget()

        for paper in Index.gPapers:
            if paper['path'] == self.path:
                self.paper = paper

        self.columns = []
        for i in range(self.num_columns):
            layout = QVBoxLayout()
            layout.setSpacing(0)
            layout.setMargin(0)
            self.columns.append(layout)

        self.checkboxes = []
        self.tags_copy = Index.gTags.copy()
        self.tags_copy.sort(key=lambda s: s)

        count = 0
        for tag in self.tags_copy:
            checkbox = QCheckBox(tag)
            self.checkboxes.append(checkbox)
            self.columns[int(
                (self.num_columns * count) / len(self.tags_copy))].addWidget(
                    checkbox)  #add the checkbox to the appropriate column

            if 'tags' in self.paper:
                if tag in self.paper['tags']:
                    checkbox.setChecked(True)

            checkbox.clicked.connect(self.checkbox_click_creator(checkbox))
            count += 1

        # self.checkboxes_widget.setLayout(self.layout)
        # self.scroll_area.setWidget(self.checkboxes_widget)

        self.layout = QHBoxLayout()
        for col in self.columns:
            self.layout.addLayout(col)

        self.scroll_area.setLayout(self.layout)
        self.scroll_area.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        self.scroll_area.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        self.scroll_area.setWidgetResizable(True)

        self.full_layout = QHBoxLayout()
        self.full_layout.addWidget(self.scroll_area)

        self.setLayout(self.full_layout)
示例#9
0
    def initUI(self):

        cb = QCheckBox('Show title', self)
        cb.move(20, 20)
        cb.toggle()     # 选中checkBox
        cb.stateChanged.connect(self.changeTitle)
        # checkBox, 带参数信号

        self.setGeometry(300, 300, 600, 400)
        self.setWindowTitle('QCheckBox')
        self.show()
示例#10
0
    def __init__(self, parent: QWidget = None):
        super().__init__(parent)
        self.dataWidgetL = DataframeView(self)
        self.dataWidgetR = DataframeView(self)
        self.scrollTogetherH = QCheckBox('Lock horizontal scroll', self)
        self.scrollTogetherV = QCheckBox('Lock vertical scroll', self)
        cLayout = QHBoxLayout()
        cLayout.addWidget(self.scrollTogetherH)
        cLayout.addWidget(self.scrollTogetherV)

        splitter = QSplitter(self)
        splitter.addWidget(self.dataWidgetL)
        splitter.addWidget(self.dataWidgetR)
        layout = QVBoxLayout(self)
        layout.addLayout(cLayout)
        layout.addWidget(splitter)
        splitter.setSizes([10, 10])

        self.scrollTogetherH.toggled.connect(self.lockScrollChangedHorizontal)
        self.scrollTogetherV.toggled.connect(self.lockScrollChangedVertical)
    def _setupUI(self):
        self.setWindowTitle("Export Attributes to USD")
        layout = QVBoxLayout()

        # This section contains the attributes tagged for export.
        label = QLabel()
        label.setText('Exported Attributes:')
        layout.addWidget(label)

        self.exportedAttrsModel = ExportedAttributesModel()
        self.exportedAttrsView = ExportedAttributesView()
        self.exportedAttrsView.verticalHeader().hide()
        self.exportedAttrsView.setModel(self.exportedAttrsModel)
        selectionModel = self.exportedAttrsView.selectionModel()
        selectionModel.selectionChanged.connect(
            self._onExportedAttrsSelectionChanged)
        self.exportedAttrsModel.dataChanged.connect(self._onModelDataChanged)
        layout.addWidget(self.exportedAttrsView)

        self.removeExportedAttrButton = QPushButton(
            "Remove Exported Attribute")
        self.removeExportedAttrButton.clicked.connect(
            self._onRemoveExportedAttrPressed)
        self.removeExportedAttrButton.setEnabled(False)
        layout.addWidget(self.removeExportedAttrButton)

        # This section contains the attributes available for export.
        label = QLabel()
        label.setText('Available Attributes:')
        layout.addWidget(label)

        self.userDefinedCheckBox = QCheckBox('User Defined')
        self.userDefinedCheckBox.setToolTip(
            'Show only user-defined (dynamic) attributes')
        self.userDefinedCheckBox.setChecked(True)
        self.userDefinedCheckBox.stateChanged.connect(self._syncUI)
        layout.addWidget(self.userDefinedCheckBox)

        self.addAttrsModel = AddAttributesModel()
        self.addAttrsView = AddAttributesView()
        self.addAttrsView.setModel(self.addAttrsModel)
        selectionModel = self.addAttrsView.selectionModel()
        selectionModel.selectionChanged.connect(
            self._onAddAttrsSelectionChanged)
        self.addAttrsModel.dataChanged.connect(self._onModelDataChanged)
        layout.addWidget(self.addAttrsView)

        self.addExportedAttrButton = QPushButton("Add Exported Attribute")
        self.addExportedAttrButton.clicked.connect(
            self._onAddExportedAttrPressed)
        self.addExportedAttrButton.setEnabled(False)
        layout.addWidget(self.addExportedAttrButton)

        self.setLayout(layout)
示例#12
0
    def editorEvent(self, event: QEvent, model: 'PropModel',
                    option: QStyleOptionViewItem, index: QModelIndex) -> bool:
        """
		Change the data in the model and the state of the checkbox
		if the user presses the left mouse button or presses
		Key_Space or Key_Select and this cell is editable. Otherwise do nothing.

		:param event: The event that will take place to trigger the editor Event.
		:type event: QEvent
		:param model: The model that our delegate will render.
		:type model: PropModel
		:param option: Option for the kind've event that takes place.
		:type option: QStyleOptionViewItem
		:param index: Index of the events.
		:type index: QModelIndex
		:return: true if the given editor is a valid QWidget and the given event is handled; otherwise returns false.
		:rtype: bool
		"""
        event.type()
        if not (index.flags() & QtCore.Qt.ItemIsEditable) > 0:
            return False

        data = index.internalPointer()
        if index.column() != 1 or not isinstance(
                data, Property) or data.getType() != bool:
            return QStyledItemDelegate.editorEvent(self, event, model, option,
                                                   index)

        if data.isReadOnly():
            return False

        # Do not change the checkbox-state
        if event.type() == QEvent.MouseButtonPress:
            return False
        if event.type() == QEvent.MouseButtonRelease or event.type(
        ) == QEvent.MouseButtonDblClick:
            if event.button(
            ) != QtCore.Qt.LeftButton or not self.getCheckBoxRect(
                    option).contains(event.pos()):
                return False
            if event.type() == QEvent.MouseButtonDblClick:
                return True
        elif event.type() == QEvent.KeyPress:
            if event.key() != QtCore.Qt.Key_Space and event.key(
            ) != QtCore.Qt.Key_Select:
                return False
        else:
            return False

        # Change the checkbox-state
        checkbox = QCheckBox('temp')
        checkbox.setChecked(not data.getValue())
        self.setModelData(checkbox, model, index)
        return True
示例#13
0
    def __init__(self, parent):
        self.widget = QWidget()
        self.layout = QFormLayout(parent)

        self.sounds = get_sounds()

        self.item_enabled = QCheckBox(_('Enabled'))
        self.item_enabled.setChecked(Config().sound.get('enabled'))
        self.layout.addRow(self.item_enabled)

        self.label_successful = QLabel(_('Successful result'))
        self.item_successful = AdvComboBox()
        self.item_successful.addItems(self.sounds)
        self.item_successful.setCurrentText(Config().sound.get('successful')
                                            or config.sound_dir('ok.wav'))
        self.layout.addRow(self.label_successful, self.item_successful)

        self.label_unsuccessful = QLabel(_('Unsuccessful result'))
        self.item_unsuccessful = AdvComboBox()
        self.item_unsuccessful.addItems(self.sounds)
        self.item_unsuccessful.setCurrentText(
            Config().sound.get('unsuccessful')
            or config.sound_dir('failure.wav'))
        self.layout.addRow(self.label_unsuccessful, self.item_unsuccessful)

        self.item_enabled_rented_card = QCheckBox(
            _('Enable rented card sound'))
        self.item_enabled_rented_card.setChecked(Config().sound.get(
            'enabled_rented_card',
            Config().sound.get('enabled')))
        self.layout.addRow(self.item_enabled_rented_card)

        self.label_rented_card = QLabel(_('Rented card sound'))
        self.item_rented_card = AdvComboBox()
        self.item_rented_card.addItems(self.sounds)
        self.item_rented_card.setCurrentText(
            Config().sound.get('rented_card')
            or config.sound_dir('rented_card.wav'))
        self.layout.addRow(self.label_rented_card, self.item_rented_card)

        self.widget.setLayout(self.layout)
示例#14
0
 def __init__(self, parent=None):
     super().__init__(parent)
     self.mainLayout = QVBoxLayout(self)
     self.byTime = QCheckBox('By time', self)
     self.byDate = QCheckBox('By date', self)
     self.group = QButtonGroup(self)
     butLayout = QHBoxLayout()
     butLayout.addWidget(self.byDate)
     butLayout.addWidget(self.byTime)
     self.group.addButton(self.byDate)
     self.group.addButton(self.byTime)
     self.addRowBut = QPushButton('Add interval', self)
     self.addRowBut.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
     self.gLayout = QGridLayout()
     self.mainLayout.addLayout(butLayout)
     self.mainLayout.addWidget(self.addRowBut, 0, Qt.AlignLeft)
     self.mainLayout.addLayout(self.gLayout)
     self.gLayout.setHorizontalSpacing(self._SPACER)
     self.group.setExclusive(False)
     self.byDate.setChecked(True)
     self.byTime.setChecked(True)
示例#15
0
    def add_items_to_list(self, items, locked=[]):
        self.ui.tableWidget.setRowCount(len(items))
        self.ui.tableWidget.clear()
        self.set_headers()

        for col, item in enumerate(items):
            box = None
            if item in locked:
                box = QCheckBox()
                box.setChecked(True)
            self.add_item_to_list(item[0], item[1], item[2], item[4], item[5],
                                  col, box)
示例#16
0
    def closeEvent(self, event):
        if sys.platform != "darwin" and self.app.show_minimize_message:
            msg = QMessageBox(self)
            msg.setWindowTitle("App Minimized")
            msg.setText("The app will be minimized to your system tray.")
            msg.setIcon(QMessageBox.Icon.Information)
            check = QCheckBox("Don't show again.")
            msg.setCheckBox(check)
            msg.exec_()

            self.app.show_minimize_message = not check.isChecked()
            Settings.set_param("minimize", not self.app.show_minimize_message)
示例#17
0
    def __init__(self, parent=None):
        super(Window, self).__init__(parent)

        self.iconGroupBox = QGroupBox()
        self.iconLabel = QLabel()
        self.iconComboBox = QComboBox()
        self.showIconCheckBox = QCheckBox()

        self.messageGroupBox = QGroupBox()
        self.typeLabel = QLabel()
        self.durationLabel = QLabel()
        self.durationWarningLabel = QLabel()
        self.titleLabel = QLabel()
        self.bodyLabel = QLabel()

        self.typeComboBox = QComboBox()
        self.durationSpinBox = QSpinBox()
        self.titleEdit = QLineEdit()
        self.bodyEdit = QTextEdit()
        self.showMessageButton = QPushButton()

        self.minimizeAction = QAction()
        self.maximizeAction = QAction()
        self.restoreAction = QAction()
        self.quitAction = QAction()

        self.trayIcon = QSystemTrayIcon()
        self.trayIconMenu = QMenu()

        self.createIconGroupBox()
        self.createMessageGroupBox()

        self.iconLabel.setMinimumWidth(self.durationLabel.sizeHint().width())

        self.createActions()
        self.createTrayIcon()

        self.showMessageButton.clicked.connect(self.showMessage)
        self.showIconCheckBox.toggled.connect(self.trayIcon.setVisible)
        self.iconComboBox.currentIndexChanged.connect(self.setIcon)
        self.trayIcon.messageClicked.connect(self.messageClicked)
        self.trayIcon.activated.connect(self.iconActivated)

        self.mainLayout = QVBoxLayout()
        self.mainLayout.addWidget(self.iconGroupBox)
        self.mainLayout.addWidget(self.messageGroupBox)
        self.setLayout(self.mainLayout)

        self.iconComboBox.setCurrentIndex(1)
        self.trayIcon.show()

        self.setWindowTitle("Systray")
        self.resize(400, 300)
 def __init__(self, parent):
     super().__init__(parent)
     self.setTitle("Installation successful")
     self._label = HyperTextLabel()
     layout = QVBoxLayout(self)
     use_julia_check_box = QCheckBox("Use this Julia with Spine Toolbox")
     self.registerField("use_julia", use_julia_check_box)
     layout.addWidget(self._label)
     layout.addStretch()
     layout.addWidget(use_julia_check_box)
     layout.addStretch()
     layout.addStretch()
示例#19
0
    def __init__(self, listeners_pool, *args, **kwargs):
        super(SecondaryFilters, self).__init__(*args, **kwargs)
        ListenerNode.__init__(self, 'secondary-filters', listeners_pool)

        self.group_by_month = QCheckBox('Por mes')
        self.group_by_type = QCheckBox('Por tipo de gasto')

        layout = QVBoxLayout()
        self.setLayout(layout)

        inner_layout = QHBoxLayout()
        inner_layout.addWidget(self.group_by_month)
        inner_layout.addWidget(self.group_by_type)

        group_box = QGroupBox('Agrupaciones')
        group_box.setLayout(inner_layout)

        layout.addWidget(group_box)

        self.group_by_month.stateChanged.connect(self.grouping_changed)
        self.group_by_type.stateChanged.connect(self.grouping_changed)
示例#20
0
 def _widget(self, key, values, label, default):
     w = QGroupBox()
     layout = QVBoxLayout()
     self._optionwidgets = {}
     self._layout = layout
     for value, default in zip(values, default):
         checkbox = QCheckBox(value)
         checkbox.setChecked(default)
         self._optionwidgets[key] = checkbox
         layout.addWidget(checkbox)
     w.setLayout(layout)
     return w
示例#21
0
    def setup_func_widget(self):
        f_widget = QWidget()
        f_layout = QHBoxLayout()
        self.select_button = QPushButton("Open Dir")
        self.select_button.clicked.connect(self.select_dir)
        self.save_button = QPushButton("Save")
        self.save_button.clicked.connect(self.save_data)
        self.delete_button = QPushButton("Delete")
        self.delete_button.clicked.connect(self.delete_data)
        self.auto_load_next_data_box = QCheckBox("Auto Load Next")
        self.auto_save_box = QCheckBox("Auto Save")
        self.auto_take_over_last_data_box = QCheckBox("Auto Use Last label")

        f_layout.addWidget(self.select_button)
        f_layout.addWidget(self.save_button)
        f_layout.addWidget(self.delete_button)
        f_layout.addWidget(self.auto_load_next_data_box)
        f_layout.addWidget(self.auto_save_box)
        f_layout.addWidget(self.auto_take_over_last_data_box)
        f_widget.setLayout(f_layout)
        return f_widget
示例#22
0
 def _insert_merged(self, al, bl):
     if al:
         row = self.rowCount()
         self.insertRow(row)
         self.setItem(row, 1,
                      self._table_item('\n'.join(map(lambda x: x[0], al))))
         self.setItem(row, 2, self._table_item())
         self.setItem(row, 3, self._table_item())
         editor = NPTextEdit(bg_color='#ffeef0')
         editor.sig_size.connect(self.item(row, 3).setSizeHint)
         self._highlight(editor, ''.join(map(lambda x: x[1], al)),
                         self.fmt_sub, self.fmt_sub)
         self.setCellWidget(row, 3, editor)
         if not bl:
             self.setItem(row, 0, self._table_item())
             self.setCellWidget(row, 0, QCheckBox(checked=True))
             self.cellWidget(row, 3).setReadOnly(True)
     if bl:
         row = self.rowCount()
         self.insertRow(row)
         self.setItem(row, 1, self._table_item())
         self.setItem(row, 2,
                      self._table_item('\n'.join(map(lambda x: x[0], bl))))
         self.setItem(row, 3, self._table_item())
         editor = NPTextEdit(bg_color='#e6ffed')
         editor.sig_size.connect(self.item(row, 3).setSizeHint)
         self._highlight(editor, ''.join(map(lambda x: x[1], bl)),
                         self.fmt_add, self.fmt_add)
         self.setCellWidget(row, 3, editor)
         if not al:
             self.setCellWidget(row, 0, QCheckBox(checked=True))
     if al and bl:  # 변경 시 radio button 필요
         group = QButtonGroup(self)
         group.setExclusive(True)
         ar = QRadioButton()
         br = QRadioButton(checked=True)
         group.addButton(ar)
         group.addButton(br)
         self.setCellWidget(self.rowCount() - 2, 0, ar)
         self.setCellWidget(self.rowCount() - 1, 0, br)
示例#23
0
    def __init__(self, image, parent=None):
        super(GradientWidget, self).__init__(parent)
        self.intensity_spin = QSpinBox()
        self.intensity_spin.setRange(0, 100)
        self.intensity_spin.setValue(95)
        self.intensity_spin.setSuffix(self.tr(' %'))
        self.intensity_spin.setToolTip(self.tr('Tonality compression amount'))
        self.blue_combo = QComboBox()
        self.blue_combo.addItems([self.tr('None'), self.tr('Flat'), self.tr('Abs'), self.tr('Norm')])
        self.blue_combo.setCurrentIndex(2)
        self.blue_combo.setToolTip(self.tr('Blue component inclusion mode'))
        self.invert_check = QCheckBox(self.tr('Invert'))
        self.invert_check.setToolTip(self.tr('Reverse lighting direction'))
        self.equalize_check = QCheckBox(self.tr('Equalize'))
        self.equalize_check.setToolTip(self.tr('Apply histogram equalization'))

        self.image = image
        self.viewer = ImageViewer(self.image, self.image)
        self.dx, self.dy = cv.spatialGradient(cv.cvtColor(self.image, cv.COLOR_BGR2GRAY))
        self.process()

        self.intensity_spin.valueChanged.connect(self.process)
        self.blue_combo.currentIndexChanged.connect(self.process)
        self.invert_check.stateChanged.connect(self.process)
        self.equalize_check.stateChanged.connect(self.process)

        top_layout = QHBoxLayout()
        top_layout.addWidget(QLabel(self.tr('Intensity:')))
        top_layout.addWidget(self.intensity_spin)
        top_layout.addWidget(QLabel(self.tr('Blue channel:')))
        top_layout.addWidget(self.blue_combo)
        top_layout.addWidget(self.invert_check)
        top_layout.addWidget(self.equalize_check)
        top_layout.addStretch()

        main_layout = QVBoxLayout()
        main_layout.addLayout(top_layout)
        main_layout.addWidget(self.viewer)

        self.setLayout(main_layout)
示例#24
0
    def buildBoxes(self, isIsolate, pastOptions):
        boxColumn = QVBoxLayout()

        vocals = QCheckBox("Vocals")
        if 'vocals' in pastOptions:
            vocals.setChecked(True)
        vocals.toggled.connect(
            lambda x: self.setChecked('vocals', isIsolate, x))
        boxColumn.addWidget(vocals)

        if self.curStems != '2 tracks':
            if self.curStems == '5 tracks':
                piano = QCheckBox("Piano")
                if 'piano' in pastOptions:
                    piano.setChecked(True)
                piano.toggled.connect(
                    lambda x: self.setChecked('piano', isIsolate, x))
                boxColumn.addWidget(piano)

            bass = QCheckBox("Bass")
            if 'bass' in pastOptions:
                bass.setChecked(True)
            bass.toggled.connect(
                lambda x: self.setChecked('bass', isIsolate, x))
            boxColumn.addWidget(bass)

            drums = QCheckBox("Drums")
            if 'drums' in pastOptions:
                drums.setChecked(True)
            drums.toggled.connect(
                lambda x: self.setChecked('drums', isIsolate, x))
            boxColumn.addWidget(drums)

        other = QCheckBox('Other')
        if 'other' in pastOptions:
            other.setChecked(True)
        other.toggled.connect(lambda x: self.setChecked('other', isIsolate, x))
        boxColumn.addWidget(other)

        return boxColumn
示例#25
0
 def __init__(self, ui, cam):
     super(Properties_UI, self).__init__()
     self.cam = cam
     self.ui = ui
     self.setTitle('Properties')
     properties_layout = QGridLayout()
     ui.power = QCheckBox()
     ui.power.setText('Power')
     ui.power.clicked.connect(self.on_power_toggled)
     properties_layout.addWidget(ui.power, 1, 1, 1, 1)
     ui.video = QComboBox()
     ui.video.addItems([str(truc) for truc in answers['video'].values()])
     ui.video.currentTextChanged.connect(self.on_video_currentTextChanged)
     properties_layout.addWidget(ui.video, 1, 2, 1, 1)
     ui.IR = QCheckBox()
     ui.IR.setText('IR')
     ui.IR.clicked.connect(self.on_IR_toggled)
     properties_layout.addWidget(ui.IR, 1, 3, 1, 1)
     ui.FX = QComboBox()
     ui.FX.addItems(['Normal', 'NegArt', 'B&W'])
     ui.FX.currentTextChanged.connect(self.on_FX_currentTextChanged)
     properties_layout.addWidget(ui.FX, 1, 4, 1, 1)
     mem_set_label = QLabel()
     mem_set_label.setText('Make Memory')
     properties_layout.addWidget(mem_set_label, 2, 1, 1, 1)
     ui.memory_set = QComboBox()
     mem_list = [str(i) for i in range(49)]
     ui.memory_set.addItems(mem_list)
     ui.memory_set.currentTextChanged.connect(
         self.on_memory_set_currentTextChanged)
     properties_layout.addWidget(ui.memory_set, 3, 1, 1, 1)
     mem_recall_label = QLabel()
     mem_recall_label.setText('Recall Memory')
     properties_layout.addWidget(mem_recall_label, 2, 2, 1, 1)
     ui.memory_recall = QComboBox()
     ui.memory_recall.addItems(mem_list)
     ui.memory_recall.currentTextChanged.connect(
         self.on_memory_recall_currentTextChanged)
     properties_layout.addWidget(ui.memory_recall, 3, 2, 1, 1)
     self.setLayout(properties_layout)
    def __init__(self, parent=None):
        super().__init__(parent)

        self.label = QLabel("Find &what : ")
        self.lineEdit = QLineEdit()
        self.label.setBuddy(self.lineEdit)

        self.caseCheckBox = QCheckBox("&Match & case")
        self.backwardCheckBox = QCheckBox("Search &backward")

        self.findButton = QPushButton("&find")
        self.findButton.setDefault(True)
        self.findButton.setEnabled(False)

        self.closeButton = QPushButton("&close")

        self.lineEdit.textChanged.connect(self.enableFindButton)
        self.findButton.clicked.connect(self.findClicked)
        self.closeButton.clicked.connect(self.close)

        self.topLeftLayout = QHBoxLayout()
        self.topLeftLayout.addWidget(self.label)
        self.topLeftLayout.addWidget(self.lineEdit)

        self.leftLayout = QVBoxLayout()
        self.leftLayout.addLayout(self.topLeftLayout)
        self.leftLayout.addWidget(self.caseCheckBox)
        self.leftLayout.addWidget(self.backwardCheckBox)

        self.rightLayout = QVBoxLayout()
        self.rightLayout.addWidget(self.findButton)
        self.rightLayout.addWidget(self.closeButton)
        self.rightLayout.addStretch()

        self.mainLayout = QHBoxLayout()
        self.mainLayout.addLayout(self.leftLayout)
        self.mainLayout.addLayout(self.rightLayout)
        self.setLayout(self.mainLayout)

        self.setWindowTitle("Find")
示例#27
0
    def initializeUI(self):
        main_grid = QGridLayout()
        todo_title = QLabel("Список дел на день")
        todo_title.setFont(QFont('Arial', 24))
        todo_title.setAlignment(Qt.AlignCenter)
        # создание меток
        mustdo_label = QLabel("Надо сделать")
        mustdo_label.setFont(QFont('Arial', 20))
        mustdo_label.setAlignment(Qt.AlignCenter)
        appts_label = QLabel("Запланированные встречи")
        appts_label.setFont(QFont('Arial', 20))
        appts_label.setAlignment(Qt.AlignCenter)
        # создание секций
        mustdo_grid = QGridLayout()
        mustdo_grid.setContentsMargins(5, 5, 5, 5)
        mustdo_grid.addWidget(mustdo_label, 0, 0, 1, 2)
        # создание чекбоксов с полями ввода
        for position in range(1, 15):
            checkbox = QCheckBox()
            checkbox.setObjectName(str(position))
            linedit = QLineEdit("")
            linedit.setMinimumWidth(200)
            mustdo_grid.addWidget(checkbox, position, 0)
            mustdo_grid.addWidget(linedit, position, 1)
            self.dictToDo[checkbox] = linedit

        # секция встреч
        morning_label = QLabel("Утро")
        morning_label.setFont(QFont('Arial', 16))
        noon_label = QLabel("Обед")
        noon_label.setFont(QFont('Arial', 16))
        evening_label = QLabel("Вечер")
        evening_label.setFont(QFont('Arial', 16))
        # первичная компоновка
        appt_v_box = QVBoxLayout()
        appt_v_box.setContentsMargins(5, 5, 5, 5)
        evening_entry = QTextEdit()
        noon_entry = QTextEdit()
        morning_entry = QTextEdit()
        appt_v_box.addWidget(appts_label)
        appt_v_box.addWidget(morning_label)
        appt_v_box.addWidget(morning_entry)
        appt_v_box.addWidget(noon_label)
        appt_v_box.addWidget(noon_entry)
        appt_v_box.addWidget(evening_label)
        appt_v_box.addWidget(evening_entry)
        self.dayMeet = [morning_entry, noon_entry, evening_entry]
        # завершение компоновки
        main_grid.addWidget(todo_title, 0, 0, 1, 2)
        main_grid.addLayout(mustdo_grid, 1, 0)
        main_grid.addLayout(appt_v_box, 1, 1)
        self.setLayout(main_grid)
示例#28
0
    def init_ui(self):
        self.setWindowTitle(_('Scores assign'))
        self.setWindowIcon(QIcon(config.ICON))
        self.setSizeGripEnabled(False)
        self.setModal(False)
        self.setMinimumWidth(650)

        self.layout = QFormLayout(self)

        self.label_list = QRadioButton(_('Value list'))
        self.label_list.setChecked(True)
        self.item_list = QLineEdit()
        self.item_list.setText(
            '40;37;35;33;32;31;30;29;28;27;26;25;24;23;22;21;20;19;18;17;16;15;14;13;12;11;10;9;8;7;6;5;4;3;2;1'
        )
        self.layout.addRow(self.label_list, self.item_list)

        self.label_formula = QRadioButton(_('Formula'))
        self.item_formula = QLineEdit()
        self.layout.addRow(self.label_formula, self.item_formula)

        self.label_formula_hint = QLabel(
            'Hint: You can use following variables: LeaderTime, Time, Year, Place, Length'
        )
        self.layout.addRow(self.label_formula_hint)

        self.label_limit = QCheckBox(_('Limit per team'))
        self.item_limit = QSpinBox()
        self.item_limit.setMaximumWidth(50)
        self.layout.addRow(self.label_limit, self.item_limit)

        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()
示例#29
0
    def __init__(self):
        QWidget.__init__(self)
        self.setFixedWidth(240)

        self.mainlayout = QVBoxLayout(self)
        self.prinlayout = QVBoxLayout(self)
        self.seclayout = QVBoxLayout(self)
        self.headerlayout = QVBoxLayout(self)
        self.footerlayout = QVBoxLayout(self)

        self.tranSlider = QSlider(orientation=Qt.Horizontal)
        self.tranSlider.setMinimum(0)
        self.tranSlider.setValue(50)
        self.tranSlider.setMaximum(100)
        self.tranSlider.sliderReleased.connect(self.onTranChange)
        tLabel = QLabel("Transparência:")

        self.classCheck = QCheckBox("Segmentar diversas classes")
        self.classCheck.clicked.connect(
            lambda: self.enableClasses(self.classCheck.isChecked()))
        self.classCheck.setChecked(False)

        btnAdd = QPushButton("+")
        btnAdd.clicked.connect(self.addColor)

        self.colorList = list()
        self.currColor = 0

        btnUndo = QPushButton("Desfazer Tudo")
        btnUndo.clicked.connect(self.undoAll)

        self.headerlayout.addWidget(tLabel)
        self.headerlayout.addWidget(self.tranSlider)
        self.headerlayout.addWidget(self.classCheck)
        self.prinlayout.addWidget(QLabel("Classes:"))
        self.seclayout.addWidget(btnAdd)
        self.seclayout.addStretch(1)
        self.footerlayout.addWidget(btnUndo)

        self.__wid1 = QWidget()
        self.__wid1.setLayout(self.prinlayout)

        self.__wid2 = QWidget()
        self.__wid2.setLayout(self.seclayout)
        self.enableClasses(False)

        self.mainlayout.addLayout(self.headerlayout)
        self.mainlayout.addWidget(self.__wid1)
        self.mainlayout.addWidget(self.__wid2)
        self.mainlayout.addLayout(self.footerlayout)

        self.setLayout(self.mainlayout)
示例#30
0
    def __init__(self, parent=None):
        super(StyleWidget, self).__init__(parent)

        self.label_line_length = QLabel(u'Длина линии')
        self.spinbox_line_length = QSpinBox()
        self.spinbox_line_length.setMinimum(10)
        self.spinbox_line_length.setMaximum(250)
        self.spinbox_line_length.setSingleStep(10)
        self.spinbox_line_length.setValue(200)

        self.label_line_width = QLabel(u'Толщина линии')
        self.spinbox_line_width = QSpinBox()
        self.spinbox_line_width.setMinimum(1)
        self.spinbox_line_width.setMaximum(10)
        self.spinbox_line_width.setSingleStep(1)
        self.spinbox_line_width.setValue(2)

        self.label_circle_rad = QLabel(u'Радиус круга')
        self.spinbox_circle_rad = QSpinBox()
        self.spinbox_circle_rad.setMinimum(1)
        self.spinbox_circle_rad.setMaximum(30)
        self.spinbox_circle_rad.setSingleStep(1)
        self.spinbox_circle_rad.setValue(10)

        self.label_line_color = QLabel(u'Цвет линии')
        self.combobox_line_color = QComboBox()
        self.combobox_line_color.addItem(u'черный', 'black')
        self.combobox_line_color.addItem(u'красный', 'red')
        self.combobox_line_color.addItem(u'зеленый', 'green')
        self.combobox_line_color.addItem(u'синий', 'blue')

        self.checkbox_normalize_circle_rad = QCheckBox(u'Круги одинакового размера')

        layout = QGridLayout()
        layout.addWidget(self.label_line_length, 0, 0, Qt.AlignRight)
        layout.addWidget(self.spinbox_line_length, 0, 1)
        layout.addWidget(self.label_line_width, 1, 0, Qt.AlignRight)
        layout.addWidget(self.spinbox_line_width, 1, 1)
        layout.addWidget(self.label_circle_rad, 2, 0, Qt.AlignRight)
        layout.addWidget(self.spinbox_circle_rad, 2, 1)
        layout.addWidget(self.label_line_color, 3, 0, Qt.AlignRight)
        layout.addWidget(self.combobox_line_color, 3, 1)
        layout.addWidget(self.checkbox_normalize_circle_rad, 4, 0, 1, 2)
        layout.setRowStretch(5, 1)
        self.setLayout(layout)

        self.spinbox_line_length.valueChanged.connect(self.on_change)
        self.spinbox_line_width.valueChanged.connect(self.on_change)
        self.spinbox_circle_rad.valueChanged.connect(self.on_change)
        self.combobox_line_color.activated.connect(self.on_change)
        self.checkbox_normalize_circle_rad.stateChanged.connect(self.on_change)
        self.on_change()