Ejemplo n.º 1
0
    def layouts(self):
        self.mainLayout = QVBoxLayout()
        self.topLayout = QVBoxLayout()
        self.bottomLayout = QFormLayout()
        self.topFrame = QFrame()
        self.bottomFrame = QFrame()

        # Add widgets
        self.topLayout.addWidget(self.titleText)
        self.topLayout.addWidget(self.personImg)
        self.topFrame.setLayout(self.topLayout)

        self.bottomLayout.addRow("ID: ", self.idEntry)
        self.bottomLayout.addRow("First name: ", self.firstNameEntry)
        self.bottomLayout.addRow("Last name: ", self.lastNameEntry)
        self.bottomLayout.addRow("Title: ", self.titleEntry)
        self.bottomLayout.addRow("Phone: ", self.phoneEntry)
        self.bottomLayout.addRow("Email: ", self.emailEntry)
        self.bottomLayout.addRow("Location: ", self.locationEntry)
        self.bottomLayout.addRow("Employment type: ", self.employmentTypeEntry)
        self.bottomLayout.addRow("", self.updateBtn)
        self.bottomLayout.addRow("", self.deleteBtn)
        self.bottomFrame.setLayout(self.bottomLayout)

        self.mainLayout.addWidget(self.topFrame)
        self.mainLayout.addWidget(self.bottomFrame)

        self.setLayout(self.mainLayout)
Ejemplo n.º 2
0
    def initUI(self):

        self.col = QColor(0, 0, 0)

        redb = QPushButton('Red', self)
        redb.setCheckable(True)
        redb.move(10, 10)
        redb.clicked[bool].connect(self.setColor)

        greenb = QPushButton('Green', self)
        greenb.setCheckable(True)
        greenb.move(10, 60)
        greenb.clicked[bool].connect(self.setColor)

        blueb = QPushButton('Blue', self)
        blueb.setCheckable(True)  # 把这个按钮变为切换按钮(类似checkBox)
        blueb.move(10, 100)
        blueb.clicked[bool].connect(self.setColor)  # True, False切换

        self.square = QFrame(self)
        self.square.setGeometry(150, 20, 100, 100)
        self.square.setStyleSheet("QWidget { background-color: %s }" %
                                  self.col.name())

        self.setGeometry(300, 300, 600, 400)
        self.setWindowTitle("Toggle button")
        self.show()
    def __init__(self, parent=None):
        super().__init__(parent)
        layout = QVBoxLayout()
        self.setLayout(layout)            
        self.setContentsMargins(0, 0, 0, 0)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)
        self.setAutoFillBackground(True)
        self.setFocusPolicy(Qt.StrongFocus)
        self.setFrameStyle(QFrame.Panel | QFrame.Plain)

        self._fallback_text = None
        self._experiment = None

        self.line_edit = QLineEdit()
        self.line_edit.setFrame(False)
        self.message_label = QLabel()
        self.message_label.hide()

        # Divider line
        self.divider_line = QFrame()
        self.divider_line.setFrameShape(QFrame.HLine)
        self.divider_line.setFrameShadow(QFrame.Plain)
        self.divider_line.setLineWidth(1)

        layout.addWidget(self.line_edit)
        layout.addWidget(self.divider_line)
        layout.addWidget(self.message_label)

        self.line_edit.textChanged.connect(self._updateMessage)
Ejemplo n.º 4
0
    def __init__(self, parent, id):
        super().__init__(parent)
        self.displays = []
        self.groupID = id
        self.displayArea = parent

        self.minX = 1000000
        self.minY = 1000000

        self.maxX = 0
        self.maxY = 0

        self.labelFrame = QFrame(self)
        self.labelFrame.setFrameShape(QFrame.Box)
        self.labelFrame.setAutoFillBackground(True)

        p = self.labelFrame.palette()
        p.setColor(self.backgroundRole(), QColor(80, 80, 200, 20))
        self.labelFrame.setPalette(p)

        self.label = QLabel(self.labelFrame)
        self.label.setText(self.groupID)
        self.label.setFont(QFont("arial", 32))
        self.label.setAlignment(Qt.AlignCenter)

        self.globalBounds = [0, 0, self.width(), self.height()]
        self.widgetBounds = [0, 0, self.width(), self.height()]
