Example #1
0
    def on_select_area(self, select_node: Optional[Node] = None):
        for node in self.radio_button_to_node.keys():
            node.deleteLater()

        self.radio_button_to_node.clear()

        current_area = self.current_area
        self.area_view_canvas.select_area(current_area)

        if not current_area:
            self.new_node_button.setEnabled(False)
            self.delete_node_button.setEnabled(False)
            return

        is_first = True
        for node in sorted(current_area.nodes, key=lambda x: x.name):
            if node.is_derived_node:
                continue

            button = QRadioButton(self.nodes_scroll_contents)
            button.setText(node.name)
            self.radio_button_to_node[button] = node
            if is_first or select_node is node:
                self.selected_node_button = button
                button.setChecked(True)
            else:
                button.setChecked(False)
            button.toggled.connect(self.on_select_node)
            is_first = False
            self.nodes_scroll_layout.addWidget(button)

        self.new_node_button.setEnabled(True)
        self.delete_node_button.setEnabled(len(current_area.nodes) > 1)

        self.update_selected_node()
 def create_data_group(self):
     """Creates group for holding specific choice data selection"""
     button_group = QButtonGroup(self)
     button_group.setExclusive(True)
     colecao_radio_button = QRadioButton('Coleção')
     self.partidas_radio_button = QRadioButton('Partidas')
     colecao_radio_button.setChecked(True)
     button_group.addButton(colecao_radio_button)
     button_group.addButton(self.partidas_radio_button)
     (self.min_date_picker,
      min_date_label) = create_date_picker('À Partir de:', self)
     (self.max_date_picker,
      max_date_label) = create_date_picker('Até:', self)
     self.min_date_picker.dateChanged.connect(
         self.max_date_picker.setMinimumDate)
     colecao_radio_button.toggled.connect(self.min_date_picker.setDisabled)
     colecao_radio_button.toggled.connect(self.max_date_picker.setDisabled)
     self.map_users_button = QPushButton(
         'Ver mapa de usuarios BGG -> Ludopedia', self)
     self.map_users_button.setEnabled(False)
     self.map_users_button.clicked.connect(self.user_map)
     colecao_radio_button.toggled.connect(self.map_users_button.setDisabled)
     group_box = QGroupBox('Dados')
     grid_layout = QGridLayout(group_box)
     grid_layout.addWidget(colecao_radio_button, 1, 1)
     grid_layout.addWidget(self.partidas_radio_button, 1, 2)
     grid_layout.addWidget(min_date_label, 2, 1)
     grid_layout.addWidget(self.min_date_picker, 2, 2)
     grid_layout.addWidget(max_date_label, 3, 1)
     grid_layout.addWidget(self.max_date_picker, 3, 2)
     grid_layout.addWidget(self.map_users_button, 4, 1, 1, 2)
     group_box.setLayout(grid_layout)
     return group_box
Example #3
0
class ReferenceDialog(QDialog):
    def __init__(self, parent):
        super().__init__(parent)
        self.setWindowTitle("Set reference")
        vbox = QVBoxLayout(self)
        grid = QGridLayout()
        self.average = QRadioButton("Average")
        self.channels = QRadioButton("Channel(s):")
        self.average.toggled.connect(self.toggle)
        self.channellist = QLineEdit()
        self.channellist.setEnabled(False)
        self.average.setChecked(True)
        grid.addWidget(self.average, 0, 0)
        grid.addWidget(self.channels, 1, 0)
        grid.addWidget(self.channellist, 1, 1)
        vbox.addLayout(grid)
        buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        vbox.addWidget(buttonbox)
        buttonbox.accepted.connect(self.accept)
        buttonbox.rejected.connect(self.reject)
        vbox.setSizeConstraint(QVBoxLayout.SetFixedSize)

    def toggle(self):
        if self.average.isChecked():
            self.channellist.setEnabled(False)
        else:
            self.channellist.setEnabled(True)
Example #4
0
    def setup_ui(self):
        super(SettingUI, self).setup_ui()
        max_width_label = QLabel(text="最大宽度",
                                 alignment=QtCore.Qt.AlignRight
                                 | QtCore.Qt.AlignVCenter)
        max_width_combo = QComboBox()
        max_width_combo.addItems(Globals.max_width_arr)
        max_width_combo.setCurrentIndex(self.max_width_index)
        max_width_combo.currentIndexChanged.connect(self.on_combo_changed)

        size_label = QLabel(text="输出字号",
                            alignment=QtCore.Qt.AlignRight
                            | QtCore.Qt.AlignVCenter)
        size_spin = QSpinBox()
        size_spin.setRange(10, 64)
        size_spin.setValue(Globals.config.get(Globals.UserData.font_size))
        size_spin.valueChanged.connect(self.on_save_font_size)

        output_name_label = QLabel(text="输出名称",
                                   alignment=QtCore.Qt.AlignRight
                                   | QtCore.Qt.AlignVCenter)
        output_name_edit = QLineEdit(
            Globals.config.get(Globals.UserData.font_save_name))
        output_name_edit.textEdited.connect(self.on_output_name_edited)

        output_label = QLabel(text="输出目录",
                              alignment=QtCore.Qt.AlignRight
                              | QtCore.Qt.AlignVCenter)
        output_line_edit = QLineEdit(
            Globals.config.get(Globals.UserData.output_dir))
        output_line_edit.setReadOnly(True)
        output_line_edit.cursorPositionChanged.connect(
            self.on_output_choose_clicked)

        mode_1_radio = QRadioButton("图集模式")
        mode_2_radio = QRadioButton("字体模式")
        mode_1_radio.setChecked(True)
        mode_1_radio.toggled.connect(self.on_mode_1_radio_toggled)
        mode_radio_group = QButtonGroup(self)
        mode_radio_group.addButton(mode_1_radio, 0)
        mode_radio_group.addButton(mode_2_radio, 1)

        self.main_layout.setColumnStretch(1, 1)
        self.main_layout.setColumnStretch(3, 1)
        self.main_layout.addWidget(mode_1_radio, 0, 0, 1, 1)
        self.main_layout.addWidget(mode_2_radio, 0, 1, 1, 1)
        self.main_layout.addWidget(output_name_label, 1, 0, 1, 1)
        self.main_layout.addWidget(output_name_edit, 1, 1, 1, 1)
        self.main_layout.addWidget(max_width_label, 1, 2, 1, 1)
        self.main_layout.addWidget(max_width_combo, 1, 3, 1, 1)
        self.main_layout.addWidget(output_label, 2, 0, 1, 1)
        self.main_layout.addWidget(output_line_edit, 2, 1, 1, 1)
        self.main_layout.addWidget(size_label, 2, 2, 1, 1)
        self.main_layout.addWidget(size_spin, 2, 3, 1, 1)

        self.max_width_combo = max_width_combo
        self.size_spin = size_spin
        self.output_name_edit = output_name_edit
        self.output_line_edit = output_line_edit
Example #5
0
    def setup_ui(self):
        super(FontUI, self).setup_ui()

        sys_radio = QRadioButton("系统字体")
        sys_radio.setChecked(True)
        font_combo = QComboBox()
        for item in self.system_fonts:
            font_combo.addItem(item[1])
        font_combo.setCurrentIndex(0)
        font_combo.currentIndexChanged.connect(self.refresh_font)

        custom_radio = QRadioButton("自选字体")
        custom_radio.setCheckable(True)
        custom_radio.setChecked(False)
        custom_radio.toggled.connect(self.on_custom_radio_toggled)
        custom_edit = QLineEdit()
        custom_edit.setPlaceholderText("自定义字体(*.ttf, *.otf)")
        custom_edit.setReadOnly(True)
        custom_edit.setEnabled(False)
        custom_btn = QPushButton(text="浏览")
        custom_btn.setEnabled(False)
        custom_btn.clicked.connect(self.on_custom_clicked)

        font_group = QButtonGroup(self)
        font_group.addButton(sys_radio, 0)
        font_group.addButton(custom_radio, 1)
        font_group.setExclusive(True)

        input_label = QLabel("输出字符")
        input_edit = MLineEdit()
        import_btn = QPushButton(text="从文本文件导入")
        import_btn.clicked.connect(self.on_import_btn_clicked)

        self.main_layout.setColumnStretch(1, 1)
        self.main_layout.addWidget(sys_radio, 1, 0, 1, 1)
        self.main_layout.addWidget(font_combo, 1, 1, 1, 2)
        self.main_layout.addWidget(custom_radio, 2, 0, 1, 1)
        self.main_layout.addWidget(custom_edit, 2, 1, 1, 1)
        self.main_layout.addWidget(custom_btn, 2, 2, 1, 1)

        self.main_layout.addWidget(input_label, 3, 0, 1, 1)
        self.main_layout.addWidget(import_btn, 3, 2, 1, 1)
        self.main_layout.addWidget(input_edit, 4, 0, 1, 3)

        self.input_edit = input_edit
        self.font_combo = font_combo
        self.custom_btn = custom_btn
        self.custom_edit = custom_edit

        self.refresh_font()
class SetPolicyWidget(QWidget):

    Sg_view_changed = Signal()

    def __init__(self, model: SettingsModel, parent=None):
        super(SetPolicyWidget, self).__init__(parent)

        self._model = model

        self.setAccessibleName("InfoBox")

        self.titolo = QLabel("Politica di gestione conflitti")
        self.titolo.setAccessibleName('Title2')

        self.sottotitolo = QLabel("Cambia come vengono gestiti conflitti")
        self.sottotitolo.setAccessibleName('Sottotitolo')

        self.spaceLabel = QLabel(" ")

        self.client = QRadioButton(
            "Client: le modifiche in locale sovrascrivono quelle presenti nel server"
        )
        self.manual = QRadioButton(
            "Manuale: verranno salvati entrambi i file, sarà l'utente a decidere cosa mantenere"
        )
        self.Sl_model_changed()

        layout = QVBoxLayout()
        layout.addWidget(self.titolo)
        layout.addWidget(self.sottotitolo)
        layout.addWidget(self.spaceLabel)
        sub_layout = QVBoxLayout()
        sub_layout.addWidget(self.client)
        sub_layout.addWidget(self.manual)

        layout.addLayout(sub_layout)
        self.setLayout(layout)

        self.client.clicked.connect(self.Sl_client_checked)
        self.manual.clicked.connect(self.Sl_manual_checked)

    @Slot()
    def Sl_client_checked(self):
        if self.client.isChecked():
            self.Sg_view_changed.emit()

    @Slot()
    def Sl_manual_checked(self):
        if self.manual.isChecked():
            self.Sg_view_changed.emit()

    @Slot()
    def Sl_model_changed(self):
        if self._model.get_policy() == Policy.Manual:
            self.client.setChecked(False)
            self.manual.setChecked(True)
        else:
            self.client.setChecked(True)
            self.manual.setChecked(False)
