Exemplo n.º 1
0
    def __init__(self, params):
        IWB.__init__(self, params)
        QWidget.__init__(self)

        self.setStyleSheet(
            self.parent_node_instance.session_stylesheet() + '''
        QWidget {
            background: transparent;
        }
        QRadioButton {
            color: ''' +
            self.parent_node_instance.parent_node.color.lighter().name() + ''';
        }
        ''')

        self.units = 'kelvin'

        layout = QVBoxLayout()
        self.units_kelvin = QRadioButton('Kelvin')
        self.units_kelvin.setChecked(True)
        self.units_kelvin.toggled.connect(M(self.set_units_kelvin))
        layout.addWidget(self.units_kelvin)
        self.units_celsius = QRadioButton('Celsius')
        self.units_celsius.toggled.connect(M(self.set_units_celsius))
        layout.addWidget(self.units_celsius)
        self.units_fahrenheit = QRadioButton('Fahrenheit')
        self.units_fahrenheit.toggled.connect(M(self.set_units_fahrenheit))
        layout.addWidget(self.units_fahrenheit)
        self.setLayout(layout)

        self.radio_buttons = [
            self.units_kelvin, self.units_celsius, self.units_fahrenheit
        ]
 def __init__(self, config: ConfigFactory, logger: LoggerFactory, title: str, languages: list):
     super(ChoiceLanguageDialog, self).__init__()
     self.config = config
     self.logger = logger
     self.setWindowTitle(title)
     self.setModal(True)
     self.setWindowFlag(Qt.WindowContextHelpButtonHint, False)
     self.languages = languages
     self.choice_language_button_group = QButtonGroup()
     self.choice_language_button_group.setExclusive(True)
     layout = QVBoxLayout()
     for language_id, language in enumerate(languages):
         # 显示语言提示
         language_item = QRadioButton(language.split(':')[0])
         self.choice_language_button_group.addButton(language_item)
         self.choice_language_button_group.setId(language_item, language_id)
         if language_id == 0:
             language_item.setChecked(True)
             self.language_id = 0
         layout.addWidget(language_item)
     self.choice_language_button_group.buttonClicked.connect(self.language_change)
     self.buttons = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self)
     self.buttons.accepted.connect(self.accept)
     self.buttons.rejected.connect(self.reject)
     layout.addWidget(self.buttons)
     self.setLayout(layout)
        def __init__(self, parent=None):
            super().__init__(parent=parent)

            layout = QFormLayout()
            self.setLayout(layout)

            self.vector = QLineEdit()
            self.vector.setPlaceholderText("Fp1=1;Cz=-1;...")
            self.vector.editingFinished.connect(self.updateModel)

            self.vector_path = PathEdit()
            dialog = QFileDialog(self, "Open")
            dialog.setFileMode(dialog.AnyFile)
            self.vector_path.setDialog(dialog)
            self.vector_path.pathChanged.connect(self.updateModel)

            # Vector data can be contained in a file or inputted directly from a file
            self.vector_radio_button = QRadioButton("Filter vector")
            self.vector_radio_button.toggled.connect(self.vector.setEnabled)
            self.vector_radio_button.clicked.connect(self.updateModel)
            self.vector_path_radio_button = QRadioButton("Filter vector file")
            self.vector_path_radio_button.toggled.connect(self.vector_path.setEnabled)
            self.vector_path_radio_button.clicked.connect(self.updateModel)

            layout.addRow(self.vector_radio_button, self.vector)
            layout.addRow(self.vector_path_radio_button, self.vector_path)

            self.vector_radio_button.setChecked(True)
            self.vector_path.setEnabled(False)