Ejemplo n.º 5
0
    def __init__(self, cp: ControlPoint, game_model: GameModel):
        super(QBaseMenuTabs, self).__init__()
        self.cp = cp
        if cp:

            if not cp.captured:
                if not cp.is_carrier:
                    self.base_defenses_hq = QBaseDefensesHQ(cp, game_model.game)
                    self.addTab(self.base_defenses_hq, "Base Defenses")
                self.intel = QIntelInfo(cp, game_model.game)
                self.addTab(self.intel, "Intel")
            else:
                if cp.has_runway():
                    self.airfield_command = QAirfieldCommand(cp, game_model)
                    self.addTab(self.airfield_command, "Airfield Command")

                if not cp.is_carrier:
                    self.ground_forces_hq = QGroundForcesHQ(cp, game_model)
                    self.addTab(self.ground_forces_hq, "Ground Forces HQ")
                    self.base_defenses_hq = QBaseDefensesHQ(cp, game_model.game)
                    self.addTab(self.base_defenses_hq, "Base Defenses")
                else:
                    self.base_defenses_hq = QBaseDefensesHQ(cp, game_model.game)
                    self.addTab(self.base_defenses_hq, "Fleet")

        else:
            tabError = QFrame()
            l = QGridLayout()
            l.addWidget(QLabel("No Control Point"))
            tabError.setLayout(l)
            self.addTab(tabError, "No Control Point")
Ejemplo n.º 6
0
 def __init_username_jobname_widget__(self, parent=None):
     self.__username_jobname_widget = QFrame(parent)
     self.__username_jobname_widget.setSizePolicy(QSizePolicy.Maximum,
                                                  QSizePolicy.Maximum)
     username_label = QLabel("Username",
                             parent=self.__username_jobname_widget)
     username_edit = QLineEdit(parent=self.__username_jobname_widget)
     username_edit.setText(self.dlp_controller.username)
     username_edit.textChanged.connect(self.dlp_controller.set_username)
     jobname_label = QLabel("Print Job Name",
                            parent=self.__username_jobname_widget)
     jobname_edit = QLineEdit(parent=self.__username_jobname_widget)
     jobname_edit.setText(self.dlp_controller.print_job_name)
     jobname_edit.textChanged.connect(self.dlp_controller.set_printjob_name)
     etc = self.dlp_controller.evaluate_time_estimate()
     self.etc_label = QLabel(
         "ETC: " +
         QDateTime.fromTime_t(etc / 1000.0).toUTC().toString('hh:mm:ss'),
         self.__username_jobname_widget)
     self.dlp_controller.etc_updated_signal.connect(
         self.update_time_estimate)
     username_jobname_layout = QHBoxLayout(self.__username_jobname_widget)
     username_jobname_layout.addWidget(self.etc_label)
     username_jobname_layout.addWidget(username_label)
     username_jobname_layout.addWidget(username_edit)
     username_jobname_layout.addWidget(jobname_label)
     username_jobname_layout.addWidget(jobname_edit)
     self.__username_jobname_widget.setLayout(username_jobname_layout)
Ejemplo n.º 7
0
    def _create_reg(self, frame, layout, col, width, cmp_switches,
                    ign_switches, cmp_fn, ign_fn):
        # Add indicators for each bit in the register, from MSB to LSB
        for i in range(width, 0, -1):
            check = QCheckBox(frame)
            check.setFixedSize(20, 20)
            check.setStyleSheet(
                'QCheckBox::indicator{subcontrol-position:center;}')
            check.stateChanged.connect(cmp_fn)
            layout.addWidget(check, 0, col)
            layout.setAlignment(check, Qt.AlignCenter)
            cmp_switches.append(check)

            check = QCheckBox(frame)
            check.setFixedSize(20, 20)
            check.setStyleSheet(
                'QCheckBox::indicator{subcontrol-position:center;}')
            check.stateChanged.connect(ign_fn)
            layout.addWidget(check, 1, col)
            layout.setAlignment(check, Qt.AlignCenter)
            ign_switches.append(check)

            col += 1

            # Add separators between each group of 3 bits
            if (i < 16) and (i > 1) and ((i % 3) == 1):
                sep = QFrame(frame)
                sep.setFrameStyle(QFrame.VLine | QFrame.Raised)
                layout.addWidget(sep, 0, col, 2, 1)
                col += 1

        return col