Example #7
0
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        if not MainWindow.objectName():
            MainWindow.setObjectName(u"MainWindow")
        MainWindow.setWindowModality(Qt.ApplicationModal)
        MainWindow.resize(1492, 1852)
        sizePolicy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth())
        MainWindow.setSizePolicy(sizePolicy)
        MainWindow.setMinimumSize(QSize(700, 700))
        MainWindow.setMaximumSize(QSize(16777215, 16777215))
        MainWindow.setBaseSize(QSize(600, 600))
        font = QFont()
        font.setPointSize(12)
        font.setKerning(True)
        MainWindow.setFont(font)
        MainWindow.setAutoFillBackground(False)
        MainWindow.setStyleSheet(u"")
        MainWindow.setDocumentMode(False)
        MainWindow.setTabShape(QTabWidget.Rounded)
        MainWindow.setDockOptions(QMainWindow.AllowTabbedDocks|QMainWindow.AnimatedDocks)
        MainWindow.setUnifiedTitleAndToolBarOnMac(False)
        self.action_Quit = QAction(MainWindow)
        self.action_Quit.setObjectName(u"action_Quit")
        self.main_widget = QWidget(MainWindow)
        self.main_widget.setObjectName(u"main_widget")
        self.main_widget.setEnabled(True)
        self.main_widget.setMinimumSize(QSize(650, 650))
        self.main_widget.setContextMenuPolicy(Qt.DefaultContextMenu)
        self.main_widget.setAutoFillBackground(False)
        self.main_widget.setStyleSheet(u"")
        self.main_layout = QGridLayout(self.main_widget)
        self.main_layout.setObjectName(u"main_layout")
        self.horizontalLayout_2 = QHBoxLayout()
        self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
        self.log_button = QPushButton(self.main_widget)
        self.log_button.setObjectName(u"log_button")
        sizePolicy1 = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy1.setHorizontalStretch(0)
        sizePolicy1.setVerticalStretch(0)
        sizePolicy1.setHeightForWidth(self.log_button.sizePolicy().hasHeightForWidth())
        self.log_button.setSizePolicy(sizePolicy1)
        self.log_button.setMinimumSize(QSize(24, 24))
        font1 = QFont()
        font1.setPointSize(9)
        font1.setBold(True)
        font1.setKerning(True)
        self.log_button.setFont(font1)
        self.log_button.setCursor(QCursor(Qt.PointingHandCursor))
        self.log_button.setCheckable(False)
        self.log_button.setFlat(True)

        self.horizontalLayout_2.addWidget(self.log_button)


        self.main_layout.addLayout(self.horizontalLayout_2, 5, 2, 1, 1)

        self.shuttle_widget = QWidget(self.main_widget)
        self.shuttle_widget.setObjectName(u"shuttle_widget")
        self.shuttle_widget.setMinimumSize(QSize(600, 600))
        self.shuttle_widget.setMaximumSize(QSize(600, 600))
        self.shuttle_widget.setAutoFillBackground(False)
        self.shuttle_widget.setStyleSheet(u"QWidget#shuttle_widget {background: url(images/ShuttleXpress_Black.png);\n"
"        background-repeat:no-repeat;}\n"
"       ")
        self.button_1 = QCheckBox(self.shuttle_widget)
        self.button_1.setObjectName(u"button_1")
        self.button_1.setGeometry(QRect(80, 266, 24, 24))
        sizePolicy1.setHeightForWidth(self.button_1.sizePolicy().hasHeightForWidth())
        self.button_1.setSizePolicy(sizePolicy1)
        self.button_1.setMinimumSize(QSize(24, 24))
        self.button_1.setFont(font)
        self.button_1.setStyleSheet(u"background: #000000ff;\n"
"         color: white;\n"
"        ")
        self.usb_status = QPushButton(self.shuttle_widget)
        self.usb_status.setObjectName(u"usb_status")
        self.usb_status.setEnabled(False)
        self.usb_status.setGeometry(QRect(288, 10, 24, 24))
        sizePolicy1.setHeightForWidth(self.usb_status.sizePolicy().hasHeightForWidth())
        self.usb_status.setSizePolicy(sizePolicy1)
        self.usb_status.setMinimumSize(QSize(24, 24))
        self.usb_status.setFont(font1)
        self.usb_status.setCursor(QCursor(Qt.ArrowCursor))
        self.usb_status.setAutoFillBackground(False)
        self.usb_status.setText(u"")
        icon = QIcon()
        icon.addFile(u"images/usb_black_24.png", QSize(), QIcon.Disabled, QIcon.Off)
        icon.addFile(u"images/usb_white_24.png", QSize(), QIcon.Disabled, QIcon.On)
        self.usb_status.setIcon(icon)
        self.usb_status.setIconSize(QSize(24, 24))
        self.usb_status.setCheckable(True)
        self.usb_status.setChecked(False)
        self.usb_status.setFlat(True)
        self.button_5 = QCheckBox(self.shuttle_widget)
        self.button_5.setObjectName(u"button_5")
        self.button_5.setGeometry(QRect(498, 266, 24, 24))
        sizePolicy1.setHeightForWidth(self.button_5.sizePolicy().hasHeightForWidth())
        self.button_5.setSizePolicy(sizePolicy1)
        self.button_5.setMinimumSize(QSize(24, 24))
        self.button_5.setFont(font)
        self.button_5.setLayoutDirection(Qt.RightToLeft)
        self.button_5.setStyleSheet(u"background: #000000ff;\n"
"         color: white;\n"
"        ")
        self.wheel_pos4 = QRadioButton(self.shuttle_widget)
        self.wheel_pos4.setObjectName(u"wheel_pos4")
        self.wheel_pos4.setGeometry(QRect(382, 164, 24, 24))
        sizePolicy1.setHeightForWidth(self.wheel_pos4.sizePolicy().hasHeightForWidth())
        self.wheel_pos4.setSizePolicy(sizePolicy1)
        self.wheel_pos4.setMinimumSize(QSize(24, 24))
        self.wheel_pos4.setStyleSheet(u"background: #000000ff;\n"
"         color: white;\n"
"        ")
        self.wheel_cent0 = QRadioButton(self.shuttle_widget)
        self.wheel_cent0.setObjectName(u"wheel_cent0")
        self.wheel_cent0.setGeometry(QRect(289, 130, 24, 24))
        sizePolicy1.setHeightForWidth(self.wheel_cent0.sizePolicy().hasHeightForWidth())
        self.wheel_cent0.setSizePolicy(sizePolicy1)
        self.wheel_cent0.setMinimumSize(QSize(24, 24))
        self.wheel_cent0.setStyleSheet(u"background: #000000ff;\n"
"         color: white;\n"
"        ")
        self.wheel_cent0.setChecked(True)
        self.wheel_pos1 = QRadioButton(self.shuttle_widget)
        self.wheel_pos1.setObjectName(u"wheel_pos1")
        self.wheel_pos1.setGeometry(QRect(314, 133, 24, 24))
        sizePolicy1.setHeightForWidth(self.wheel_pos1.sizePolicy().hasHeightForWidth())
        self.wheel_pos1.setSizePolicy(sizePolicy1)
        self.wheel_pos1.setMinimumSize(QSize(24, 24))
        self.wheel_pos1.setStyleSheet(u"color: white;")
        self.wheel_pos2 = QRadioButton(self.shuttle_widget)
        self.wheel_pos2.setObjectName(u"wheel_pos2")
        self.wheel_pos2.setGeometry(QRect(338, 139, 24, 24))
        sizePolicy1.setHeightForWidth(self.wheel_pos2.sizePolicy().hasHeightForWidth())
        self.wheel_pos2.setSizePolicy(sizePolicy1)
        self.wheel_pos2.setMinimumSize(QSize(24, 24))
        self.wheel_pos2.setStyleSheet(u"background: #000000ff;\n"
"         color: white;\n"
"        ")
        self.dial = QDial(self.shuttle_widget)
        self.dial.setObjectName(u"dial")
        self.dial.setGeometry(QRect(197, 178, 216, 216))
        sizePolicy2 = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Preferred)
        sizePolicy2.setHorizontalStretch(0)
        sizePolicy2.setVerticalStretch(0)
        sizePolicy2.setHeightForWidth(self.dial.sizePolicy().hasHeightForWidth())
        self.dial.setSizePolicy(sizePolicy2)
        self.dial.setMinimumSize(QSize(24, 24))
        self.dial.setAutoFillBackground(False)
        self.dial.setStyleSheet(u"background-color: black;")
        self.dial.setMinimum(0)
        self.dial.setMaximum(10)
        self.dial.setPageStep(1)
        self.dial.setValue(5)
        self.dial.setSliderPosition(5)
        self.dial.setInvertedAppearance(False)
        self.dial.setInvertedControls(False)
        self.dial.setWrapping(True)
        self.dial.setNotchTarget(3.700000000000000)
        self.dial.setNotchesVisible(False)
        self.wheel_neg6 = QRadioButton(self.shuttle_widget)
        self.wheel_neg6.setObjectName(u"wheel_neg6")
        self.wheel_neg6.setGeometry(QRect(162, 204, 24, 24))
        sizePolicy1.setHeightForWidth(self.wheel_neg6.sizePolicy().hasHeightForWidth())
        self.wheel_neg6.setSizePolicy(sizePolicy1)
        self.wheel_neg6.setMinimumSize(QSize(24, 24))
        self.wheel_neg6.setStyleSheet(u"color: white;")
        self.wheel_pos5 = QRadioButton(self.shuttle_widget)
        self.wheel_pos5.setObjectName(u"wheel_pos5")
        self.wheel_pos5.setGeometry(QRect(400, 182, 24, 24))
        sizePolicy1.setHeightForWidth(self.wheel_pos5.sizePolicy().hasHeightForWidth())
        self.wheel_pos5.setSizePolicy(sizePolicy1)
        self.wheel_pos5.setMinimumSize(QSize(24, 24))
        self.wheel_pos5.setStyleSheet(u"background: #000000ff;\n"
"         color: white;\n"
"        ")
        self.button_2 = QCheckBox(self.shuttle_widget)
        self.button_2.setObjectName(u"button_2")
        self.button_2.setGeometry(QRect(156, 122, 24, 24))
        sizePolicy1.setHeightForWidth(self.button_2.sizePolicy().hasHeightForWidth())
        self.button_2.setSizePolicy(sizePolicy1)
        self.button_2.setMinimumSize(QSize(24, 24))
        self.button_2.setFont(font)
        self.button_2.setStyleSheet(u"background: #000000ff;\n"
"         color: white;\n"
"        ")
        self.wheel_neg5 = QRadioButton(self.shuttle_widget)
        self.wheel_neg5.setObjectName(u"wheel_neg5")
        self.wheel_neg5.setGeometry(QRect(178, 182, 24, 24))
        sizePolicy1.setHeightForWidth(self.wheel_neg5.sizePolicy().hasHeightForWidth())
        self.wheel_neg5.setSizePolicy(sizePolicy1)
        self.wheel_neg5.setMinimumSize(QSize(24, 24))
        self.wheel_neg5.setStyleSheet(u"color: white;")
        self.wheel_pos6 = QRadioButton(self.shuttle_widget)
        self.wheel_pos6.setObjectName(u"wheel_pos6")
        self.wheel_pos6.setGeometry(QRect(416, 204, 24, 24))
        sizePolicy1.setHeightForWidth(self.wheel_pos6.sizePolicy().hasHeightForWidth())
        self.wheel_pos6.setSizePolicy(sizePolicy1)
        self.wheel_pos6.setMinimumSize(QSize(24, 24))
        self.wheel_pos6.setStyleSheet(u"background: #000000ff;\n"
"         color: white;\n"
"        ")
        self.wheel_neg1 = QRadioButton(self.shuttle_widget)
        self.wheel_neg1.setObjectName(u"wheel_neg1")
        self.wheel_neg1.setGeometry(QRect(264, 133, 24, 24))
        sizePolicy1.setHeightForWidth(self.wheel_neg1.sizePolicy().hasHeightForWidth())
        self.wheel_neg1.setSizePolicy(sizePolicy1)
        self.wheel_neg1.setMinimumSize(QSize(24, 24))
        self.wheel_neg1.setStyleSheet(u"background: #000000ff;\n"
"         color: white;\n"
"        ")
        self.button_4 = QCheckBox(self.shuttle_widget)
        self.button_4.setObjectName(u"button_4")
        self.button_4.setGeometry(QRect(430, 122, 24, 24))
        sizePolicy1.setHeightForWidth(self.button_4.sizePolicy().hasHeightForWidth())
        self.button_4.setSizePolicy(sizePolicy1)
        self.button_4.setMinimumSize(QSize(24, 24))
        self.button_4.setFont(font)
        self.button_4.setLayoutDirection(Qt.RightToLeft)
        self.button_4.setAutoFillBackground(False)
        self.button_4.setStyleSheet(u"background: #000000ff;\n"
"         color: white;\n"
"        ")
        self.wheel_pos7 = QRadioButton(self.shuttle_widget)
        self.wheel_pos7.setObjectName(u"wheel_pos7")
        self.wheel_pos7.setGeometry(QRect(427, 229, 24, 24))
        sizePolicy1.setHeightForWidth(self.wheel_pos7.sizePolicy().hasHeightForWidth())
        self.wheel_pos7.setSizePolicy(sizePolicy1)
        self.wheel_pos7.setMinimumSize(QSize(24, 24))
        self.wheel_pos7.setStyleSheet(u"background: #000000ff;\n"
"         color: white;\n"
"        ")
        self.button_3 = QCheckBox(self.shuttle_widget)
        self.button_3.setObjectName(u"button_3")
        self.button_3.setGeometry(QRect(290, 72, 24, 24))
        sizePolicy1.setHeightForWidth(self.button_3.sizePolicy().hasHeightForWidth())
        self.button_3.setSizePolicy(sizePolicy1)
        self.button_3.setMinimumSize(QSize(24, 24))
        self.button_3.setFont(font)
        self.button_3.setStyleSheet(u"background: #000000ff;\n"
"         color: white;\n"
"        ")
        self.button_3.setTristate(False)
        self.wheel_neg2 = QRadioButton(self.shuttle_widget)
        self.wheel_neg2.setObjectName(u"wheel_neg2")
        self.wheel_neg2.setGeometry(QRect(240, 139, 24, 24))
        sizePolicy1.setHeightForWidth(self.wheel_neg2.sizePolicy().hasHeightForWidth())
        self.wheel_neg2.setSizePolicy(sizePolicy1)
        self.wheel_neg2.setMinimumSize(QSize(24, 24))
        self.wheel_neg2.setStyleSheet(u"background: #000000ff;\n"
"         color: white;\n"
"        ")
        self.wheel_pos3 = QRadioButton(self.shuttle_widget)
        self.wheel_pos3.setObjectName(u"wheel_pos3")
        self.wheel_pos3.setGeometry(QRect(361, 149, 24, 24))
        sizePolicy1.setHeightForWidth(self.wheel_pos3.sizePolicy().hasHeightForWidth())
        self.wheel_pos3.setSizePolicy(sizePolicy1)
        self.wheel_pos3.setMinimumSize(QSize(24, 24))
        self.wheel_pos3.setStyleSheet(u"background: #000000ff;\n"
"         color: white;\n"
"        ")
        self.wheel_neg3 = QRadioButton(self.shuttle_widget)
        self.wheel_neg3.setObjectName(u"wheel_neg3")
        self.wheel_neg3.setGeometry(QRect(217, 149, 24, 24))
        sizePolicy1.setHeightForWidth(self.wheel_neg3.sizePolicy().hasHeightForWidth())
        self.wheel_neg3.setSizePolicy(sizePolicy1)
        self.wheel_neg3.setMinimumSize(QSize(24, 24))
        self.wheel_neg3.setStyleSheet(u"color: white;")
        self.wheel_neg4 = QRadioButton(self.shuttle_widget)
        self.wheel_neg4.setObjectName(u"wheel_neg4")
        self.wheel_neg4.setGeometry(QRect(196, 164, 24, 24))
        sizePolicy1.setHeightForWidth(self.wheel_neg4.sizePolicy().hasHeightForWidth())
        self.wheel_neg4.setSizePolicy(sizePolicy1)
        self.wheel_neg4.setMinimumSize(QSize(24, 24))
        self.wheel_neg4.setStyleSheet(u"background: #000000ff;\n"
"         color: white;\n"
"        ")
        self.wheel_neg7 = QRadioButton(self.shuttle_widget)
        self.wheel_neg7.setObjectName(u"wheel_neg7")
        self.wheel_neg7.setGeometry(QRect(151, 229, 24, 24))
        sizePolicy1.setHeightForWidth(self.wheel_neg7.sizePolicy().hasHeightForWidth())
        self.wheel_neg7.setSizePolicy(sizePolicy1)
        self.wheel_neg7.setMinimumSize(QSize(24, 24))
        self.wheel_neg7.setStyleSheet(u"color: white;")
        self.dial.raise_()
        self.button_1.raise_()
        self.usb_status.raise_()
        self.button_5.raise_()
        self.wheel_pos4.raise_()
        self.wheel_cent0.raise_()
        self.wheel_pos1.raise_()
        self.wheel_pos2.raise_()
        self.wheel_neg6.raise_()
        self.wheel_pos5.raise_()
        self.button_2.raise_()
        self.wheel_neg5.raise_()
        self.wheel_pos6.raise_()
        self.wheel_neg1.raise_()
        self.button_4.raise_()
        self.wheel_pos7.raise_()
        self.button_3.raise_()
        self.wheel_neg2.raise_()
        self.wheel_pos3.raise_()
        self.wheel_neg3.raise_()
        self.wheel_neg4.raise_()
        self.wheel_neg7.raise_()

        self.main_layout.addWidget(self.shuttle_widget, 3, 2, 1, 1)

        self.horizontalLayout = QHBoxLayout()
        self.horizontalLayout.setObjectName(u"horizontalLayout")
        self.about_button = QPushButton(self.main_widget)
        self.about_button.setObjectName(u"about_button")
        sizePolicy1.setHeightForWidth(self.about_button.sizePolicy().hasHeightForWidth())
        self.about_button.setSizePolicy(sizePolicy1)
        self.about_button.setMinimumSize(QSize(24, 24))
        self.about_button.setFont(font1)
        self.about_button.setCursor(QCursor(Qt.WhatsThisCursor))
        self.about_button.setCheckable(False)
        self.about_button.setFlat(True)

        self.horizontalLayout.addWidget(self.about_button)


        self.main_layout.addLayout(self.horizontalLayout, 1, 2, 1, 1)

        self.horizontalLayout_3 = QHBoxLayout()
        self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
        self.plug_button = QPushButton(self.main_widget)
        self.plug_button.setObjectName(u"plug_button")
        sizePolicy1.setHeightForWidth(self.plug_button.sizePolicy().hasHeightForWidth())
        self.plug_button.setSizePolicy(sizePolicy1)
        self.plug_button.setMinimumSize(QSize(24, 24))
        self.plug_button.setFont(font1)
        self.plug_button.setCursor(QCursor(Qt.PointingHandCursor))
        self.plug_button.setCheckable(False)
        self.plug_button.setFlat(True)

        self.horizontalLayout_3.addWidget(self.plug_button)


        self.main_layout.addLayout(self.horizontalLayout_3, 3, 1, 1, 1)

        self.verticalLayout = QVBoxLayout()
        self.verticalLayout.setObjectName(u"verticalLayout")
        self.conf_button = QPushButton(self.main_widget)
        self.conf_button.setObjectName(u"conf_button")
        sizePolicy1.setHeightForWidth(self.conf_button.sizePolicy().hasHeightForWidth())
        self.conf_button.setSizePolicy(sizePolicy1)
        self.conf_button.setMinimumSize(QSize(24, 24))
        self.conf_button.setFont(font1)
        self.conf_button.setCursor(QCursor(Qt.PointingHandCursor))
        self.conf_button.setCheckable(False)
        self.conf_button.setFlat(True)

        self.verticalLayout.addWidget(self.conf_button)


        self.main_layout.addLayout(self.verticalLayout, 3, 4, 1, 1)

        MainWindow.setCentralWidget(self.main_widget)
        self.statusbar = QStatusBar(MainWindow)
        self.statusbar.setObjectName(u"statusbar")
        self.statusbar.setMinimumSize(QSize(600, 0))
        MainWindow.setStatusBar(self.statusbar)
        self.about_widget = QDockWidget(MainWindow)
        self.about_widget.setObjectName(u"about_widget")
        self.about_widget.setEnabled(True)
        sizePolicy3 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        sizePolicy3.setHorizontalStretch(0)
        sizePolicy3.setVerticalStretch(0)
        sizePolicy3.setHeightForWidth(self.about_widget.sizePolicy().hasHeightForWidth())
        self.about_widget.setSizePolicy(sizePolicy3)
        self.about_widget.setMinimumSize(QSize(600, 600))
        self.about_widget.setVisible(True)
        self.about_widget.setFloating(False)
        self.about_widget.setFeatures(QDockWidget.DockWidgetClosable|QDockWidget.DockWidgetMovable)
        self.about_widget.setAllowedAreas(Qt.TopDockWidgetArea)
        self.about_layout = QWidget()
        self.about_layout.setObjectName(u"about_layout")
        sizePolicy3.setHeightForWidth(self.about_layout.sizePolicy().hasHeightForWidth())
        self.about_layout.setSizePolicy(sizePolicy3)
        self.about_layout.setAutoFillBackground(False)
        self.gridLayout_3 = QGridLayout(self.about_layout)
        self.gridLayout_3.setObjectName(u"gridLayout_3")
        self.about_text = QTextEdit(self.about_layout)
        self.about_text.setObjectName(u"about_text")
        self.about_text.setFocusPolicy(Qt.WheelFocus)
        self.about_text.setAcceptDrops(False)
        self.about_text.setStyleSheet(u"color: white;")
        self.about_text.setFrameShape(QFrame.StyledPanel)
        self.about_text.setFrameShadow(QFrame.Sunken)
        self.about_text.setUndoRedoEnabled(False)
        self.about_text.setReadOnly(True)
        self.about_text.setAcceptRichText(True)

        self.gridLayout_3.addWidget(self.about_text, 0, 0, 1, 1)

        self.about_widget.setWidget(self.about_layout)
        MainWindow.addDockWidget(Qt.TopDockWidgetArea, self.about_widget)
        self.log_widget = QDockWidget(MainWindow)
        self.log_widget.setObjectName(u"log_widget")
        self.log_widget.setEnabled(True)
        self.log_widget.setMinimumSize(QSize(550, 158))
        self.log_widget.setFont(font)
        self.log_widget.setVisible(True)
        self.log_widget.setFloating(False)
        self.log_widget.setFeatures(QDockWidget.DockWidgetClosable|QDockWidget.DockWidgetFloatable|QDockWidget.DockWidgetMovable)
        self.log_widget.setAllowedAreas(Qt.BottomDockWidgetArea)
        self.log_layout = QWidget()
        self.log_layout.setObjectName(u"log_layout")
        sizePolicy4 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        sizePolicy4.setHorizontalStretch(0)
        sizePolicy4.setVerticalStretch(0)
        sizePolicy4.setHeightForWidth(self.log_layout.sizePolicy().hasHeightForWidth())
        self.log_layout.setSizePolicy(sizePolicy4)
        self.gridLayout_2 = QGridLayout(self.log_layout)
        self.gridLayout_2.setObjectName(u"gridLayout_2")
        self.log_content_layout = QVBoxLayout()
        self.log_content_layout.setObjectName(u"log_content_layout")
        self.log_content_layout.setSizeConstraint(QLayout.SetDefaultConstraint)
        self.log_text = QPlainTextEdit(self.log_layout)
        self.log_text.setObjectName(u"log_text")
        sizePolicy4.setHeightForWidth(self.log_text.sizePolicy().hasHeightForWidth())
        self.log_text.setSizePolicy(sizePolicy4)
        self.log_text.setMinimumSize(QSize(0, 0))
        self.log_text.setAcceptDrops(False)
        self.log_text.setFrameShape(QFrame.StyledPanel)
        self.log_text.setFrameShadow(QFrame.Sunken)
        self.log_text.setUndoRedoEnabled(False)
        self.log_text.setReadOnly(True)

        self.log_content_layout.addWidget(self.log_text)

        self.buttons_layout = QHBoxLayout()
        self.buttons_layout.setObjectName(u"buttons_layout")
        self.buttons_layout.setSizeConstraint(QLayout.SetDefaultConstraint)
        self.log_clear_button = QToolButton(self.log_layout)
        self.log_clear_button.setObjectName(u"log_clear_button")
        icon1 = QIcon()
        icon1.addFile(u"images/delete-sweep_24.png", QSize(), QIcon.Normal, QIcon.Off)
        self.log_clear_button.setIcon(icon1)
        self.log_clear_button.setIconSize(QSize(24, 24))

        self.buttons_layout.addWidget(self.log_clear_button)


        self.log_content_layout.addLayout(self.buttons_layout)


        self.gridLayout_2.addLayout(self.log_content_layout, 0, 0, 1, 1)

        self.log_widget.setWidget(self.log_layout)
        MainWindow.addDockWidget(Qt.BottomDockWidgetArea, self.log_widget)
        self.config_widget = QDockWidget(MainWindow)
        self.config_widget.setObjectName(u"config_widget")
        self.config_widget.setEnabled(True)
        self.config_widget.setMinimumSize(QSize(250, 600))
        self.config_widget.setFloating(False)
        self.config_widget.setFeatures(QDockWidget.DockWidgetClosable|QDockWidget.DockWidgetFloatable|QDockWidget.DockWidgetMovable)
        self.config_widget.setAllowedAreas(Qt.RightDockWidgetArea)
        self.config_layout = QWidget()
        self.config_layout.setObjectName(u"config_layout")
        self.gridLayout = QGridLayout(self.config_layout)
        self.gridLayout.setObjectName(u"gridLayout")
        self.config_content_layout = QFormLayout()
        self.config_content_layout.setObjectName(u"config_content_layout")

        self.gridLayout.addLayout(self.config_content_layout, 0, 0, 1, 1)

        self.config_widget.setWidget(self.config_layout)
        MainWindow.addDockWidget(Qt.RightDockWidgetArea, self.config_widget)
        self.plugins_widget = QDockWidget(MainWindow)
        self.plugins_widget.setObjectName(u"plugins_widget")
        self.plugins_widget.setMinimumSize(QSize(250, 600))
        self.plugins_widget.setAllowedAreas(Qt.LeftDockWidgetArea)
        self.dockWidgetContents = QWidget()
        self.dockWidgetContents.setObjectName(u"dockWidgetContents")
        self.plugins_widget.setWidget(self.dockWidgetContents)
        MainWindow.addDockWidget(Qt.LeftDockWidgetArea, self.plugins_widget)
        self.about_widget.raise_()
        self.log_widget.raise_()

        self.retranslateUi(MainWindow)

        self.usb_status.setDefault(False)


        QMetaObject.connectSlotsByName(MainWindow)
    # setupUi

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"Contour ShuttleXpress", None))
        self.action_Quit.setText(QCoreApplication.translate("MainWindow", u"&Quit", None))
