本文整理汇总了Python中PySide.QtGui.QFormLayout方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QFormLayout方法的具体用法?Python QtGui.QFormLayout怎么用?Python QtGui.QFormLayout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui
的用法示例。
在下文中一共展示了QtGui.QFormLayout方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: quickLayout
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QFormLayout [as 别名]
def quickLayout(self, type, ui_name=""):
the_layout = ''
if type in ("form", "QFormLayout"):
the_layout = QtWidgets.QFormLayout()
the_layout.setLabelAlignment(QtCore.Qt.AlignLeft)
the_layout.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)
elif type in ("grid", "QGridLayout"):
the_layout = QtWidgets.QGridLayout()
elif type in ("hbox", "QHBoxLayout"):
the_layout = QtWidgets.QHBoxLayout()
the_layout.setAlignment(QtCore.Qt.AlignTop)
else:
the_layout = QtWidgets.QVBoxLayout()
the_layout.setAlignment(QtCore.Qt.AlignTop)
if ui_name != "":
self.uiList[ui_name] = the_layout
return the_layout
示例2: quickLayout
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QFormLayout [as 别名]
def quickLayout(self, type, ui_name=""):
the_layout = ''
if type in ("form", "QFormLayout"):
the_layout = QtGui.QFormLayout()
the_layout.setLabelAlignment(QtCore.Qt.AlignLeft)
the_layout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
elif type in ("grid", "QGridLayout"):
the_layout = QtGui.QGridLayout()
elif type in ("hbox", "QHBoxLayout"):
the_layout = QtGui.QHBoxLayout()
the_layout.setAlignment(QtCore.Qt.AlignTop)
else:
the_layout = QtGui.QVBoxLayout()
the_layout.setAlignment(QtCore.Qt.AlignTop)
if ui_name != "":
self.uiList[ui_name] = the_layout
return the_layout
示例3: drawUI
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QFormLayout [as 别名]
def drawUI(self):
# Our main layoyt will be vertical
self.mainLayout = QtGui.QVBoxLayout(self.form)
# Define the fields for the form ( label + widget )
self.formLayout = QtGui.QFormLayout()
# Datum Type
self.datumType = QtGui.QLineEdit()
self.datumType.setReadOnly(True)
self.formLayout.addRow(QtGui.QLabel('Datum Type'),self.datumType)
# Datum Object
self.datumOrig = QtGui.QLineEdit()
self.datumOrig.setReadOnly(True)
self.formLayout.addRow(QtGui.QLabel('Orig. Datum'),self.datumOrig)
# Link instance
self.linkName = QtGui.QLineEdit()
self.linkName.setReadOnly(True)
self.formLayout.addRow(QtGui.QLabel('Orig. Instance'),self.linkName)
# Orig Part
self.partName = QtGui.QLineEdit()
self.partName.setReadOnly(True)
self.formLayout.addRow(QtGui.QLabel('Orig. Doc#Part'),self.partName)
# apply the layout
self.mainLayout.addLayout(self.formLayout)
# empty line
self.mainLayout.addWidget(QtGui.QLabel())
# the name as seen in the tree of the selected link
self.datumName = QtGui.QLineEdit()
self.mainLayout.addWidget(QtGui.QLabel("Enter the imported Datum's name :"))
self.mainLayout.addWidget(self.datumName)
# set main window widgets
self.form.setLayout(self.mainLayout)
示例4: drawUI
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QFormLayout [as 别名]
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
示例5: qui
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QFormLayout [as 别名]
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)
示例6: qui
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QFormLayout [as 别名]
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)
示例7: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QFormLayout [as 别名]
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 = {}
#------------------------------
示例8: qui
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QFormLayout [as 别名]
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)
示例9: setupUi
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QFormLayout [as 别名]
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.setWindowModality(QtCore.Qt.ApplicationModal)
Dialog.resize(364, 138)
Dialog.setModal(True)
self.verticalLayout = QtGui.QVBoxLayout(Dialog)
self.verticalLayout.setObjectName("verticalLayout")
self.formLayout = QtGui.QFormLayout()
self.formLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
self.formLayout.setContentsMargins(-1, 10, -1, -1)
self.formLayout.setObjectName("formLayout")
self.login_or_email_label = QtGui.QLabel(Dialog)
self.login_or_email_label.setObjectName("login_or_email_label")
self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.login_or_email_label)
self.login_or_email_lineEdit = QtGui.QLineEdit(Dialog)
self.login_or_email_lineEdit.setInputMask("")
self.login_or_email_lineEdit.setObjectName("login_or_email_lineEdit")
self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.login_or_email_lineEdit)
self.password_label = QtGui.QLabel(Dialog)
self.password_label.setObjectName("password_label")
self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.password_label)
self.password_lineEdit = QtGui.QLineEdit(Dialog)
self.password_lineEdit.setInputMask("")
self.password_lineEdit.setText("")
self.password_lineEdit.setEchoMode(QtGui.QLineEdit.Password)
self.password_lineEdit.setObjectName("password_lineEdit")
self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.password_lineEdit)
self.buttonBox = QtGui.QDialogButtonBox(Dialog)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.buttonBox)
self.verticalLayout.addLayout(self.formLayout)
self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)
示例10: setupUi
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QFormLayout [as 别名]
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(923, 542)
self.verticalLayout = QtGui.QVBoxLayout(Dialog)
self.verticalLayout.setObjectName("verticalLayout")
self.formLayout = QtGui.QFormLayout()
self.formLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
self.formLayout.setObjectName("formLayout")
self.media_files_path_lineEdit = QtGui.QLineEdit(Dialog)
self.media_files_path_lineEdit.setObjectName("media_files_path_lineEdit")
self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.media_files_path_lineEdit)
self.label = QtGui.QLabel(Dialog)
self.label.setObjectName("label")
self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.label)
self.label_2 = QtGui.QLabel(Dialog)
self.label_2.setObjectName("label_2")
self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.label_2)
self.verticalLayout.addLayout(self.formLayout)
self.edl_preview_plainTextEdit = QtGui.QPlainTextEdit(Dialog)
self.edl_preview_plainTextEdit.setReadOnly(True)
self.edl_preview_plainTextEdit.setObjectName("edl_preview_plainTextEdit")
self.verticalLayout.addWidget(self.edl_preview_plainTextEdit)
self.horizontalLayout_2 = QtGui.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.send_pushButton = QtGui.QPushButton(Dialog)
self.send_pushButton.setObjectName("send_pushButton")
self.horizontalLayout_2.addWidget(self.send_pushButton)
self.verticalLayout.addLayout(self.horizontalLayout_2)
self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)
Dialog.setTabOrder(self.media_files_path_lineEdit, self.edl_preview_plainTextEdit)
Dialog.setTabOrder(self.edl_preview_plainTextEdit, self.send_pushButton)
示例11: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QFormLayout [as 别名]
def __init__(self):
super(Graduation_Widget, self).__init__()
# Grad type dropdown
type_label = QtGui.QLabel("Graduation Criterion:")
self.type_selection = QtGui.QComboBox()
self.type_selection.insertItems(0, tasks.GRAD_LIST.keys())
self.type_selection.currentIndexChanged.connect(self.populate_params)
# Param form
self.param_layout = QtGui.QFormLayout()
layout = QtGui.QVBoxLayout()
layout.addWidget(type_label)
layout.addWidget(self.type_selection)
layout.addLayout(self.param_layout)
self.setLayout(layout)
self.param_dict = {}
self.type = ""
self.set_graduation = None
self.populate_params()
示例12: initUI
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QFormLayout [as 别名]
def initUI(self):
self.setWindowTitle("QueryTool")
self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
self.setMouseTracking(True)
#1st row
self.labName = QtGui.QLabel("(seleziona un oggetto)", self)
#2nd row
self.labBaseVal = QtGui.QLabel("(base)", self)
self.subFLayout1=QtGui.QFormLayout()
self.subFLayout1.addRow('Base: ',self.labBaseVal)
#3rd row
self.labRotAng = QtGui.QLabel("(angle)", self)
self.subFLayout2=QtGui.QFormLayout()
self.subFLayout2.addRow('Rotation angle: ',self.labRotAng)
# 4th row
self.labRotAx = QtGui.QLabel("v = (x,y,z)", self)
self.subFLayout3=QtGui.QFormLayout()
self.subFLayout3.addRow('Rotation axis: ',self.labRotAx)
# 5th row
self.labSubObj = QtGui.QLabel("(Sub object property)", self)
# 6th row
self.labBeam = QtGui.QLabel("(Beam property)", self)
# 7th row
self.labProfile = QtGui.QLabel("(Profile property)", self)
# 8th row
self.pushButton1 = QtGui.QPushButton('QueryObject')
self.pushButton1.setDefault(True)
self.pushButton1.clicked.connect(self.onPushButton1)
self.pushButton1.setMinimumWidth(90)
self.cancelButton = QtGui.QPushButton('Exit')
self.cancelButton.clicked.connect(self.onCancel)
self.subHLayout1=QtGui.QHBoxLayout()
self.subHLayout1.addWidget(self.pushButton1)
self.subHLayout1.addWidget(self.cancelButton)
# arrange the layout
self.mainVLayout=QtGui.QVBoxLayout()
self.mainVLayout.addWidget(self.labName)
self.mainVLayout.addLayout(self.subFLayout1)
self.mainVLayout.addLayout(self.subFLayout2)
self.mainVLayout.addLayout(self.subFLayout3)
self.mainVLayout.addWidget(self.labSubObj)
self.mainVLayout.addWidget(self.labBeam)
self.mainVLayout.addWidget(self.labProfile)
self.mainVLayout.addLayout(self.subHLayout1)
QtGui.QWidget.setLayout(self,self.mainVLayout)
# now make the window visible
self.show()
示例13: drawUI
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QFormLayout [as 别名]
def drawUI(self):
# Build the window layout
self.mainLayout = QtGui.QVBoxLayout()
# the name as seen in the tree of the selected link
self.formLayout = QtGui.QFormLayout()
self.FStype = QtGui.QLineEdit()
self.FStype.setReadOnly(True)
self.formLayout.addRow(QtGui.QLabel('Fastener :'),self.FStype)
# combobox showing all available App::Link
self.parentList = QtGui.QComboBox()
self.formLayout.addRow(QtGui.QLabel('Attach to :'),self.parentList)
self.mainLayout.addLayout(self.formLayout)
# the document containing the linked object
self.parentDoc = QtGui.QLineEdit()
self.parentDoc.setReadOnly(True)
self.mainLayout.addWidget(self.parentDoc)
# The list of all attachment LCS in the assembly is a QListWidget
# it is populated only when the parent combo-box is activated
self.mainLayout.addWidget(QtGui.QLabel("Select attachment LCS in parent Part :"))
self.attLCSlist = QtGui.QListWidget()
self.mainLayout.addWidget(self.attLCSlist)
# Rotation Buttons
self.rotButtonsLayout = QtGui.QHBoxLayout()
self.RotXButton = QtGui.QPushButton('Rot X')
self.RotXButton.setToolTip("Rotate the instance around the X axis by 90deg")
self.RotYButton = QtGui.QPushButton('Rot Y')
self.RotYButton.setToolTip("Rotate the instance around the Y axis by 90deg")
self.RotZButton = QtGui.QPushButton('Rot Z')
self.RotZButton.setToolTip("Rotate the instance around the Z axis by 90deg")
# add the buttons
self.rotButtonsLayout.addStretch()
self.rotButtonsLayout.addWidget(self.RotXButton)
self.rotButtonsLayout.addWidget(self.RotYButton)
self.rotButtonsLayout.addWidget(self.RotZButton)
self.rotButtonsLayout.addStretch()
self.mainLayout.addLayout(self.rotButtonsLayout)
# apply the layout to the main window
self.form.setLayout(self.mainLayout)
# Actions
self.parentList.currentIndexChanged.connect( self.onParentList )
self.attLCSlist.itemClicked.connect( self.onDatumClicked )
self.RotXButton.clicked.connect( self.onRotX )
self.RotYButton.clicked.connect( self.onRotY )
self.RotZButton.clicked.connect( self.onRotZ)
示例14: drawUI
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QFormLayout [as 别名]
def drawUI(self):
# Our main window will be a QDialog
# make this dialog stay above the others, always visible
self.UI.setWindowFlags( QtCore.Qt.WindowStaysOnTopHint )
self.UI.setWindowTitle('Add Variable')
self.UI.setWindowIcon( QtGui.QIcon( os.path.join( Asm4.iconPath , 'FreeCad.svg' ) ) )
self.UI.setMinimumWidth(470)
self.UI.resize(470,300)
self.UI.setModal(False)
# the layout for the main window is vertical (top to down)
self.mainLayout = QtGui.QVBoxLayout(self.UI)
# Define the fields for the form ( label + widget )
self.formLayout = QtGui.QFormLayout()
# Variable Type, combobox showing all available App::PropertyType
self.typeList = QtGui.QComboBox()
self.formLayout.addRow(QtGui.QLabel('Type'),self.typeList)
# Variable Name
self.varName = QtGui.QLineEdit()
self.formLayout.addRow(QtGui.QLabel('Name'),self.varName)
# Variable Value
self.varValue = QtGui.QDoubleSpinBox()
self.varValue.setRange( -1000000.0, 1000000.0 )
self.formLayout.addRow(QtGui.QLabel('Value'),self.varValue)
# Documentation
self.description = QtGui.QTextEdit()
self.formLayout.addRow(QtGui.QLabel('Description'),self.description)
# apply the layout
self.mainLayout.addLayout(self.formLayout)
self.mainLayout.addStretch()
# Buttons
self.buttonLayout = QtGui.QHBoxLayout()
# Cancel button
self.CancelButton = QtGui.QPushButton('Cancel')
# OK button
self.OkButton = QtGui.QPushButton('OK')
self.OkButton.setDefault(True)
# the button layout
self.buttonLayout.addWidget(self.CancelButton)
self.buttonLayout.addStretch()
self.buttonLayout.addWidget(self.OkButton)
self.mainLayout.addLayout(self.buttonLayout)
# finally, apply the layout to the main window
self.UI.setLayout(self.mainLayout)
# Actions
self.CancelButton.clicked.connect(self.onCancel)
self.OkButton.clicked.connect(self.onOK)
示例15: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QFormLayout [as 别名]
def __init__(self, parent=None, mode=0):
QtWidgets.QMainWindow.__init__(self, parent)
#------------------------------
# class variables
#------------------------------
self.version = '0.1'
self.date = '2017.01.01'
self.log = 'no version log in user class'
self.help = 'no help guide in user class'
self.hotkey = {}
self.uiList={} # for ui obj storage
self.memoData = {} # key based variable data storage
self.memoData['font_size_default'] = QtGui.QFont().pointSize()
self.memoData['font_size'] = self.memoData['font_size_default']
self.memoData['last_export'] = ''
self.memoData['last_import'] = ''
self.name = self.__class__.__name__
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.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',
'menu' : 'QMenu', 'menubar' : 'QMenuBar',
}
self.qui_user_dict = {}