Ejemplo n.º 8
0
    def layouts(self):
        self.mainLayout = QVBoxLayout()
        self.topLayout = QHBoxLayout()
        self.bottomLayout = QFormLayout()
        # Put elements into frames for visual distinction
        self.topFrame = QFrame()
        self.bottomFrame = QFrame()

        # Add widgets to top layout
        self.topLayout.addWidget(self.addPersonImg)
        self.topLayout.addWidget(self.titleText)

        self.topFrame.setLayout(self.topLayout)

        # Add widgets to middle layout
        self.bottomLayout.addWidget(self.personInfoTitleText)
        self.bottomLayout.addRow(QLabel("First name: "), self.firstNameEntry)
        self.bottomLayout.addRow(QLabel("Last name: "), self.lastNameEntry)
        self.bottomLayout.addRow(QLabel("Title: "), self.titleEntry)
        self.bottomLayout.addRow(QLabel("Phone: "), self.phoneEntry)
        self.bottomLayout.addRow(QLabel("Email: "), self.emailEntry)
        self.bottomLayout.addRow(QLabel("Location: "), self.locationEntry)
        self.bottomLayout.addRow(QLabel("Employment type: "), self.employmentTypeEntry)
        self.bottomLayout.addRow(QLabel(""), self.attachPhotoBtn)
        self.bottomLayout.addRow(QLabel(""), self.addPersonBtn)

        self.bottomFrame.setLayout(self.bottomLayout)

        # Add frames to main layout
        self.mainLayout.addWidget(self.topFrame)
        self.mainLayout.addWidget(self.bottomFrame)

        self.setLayout(self.mainLayout)
Ejemplo n.º 9
0
class Forecast:
    def __init__(self):
        self.layout = QGridLayout()
        self.wrapper = QFrame()
        self.wrapper.setLayout(self.layout)
        self.layout.setSpacing(0)
        self.layout.setContentsMargins(0, 0, 0, 0)

        self.icon = QSvgWidget()
        self.day = QLabel()
        self.min_temp = QLabel()
        self.max_temp = QLabel()
        self.precip = QLabel()
        self.wind = QLabel()

        self.layout.addWidget(self.icon, 0, 0, 1, 1)
        self.layout.addWidget(self.day, 1, 0, 1, 1)
        self.layout.addWidget(self.min_temp, 1, 1, 1, 1)
        self.layout.addWidget(self.max_temp, 0, 1, 1, 1)
        self.layout.addWidget(self.wind, 0, 2, 1, 1)
        self.layout.addWidget(self.precip, 1, 2, 1, 1)

    def update(self, values):
        self.icon.load(values.icon)
        self.day.setText(values.day)
        self.min_temp.setText(values.min_temp)
        self.max_temp.setText(values.max_temp)
        self.precip.setText(values.precip)
        self.wind.setText(values.wind)
Ejemplo n.º 10
0
    def initUI(self):

        self.col = QColor(0, 0, 0)

        redb = QPushButton("Red", self)
        redb.setCheckable(True)
        redb.move(10, 10)

        redb.clicked[bool].connect(self.setColor)

        greenb = QPushButton("Green", self)
        greenb.setCheckable(True)
        greenb.move(10, 60)

        greenb.clicked[bool].connect(self.setColor)

        blueb = QPushButton("Blue", self)
        blueb.setCheckable(True)
        blueb.move(10, 110)

        blueb.clicked[bool].connect(self.setColor)

        self.square = QFrame(self)
        self.square.setGeometry(150, 20, 100, 100)
        self.square.setStyleSheet("QWidget { background-color: %s }" %
                                  self.col.name())

        self.setGeometry(300, 300, 280, 170)
        self.setWindowTitle("Toggle Button")
        self.show()
Ejemplo n.º 11
0
    def __init__(self, main):
        QFrame.__init__(self)
        self.setupUi(self)
        self.main = main
        self.table_size: list = [6, 5]
        self.spinBox_row.setValue(self.table_size[0])
        self.spinBox_col.setValue(self.table_size[1])
        self.start = [1, 1]
        self.end = [5, 4]
        self.obstacles = [[1, 3]
                          ]  # 2D list like [[1, 2], [3, 4]] to show obstacles
        self.radio = ""
        self.connect(self.spinBox_col, SIGNAL("valueChanged(int)"),
                     self.set_col)
        self.connect(self.spinBox_row, SIGNAL("valueChanged(int)"),
                     self.set_row)
        self.connect(self.pushButtonGenerate, SIGNAL("clicked()"),
                     self.generate_table)
        self.connect(self.pushButtonResult, SIGNAL("clicked()"), self.run)

        self.radioButtonInit.toggled.connect(
            lambda: self.radio_change(self.radioButtonInit))
        self.radioButtonGoal.toggled.connect(
            lambda: self.radio_change(self.radioButtonGoal))
        self.radioButtonObstacles.toggled.connect(
            lambda: self.radio_change(self.radioButtonObstacles))
        # TODO: edit cell
        self.connect(self.tableWidgetResult, SIGNAL("cellClicked(int, int)"),
                     self.on_click_cell)
        self.generate_table()