#if QT_CONFIG(tooltip)
        self.log_button.setToolTip("")
#endif // QT_CONFIG(tooltip)
#if QT_CONFIG(statustip)
        self.log_button.setStatusTip(QCoreApplication.translate("MainWindow", u"Log", None))
#endif // QT_CONFIG(statustip)
        self.log_button.setText(QCoreApplication.translate("MainWindow", u"//", None))
#if QT_CONFIG(statustip)
        self.button_1.setStatusTip(QCoreApplication.translate("MainWindow", u"Button 1", None))
#endif // QT_CONFIG(statustip)
        self.button_1.setText("")
#if QT_CONFIG(tooltip)
        self.usb_status.setToolTip("")
#endif // QT_CONFIG(tooltip)
#if QT_CONFIG(statustip)
        self.usb_status.setStatusTip(QCoreApplication.translate("MainWindow", u"USB connection status", None))
#endif // QT_CONFIG(statustip)
#if QT_CONFIG(whatsthis)
        self.usb_status.setWhatsThis(QCoreApplication.translate("MainWindow", u"USB Status", None))
#endif // QT_CONFIG(whatsthis)
#if QT_CONFIG(statustip)
        self.button_5.setStatusTip(QCoreApplication.translate("MainWindow", u"Button 5", None))
#endif // QT_CONFIG(statustip)
        self.button_5.setText("")
#if QT_CONFIG(statustip)
        self.wheel_pos4.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: right 4", None))
#endif // QT_CONFIG(statustip)
        self.wheel_pos4.setText("")
#if QT_CONFIG(statustip)
        self.wheel_cent0.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: center", None))
#endif // QT_CONFIG(statustip)
        self.wheel_cent0.setText("")
#if QT_CONFIG(statustip)
        self.wheel_pos1.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: right 1", None))
#endif // QT_CONFIG(statustip)
        self.wheel_pos1.setText("")
#if QT_CONFIG(statustip)
        self.wheel_pos2.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: right 2", None))
#endif // QT_CONFIG(statustip)
        self.wheel_pos2.setText("")
#if QT_CONFIG(statustip)
        self.dial.setStatusTip(QCoreApplication.translate("MainWindow", u"Dial", None))
#endif // QT_CONFIG(statustip)
#if QT_CONFIG(statustip)
        self.wheel_neg6.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: left 6", None))
#endif // QT_CONFIG(statustip)
        self.wheel_neg6.setText("")
#if QT_CONFIG(statustip)
        self.wheel_pos5.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: right 5", None))
#endif // QT_CONFIG(statustip)
        self.wheel_pos5.setText("")
#if QT_CONFIG(statustip)
        self.button_2.setStatusTip(QCoreApplication.translate("MainWindow", u"Button 2", None))
#endif // QT_CONFIG(statustip)
        self.button_2.setText("")
#if QT_CONFIG(statustip)
        self.wheel_neg5.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: left 5", None))
#endif // QT_CONFIG(statustip)
        self.wheel_neg5.setText("")
#if QT_CONFIG(statustip)
        self.wheel_pos6.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: right 6", None))
#endif // QT_CONFIG(statustip)
        self.wheel_pos6.setText("")
#if QT_CONFIG(statustip)
        self.wheel_neg1.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: left 1", None))
#endif // QT_CONFIG(statustip)
        self.wheel_neg1.setText("")
#if QT_CONFIG(statustip)
        self.button_4.setStatusTip(QCoreApplication.translate("MainWindow", u"Button 4", None))
#endif // QT_CONFIG(statustip)
        self.button_4.setText("")
#if QT_CONFIG(statustip)
        self.wheel_pos7.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: right 7", None))
#endif // QT_CONFIG(statustip)
        self.wheel_pos7.setText("")
#if QT_CONFIG(statustip)
        self.button_3.setStatusTip(QCoreApplication.translate("MainWindow", u"Button 3", None))
#endif // QT_CONFIG(statustip)
        self.button_3.setText("")
#if QT_CONFIG(statustip)
        self.wheel_neg2.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: left 2", None))
#endif // QT_CONFIG(statustip)
        self.wheel_neg2.setText("")
#if QT_CONFIG(statustip)
        self.wheel_pos3.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: right 3", None))
#endif // QT_CONFIG(statustip)
        self.wheel_pos3.setText("")
