本文整理匯總了Python中PyQt4.QtGui.QDateEdit.setEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Python QDateEdit.setEnabled方法的具體用法?Python QDateEdit.setEnabled怎麽用?Python QDateEdit.setEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt4.QtGui.QDateEdit
的用法示例。
在下文中一共展示了QDateEdit.setEnabled方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: TalkDetailsWidget
# 需要導入模塊: from PyQt4.QtGui import QDateEdit [as 別名]
# 或者: from PyQt4.QtGui.QDateEdit import setEnabled [as 別名]
class TalkDetailsWidget(QWidget):
def __init__(self, parent=None):
super(TalkDetailsWidget, self).__init__(parent)
self.layout = QGridLayout()
self.setLayout(self.layout)
self.buttonLayout = QHBoxLayout()
saveIcon = QIcon.fromTheme("document-save")
self.saveButton = QPushButton('Save Talk')
self.saveButton.setIcon(saveIcon)
self.buttonLayout.addWidget(self.saveButton)
self.layout.addLayout(self.buttonLayout, 0, 1, 1, 1)
self.titleLabel = QLabel('Title')
self.titleLineEdit = QLineEdit()
self.presenterLabel = QLabel('Presenter')
self.presenterLineEdit = QLineEdit()
self.layout.addWidget(self.titleLabel, 1, 0, 1, 1)
self.layout.addWidget(self.titleLineEdit, 1, 1, 1, 1)
self.layout.addWidget(self.presenterLabel, 1, 2, 1, 1)
self.layout.addWidget(self.presenterLineEdit, 1, 3, 1, 1)
self.eventLabel = QLabel('Event')
self.eventLineEdit = QLineEdit()
self.categoryLabel = QLabel('Category')
self.categoryLineEdit = QLineEdit()
self.layout.addWidget(self.eventLabel, 2, 0, 1, 1)
self.layout.addWidget(self.eventLineEdit, 2, 1, 1, 1)
self.layout.addWidget(self.categoryLabel, 2, 2, 1, 1)
self.layout.addWidget(self.categoryLineEdit, 2, 3, 1, 1)
self.roomLabel = QLabel('Room')
self.roomLineEdit = QLineEdit()
self.dateLayout = QHBoxLayout()
self.dateLabel = QLabel('Date')
self.dateEdit = QDateEdit()
currentDate = QDate()
self.dateEdit.setDate(currentDate.currentDate())
self.dateEdit.setCalendarPopup(True)
self.layout.addWidget(self.roomLabel, 3, 0, 1, 1)
self.layout.addWidget(self.roomLineEdit, 3, 1, 1, 1)
self.dateLayout.addWidget(self.dateEdit)
self.layout.addWidget(self.dateLabel, 3, 2, 1, 1)
self.layout.addLayout(self.dateLayout, 3, 3, 1, 1)
self.startTimeLayout = QHBoxLayout()
self.startTimeLabel = QLabel('Start Time')
self.startTimeEdit = QTimeEdit()
self.startTimeLayout.addWidget(self.startTimeEdit)
self.endTimeLayout = QHBoxLayout()
self.endTimeLabel = QLabel('End Time')
self.endTimeEdit = QTimeEdit()
self.endTimeLayout.addWidget(self.endTimeEdit)
self.layout.addWidget(self.startTimeLabel, 4, 0, 1, 1)
self.layout.addLayout(self.startTimeLayout, 4, 1, 1, 1)
self.layout.addWidget(self.endTimeLabel, 4, 2, 1, 1)
self.layout.addLayout(self.endTimeLayout, 4, 3, 1, 1)
self.descriptionLabel = QLabel('Description')
self.descriptionLabel.setAlignment(Qt.AlignTop)
self.descriptionTextEdit = QPlainTextEdit()
self.layout.addWidget(self.descriptionLabel, 5, 0, 1, 1)
self.layout.addWidget(self.descriptionTextEdit, 5, 1, 1, 3)
def enable_input_fields(self):
self.titleLineEdit.setPlaceholderText("Enter Talk Title")
self.presenterLineEdit.setPlaceholderText("Enter Presenter Name")
self.categoryLineEdit.setPlaceholderText("Enter Category Type")
self.eventLineEdit.setPlaceholderText("Enter Event Name")
self.roomLineEdit.setPlaceholderText("Enter Room Location")
self.titleLineEdit.setEnabled(True)
self.presenterLineEdit.setEnabled(True)
self.categoryLineEdit.setEnabled(True)
self.eventLineEdit.setEnabled(True)
self.roomLineEdit.setEnabled(True)
self.dateEdit.setEnabled(True)
self.startTimeEdit.setEnabled(True)
self.endTimeEdit.setEnabled(True)
self.descriptionTextEdit.setEnabled(True)
def disable_input_fields(self):
self.titleLineEdit.setPlaceholderText("")
self.presenterLineEdit.setPlaceholderText("")
self.categoryLineEdit.setPlaceholderText("")
self.eventLineEdit.setPlaceholderText("")
self.roomLineEdit.setPlaceholderText("")
self.titleLineEdit.setEnabled(False)
self.presenterLineEdit.setEnabled(False)
self.categoryLineEdit.setEnabled(False)
self.eventLineEdit.setEnabled(False)
self.roomLineEdit.setEnabled(False)
self.dateEdit.setEnabled(False)
self.startTimeEdit.setEnabled(False)
#.........這裏部分代碼省略.........
示例2: LDSControls
# 需要導入模塊: from PyQt4.QtGui import QDateEdit [as 別名]
# 或者: from PyQt4.QtGui.QDateEdit import setEnabled [as 別名]
class LDSControls(QFrame):
STATIC_IMG = ('error_static.png','linz_static.png','busy_static.png','clean_static.png')
ANIM_IMG = ('error.gif','linz.gif','layer.gif','clean.gif')
IMG_SPEED = 100
IMG_WIDTH = 64
IMG_HEIGHT = 64
MAX_WD = 450
GD_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../../bin/gdal/gdal-data'))
STATUS = LU.enum('ERROR','IDLE','BUSY','CLEAN')
def __init__(self,parent):
super(LDSControls, self).__init__()
self.parent = parent
self.initConf()
self.initEPSG()
self.initUI()
def initConf(self):
'''Read files in conf dir ending in conf'''
self.cflist = ConfigInitialiser.getConfFiles()
#self.imgset = self.STATIC_IMG if ConfigWrapper().readDSProperty('Misc','indicator')=='static' else self.ANIM_IMG
#self.imgset = self.STATIC_IMG if self.parent.confconn.tp.src.confwrap.readDSProperty('Misc','indicator')=='static' else self.ANIM_IMG
sep = self.parent.confconn.reg.openEndPoint(self.parent.confconn.SRCNAME,self.parent.confconn.uconf)
self.imgset = self.STATIC_IMG if sep.confwrap.readDSProperty('Misc','indicator')=='static' else self.ANIM_IMG
self.parent.confconn.reg.closeEndPoint(self.parent.confconn.SRCNAME)
def initEPSG(self):
'''Read GDAL EPSG files, splitting by NZ(RSR) and RestOfTheWorld'''
gcsf = gdal.FindFile('gdal','gcs.csv')
if not gcsf:
gcsf = os.path.join(self.GD_PATH,'gcs.csv')
pcsf = gdal.FindFile('gdal','pcs.csv')
if not pcsf:
pcsf = os.path.join(self.GD_PATH,'pcs.csv')
gcs = ConfigInitialiser.readCSV(gcsf)
pcs = ConfigInitialiser.readCSV(pcsf)
self.nzlsr = [(e[0],e[0]+' - '+e[3]) for e in gcs if 'NZGD' in e[1] or 'RSRGD' in e[1]] \
+ [(e[0],e[0]+' - '+e[1]) for e in pcs if 'NZGD' in e[1] or 'RSRGD' in e[1]]
self.rowsr = [(e[0],e[0]+' - '+e[3]) for e in gcs if 'NZGD' not in e[1] and 'RSRGD' not in e[1]] \
+ [(e[0],e[0]+' - '+e[1]) for e in pcs if 'NZGD' not in e[1] and 'RSRGD' not in e[1]]
def initUI(self):
# 0 1 2 3 4 5 6 7 8
#'destname','lgselect','layer','uconf','group','epsg','fd','td','int'
#self.rdest,rlgselect,self.rlayer,ruconf,self.rgroup,repsg,rfd,rtd,rint = readlist
QToolTip.setFont(QFont('SansSerif', 10))
#labels
destLabel = QLabel('Destination')
lgLabel = QLabel('Group/Layer')
epsgLabel = QLabel('EPSG')
fromDateLabel = QLabel('From Date')
toDateLabel = QLabel('To Date')
confLabel = QLabel('User Config')
self.view = QLabel()
self.view.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
self.view.setAlignment(Qt.AlignCenter)
self.confcombo = QComboBox(self)
self.confcombo.setToolTip('Enter your user config name (file) here')
self.confcombo.addItems(self.cflist)
self.confcombo.setEditable(False)
#self.confcombo.currentIndexChanged.connect(self.doLGEditUpdate)
#combos
self.lgcombo = QComboBox(self)
self.lgcombo.setMaximumWidth(self.MAX_WD)
self.lgcombo.setDuplicatesEnabled(False)
#self.lgcombo.setInsertPolicy(QComboBox.InsertAlphabetically)#?doesnt seem to work
self.lgcombo.setToolTip('Select either Layer or Group entry')
self.lgcombo.setEditable(False)
self.sepindex = None
#self.updateLGValues()
self.epsgcombo = QComboBox(self)
self.epsgcombo.setMaximumWidth(self.MAX_WD)
self.epsgcombo.setToolTip('Setting an EPSG number here determines the output SR of the layer')
self.epsgcombo.addItems([i[1] for i in self.nzlsr])
self.epsgcombo.insertSeparator(len(self.nzlsr))
self.epsgcombo.addItems([i[1] for i in self.rowsr])
self.epsgcombo.setEditable(True)
self.epsgcombo.setEnabled(False)
self.destlist = self.getConfiguredDestinations()
self.destcombo = QComboBox(self)
self.destcombo.setToolTip('Choose the desired output type')
self.destcombo.setEditable(False)
self.destcombo.addItems(self.destlist)
#.........這裏部分代碼省略.........