本文整理汇总了Python中PyQt4.QtGui.QDateEdit.setDate方法的典型用法代码示例。如果您正苦于以下问题:Python QDateEdit.setDate方法的具体用法?Python QDateEdit.setDate怎么用?Python QDateEdit.setDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QDateEdit
的用法示例。
在下文中一共展示了QDateEdit.setDate方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: NewTaskDialog
# 需要导入模块: from PyQt4.QtGui import QDateEdit [as 别名]
# 或者: from PyQt4.QtGui.QDateEdit import setDate [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())
示例2: AddTalkWidget
# 需要导入模块: from PyQt4.QtGui import QDateEdit [as 别名]
# 或者: from PyQt4.QtGui.QDateEdit import setDate [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)
示例3: TalkDetailsWidget
# 需要导入模块: from PyQt4.QtGui import QDateEdit [as 别名]
# 或者: from PyQt4.QtGui.QDateEdit import setDate [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)
#.........这里部分代码省略.........
示例4: LDSControls
# 需要导入模块: from PyQt4.QtGui import QDateEdit [as 别名]
# 或者: from PyQt4.QtGui.QDateEdit import setDate [as 别名]
#.........这里部分代码省略.........
#self.confEdit.setText(ruconf if LU.assessNone(ruconf) else '')
#Layer/Group Selection
self.updateLGValues(ruconf,self.rlgval,rdest)
lgindex = None
if LU.assessNone(self.rlgval):
#index of list value
lgindex = self.parent.confconn.getLayerGroupIndex(self.rlgval,col=1)
if LU.assessNone(lgindex):
#advance by 1 for sep
lgindex += 1 if lgindex>self.sepindex else 0
else:
#using the separator index sets the combo to blank
lgindex = self.sepindex
if self.lgcombo.currentIndex() != lgindex:
self.lgcombo.setCurrentIndex(lgindex)
#self.doLGEditUpdate()
#EPSG
# user > layerconf
#useepsg = LU.precedence(repsg, lce.epsg if lce else None, None)
epsgindex = [i[0] for i in self.nzlsr+[(None,None)]+self.rowsr].index(repsg)
if self.epsgcombo.currentIndex() != epsgindex:
self.epsgcombo.setCurrentIndex(epsgindex)
#epsgedit = self.epsgcombo.lineEdit()
#epsgedit.setText([e[1] for e in self.nzlsr+self.rowsr if e[0]==repsg][0])
#epsgedit.setText([e for e in self.nzlsr+self.rowsr if re.match('^\s*(\d+).*',e).group(1)==repsg][0])
#To/From Dates
if LU.assessNone(rfd):
self.fromdateedit.setDate(QDate(int(rfd[0:4]),int(rfd[5:7]),int(rfd[8:10])))
else:
early = DataStore.EARLIEST_INIT_DATE
self.fromdateedit.setDate(QDate(int(early[0:4]),int(early[5:7]),int(early[8:10])))
if LU.assessNone(rtd):
self.todateedit.setDate(QDate(int(rtd[0:4]),int(rtd[5:7]),int(rtd[8:10])))
else:
today = DataStore.getCurrent()
self.todateedit.setDate(QDate(int(today[0:4]),int(today[5:7]),int(today[8:10])))
#Internal/External CheckBox
# if LU.assessNone(rint):
# self.internalTrigger.setChecked(rint.lower()==DataStore.CONF_INT)
# else:
# self.internalTrigger.setChecked(DataStore.DEFAULT_CONF==DataStore.CONF_INT)
def getConfiguredDestinations(self):
defml = ['',]+DataStore.DRIVER_NAMES.values()
return [d for d in self.parent.gpr.getDestinations() if d in defml]
def doEPSGEnable(self):
self.epsgcombo.setEnabled(self.epsgenable.isChecked())
def doFromDateEnable(self):
self.fromdateedit.setEnabled(self.fromdateenable.isChecked())
def doToDateEnable(self):
self.todateedit.setEnabled(self.todateenable.isChecked())
def readParameters(self):
'''Read values out of dialogs'''
示例5: sub_canvas
# 需要导入模块: from PyQt4.QtGui import QDateEdit [as 别名]
# 或者: from PyQt4.QtGui.QDateEdit import setDate [as 别名]
class sub_canvas(MyMplCanvas):
def __init__(self, *args, **kwargs):
MyMplCanvas.__init__(self, *args, **kwargs)
# 初始化变量,以控制图表的显示
self.control = {"basic":True,
"extreme":True,
"slope":True,
"star":True}
self.widget = QWidget(self)
self.horizontalLayout = QHBoxLayout(self.widget)
self.label_1 = QLabel(self.widget)
self.horizontalLayout.addWidget(self.label_1)
self.lineEdit = QLineEdit(self.widget)
self.horizontalLayout.addWidget(self.lineEdit)
self.label_2 = QLabel(self.widget)
self.horizontalLayout.addWidget(self.label_2)
self.dateEdit = QDateEdit(self.widget)
self.horizontalLayout.addWidget(self.dateEdit)
self.label_3 = QLabel(self.widget)
self.horizontalLayout.addWidget(self.label_3)
self.dateEdit_2 = QDateEdit(self.widget)
self.horizontalLayout.addWidget(self.dateEdit_2)
self.button1 = QPushButton(self.widget)
self.horizontalLayout.addWidget(self.button1)
self.button2 = QPushButton(self.widget)
self.horizontalLayout.addWidget(self.button2)
self.button3 = QPushButton(self.widget)
self.horizontalLayout.addWidget(self.button3)
self.button4 = QPushButton(self.widget)
self.horizontalLayout.addWidget(self.button4)
self.button5 = QPushButton(self.widget)
self.horizontalLayout.addWidget(self.button5)
self.lineEdit.setText(QtCore.QString('002594'))
three_month = QtCore.QDate.currentDate().toJulianDay() - 150
self.dateEdit.setDate(QtCore.QDate.fromJulianDay(three_month))
self.dateEdit_2.setDate(QtCore.QDate.currentDate())
self.label_1.setText(_translate("MainWindow", "股票代码", None))
self.label_2.setText(_translate("MainWindow", "起始时间", None))
self.label_3.setText(_translate("MainWindow", "终止时间", None))
self.button1.setText(_translate("MainWindow", "所有", None))
self.button2.setText(_translate("MainWindow", "极端", None))
self.button3.setText(_translate("MainWindow", "斜率", None))
self.button4.setText(_translate("MainWindow", "趋势", None))
self.button5.setText(_translate("MainWindow", "清除", None))
self.button1.clicked.connect(self.draw_all)
self.button2.clicked.connect(self.draw_extreme)
self.button3.clicked.connect(self.draw_slope)
self.button4.clicked.connect(self.draw_trend)
self.button5.clicked.connect(self.clear)
def keyPressEvent(self, event):
keyEvent = QKeyEvent(event)
if keyEvent.key() == QtCore.Qt.Key_Enter or keyEvent.key() == QtCore.Qt.Key_Return:
self.draw_all()
if keyEvent.key() == QtCore.Qt.Key_0:
self.draw_all()
# 定义横坐标格式的回调函数
def my_major_formatter(self, x, pos):
for i in range(self.num):
if (x == i):
return self.str_date[i]
# 控制图表的显示信息
# basic 为基本图标,extreme为极端情景,slope为斜率,star为选股星数,trend为趋势线
def set_control_all(self):
self.control = {"basic": True, "extreme": True, "slope": True,"star":True,"trend":False}
def set_control_extreme(self):
self.control = {"basic": True, "extreme": True, "slope": False, "star": True,"trend":False}
def set_control_slope(self):
self.control = {"basic": True, "extreme": False, "slope": True, "star": True,"trend":False}
def set_control_star(self):
self.control = {"basic": True, "extreme": False, "slope": False, "star": True,"trend":False}
def set_control_trend(self):
self.control = {"basic": True, "extreme": False, "slope": False, "star": False, "trend": True}
def draw_all(self):
self.get_value()
self.set_control_all()
self.update_figure()
def draw_extreme(self):
self.get_value()
self.set_control_extreme()
self.update_figure()
def draw_slope(self):
self.get_value()
self.set_control_slope()
self.update_figure()
def draw_star(self):
self.get_value()
self.set_control_star()
#.........这里部分代码省略.........
示例6: sub_canvas
# 需要导入模块: from PyQt4.QtGui import QDateEdit [as 别名]
# 或者: from PyQt4.QtGui.QDateEdit import setDate [as 别名]
class sub_canvas(MyMplCanvas):
def __init__(self, *args, **kwargs):
MyMplCanvas.__init__(self, *args, **kwargs)
self.widget = QWidget(self)
self.horizontalLayout = QHBoxLayout(self.widget)
self.label_1 = QLabel(self.widget)
self.horizontalLayout.addWidget(self.label_1)
self.lineEdit = QLineEdit(self.widget)
self.horizontalLayout.addWidget(self.lineEdit)
self.label_2 = QLabel(self.widget)
self.horizontalLayout.addWidget(self.label_2)
self.dateEdit = QDateEdit(self.widget)
self.horizontalLayout.addWidget(self.dateEdit)
self.label_3 = QLabel(self.widget)
self.horizontalLayout.addWidget(self.label_3)
self.dateEdit_2 = QDateEdit(self.widget)
self.horizontalLayout.addWidget(self.dateEdit_2)
self.button1 = QPushButton(self.widget)
self.horizontalLayout.addWidget(self.button1)
self.button2 = QPushButton(self.widget)
self.horizontalLayout.addWidget(self.button2)
self.lineEdit.setText(QtCore.QString('600198'))
three_month = QtCore.QDate.currentDate().toJulianDay() - 40
self.dateEdit.setDate(QtCore.QDate.fromJulianDay(three_month))
self.dateEdit_2.setDate(QtCore.QDate.currentDate())
self.label_1.setText(_translate("MainWindow", "股票代码", None))
self.label_2.setText(_translate("MainWindow", "起始时间", None))
self.label_3.setText(_translate("MainWindow", "终止时间", None))
self.button1.setText(_translate("MainWindow", "提交", None))
self.button2.setText(_translate("MainWindow", "清除", None))
self.button1.clicked.connect(self.get_value)
self.button2.clicked.connect(self.clear)
# 定义横坐标格式的回调函数
def my_major_formatter(self, x, pos):
for i in range(self.num):
if (x == i):
return self.str_date[i]
def get_value(self):
code = QtCore.QString(self.lineEdit.text())
start = QtCore.QString(self.dateEdit.text())
end = QtCore.QString(self.dateEdit_2.text())
code = unicode(code)
start = datetime.date(int(start.split("/")[0]), int(start.split("/")[1]), int(start.split("/")[2])).isoformat()
end = datetime.date(int(end.split("/")[0]), int(end.split("/")[1]), int(end.split("/")[2])).isoformat()
self.num, self.kbar, self.str_date, self.ema, = source(code, start, end)
self.star_date, self.star_value = star(col, code, start, end)
self.update_figure()
def update_figure(self):
self.fig.clf()
self.ax1 = self.fig.add_subplot(111)
self.ax2 = self.ax1.twinx() # 创建第二个坐标轴,为同图
# 子图一
self.ax1.set_xticks(range(self.num))
xmajorLocator = MultipleLocator(5) # 将x主刻度标签设置为3的倍数
xminorLocator = MultipleLocator(1) # 将x副刻度标签设置为1的倍数
self.ax1.xaxis.set_major_locator(xmajorLocator)
self.ax1.xaxis.set_minor_locator(xminorLocator)
self.ax1.xaxis.set_major_formatter(FuncFormatter(self.my_major_formatter))
self.ax1.grid()
self.ax2.bar(range(len(self.star_date)), self.star_value, picker=True, color='#FFFF00', width = 0.5,edgecolor = 'black')
self.ax1.plot(range(self.num),self.ema,linewidth = 0.5,color = "blue")
#极端情况
high_1 = self.kbar[0][2]
low_1 = self.kbar[0][3]
ema_1 = self.ema[0]
deviate_1 = max(abs(high_1 - ema_1),abs(low_1 - ema_1))
high_2 = self.kbar[1][2]
low_2 = self.kbar[1][3]
ema_2 = self.ema[1]
deviate_2 = max(abs(high_2 - ema_2),abs(low_2 - ema_2))
high_3 = self.kbar[2][2]
low_3 = self.kbar[2][3]
ema_3 = self.ema[2]
deviate_3 = max(abs(high_3 - ema_3),abs(low_3 - ema_3))
high_4 = self.kbar[3][2]
low_4 = self.kbar[3][3]
ema_4 = self.ema[3]
deviate_4 = max(abs(high_4 - ema_4),abs(low_4 - ema_4))
high_5 = self.kbar[4][2]
low_5 = self.kbar[4][3]
ema_5 = self.ema[4]
deviate_5 = max(abs(high_5 - ema_5),abs(low_5 - ema_5))
high_6 = self.kbar[5][2]
low_6 = self.kbar[5][3]
ema_6 = self.ema[5]
deviate_6 = max(abs(high_6 - ema_6),abs(low_6 - ema_6))
for i in range(6,self.num):
high_7 = self.kbar[i][2]
low_7 = self.kbar[i][3]
ema_7 = self.ema[i]
deviate_7 = max(abs(high_7 - ema_7),abs(low_7 - ema_7))
#.........这里部分代码省略.........
示例7: sub_canvas
# 需要导入模块: from PyQt4.QtGui import QDateEdit [as 别名]
# 或者: from PyQt4.QtGui.QDateEdit import setDate [as 别名]
class sub_canvas(MyMplCanvas):
def __init__(self, *args, **kwargs):
MyMplCanvas.__init__(self, *args, **kwargs)
self.widget = QWidget(self)
self.horizontalLayout = QHBoxLayout(self.widget)
self.treeWidget = QTreeWidget(self.widget)
self.horizontalLayout.addWidget(self.treeWidget)
self.label_1 = QLabel(self.widget)
self.horizontalLayout.addWidget(self.label_1)
self.label_2 = QLabel(self.widget )
self.lineEdit = QLineEdit(self.widget)
self.horizontalLayout.addWidget(self.lineEdit)
self.horizontalLayout.addWidget(self.label_2)
self.dateEdit = QDateEdit(self.widget)
self.horizontalLayout.addWidget(self.dateEdit)
self.label_3 = QLabel(self.widget)
self.horizontalLayout.addWidget(self.label_3)
self.dateEdit_2 = QDateEdit(self.widget)
self.horizontalLayout.addWidget(self.dateEdit_2)
self.button1 = QPushButton(self.widget)
self.horizontalLayout.addWidget(self.button1)
self.button2 = QPushButton(self.widget)
self.horizontalLayout.addWidget(self.button2)
self.lineEdit.setText(QtCore.QString('M'))
three_month = QtCore.QDate.currentDate().toJulianDay() - 60
self.dateEdit.setDate(QtCore.QDate.fromJulianDay(three_month))
self.dateEdit_2.setDate(QtCore.QDate.currentDate())
self.button1.clicked.connect(self.get_value)
self.button2.clicked.connect(self.clear)
self.treeWidget.headerItem().setText(0, _translate("MainWindow", "期货品种", None))
self.root1 = QTreeWidgetItem(self.treeWidget)
self.root1.setText(0, _translate("MainWindow", "中金所", None))
self.root2 = QTreeWidgetItem(self.treeWidget)
self.root2.setText(0, _translate("MainWindow", "上海期货", None))
self.root3 = QTreeWidgetItem(self.treeWidget)
self.root3.setText(0, _translate("MainWindow", "大连商品", None))
self.root4 = QTreeWidgetItem(self.treeWidget)
self.root4.setText(0, _translate("MainWindow", "郑州商品", None))
self.child11 = QTreeWidgetItem(self.root1)
self.child12 = QTreeWidgetItem(self.root1)
self.child13 = QTreeWidgetItem(self.root1)
self.child14 = QTreeWidgetItem(self.root1)
self.child15 = QTreeWidgetItem(self.root1)
self.child16 = QTreeWidgetItem(self.root1)
self.child17 = QTreeWidgetItem(self.root1)
self.child18 = QTreeWidgetItem(self.root1)
self.child11.setText(0, _translate("MainWindow", "CFFEX 沪深300指数期货(IF)", None))
self.child12.setText(0, _translate("MainWindow", "CFFEX 上证50指数期货(IH)", None))
self.child13.setText(0, _translate("MainWindow", "CFFEX 中证500指数期货(IC)", None))
self.child14.setText(0, _translate("MainWindow", "CFFEX 5年期国债期货(TF)", None))
self.child15.setText(0, _translate("MainWindow", "CFFEX 10年期国债期货(T)", None))
self.child16.setText(0, _translate("MainWindow", "CFFEX 3年期国债期货(仿真)(TT)", None))
self.child17.setText(0, _translate("MainWindow", "CFFEX 澳元兑美元(AUDUSD)期货(仿真)(AF)", None))
self.child18.setText(0, _translate("MainWindow", "CFFEX 欧元兑美元(EURUSD)期货(仿真)(EF)", None))
self.child21 = QTreeWidgetItem(self.root2)
self.child22 = QTreeWidgetItem(self.root2)
self.child23 = QTreeWidgetItem(self.root2)
self.child24 = QTreeWidgetItem(self.root2)
self.child25 = QTreeWidgetItem(self.root2)
self.child26 = QTreeWidgetItem(self.root2)
self.child27 = QTreeWidgetItem(self.root2)
self.child28 = QTreeWidgetItem(self.root2)
self.child29 = QTreeWidgetItem(self.root2)
self.child210 = QTreeWidgetItem(self.root2)
self.child211 = QTreeWidgetItem(self.root2)
self.child212 = QTreeWidgetItem(self.root2)
self.child213 = QTreeWidgetItem(self.root2)
self.child214 = QTreeWidgetItem(self.root2)
self.child21.setText(0, _translate("MainWindow", "SHFE 铜(CU)", None))
self.child22.setText(0, _translate("MainWindow", "SHFE 铝(AL)", None))
self.child23.setText(0, _translate("MainWindow", "SHFE 铅(ZN)", None))
self.child24.setText(0, _translate("MainWindow", "SHFE 黄金(AU)", None))
self.child25.setText(0, _translate("MainWindow", "SHFE 白银(AG)", None))
self.child26.setText(0, _translate("MainWindow", "SHFE 螺纹钢(RB)", None))
self.child27.setText(0, _translate("MainWindow", "SHFE 橡胶(RU)", None))
self.child28.setText(0, _translate("MainWindow", "SHFE 燃油(FU)", None))
self.child29.setText(0, _translate("MainWindow", "SHFE 线材(WR)", None))
self.child210.setText(0, _translate("MainWindow", "SHFE 石油沥青(BU)", None))
self.child211.setText(0, _translate("MainWindow", "SHFE 热轧卷板(HC)", None))
self.child212.setText(0, _translate("MainWindow", "SHFE 镍(NI)", None))
self.child213.setText(0, _translate("MainWindow", "SHFE 锡(SN)", None))
self.child214.setText(0, _translate("MainWindow", "SHFE 上期有色金属指数期货(仿真)(IM)", None))
self.child31 = QTreeWidgetItem(self.root3)
self.child32 = QTreeWidgetItem(self.root3)
self.child33 = QTreeWidgetItem(self.root3)
self.child34 = QTreeWidgetItem(self.root3)
self.child35 = QTreeWidgetItem(self.root3)
self.child36 = QTreeWidgetItem(self.root3)
self.child37 = QTreeWidgetItem(self.root3)
self.child38 = QTreeWidgetItem(self.root3)
self.child39 = QTreeWidgetItem(self.root3)
self.child310 = QTreeWidgetItem(self.root3)
self.child311 = QTreeWidgetItem(self.root3)
self.child312 = QTreeWidgetItem(self.root3)
self.child313 = QTreeWidgetItem(self.root3)
self.child314 = QTreeWidgetItem(self.root3)
self.child31.setText(0, _translate("MainWindow", "DCE 豆一(A)", None))
#.........这里部分代码省略.........
示例8: QtDateSelector
# 需要导入模块: from PyQt4.QtGui import QDateEdit [as 别名]
# 或者: from PyQt4.QtGui.QDateEdit import setDate [as 别名]
class QtDateSelector(QtBoundedDate, ProxyDateSelector):
""" 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.
"""
#.........这里部分代码省略.........