#if QT_CONFIG(statustip)
        self.wheel_neg3.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: left 3", None))
#endif // QT_CONFIG(statustip)
        self.wheel_neg3.setText("")
#if QT_CONFIG(statustip)
        self.wheel_neg4.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: left 4", None))
#endif // QT_CONFIG(statustip)
        self.wheel_neg4.setText(QCoreApplication.translate("MainWindow", u"-", None))
#if QT_CONFIG(statustip)
        self.wheel_neg7.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: left 7", None))
#endif // QT_CONFIG(statustip)
        self.wheel_neg7.setText("")
#if QT_CONFIG(tooltip)
        self.about_button.setToolTip("")
#endif // QT_CONFIG(tooltip)
#if QT_CONFIG(statustip)
        self.about_button.setStatusTip(QCoreApplication.translate("MainWindow", u"About", None))
#endif // QT_CONFIG(statustip)
        self.about_button.setText(QCoreApplication.translate("MainWindow", u"?", None))
#if QT_CONFIG(tooltip)
        self.plug_button.setToolTip("")
#endif // QT_CONFIG(tooltip)
#if QT_CONFIG(statustip)
        self.plug_button.setStatusTip(QCoreApplication.translate("MainWindow", u"Configuration", None))
#endif // QT_CONFIG(statustip)
        self.plug_button.setText(QCoreApplication.translate("MainWindow", u"#", None))
#if QT_CONFIG(tooltip)
        self.conf_button.setToolTip("")
#endif // QT_CONFIG(tooltip)
#if QT_CONFIG(statustip)
        self.conf_button.setStatusTip(QCoreApplication.translate("MainWindow", u"Configuration", None))
#endif // QT_CONFIG(statustip)
        self.conf_button.setText(QCoreApplication.translate("MainWindow", u"=", None))
        self.about_widget.setWindowTitle(QCoreApplication.translate("MainWindow", u"About", None))
        self.about_text.setDocumentTitle("")
        self.log_widget.setWindowTitle(QCoreApplication.translate("MainWindow", u"Log", None))
        self.log_clear_button.setText(QCoreApplication.translate("MainWindow", u"Clear", None))
        self.config_widget.setWindowTitle(QCoreApplication.translate("MainWindow", u"Configuration", None))
        self.plugins_widget.setWindowTitle(QCoreApplication.translate("MainWindow", u"Plugins", None))
Example #8
0
class Ui_SlideshowClip_UI(object):
    def setupUi(self, SlideshowClip_UI):
        if not SlideshowClip_UI.objectName():
            SlideshowClip_UI.setObjectName(u"SlideshowClip_UI")
        SlideshowClip_UI.resize(354, 631)
        self.gridLayout_4 = QGridLayout(SlideshowClip_UI)
        self.gridLayout_4.setObjectName(u"gridLayout_4")
        self.gridLayout_4.setVerticalSpacing(6)
        self.icon_list = QListWidget(SlideshowClip_UI)
        self.icon_list.setObjectName(u"icon_list")

        self.gridLayout_4.addWidget(self.icon_list, 12, 0, 1, 4)

        self.animation = KComboBox(SlideshowClip_UI)
        self.animation.setObjectName(u"animation")
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.animation.sizePolicy().hasHeightForWidth())
        self.animation.setSizePolicy(sizePolicy)

        self.gridLayout_4.addWidget(self.animation, 10, 2, 1, 2)

        self.slide_crop = QCheckBox(SlideshowClip_UI)
        self.slide_crop.setObjectName(u"slide_crop")

        self.gridLayout_4.addWidget(self.slide_crop, 4, 0, 1, 2)

        self.label_3 = QLabel(SlideshowClip_UI)
        self.label_3.setObjectName(u"label_3")

        self.gridLayout_4.addWidget(self.label_3, 0, 0, 1, 1)

        self.label_2 = QLabel(SlideshowClip_UI)
        self.label_2.setObjectName(u"label_2")

        self.gridLayout_4.addWidget(self.label_2, 2, 0, 1, 2)

        self.horizontalLayout_2 = QHBoxLayout()
        self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
        self.clip_duration = QLineEdit(SlideshowClip_UI)
        self.clip_duration.setObjectName(u"clip_duration")

        self.horizontalLayout_2.addWidget(self.clip_duration)

        self.clip_duration_frames = QSpinBox(SlideshowClip_UI)
        self.clip_duration_frames.setObjectName(u"clip_duration_frames")
        sizePolicy1 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        sizePolicy1.setHorizontalStretch(0)
        sizePolicy1.setVerticalStretch(0)
        sizePolicy1.setHeightForWidth(
            self.clip_duration_frames.sizePolicy().hasHeightForWidth())
        self.clip_duration_frames.setSizePolicy(sizePolicy1)
        self.clip_duration_frames.setMinimum(1)
        self.clip_duration_frames.setMaximum(256000)

        self.horizontalLayout_2.addWidget(self.clip_duration_frames)

        self.gridLayout_4.addLayout(self.horizontalLayout_2, 2, 2, 1, 1)

        self.luma_softness = QSlider(SlideshowClip_UI)
        self.luma_softness.setObjectName(u"luma_softness")
        self.luma_softness.setEnabled(False)
        self.luma_softness.setMaximum(100)
        self.luma_softness.setOrientation(Qt.Horizontal)

        self.gridLayout_4.addWidget(self.luma_softness, 8, 2, 1, 2)

        self.horizontalLayout = QHBoxLayout()
        self.horizontalLayout.setObjectName(u"horizontalLayout")
        self.luma_duration = QLineEdit(SlideshowClip_UI)
        self.luma_duration.setObjectName(u"luma_duration")

        self.horizontalLayout.addWidget(self.luma_duration)

        self.luma_duration_frames = QSpinBox(SlideshowClip_UI)
        self.luma_duration_frames.setObjectName(u"luma_duration_frames")
        self.luma_duration_frames.setEnabled(False)
        sizePolicy1.setHeightForWidth(
            self.luma_duration_frames.sizePolicy().hasHeightForWidth())
        self.luma_duration_frames.setSizePolicy(sizePolicy1)
        self.luma_duration_frames.setMinimum(1)
        self.luma_duration_frames.setMaximum(256000)

        self.horizontalLayout.addWidget(self.luma_duration_frames)

        self.gridLayout_4.addLayout(self.horizontalLayout, 5, 2, 1, 2)

        self.luma_fade = QCheckBox(SlideshowClip_UI)
        self.luma_fade.setObjectName(u"luma_fade")
        self.luma_fade.setEnabled(False)

        self.gridLayout_4.addWidget(self.luma_fade, 7, 0, 1, 1)

        self.slide_fade = QCheckBox(SlideshowClip_UI)
        self.slide_fade.setObjectName(u"slide_fade")

        self.gridLayout_4.addWidget(self.slide_fade, 5, 0, 1, 1)

        self.luma_file = KComboBox(SlideshowClip_UI)
        self.luma_file.setObjectName(u"luma_file")
        self.luma_file.setEnabled(False)

        self.gridLayout_4.addWidget(self.luma_file, 7, 2, 1, 2)

        self.label_softness = QLabel(SlideshowClip_UI)
        self.label_softness.setObjectName(u"label_softness")
        self.label_softness.setEnabled(False)

        self.gridLayout_4.addWidget(self.label_softness, 8, 0, 1, 1)

        self.groupBox = QGroupBox(SlideshowClip_UI)
        self.groupBox.setObjectName(u"groupBox")
        self.gridLayout = QGridLayout(self.groupBox)
        self.gridLayout.setObjectName(u"gridLayout")
        self.gridLayout.setVerticalSpacing(0)
        self.method_mime = QRadioButton(self.groupBox)
        self.method_mime.setObjectName(u"method_mime")
        self.method_mime.setChecked(True)

        self.gridLayout.addWidget(self.method_mime, 0, 0, 1, 1)

        self.method_pattern = QRadioButton(self.groupBox)
        self.method_pattern.setObjectName(u"method_pattern")

        self.gridLayout.addWidget(self.method_pattern, 0, 1, 1, 1)

        self.stackedWidget = QStackedWidget(self.groupBox)
        self.stackedWidget.setObjectName(u"stackedWidget")
        self.page = QWidget()
        self.page.setObjectName(u"page")
        self.gridLayout_2 = QGridLayout(self.page)
        self.gridLayout_2.setObjectName(u"gridLayout_2")
        self.label = QLabel(self.page)
        self.label.setObjectName(u"label")

        self.gridLayout_2.addWidget(self.label, 0, 0, 1, 1)

        self.verticalSpacer_2 = QSpacerItem(20, 40, QSizePolicy.Minimum,
                                            QSizePolicy.Expanding)

        self.gridLayout_2.addItem(self.verticalSpacer_2, 2, 2, 1, 1)

        self.label_4 = QLabel(self.page)
        self.label_4.setObjectName(u"label_4")

        self.gridLayout_2.addWidget(self.label_4, 1, 0, 1, 1)

        self.folder_url = KUrlRequester(self.page)
        self.folder_url.setObjectName(u"folder_url")

        self.gridLayout_2.addWidget(self.folder_url, 0, 1, 1, 2)

        self.image_type = KComboBox(self.page)
        self.image_type.setObjectName(u"image_type")

        self.gridLayout_2.addWidget(self.image_type, 1, 1, 1, 2)

        self.stackedWidget.addWidget(self.page)
        self.page_2 = QWidget()
        self.page_2.setObjectName(u"page_2")
        self.gridLayout_3 = QGridLayout(self.page_2)
        self.gridLayout_3.setObjectName(u"gridLayout_3")
        self.label_5 = QLabel(self.page_2)
        self.label_5.setObjectName(u"label_5")

        self.gridLayout_3.addWidget(self.label_5, 0, 0, 1, 1)

        self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum,
                                          QSizePolicy.Expanding)

        self.gridLayout_3.addItem(self.verticalSpacer, 1, 2, 1, 1)

        self.pattern_url = KUrlRequester(self.page_2)
        self.pattern_url.setObjectName(u"pattern_url")

        self.gridLayout_3.addWidget(self.pattern_url, 0, 1, 1, 2)

        self.stackedWidget.addWidget(self.page_2)

        self.gridLayout.addWidget(self.stackedWidget, 1, 0, 1, 2)

        self.gridLayout_4.addWidget(self.groupBox, 1, 0, 1, 4)

        self.buttonBox = QDialogButtonBox(SlideshowClip_UI)
        self.buttonBox.setObjectName(u"buttonBox")
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel
                                          | QDialogButtonBox.Ok)

        self.gridLayout_4.addWidget(self.buttonBox, 14, 2, 1, 2)

        self.slide_loop = QCheckBox(SlideshowClip_UI)
        self.slide_loop.setObjectName(u"slide_loop")

        self.gridLayout_4.addWidget(self.slide_loop, 3, 0, 1, 1)

        self.clip_name = QLineEdit(SlideshowClip_UI)
        self.clip_name.setObjectName(u"clip_name")

        self.gridLayout_4.addWidget(self.clip_name, 0, 1, 1, 3)

        self.horizontalLayout_3 = QHBoxLayout()
        self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
        self.show_thumbs = QCheckBox(SlideshowClip_UI)
        self.show_thumbs.setObjectName(u"show_thumbs")

        self.horizontalLayout_3.addWidget(self.show_thumbs)

        self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                            QSizePolicy.Minimum)

        self.horizontalLayout_3.addItem(self.horizontalSpacer)

        self.label_info = QLabel(SlideshowClip_UI)
        self.label_info.setObjectName(u"label_info")

        self.horizontalLayout_3.addWidget(self.label_info)

        self.gridLayout_4.addLayout(self.horizontalLayout_3, 13, 0, 1, 4)

        self.clip_duration_format = KComboBox(SlideshowClip_UI)
        self.clip_duration_format.setObjectName(u"clip_duration_format")

        self.gridLayout_4.addWidget(self.clip_duration_format, 2, 3, 1, 1)

        self.label_6 = QLabel(SlideshowClip_UI)
        self.label_6.setObjectName(u"label_6")

        self.gridLayout_4.addWidget(self.label_6, 10, 0, 1, 1)

        self.low_pass = QCheckBox(SlideshowClip_UI)
        self.low_pass.setObjectName(u"low_pass")
        self.low_pass.setEnabled(False)

        self.gridLayout_4.addWidget(self.low_pass, 11, 0, 1, 4)

        self.retranslateUi(SlideshowClip_UI)
        self.buttonBox.accepted.connect(SlideshowClip_UI.accept)
        self.buttonBox.rejected.connect(SlideshowClip_UI.reject)

        self.stackedWidget.setCurrentIndex(0)

        QMetaObject.connectSlotsByName(SlideshowClip_UI)

    # setupUi

    def retranslateUi(self, SlideshowClip_UI):
        SlideshowClip_UI.setWindowTitle(
            QCoreApplication.translate("SlideshowClip_UI", u"Slideshow Clip",
                                       None))
        self.slide_crop.setText(
            QCoreApplication.translate("SlideshowClip_UI", u"Center crop",
                                       None))
        self.label_3.setText(
            QCoreApplication.translate("SlideshowClip_UI", u"Name:", None))
        self.label_2.setText(
            QCoreApplication.translate("SlideshowClip_UI", u"Frame duration:",
                                       None))
        self.luma_fade.setText(
            QCoreApplication.translate("SlideshowClip_UI", u"Wipe:", None))
        self.slide_fade.setText(
            QCoreApplication.translate("SlideshowClip_UI", u"Dissolve:", None))
        self.label_softness.setText(
            QCoreApplication.translate("SlideshowClip_UI", u"Softness:", None))
        self.groupBox.setTitle(
            QCoreApplication.translate("SlideshowClip_UI",
                                       u"Image Selection Method", None))
        self.method_mime.setText(
            QCoreApplication.translate("SlideshowClip_UI", u"&MIME type",
                                       None))
        self.method_pattern.setText(
            QCoreApplication.translate("SlideshowClip_UI",
                                       u"Fi&lename pattern", None))
        self.label.setText(
            QCoreApplication.translate("SlideshowClip_UI", u"Folder:", None))
        self.label_4.setText(
            QCoreApplication.translate("SlideshowClip_UI", u"Image type:",
                                       None))
        self.label_5.setText(
            QCoreApplication.translate("SlideshowClip_UI", u"First frame",
                                       None))
        self.slide_loop.setText(
            QCoreApplication.translate("SlideshowClip_UI", u"Loop", None))
        self.show_thumbs.setText(
            QCoreApplication.translate("SlideshowClip_UI", u"Show thumbnails",
                                       None))
        self.label_info.setText(
            QCoreApplication.translate("SlideshowClip_UI", u"No image found",
                                       None))
        self.label_6.setText(
            QCoreApplication.translate("SlideshowClip_UI", u"Animation:",
                                       None))
        self.low_pass.setText(
            QCoreApplication.translate("SlideshowClip_UI", u"Low pass", None))