class PrimaryMonitorSelect(QWidget):
    def __init__(self, parent):
        super(PrimaryMonitorSelect, self).__init__()
        self.parent = parent
        self.layout = QHBoxLayout()
        self.layout.setAlignment(Qt.AlignCenter)
        self.setLayout(self.layout)
        self.label = QLabel("Primary Monitor:")
        self.layout.addWidget(self.label)
        self.radio_buttons_setup()

    def radio_buttons_setup(self):
        self.leftRadioButton = QRadioButton("Left")
        self.leftRadioButton.toggled.connect(self.handle_toggled)
        self.rightRadioButton = QRadioButton("Right")
        self.rightRadioButton.toggled.connect(self.handle_toggled)
        if defaultSettings.list[2][1] == "True":
            self.leftRadioButton.setChecked(True)
        else:
            self.rightRadioButton.setChecked(True)
        self.layout.addWidget(self.leftRadioButton)
        self.layout.addWidget(self.rightRadioButton)

    def handle_toggled(self):
        defaultSettings.list[2][1] = str(self.leftRadioButton.isChecked())
        defaultSettings.write()
    def __init__(self, config: ConfigFactory, logger: LoggerFactory,
                 title: str, surpacs: list):
        super(ChoiceSurpacDialog, self).__init__()
        self.config = config
        self.logger = logger

        self.setWindowTitle(title)
        self.setModal(True)
        self.setWindowFlag(Qt.WindowContextHelpButtonHint, False)
        self.surpacs = surpacs
        self.choice_surpac_button_group = QButtonGroup()
        self.choice_surpac_button_group.setExclusive(True)
        layout = QVBoxLayout()
        for surpac_id, choice in enumerate(surpacs):
            surpac_item = QRadioButton(choice)
            self.choice_surpac_button_group.addButton(surpac_item)
            self.choice_surpac_button_group.setId(surpac_item, surpac_id)
            if surpac_id == 0:
                surpac_item.setChecked(True)
                self.surpac_id = 0
            layout.addWidget(surpac_item)
        self.choice_surpac_button_group.buttonClicked.connect(
            self.choice_surpac_change)
        self.buttons = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self)
        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)
        layout.addWidget(self.buttons)
        self.setLayout(layout)
Exemplo n.º 6
0
 def create_history_item(self, node):
     button = QRadioButton(self.layout_history_content)
     button.toggled.connect(self.on_select_node)
     button.setText(node)
     self.layout_history_content_layout.addWidget(button)
     self._history_items.append(button)
     return button
Exemplo n.º 7
0
    def __init__(self, parent=None):
        super().__init__(parent)
        self.parent = parent
        self.lca_scores_widget = LCAScoresTab(parent)
        self.lca_overview_widget = LCIAResultsTab(parent)

        self.layout.setAlignment(QtCore.Qt.AlignTop)
        self.layout.addLayout(get_header_layout('LCA Results'))

        # buttons
        button_layout = QHBoxLayout()
        self.button_group = QButtonGroup()
        self.button_overview = QRadioButton("Overview")
        self.button_overview.setToolTip(
            "Show a matrix of all functional units and all impact categories")
        button_layout.addWidget(self.button_overview)
        self.button_by_method = QRadioButton("by LCIA method")
        self.button_by_method.setToolTip(
            "Show the impacts of each functional unit for the selected impact categories"
        )
        self.button_by_method.setChecked(True)
        self.scenario_label = QLabel("Scenario:")
        self.button_group.addButton(self.button_overview, 0)
        self.button_group.addButton(self.button_by_method, 1)
        button_layout.addWidget(self.button_by_method)
        button_layout.addWidget(self.scenario_label)
        button_layout.addWidget(self.scenario_box)
        button_layout.addStretch(1)
        self.layout.addLayout(button_layout)

        self.layout.addWidget(self.lca_scores_widget)
        self.layout.addWidget(self.lca_overview_widget)

        self.button_clicked(False)
        self.connect_signals()
Exemplo n.º 8
0
    def init_ui(self):
        # self.setFixedWidth(500)
        self.setWindowTitle(_('Teamwork'))
        # self.setWindowIcon(QIcon(icon_dir('sportident.png')))
        self.setSizeGripEnabled(False)
        self.setModal(True)

        self.tab_widget = QTabWidget()

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

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

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

        def cancel_changes():
            self.close()

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

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

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

        self.set_values_from_model()

        self.show()
Exemplo n.º 9
0
    def _create_switch(self, box, layout, col, labels):
        if labels is None:
            return None

        l = QLabel(labels[0], box)
        l.setMinimumHeight(20)
        l.setAlignment(Qt.AlignCenter | Qt.AlignBottom)

        font = l.font()
        font.setPointSize(7)
        font.setBold(True)
        l.setFont(font)
        layout.addWidget(l, 3, col, Qt.AlignBottom | Qt.AlignCenter)

        r1 = QRadioButton(box)
        r1.setStyleSheet(
            'QRadioButton::indicator{subcontrol-position:center;}')
        layout.addWidget(r1, 4, col, Qt.AlignCenter)

        r2 = QRadioButton(box)
        r2.setStyleSheet(
            'QRadioButton::indicator{subcontrol-position:center;}')
        layout.addWidget(r2, 5, col, Qt.AlignCenter)

        l = QLabel(labels[1], box)
        l.setAlignment(Qt.AlignCenter)
        l.setFont(font)
        layout.addWidget(l, 6, col, Qt.AlignTop | Qt.AlignCenter)

        g = QButtonGroup(box)
        g.addButton(r1)
        g.addButton(r2)
        r1.setChecked(True)

        return r2
