Python PySide.QtGui.QCheckBox() Examples
The following are 30
code examples of PySide.QtGui.QCheckBox().
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
PySide.QtGui
, or try the search function
.
Example #1
Source File: UITranslator_v1.0.py From universal_tool_template.py with MIT License | 6 votes |
def setLang(self, langName): uiList_lang_read = self.memoData['lang'][langName] for ui_name in uiList_lang_read: ui_element = self.uiList[ui_name] if type(ui_element) in [ QtGui.QLabel, QtGui.QPushButton, QtGui.QAction, QtGui.QCheckBox ]: # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox if uiList_lang_read[ui_name] != "": ui_element.setText(uiList_lang_read[ui_name]) elif type(ui_element) in [ QtGui.QGroupBox, QtGui.QMenu ]: # uiType: QMenu, QGroupBox if uiList_lang_read[ui_name] != "": ui_element.setTitle(uiList_lang_read[ui_name]) elif type(ui_element) in [ QtGui.QTabWidget]: # uiType: QTabWidget tabCnt = ui_element.count() if uiList_lang_read[ui_name] != "": tabNameList = uiList_lang_read[ui_name].split(';') if len(tabNameList) == tabCnt: for i in range(tabCnt): if tabNameList[i] != "": ui_element.setTabText(i,tabNameList[i]) elif type(ui_element) == str: # uiType: string for msg if uiList_lang_read[ui_name] != "": self.uiList[ui_name] = uiList_lang_read[ui_name]
Example #2
Source File: ScatterPlotSpeedTestTemplate_pyside.py From qgisSpaceSyntaxToolkit with GNU General Public License v3.0 | 6 votes |
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(400, 300) self.gridLayout = QtGui.QGridLayout(Form) self.gridLayout.setObjectName("gridLayout") self.sizeSpin = QtGui.QSpinBox(Form) self.sizeSpin.setProperty("value", 10) self.sizeSpin.setObjectName("sizeSpin") self.gridLayout.addWidget(self.sizeSpin, 1, 1, 1, 1) self.pixelModeCheck = QtGui.QCheckBox(Form) self.pixelModeCheck.setObjectName("pixelModeCheck") self.gridLayout.addWidget(self.pixelModeCheck, 1, 3, 1, 1) self.label = QtGui.QLabel(Form) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 1, 0, 1, 1) self.plot = PlotWidget(Form) self.plot.setObjectName("plot") self.gridLayout.addWidget(self.plot, 0, 0, 1, 4) self.randCheck = QtGui.QCheckBox(Form) self.randCheck.setObjectName("randCheck") self.gridLayout.addWidget(self.randCheck, 1, 2, 1, 1) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
Example #3
Source File: gui.py From epycyzm with MIT License | 6 votes |
def createIconGroupBox(self): self.iconGroupBox = QtGui.QGroupBox("Tray Icon") self.iconLabel = QtGui.QLabel("Icon:") self.iconComboBox = QtGui.QComboBox() self.iconComboBox.addItem(QtGui.QIcon(':/icons/miner.svg'), "Miner") self.iconComboBox.addItem(QtGui.QIcon(':/images/heart.svg'), "Heart") self.iconComboBox.addItem(QtGui.QIcon(':/images/trash.svg'), "Trash") self.showIconCheckBox = QtGui.QCheckBox("Show icon") self.showIconCheckBox.setChecked(True) iconLayout = QtGui.QHBoxLayout() iconLayout.addWidget(self.iconLabel) iconLayout.addWidget(self.iconComboBox) iconLayout.addStretch() iconLayout.addWidget(self.showIconCheckBox) self.iconGroupBox.setLayout(iconLayout)
Example #4
Source File: ScatterPlotSpeedTestTemplate_pyside.py From tf-pose with Apache License 2.0 | 6 votes |
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(400, 300) self.gridLayout = QtGui.QGridLayout(Form) self.gridLayout.setObjectName("gridLayout") self.sizeSpin = QtGui.QSpinBox(Form) self.sizeSpin.setProperty("value", 10) self.sizeSpin.setObjectName("sizeSpin") self.gridLayout.addWidget(self.sizeSpin, 1, 1, 1, 1) self.pixelModeCheck = QtGui.QCheckBox(Form) self.pixelModeCheck.setObjectName("pixelModeCheck") self.gridLayout.addWidget(self.pixelModeCheck, 1, 3, 1, 1) self.label = QtGui.QLabel(Form) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 1, 0, 1, 1) self.plot = PlotWidget(Form) self.plot.setObjectName("plot") self.gridLayout.addWidget(self.plot, 0, 0, 1, 4) self.randCheck = QtGui.QCheckBox(Form) self.randCheck.setObjectName("randCheck") self.gridLayout.addWidget(self.randCheck, 1, 2, 1, 1) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
Example #5
Source File: UITranslator.py From universal_tool_template.py with MIT License | 6 votes |
def setLang(self, langName): uiList_lang_read = self.memoData['lang'][langName] for ui_name in uiList_lang_read: ui_element = self.uiList[ui_name] if type(ui_element) in [ QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox ]: # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox if uiList_lang_read[ui_name] != "": ui_element.setText(uiList_lang_read[ui_name]) elif type(ui_element) in [ QtWidgets.QGroupBox, QtWidgets.QMenu ]: # uiType: QMenu, QGroupBox if uiList_lang_read[ui_name] != "": ui_element.setTitle(uiList_lang_read[ui_name]) elif type(ui_element) in [ QtWidgets.QTabWidget]: # uiType: QTabWidget tabCnt = ui_element.count() if uiList_lang_read[ui_name] != "": tabNameList = uiList_lang_read[ui_name].split(';') if len(tabNameList) == tabCnt: for i in range(tabCnt): if tabNameList[i] != "": ui_element.setTabText(i,tabNameList[i]) elif type(ui_element) == str: # uiType: string for msg if uiList_lang_read[ui_name] != "": self.uiList[ui_name] = uiList_lang_read[ui_name]
Example #6
Source File: universal_tool_template_v7.3.py From universal_tool_template.py with MIT License | 6 votes |
def setLang(self, langName): uiList_lang_read = self.memoData['lang'][langName] for ui_name in uiList_lang_read: ui_element = self.uiList[ui_name] if type(ui_element) in [ QtGui.QLabel, QtGui.QPushButton, QtGui.QAction, QtGui.QCheckBox ]: # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox if uiList_lang_read[ui_name] != "": ui_element.setText(uiList_lang_read[ui_name]) elif type(ui_element) in [ QtGui.QGroupBox, QtGui.QMenu ]: # uiType: QMenu, QGroupBox if uiList_lang_read[ui_name] != "": ui_element.setTitle(uiList_lang_read[ui_name]) elif type(ui_element) in [ QtGui.QTabWidget]: # uiType: QTabWidget tabCnt = ui_element.count() if uiList_lang_read[ui_name] != "": tabNameList = uiList_lang_read[ui_name].split(';') if len(tabNameList) == tabCnt: for i in range(tabCnt): if tabNameList[i] != "": ui_element.setTabText(i,tabNameList[i]) elif type(ui_element) == str: # uiType: string for msg if uiList_lang_read[ui_name] != "": self.uiList[ui_name] = uiList_lang_read[ui_name]
Example #7
Source File: universal_tool_template_v8.1.py From universal_tool_template.py with MIT License | 6 votes |
def setLang(self, langName): uiList_lang_read = self.memoData['lang'][langName] for ui_name in uiList_lang_read: ui_element = self.uiList[ui_name] if type(ui_element) in [ QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox ]: # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox if uiList_lang_read[ui_name] != "": ui_element.setText(uiList_lang_read[ui_name]) elif type(ui_element) in [ QtWidgets.QGroupBox, QtWidgets.QMenu ]: # uiType: QMenu, QGroupBox if uiList_lang_read[ui_name] != "": ui_element.setTitle(uiList_lang_read[ui_name]) elif type(ui_element) in [ QtWidgets.QTabWidget]: # uiType: QTabWidget tabCnt = ui_element.count() if uiList_lang_read[ui_name] != "": tabNameList = uiList_lang_read[ui_name].split(';') if len(tabNameList) == tabCnt: for i in range(tabCnt): if tabNameList[i] != "": ui_element.setTabText(i,tabNameList[i]) elif type(ui_element) == str: # uiType: string for msg if uiList_lang_read[ui_name] != "": self.uiList[ui_name] = uiList_lang_read[ui_name]
Example #8
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 #9
Source File: universal_tool_template_0903.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 #10
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 #11
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 #12
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 #13
Source File: universal_tool_template_v7.3.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', '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 #14
Source File: universal_tool_template_v7.3.py From universal_tool_template.py with MIT License | 5 votes |
def loadLang(self): self.quickMenu(['language_menu;&Language']) cur_menu = self.uiList['language_menu'] self.quickMenuAction('langDefault_atnLang', 'Default','','langDefault.png', cur_menu) cur_menu.addSeparator() QtCore.QObject.connect( self.uiList['langDefault_atnLang'], QtCore.SIGNAL("triggered()"), partial(self.setLang, 'default') ) # store default language self.memoData['lang']={} self.memoData['lang']['default']={} for ui_name in self.uiList: ui_element = self.uiList[ui_name] if type(ui_element) in [ QtGui.QLabel, QtGui.QPushButton, QtGui.QAction, QtGui.QCheckBox ]: # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox self.memoData['lang']['default'][ui_name] = str(ui_element.text()) elif type(ui_element) in [ QtGui.QGroupBox, QtGui.QMenu ]: # uiType: QMenu, QGroupBox self.memoData['lang']['default'][ui_name] = str(ui_element.title()) elif type(ui_element) in [ QtGui.QTabWidget]: # uiType: QTabWidget tabCnt = ui_element.count() tabNameList = [] for i in range(tabCnt): tabNameList.append(str(ui_element.tabText(i))) self.memoData['lang']['default'][ui_name]=';'.join(tabNameList) elif type(ui_element) == str: # uiType: string for msg self.memoData['lang']['default'][ui_name] = self.uiList[ui_name] # try load other language lang_path = os.path.dirname(self.location) # better in packed than(os.path.abspath(__file__)) baseName = os.path.splitext( os.path.basename(self.location) )[0] for fileName in os.listdir(lang_path): if fileName.startswith(baseName+"_lang_"): langName = fileName.replace(baseName+"_lang_","").split('.')[0].replace(" ","") self.memoData['lang'][ langName ] = self.readRawFile( os.path.join(lang_path,fileName) ) self.quickMenuAction(langName+'_atnLang', langName.upper(),'',langName + '.png', cur_menu) QtCore.QObject.connect( self.uiList[langName+'_atnLang'], QtCore.SIGNAL("triggered()"), partial(self.setLang, langName) ) # if no language file detected, add export default language option if len(self.memoData['lang']) == 1: self.quickMenuAction('langExport_atnLang', 'Export Default Language','','langExport.png', cur_menu) QtCore.QObject.connect( self.uiList['langExport_atnLang'], QtCore.SIGNAL("triggered()"), self.exportLang )
Example #15
Source File: universal_tool_template_v8.1.py From universal_tool_template.py with MIT License | 5 votes |
def loadLang(self): self.quickMenu(['language_menu;&Language']) cur_menu = self.uiList['language_menu'] self.quickMenuAction('langDefault_atnLang', 'Default','','langDefault.png', cur_menu) cur_menu.addSeparator() self.uiList['langDefault_atnLang'].triggered.connect(partial(self.setLang,'default')) # store default language self.memoData['lang']={} self.memoData['lang']['default']={} for ui_name in self.uiList: ui_element = self.uiList[ui_name] if type(ui_element) in [ QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox ]: # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox self.memoData['lang']['default'][ui_name] = str(ui_element.text()) elif type(ui_element) in [ QtWidgets.QGroupBox, QtWidgets.QMenu ]: # uiType: QMenu, QGroupBox self.memoData['lang']['default'][ui_name] = str(ui_element.title()) elif type(ui_element) in [ QtWidgets.QTabWidget]: # uiType: QTabWidget tabCnt = ui_element.count() tabNameList = [] for i in range(tabCnt): tabNameList.append(str(ui_element.tabText(i))) self.memoData['lang']['default'][ui_name]=';'.join(tabNameList) elif type(ui_element) == str: # uiType: string for msg self.memoData['lang']['default'][ui_name] = self.uiList[ui_name] # try load other language lang_path = os.path.dirname(self.location) # better in packed than(os.path.abspath(__file__)) baseName = os.path.splitext( os.path.basename(self.location) )[0] for fileName in os.listdir(lang_path): if fileName.startswith(baseName+"_lang_"): langName = fileName.replace(baseName+"_lang_","").split('.')[0].replace(" ","") self.memoData['lang'][ langName ] = self.readRawFile( os.path.join(lang_path,fileName) ) self.quickMenuAction(langName+'_atnLang', langName.upper(),'',langName + '.png', cur_menu) self.uiList[langName+'_atnLang'].triggered.connect(partial(self.setLang,langName)) # if no language file detected, add export default language option if len(self.memoData['lang']) == 1: self.quickMenuAction('langExport_atnLang', 'Export Default Language','','langExport.png', cur_menu) self.uiList['langExport_atnLang'].triggered.connect(self.exportLang)
Example #16
Source File: universal_tool_template_0803.py From universal_tool_template.py with MIT License | 5 votes |
def setLang(self, langName): uiList_lang_read = self.memoData['lang'][langName] for ui_name in uiList_lang_read: ui_element = self.uiList[ui_name] if type(ui_element) in [ QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox ]: # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox if uiList_lang_read[ui_name] != "": ui_element.setText(uiList_lang_read[ui_name]) elif type(ui_element) in [ QtWidgets.QGroupBox, QtWidgets.QMenu ]: # uiType: QMenu, QGroupBox if uiList_lang_read[ui_name] != "": ui_element.setTitle(uiList_lang_read[ui_name]) elif type(ui_element) in [ QtWidgets.QTabWidget]: # uiType: QTabWidget tabCnt = ui_element.count() if uiList_lang_read[ui_name] != "": tabNameList = uiList_lang_read[ui_name].split(';') if len(tabNameList) == tabCnt: for i in range(tabCnt): if tabNameList[i] != "": ui_element.setTabText(i,tabNameList[i]) elif type(ui_element) == str: # uiType: string for msg if uiList_lang_read[ui_name] != "": self.uiList[ui_name] = uiList_lang_read[ui_name]
Example #17
Source File: casc_plugin.py From CASC with GNU General Public License v2.0 | 5 votes |
def set_masking(self, maskings): checkboxes = [x[1] for x in self.maskings] + [x[1] for x in self.registers] for x in [self.gui.findChild(QtWidgets.QCheckBox, x) for x in checkboxes]: name = x.objectName().replace('_mask', '') if name in maskings: x.setChecked(True)
Example #18
Source File: casc_plugin.py From CASC with GNU General Public License v2.0 | 5 votes |
def register_signals(self, apply_mask_func, custom_ui_func): checkboxes = [x[1] for x in self.maskings] + [x[1] for x in self.registers] objs = [self.gui.findChild(QtWidgets.QCheckBox, x) for x in checkboxes] for checkbox in objs: name = checkbox.objectName() if name.startswith('custom'): checkbox.stateChanged.connect(custom_ui_func) else: checkbox.stateChanged.connect(apply_mask_func)
Example #19
Source File: casc_plugin.py From CASC with GNU General Public License v2.0 | 5 votes |
def get_non_custom_masks(self): checkboxes = [x[1] for x in self.maskings if not x[1].startswith('custom')] checkboxes += [x[1] for x in self.registers] return [self.gui.findChild(QtWidgets.QCheckBox, x) for x in checkboxes]
Example #20
Source File: casc_plugin.py From CASC with GNU General Public License v2.0 | 5 votes |
def get_custom_checkbox(self): custom = [x[1] for x in self.maskings if x[1].startswith('custom')][0] return self.gui.findChild(QtWidgets.QCheckBox, custom) # # Architecture parsers #-------------------------------------------------------------------------------
Example #21
Source File: preferences.py From FreeCAD_drawing_dimensioning with GNU Lesser General Public License v2.1 | 5 votes |
def generateWidget( self, dimensioningProcess ): self.checkbox = QtGui.QCheckBox('repeat') c = self.dd_parms.GetBool( self.parmName, self.defaultValue ) self.checkbox.setChecked( c ) self.d.endFunction = self.endFunction if self.checkbox.isChecked() else None self.checkbox.stateChanged.connect( self.stateChanged ) return self.checkbox
Example #22
Source File: preferences.py From FreeCAD_drawing_dimensioning with GNU Lesser General Public License v2.1 | 5 votes |
def generateWidget( self, dimensioningProcess ): self.dimensioningProcess = dimensioningProcess self.checkbox = QtGui.QCheckBox(self.label) self.revertToDefault() self.checkbox.stateChanged.connect( self.valueChanged ) return self.checkbox
Example #23
Source File: GDT.py From FreeCAD-GDT with GNU Lesser General Public License v2.1 | 5 votes |
def generateWidget( self, idGDT, ContainerOfData ): self.idGDT = idGDT self.ContainerOfData = ContainerOfData self.checkBox = QtGui.QCheckBox(self.Text) self.checkBox.setChecked(True) global checkBoxState checkBoxState = True hbox = QtGui.QHBoxLayout() hbox.addWidget(self.checkBox) hbox.addStretch(1) self.checkBox.stateChanged.connect(self.updateState) return hbox
Example #24
Source File: toolwidget.py From LCInterlocking with GNU Lesser General Public License v2.1 | 5 votes |
def create_item(self, widget_config, grid, row_index): widget_config.widget_title = QtGui.QLabel(self.form) widget_config.widget_title.setText("%s : " % widget_config.show_name) if widget_config.type == float and not hasattr(widget_config, 'step'): widget_config.widget = QtGui.QLabel(self.form) widget_config.widget.setText("%f" % self.get_property_value(widget_config.name)) elif widget_config.type == float: widget_config.widget = QtGui.QDoubleSpinBox(self.form) widget_config.widget.setDecimals(widget_config.decimals) widget_config.widget.setSingleStep(widget_config.step) widget_config.widget.setMinimum(widget_config.interval_value[0]) widget_config.widget.setMaximum(widget_config.interval_value[-1]) widget_config.widget.setValue(self.get_property_value(widget_config.name)) elif widget_config.type == bool: widget_config.widget = QtGui.QCheckBox("", self.form) state = QtCore.Qt.Checked if self.get_property_value(widget_config.name) == True else QtCore.Qt.Unchecked widget_config.widget.setCheckState(state) elif widget_config.type == list: widget_config.widget = QtGui.QComboBox(self.form) widget_config.widget.addItems(widget_config.interval_value) default_value_index = 0 for str_value in widget_config.interval_value: if self.get_property_value(widget_config.name) == str_value: break default_value_index += 1 if default_value_index == len(widget_config.interval_value): raise ValueError("Default value not found for list" + widget_config.name) widget_config.widget.setCurrentIndex(default_value_index) widget_config.widget.currentIndexChanged.connect(self.listchangeIndex) elif widget_config.type == str: widget_config.widget = QtGui.QLineEdit(self.form) widget_config.widget.setText(self.get_property_value(widget_config.name)) else: raise ValueError("Undefined widget type") grid.addWidget(widget_config.widget_title, row_index, 0) grid.addWidget(widget_config.widget, row_index, 1)
Example #25
Source File: crosspiece.py From LCInterlocking with GNU Lesser General Public License v2.1 | 5 votes |
def init_tree_widget(self): #Preview button v_box = QtGui.QVBoxLayout(self.tree_widget) preview_button = QtGui.QPushButton('Preview', self.tree_widget) preview_button.clicked.connect(self.preview) #self.fast_preview = QtGui.QCheckBox("Fast preview", self.tree_widget) line = QtGui.QFrame(self.tree_widget) line.setFrameShape(QtGui.QFrame.HLine); line.setFrameShadow(QtGui.QFrame.Sunken); h_box = QtGui.QHBoxLayout(self.tree_widget) h_box.addWidget(preview_button) #h_box.addWidget(self.fast_preview) v_box.addLayout(h_box) v_box.addWidget(line) self.tree_vbox.addLayout(v_box) # Add part buttons h_box = QtGui.QHBoxLayout(self.tree_widget) add_parts_button = QtGui.QPushButton('Add parts', self.tree_widget) add_parts_button.clicked.connect(self.add_parts) add_same_part_button = QtGui.QPushButton('Add same parts', self.tree_widget) add_same_part_button.clicked.connect(self.add_same_parts) h_box.addWidget(add_parts_button) h_box.addWidget(add_same_part_button) self.tree_vbox.addLayout(h_box) # tree self.selection_model = self.tree_view_widget.selectionModel() self.selection_model.selectionChanged.connect(self.selection_changed) self.tree_vbox.addWidget(self.tree_view_widget) remove_item_button = QtGui.QPushButton('Remove item', self.tree_widget) remove_item_button.clicked.connect(self.remove_items) self.tree_vbox.addWidget(remove_item_button) # test layout self.edit_items_layout = QtGui.QVBoxLayout(self.tree_widget) self.tree_vbox.addLayout(self.edit_items_layout)
Example #26
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 #27
Source File: options.py From dpa-pipe with MIT License | 5 votes |
def __init__(self, name, config, parent=None): ActionOption.__init__(self, name, config) QtGui.QCheckBox.__init__(self, parent=parent) self.setChecked(bool(self.default)) self.setDisabled(bool(self.disabled)) self.setToolTip(self.tooltip) self.stateChanged.connect(lambda s: self.value_changed.emit()) # -----------------------------------------------------------------------------
Example #28
Source File: QtShim.py From grap with MIT License | 5 votes |
def get_QCheckBox(): """QCheckBox getter.""" try: import PySide.QtGui as QtGui return QtGui.QCheckBox except ImportError: import PyQt5.QtWidgets as QtWidgets return QtWidgets.QCheckBox
Example #29
Source File: vfpfunc.py From vfp2py with MIT License | 5 votes |
def __init__(self, *args, **kwargs): QtGui.QCheckBox.__init__(self) Custom.__init__(self, *args, **kwargs) self.clicked.connect(self.click) self.clicked.connect(self.interactivechange)
Example #30
Source File: infoPartCmd.py From FreeCAD_Assembly4 with GNU Lesser General Public License v2.1 | 5 votes |
def drawUI(self): # Place the widgets with layouts self.mainLayout = QtGui.QVBoxLayout(self.form) self.formLayout = QtGui.QFormLayout() for prop in self.infoTable: checkLayout = QtGui.QHBoxLayout() propValue = QtGui.QLineEdit() propValue.setText( prop[1] ) checked = QtGui.QCheckBox() checkLayout.addWidget(propValue) checkLayout.addWidget(checked) self.formLayout.addRow(QtGui.QLabel(prop[0]),checkLayout) self.mainLayout.addLayout(self.formLayout) self.mainLayout.addWidget(QtGui.QLabel()) # Buttons self.buttonsLayout = QtGui.QHBoxLayout() self.AddNew = QtGui.QPushButton('Add New Info') self.Delete = QtGui.QPushButton('Delete Selected') self.buttonsLayout.addWidget(self.AddNew) self.buttonsLayout.addStretch() self.buttonsLayout.addWidget(self.Delete) self.mainLayout.addLayout(self.buttonsLayout) self.form.setLayout(self.mainLayout) # Actions