Example #9
0
class Maker(QWidget):
    def __init__(self, parent=None):
        super(Maker, self).__init__(parent)

        self.setWindowTitle("Project Maker")

        self.userFilepath = QLineEdit()
        self.userFilepath.setPlaceholderText("Your filepath here...")
        self.projName = QLineEdit()
        self.projName.setPlaceholderText("Your project name here...")
        self.makeButton = QPushButton("Create Project")
        self.fileSearchButton = QPushButton("...")
        self.fileSearchButton.setToolTip(
            "Search for a directory for your project")

        self.goProj = QRadioButton("Go Project")
        self.goProj.setToolTip("You will still need a go.mod file")
        self.pyProj = QRadioButton("Python Project")
        self.versionControlFiles = QCheckBox(
            "Create README.md and .gitignore?")
        self.versionControlFiles.setToolTip(
            "Creates the files used in online version control, such as Github")
        self.pyProj.setChecked(True)
        self.versionControlFiles.setChecked(True)

        projSelect = QGroupBox("Project Selection")
        projectOptions = QVBoxLayout()
        projectOptions.addWidget(self.pyProj)
        projectOptions.addWidget(self.goProj)
        projectOptions.addWidget(self.versionControlFiles)
        projectOptions.stretch(1)
        projSelect.setLayout(projectOptions)

        searchLayout = QHBoxLayout()
        searchLayout.addWidget(self.userFilepath)
        searchLayout.addWidget(self.fileSearchButton)
        searchLayout.stretch(1)

        layout = QVBoxLayout()
        layout.addLayout(searchLayout)
        layout.addWidget(self.projName)
        layout.addWidget(self.makeButton)
        layout.addWidget(self.fileSearchButton)
        layout.addWidget(projSelect)
        self.setLayout(layout)

        self.makeButton.clicked.connect(self.createFiles)
        self.fileSearchButton.clicked.connect(self.onClickFileSearch)

    @Slot()
    def onClickFileSearch(self):
        fileSearch = QFileDialog.getExistingDirectory(self,
                                                      "Select a Directory...",
                                                      "C:/Users")
        self.userFilepath.setText(fileSearch)

    @Slot()
    def createFiles(self):
        p = Path(f"{self.userFilepath.text()}/{self.projName.text()}")
        try:
            p.mkdir()
        except FileExistsError as exc:
            msgbox = QMessageBox()
            msgbox.setText(f"{exc}")
            msgbox.exec()
        else:
            os.chdir(f"{self.userFilepath.text()}\\{self.projName.text()}")
            if self.pyProj.isChecked():
                fileType = "py"
            elif self.goProj.isChecked():
                fileType = "go"
            with open(f"{self.projName.text()}.{fileType}", "w") as f:
                f.write(f"# Created on {date.today()}")
            if self.versionControlFiles.isChecked():
                open("README.md", "a").close()
                open(".gitignore", "a").close()
    def __init__(self, ruler, parent=None):
        QWidget.__init__(self, parent)

        # units (cm/px/inch)
        unitsGroup = QButtonGroup(self)
        pixels = QRadioButton('Pixels')
        pixels.unit = 'px'
        centimeters = QRadioButton('Centimeters')
        centimeters.unit = 'cm'
        inches = QRadioButton('Inches')
        inches.unit = 'inch'

        selectedUnit = ruler.data.get('units')

        if selectedUnit == 'cm':
            centimeters.setChecked(True)

        elif selectedUnit == 'inch':
            inches.setChecked(True)

        else:
            pixels.setChecked(True)

        unitsGroup.addButton(pixels)
        unitsGroup.addButton(centimeters)
        unitsGroup.addButton(inches)

        def changeUnits(radioButton):
            nonlocal selectedUnit
            newUnit = radioButton.unit

            if newUnit != selectedUnit:
                ruler.data.update('units', newUnit)
                selectedUnit = newUnit
                ruler.update()

        unitsGroup.buttonClicked.connect(changeUnits)

        # orientation (horizontal/vertical)
        horizontalOrientation = ruler.data.get('horizontal_orientation')

        orientationGroup = QButtonGroup(self)
        self.horizontal_string = 'Horizontal'
        self.vertical_string = 'Vertical'
        horizontal = QRadioButton(self.horizontal_string)
        vertical = QRadioButton(self.vertical_string)

        if horizontalOrientation:
            horizontal.setChecked(True)
            self.selected_orientation = self.horizontal_string

        else:
            vertical.setChecked(True)
            self.selected_orientation = self.vertical_string

        def changeOrientation(radioButton):
            text = radioButton.text()

            if self.selected_orientation != text:

                self.selected_orientation = text
                ruler.rotate()

        orientationGroup.addButton(horizontal)
        orientationGroup.addButton(vertical)
        orientationGroup.buttonClicked.connect(changeOrientation)

        # length settings (always above + division lines + current length)
        alwaysAbove = QCheckBox('Always Above', self)
        alwaysAbove.setChecked(ruler.data.get('always_above'))

        def alwaysAboveSetting():

            if alwaysAbove.isChecked():

                ruler.data.update('always_above', True)
                ruler.setWindowFlags(ruler.windowFlags()
                                     | Qt.WindowStaysOnTopHint)

            else:
                ruler.data.update('always_above', False)
                ruler.setWindowFlags(ruler.windowFlags()
                                     & ~Qt.WindowStaysOnTopHint)

            ruler.show()

        alwaysAbove.clicked.connect(alwaysAboveSetting)

        divisionLines = QCheckBox('1/2 1/4 3/4 divisions', self)
        divisionLines.setChecked(ruler.data.get('division_lines'))

        def divisionLinesSetting():
            ruler.data.update('division_lines', divisionLines.isChecked())
            ruler.update()

        divisionLines.clicked.connect(divisionLinesSetting)

        currentLength = QLabel('0px')
        currentLength.setAlignment(Qt.AlignCenter)

        # setup the layout
        layout = QGridLayout()
        layout.setSpacing(10)

        # set the same width/height for all the columns/rows
        columnWidth = 120
        rowHeight = 25
        layout.setRowMinimumHeight(0, rowHeight)
        layout.setRowMinimumHeight(1, rowHeight)
        layout.setRowMinimumHeight(2, rowHeight)
        layout.setColumnMinimumWidth(0, columnWidth)
        layout.setColumnMinimumWidth(1, columnWidth)
        layout.setColumnMinimumWidth(2, columnWidth)

        # first column
        layout.addWidget(pixels, 0, 0)
        layout.addWidget(centimeters, 1, 0)
        layout.addWidget(inches, 2, 0)

        # second column
        layout.addWidget(horizontal, 0, 1)
        layout.addWidget(vertical, 1, 1)

        # third column
        layout.addWidget(alwaysAbove, 0, 2)
        layout.addWidget(divisionLines, 1, 2)
        layout.addWidget(currentLength, 2, 2)

        layout.setSizeConstraint(QLayout.SetFixedSize)

        self.current_length = currentLength
        self.vertical = vertical
        self.horizontal = horizontal
        self.setLayout(layout)