Exemplo n.º 10
0
    def __init__(self,parent=None):
        QWidget.__init__(self,parent)
        self.setWindowTitle('Button Demo')

        self.button = QPushButton('&Ok',self)
        self.button.clicked.connect(self.okButtonClicked)

        self.checkBox = QCheckBox('&Case sensitivity',self)
        self.checkBox.toggled.connect(self.onCaseSensitivity)

        box = QGroupBox("Sex",self)

        self.button1 = QRadioButton("Male",box)
        self.button2 = QRadioButton("Female",box)
        self.button1.setChecked(True)

        groupBoxLayout = QVBoxLayout(box)
        groupBoxLayout.addWidget(self.button1)
        groupBoxLayout.addWidget(self.button2)
        self.button1.toggled.connect(self.onMale)

        mainlayout = QVBoxLayout()
        mainlayout.addWidget(self.button)
        mainlayout.addWidget(self.checkBox)
        mainlayout.addWidget(box)

        self.setLayout(mainlayout)
Exemplo n.º 11
0
    def __init__(self, parent, **kwargs):
        super().__init__(parent)
        self.cutoff_menu = CutoffMenu(self, cutoff_value=0.05)
        self.combobox_menu = Combobox(
            func=QComboBox(self),
            func_label=QLabel("Functional Unit:"),
            method=QComboBox(self),
            method_label=QLabel("Impact Category:"),
            agg=QComboBox(self),
            agg_label=QLabel("Aggregate by:"),
            scenario=self.scenario_box,
            scenario_label=QLabel("Scenario:"),
        )
        self.switch_label = QLabel("Compare:")
        self.switches = SwitchComboBox(self)

        self.relativity = Relativity(
            QRadioButton("Relative"),
            QRadioButton("Absolute"),
        )
        self.relativity.relative.setChecked(True)
        self.relative = True
        self.relativity.relative.setToolTip(
            "Show relative values (compare fraction of each contribution)")
        self.relativity.absolute.setToolTip(
            "Show absolute values (compare magnitudes of each contribution)")

        self.df = None
        self.plot = ContributionPlot()
        self.table = ContributionTable(self)
        self.contribution_fn = None
        self.has_method, self.has_func = False, False
        self.unit = None
Exemplo n.º 12
0
    def __init__(self, parent_port_instance, parent_node_instance):
        super(%CLASS%, self).__init__()

        # leave these lines ------------------------------
        self.parent_port_instance = parent_port_instance
        self.parent_node_instance = parent_node_instance
        # ------------------------------------------------

        self.setStyleSheet(self.parent_node_instance.get_default_stylesheet()+'''
        QWidget {
            background: transparent;
        }
        QRadioButton {
            color: '''+self.parent_node_instance.parent_node.color.lighter().name()+''';
        }
        ''')

        self.units = 'kelvin'
        
        layout = QVBoxLayout()
        self.units_kelvin = QRadioButton('Kelvin')
        self.units_kelvin.setChecked(True)
        self.units_kelvin.toggled.connect(M(self.set_units_kelvin))
        layout.addWidget(self.units_kelvin)
        self.units_celsius = QRadioButton('Celsius')
        self.units_celsius.toggled.connect(M(self.set_units_celsius))
        layout.addWidget(self.units_celsius)
        self.units_fahrenheit = QRadioButton('Fahrenheit')
        self.units_fahrenheit.toggled.connect(M(self.set_units_fahrenheit))
        layout.addWidget(self.units_fahrenheit)
        self.setLayout(layout)
    
        self.radio_buttons = [self.units_kelvin, self.units_celsius, self.units_fahrenheit]
Exemplo n.º 13
0
    def __init__(self, parent=None):
        super().__init__(parent)
        self.df_biosphere = None
        self.df_technosphere = None

        self.layout.addLayout(get_header_layout('Inventory'))

        # buttons
        button_layout = QHBoxLayout()
        self.radio_button_biosphere = QRadioButton("Biosphere flows")
        self.radio_button_biosphere.setChecked(True)
        button_layout.addWidget(self.radio_button_biosphere)
        self.radio_button_technosphere = QRadioButton("Technosphere flows")
        self.scenario_label = QLabel("Scenario:")
        button_layout.addWidget(self.radio_button_technosphere)
        button_layout.addWidget(self.scenario_label)
        button_layout.addWidget(self.scenario_box)
        button_layout.addStretch(1)
        self.layout.addLayout(button_layout)

        # table
        self.table = InventoryTable(self.parent)
        self.table.table_name = 'Inventory_' + self.parent.cs_name
        self.layout.addWidget(self.table)

        self.layout.addLayout(self.build_export(has_plot=False,
                                                has_table=True))
        self.connect_signals()
