本文整理汇总了Python中PyQt5.QtCore.QDate.currentDate方法的典型用法代码示例。如果您正苦于以下问题:Python QDate.currentDate方法的具体用法?Python QDate.currentDate怎么用?Python QDate.currentDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.QDate
的用法示例。
在下文中一共展示了QDate.currentDate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5.QtCore import QDate [as 别名]
# 或者: from PyQt5.QtCore.QDate import currentDate [as 别名]
def __init__(self):
super(MainWindow, self).__init__()
# setupUi というメソッドが定義されているので実行する
# これで設置したウィジェットなどがインスタンス化される
self.setupUi(self)
# 継承したので self.名前 でアクセスできる
self.setWindowTitle("AgeInDays") # ウィンドウタイトル
# 操作と関数のひも付け
self.pushButton_Go.clicked.connect(self.calculate)
self.pushButton_Clear.clicked.connect(self.textBrowser.clear)
self.change_mode.activated.connect(self.target_mode_change)
self.switch_target_age.activated.connect(self.target_mode_change)
self.switch_target_range.activated.connect(self.target_mode_change)
# 日付入力に今日の日付を挿入
self.input_research_date.setDate(QDate.currentDate())
self.input_birthday.setDate(QDate.currentDate())
# ラジオボタンの初期設定とカレンダーにひも付け
self.switch_birthday.toggled.connect(self.connect_calendar) # ボタングループで判定されるので1つだけ
self.switch_research_date.setChecked(True)
self.switch_birthday.setChecked(False)
# カレンダーのひも付けとUIのデフォルト状態を設定しておく
self.connect_calendar()
self.target_mode_change()
示例2: start_settings
# 需要导入模块: from PyQt5.QtCore import QDate [as 别名]
# 或者: from PyQt5.QtCore.QDate import currentDate [as 别名]
def start_settings(self):
self.de_date_in.setDate(QDate.currentDate().addMonths(-1))
self.de_date_from.setDate(QDate.currentDate())
self.table_widget.horizontalHeader().resizeSection(0, 65)
self.table_widget.horizontalHeader().resizeSection(1, 65)
self.table_widget.horizontalHeader().resizeSection(2, 35)
self.table_widget.horizontalHeader().resizeSection(3, 155)
self.table_widget.horizontalHeader().resizeSection(4, 35)
self.table_widget.horizontalHeader().resizeSection(5, 35)
self.table_widget.horizontalHeader().resizeSection(6, 40)
self.table_widget.horizontalHeader().resizeSection(7, 100)
self.table_widget.horizontalHeader().resizeSection(8, 70)
self.table_widget.horizontalHeader().resizeSection(9, 70)
self.table_widget.horizontalHeader().resizeSection(10, 70)
self.table_widget.horizontalHeader().resizeSection(11, 70)
self.table_widget.horizontalHeader().resizeSection(12, 70)
self.table_widget.horizontalHeader().resizeSection(13, 70)
self.table_widget.horizontalHeader().resizeSection(14, 70)
self.table_widget.horizontalHeader().resizeSection(15, 70)
self.table_widget.horizontalHeader().resizeSection(16, 70)
self.table_widget.horizontalHeader().resizeSection(17, 70)
self.table_widget.horizontalHeader().resizeSection(18, 70)
self.table_widget.horizontalHeader().resizeSection(19, 70)
self.table_widget.horizontalHeader().resizeSection(20, 70)
示例3: start_settings
# 需要导入模块: from PyQt5.QtCore import QDate [as 别名]
# 或者: from PyQt5.QtCore.QDate import currentDate [as 别名]
def start_settings(self):
self.de_date_from.setDate(QDate.currentDate().addDays(-10))
self.de_date_to.setDate(QDate.currentDate())
self.tableWidget.horizontalHeader().resizeSection(0, 65)
self.tableWidget.horizontalHeader().resizeSection(1, 30)
self.tableWidget.horizontalHeader().resizeSection(2, 60)
示例4: __setup_log_tab
# 需要导入模块: from PyQt5.QtCore import QDate [as 别名]
# 或者: from PyQt5.QtCore.QDate import currentDate [as 别名]
def __setup_log_tab(self):
self._log_table_view = pd.DataFrame()
self._log_table_model = DataFrameModel(self._log_table_view, copyDataFrame=False, show_index=False)
self._log_table_model.enableEditing(True)
self._log_table_model.dataChanged.connect(self.log_values_changed)
self.log_table.setModel(self._log_table_model)
self.log_table.horizontalHeader().setStretchLastSection(True)
self._log_date = pd.Timestamp.today()
self._log_lift = ''
self._log_unsynced_changes = False
self._log_unsaved_changes = False
self.log_date.setDate(QDate.currentDate())
self.log_cal.setSelectedDate(QDate.currentDate())
self.log_date_changed(pd.Timestamp.today())
self.log_populate_lifts_box()
self.log_populate_table()
self.log_date.dateChanged.connect(self.log_date_selection_changed)
self.log_cal.selectionChanged.connect(self.log_cal_selection_changed)
self.log_add.clicked.connect(self.log_add_entry)
self.log_save.clicked.connect(self.log_sync_changes)
self.log_delete.clicked.connect(self.log_del_row)
示例5: set_start_settings
# 需要导入模块: from PyQt5.QtCore import QDate [as 别名]
# 或者: from PyQt5.QtCore.QDate import currentDate [as 别名]
def set_start_settings(self):
self.de_date_from.setDate(QDate.currentDate().addMonths(-1))
self.de_date_to.setDate(QDate.currentDate())
self.tableWidget.horizontalHeader().resizeSection(0, 215)
self.tableWidget.horizontalHeader().resizeSection(1, 80)
self.tableWidget.horizontalHeader().resizeSection(2, 80)
self.tableWidget.horizontalHeader().resizeSection(3, 100)
示例6: checkDeadDateTime
# 需要导入模块: from PyQt5.QtCore import QDate [as 别名]
# 或者: from PyQt5.QtCore.QDate import currentDate [as 别名]
def checkDeadDateTime(self):
print(QDate.currentDate())
print(QTime.currentTime())
datetime=QDateTime(QDate.currentDate(),QTime.currentTime())
if(datetime<=self.deaddatetime):
return True
else:
return False
示例7: set_start_settings
# 需要导入模块: from PyQt5.QtCore import QDate [as 别名]
# 或者: from PyQt5.QtCore.QDate import currentDate [as 别名]
def set_start_settings(self):
self.de_date_from.setDate(QDate.currentDate().addMonths(-1))
self.de_date_to.setDate(QDate.currentDate())
self.tw_product.horizontalHeader().resizeSection(0, 40)
self.tw_product.horizontalHeader().resizeSection(1, 100)
self.tw_product.horizontalHeader().resizeSection(2, 60)
self.tw_product.horizontalHeader().resizeSection(3, 200)
示例8: start_settings
# 需要导入模块: from PyQt5.QtCore import QDate [as 别名]
# 或者: from PyQt5.QtCore.QDate import currentDate [as 别名]
def start_settings(self):
self.de_date_from.setDate(QDate.currentDate().addMonths(-1))
self.de_date_to.setDate(QDate.currentDate())
self.tw_work.horizontalHeader().resizeSection(0, 110)
self.tw_work.horizontalHeader().resizeSection(1, 110)
self.tw_work.horizontalHeader().resizeSection(2, 70)
self.tw_work.horizontalHeader().resizeSection(3, 70)
self.tw_work.horizontalHeader().resizeSection(4, 70)
示例9: set_start_settings
# 需要导入模块: from PyQt5.QtCore import QDate [as 别名]
# 或者: from PyQt5.QtCore.QDate import currentDate [as 别名]
def set_start_settings(self):
self.de_date_from.setDate(QDate.currentDate().addMonths(-1))
self.de_date_to.setDate(QDate.currentDate())
self.tableWidget.horizontalHeader().resizeSection(0, 150)
self.tableWidget.horizontalHeader().resizeSection(1, 60)
self.tableWidget.horizontalHeader().resizeSection(2, 70)
self.tableWidget.horizontalHeader().resizeSection(3, 70)
self.tableWidget.horizontalHeader().resizeSection(4, 90)
self.tableWidget.horizontalHeader().resizeSection(5, 90)
self.tableWidget.horizontalHeader().resizeSection(6, 60)
示例10: start_settings
# 需要导入模块: from PyQt5.QtCore import QDate [as 别名]
# 或者: from PyQt5.QtCore.QDate import currentDate [as 别名]
def start_settings(self):
self.de_date_from.setDate(QDate.currentDate().addMonths(-3))
self.de_date_to.setDate(QDate.currentDate())
self.tw_pack.horizontalHeader().resizeSection(0, 50)
self.tw_pack.horizontalHeader().resizeSection(1, 50)
self.tw_pack.horizontalHeader().resizeSection(2, 50)
self.tw_pack.horizontalHeader().resizeSection(3, 50)
self.tw_pack.horizontalHeader().resizeSection(4, 80)
self.tw_pack.horizontalHeader().resizeSection(5, 80)
self.tw_pack.horizontalHeader().resizeSection(6, 80)
示例11: update_attractions_date
# 需要导入模块: from PyQt5.QtCore import QDate [as 别名]
# 或者: from PyQt5.QtCore.QDate import currentDate [as 别名]
def update_attractions_date(self):
self.ui.dateTimeEdit_Attractions_Start.setDate(QDate.currentDate())
self.ui.dateTimeEdit_Attractions_End.setDate(QDate.currentDate())
query = QSqlQuery()
query.prepare('SELECT t_event.id, t_event.name '
'FROM t_event')
query.setForwardOnly(1)
query.exec_()
while query.next():
self.ui.comboBox_Attractions_Event.addItem(str(query.value(0)) + " - " + query.value(1))
示例12: __init__
# 需要导入模块: from PyQt5.QtCore import QDate [as 别名]
# 或者: from PyQt5.QtCore.QDate import currentDate [as 别名]
def __init__(self, parent=None):
"""
Constructor
@param parent parent widget of the dialog (QWidget)
"""
super(SvnRevisionSelectionDialog, self).__init__(parent)
self.setupUi(self)
self.date1Edit.setDate(QDate.currentDate())
self.date2Edit.setDate(QDate.currentDate())
msh = self.minimumSizeHint()
self.resize(max(self.width(), msh.width()), msh.height())
示例13: start_settings
# 需要导入模块: from PyQt5.QtCore import QDate [as 别名]
# 或者: from PyQt5.QtCore.QDate import currentDate [as 别名]
def start_settings(self):
if self.id is None:
self.de_plus_date.setDate(QDate.currentDate())
self.de_minus_date.setDate(QDate.currentDate())
self.de_road_date.setDate(QDate.currentDate())
self.de_p_m_date.setDate(QDate.currentDate())
self.de_bye_date.setDate(QDate.currentDate())
else:
query = """SELECT work.Id, work.First_Name, work.Last_Name, pay_worker.Balance, pay_worker.Date_In_Pay, pay_reason.Id, pay_reason.Name, pay_worker.Note
FROM pay_worker
LEFT JOIN staff_worker_info AS work ON pay_worker.Worker_Id = work.Id
LEFT JOIN pay_reason ON pay_worker.Reason_Id = pay_reason.Id
WHERE pay_worker.Id = %s"""
sql_info = my_sql.sql_select(query, (self.id, ))
if "mysql.connector.errors" in str(type(sql_info)):
QMessageBox.critical(self, "Ошибка sql получение операции", sql_info.msg, QMessageBox.Ok)
return False
if sql_info[0][3] > 0:
self.menu_text = "Доплата"
self.sw_main.setCurrentIndex(1)
self.le_work_plus.setWhatsThis(str(sql_info[0][0]))
self.le_work_plus.setText(str(sql_info[0][1]) + " " + str(sql_info[0][2]))
self.le_value_plus.setText(str(sql_info[0][3]))
self.de_plus_date.setDate(sql_info[0][4])
self.le_reason_plus.setWhatsThis(str(sql_info[0][5]))
self.le_reason_plus.setText(str(sql_info[0][6]))
self.le_note_plus.setText(str(sql_info[0][7]))
else:
self.menu_text = "Вычет"
self.sw_main.setCurrentIndex(2)
self.le_work_minus.setWhatsThis(str(sql_info[0][0]))
self.le_work_minus.setText(str(sql_info[0][1]) + " " + str(sql_info[0][2]))
self.le_value_minus.setText(str(-sql_info[0][3]))
self.de_minus_date.setDate(sql_info[0][4])
self.le_reason_minus.setWhatsThis(str(sql_info[0][5]))
self.le_reason_minus.setText(str(sql_info[0][6]))
self.le_note_minus.setText(str(sql_info[0][7]))
self.lw_menu.setEnabled(False)
示例14: importedBookmarks
# 需要导入模块: from PyQt5.QtCore import QDate [as 别名]
# 或者: from PyQt5.QtCore.QDate import currentDate [as 别名]
def importedBookmarks(self):
"""
Public method to get the imported bookmarks.
@return imported bookmarks (BookmarkNode)
"""
from ..XbelReader import XbelReader
reader = XbelReader()
importRootNode = reader.read(self.__fileName)
if reader.error() != QXmlStreamReader.NoError:
self._error = True
self._errorString = self.tr(
"""Error when importing bookmarks on line {0},"""
""" column {1}:\n{2}""")\
.format(reader.lineNumber(),
reader.columnNumber(),
reader.errorString())
return None
from ..BookmarkNode import BookmarkNode
importRootNode.setType(BookmarkNode.Folder)
if self._id == "e5browser":
importRootNode.title = self.tr("eric6 Web Browser Import")
elif self._id == "konqueror":
importRootNode.title = self.tr("Konqueror Import")
elif self._id == "xbel":
importRootNode.title = self.tr("XBEL Import")
else:
importRootNode.title = self.tr("Imported {0}")\
.format(QDate.currentDate().toString(Qt.SystemLocaleShortDate))
return importRootNode
示例15: data
# 需要导入模块: from PyQt5.QtCore import QDate [as 别名]
# 或者: from PyQt5.QtCore.QDate import currentDate [as 别名]
def data(self, index, role=Qt.DisplayRole):
"""
Public method to get data from the model.
@param index index of history entry to get data for (QModelIndex)
@param role data role (integer)
@return history entry data
"""
if role in [Qt.DisplayRole, Qt.EditRole]:
start = index.internalId()
if start == 0:
offset = self.__sourceDateRow(index.row())
if index.column() == 0:
idx = self.sourceModel().index(offset, 0)
date = idx.data(HistoryModel.DateRole)
if date == QDate.currentDate():
return self.tr("Earlier Today")
return date.toString("yyyy-MM-dd")
if index.column() == 1:
return self.tr(
"%n item(s)", "",
self.rowCount(index.sibling(index.row(), 0)))
elif role == Qt.DecorationRole:
if index.column() == 0 and not index.parent().isValid():
return UI.PixmapCache.getIcon("history.png")
elif role == HistoryModel.DateRole:
if index.column() == 0 and index.internalId() == 0:
offset = self.__sourceDateRow(index.row())
idx = self.sourceModel().index(offset, 0)
return idx.data(HistoryModel.DateRole)
return QAbstractProxyModel.data(self, index, role)