Ejemplo n.º 12
0
 def horizontal_line():
     line = QFrame()
     line.setFrameShape(QFrame.HLine)
     line.setFrameShadow(QFrame.Sunken)
     line.setFixedHeight(2)
     line.setContentsMargins(0, 30, 0, 0)
     return line
Ejemplo n.º 13
0
class Current:
    def __init__(self):
        self.layout = QGridLayout()
        self.wrapper = QFrame()
        self.wrapper.setLayout(self.layout)
        self.layout.setSpacing(0)
        self.layout.setContentsMargins(0, 0, 0, 0)

        self.time = QLabel()
        self.icon = QSvgWidget()
        self.temp = QLabel()
        self.precip = QLabel()
        self.wind = QLabel()

        self.layout.addWidget(self.time, 0, 0, 1, 2)
        self.layout.addWidget(self.icon, 1, 0, 3, 1)
        self.layout.addWidget(self.temp, 1, 1, 1, 1)
        self.layout.addWidget(self.wind, 2, 1, 1, 1)
        self.layout.addWidget(self.precip, 3, 1, 1, 1)

    def update(self, values):
        self.icon.load(values.icon)
        self.time.setText(values.time)
        self.temp.setText(values.temp)
        self.wind.setText(values.wind)
        self.precip.setText(values.precip)
Ejemplo n.º 14
0
    def __init__(self, flight: Flight, game: Game, planner, selected_tab):
        super(QFlightPlanner, self).__init__()

        print(selected_tab)

        self.tabCount = 0
        if flight:
            self.general_settings_tab = QGeneralFlightSettingsTab(
                flight, game, planner)
            self.general_settings_tab.on_flight_settings_changed.connect(
                lambda: self.on_planned_flight_changed.emit())
            self.payload_tab = QFlightPayloadTab(flight, game)
            self.waypoint_tab = QFlightWaypointTab(game, flight)
            self.waypoint_tab.on_flight_changed.connect(
                lambda: self.on_planned_flight_changed.emit())
            self.addTab(self.general_settings_tab, "General Flight settings")
            self.addTab(self.payload_tab, "Payload")
            self.addTab(self.waypoint_tab, "Waypoints")
            self.tabCount = 3
            self.setCurrentIndex(selected_tab)
        else:
            tabError = QFrame()
            l = QGridLayout()
            l.addWidget(QLabel("No flight selected"))
            tabError.setLayout(l)
            self.addTab(tabError, "No flight")
            self.tabCount = 1
Ejemplo n.º 15
0
    def _init_cfg_options_tab(self, tab):
        resolve_indirect_jumps = QCheckBox(self)
        resolve_indirect_jumps.setText('Resolve indirect jumps')
        resolve_indirect_jumps.setChecked(True)
        self.option_widgets['resolve_indirect_jumps'] = resolve_indirect_jumps

        collect_data_refs = QCheckBox(self)
        collect_data_refs.setText(
            'Collect data references (one per data item) and guess data types')
        collect_data_refs.setChecked(True)
        self.option_widgets['data_references'] = collect_data_refs

        xrefs = QCheckBox(self)
        xrefs.setText('Collect cross references')
        xrefs.setChecked(True)
        self.option_widgets['cross_references'] = xrefs

        layout = QVBoxLayout()
        layout.addWidget(resolve_indirect_jumps)
        layout.addWidget(collect_data_refs)
        layout.addWidget(xrefs)
        layout.addStretch(0)
        frame = QFrame(self)
        frame.setLayout(layout)
        tab.addTab(frame, 'CFG Options')
    def layouts(self):
        self.mainLayout = QVBoxLayout()
        self.topLayout = QVBoxLayout()
        self.bottomLayout = QFormLayout()
        self.bottomBtnLayout = QHBoxLayout()

        self.topFrame = QFrame()
        self.bottomFrame = QFrame()

        # Add widgets
        self.topLayout.addWidget(self.titleText)
        self.topLayout.addWidget(self.facilityImg)
        self.topFrame.setLayout(self.topLayout)

        self.bottomLayout.addRow("ID: ", self.idEntry)
        self.bottomLayout.addRow("First name: ", self.nameEntry)
        self.bottomLayout.addRow("Last name: ", self.locationEntry)
        self.bottomLayout.addRow("Title: ", self.phoneEntry)
        self.bottomLayout.addRow("Phone: ", self.emailEntry)
        self.bottomLayout.addRow("Email: ", self.supervisorEntry)

        self.bottomBtnLayout.addWidget(self.cancelBtn)
        self.bottomBtnLayout.addItem(
            QSpacerItem(60, 40, QSizePolicy.Minimum, QSizePolicy.Expanding))
        self.bottomBtnLayout.addWidget(self.deleteBtn)
        self.bottomBtnLayout.addWidget(self.updateBtn)

        self.bottomLayout.addRow(self.bottomBtnLayout)
        self.bottomFrame.setLayout(self.bottomLayout)

        self.mainLayout.addWidget(self.topFrame)
        self.mainLayout.addWidget(self.bottomFrame)

        self.setLayout(self.mainLayout)