Exemplo n.º 14
0
 def stack_2_UI(self):
     layout = QFormLayout()
     sex = QHBoxLayout()
     sex.addWidget(QRadioButton("Male"))
     sex.addWidget(QRadioButton("Female"))
     layout.addRow(QLabel("Sex"), sex)
     layout.addRow("Date of Birth", QLineEdit())
     self.stack_2.setLayout(layout)
Exemplo n.º 15
0
    def __set_fuzzy_set_operation_types_ui(self):
        group_box = QGroupBox("Tipe Operasi Fuzzy")
        inner_layout = QFormLayout()
        group_box.setLayout(inner_layout)

        self.implication_selections = RadioButtonSet([
            #("imp_dr", QRadioButton("Dienes-Rescher")),
            #("imp_l", QRadioButton("Lukasieweicz")),
            #("imp_z", QRadioButton("Zadel")),
            #("imp_g", QRadioButton("Godel")),
            ("imp_m", QRadioButton("Mamdani")),
            #("imp_p", QRadioButton("Product"))
        ])
        self.combination_vars_selections = RadioButtonSet([
            ("tn_min", QRadioButton("Minimum")),
            #("tn_ap", QRadioButton("Algebraic Product")),
            #("tn_bp", QRadioButton("Bounded Product")),
            #("tn_dp", QRadioButton("Drastic Product"))
        ])
        self.combination_rules_selections = RadioButtonSet([
            ("tc_max", QRadioButton("Maximum")),
            #("tc_as", QRadioButton("Algebraic Sum")),
            #("tc_bs", QRadioButton("Bounded Sum")),
            #("tc_ds", QRadioButton("Drastic Sum"))
        ])
        self.defuzzifier_selections = RadioButtonSet([
            ("gravity_center", QRadioButton("Titik Tengah")),
            #("maxima_mean", QRadioButton("Mean of Maxima")),
            #("modified_maxima_mean", QRadioButton("Modified Mean of Maxima"))
        ])

        self.implication_selections.set_selected('imp_m')
        self.combination_vars_selections.set_selected('tn_min')
        self.combination_rules_selections.set_selected('tc_max')
        self.defuzzifier_selections.set_selected('gravity_center')

        self.implication_selections.setStatusTip("Choose the method for fuzzy "
                                                 "implication.")
        self.combination_vars_selections.setStatusTip(
            "Choose the method of "
            "combination of multiple "
            "fuzzy variables.")
        self.combination_rules_selections.setStatusTip("Choose the method of "
                                                       "combination of "
                                                       "multiple fuzzy rules.")
        self.defuzzifier_selections.setStatusTip("Choose the method for the "
                                                 "defuzifier.")

        inner_layout.addRow(QLabel("Metoda Fuzzy:"),
                            self.implication_selections)
        inner_layout.addRow(QLabel("Kombinasi Variable:"),
                            self.combination_vars_selections)
        inner_layout.addRow(QLabel("Kombinasi Rule:"),
                            self.combination_rules_selections)
        inner_layout.addRow(QLabel("Defuzifikasi:"),
                            self.defuzzifier_selections)

        self.__layout.addWidget(group_box)
Exemplo n.º 16
0
 def test_creation_of_destinations_radio_box(self):
     destinations = {
         'dest1': QRadioButton('Destination 1'),
         'dest2': QRadioButton('Destination 2'),
         'dest3': QRadioButton('Destination 3')
     }
     radio_box = qt.DestinationRadioBox(destinations)
     self.assertEqual(len(radio_box.b_group.buttons()), 3)
     for item in destinations.values():
         self.assertIn(item, radio_box.children())
