本文整理汇总了Python中PyQt4.QtGui.QDateEdit.setCalendarPopup方法的典型用法代码示例。如果您正苦于以下问题:Python QDateEdit.setCalendarPopup方法的具体用法?Python QDateEdit.setCalendarPopup怎么用?Python QDateEdit.setCalendarPopup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QDateEdit
的用法示例。
在下文中一共展示了QDateEdit.setCalendarPopup方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createEditor
# 需要导入模块: from PyQt4.QtGui import QDateEdit [as 别名]
# 或者: from PyQt4.QtGui.QDateEdit import setCalendarPopup [as 别名]
def createEditor(self, parent, option, index):
dateedit = QDateEdit(parent)
dateedit.setDateRange(self.minimum, self.maximum)
dateedit.setAlignment(Qt.AlignRight|Qt.AlignVCenter)
dateedit.setDisplayFormat(self.format)
dateedit.setCalendarPopup(True)
return dateedit
示例2: CatalogFilterDate
# 需要导入模块: from PyQt4.QtGui import QDateEdit [as 别名]
# 或者: from PyQt4.QtGui.QDateEdit import setCalendarPopup [as 别名]
class CatalogFilterDate(CatalogFilter):
def __init__(self, id):
super(CatalogFilterDate, self).__init__(id)
self.label = QLabel(TEXT_LABEL_BETWEEN)
self.datetime_begin_edit = QDateEdit(QDate.currentDate())
self.datetime_end_edit = QDateEdit(QDate.currentDate())
self.datetime_begin_edit.setCalendarPopup(True)
self.datetime_end_edit.setCalendarPopup(True)
self.expand_widget(self.datetime_begin_edit)
self.expand_widget(self.datetime_end_edit)
value_item = QGridLayout()
value_item.addWidget(self.datetime_begin_edit, 0, 0)
value_item.addWidget(QLabel(TEXT_LABEL_AND), 0, 1)
value_item.addWidget(self.datetime_end_edit, 0, 2)
self.value_item = value_item
def get_query_filters(self):
# date request filter values are returned by get_datetime_begin/end
return []
def validate(self, errors):
datetime_begin = self.datetime_begin_edit.dateTime()
datetime_end = self.datetime_end_edit.dateTime()
if datetime_begin.daysTo(datetime_end) < 0:
errors.append("First value must be less than or equal to second for %s filter." % self.column_name)
def get_datetime_begin(self):
return self.datetime_begin_edit.dateTime().toString(DATETIME_FORMAT)
def get_datetime_end(self):
return self.datetime_end_edit.dateTime().toString(DATETIME_FORMAT)
示例3: NewTaskDialog
# 需要导入模块: from PyQt4.QtGui import QDateEdit [as 别名]
# 或者: from PyQt4.QtGui.QDateEdit import setCalendarPopup [as 别名]
class NewTaskDialog(QDialog):
def __init__(self, parent=None):
super(NewTaskDialog, self).__init__(parent)
# task name
nameLabel = QLabel(self.tr("Name:"))
self.name = QLineEdit()
nameLabel.setBuddy(self.name)
# priority
priorityLabel = QLabel(self.tr("Priority:"))
self.priority = QComboBox()
priorityLabel.setBuddy(self.priority)
dateLabel = QLabel(self.tr("Deadline:"))
self.deadline = QDateEdit()
dateLabel.setBuddy(self.deadline)
self.deadline.setCalendarPopup(True)
self.deadline.calendarWidget().setFirstDayOfWeek(Qt.Monday)
self.deadline.setDate(QDate(date.today()))
createButton = QPushButton(self.tr("Save"))
cancelButton = QPushButton(self.tr("Cancel"))
buttonLayout = QHBoxLayout()
buttonLayout.addStretch()
buttonLayout.addWidget(createButton)
buttonLayout.addWidget(cancelButton)
layout = QGridLayout()
layout.addWidget(nameLabel, 0, 0)
layout.addWidget(self.name, 0, 1)
layout.addWidget(priorityLabel, 1, 0)
layout.addWidget(self.priority, 1, 1)
layout.addWidget(dateLabel, 2, 0)
layout.addWidget(self.deadline, 2, 1)
layout.addLayout(buttonLayout, 3, 0, 3, 2)
self.setLayout(layout)
self.connect(self.deadline, SIGNAL("dateChanged(const QDate&)"), self, SLOT("changed()"))
self.connect(createButton, SIGNAL("clicked()"), self, SLOT("accept()"))
self.connect(cancelButton, SIGNAL("clicked()"), self, SLOT("reject()"))
self.setWindowTitle(self.tr("Task"))
self.resize(350, 120)
self.setMinimumSize(QSize(250, 120))
self.setMaximumSize(QSize(450, 120))
@pyqtSlot()
def changed(self):
print(self.deadline.text())
示例4: DlgCredito
# 需要导入模块: from PyQt4.QtGui import QDateEdit [as 别名]
# 或者: from PyQt4.QtGui.QDateEdit import setCalendarPopup [as 别名]
class DlgCredito( QDialog ):
def __init__( self, parent = None ):
super( DlgCredito, self ).__init__( parent )
self.dtFechaTope = QDateEdit( QDate.currentDate().addDays( 1 ) )
self.dtFechaTope.setMinimumDate( QDate.currentDate().addDays( 1 ) )
"""
@ivar: Este widget tiene la fecha tope en la que puede
pagarse el credito
@type: QDateEdit
"""
self.sbTaxRate = QDoubleSpinBox()
"""
@ivar: Este widget contiene la tasa de multa que se
le aplicara a este credito
@typ: QDoubleSpinBox
"""
self.setupUi()
def setupUi( self ):
vertical_layout = QVBoxLayout( self )
form_layout = QFormLayout()
self.dtFechaTope.setCalendarPopup( True )
self.sbTaxRate.setSuffix( '%' )
form_layout.addRow( u"<b>Fecha Tope</b>", self.dtFechaTope )
form_layout.addRow( u"<b>Tasa de multa</b>", self.sbTaxRate )
buttonbox = QDialogButtonBox( QDialogButtonBox.Ok |
QDialogButtonBox.Cancel )
vertical_layout.addLayout( form_layout )
vertical_layout.addWidget( buttonbox )
buttonbox.accepted.connect( self.accept )
buttonbox.rejected.connect( self.reject )
示例5: createEditor
# 需要导入模块: from PyQt4.QtGui import QDateEdit [as 别名]
# 或者: from PyQt4.QtGui.QDateEdit import setCalendarPopup [as 别名]
def createEditor(self, parent, option, index):
if index.column() == DATAINS:
editor = QDateEdit(parent)
editor.setCalendarPopup(True)
editor.setAlignment(Qt.AlignRight|Qt.AlignVCenter)
return editor
elif index.column() == QT:
editor = QLineEdit(parent)
validator = QIntValidator(self)
editor.setValidator(validator)
editor.setAlignment(Qt.AlignRight|Qt.AlignVCenter)
return editor
elif index.column() == IMP:
editor = QLineEdit(parent)
validator = QDoubleValidator(self)
validator.setDecimals(3)
editor.setValidator(validator)
editor.setAlignment(Qt.AlignRight|Qt.AlignVCenter)
return editor
else:
return QSqlRelationalDelegate.createEditor(self, parent, option,
index)
示例6: createEditor
# 需要导入模块: from PyQt4.QtGui import QDateEdit [as 别名]
# 或者: from PyQt4.QtGui.QDateEdit import setCalendarPopup [as 别名]
def createEditor(self, parent, option, index):
editor = QDateEdit(parent)
editor.setCalendarPopup(True)
return editor
示例7: AddTalkWidget
# 需要导入模块: from PyQt4.QtGui import QDateEdit [as 别名]
# 或者: from PyQt4.QtGui.QDateEdit import setCalendarPopup [as 别名]
class AddTalkWidget(QWidget):
'''
classdocs
'''
def __init__(self, parent=None):
'''
Constructor
'''
QWidget.__init__(self, parent)
self.mainLayout = QVBoxLayout()
self.setLayout(self.mainLayout)
self.addTalkGroupBox = QGroupBox("Add Talk")
self.mainLayout.addWidget(self.addTalkGroupBox)
self.addTalkLayout = QFormLayout()
self.addTalkGroupBox.setLayout(self.addTalkLayout)
# Title
self.titleLabel = QLabel("Title")
self.titleLineEdit = QLineEdit()
if hasattr(QLineEdit(), 'setPlaceholderText'):
self.titleLineEdit.setPlaceholderText("Title of the presentation")
self.titleLabel.setBuddy(self.titleLineEdit)
self.addTalkLayout.addRow(self.titleLabel, self.titleLineEdit)
# Presenter
self.presenterLabel = QLabel("Presenter")
self.presenterLineEdit = QLineEdit()
if hasattr(QLineEdit(), 'setPlaceholderText'):
self.presenterLineEdit.setPlaceholderText("Name person or people presenting (comma separated)")
self.presenterLabel.setBuddy(self.presenterLineEdit)
self.addTalkLayout.addRow(self.presenterLabel, self.presenterLineEdit)
# Event
self.eventLabel = QLabel("Event")
self.eventLineEdit = QLineEdit()
if hasattr(QLineEdit(), 'setPlaceholderText'):
self.eventLineEdit.setPlaceholderText("The name of the Event this talk is being presented at")
self.eventLabel.setBuddy(self.eventLineEdit)
self.addTalkLayout.addRow(self.eventLabel, self.eventLineEdit)
# Room
self.roomLabel = QLabel("Room")
self.roomLineEdit = QLineEdit()
if hasattr(QLineEdit(), 'setPlaceholderText'):
self.roomLineEdit.setPlaceholderText("The Room in which the presentation is taking place")
self.roomLabel.setBuddy(self.roomLineEdit)
self.addTalkLayout.addRow(self.roomLabel, self.roomLineEdit)
# Date
current_date = QDate()
self.dateLabel = QLabel("Date")
self.dateEdit = QDateEdit()
self.dateEdit.setDate(current_date.currentDate())
self.dateLabel.setBuddy(self.dateEdit)
self.addTalkLayout.addRow(self.dateLabel, self.dateEdit)
self.dateEdit.setCalendarPopup(True)
# Time
current_time = QTime()
self.timeLabel = QLabel("Time")
self.timeEdit = QTimeEdit()
self.timeEdit.setTime(current_time.currentTime())
self.timeLabel.setBuddy(self.dateEdit)
self.addTalkLayout.addRow(self.timeLabel, self.timeEdit)
# Buttons
addIcon = QIcon.fromTheme("list-add")
cancelIcon = QIcon.fromTheme("edit-clear")
self.buttonsWidget = QHBoxLayout()
self.addButton = QPushButton("Add")
self.addButton.setIcon(addIcon)
self.cancelButton = QPushButton("Cancel")
self.cancelButton.setIcon(cancelIcon)
self.buttonsWidget.addWidget(self.addButton)
self.buttonsWidget.addWidget(self.cancelButton)
self.addTalkLayout.addRow(None, self.buttonsWidget)
示例8: TalkDetailsWidget
# 需要导入模块: from PyQt4.QtGui import QDateEdit [as 别名]
# 或者: from PyQt4.QtGui.QDateEdit import setCalendarPopup [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)
#.........这里部分代码省略.........
示例9: LDSControls
# 需要导入模块: from PyQt4.QtGui import QDateEdit [as 别名]
# 或者: from PyQt4.QtGui.QDateEdit import setCalendarPopup [as 别名]
#.........这里部分代码省略.........
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)
#date selection
self.fromdateedit = QDateEdit()
self.fromdateedit.setCalendarPopup(True)
self.fromdateedit.setEnabled(False)
self.todateedit = QDateEdit()
self.todateedit.setCalendarPopup(True)
self.todateedit.setEnabled(False)
#check boxes
self.epsgenable = QCheckBox()
self.epsgenable.setCheckState(False)
self.epsgenable.clicked.connect(self.doEPSGEnable)
self.fromdateenable = QCheckBox()
self.fromdateenable.setCheckState(False)
self.fromdateenable.clicked.connect(self.doFromDateEnable)
self.todateenable = QCheckBox()
self.todateenable.setCheckState(False)
self.todateenable.clicked.connect(self.doToDateEnable)
self.progressbar = QProgressBar()
self.progressbar.setRange(0,100)
self.progressbar.setVisible(True)
self.progressbar.setMinimumWidth(self.MAX_WD)
#buttons
self.initbutton = QPushButton("waiting")
self.initbutton.setToolTip('Initialise the Layer Configuration')
self.initbutton.clicked.connect(self.doInitClickAction)
self.cleanbutton = QPushButton("Clean")
self.cleanbutton.setToolTip('Clean the selected layer/group from local storage')
示例10: QtDateSelector
# 需要导入模块: from PyQt4.QtGui import QDateEdit [as 别名]
# 或者: from PyQt4.QtGui.QDateEdit import setCalendarPopup [as 别名]
#.........这里部分代码省略.........
""" A Qt implementation of an Enaml ProxyDateSelector.
"""
#: A reference to the widget created by the proxy.
widget = Typed(QDateEdit)
# --------------------------------------------------------------------------
# Initialization API
# --------------------------------------------------------------------------
def create_widget(self):
""" Create the QDateEdit widget.
"""
self.widget = QDateEdit(self.parent_widget())
def init_widget(self):
""" Initialize the widget.
"""
super(QtDateSelector, self).init_widget()
d = self.declaration
self.set_date_format(d.date_format)
self.set_calendar_popup(d.calendar_popup)
self.widget.dateChanged.connect(self.on_date_changed)
# --------------------------------------------------------------------------
# Abstract API Implementation
# --------------------------------------------------------------------------
def get_date(self):
""" Return the current date in the control.
Returns
-------
result : date
The current control date as a date object.
"""
return self.widget.date().toPyDate()
def set_minimum(self, date):
""" Set the widget's minimum date.
Parameters
----------
date : date
The date object to use for setting the minimum date.
"""
self.widget.setMinimumDate(date)
def set_maximum(self, date):
""" Set the widget's maximum date.
Parameters
----------
date : date
The date object to use for setting the maximum date.
"""
self.widget.setMaximumDate(date)
def set_date(self, date):
""" Set the widget's current date.
Parameters
----------
date : date
The date object to use for setting the date.
"""
self._guard |= CHANGED_GUARD
try:
self.widget.setDate(date)
finally:
self._guard &= ~CHANGED_GUARD
def set_date_format(self, format):
""" Set the widget's date format.
Parameters
----------
format : str
A Python time formatting string.
"""
# XXX make sure Python's and Qt's format strings are the
# same, or convert between the two.
self.widget.setDisplayFormat(format)
def set_calendar_popup(self, popup):
""" Set whether a calendar popup is available on the widget.
Parameters
----------
popup : bool
Whether the calendar popup is enabled.
"""
self.widget.setCalendarPopup(popup)