Ejemplo n.º 17
0
    def get_frame(
        self,
        value: Union[
            Component,
            ComponentInfo,
            Transformation,
            LinkTransformation,
            TransformationsList,
            FileWriterModule,
        ],
    ):
        frame = QFrame()
        frame.setAutoFillBackground(True)
        SizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        SizePolicy.setHorizontalStretch(0)
        SizePolicy.setVerticalStretch(0)
        frame.setSizePolicy(SizePolicy)
        frame.setLayout(QVBoxLayout())
        frame.layout().setContentsMargins(0, 0, 0, 0)

        if isinstance(value, Group):
            get_group_frame(frame, value)
        elif isinstance(value, TransformationsList):
            get_transformations_list_frame(frame)
        elif isinstance(value, ComponentInfo):
            get_group_info_frame(frame, value)
        elif isinstance(value, Transformation):
            get_transformation_frame(frame, self.model, value)
        elif isinstance(value, LinkTransformation):
            get_link_transformation_frame(frame, self.model, value)
        elif isinstance(value, FileWriterModule):
            get_module_frame(frame, self.model, value, self._use_simple_tree_view)
        return frame
Ejemplo n.º 18
0
    def initUI(self):
        self.color = QColor(0, 0, 0)

        redButton = QPushButton('红', self)
        redButton.setCheckable(True)  #处于选中的状态
        redButton.move(10, 10)
        redButton.clicked[bool].connect(self.setColor)

        greenButton = QPushButton('绿', self)
        greenButton.setCheckable(True)
        greenButton.move(10, 60)
        greenButton.clicked[bool].connect(self.setColor)

        blueButton = QPushButton('蓝', self)
        blueButton.setCheckable(True)
        blueButton.move(10, 110)
        blueButton.clicked[bool].connect(self.setColor)

        self.square = QFrame(self)
        self.square.setGeometry(150, 20, 100, 100)

        self.square.setStyleSheet('QWidget{background-color:%s}' %
                                  self.color.name())
        self.setGeometry(300, 300, 280, 170)
        self.setWindowTitle('按钮控件')
        self.show()
    def __init__(self, cp: ControlPoint, game_model: GameModel) -> None:
        QFrame.__init__(self)
        self.cp = cp
        self.game_model = game_model
        self.deliveryEvent: Optional[UnitsDeliveryEvent] = None

        self.bought_amount_labels = {}
        self.existing_units_labels = {}

        for event in self.game_model.game.events:
            if event.__class__ == UnitsDeliveryEvent and event.from_cp == self.cp:
                self.deliveryEvent = event
        if not self.deliveryEvent:
            self.deliveryEvent = self.game_model.game.units_delivery_event(
                self.cp)

        # Determine maximum number of aircrafts that can be bought
        self.set_maximum_units(self.cp.available_aircraft_slots)
        self.set_recruitable_types([CAP, CAS])

        self.bought_amount_labels = {}
        self.existing_units_labels = {}

        self.hangar_status = QHangarStatus(self.total_units,
                                           self.cp.available_aircraft_slots)

        self.init_ui()