Exemplo n.º 17
0
 def __init__(self, buttons, index, parent=None):
     QVBoxLayout.__init__(self)
     self.setSpacing(0)
     self.group = QButtonGroup()
     for i, button in enumerate(buttons):
         btn = QRadioButton(button)
         if i == index:
             btn.setChecked(True)
         self.addWidget(btn)
         self.group.addButton(btn, i)
 def radio_buttons_setup(self):
     self.leftRadioButton = QRadioButton("Left")
     self.leftRadioButton.toggled.connect(self.handle_toggled)
     self.rightRadioButton = QRadioButton("Right")
     self.rightRadioButton.toggled.connect(self.handle_toggled)
     if defaultSettings.list[2][1] == "True":
         self.leftRadioButton.setChecked(True)
     else:
         self.rightRadioButton.setChecked(True)
     self.layout.addWidget(self.leftRadioButton)
     self.layout.addWidget(self.rightRadioButton)
    def __init__(self):
        super(InputsLayout, self).__init__()
        self.big_font = QFont()
        self.medium_font = QFont()
        self.header = QLabel()
        self.header_general = QLabel()
        self.header_fitness_remapping = QLabel()
        self.header_stop = QLabel()
        self.header_selection = QLabel()
        self.header_pairing = QLabel()
        self.header_crossover = QLabel()
        self.header_mutation = QLabel()

        self.inp_functions_combo = QComboBox()
        self.inp_num_variables = QSpinBox()
        self.inp_extrema_min = QRadioButton("Minimum")
        self.inp_extrema_max = QRadioButton("Maximum")
        self.inp_pop_size = QSpinBox()
        self.inp_lower_bound = QDoubleSpinBox()
        self.inp_upper_bound = QDoubleSpinBox()
        # Stopping
        self.inp_max_iter = QSpinBox()
        self.inp_similarity_cb = QCheckBox()
        self.inp_similarity = QSpinBox()
        self.inp_best_result_cb = QCheckBox()
        self.inp_best_result = QDoubleSpinBox()
        self.inp_average_result_cb = QCheckBox()
        self.inp_average_result = QDoubleSpinBox()
        # Fitness remapping
        self.inp_fitness_remapping = QComboBox()
        # Selection
        self.inp_selection_method = QComboBox()
        self.inp_elitism = QDoubleSpinBox()
        # Pairing
        self.inp_pairing_method = QComboBox()
        # Crossover
        self.inp_crossover_method = QComboBox()
        self.inp_crossover_fraction = QDoubleSpinBox()
        self.intermediate_offset = QDoubleSpinBox()
        # Mutation
        self.inp_mutation_method = QComboBox()
        self.inp_mutation_intensity = QDoubleSpinBox()
        self.inp_mutation_intensity_final = QDoubleSpinBox()

        self.init_fonts()
        self.init_header()
        self.init_row_functions()
        self.init_row_general()
        self.init_row_fitness_remapping()
        self.init_row_stop()
        self.init_row_selection()
        self.init_row_pairing()
        self.init_row_crossover()
        self.init_row_mutation()
    def __init__(self, *args, **kwargs):
        super(IntroductionPage, self).__init__(*args, **kwargs)

        # ____COMBO BOX____
        self.radioButtonsContent = QGroupBox('new auction OR load auction')
        self.radioButtonNew = QRadioButton('new')
        self.radioButtonLoad = QRadioButton('load')

        self.radioHBox = QHBoxLayout()
        self.radioHBox.addWidget(self.radioButtonNew, 0)
        self.radioHBox.addWidget(self.radioButtonLoad, 1)
        self.radioButtonsContent.setLayout(self.radioHBox)

        self.radioButtonNew.toggled
        self.radioButtonNew.toggled.connect(self.changeViewFromRadio)

        # ___________________SELECT NUMBER OF CONTENDER_________________________

        self.newViewContent = QGroupBox('new auction:')
        self.newViewContent.setVisible(False)
        self.titleNumberOfContenders = QLabel('Select number of contenders')
        self.numberOfContenders = QComboBox()
        self.numberOfContenders.addItems([
            '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'
        ])

        self.newViewBoxLayout = QHBoxLayout()
        self.newViewBoxLayout.addWidget(self.titleNumberOfContenders, 0)
        self.newViewBoxLayout.addWidget(self.numberOfContenders, 1)
        self.newViewContent.setLayout(self.newViewBoxLayout)

        self.registerField("contenderCount*", self.numberOfContenders)

        # ___________________LOAD DATA_________________________

        self.loadViewContent = QGroupBox('Load data:')
        self.loadViewContent.setVisible(False)
        self.titleLoadData = QLabel("Select folder with save")
        self.loadButton = QPushButton()
        self.loadButton.setText("search saved file")

        self.loadViewBoxLayout = QVBoxLayout()
        self.loadViewBoxLayout.addWidget(self.titleLoadData)
        self.loadViewBoxLayout.addWidget(self.loadButton)
        self.loadViewContent.setLayout(self.loadViewBoxLayout)

        # ___Add Elements to layout___
        self.layout = QVBoxLayout()
        self.layout.addWidget(self.radioButtonsContent)
        self.layout.addWidget(self.newViewContent)
        self.layout.addWidget(self.loadViewContent)

        self.setLayout(self.layout)