Example #11
0
class Ui_Img(object):
    def setupUi(self, Img):
        if not Img.objectName():
            Img.setObjectName(u"Img")
        Img.resize(620, 559)
        self.gridLayout = QGridLayout(Img)
        self.gridLayout.setObjectName(u"gridLayout")
        self.graphicsView = QGraphicsView(Img)
        self.graphicsView.setObjectName(u"graphicsView")

        self.gridLayout.addWidget(self.graphicsView, 0, 0, 1, 1)

        self.verticalLayout = QVBoxLayout()
        self.verticalLayout.setObjectName(u"verticalLayout")
        self.line_3 = QFrame(Img)
        self.line_3.setObjectName(u"line_3")
        self.line_3.setFrameShape(QFrame.VLine)
        self.line_3.setFrameShadow(QFrame.Sunken)

        self.verticalLayout.addWidget(self.line_3)

        self.verticalLayout_2 = QVBoxLayout()
        self.verticalLayout_2.setObjectName(u"verticalLayout_2")
        self.line_5 = QFrame(Img)
        self.line_5.setObjectName(u"line_5")
        self.line_5.setFrameShape(QFrame.VLine)
        self.line_5.setFrameShadow(QFrame.Sunken)

        self.verticalLayout_2.addWidget(self.line_5)

        self.checkBox = QCheckBox(Img)
        self.checkBox.setObjectName(u"checkBox")
        self.checkBox.setMaximumSize(QSize(100, 16777215))
        self.checkBox.setChecked(True)

        self.verticalLayout_2.addWidget(self.checkBox)

        self.ttaModel = QCheckBox(Img)
        self.ttaModel.setObjectName(u"ttaModel")
        self.ttaModel.setMaximumSize(QSize(70, 16777215))

        self.verticalLayout_2.addWidget(self.ttaModel)

        self.horizontalLayout_3 = QHBoxLayout()
        self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
        self.scaleRadio = QRadioButton(Img)
        self.buttonGroup_2 = QButtonGroup(Img)
        self.buttonGroup_2.setObjectName(u"buttonGroup_2")
        self.buttonGroup_2.addButton(self.scaleRadio)
        self.scaleRadio.setObjectName(u"scaleRadio")
        self.scaleRadio.setMaximumSize(QSize(80, 16777215))
        self.scaleRadio.setChecked(True)

        self.horizontalLayout_3.addWidget(self.scaleRadio)

        self.scaleEdit = QLineEdit(Img)
        self.scaleEdit.setObjectName(u"scaleEdit")
        self.scaleEdit.setMaximumSize(QSize(160, 16777215))
        self.scaleEdit.setAlignment(Qt.AlignCenter)

        self.horizontalLayout_3.addWidget(self.scaleEdit)

        self.verticalLayout_2.addLayout(self.horizontalLayout_3)

        self.horizontalLayout_4 = QHBoxLayout()
        self.horizontalLayout_4.setObjectName(u"horizontalLayout_4")
        self.heighRadio = QRadioButton(Img)
        self.buttonGroup_2.addButton(self.heighRadio)
        self.heighRadio.setObjectName(u"heighRadio")
        self.heighRadio.setMaximumSize(QSize(80, 16777215))

        self.horizontalLayout_4.addWidget(self.heighRadio)

        self.widthEdit = QLineEdit(Img)
        self.widthEdit.setObjectName(u"widthEdit")
        self.widthEdit.setEnabled(False)
        self.widthEdit.setMaximumSize(QSize(60, 16777215))
        self.widthEdit.setAlignment(Qt.AlignCenter)

        self.horizontalLayout_4.addWidget(self.widthEdit)

        self.label_2 = QLabel(Img)
        self.label_2.setObjectName(u"label_2")
        self.label_2.setMaximumSize(QSize(20, 16777215))

        self.horizontalLayout_4.addWidget(self.label_2)

        self.heighEdit = QLineEdit(Img)
        self.heighEdit.setObjectName(u"heighEdit")
        self.heighEdit.setEnabled(False)
        self.heighEdit.setMaximumSize(QSize(60, 16777215))
        self.heighEdit.setAlignment(Qt.AlignCenter)

        self.horizontalLayout_4.addWidget(self.heighEdit)

        self.verticalLayout_2.addLayout(self.horizontalLayout_4)

        self.horizontalLayout_5 = QHBoxLayout()
        self.horizontalLayout_5.setObjectName(u"horizontalLayout_5")
        self.label_4 = QLabel(Img)
        self.label_4.setObjectName(u"label_4")
        self.label_4.setMaximumSize(QSize(60, 16777215))

        self.horizontalLayout_5.addWidget(self.label_4)

        self.noiseCombox = QComboBox(Img)
        self.noiseCombox.addItem("")
        self.noiseCombox.addItem("")
        self.noiseCombox.addItem("")
        self.noiseCombox.addItem("")
        self.noiseCombox.addItem("")
        self.noiseCombox.setObjectName(u"noiseCombox")
        self.noiseCombox.setMaximumSize(QSize(160, 16777215))

        self.horizontalLayout_5.addWidget(self.noiseCombox)

        self.verticalLayout_2.addLayout(self.horizontalLayout_5)

        self.horizontalLayout_6 = QHBoxLayout()
        self.horizontalLayout_6.setObjectName(u"horizontalLayout_6")
        self.label_5 = QLabel(Img)
        self.label_5.setObjectName(u"label_5")
        self.label_5.setMaximumSize(QSize(60, 16777215))

        self.horizontalLayout_6.addWidget(self.label_5)

        self.comboBox = QComboBox(Img)
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.setObjectName(u"comboBox")
        self.comboBox.setMaximumSize(QSize(160, 16777215))

        self.horizontalLayout_6.addWidget(self.comboBox)

        self.verticalLayout_2.addLayout(self.horizontalLayout_6)

        self.horizontalLayout_7 = QHBoxLayout()
        self.horizontalLayout_7.setObjectName(u"horizontalLayout_7")
        self.changeJpg = QPushButton(Img)
        self.changeJpg.setObjectName(u"changeJpg")
        self.changeJpg.setMaximumSize(QSize(100, 16777215))

        self.horizontalLayout_7.addWidget(self.changeJpg)

        self.changePng = QPushButton(Img)
        self.changePng.setObjectName(u"changePng")
        self.changePng.setMaximumSize(QSize(100, 16777215))

        self.horizontalLayout_7.addWidget(self.changePng)

        self.changeLabel = QLabel(Img)
        self.changeLabel.setObjectName(u"changeLabel")
        self.changeLabel.setMaximumSize(QSize(100, 16777215))
        self.changeLabel.setAlignment(Qt.AlignCenter)

        self.horizontalLayout_7.addWidget(self.changeLabel)

        self.verticalLayout_2.addLayout(self.horizontalLayout_7)

        self.horizontalLayout_11 = QHBoxLayout()
        self.horizontalLayout_11.setObjectName(u"horizontalLayout_11")

        self.verticalLayout_2.addLayout(self.horizontalLayout_11)

        self.verticalLayout.addLayout(self.verticalLayout_2)

        self.line = QFrame(Img)
        self.line.setObjectName(u"line")
        self.line.setFrameShape(QFrame.VLine)
        self.line.setFrameShadow(QFrame.Sunken)

        self.verticalLayout.addWidget(self.line)

        self.line_4 = QFrame(Img)
        self.line_4.setObjectName(u"line_4")
        self.line_4.setFrameShape(QFrame.HLine)
        self.line_4.setFrameShadow(QFrame.Sunken)

        self.verticalLayout.addWidget(self.line_4)

        self.verticalLayout_3 = QVBoxLayout()
        self.verticalLayout_3.setObjectName(u"verticalLayout_3")
        self.horizontalLayout_8 = QHBoxLayout()
        self.horizontalLayout_8.setObjectName(u"horizontalLayout_8")
        self.label_8 = QLabel(Img)
        self.label_8.setObjectName(u"label_8")
        self.label_8.setMaximumSize(QSize(60, 16777215))

        self.horizontalLayout_8.addWidget(self.label_8)

        self.resolutionLabel = QLabel(Img)
        self.resolutionLabel.setObjectName(u"resolutionLabel")
        self.resolutionLabel.setMaximumSize(QSize(160, 16777215))

        self.horizontalLayout_8.addWidget(self.resolutionLabel)

        self.verticalLayout_3.addLayout(self.horizontalLayout_8)

        self.horizontalLayout_9 = QHBoxLayout()
        self.horizontalLayout_9.setObjectName(u"horizontalLayout_9")
        self.label_10 = QLabel(Img)
        self.label_10.setObjectName(u"label_10")
        self.label_10.setMaximumSize(QSize(60, 16777215))

        self.horizontalLayout_9.addWidget(self.label_10)

        self.sizeLabel = QLabel(Img)
        self.sizeLabel.setObjectName(u"sizeLabel")
        self.sizeLabel.setMaximumSize(QSize(160, 16777215))

        self.horizontalLayout_9.addWidget(self.sizeLabel)

        self.verticalLayout_3.addLayout(self.horizontalLayout_9)

        self.horizontalLayout = QHBoxLayout()
        self.horizontalLayout.setObjectName(u"horizontalLayout")
        self.label = QLabel(Img)
        self.label.setObjectName(u"label")
        self.label.setMaximumSize(QSize(60, 16777215))

        self.horizontalLayout.addWidget(self.label)

        self.gpuName = QLabel(Img)
        self.gpuName.setObjectName(u"gpuName")
        self.gpuName.setMaximumSize(QSize(160, 16777215))

        self.horizontalLayout.addWidget(self.gpuName)

        self.verticalLayout_3.addLayout(self.horizontalLayout)

        self.horizontalLayout_10 = QHBoxLayout()
        self.horizontalLayout_10.setObjectName(u"horizontalLayout_10")
        self.label_6 = QLabel(Img)
        self.label_6.setObjectName(u"label_6")
        self.label_6.setMaximumSize(QSize(60, 16777215))

        self.horizontalLayout_10.addWidget(self.label_6)

        self.tickLabel = QLabel(Img)
        self.tickLabel.setObjectName(u"tickLabel")
        self.tickLabel.setMaximumSize(QSize(160, 16777215))

        self.horizontalLayout_10.addWidget(self.tickLabel)

        self.verticalLayout_3.addLayout(self.horizontalLayout_10)

        self.oepnButton = QPushButton(Img)
        self.oepnButton.setObjectName(u"oepnButton")
        self.oepnButton.setMaximumSize(QSize(100, 16777215))

        self.verticalLayout_3.addWidget(self.oepnButton)

        self.horizontalLayout_2 = QHBoxLayout()
        self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")

        self.verticalLayout_3.addLayout(self.horizontalLayout_2)

        self.pushButton_3 = QPushButton(Img)
        self.pushButton_3.setObjectName(u"pushButton_3")
        self.pushButton_3.setMaximumSize(QSize(100, 16777215))

        self.verticalLayout_3.addWidget(self.pushButton_3)

        self.pushButton = QPushButton(Img)
        self.pushButton.setObjectName(u"pushButton")
        self.pushButton.setMaximumSize(QSize(100, 16777215))

        self.verticalLayout_3.addWidget(self.pushButton)

        self.saveButton = QPushButton(Img)
        self.saveButton.setObjectName(u"saveButton")
        self.saveButton.setMaximumSize(QSize(100, 16777215))

        self.verticalLayout_3.addWidget(self.saveButton)

        self.verticalLayout.addLayout(self.verticalLayout_3)

        self.line_6 = QFrame(Img)
        self.line_6.setObjectName(u"line_6")
        self.line_6.setFrameShape(QFrame.HLine)
        self.line_6.setFrameShadow(QFrame.Sunken)

        self.verticalLayout.addWidget(self.line_6)

        self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum,
                                          QSizePolicy.Expanding)

        self.verticalLayout.addItem(self.verticalSpacer)

        self.line_2 = QFrame(Img)
        self.line_2.setObjectName(u"line_2")
        self.line_2.setFrameShape(QFrame.VLine)
        self.line_2.setFrameShadow(QFrame.Sunken)

        self.verticalLayout.addWidget(self.line_2)

        self.gridLayout.addLayout(self.verticalLayout, 0, 1, 1, 1)

        self.retranslateUi(Img)
        self.checkBox.clicked.connect(Img.SwithPicture)
        self.saveButton.clicked.connect(Img.SavePicture)
        self.heighEdit.textChanged.connect(Img.CheckScaleRadio)
        self.pushButton_3.clicked.connect(Img.ReduceScalePic)
        self.heighRadio.clicked.connect(Img.CheckScaleRadio)
        self.ttaModel.clicked.connect(Img.CheckScaleRadio)
        self.oepnButton.clicked.connect(Img.OpenPicture)
        self.widthEdit.textChanged.connect(Img.CheckScaleRadio)
        self.pushButton.clicked.connect(Img.AddScalePic)
        self.scaleEdit.textChanged.connect(Img.CheckScaleRadio)
        self.scaleRadio.clicked.connect(Img.CheckScaleRadio)
        self.comboBox.currentIndexChanged.connect(Img.ChangeModel)
        self.changeJpg.clicked.connect(Img.StartWaifu2x)
        self.noiseCombox.currentIndexChanged.connect(Img.CheckScaleRadio)
        self.changePng.clicked.connect(Img.StartWaifu2xPng)
        self.changeJpg.clicked.connect(Img.StartWaifu2xJPG)

        QMetaObject.connectSlotsByName(Img)

    # setupUi

    def retranslateUi(self, Img):
        Img.setWindowTitle(QCoreApplication.translate("Img", u"Form", None))
        self.checkBox.setText(
            QCoreApplication.translate("Img", u"waifu2x", None))
        #if QT_CONFIG(tooltip)
        self.ttaModel.setToolTip(
            QCoreApplication.translate(
                "Img",
                u"\u753b\u8d28\u63d0\u5347\uff0c\u8017\u65f6\u589e\u52a0",
                None))
        #endif // QT_CONFIG(tooltip)
        self.ttaModel.setText(
            QCoreApplication.translate("Img", u"tta\u6a21\u5f0f", None))
        self.scaleRadio.setText(
            QCoreApplication.translate("Img", u"\u500d\u6570\u653e\u5927",
                                       None))
        self.scaleEdit.setText(QCoreApplication.translate("Img", u"2", None))
        self.heighRadio.setText(
            QCoreApplication.translate("Img", u"\u56fa\u5b9a\u957f\u5bbd",
                                       None))
        self.label_2.setText(QCoreApplication.translate("Img", u"x", None))
        self.label_4.setText(
            QCoreApplication.translate("Img", u"\u964d\u566a\uff1a", None))
        self.noiseCombox.setItemText(
            0, QCoreApplication.translate("Img", u"3", None))
        self.noiseCombox.setItemText(
            1, QCoreApplication.translate("Img", u"2", None))
        self.noiseCombox.setItemText(
            2, QCoreApplication.translate("Img", u"1", None))
        self.noiseCombox.setItemText(
            3, QCoreApplication.translate("Img", u"0", None))
        self.noiseCombox.setItemText(
            4, QCoreApplication.translate("Img", u"-1", None))

        self.label_5.setText(
            QCoreApplication.translate("Img", u"\u6a21\u578b\uff1a", None))
        self.comboBox.setItemText(
            0, QCoreApplication.translate("Img", u"cunet", None))
        self.comboBox.setItemText(
            1, QCoreApplication.translate("Img", u"photo", None))
        self.comboBox.setItemText(
            2, QCoreApplication.translate("Img", u"anime_style_art_rgb", None))

        self.changeJpg.setText(
            QCoreApplication.translate("Img", u"\u8f6c\u6362JPG", None))
        self.changePng.setText(
            QCoreApplication.translate("Img", u"\u8f6c\u6362PNG", None))
        self.changeLabel.setText("")
        self.label_8.setText(
            QCoreApplication.translate("Img", u"\u5206\u8fa8\u7387\uff1a",
                                       None))
        self.resolutionLabel.setText(
            QCoreApplication.translate("Img", u"TextLabel", None))
        self.label_10.setText(
            QCoreApplication.translate("Img", u"\u5927 \u5c0f\uff1a", None))
        self.sizeLabel.setText(
            QCoreApplication.translate("Img", u"TextLabel", None))
        self.label.setText(QCoreApplication.translate("Img", u"GPU:", None))
        self.gpuName.setText(
            QCoreApplication.translate("Img", u"TextLabel", None))
        self.label_6.setText(
            QCoreApplication.translate("Img", u"\u8017\u65f6\uff1a", None))
        self.tickLabel.setText("")
        self.oepnButton.setText(
            QCoreApplication.translate("Img", u"\u6253\u5f00\u56fe\u7247",
                                       None))
        self.pushButton_3.setText(
            QCoreApplication.translate("Img", u"\u7f29\u5c0f", None))
        self.pushButton.setText(
            QCoreApplication.translate("Img", u"\u653e\u5927", None))
        self.saveButton.setText(
            QCoreApplication.translate("Img", u"\u4fdd\u5b58\u56fe\u7247",
                                       None))
