Python PySide2.QtWidgets.QComboBox() Examples
The following are 30
code examples of PySide2.QtWidgets.QComboBox().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PySide2.QtWidgets
, or try the search function
.
Example #1
Source File: manager.py From hotbox_designer with BSD 3-Clause Clear License | 6 votes |
def __init__(self, parent=None): super(HotboxGeneralSettingWidget, self).__init__(parent) self.setFixedWidth(200) self.name = QtWidgets.QLineEdit() self.name.textEdited.connect(partial(self.optionSet.emit, 'name')) self.submenu = BoolCombo(False) self.submenu.valueSet.connect(partial(self.optionSet.emit, 'submenu')) self.triggering = QtWidgets.QComboBox() self.triggering.addItems(TRIGGERING_TYPES) self.triggering.currentIndexChanged.connect(self._triggering_changed) self.aiming = BoolCombo(False) self.aiming.valueSet.connect(partial(self.optionSet.emit, 'aiming')) self.leaveclose = BoolCombo(False) method = partial(self.optionSet.emit, 'leaveclose') self.leaveclose.valueSet.connect(method) self.open_command = CommandButton('show') self.close_command = CommandButton('hide') self.switch_command = CommandButton('switch') self.layout = QtWidgets.QFormLayout(self) self.layout.setContentsMargins(0, 0, 0, 0) self.layout.setSpacing(0) self.layout.setHorizontalSpacing(5) self.layout.addRow(Title('Options')) self.layout.addItem(QtWidgets.QSpacerItem(0, 8)) self.layout.addRow('name', self.name) self.layout.addItem(QtWidgets.QSpacerItem(0, 8)) self.layout.addRow('is submenu', self.submenu) self.layout.addRow('triggering', self.triggering) self.layout.addRow('aiming', self.aiming) self.layout.addRow('close on leave', self.leaveclose) self.layout.addItem(QtWidgets.QSpacerItem(0, 8)) self.layout.addRow(Title('Commands')) self.layout.addItem(QtWidgets.QSpacerItem(0, 8)) self.layout.addRow(self.open_command) self.layout.addRow(self.close_command) self.layout.addRow(self.switch_command)
Example #2
Source File: logic_settings_window.py From randovania with GNU General Public License v3.0 | 6 votes |
def setup_translators_elements(self): randomizer_data = default_data.decode_randomizer_data() self.translator_randomize_all_button.clicked.connect(self._on_randomize_all_gates_pressed) self.translator_vanilla_actual_button.clicked.connect(self._on_vanilla_actual_gates_pressed) self.translator_vanilla_colors_button.clicked.connect(self._on_vanilla_colors_gates_pressed) self._combo_for_gate = {} for i, gate in enumerate(randomizer_data["TranslatorLocationData"]): label = QLabel(self.translators_scroll_contents) label.setText(gate["Name"]) self.translators_layout.addWidget(label, 3 + i, 0, 1, 1) combo = QComboBox(self.translators_scroll_contents) combo.gate = TranslatorGate(gate["Index"]) for item in LayoutTranslatorRequirement: combo.addItem(item.long_name, item) combo.currentIndexChanged.connect(functools.partial(self._on_gate_combo_box_changed, combo)) self.translators_layout.addWidget(combo, 3 + i, 1, 1, 2) self._combo_for_gate[combo.gate] = combo
Example #3
Source File: universal_tool_template_1112.py From universal_tool_template.py with MIT License | 5 votes |
def setLang(self, langName): lang_data = self.memoData['lang'][langName] for ui_name in lang_data.keys(): if ui_name in self.uiList.keys() and lang_data[ui_name] != '': ui_element = self.uiList[ui_name] # '' means no translation availdanle in that data file if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ): # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox ui_element.setText(lang_data[ui_name]) elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ): # uiType: QMenu, QGroupBox ui_element.setTitle(lang_data[ui_name]) elif isinstance(ui_element, QtWidgets.QTabWidget): # uiType: QTabWidget tabCnt = ui_element.count() tabNameList = lang_data[ui_name].split(';') if len(tabNameList) == tabCnt: for i in range(tabCnt): if tabNameList[i] != '': ui_element.setTabText(i,tabNameList[i]) elif isinstance(ui_element, QtWidgets.QComboBox): # uiType: QComboBox itemCnt = ui_element.count() itemNameList = lang_data[ui_name].split(';') ui_element.clear() ui_element.addItems(itemNameList) elif isinstance(ui_element, QtWidgets.QTreeWidget): # uiType: QTreeWidget labelCnt = ui_element.headerItem().columnCount() labelList = lang_data[ui_name].split(';') ui_element.setHeaderLabels(labelList) elif isinstance(ui_element, QtWidgets.QTableWidget): # uiType: QTableWidget colCnt = ui_element.columnCount() headerList = lang_data[ui_name].split(';') cur_table.setHorizontalHeaderLabels( headerList ) elif isinstance(ui_element, (str, unicode) ): # uiType: string for msg self.uiList[ui_name] = lang_data[ui_name]
Example #4
Source File: attributes.py From hotbox_designer with BSD 3-Clause Clear License | 5 votes |
def __init__(self, parent=None): super(ShapeSettings, self).__init__(parent) self.shape = QtWidgets.QComboBox() self.shape.addItems(SHAPE_TYPES) self.shape.currentIndexChanged.connect(self.shape_changed) self.left = FloatEdit(minimum=0.0) method = partial(self.rectModified.emit, 'shape.left') self.left.valueSet.connect(method) self.top = FloatEdit(minimum=0.0) method = partial(self.rectModified.emit, 'shape.right') self.top.valueSet.connect(method) self.width = FloatEdit(minimum=0.0) method = partial(self.rectModified.emit, 'shape.width') self.width.valueSet.connect(method) self.height = FloatEdit(minimum=0.0) method = partial(self.rectModified.emit, 'shape.height') self.height.valueSet.connect(method) self.layout = QtWidgets.QFormLayout(self) self.layout.setSpacing(0) self.layout.setContentsMargins(0, 0, 0, 0) self.layout.setHorizontalSpacing(5) self.layout.addRow('Shape', self.shape) self.layout.addItem(QtWidgets.QSpacerItem(0, 8)) self.layout.addRow(Title('Dimensions')) self.layout.addRow('left', self.left) self.layout.addRow('top', self.top) self.layout.addRow('width', self.width) self.layout.addRow('height', self.height) for label in self.findChildren(QtWidgets.QLabel): if not isinstance(label, Title): label.setFixedWidth(LEFT_CELL_WIDTH)
Example #5
Source File: universal_tool_template_1100.py From universal_tool_template.py with MIT License | 5 votes |
def setLang(self, langName): lang_data = self.memoData['lang'][langName] for ui_name in lang_data.keys(): if ui_name in self.uiList.keys() and lang_data[ui_name] != '': ui_element = self.uiList[ui_name] # '' means no translation availdanle in that data file if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ): # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox ui_element.setText(lang_data[ui_name]) elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ): # uiType: QMenu, QGroupBox ui_element.setTitle(lang_data[ui_name]) elif isinstance(ui_element, QtWidgets.QTabWidget): # uiType: QTabWidget tabCnt = ui_element.count() tabNameList = lang_data[ui_name].split(';') if len(tabNameList) == tabCnt: for i in range(tabCnt): if tabNameList[i] != '': ui_element.setTabText(i,tabNameList[i]) elif isinstance(ui_element, QtWidgets.QComboBox): # uiType: QComboBox itemCnt = ui_element.count() itemNameList = lang_data[ui_name].split(';') ui_element.clear() ui_element.addItems(itemNameList) elif isinstance(ui_element, QtWidgets.QTreeWidget): # uiType: QTreeWidget labelCnt = ui_element.headerItem().columnCount() labelList = lang_data[ui_name].split(';') ui_element.setHeaderLabels(labelList) elif isinstance(ui_element, QtWidgets.QTableWidget): # uiType: QTableWidget colCnt = ui_element.columnCount() headerList = lang_data[ui_name].split(';') cur_table.setHorizontalHeaderLabels( headerList ) elif isinstance(ui_element, (str, unicode) ): # uiType: string for msg self.uiList[ui_name] = lang_data[ui_name]
Example #6
Source File: universal_tool_template_1110.py From universal_tool_template.py with MIT License | 5 votes |
def setLang(self, langName): lang_data = self.memoData['lang'][langName] for ui_name in lang_data.keys(): if ui_name in self.uiList.keys() and lang_data[ui_name] != '': ui_element = self.uiList[ui_name] # '' means no translation availdanle in that data file if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ): # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox ui_element.setText(lang_data[ui_name]) elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ): # uiType: QMenu, QGroupBox ui_element.setTitle(lang_data[ui_name]) elif isinstance(ui_element, QtWidgets.QTabWidget): # uiType: QTabWidget tabCnt = ui_element.count() tabNameList = lang_data[ui_name].split(';') if len(tabNameList) == tabCnt: for i in range(tabCnt): if tabNameList[i] != '': ui_element.setTabText(i,tabNameList[i]) elif isinstance(ui_element, QtWidgets.QComboBox): # uiType: QComboBox itemCnt = ui_element.count() itemNameList = lang_data[ui_name].split(';') ui_element.clear() ui_element.addItems(itemNameList) elif isinstance(ui_element, QtWidgets.QTreeWidget): # uiType: QTreeWidget labelCnt = ui_element.headerItem().columnCount() labelList = lang_data[ui_name].split(';') ui_element.setHeaderLabels(labelList) elif isinstance(ui_element, QtWidgets.QTableWidget): # uiType: QTableWidget colCnt = ui_element.columnCount() headerList = lang_data[ui_name].split(';') cur_table.setHorizontalHeaderLabels( headerList ) elif isinstance(ui_element, (str, unicode) ): # uiType: string for msg self.uiList[ui_name] = lang_data[ui_name]
Example #7
Source File: universal_tool_template_0803.py From universal_tool_template.py with MIT License | 5 votes |
def qui(self, ui_list_string, parentObject_string='', opt=''): # pre-defined user short name syntax type_dict = { 'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout', 'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget', 'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox', 'txt': 'QTextEdit', 'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget', 'space': 'QSpacerItem', } # get ui_list, creation or existing ui object ui_list = [x.strip() for x in ui_list_string.split('|')] for i in range(len(ui_list)): if ui_list[i] in self.uiList: # - exisiting object ui_list[i] = self.uiList[ui_list[i]] else: # - string creation: # get part info partInfo = ui_list[i].split(';',1) uiName = partInfo[0].split('@')[0] uiType = uiName.rsplit('_',1)[-1] if uiType in type_dict: uiType = type_dict[uiType] # set quickUI string format ui_list[i] = partInfo[0]+';'+uiType if len(partInfo)==1: # give empty button and label a place holder name if uiType in ('btn', 'btnMsg', 'QPushButton','label', 'QLabel'): ui_list[i] = partInfo[0]+';'+uiType + ';'+uiName elif len(partInfo)==2: ui_list[i]=ui_list[i]+";"+partInfo[1] # get parentObject or exisiting object parentObject = parentObject_string if parentObject in self.uiList: parentObject = self.uiList[parentObject] # process quickUI self.quickUI(ui_list, parentObject, opt)
Example #8
Source File: universal_tool_template_0904.py From universal_tool_template.py with MIT License | 5 votes |
def __init__(self, parent=None, mode=0): super_class.__init__(self, parent) #------------------------------ # class variables #------------------------------ self.version="0.1" self.help = "How to Use:\n1. Put source info in\n2. Click Process button\n3. Check result output\n4. Save memory info into a file." self.uiList={} # for ui obj storage self.memoData = {} # key based variable data storage self.location = "" if getattr(sys, 'frozen', False): # frozen - cx_freeze self.location = sys.executable else: # unfrozen self.location = os.path.realpath(sys.modules[self.__class__.__module__].__file__) self.name = self.__class__.__name__ self.iconPath = os.path.join(os.path.dirname(self.location),'icons',self.name+'.png') self.iconPix = QtGui.QPixmap(self.iconPath) self.icon = QtGui.QIcon(self.iconPath) self.fileType='.{0}_EXT'.format(self.name) #------------------------------ # core function variable #------------------------------ self.qui_core_dict = { 'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout', 'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget', 'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox', 'txt': 'QTextEdit', 'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget', 'space': 'QSpacerItem', } self.qui_user_dict = {} #------------------------------
Example #9
Source File: universal_tool_template_1000.py From universal_tool_template.py with MIT License | 5 votes |
def setLang(self, langName): lang_data = self.memoData['lang'][langName] for ui_name in lang_data.keys(): if ui_name in self.uiList.keys() and lang_data[ui_name] != '': ui_element = self.uiList[ui_name] # '' means no translation availdanle in that data file if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ): # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox ui_element.setText(lang_data[ui_name]) elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ): # uiType: QMenu, QGroupBox ui_element.setTitle(lang_data[ui_name]) elif isinstance(ui_element, QtWidgets.QTabWidget): # uiType: QTabWidget tabCnt = ui_element.count() tabNameList = lang_data[ui_name].split(';') if len(tabNameList) == tabCnt: for i in range(tabCnt): if tabNameList[i] != '': ui_element.setTabText(i,tabNameList[i]) elif isinstance(ui_element, QtWidgets.QComboBox): # uiType: QComboBox itemCnt = ui_element.count() itemNameList = lang_data[ui_name].split(';') ui_element.clear() ui_element.addItems(itemNameList) elif isinstance(ui_element, QtWidgets.QTreeWidget): # uiType: QTreeWidget labelCnt = ui_element.headerItem().columnCount() labelList = lang_data[ui_name].split(';') ui_element.setHeaderLabels(labelList) elif isinstance(ui_element, QtWidgets.QTableWidget): # uiType: QTableWidget colCnt = ui_element.columnCount() headerList = lang_data[ui_name].split(';') cur_table.setHorizontalHeaderLabels( headerList ) elif isinstance(ui_element, (str, unicode) ): # uiType: string for msg self.uiList[ui_name] = lang_data[ui_name]
Example #10
Source File: universal_tool_template_v8.1.py From universal_tool_template.py with MIT License | 5 votes |
def qui(self, ui_list_string, parentObject_string='', opt=''): # pre-defined user short name syntax type_dict = { 'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout', 'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget', 'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox', 'txtEdit': 'LNTextEdit', 'txt': 'QTextEdit', 'tree': 'QTreeWidget', 'table': 'QTableWidget', 'space': 'QSpacerItem', } # get ui_list, creation or existing ui object ui_list = [x.strip() for x in ui_list_string.split('|')] for i in range(len(ui_list)): if ui_list[i] in self.uiList: # - exisiting object ui_list[i] = self.uiList[ui_list[i]] else: # - string creation: # get part info partInfo = ui_list[i].split(';',1) uiName = partInfo[0].split('@')[0] uiType = uiName.rsplit('_',1)[-1] if uiType in type_dict: uiType = type_dict[uiType] # set quickUI string format ui_list[i] = partInfo[0]+';'+uiType if len(partInfo)==1: # give empty button and label a place holder name if uiType in ('btn', 'btnMsg', 'QPushButton','label', 'QLabel'): ui_list[i] = partInfo[0]+';'+uiType + ';'+uiName elif len(partInfo)==2: ui_list[i]=ui_list[i]+";"+partInfo[1] # get parentObject or exisiting object parentObject = parentObject_string if parentObject in self.uiList: parentObject = self.uiList[parentObject] # process quickUI self.quickUI(ui_list, parentObject, opt)
Example #11
Source File: universal_tool_template_1010.py From universal_tool_template.py with MIT License | 5 votes |
def setLang(self, langName): lang_data = self.memoData['lang'][langName] for ui_name in lang_data.keys(): if ui_name in self.uiList.keys() and lang_data[ui_name] != '': ui_element = self.uiList[ui_name] # '' means no translation availdanle in that data file if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ): # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox ui_element.setText(lang_data[ui_name]) elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ): # uiType: QMenu, QGroupBox ui_element.setTitle(lang_data[ui_name]) elif isinstance(ui_element, QtWidgets.QTabWidget): # uiType: QTabWidget tabCnt = ui_element.count() tabNameList = lang_data[ui_name].split(';') if len(tabNameList) == tabCnt: for i in range(tabCnt): if tabNameList[i] != '': ui_element.setTabText(i,tabNameList[i]) elif isinstance(ui_element, QtWidgets.QComboBox): # uiType: QComboBox itemCnt = ui_element.count() itemNameList = lang_data[ui_name].split(';') ui_element.clear() ui_element.addItems(itemNameList) elif isinstance(ui_element, QtWidgets.QTreeWidget): # uiType: QTreeWidget labelCnt = ui_element.headerItem().columnCount() labelList = lang_data[ui_name].split(';') ui_element.setHeaderLabels(labelList) elif isinstance(ui_element, QtWidgets.QTableWidget): # uiType: QTableWidget colCnt = ui_element.columnCount() headerList = lang_data[ui_name].split(';') cur_table.setHorizontalHeaderLabels( headerList ) elif isinstance(ui_element, (str, unicode) ): # uiType: string for msg self.uiList[ui_name] = lang_data[ui_name]
Example #12
Source File: logic_settings_window.py From randovania with GNU General Public License v3.0 | 5 votes |
def _update_options_by_value(options: Options, combo: QComboBox, new_index: int): with options: setattr(options, combo.options_field_name, combo.currentData())
Example #13
Source File: logic_settings_window.py From randovania with GNU General Public License v3.0 | 5 votes |
def _on_gate_combo_box_changed(self, combo: QComboBox, new_index: int): with self._editor as options: options.set_layout_configuration_field( "translator_configuration", options.layout_configuration.translator_configuration.replace_requirement_for_gate( combo.gate, combo.currentData())) # Hints
Example #14
Source File: logic_settings_window.py From randovania with GNU General Public License v3.0 | 5 votes |
def _on_ammo_type_combo_changed(self, beam: str, combo: QComboBox, is_ammo_b: bool, _): with self._editor as editor: beam_configuration = editor.layout_configuration.beam_configuration old_config: BeamAmmoConfiguration = getattr(beam_configuration, beam) if is_ammo_b: new_config = dataclasses.replace(old_config, ammo_b=combo.currentData()) else: new_config = dataclasses.replace(old_config, ammo_a=combo.currentData()) editor.set_layout_configuration_field("beam_configuration", dataclasses.replace(beam_configuration, **{beam: new_config}))
Example #15
Source File: game_patches_window.py From randovania with GNU General Public License v3.0 | 5 votes |
def _persist_enum(self, combo: QComboBox, attribute_name: str): def persist(index: int): with self._editor as options: options.set_patcher_configuration_field(attribute_name, combo.itemData(index)) return persist
Example #16
Source File: tests.py From Qt.py with MIT License | 5 votes |
def test_load_ui_existingLayoutOnDialog(): """Tests to see if loading a ui onto a layout in a Dialog works""" import sys from Qt import QtWidgets, QtCompat msgs = 'QLayout: Attempting to add QLayout "" to QDialog ' \ '"Dialog", which already has a layout' with ignoreQtMessageHandler([msgs]): app = QtWidgets.QApplication(sys.argv) win = QtWidgets.QDialog() QtWidgets.QComboBox(win) QtWidgets.QHBoxLayout(win) QtCompat.loadUi(self.ui_qdialog, win) app.exit()
Example #17
Source File: tests.py From Qt.py with MIT License | 5 votes |
def test_load_ui_existingLayoutOnMainWindow(): """Tests to see if loading a ui onto a layout in a MainWindow works""" import sys from Qt import QtWidgets, QtCompat msgs = 'QLayout: Attempting to add QLayout "" to QMainWindow ' \ '"", which already has a layout' with ignoreQtMessageHandler([msgs]): app = QtWidgets.QApplication(sys.argv) win = QtWidgets.QMainWindow() QtWidgets.QComboBox(win) QtWidgets.QHBoxLayout(win) QtCompat.loadUi(self.ui_qmainwindow, win) app.exit()
Example #18
Source File: tests.py From Qt.py with MIT License | 5 votes |
def test_load_ui_existingLayoutOnDockWidget(): """Tests to see if loading a ui onto a layout in a DockWidget works""" import sys from Qt import QtWidgets, QtCompat msgs = 'QLayout: Attempting to add QLayout "" to QDockWidget ' \ '"", which already has a layout' with ignoreQtMessageHandler([msgs]): app = QtWidgets.QApplication(sys.argv) win = QtWidgets.QDockWidget() QtWidgets.QComboBox(win) QtWidgets.QHBoxLayout(win) QtCompat.loadUi(self.ui_qdockwidget, win) app.exit()
Example #19
Source File: UITranslator.py From universal_tool_template.py with MIT License | 5 votes |
def qui(self, ui_list_string, parentObject_string='', opt=''): # pre-defined user short name syntax type_dict = { 'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout', 'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget', 'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox', 'txtEdit': 'LNTextEdit', 'txt': 'QTextEdit', 'tree': 'QTreeWidget', 'table': 'QTableWidget', 'space': 'QSpacerItem', } # get ui_list, creation or existing ui object ui_list = [x.strip() for x in ui_list_string.split('|')] for i in range(len(ui_list)): if ui_list[i] in self.uiList: # - exisiting object ui_list[i] = self.uiList[ui_list[i]] else: # - string creation: # get part info partInfo = ui_list[i].split(';',1) uiName = partInfo[0].split('@')[0] uiType = uiName.rsplit('_',1)[-1] if uiType in type_dict: uiType = type_dict[uiType] # set quickUI string format ui_list[i] = partInfo[0]+';'+uiType if len(partInfo)==1: # give empty button and label a place holder name if uiType in ('btn', 'btnMsg', 'QPushButton','label', 'QLabel'): ui_list[i] = partInfo[0]+';'+uiType + ';'+uiName elif len(partInfo)==2: ui_list[i]=ui_list[i]+";"+partInfo[1] # get parentObject or exisiting object parentObject = parentObject_string if parentObject in self.uiList: parentObject = self.uiList[parentObject] # process quickUI self.quickUI(ui_list, parentObject, opt)
Example #20
Source File: GearBox_template_1010.py From universal_tool_template.py with MIT License | 5 votes |
def setLang(self, langName): lang_data = self.memoData['lang'][langName] for ui_name in lang_data.keys(): if ui_name in self.uiList.keys() and lang_data[ui_name] != '': ui_element = self.uiList[ui_name] # '' means no translation availdanle in that data file if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ): # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox ui_element.setText(lang_data[ui_name]) elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ): # uiType: QMenu, QGroupBox ui_element.setTitle(lang_data[ui_name]) elif isinstance(ui_element, QtWidgets.QTabWidget): # uiType: QTabWidget tabCnt = ui_element.count() tabNameList = lang_data[ui_name].split(';') if len(tabNameList) == tabCnt: for i in range(tabCnt): if tabNameList[i] != '': ui_element.setTabText(i,tabNameList[i]) elif isinstance(ui_element, QtWidgets.QComboBox): # uiType: QComboBox itemCnt = ui_element.count() itemNameList = lang_data[ui_name].split(';') ui_element.clear() ui_element.addItems(itemNameList) elif isinstance(ui_element, QtWidgets.QTreeWidget): # uiType: QTreeWidget labelCnt = ui_element.headerItem().columnCount() labelList = lang_data[ui_name].split(';') ui_element.setHeaderLabels(labelList) elif isinstance(ui_element, QtWidgets.QTableWidget): # uiType: QTableWidget colCnt = ui_element.columnCount() headerList = lang_data[ui_name].split(';') cur_table.setHorizontalHeaderLabels( headerList ) elif isinstance(ui_element, (str, unicode) ): # uiType: string for msg self.uiList[ui_name] = lang_data[ui_name]
Example #21
Source File: universal_tool_template_1020.py From universal_tool_template.py with MIT License | 5 votes |
def setLang(self, langName): lang_data = self.memoData['lang'][langName] for ui_name in lang_data.keys(): if ui_name in self.uiList.keys() and lang_data[ui_name] != '': ui_element = self.uiList[ui_name] # '' means no translation availdanle in that data file if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ): # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox ui_element.setText(lang_data[ui_name]) elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ): # uiType: QMenu, QGroupBox ui_element.setTitle(lang_data[ui_name]) elif isinstance(ui_element, QtWidgets.QTabWidget): # uiType: QTabWidget tabCnt = ui_element.count() tabNameList = lang_data[ui_name].split(';') if len(tabNameList) == tabCnt: for i in range(tabCnt): if tabNameList[i] != '': ui_element.setTabText(i,tabNameList[i]) elif isinstance(ui_element, QtWidgets.QComboBox): # uiType: QComboBox itemCnt = ui_element.count() itemNameList = lang_data[ui_name].split(';') ui_element.clear() ui_element.addItems(itemNameList) elif isinstance(ui_element, QtWidgets.QTreeWidget): # uiType: QTreeWidget labelCnt = ui_element.headerItem().columnCount() labelList = lang_data[ui_name].split(';') ui_element.setHeaderLabels(labelList) elif isinstance(ui_element, QtWidgets.QTableWidget): # uiType: QTableWidget colCnt = ui_element.columnCount() headerList = lang_data[ui_name].split(';') cur_table.setHorizontalHeaderLabels( headerList ) elif isinstance(ui_element, (str, unicode) ): # uiType: string for msg self.uiList[ui_name] = lang_data[ui_name]
Example #22
Source File: combobox_and_label.py From Hands-On-Blockchain-for-Python-Developers with MIT License | 5 votes |
def __init__(self): super(ComboBoxAndLabel, self).__init__() self.combobox = QComboBox() self.combobox.addItems(["Orange", "Apple", "Grape"]) self.combobox.currentTextChanged.connect(self.comboboxSelected) self.label = QLabel("label: before selecting combobox") layout = QVBoxLayout() layout.addWidget(self.combobox) layout.addWidget(self.label) self.setLayout(layout)
Example #23
Source File: universal_tool_template_1116.py From universal_tool_template.py with MIT License | 5 votes |
def setLang(self, langName): lang_data = self.memoData['lang'][langName] for ui_name in lang_data.keys(): if ui_name in self.uiList.keys() and lang_data[ui_name] != '': ui_element = self.uiList[ui_name] # '' means no translation availdanle in that data file if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ): # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox ui_element.setText(lang_data[ui_name]) elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ): # uiType: QMenu, QGroupBox ui_element.setTitle(lang_data[ui_name]) elif isinstance(ui_element, QtWidgets.QTabWidget): # uiType: QTabWidget tabCnt = ui_element.count() tabNameList = lang_data[ui_name].split(';') if len(tabNameList) == tabCnt: for i in range(tabCnt): if tabNameList[i] != '': ui_element.setTabText(i,tabNameList[i]) elif isinstance(ui_element, QtWidgets.QComboBox): # uiType: QComboBox itemCnt = ui_element.count() itemNameList = lang_data[ui_name].split(';') ui_element.clear() ui_element.addItems(itemNameList) elif isinstance(ui_element, QtWidgets.QTreeWidget): # uiType: QTreeWidget labelCnt = ui_element.headerItem().columnCount() labelList = lang_data[ui_name].split(';') ui_element.setHeaderLabels(labelList) elif isinstance(ui_element, QtWidgets.QTableWidget): # uiType: QTableWidget colCnt = ui_element.columnCount() headerList = lang_data[ui_name].split(';') cur_table.setHorizontalHeaderLabels( headerList ) elif isinstance(ui_element, (str, unicode) ): # uiType: string for msg self.uiList[ui_name] = lang_data[ui_name]
Example #24
Source File: universal_tool_template_1115.py From universal_tool_template.py with MIT License | 5 votes |
def setLang(self, langName): lang_data = self.memoData['lang'][langName] for ui_name in lang_data.keys(): if ui_name in self.uiList.keys() and lang_data[ui_name] != '': ui_element = self.uiList[ui_name] # '' means no translation availdanle in that data file if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ): # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox ui_element.setText(lang_data[ui_name]) elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ): # uiType: QMenu, QGroupBox ui_element.setTitle(lang_data[ui_name]) elif isinstance(ui_element, QtWidgets.QTabWidget): # uiType: QTabWidget tabCnt = ui_element.count() tabNameList = lang_data[ui_name].split(';') if len(tabNameList) == tabCnt: for i in range(tabCnt): if tabNameList[i] != '': ui_element.setTabText(i,tabNameList[i]) elif isinstance(ui_element, QtWidgets.QComboBox): # uiType: QComboBox itemCnt = ui_element.count() itemNameList = lang_data[ui_name].split(';') ui_element.clear() ui_element.addItems(itemNameList) elif isinstance(ui_element, QtWidgets.QTreeWidget): # uiType: QTreeWidget labelCnt = ui_element.headerItem().columnCount() labelList = lang_data[ui_name].split(';') ui_element.setHeaderLabels(labelList) elif isinstance(ui_element, QtWidgets.QTableWidget): # uiType: QTableWidget colCnt = ui_element.columnCount() headerList = lang_data[ui_name].split(';') cur_table.setHorizontalHeaderLabels( headerList ) elif isinstance(ui_element, (str, unicode) ): # uiType: string for msg self.uiList[ui_name] = lang_data[ui_name]
Example #25
Source File: guiDemo_ui.py From MayaDev with MIT License | 5 votes |
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(360, 180) self.gridLayout = QtWidgets.QGridLayout(Form) self.gridLayout.setObjectName("gridLayout") self.label_2 = QtWidgets.QLabel(Form) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 0, 0, 1, 1) self.cbObjType = QtWidgets.QComboBox(Form) self.cbObjType.setObjectName("cbObjType") self.cbObjType.addItem("") self.cbObjType.addItem("") self.gridLayout.addWidget(self.cbObjType, 0, 1, 1, 1) self.btnCreate = QtWidgets.QPushButton(Form) self.btnCreate.setObjectName("btnCreate") self.gridLayout.addWidget(self.btnCreate, 0, 2, 1, 1) self.label = QtWidgets.QLabel(Form) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 1, 0, 1, 1) self.leNewName = QtWidgets.QLineEdit(Form) self.leNewName.setObjectName("leNewName") self.gridLayout.addWidget(self.leNewName, 1, 1, 1, 1) self.btnRename = QtWidgets.QPushButton(Form) self.btnRename.setObjectName("btnRename") self.gridLayout.addWidget(self.btnRename, 1, 2, 1, 1) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
Example #26
Source File: copy_bounding_box_dialog.py From metashape-scripts with MIT License | 5 votes |
def __init__(self, parent): QtWidgets.QDialog.__init__(self, parent) self.setWindowTitle("Copy bounding box") self.labelFrom = QtWidgets.QLabel("From") self.labelTo = QtWidgets.QLabel("To") self.fromChunk = QtWidgets.QComboBox() for chunk in Metashape.app.document.chunks: self.fromChunk.addItem(chunk.label) self.toChunks = QtWidgets.QListWidget() self.toChunks.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) for chunk in Metashape.app.document.chunks: self.toChunks.addItem(chunk.label) self.btnOk = QtWidgets.QPushButton("Ok") self.btnOk.setFixedSize(90, 50) self.btnOk.setToolTip("Copy bounding box to all selected chunks") self.btnQuit = QtWidgets.QPushButton("Close") self.btnQuit.setFixedSize(90, 50) layout = QtWidgets.QGridLayout() # creating layout layout.addWidget(self.labelFrom, 0, 0) layout.addWidget(self.fromChunk, 0, 1) layout.addWidget(self.labelTo, 0, 2) layout.addWidget(self.toChunks, 0, 3) layout.addWidget(self.btnOk, 1, 1) layout.addWidget(self.btnQuit, 1, 3) self.setLayout(layout) QtCore.QObject.connect(self.btnOk, QtCore.SIGNAL("clicked()"), self.copyBoundingBox) QtCore.QObject.connect(self.btnQuit, QtCore.SIGNAL("clicked()"), self, QtCore.SLOT("reject()")) self.exec()
Example #27
Source File: export_depth_maps_dialog.py From metashape-scripts with MIT License | 5 votes |
def __init__ (self, parent): QtWidgets.QDialog.__init__(self, parent) self.setWindowTitle("Export depth maps") self.btnQuit = QtWidgets.QPushButton("&Close") self.btnP1 = QtWidgets.QPushButton("&Export") self.pBar = QtWidgets.QProgressBar() self.pBar.setTextVisible(False) # self.selTxt =QtWidgets.QLabel() # self.selTxt.setText("Apply to:") self.radioBtn_all = QtWidgets.QRadioButton("Apply to all cameras") self.radioBtn_sel = QtWidgets.QRadioButton("Apply to selected") self.radioBtn_all.setChecked(True) self.radioBtn_sel.setChecked(False) self.formTxt = QtWidgets.QLabel() self.formTxt.setText("Export format:") self.formCmb = QtWidgets.QComboBox() self.formCmb.addItem("1-band F32") self.formCmb.addItem("Grayscale 8-bit") self.formCmb.addItem("Grayscale 16-bit") # creating layout layout = QtWidgets.QGridLayout() layout.setSpacing(10) layout.addWidget(self.radioBtn_all, 0, 0) layout.addWidget(self.radioBtn_sel, 1, 0) layout.addWidget(self.formTxt, 0, 1) layout.addWidget(self.formCmb, 1, 1) layout.addWidget(self.btnP1, 2, 0) layout.addWidget(self.btnQuit, 2, 1) layout.addWidget(self.pBar, 3, 0, 1, 2) self.setLayout(layout) QtCore.QObject.connect(self.btnP1, QtCore.SIGNAL("clicked()"), self.export_depth) QtCore.QObject.connect(self.btnQuit, QtCore.SIGNAL("clicked()"), self, QtCore.SLOT("reject()")) self.exec()
Example #28
Source File: mops_updater.py From MOPS with GNU Lesser General Public License v3.0 | 4 votes |
def buildui(self): main_layout = QtWidgets.QVBoxLayout() btn_layout = QtWidgets.QHBoxLayout() form = QtWidgets.QGridLayout() main_layout.addLayout(form) current_branch_label = QtWidgets.QLabel('Current Branch: ') current_branch = QtWidgets.QLineEdit() current_build_label = QtWidgets.QLabel('Current Build: ') current_build = QtWidgets.QLineEdit() branch_combo_label = QtWidgets.QLabel('Select Branch: ') self.branch_combo = QtWidgets.QComboBox() build_combo_label = QtWidgets.QLabel('Select Build: ') self.build_combo = QtWidgets.QComboBox() self.update_env = QtWidgets.QCheckBox('Auto-Update houdini.env') self.update_env.setChecked(False) # deprecated self.update_env.setVisible(False) self.do_analytics = QtWidgets.QCheckBox('Share anonymous MOPs data') self.do_analytics.setChecked(False) apply_btn = QtWidgets.QPushButton('Apply Update') cancel_btn = QtWidgets.QPushButton('Cancel') form.addWidget(current_branch_label, 0, 0) form.addWidget(current_branch, 0, 1) form.addWidget(current_build_label, 1, 0) form.addWidget(current_build, 1, 1) form.addWidget(branch_combo_label, 2, 0) form.addWidget(self.branch_combo, 2, 1) form.addWidget(build_combo_label, 3, 0) form.addWidget(self.build_combo, 3, 1) main_layout.addStretch() main_layout.addWidget(self.update_env) main_layout.addWidget(self.do_analytics) main_layout.addLayout(btn_layout) btn_layout.addWidget(apply_btn) btn_layout.addWidget(cancel_btn) self.setLayout(main_layout) # defaults current_branch.setEnabled(False) current_build.setEnabled(False) install_info = get_install_info() current_branch.setText(install_info['branch']) current_build.setText(install_info['release']) # signals / slots self.branch_combo.currentIndexChanged.connect(self.set_branch) self.build_combo.currentIndexChanged.connect(self.set_build) apply_btn.clicked.connect(self.apply) cancel_btn.clicked.connect(self.close) self.update_env.clicked.connect(self.toggle_env_update) # window size # self.setFixedSize(300, 200)
Example #29
Source File: GeneralDialogues.py From GridCal with GNU General Public License v3.0 | 4 votes |
def __init__(self): super(NewProfilesStructureDialogue, self).__init__() self.setObjectName("self") # self.resize(200, 71) # self.setMinimumSize(QtCore.QSize(200, 71)) # self.setMaximumSize(QtCore.QSize(200, 71)) self.setContextMenuPolicy(QtCore.Qt.NoContextMenu) # icon = QtGui.QIcon() # icon.addPixmap(QtGui.QPixmap("Icons/Plus-32.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) # self.setWindowIcon(icon) self.layout = QtWidgets.QVBoxLayout(self) # calendar self.calendar = QtWidgets.QDateTimeEdit() d = datetime.today() self.calendar.setDateTime(QtCore.QDateTime(d.year, 1, 1, 00, 00, 00)) # number of time steps self.steps_spinner = QtWidgets.QSpinBox() self.steps_spinner.setMinimum(1) self.steps_spinner.setMaximum(9999999) self.steps_spinner.setValue(1) # time step length self.step_length = QtWidgets.QDoubleSpinBox() self.step_length.setMinimum(1) self.step_length.setMaximum(60) self.step_length.setValue(1) # units combo box self.units = QtWidgets.QComboBox() self.units.setModel(get_list_model(['h', 'm', 's'])) # accept button self.accept_btn = QtWidgets.QPushButton() self.accept_btn.setText('Accept') self.accept_btn.clicked.connect(self.accept_click) # labels # add all to the GUI self.layout.addWidget(QtWidgets.QLabel("Start date")) self.layout.addWidget(self.calendar) self.layout.addWidget(QtWidgets.QLabel("Number of time steps")) self.layout.addWidget(self.steps_spinner) self.layout.addWidget(QtWidgets.QLabel("Time step length")) self.layout.addWidget(self.step_length) self.layout.addWidget(QtWidgets.QLabel("Time units")) self.layout.addWidget(self.units) self.layout.addWidget(self.accept_btn) self.setLayout(self.layout) self.setWindowTitle('New profiles structure')
Example #30
Source File: MainWindow.py From HS_Downloader with MIT License | 4 votes |
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(476, 263) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.searchButton = QtWidgets.QPushButton(self.centralwidget) self.searchButton.setGeometry(QtCore.QRect(340, 10, 131, 31)) self.searchButton.setObjectName("searchButton") self.selectAll = QtWidgets.QPushButton(self.centralwidget) self.selectAll.setGeometry(QtCore.QRect(340, 55, 131, 31)) self.selectAll.setObjectName("selectAll") self.deselectAll = QtWidgets.QPushButton(self.centralwidget) self.deselectAll.setGeometry(QtCore.QRect(340, 90, 131, 31)) self.deselectAll.setObjectName("deselectAll") self.line = QtWidgets.QFrame(self.centralwidget) self.line.setGeometry(QtCore.QRect(340, 35, 131, 31)) self.line.setFrameShape(QtWidgets.QFrame.HLine) self.line.setFrameShadow(QtWidgets.QFrame.Sunken) self.line.setObjectName("line") self.downloadButton = QtWidgets.QPushButton(self.centralwidget) self.downloadButton.setGeometry(QtCore.QRect(340, 220, 131, 31)) self.downloadButton.setObjectName("downloadButton") self.animeView = QtWidgets.QListWidget(self.centralwidget) self.animeView.setGeometry(QtCore.QRect(10, 50, 321, 201)) self.animeView.setObjectName("animeView") self.searchField = QtWidgets.QLineEdit(self.centralwidget) self.searchField.setGeometry(QtCore.QRect(10, 10, 321, 31)) self.searchField.setObjectName("searchField") self.loadingStatus = QtWidgets.QLabel(self.centralwidget) self.loadingStatus.setEnabled(True) self.loadingStatus.setGeometry(QtCore.QRect(340, 160, 131, 20)) font = QtGui.QFont() font.setFamily("Segoe UI") font.setPointSize(11) font.setWeight(75) font.setBold(True) self.loadingStatus.setFont(font) self.loadingStatus.setAlignment(QtCore.Qt.AlignCenter) self.loadingStatus.setObjectName("loadingStatus") self.selectQuality = QtWidgets.QComboBox(self.centralwidget) self.selectQuality.setGeometry(QtCore.QRect(340, 190, 131, 22)) self.selectQuality.setObjectName("selectQuality") self.intellTurn = QtWidgets.QCheckBox(self.centralwidget) self.intellTurn.setGeometry(QtCore.QRect(340, 130, 131, 17)) self.intellTurn.setObjectName("intellTurn") MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)