Exemplo n.º 21
0
 def widgetSetup(self, themode):  # based on which main button is pressed
     self.themode = themode  # this is set when a main button is pressed, or on initial load
     self.emptyConvLayout(
     )  # get rid of old radio buttons if they exist, hide input/output, etc.
     thetext, thestyle = makeHeader1(
         themode, self.uiFileName)  # make heading for convType = themode
     self.header1.setStyleSheet(
         thestyle)  # can have different background colors
     self.header1.setText(thetext)
     self.header1.show()
     self.hideBigInstructions()
     if themode in self.convs.getValidConvTypes(
     ):  # set up radio buttons for conversions
         oneConvTypeInfo = self.convs.convTypeToConvInfo(
             themode)  # get convCodes, displays for this convType
         for ix, (convCode, convDisplay) in enumerate(
                 oneConvTypeInfo
         ):  # iterate through enumerated list of tuples
             self.oneRadio = QRadioButton(
                 "{}".format(convDisplay))  # text for button
             self.oneRadio.setObjectName("object_{}".format(
                 convCode))  # to be used later by sender()
             self.oneRadio.setStyleSheet(
                 makeStyleSheet("radiobutton", self.uiFileName))
             self.layoutConv.addWidget(self.oneRadio)
             self.oneRadio.clicked.connect(
                 self.convSetup
             )  # convSetup will call sender() to find convCode
             if ix == 0:
                 self.oneRadio.setFocus(
                 )  # set focus on first button in list
     if themode == "fromjpyear":  # set up radio buttons for modern eras
         self.fromjpyearmode = "modern"  # start with modern eras only
         self.showJpEras()
     if themode == "fromjpyearhistoric":  # set up radio buttons for all eras
         self.fromjpyearmode = "all"  # start with modern eras only
         self.showJpEras()
     if themode == "tojpyear":  # no choices, go straight to input box
         self.showInstructions(self.mess.getToJpYear(self.yc.getMinYear()),
                               "")
         self.input1.setText(str(
             self.yc.getNowYear()))  # start with current year
         self.setUpValidator()
         self.convertUnits()
     if themode == "zodiac":  # no choices, go straight to input box
         self.showInstructions(self.mess.getEnterYearZodiac(), "")
         self.input1.setText(str(
             self.yc.getNowYear()))  # start with current year
         self.setUpValidator()
         self.convertUnits()
     if themode == "start":
         self.btnFromMetric.setFocus()
         self.showBigInstructions(self.mess.getStartMsg2())
Exemplo n.º 22
0
 def load_available(self):
     self.ava_table.setRowCount(0)
     self.ava_table.clearContents()
     for name, info in G.config.DB_INFO.items():
         self.ava_table.insertRow(0)
         self.ava_table.setItem(0, 0, QTableWidgetItem(name))
         radio = QRadioButton(self)
         self.btn_group.addButton(radio)
         radio.clicked.connect(self.radio_slot)
         if name == G.config.WHICH_DB:
             radio.setChecked(True)
         self.ava_table.setCellWidget(0, 1, radio)
Exemplo n.º 23
0
    def __init__(self, lien):
        QWidget.__init__(self)
        self.setFixedWidth(340)

        self.__restriction = QIntValidator()
        self.precision = 0
        self.masse = 0
        self.rho = 1000
        self.__label_title = QLabel('''Tirant d'Eau''')
        self.__label_title.setAlignment(QtCore.Qt.AlignCenter
                                        | QtCore.Qt.AlignVCenter)
        A = QFont("DIN Condensed", 45)
        self.__label_title.setFixedHeight(100)

        self.__label_title.setFont(A)
        self.layout = QGridLayout()
        self.button_compute = QPushButton('Compute')
        self.button_compute.sizeHint()
        self.__label_precision = QLabel('Tolérance')
        self.__label_precision.setAlignment(QtCore.Qt.AlignCenter
                                            | QtCore.Qt.AlignVCenter)
        self.text_precision = QLineEdit()
        self.__label_poids = QLabel('Masse (kg)')
        self.__label_poids.setAlignment(QtCore.Qt.AlignCenter
                                        | QtCore.Qt.AlignVCenter)
        self.text_poids = QLineEdit()
        self.text_poids.setValidator(self.__restriction)

        self.text_precision.textChanged.connect(self.l1)
        self.text_poids.textChanged.connect(self.l2)

        self.eau_de_mer = QRadioButton('''Eau De Mer''')
        self.eau_de_mer.setChecked(True)
        self.eau_douce = QRadioButton('''Eau Douce''')

        A = QFont("DIN Condensed", 20)
        self.__label_LCD = QLabel('''Tirant d'eau (m)''')
        self.__label_LCD.setAlignment(QtCore.Qt.AlignCenter
                                      | QtCore.Qt.AlignVCenter)
        self.__label_LCD.setFont(A)
        self.LCD = QLCDNumber()
        '''Association Layout'''
        self.layout.addWidget(self.__label_title, 0, 0, 1, 0)
        self.layout.addWidget(self.__label_precision, 2, 0, 1, 0)
        self.layout.addWidget(self.text_precision, 3, 0, 1, 0)
        self.layout.addWidget(self.__label_poids, 4, 0, 1, 0)
        self.layout.addWidget(self.text_poids, 5, 0, 1, 0)
        self.layout.addWidget(self.eau_de_mer, 8, 0)
        self.layout.addWidget(self.eau_douce, 8, 1)
        self.layout.addWidget(self.button_compute, 9, 0, 1, 0)
        self.layout.addWidget(self.__label_LCD, 11, 0, 1, 0)
        self.layout.addWidget(self.LCD, 12, 0, 1, 0)
        self.setLayout(self.layout)