Ejemplo n.º 20
0
    def layouts(self):
        self.mainLayout = QVBoxLayout()
        self.topLayout = QVBoxLayout()
        self.bottomLayout = QFormLayout()
        self.topFrame = QFrame()
        self.bottomFrame = QFrame()

        # Add widgets
        self.topLayout.addWidget(self.titleText)
        self.topLayout.addWidget(self.facilityImg)
        self.topFrame.setLayout(self.topLayout)

        self.bottomLayout.addRow("ID: ", self.idEntry)
        self.bottomLayout.addRow("First name: ", self.nameEntry)
        self.bottomLayout.addRow("Last name: ", self.locationEntry)
        self.bottomLayout.addRow("Title: ", self.phoneEntry)
        self.bottomLayout.addRow("Phone: ", self.emailEntry)
        self.bottomLayout.addRow("Email: ", self.supervisorEntry)
        self.bottomLayout.addRow("", self.updateBtn)
        self.bottomLayout.addRow("", self.deleteBtn)
        self.bottomFrame.setLayout(self.bottomLayout)

        self.mainLayout.addWidget(self.topFrame)
        self.mainLayout.addWidget(self.bottomFrame)

        self.setLayout(self.mainLayout)
Ejemplo n.º 21
0
    def _init_widgets(self):
        if self._state.am_none():
            return

        layout = QVBoxLayout()
        area = QScrollArea()
        area.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
        area.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
        area.setWidgetResizable(True)

        table = QTableWidget(0, 0)
        table.setColumnCount(len(self.COLUMNS))
        table.setHorizontalHeaderLabels(self.COLUMNS)

        self.table = table
        layout.addWidget(table)

        # common ones
        layout.setSpacing(0)
        layout.addStretch(0)
        layout.setContentsMargins(2, 2, 2, 2)

        # the container
        container = QFrame()
        container.setAutoFillBackground(True)
        palette = container.palette()
        palette.setColor(container.backgroundRole(), Qt.white)
        container.setPalette(palette)
        container.setLayout(layout)

        area.setWidget(container)

        base_layout = QVBoxLayout()
        base_layout.addWidget(area)
        self.setLayout(base_layout)
    def __init__(self):
        super(RenameOptionsView, self).__init__()
        self.layout = QVBoxLayout()
        self.frame_layout = QVBoxLayout()
        self.options_lbl = QLabel(prefs.OPTIONS)
        self.frame = QFrame()
        self.prefix_h_layout = QHBoxLayout()
        self.complete_rename_h_layout = QHBoxLayout()
        self.search_and_replace_h_layout = QHBoxLayout()
        self.renumber_h_layout = QHBoxLayout()
        self.remove_ext_h_layout = QHBoxLayout()
        self.change_ext_h_layout = QHBoxLayout()
        self.create_backup_h_layout = QHBoxLayout()
        self.preview_h_layout = QHBoxLayout()
        self.start_lbl = QLabel(prefs.START_NUM)
        self.padding_lbl = QLabel(prefs.PADDING)
        self.add_prefix_cb = QCheckBox(prefs.PREFIX)
        self.prefix = QLineEdit(prefs.PREFIX_DEFAULT)
        self.complete_rename_cb = QCheckBox(prefs.COMPLETE_RENAME)
        self.new_name = QLineEdit(prefs.COMPLETE_RENAME_DEFAULT)
        self.search_and_replace_cb = QCheckBox(prefs.SEARCH_AND_REPLACE)
        self.find = QLineEdit(prefs.SEARCH_AND_REPLACE_DEFAULT)
        self.replace = QLineEdit(prefs.REPLACE_WITH_DEFAULT)
        self.renumber_cb = QCheckBox(prefs.RENUMBER)
        self.start_num = QSpinBox()
        self.padding = QComboBox()
        self.dot_cb = QCheckBox(prefs.USE_DOT)
        self.remove_ext_cb = QCheckBox(prefs.REMOVE_EXT)
        self.backup_files_cb = QCheckBox(prefs.BACKUP)
        self.change_ext_cb = QCheckBox(prefs.CHANGE_EXT)
        self.change_ext = QLineEdit(prefs.CHANGE_EXT_DEFAULT)
        self.preview_cb = QCheckBox(prefs.PREVIEW)

        self._configure()
