当前位置: 首页>>代码示例>>Python>>正文


Python QtCore.QDate方法代码示例

本文整理汇总了Python中PyQt4.QtCore.QDate方法的典型用法代码示例。如果您正苦于以下问题:Python QtCore.QDate方法的具体用法?Python QtCore.QDate怎么用?Python QtCore.QDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.QtCore的用法示例。


在下文中一共展示了QtCore.QDate方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QDate [as 别名]
def __init__(self, title="Calendar"):
        super(CalendarWidget, self).__init__()

        self.setWindowTitle(title)
        layout = qt_widgets.QGridLayout()
        layout.setColumnStretch(1, 1)

        self.cal = qt_widgets.QCalendarWidget(self)
        self.cal.setGridVisible(True)
        self.cal.clicked[QtCore.QDate].connect(self.show_date)
        layout.addWidget(self.cal, 0, 0, 1, 2)

        self.date_label = qt_widgets.QLabel()
        self.date = self.cal.selectedDate()
        self.date_label.setText(self.date.toString())
        layout.addWidget(self.date_label, 1, 0)

        button_box = qt_widgets.QDialogButtonBox()
        confirm_button = button_box.addButton(qt_widgets.QDialogButtonBox.Ok)
        confirm_button.clicked.connect(self.confirm)
        layout.addWidget(button_box, 1, 1)

        self.setLayout(layout)
        self.show()
        self.raise_() 
开发者ID:aroberge,项目名称:easygui_qt,代码行数:27,代码来源:calendar_widget.py

示例2: __setitem__

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QDate [as 别名]
def __setitem__(self, key, value):
		isDate = False
		if isinstance(value, QDate):
			value = value.toString('MM/dd/yyyy')
			isDate = True
		elif isinstance(value, date):
			value = value.strftime('%m/%d/%Y')
			isDate = True
		elif not isinstance(value, (float, int, str, unicode, QString)):
			value = repr(value)
		# addProperty is also setProperty
		if isDate:
			mxs.fileProperties.addProperty(self.customName, key, value, mxs.pyhelper.namify('date'))
		else:
			mxs.fileProperties.addProperty(self.customName, key, value)
		self.emitChange(key) 
开发者ID:blurstudio,项目名称:cross3d,代码行数:18,代码来源:studiomaxuserprops.py

示例3: __init__

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QDate [as 别名]
def __init__(self):

        super(self.__class__, self).__init__()
        self.setupUi(self)
        self.start_date = '1984-04-25'
        # Sets end date to current date.
        self.end_date = str((QtCore.QDate.currentDate()).toString('yyyy-MM-dd'))
        self.selected_lake = 'Lake Tahoe'
        self.selectlakeDropMenu.activated[str].connect(self.selectLakeHandle)
        self.okBtn.clicked.connect(self.okHandle)
        # Sets end date as current date. Couldn't set this option in QT Designer
        self.endDate.setDate(QtCore.QDate.currentDate())
        self.endDate.dateChanged[QtCore.QDate].connect(self.endHandle)
        self.startDate.dateChanged[QtCore.QDate].connect(self.startHandle)
        self.faiState = False
        self.ndtiState = False
        self.completedSignal.connect(self.completeLakeThread, QtCore.Qt.QueuedConnection) 
开发者ID:nasa,项目名称:CrisisMappingToolkit,代码行数:19,代码来源:measure_interface.py

示例4: add_non_entity_parent

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QDate [as 别名]
def add_non_entity_parent(self, layer_icon):
        """
        Adds details of layers that are view based.
        :param layer_icon: The icon of the tree node.
        :type layer_icon: QIcon
        """
        for feature_map in self.features_data():
            parent = QStandardItem(
                layer_icon,
                format_name(unicode(self.layer.name()))
            )
            for k, v, in feature_map.iteritems():
                if isinstance(v, QDate):
                    v = v.toPyDate()
                if isinstance(v, QDateTime):
                    v = v.toPyDateTime()
                if k != 'id':
                    child = QStandardItem(u'{}: {}'.format(
                        format_name(k, False), v)
                    )
                    child.setSelectable(False)
                    parent.appendRow([child])
            self.model.appendRow(parent)
            self.set_bold(parent)
            self.expand_node(parent) 
开发者ID:gltn,项目名称:stdm,代码行数:27,代码来源:feature_details.py

示例5: to_pydate

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QDate [as 别名]
def to_pydate(self, q_date):
        """
        Converts QDate to normal python date
        :param q_date: PyQT QDate type
        :type q_date: QDate
        :return: Python date
        :rtype: datetime.date
        """
        return q_date.toPyDate() if isinstance(q_date, QDate) else q_date 
开发者ID:gltn,项目名称:stdm,代码行数:11,代码来源:str_data.py

示例6: _addFeatures

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QDate [as 别名]
def _addFeatures(self, addedFeatures):
        for featureID, feature in addedFeatures.iteritems():
            QgsMessageLog.logMessage('Add feature with feature ID: ' + str(featureID), 'CartoDB Plugin', QgsMessageLog.INFO)
            sql = "INSERT INTO " + self._schema() + self.cartoTable + " ("
            addComma = False

            fieldsStr = ""
            valuesStr = ""
            for field in feature.fields():
                value = feature[field.name()]
                if unicode(value) == 'NULL' or value is None:
                    continue
                elif isinstance(value, QDate):
                    if value.isNull():
                        continue
                    else:
                        value = value.toString(Qt.ISODate)

                if addComma:
                    fieldsStr = fieldsStr + ", "
                    valuesStr = valuesStr + ", "

                fieldsStr = fieldsStr + field.name()
                valuesStr = valuesStr + "'" + unicode(value) + "'"
                addComma = True

            if feature.geometry() is not None:
                if addComma:
                    fieldsStr = fieldsStr + ", "
                    valuesStr = valuesStr + ", "

                fieldsStr = fieldsStr + "the_geom"
                valuesStr = valuesStr + "ST_GeomFromText('" + feature.geometry().exportToWkt() + "', 4326)"

            sql = sql + fieldsStr + ") VALUES (" + valuesStr + ") RETURNING cartodb_id"

            nullableFields = ['cartodb_id']
            if feature.fieldNameIndex("created_at") != -1:
                sql = sql + ", created_at"
                nullableFields.append('created_at')
            if feature.fieldNameIndex("updated_at") != -1:
                sql = sql + ", updated_at"
                nullableFields.append('updated_at')

            sql = sql.encode('utf-8')

            res = self._updateSQL(sql, 'Some error ocurred inserting feature')
            if isinstance(res, dict) and res['total_rows'] == 1:
                self.iface.messageBar().pushMessage('Info',
                                                    'Feature inserted at CartoDB servers',
                                                    level=self.iface.messageBar().INFO, duration=10)
                for f in nullableFields:
                    self._updateNullableFields(featureID, f, res['rows'][0][f]) 
开发者ID:gkudos,项目名称:qgis-cartodb,代码行数:55,代码来源:CartoDBLayer.py


注:本文中的PyQt4.QtCore.QDate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。