Example #12
0
class Ui_CalcyOption(object):
    def setupUi(self, CalcyOption):
        if not CalcyOption.objectName():
            CalcyOption.setObjectName(u"CalcyOption")
        CalcyOption.resize(516, 262)
        self.horizontalLayout_2 = QHBoxLayout(CalcyOption)
        self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
        self.tabWidget = QTabWidget(CalcyOption)
        self.tabWidget.setObjectName(u"tabWidget")
        font = QFont()
        font.setFamilies([u"Verdana"])
        font.setPointSize(10)
        self.tabWidget.setFont(font)
        self.tabOutput = QWidget()
        self.tabOutput.setObjectName(u"tabOutput")
        self.formLayout = QFormLayout(self.tabOutput)
        self.formLayout.setObjectName(u"formLayout")
        self.verticalLayout_5 = QVBoxLayout()
        self.verticalLayout_5.setObjectName(u"verticalLayout_5")
        self.groupBox_2 = QGroupBox(self.tabOutput)
        self.groupBox_2.setObjectName(u"groupBox_2")
        self.verticalLayout_6 = QVBoxLayout(self.groupBox_2)
        self.verticalLayout_6.setObjectName(u"verticalLayout_6")
        self.radioButtonDecSepSystem = QRadioButton(self.groupBox_2)
        self.radioButtonDecSepSystem.setObjectName(u"radioButtonDecSepSystem")
        self.radioButtonDecSepSystem.setChecked(True)

        self.verticalLayout_6.addWidget(self.radioButtonDecSepSystem)

        self.radioButtonDecSepComa = QRadioButton(self.groupBox_2)
        self.radioButtonDecSepComa.setObjectName(u"radioButtonDecSepComa")

        self.verticalLayout_6.addWidget(self.radioButtonDecSepComa)

        self.radioButtonDecSepDot = QRadioButton(self.groupBox_2)
        self.radioButtonDecSepDot.setObjectName(u"radioButtonDecSepDot")

        self.verticalLayout_6.addWidget(self.radioButtonDecSepDot)


        self.verticalLayout_5.addWidget(self.groupBox_2)

        self.verticalLayout_4 = QVBoxLayout()
        self.verticalLayout_4.setObjectName(u"verticalLayout_4")
        self.horizontalLayout_3 = QHBoxLayout()
        self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
        self.label = QLabel(self.tabOutput)
        self.label.setObjectName(u"label")

        self.horizontalLayout_3.addWidget(self.label)

        self.spinBoxOutputPrecision = QSpinBox(self.tabOutput)
        self.spinBoxOutputPrecision.setObjectName(u"spinBoxOutputPrecision")
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.spinBoxOutputPrecision.sizePolicy().hasHeightForWidth())
        self.spinBoxOutputPrecision.setSizePolicy(sizePolicy)
        self.spinBoxOutputPrecision.setMinimumSize(QSize(55, 0))
        self.spinBoxOutputPrecision.setMaximumSize(QSize(60, 30))
        self.spinBoxOutputPrecision.setAlignment(Qt.AlignRight|Qt.AlignTrailing|Qt.AlignVCenter)
        self.spinBoxOutputPrecision.setMinimum(1)
        self.spinBoxOutputPrecision.setMaximum(10)
        self.spinBoxOutputPrecision.setValue(3)

        self.horizontalLayout_3.addWidget(self.spinBoxOutputPrecision)


        self.verticalLayout_4.addLayout(self.horizontalLayout_3)

        self.checkBoxShowGrpSep = QCheckBox(self.tabOutput)
        self.checkBoxShowGrpSep.setObjectName(u"checkBoxShowGrpSep")
        self.checkBoxShowGrpSep.setChecked(False)

        self.verticalLayout_4.addWidget(self.checkBoxShowGrpSep)

        self.checkBoxCopyToClipboard = QCheckBox(self.tabOutput)
        self.checkBoxCopyToClipboard.setObjectName(u"checkBoxCopyToClipboard")
        self.checkBoxCopyToClipboard.setChecked(True)

        self.verticalLayout_4.addWidget(self.checkBoxCopyToClipboard)


        self.verticalLayout_5.addLayout(self.verticalLayout_4)


        self.formLayout.setLayout(0, QFormLayout.LabelRole, self.verticalLayout_5)

        self.tabWidget.addTab(self.tabOutput, "")
        self.tabRadix = QWidget()
        self.tabRadix.setObjectName(u"tabRadix")
        self.horizontalLayout_6 = QHBoxLayout(self.tabRadix)
        self.horizontalLayout_6.setObjectName(u"horizontalLayout_6")
        self.verticalLayout_3 = QVBoxLayout()
        self.verticalLayout_3.setObjectName(u"verticalLayout_3")
        self.groupBox_3 = QGroupBox(self.tabRadix)
        self.groupBox_3.setObjectName(u"groupBox_3")
        self.horizontalLayout = QHBoxLayout(self.groupBox_3)
        self.horizontalLayout.setObjectName(u"horizontalLayout")
        self.checkBoxBinOut = QCheckBox(self.groupBox_3)
        self.checkBoxBinOut.setObjectName(u"checkBoxBinOut")
        self.checkBoxBinOut.setChecked(True)

        self.horizontalLayout.addWidget(self.checkBoxBinOut)

        self.checkBoxOctOut = QCheckBox(self.groupBox_3)
        self.checkBoxOctOut.setObjectName(u"checkBoxOctOut")
        self.checkBoxOctOut.setChecked(True)

        self.horizontalLayout.addWidget(self.checkBoxOctOut)

        self.checkBoxHexOut = QCheckBox(self.groupBox_3)
        self.checkBoxHexOut.setObjectName(u"checkBoxHexOut")
        self.checkBoxHexOut.setChecked(True)

        self.horizontalLayout.addWidget(self.checkBoxHexOut)

        self.checkBoxSizeOut = QCheckBox(self.groupBox_3)
        self.checkBoxSizeOut.setObjectName(u"checkBoxSizeOut")
        self.checkBoxSizeOut.setChecked(True)

        self.horizontalLayout.addWidget(self.checkBoxSizeOut)


        self.verticalLayout_3.addWidget(self.groupBox_3)

        self.verticalLayout = QVBoxLayout()
        self.verticalLayout.setObjectName(u"verticalLayout")
        self.checkBoxShowBasePrefix = QCheckBox(self.tabRadix)
        self.checkBoxShowBasePrefix.setObjectName(u"checkBoxShowBasePrefix")
        self.checkBoxShowBasePrefix.setChecked(True)

        self.verticalLayout.addWidget(self.checkBoxShowBasePrefix)

        self.checkBoxShowLeadingZerosBin = QCheckBox(self.tabRadix)
        self.checkBoxShowLeadingZerosBin.setObjectName(u"checkBoxShowLeadingZerosBin")
        self.checkBoxShowLeadingZerosBin.setChecked(True)

        self.verticalLayout.addWidget(self.checkBoxShowLeadingZerosBin)

        self.checkBoxShowLeadingZerosOct = QCheckBox(self.tabRadix)
        self.checkBoxShowLeadingZerosOct.setObjectName(u"checkBoxShowLeadingZerosOct")
        self.checkBoxShowLeadingZerosOct.setChecked(True)

        self.verticalLayout.addWidget(self.checkBoxShowLeadingZerosOct)

        self.checkBoxShowLeadingZerosHex = QCheckBox(self.tabRadix)
        self.checkBoxShowLeadingZerosHex.setObjectName(u"checkBoxShowLeadingZerosHex")
        self.checkBoxShowLeadingZerosHex.setChecked(True)

        self.verticalLayout.addWidget(self.checkBoxShowLeadingZerosHex)

        self.verticalSpacer_2 = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)

        self.verticalLayout.addItem(self.verticalSpacer_2)


        self.verticalLayout_3.addLayout(self.verticalLayout)


        self.horizontalLayout_6.addLayout(self.verticalLayout_3)

        self.verticalLayout_2 = QVBoxLayout()
        self.verticalLayout_2.setObjectName(u"verticalLayout_2")
        self.groupBoxBW = QGroupBox(self.tabRadix)
        self.groupBoxBW.setObjectName(u"groupBoxBW")
        self.horizontalLayout_5 = QHBoxLayout(self.groupBoxBW)
        self.horizontalLayout_5.setObjectName(u"horizontalLayout_5")
        self.radioButtonBW64 = QRadioButton(self.groupBoxBW)
        self.radioButtonBW64.setObjectName(u"radioButtonBW64")

        self.horizontalLayout_5.addWidget(self.radioButtonBW64)

        self.radioButtonBW32 = QRadioButton(self.groupBoxBW)
        self.radioButtonBW32.setObjectName(u"radioButtonBW32")

        self.horizontalLayout_5.addWidget(self.radioButtonBW32)

        self.radioButtonBW16 = QRadioButton(self.groupBoxBW)
        self.radioButtonBW16.setObjectName(u"radioButtonBW16")
        self.radioButtonBW16.setChecked(True)

        self.horizontalLayout_5.addWidget(self.radioButtonBW16)

        self.radioButtonBW8 = QRadioButton(self.groupBoxBW)
        self.radioButtonBW8.setObjectName(u"radioButtonBW8")

        self.horizontalLayout_5.addWidget(self.radioButtonBW8)


        self.verticalLayout_2.addWidget(self.groupBoxBW)

        self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)

        self.verticalLayout_2.addItem(self.verticalSpacer)


        self.horizontalLayout_6.addLayout(self.verticalLayout_2)

        self.tabWidget.addTab(self.tabRadix, "")

        self.horizontalLayout_2.addWidget(self.tabWidget)


        self.retranslateUi(CalcyOption)

        self.tabWidget.setCurrentIndex(0)


        QMetaObject.connectSlotsByName(CalcyOption)
    # setupUi

    def retranslateUi(self, CalcyOption):
        CalcyOption.setWindowTitle(QCoreApplication.translate("CalcyOption", u"CalcyPy - Simple calculator", None))
        self.groupBox_2.setTitle(QCoreApplication.translate("CalcyOption", u"Decimal point and group separator", None))
#if QT_CONFIG(tooltip)
        self.radioButtonDecSepSystem.setToolTip(QCoreApplication.translate("CalcyOption", u"Use system locale settings", None))
#endif // QT_CONFIG(tooltip)
        self.radioButtonDecSepSystem.setText(QCoreApplication.translate("CalcyOption", u"System default", None))
        self.radioButtonDecSepComa.setText(QCoreApplication.translate("CalcyOption", u"Coma as decimal point and dot as group separator", None))
        self.radioButtonDecSepDot.setText(QCoreApplication.translate("CalcyOption", u"Dot as decimal point and coma as group separator", None))
        self.label.setText(QCoreApplication.translate("CalcyOption", u"Decimal output Precision", None))
#if QT_CONFIG(tooltip)
        self.spinBoxOutputPrecision.setToolTip(QCoreApplication.translate("CalcyOption", u"<html><head/><body><p>Sets the maximal number of digits</p></body></html>", None))
#endif // QT_CONFIG(tooltip)
        self.checkBoxShowGrpSep.setText(QCoreApplication.translate("CalcyOption", u"Show group separator in result", None))
#if QT_CONFIG(tooltip)
        self.checkBoxCopyToClipboard.setToolTip(QCoreApplication.translate("CalcyOption", u"If this option is enabled, pressing enter key will copy calculation result to clipboard.", None))
#endif // QT_CONFIG(tooltip)
        self.checkBoxCopyToClipboard.setText(QCoreApplication.translate("CalcyOption", u"Use Enter key to Copy result to Clipboard", None))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabOutput), QCoreApplication.translate("CalcyOption", u"General", None))
        self.groupBox_3.setTitle(QCoreApplication.translate("CalcyOption", u"Show result as", None))
        self.checkBoxBinOut.setText(QCoreApplication.translate("CalcyOption", u"Bin", None))
        self.checkBoxOctOut.setText(QCoreApplication.translate("CalcyOption", u"Oct", None))
        self.checkBoxHexOut.setText(QCoreApplication.translate("CalcyOption", u"Hex", None))
        self.checkBoxSizeOut.setText(QCoreApplication.translate("CalcyOption", u"Size", None))
#if QT_CONFIG(tooltip)
        self.checkBoxShowBasePrefix.setToolTip(QCoreApplication.translate("CalcyOption", u"Show prefix for given number base in results (i.e. \"0x\" for hexadecimal numbers)", None))
#endif // QT_CONFIG(tooltip)
        self.checkBoxShowBasePrefix.setText(QCoreApplication.translate("CalcyOption", u"Show base prefix in result", None))
        self.checkBoxShowLeadingZerosBin.setText(QCoreApplication.translate("CalcyOption", u"Show leading zeros in bin output", None))
        self.checkBoxShowLeadingZerosOct.setText(QCoreApplication.translate("CalcyOption", u"Show leading zeros in oct output", None))
        self.checkBoxShowLeadingZerosHex.setText(QCoreApplication.translate("CalcyOption", u"Show leading zeros in hex output", None))
        self.groupBoxBW.setTitle(QCoreApplication.translate("CalcyOption", u"Calculation bit width", None))
        self.radioButtonBW64.setText(QCoreApplication.translate("CalcyOption", u"64", None))
        self.radioButtonBW32.setText(QCoreApplication.translate("CalcyOption", u"32", None))
        self.radioButtonBW16.setText(QCoreApplication.translate("CalcyOption", u"16", None))
        self.radioButtonBW8.setText(QCoreApplication.translate("CalcyOption", u"8", None))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabRadix), QCoreApplication.translate("CalcyOption", u"Radix", None))