Ejemplo n.º 23
0
    def setupUi(self, Dialog):
        if Dialog.objectName():
            Dialog.setObjectName(u"Dialog")
        Dialog.resize(878, 528)
        icon = QIcon()
        icon.addFile("./icon.ico")
        Dialog.setWindowIcon(icon)
        self.verticalLayout = QVBoxLayout(Dialog)
        self.verticalLayout.setObjectName(u"verticalLayout")
        self.horizontalLayout = QHBoxLayout()
        self.horizontalLayout.setObjectName(u"horizontalLayout")
        self.questionLable = QLabel(Dialog)
        self.questionLable.setObjectName(u"questionLable")
        font = QFont()
        font.setFamily(u"\u5fae\u8f6f\u96c5\u9ed1")
        font.setPointSize(12)
        self.questionLable.setFont(font)
        self.questionLable.setWordWrap(True)
        self.questionLable.setMargin(0)
        self.questionLable.setIndent(0)

        self.horizontalLayout.addWidget(self.questionLable)

        self.lcd = QLCDNumber(Dialog)
        self.lcd.setObjectName(u"lcd")
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.lcd.sizePolicy().hasHeightForWidth())
        self.lcd.setSizePolicy(sizePolicy)
        self.lcd.setMinimumSize(QSize(120, 60))
        self.lcd.setSmallDecimalPoint(True)
        self.lcd.setDigitCount(4)
        self.lcd.setSegmentStyle(QLCDNumber.Flat)
        self.lcd.setProperty("value", 120.000000000000000)

        self.horizontalLayout.addWidget(self.lcd)

        self.verticalLayout.addLayout(self.horizontalLayout)

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

        self.verticalLayout.addWidget(self.line)

        self.answerLable = QLabel(Dialog)
        self.answerLable.setObjectName(u"answerLable")
        font1 = QFont()
        font1.setFamily(u"Yu Gothic UI")
        font1.setPointSize(14)
        self.answerLable.setFont(font1)
        self.answerLable.setWordWrap(True)

        self.verticalLayout.addWidget(self.answerLable)

        self.retranslateUi(Dialog)

        QMetaObject.connectSlotsByName(Dialog)
Ejemplo n.º 24
0
    def get_frame(
        self,
        value: Union[
            Component,
            ComponentInfo,
            Transformation,
            LinkTransformation,
            TransformationsList,
        ],
    ):
        frame = QFrame()
        frame.setAutoFillBackground(True)
        SizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        SizePolicy.setHorizontalStretch(0)
        SizePolicy.setVerticalStretch(0)
        frame.setSizePolicy(SizePolicy)
        frame.setLayout(QVBoxLayout())
        frame.layout().setContentsMargins(0, 0, 0, 0)

        if isinstance(value, Component):
            get_component_frame(frame, value)
        elif isinstance(value, TransformationsList):
            get_transformations_list_frame(frame)
        elif isinstance(value, ComponentInfo):
            get_component_info_frame(frame)
        elif isinstance(value, Transformation):
            get_transformation_frame(frame, self.instrument, value)
        elif isinstance(value, LinkTransformation):
            get_link_transformation_frame(frame, self.instrument, value)
        return frame
Ejemplo n.º 25
0
    def initUI(self):

        self.col = QColor(0, 0, 0)

        redb = QPushButton('Red', self)
        redb.setCheckable(True)
        redb.move(10, 10)
        redb.clicked[bool].connect(self.setColor)

        greenb = QPushButton('Green', self)
        # make it checkable by calling the setCheckable() method
        greenb.setCheckable(True)
        greenb.move(10, 60)
        greenb.clicked[bool].connect(self.setColor)

        blueb = QPushButton('Blue', self)
        blueb.setCheckable(True)
        blueb.move(10, 110)
        blueb.clicked[bool].connect(self.setColor)

        self.square = QFrame(self)
        self.square.setGeometry(150, 20, 100, 100)
        self.square.setStyleSheet("QWidget { background-color: %s }" %
                                  self.col.name())

        self.setGeometry(300, 300, 280, 170)
        self.setWindowTitle('Toggle button')
        self.show()
Ejemplo n.º 26
0
    def create_widget(self, parent=None):
        main_group_box = QGroupBox()
        main_layout = QHBoxLayout()

        top = QFrame()
        top_layout = QGridLayout()
        top_layout.setColumnStretch(0, 2)
        top_layout.setColumnStretch(1, 1)

        top_layout.addWidget(self.tips_label, 0, 0)
        top_layout.addWidget(self.path_label, 1, 0)

        self.button_folder_selection = QPushButton('Select directory')
        self.button_folder_selection.clicked.connect(
            lambda: self.on_dir_selection())
        top_layout.addWidget(self.button_folder_selection, 1, 1)

        top.setLayout(top_layout)
        splitter = QSplitter(Qt.Vertical)
        splitter.addWidget(top)

        gestures_group_box = self.create_gestures_group_box()
        splitter.addWidget(gestures_group_box)

        splitter.setSizes([50, 200])
        main_layout.addWidget(splitter)
        main_group_box.setLayout(main_layout)

        return main_group_box