Exemplo n.º 24
0
    def init_ui(self):
        self.setWindowTitle(_('Scores assign'))
        self.setWindowIcon(QIcon(config.ICON))
        self.setSizeGripEnabled(False)
        self.setModal(False)
        self.setMinimumWidth(650)

        self.layout = QFormLayout(self)

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

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

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

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

        def cancel_changes():
            self.close()

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

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

        self.show()
Exemplo n.º 25
0
    def _init_widgets(self):
        layout = QGridLayout()
        self.main_layout.addLayout(layout)
        self._status_label = QLabel(self)

        row = 0
        layout.addWidget(QLabel('Break on:', self), row, 0, Qt.AlignRight)
        self._type_radio_group = QButtonGroup(self)
        self._type_radio_group.addButton(QRadioButton('Execute', self),
                                         BreakpointType.Execute.value)
        self._type_radio_group.addButton(QRadioButton('Write', self),
                                         BreakpointType.Write.value)
        self._type_radio_group.addButton(QRadioButton('Read', self),
                                         BreakpointType.Read.value)
        for b in self._type_radio_group.buttons():
            layout.addWidget(b, row, 1)
            row += 1

        self._type_radio_group.button(
            self.breakpoint.type.value).setChecked(True)

        layout.addWidget(QLabel('Address:', self), row, 0, Qt.AlignRight)
        self._address_box = QAddressInput(self._on_address_changed,
                                          self.workspace,
                                          parent=self,
                                          default=f'{self.breakpoint.addr:#x}')
        layout.addWidget(self._address_box, row, 1)
        row += 1

        layout.addWidget(QLabel('Size:', self), row, 0, Qt.AlignRight)
        self._size_box = QLineEdit(self)
        self._size_box.setText(f'{self.breakpoint.size:#x}')
        self._size_box.textChanged.connect(self._on_size_changed)
        layout.addWidget(self._size_box, row, 1)
        row += 1

        layout.addWidget(QLabel('Comment:', self), row, 0, Qt.AlignRight)
        self._comment_box = QLineEdit(self)
        self._comment_box.setText(self.breakpoint.comment)
        layout.addWidget(self._comment_box, row, 1)
        row += 1

        self.main_layout.addWidget(self._status_label)

        buttons = QDialogButtonBox(parent=self)
        buttons.setStandardButtons(QDialogButtonBox.StandardButton.Cancel
                                   | QDialogButtonBox.StandardButton.Ok)
        buttons.accepted.connect(self._on_ok_clicked)
        buttons.rejected.connect(self.close)
        self._ok_button = buttons.button(QDialogButtonBox.Ok)
        self._ok_button.setEnabled(False)
        self.main_layout.addWidget(buttons)
Exemplo n.º 26
0
    def _setup_ui(self):
        self.setFrameStyle(QFrame.StyledPanel | QFrame.Raised)

        # Set up our basic layout
        layout = QGridLayout(self)
        self.setLayout(layout)
        layout.setSpacing(1)
        layout.setMargin(1)

        for bank in range(0o10):
            sw = self._create_bank_switch('E%o' % bank, layout, 0, bank, 1)
            sw.stateChanged.connect(self._update_ems_banks)
            self._bank_switches.append(sw)

        for col in range(0o10, 0o22):
            s = QSpacerItem(20, 20)
            layout.addItem(s, 1, col)

        label = QLabel('EMS', self)
        font = label.font()
        font.setPointSize(12)
        font.setBold(True)
        label.setFont(font)
        label.setAlignment(Qt.AlignCenter)
        layout.addWidget(label, 5, 16, 2, 2, Qt.AlignCenter)

        b = self._create_button('ALL', layout, 5, 1, 3)
        b.pressed.connect(lambda: self._set_all(True))
        b = self._create_button('NONE', layout, 5, 3, 2)
        b.pressed.connect(lambda: self._set_all(False))

        self._ems_sel = QRadioButton('EMS', self)
        self._ems_sel.setLayoutDirection(Qt.RightToLeft)
        layout.addWidget(self._ems_sel, 5, 6, 2, 3)
        layout.setAlignment(self._ems_sel, Qt.AlignRight)

        self._agc_sel = QRadioButton('AGC', self)
        self._agc_sel.setChecked(True)
        layout.addWidget(self._agc_sel, 5, 8, 2, 3)
        layout.setAlignment(self._agc_sel, Qt.AlignCenter)

        font.setPointSize(7)
        self._ems_sel.setFont(font)
        self._agc_sel.setFont(font)

        b = self._create_button('PAD', layout, 5, 11, 2)
        b.pressed.connect(self._load_pad)
        b = self._create_button('LOAD', layout, 5, 12, 3)
        b.pressed.connect(self._load_core)
        b = self._create_button('DUMP', layout, 5, 14, 2)
        b.pressed.connect(self._dump_core)