Example #13
0
class MainWindow(QMainWindow):

    def __init__(self):
        QMainWindow.__init__(self)
        # Variaveis
        self.separador = ";" # Separador padrao de colunas em um arquivo txt ou csv
        self.selected = np.array([1, 24, 48, 96]).astype('timedelta64[h]') # selecionados ao iniciar o programa, modificavel.
        self.fileformat =  '' # Reservado para o formato do arquivo a ser aberto. Pode ser .xlsx ou .odf. ou .csv e assim vai.

        # facilita o acesso a variavel.
        self.timedeltastr = ("1 Hora","2 Horas", "3 Horas", "4 Horas","12 Horas",
         "24 Horas", "48 Horas", "72 horas", "96 horas", "30 Dias")
        self.timedeltas = np.array([1, 2, 3, 4, 12, 24, 48, 72, 96, 24*30]).astype('timedelta64[h]')
        self.linktimedelta = dict([(self.timedeltas[x], self.timedeltastr[x]) for x in range(len(self.timedeltastr))])

        self.datastring = ["DD/MM/AAAA",'AAAA/MM/DD', "AAAA-MM-DD", "DD-MM-AAAA"]
        self.dataformat = ["%d/%m/%Y", "%Y/%m/%d", "%Y-%m-%d", "%d-%m-%Y"]
        self.linkdata = dict([(self.datastring[x], self.dataformat[x]) for x in range(len(self.dataformat))])

        self.timestring = ["hh:mm", "hh:mm:ss", "hh:mm:ss.ms"]
        self.timeformat = ["%H:%M", "%H:%M:%S", "%H:%M:%S.%f"]
        self.linktime = dict([(self.timestring[x], self.timeformat[x]) for x in range(len(self.timeformat))])

        #Janela Principal
        widget = QWidget()
        self.setCentralWidget(widget)

        # Inicializa os Widgets
        self.folder = QLineEdit("Salvar Como...")
        self.path = QLineEdit("Abrir arquivo...")
        #
        buttonOpen = QPushButton('Abrir')
        buttonSave = QPushButton("Destino")
        Processar = QPushButton('Executar')
        Ajuda = QPushButton('Informações')
        #
        groupBox2 = QGroupBox("Delimitador")
        self.delimitador1 = QRadioButton("Ponto-Vírgula")
        self.delimitador2 = QRadioButton("Vírgula")
        self.delimitador3 = QRadioButton("Ponto")
        self.delimitador4 = QRadioButton("Tabulação")
        #
        checkGroup = QGroupBox("Mais opções")
        text3 = QPushButton("Configurações")
        text2 = QLabel("Formato da Data")
        text1 = QLabel("Formato da Hora")
        self.FormatoTime = QComboBox()
        self.FormatoTime.addItems(self.timestring)
        self.FormatoData = QComboBox()
        self.FormatoData.addItems(self.datastring)
        #
        text = QLabel("Por favor, selecione na tabela abaixo as colunas a utilizar:")
        self.ignore = QRadioButton("Possui Cabeçalho") # True se estiver selecionado, False caso nao
        #
        self.Tabela = QTableWidget(15,15)
        self.startTable()

        # Layouts
        MainLayout = QVBoxLayout()

        Gridlayout = QGridLayout()
        Gridlayout.addWidget(self.path, 0, 0)
        Gridlayout.addWidget(self.folder, 1, 0)
        Gridlayout.addWidget(buttonOpen, 0, 1)
        Gridlayout.addWidget(buttonSave, 1, 1)
        Gridlayout.addWidget(Processar, 0, 3)
        Gridlayout.addWidget(Ajuda, 1, 3)
        Gridlayout.setColumnStretch(0, 2)
        Gridlayout.setColumnStretch(3, 1)
        Gridlayout.setColumnMinimumWidth(2, 20)

        SecondLayout = QHBoxLayout()
        SecondLayout.addWidget(groupBox2)
        SecondLayout.addSpacing(40)
        SecondLayout.addWidget(checkGroup)
        #
        SepLayout = QVBoxLayout()
        SepLayout.addWidget(self.delimitador1)
        SepLayout.addWidget(self.delimitador2)
        SepLayout.addWidget(self.delimitador3)
        SepLayout.addWidget(self.delimitador4)
        #
        OptionsLayout = QVBoxLayout()
        OptionsLayout.addWidget(text3)
        OptionsLayout.addWidget(text2)
        OptionsLayout.addWidget(self.FormatoData)
        OptionsLayout.addWidget(text1)
        OptionsLayout.addWidget(self.FormatoTime)

        ThirdLayout = QVBoxLayout()
        ThirdLayout.addWidget(self.ignore)
        ThirdLayout.addWidget(text)

        MainLayout.addLayout(Gridlayout)
        MainLayout.addLayout(SecondLayout)
        MainLayout.addLayout(ThirdLayout)
        MainLayout.addWidget(self.Tabela)

        # Coloca o Layout principal na Janela
        widget.setLayout(MainLayout)

        # Comandos dos Widgets e edicoes.
        groupBox2.setLayout(SepLayout)
        self.delimitador1.setChecked(True)
        self.folder.setReadOnly(True)
        self.path.setReadOnly(True)
        checkGroup.setLayout(OptionsLayout)

        buttonOpen.clicked.connect(self.searchFile)
        buttonSave.clicked.connect(self.getNewFile)
        self.delimitador1.clicked.connect(self.updateDelimiter)
        self.delimitador2.clicked.connect(self.updateDelimiter)
        self.delimitador3.clicked.connect(self.updateDelimiter)
        self.delimitador4.clicked.connect(self.updateDelimiter)
        Ajuda.clicked.connect(self.help)
        Processar.clicked.connect(self.taskStart)
        text3.clicked.connect(self.openSubWindow)

        # Propriedades da janela principal
        height = 480
        width = 640
        myappid = 'GePlu.release1_0.0' # arbitrary string
        ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
        self.setWindowIcon(QIcon(r'images\icon6.ico'))
        self.setFixedSize(width, height)
        self.setWindowTitle("GePlu")

    def openSubWindow(self):

        dialog = MyDialog(self)
        dialog.show()
        dialog.exec_()

    def taskStart(self):
        ''' Inicia a execucao do programa, se houver algum erro durante o processo
        notifica o usuario e deixa a funcao imediatamente'''
        if self.folder.isModified() and self.path.isModified(): # o usuario entrou com os enderecos?
            start = time.time()

            # Conhece do que se trata cada coluna na tabela e armazena essa informacao.
            header = {}
            for col in range(15):
                header[self.Tabela.cellWidget(0, col).currentText()] = col

            boolean = 0 if self.ignore.isChecked() else None

            # Le o arquivo e retorna um dataframe de strings
            df_master = utils.read_file(self, header = boolean)
            df_master = dt.data_filter(self, df_master, header)
            df_master = dt.convert_dtype(self, df_master)

            # Computa os acumulados para cada intervalo de tempo (key).
            for key in self.selected:
                array = dt.compute(df_master.index.to_numpy(), df_master['Observado'].to_numpy(), key)
                df_master[self.linktimedelta[key]] = pd.Series(array, df_master.index)

            # salva o arquivo final.
            utils.save_file(self, df_master)

            # Fim do processo
            end = time.time()
            # Notifica o usuario
            QMessageBox.information(self, "Notificação", "Tarefa realizada com sucesso!\nTempo de execução: {} s.".format(round(end-start, 2)))
            # Reseta a tabela e os endereço do arquivo aberto e onde salvar, na janela principal.
            self.resetProgram()

        else:
            QMessageBox.warning(self, "Notificação", "Houve um erro no arquivo ou diretório especificado.\nPor favor, selecione um caminho válido.")


    def help(self):
        x = 'Caso tenha alguma dúvida, abra o documento em PDF presente\nna pasta do programa ou entre em contato.\n\nGeplu\n1.0.0'
        msgBox = QMessageBox.information(self, "Informação", x)

    def resetProgram(self):
        self.Tabela.clearContents()
        self.startTable()
        self.folder.setText("Salvar Como...")
        self.path.setText("Selecionar o arquivo...")
        self.folder.setModified(False)
        self.folder.setModified(False)

    def updateDelimiter(self):
        separadores = {"Ponto-Vírgula": ';', "Vírgula":",", "Ponto":".", "Tabulação":"\t"}
        for x in [self.delimitador1, self.delimitador3, self.delimitador2, self.delimitador4]:
            if x.isChecked():
                self.separador = separadores[x.text()]
                break

        if self.path.isModified():
            self.updateTable()

    def startTable(self):
        for col in range(self.Tabela.columnCount()):
            combo = QComboBox()
            combo.addItems(["Selecionar","Data & Hora","Prec. Observada","Data","Hora","Nível do Rio"])
            self.Tabela.setCellWidget(0, col, combo)

    def updateTable(self):
        # Guarda a primeira linha
        n_col = self.Tabela.columnCount()
        textos = [0]*n_col
        for col in range(n_col): textos[col] = self.Tabela.cellWidget(0, col).currentText()

        self.Tabela.clearContents()
        self.startTable()

        for col in range(n_col): self.Tabela.cellWidget(0, col).setCurrentText(textos[col])

        # Mostra na tabela as primeiras 14 linhas do arquivo que o usuario deseja abrir/utilizar.
        data_df = utils.read_file(self, 14).to_numpy()
        for row in range(data_df.shape[0]):
            for col in range(data_df.shape[1]):
                self.Tabela.setItem(row+1, col, QTableWidgetItem(data_df[row][col]))


    def searchFile(self):
        address, x = QFileDialog.getOpenFileName(self, "Selecione um arquivo",
            filter = "Text files (*.txt *.csv *.xlsx)"
            )
        if len(address) > 0:
            self.path.setText(address)
            self.path.setModified(True)
            self.fileformat = address[address.index('.'):]
            self.updateTable()

    def getNewFile(self):
        address, x = QFileDialog.getSaveFileName(self, "Salvar como",
            filter = "Text files (*.csv);; Text files (*.txt);; Planilha do Microsoft Excel (*.xlsx)"
            )
        if len(address) > 0:
            self.folder.setText(address)
            self.folder.setModified(True)
Example #14
0
class PetCtView(QtWidgets.QWidget):
    load_pt_ct_signal = QtCore.Signal()

    def __init__(self):
        """
        Initialises the PET/CT View with just the start button
        """
        # Initialise Widget
        QtWidgets.QWidget.__init__(self)
        self.initialised = False
        self.pet_ct_view_layout = QtWidgets.QVBoxLayout()

        # Initialise Button
        self.load_pet_ct_button = QPushButton()
        self.load_pet_ct_button.setText("Start PT/CT")
        self.load_pet_ct_button.clicked.connect(self.go_to_patient)

        # Create variables to be initialised later
        self.pt_ct_dict_container = None
        self.iso_color = None
        self.zoom = None
        self.current_slice_number = None
        self.slice_view = None
        self.overlay_view = None
        self.display_metadata = None
        self.format_metadata = None
        self.dicom_view_layout = None
        self.radio_button_layout = None
        self.slider_layout = None
        self.slider = None
        self.alpha_slider = None
        self.view = None
        self.pt_label = None
        self.ct_label = None
        self.scene = None
        self.axial_button = None
        self.coronal_button = None
        self.sagittal_button = None

        # Add button to widget and add widget to layout
        self.pet_ct_view_layout.addWidget(self.load_pet_ct_button)
        self.setLayout(self.pet_ct_view_layout)

    def go_to_patient(self):
        """
        Triggers when the start button is pressed
        """
        self.load_pet_ct_button.setEnabled(False)
        self.load_pt_ct_signal.emit() # Opens the OpenPTCTPatientWindow
        self.load_pet_ct_button.setEnabled(True)

    def load_pet_ct(self, roi_color=None, iso_color=None, slice_view="axial",
                    format_metadata=True):
        """
        Loads the PET/CT GUI after data has been added to PTCTDictContainer
        """
        self.pt_ct_dict_container = PTCTDictContainer()
        self.iso_color = iso_color
        self.zoom = 1
        self.current_slice_number = None
        self.slice_view = slice_view
        self.overlay_view = slice_view

        self.display_metadata = False
        self.format_metadata = format_metadata

        self.dicom_view_layout = QtWidgets.QHBoxLayout()
        self.radio_button_layout = QtWidgets.QHBoxLayout()
        self.slider_layout = QtWidgets.QHBoxLayout()
        # self.radio_button_layout.setAlignment(QtCore.Qt.AlignCenter)

        # Create components
        self.slider = QtWidgets.QSlider(QtCore.Qt.Vertical)
        self.init_slider()
        self.view = QtWidgets.QGraphicsView()

        # Alpha slider
        self.alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
        self.init_alpha_slider()

        # Slider labels
        self.ct_label = QtWidgets.QLabel("CT")
        self.pt_label = QtWidgets.QLabel("PET")

        self.init_view()
        self.scene = QtWidgets.QGraphicsScene()
        # radio buttons
        self.coronal_button = QRadioButton("Coronal")
        self.coronal_button.setChecked(False)
        self.coronal_button.toggled.connect(self.update_axis)
        self.axial_button = QRadioButton("Axial")
        self.axial_button.setChecked(True)
        self.axial_button.toggled.connect(self.update_axis)
        self.sagittal_button = QRadioButton("Sagittal")
        self.sagittal_button.setChecked(False)
        self.sagittal_button.toggled.connect(self.update_axis)

        # Set layout
        self.dicom_view_layout.addWidget(self.view)
        self.dicom_view_layout.addWidget(self.slider)

        self.slider_layout.addWidget(self.ct_label)
        self.slider_layout.addWidget(self.alpha_slider)
        self.slider_layout.addWidget(self.pt_label)

        self.load_pet_ct_button.setVisible(False)
        self.pet_ct_view_layout.removeWidget(self.load_pet_ct_button)

        self.pet_ct_view_layout.addLayout(self.dicom_view_layout)
        self.pet_ct_view_layout.addLayout(self.slider_layout)
        self.pet_ct_view_layout.addLayout(self.radio_button_layout,
                                          QtCore.Qt.AlignBottom
                                          | QtCore.Qt.AlignCenter)

        self.radio_button_layout.addWidget(self.coronal_button)
        self.radio_button_layout.addWidget(self.axial_button)
        self.radio_button_layout.addWidget(self.sagittal_button)

        self.setLayout(self.pet_ct_view_layout)
        self.update_view()

        self.initialised = True

    def init_slider(self):
        """
        Create a slider for the DICOM Image View.
        """
        pixmaps = self.pt_ct_dict_container.get(
            "ct_pixmaps_" + self.slice_view)
        self.slider.setMinimum(0)
        self.slider.setMaximum(len(pixmaps) - 1)
        self.slider.setValue(int(len(pixmaps) / 2))
        self.slider.setTickPosition(QtWidgets.QSlider.TicksLeft)
        self.slider.setTickInterval(1)
        self.slider.valueChanged.connect(self.value_changed)

    def init_alpha_slider(self):
        """
        Creates the alpha slider for opacity between images
        """
        self.alpha_slider.setMinimum(0)
        self.alpha_slider.setMaximum(100)
        self.alpha_slider.setValue(50)
        self.alpha_slider.setTickPosition(QtWidgets.QSlider.TicksLeft)
        self.alpha_slider.setTickInterval(1)
        self.alpha_slider.valueChanged.connect(self.value_changed)

    def init_view(self):
        """
        Create a view widget for DICOM image.
        """
        self.view.setRenderHints(
            QtGui.QPainter.Antialiasing | QtGui.QPainter.SmoothPixmapTransform)
        background_brush = QtGui.QBrush(QtGui.QColor(0, 0, 0),
                                        QtCore.Qt.SolidPattern)
        self.view.setBackgroundBrush(background_brush)

    def update_axis(self):
        """
        Triggers when a radio button is pressed
        """
        toggled = self.sender()
        if toggled.isChecked():
            self.slice_view = toggled.text().lower()
            pixmaps = self.pt_ct_dict_container.get(
                "ct_pixmaps_" + self.slice_view)
            self.slider.setMaximum(len(pixmaps) - 1)
            self.slider.setValue(int(len(pixmaps) / 2))

        self.update_view()

    def value_changed(self):
        """
        Triggers when a value is changed on PET/CT
        """
        self.update_view()

    def update_view(self, zoom_change=False):
        """
        Update the view of the DICOM Image.
        :param zoom_change: Boolean indicating whether the user wants to
        change the zoom. False by default.
        """
        self.image_display()

        if zoom_change:
            self.view.setTransform(
                QtGui.QTransform().scale(self.zoom, self.zoom))

        self.view.setScene(self.scene)

    def image_display(self):
        """
        Update the ct_image to be displayed on the DICOM View.
        """
        # Lead CT
        ct_pixmaps = self.pt_ct_dict_container.get(
            "ct_pixmaps_" + self.slice_view)
        slider_id = self.slider.value()
        ct_image = ct_pixmaps[slider_id].toImage()

        # Load PT
        pt_pixmaps = self.pt_ct_dict_container.get(
            "pt_pixmaps_" + self.slice_view)
        m = float(len(pt_pixmaps)) / len(ct_pixmaps)
        pt_image = pt_pixmaps[int(m * slider_id)].toImage()

        # Get alpha
        alpha = float(self.alpha_slider.value() / 100)

        # Merge Images
        painter = QPainter()
        painter.begin(ct_image)
        painter.setOpacity(alpha)
        painter.drawImage(0, 0, pt_image)
        painter.end()

        # Load merged images
        merged_pixmap = QtGui.QPixmap.fromImage(ct_image)
        label = QtWidgets.QGraphicsPixmapItem(merged_pixmap)
        self.scene = QtWidgets.QGraphicsScene()
        self.scene.addItem(label)

    def zoom_in(self):
        """
        Zooms in on PET/CT
        """
        self.zoom *= 1.05
        self.update_view(zoom_change=True)

    def zoom_out(self):
        """
        Zooms out on PET/CT
        """
        self.zoom /= 1.05
        self.update_view(zoom_change=True)