Ejemplo n.º 27
0
    def initUI(self):

        self.col = QColor(0, 0, 0)

        redb = QPushButton('赤', self)
        redb.setCheckable(True)
        redb.move(10, 10)

        redb.clicked[bool].connect(self.setColor)

        greenb = QPushButton('緑', self)
        greenb.setCheckable(True)
        greenb.move(10, 60)

        greenb.clicked[bool].connect(self.setColor)

        blueb = QPushButton('青', self)
        blueb.setCheckable(True)
        blueb.move(10, 110)

        blueb.clicked[bool].connect(self.setColor)

        self.square = QFrame(self)
        self.square.setGeometry(150, 20, 100, 100)
        self.square.setStyleSheet("QWidget { background-color: %s }" % self.col.name())
Ejemplo n.º 28
0
    def __init__(self, min_size: QSize, log_handlers: [StreamHandler],
                 lang: LangEnum):
        self._logger = getLogger(__name__)
        for h in log_handlers:
            self._logger.addHandler(h)
        self._logger.debug("Initializing")
        super().__init__()
        self._icon = QIcon(image_file_path + "rs_icon.png")
        font = QFont()
        font.setPointSize(10)
        self.setFont(font)
        self.setMinimumSize(min_size)
        self.setWindowIcon(self._icon)
        self.setCentralWidget(CentralWidget(self))

        self._control_frame = QFrame(self)
        self._control_frame.setFrameShape(QFrame.NoFrame)
        self._control_layout = QHBoxLayout(self._control_frame)
        self._splitter = QSplitter(Qt.Vertical, self)
        # self.centralWidget().layout().addLayout(self._control_layout)
        self.centralWidget().layout().addWidget(self._splitter)
        self._splitter.addWidget(self._control_frame)

        self.close_check = False
        self._checker = QMessageBox()
        self._close_callback = None
        self._help_window = None

        self._strings = dict()
        self.set_lang(lang)
        self._setup_checker_buttons()
        self._restore_window()
        self._logger.debug("Initialized")
Ejemplo n.º 29
0
    def _init_load_options_tab(self, tab):

        # load debug symbols
        load_debug_info = QCheckBox()
        load_debug_info.setText("Load debug information if available")
        load_debug_info.setChecked(True)
        self.option_widgets['load_debug_info'] = load_debug_info

        # auto load libs

        auto_load_libs = QCheckBox()
        auto_load_libs.setText("Automatically load all libraries")
        auto_load_libs.setChecked(False)
        self.option_widgets['auto_load_libs'] = auto_load_libs

        # dependencies list

        dep_group = QGroupBox("Dependencies")
        dep_list = QListWidget()
        self.option_widgets['dep_list'] = dep_list

        sublayout = QVBoxLayout()
        sublayout.addWidget(dep_list)
        dep_group.setLayout(sublayout)

        layout = QVBoxLayout()
        layout.addWidget(load_debug_info)
        layout.addWidget(auto_load_libs)
        layout.addWidget(dep_group)
        layout.addStretch(0)

        frame = QFrame(self)
        frame.setLayout(layout)
        tab.addTab(frame, "Loading Options")
Ejemplo n.º 30
0
    def layouts(self):
        self.mainLayout = QVBoxLayout()
        self.topLayout = QHBoxLayout()
        self.bottomLayout = QFormLayout()
        # Put elements into frames for visual distinction
        self.topFrame = QFrame()
        self.bottomFrame = QFrame()

        # Add widgets to top layout
        self.topLayout.addWidget(self.addFacilityImg)
        self.topLayout.addWidget(self.titleText)

        self.topFrame.setLayout(self.topLayout)

        # Add widgets to middle layout
        self.bottomLayout.addWidget(self.facilityInfoTitleText)
        self.bottomLayout.addRow(QLabel("Facility name: "),
                                 self.facilityNameEntry)
        self.bottomLayout.addRow(QLabel("Location: "),
                                 self.facilityLocationEntry)
        self.bottomLayout.addRow(QLabel("Phone: "), self.facilityPhoneEntry)
        self.bottomLayout.addRow(QLabel("Email: "), self.facilityEmailEntry)
        self.bottomLayout.addRow(QLabel("Facility supervisor: "),
                                 self.facilitySupervisorEntry)
        self.bottomLayout.addRow(QLabel(""), self.attachPhotoBtn)
        self.bottomLayout.addRow(QLabel(""), self.addFacilityBtn)

        self.bottomFrame.setLayout(self.bottomLayout)

        # Add frames to main layout
        self.mainLayout.addWidget(self.topFrame)
        self.mainLayout.addWidget(self.bottomFrame)

        self.setLayout(self.mainLayout)