Exemplo n.º 27
0
    def _setup_ui(self):
        self.setFrameStyle(QFrame.StyledPanel | QFrame.Raised)

        # Set up our basic layout
        layout = QGridLayout(self)
        self.setLayout(layout)
        layout.setSpacing(1)
        layout.setMargin(1)

        for bank in range(0o44):
            col = bank % 18
            row = int(bank / 18) * 2
            sw = self._create_bank_switch('%o' % bank, layout, row, col, 1)
            sw.stateChanged.connect(
                lambda state, bank=bank: self._update_crs_bank(bank))
            self._bank_switches.append(sw)

        self._aux_switch = self._create_bank_switch('44-77', layout, 5, 0, 2)

        label = QLabel('CRS', self)
        font = label.font()
        font.setPointSize(12)
        font.setBold(True)
        label.setFont(font)
        label.setAlignment(Qt.AlignCenter)
        layout.addWidget(label, 5, 16, 2, 2, Qt.AlignCenter)

        b = self._create_button('ALL', layout, 5, 1, 3)
        b.pressed.connect(lambda: self._set_all(True))
        b = self._create_button('NONE', layout, 5, 3, 2)
        b.pressed.connect(lambda: self._set_all(False))

        self._crs_sel = QRadioButton('CRS', self)
        self._crs_sel.setLayoutDirection(Qt.RightToLeft)
        layout.addWidget(self._crs_sel, 5, 6, 2, 3)
        layout.setAlignment(self._crs_sel, Qt.AlignRight)

        self._agc_sel = QRadioButton('AGC', self)
        self._agc_sel.setChecked(True)
        layout.addWidget(self._agc_sel, 5, 8, 2, 3)
        layout.setAlignment(self._agc_sel, Qt.AlignCenter)

        font.setPointSize(7)
        self._crs_sel.setFont(font)
        self._agc_sel.setFont(font)

        b = self._create_button('LOAD', layout, 5, 12, 3)
        b.pressed.connect(self._load_rope)
        b = self._create_button('DUMP', layout, 5, 14, 2)
        b.pressed.connect(self._dump_rope)
Exemplo n.º 28
0
    def make_radio_box(self, chk_default):
        radio_layout = QVBoxLayout()

        for key in self.target_dict:
            button_key = QRadioButton(key, self)
            button_key.clicked.connect(self.radiobox_check)
            if key == chk_default:
                button_key.setChecked(True)
                self.result = self.target_dict[key]
            auto_atr = "radio_" + key
            setattr(self, auto_atr, button_key)
            radio_layout.addWidget(button_key)

        return radio_layout
 def set_whittles(self, whittles: list):
     self.whittles = whittles
     for _id, whittle in enumerate(self.whittles):
         whittle_item = QRadioButton(whittle)
         self.start_whittle_button_group.addButton(whittle_item)
         self.start_whittle_button_group.setId(whittle_item, _id)
         if _id == 0:
             whittle_item.setChecked(True)
             self.whittle_id = 0
         self.layout.addWidget(whittle_item)
     self.start_whittle_button_group.buttonClicked.connect(self.start_whittle_change)
     self.buttons.accepted.connect(self.accept)
     self.buttons.rejected.connect(self.reject)
     self.layout.addWidget(self.buttons)
Exemplo n.º 30
0
 def __init__(self, parent, text, lines=1, labelwidth=16, *args, **kwargs):
     super().__init__(parent, *args, **kwargs)
     # Make sure the text is bottom aligned in the specified number of lines
     text = "\n" * (lines - text.count("\n") - 1) + text
     self.label = QLabel(text, self)
     self.label.setFixedWidth(labelwidth)
     self.addWidget(self.label)
     self.layout.addSpacing(3)
     self.switch = QRadioButton(self)
     self.switch.setFixedSize(20, 20)
     self.switch.setStyleSheet(
         'QRadioButton::indicator{ subcontrol-position:center; } QRadioButton { color: #666; }'
     )
     self.addWidget(self.switch)
     self.addStretch()