Ejemplo n.º 1
0
    def initTimeSelectionBar(self):
        self.timeselectionbar = QtGui.QToolBar("select time range.")
        self.layout.addWidget(self.timeselectionbar)

        self.timeselectionbar.setAutoFillBackground(True)

        changeDateRange = QtGui.QAction(  # QtGui.QIcon("icons/bold.png"),
            "起止日期", self)
        changeDateRange.triggered.connect(self.toggleDatetimeBar)

        self.timeselectionbar.addAction(changeDateRange)

        changeDateStart1M = QtGui.QAction("近一月", self)
        changeDateStart1M.triggered.connect(
            lambda: self.start_date_changed(self.now_date.addMonths(-1)))

        changeDateStart3M = QtGui.QAction("近三月", self)
        changeDateStart3M.triggered.connect(
            lambda: self.start_date_changed(self.now_date.addMonths(-3)))

        changeDateStart6M = QtGui.QAction("近半年", self)
        changeDateStart6M.triggered.connect(
            lambda: self.start_date_changed(self.now_date.addMonths(-6)))

        changeDateStart1Y = QtGui.QAction("近一年", self)
        changeDateStart1Y.triggered.connect(
            lambda: self.start_date_changed(self.now_date.addYears(-1)))

        changeDateStart3Y = QtGui.QAction("近三年", self)
        changeDateStart3Y.triggered.connect(
            lambda: self.start_date_changed(self.now_date.addYears(-3)))

        changeDateStart5Y = QtGui.QAction("近五年", self)
        changeDateStart5Y.triggered.connect(
            lambda: self.start_date_changed(self.now_date.addYears(-5)))

        changeDateStart10Y = QtGui.QAction("近十年", self)
        changeDateStart10Y.triggered.connect(
            lambda: self.start_date_changed(self.now_date.addYears(-10)))

        changeDateStart15Y = QtGui.QAction("十五年", self)
        changeDateStart15Y.triggered.connect(
            lambda: self.start_date_changed(self.now_date.addYears(-15)))

        changeDateStart20Y = QtGui.QAction("二十年", self)
        changeDateStart20Y.triggered.connect(
            lambda: self.start_date_changed(self.now_date.addYears(-20)))

        changeDateStartALL = QtGui.QAction("全部数据", self)
        changeDateStartALL.triggered.connect(
            lambda: self.start_date_changed(self.now_date.addYears(-50)))

        self.timeselectionbar.addAction(changeDateStart1M)
        self.timeselectionbar.addAction(changeDateStart3M)
        self.timeselectionbar.addAction(changeDateStart6M)
        self.timeselectionbar.addAction(changeDateStart1Y)
        self.timeselectionbar.addAction(changeDateStart3Y)
        self.timeselectionbar.addAction(changeDateStart5Y)
        self.timeselectionbar.addAction(changeDateStart10Y)
        self.timeselectionbar.addAction(changeDateStart15Y)
        self.timeselectionbar.addAction(changeDateStart20Y)
        self.timeselectionbar.addAction(changeDateStartALL)

        self.datetimebar = QtGui.QToolBar("set stock date time")
        self.layout.addWidget(self.datetimebar)
        #self.datetimebar.setOrientation(QtCore.Qt.Vertical)

        self.datetimebar.hide()

        #stock_basic_label = QtGui.QLabel("起止日期:")
        #self.datetimebar.addWidget(stock_basic_label)

        start_date = QtGui.QCalendarWidget(self)
        start_date.setGridVisible(True)
        start_date.setFirstDayOfWeek(QtCore.Qt.Monday)
        start_date.clicked[QtCore.QDate].connect(self.start_date_changed)

        end_date = QtGui.QCalendarWidget(self)
        end_date.setGridVisible(True)
        end_date.setFirstDayOfWeek(QtCore.Qt.Monday)
        end_date.clicked[QtCore.QDate].connect(self.end_date_changed)

        self.datetimebar.addWidget(start_date)
        self.datetimebar.addWidget(end_date)
Ejemplo n.º 2
0
    def setupUi(self, DockWidget):
        DockWidget.setObjectName(_fromUtf8("DockWidget"))
        DockWidget.resize(703, 632)
        self.dockWidgetContents = QtGui.QWidget()
        self.dockWidgetContents.setObjectName(_fromUtf8("dockWidgetContents"))
        self.gridLayout = QtGui.QGridLayout(self.dockWidgetContents)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.textBrowser = QtGui.QTextBrowser(self.dockWidgetContents)
        self.textBrowser.setMinimumSize(QtCore.QSize(0, 0))
        self.textBrowser.setMaximumSize(QtCore.QSize(16777215, 16777215))
        self.textBrowser.setObjectName(_fromUtf8("textBrowser"))
        self.gridLayout.addWidget(self.textBrowser, 2, 1, 1, 1)
        self.label_77 = QtGui.QLabel(self.dockWidgetContents)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.label_77.setFont(font)
        self.label_77.setObjectName(_fromUtf8("label_77"))
        self.gridLayout.addWidget(self.label_77, 0, 1, 1, 1)
        self.label_78 = QtGui.QLabel(self.dockWidgetContents)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.label_78.setFont(font)
        self.label_78.setObjectName(_fromUtf8("label_78"))
        self.gridLayout.addWidget(self.label_78, 0, 2, 1, 1)
        self.label_3 = QtGui.QLabel(self.dockWidgetContents)
        self.label_3.setMinimumSize(QtCore.QSize(0, 0))
        self.label_3.setMaximumSize(QtCore.QSize(16777215, 16777215))
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.label_3.setFont(font)
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self.gridLayout.addWidget(self.label_3, 1, 0, 1, 1)
        self.label_79 = QtGui.QLabel(self.dockWidgetContents)
        self.label_79.setEnabled(False)
        self.label_79.setObjectName(_fromUtf8("label_79"))
        self.gridLayout.addWidget(self.label_79, 1, 2, 1, 1)
        self.label_4 = QtGui.QLabel(self.dockWidgetContents)
        self.label_4.setMinimumSize(QtCore.QSize(0, 0))
        self.label_4.setMaximumSize(QtCore.QSize(16777215, 16777215))
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.label_4.setFont(font)
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self.gridLayout.addWidget(self.label_4, 2, 0, 1, 1)
        self.textBrowserDis = QtGui.QTextBrowser(self.dockWidgetContents)
        self.textBrowserDis.setEnabled(False)
        self.textBrowserDis.setObjectName(_fromUtf8("textBrowserDis"))
        self.gridLayout.addWidget(self.textBrowserDis, 2, 2, 1, 1)
        self.label_5 = QtGui.QLabel(self.dockWidgetContents)
        self.label_5.setMinimumSize(QtCore.QSize(0, 0))
        self.label_5.setMaximumSize(QtCore.QSize(16777215, 16777215))
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.label_5.setFont(font)
        self.label_5.setObjectName(_fromUtf8("label_5"))
        self.gridLayout.addWidget(self.label_5, 3, 0, 1, 1)
        self.graphicsView = QtGui.QGraphicsView(self.dockWidgetContents)
        self.graphicsView.setMinimumSize(QtCore.QSize(0, 0))
        self.graphicsView.setMaximumSize(QtCore.QSize(16777215, 16777215))
        self.graphicsView.setObjectName(_fromUtf8("graphicsView"))
        self.gridLayout.addWidget(self.graphicsView, 3, 1, 1, 1)
        self.graphicsViewDis = QtGui.QGraphicsView(self.dockWidgetContents)
        self.graphicsViewDis.setEnabled(False)
        self.graphicsViewDis.setObjectName(_fromUtf8("graphicsViewDis"))
        self.gridLayout.addWidget(self.graphicsViewDis, 3, 2, 1, 1)
        self.label_6 = QtGui.QLabel(self.dockWidgetContents)
        self.label_6.setMinimumSize(QtCore.QSize(0, 0))
        self.label_6.setMaximumSize(QtCore.QSize(16777215, 16777215))
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.label_6.setFont(font)
        self.label_6.setObjectName(_fromUtf8("label_6"))
        self.gridLayout.addWidget(self.label_6, 4, 0, 1, 1)
        self.calendarWidget = QtGui.QCalendarWidget(self.dockWidgetContents)
        self.calendarWidget.setMinimumSize(QtCore.QSize(0, 0))
        self.calendarWidget.setMaximumSize(QtCore.QSize(16777215, 16777215))
        self.calendarWidget.setObjectName(_fromUtf8("calendarWidget"))
        self.gridLayout.addWidget(self.calendarWidget, 4, 1, 1, 1)
        self.calendarWidgetDis = QtGui.QCalendarWidget(self.dockWidgetContents)
        self.calendarWidgetDis.setEnabled(False)
        self.calendarWidgetDis.setObjectName(_fromUtf8("calendarWidgetDis"))
        self.gridLayout.addWidget(self.calendarWidgetDis, 4, 2, 1, 1)
        self.lcdNumberDis = QtGui.QLCDNumber(self.dockWidgetContents)
        self.lcdNumberDis.setEnabled(False)
        self.lcdNumberDis.setObjectName(_fromUtf8("lcdNumberDis"))
        self.gridLayout.addWidget(self.lcdNumberDis, 5, 2, 1, 1)
        self.label_7 = QtGui.QLabel(self.dockWidgetContents)
        self.label_7.setMinimumSize(QtCore.QSize(0, 0))
        self.label_7.setMaximumSize(QtCore.QSize(16777215, 16777215))
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.label_7.setFont(font)
        self.label_7.setObjectName(_fromUtf8("label_7"))
        self.gridLayout.addWidget(self.label_7, 5, 0, 1, 1)
        self.lcdNumber = QtGui.QLCDNumber(self.dockWidgetContents)
        self.lcdNumber.setMinimumSize(QtCore.QSize(0, 0))
        self.lcdNumber.setMaximumSize(QtCore.QSize(16777215, 16777215))
        self.lcdNumber.setObjectName(_fromUtf8("lcdNumber"))
        self.gridLayout.addWidget(self.lcdNumber, 5, 1, 1, 1)
        self.label_8 = QtGui.QLabel(self.dockWidgetContents)
        self.label_8.setMinimumSize(QtCore.QSize(0, 0))
        self.label_8.setMaximumSize(QtCore.QSize(16777215, 16777215))
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.label_8.setFont(font)
        self.label_8.setObjectName(_fromUtf8("label_8"))
        self.gridLayout.addWidget(self.label_8, 6, 0, 1, 1)
        self.progressBar = QtGui.QProgressBar(self.dockWidgetContents)
        self.progressBar.setMinimumSize(QtCore.QSize(0, 0))
        self.progressBar.setMaximumSize(QtCore.QSize(16777215, 16777215))
        self.progressBar.setProperty("value", 24)
        self.progressBar.setObjectName(_fromUtf8("progressBar"))
        self.gridLayout.addWidget(self.progressBar, 6, 1, 1, 1)
        self.progressBarDis = QtGui.QProgressBar(self.dockWidgetContents)
        self.progressBarDis.setEnabled(False)
        self.progressBarDis.setProperty("value", 24)
        self.progressBarDis.setObjectName(_fromUtf8("progressBarDis"))
        self.gridLayout.addWidget(self.progressBarDis, 6, 2, 1, 1)
        self.label_9 = QtGui.QLabel(self.dockWidgetContents)
        self.label_9.setMinimumSize(QtCore.QSize(0, 0))
        self.label_9.setMaximumSize(QtCore.QSize(16777215, 16777215))
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.label_9.setFont(font)
        self.label_9.setObjectName(_fromUtf8("label_9"))
        self.gridLayout.addWidget(self.label_9, 7, 0, 1, 1)
        self.lineH = QtGui.QFrame(self.dockWidgetContents)
        self.lineH.setMinimumSize(QtCore.QSize(0, 0))
        self.lineH.setMaximumSize(QtCore.QSize(16777215, 16777215))
        self.lineH.setFrameShape(QtGui.QFrame.HLine)
        self.lineH.setFrameShadow(QtGui.QFrame.Sunken)
        self.lineH.setObjectName(_fromUtf8("lineH"))
        self.gridLayout.addWidget(self.lineH, 7, 1, 1, 1)
        self.lineHDis = QtGui.QFrame(self.dockWidgetContents)
        self.lineHDis.setEnabled(False)
        self.lineHDis.setFrameShape(QtGui.QFrame.HLine)
        self.lineHDis.setFrameShadow(QtGui.QFrame.Sunken)
        self.lineHDis.setObjectName(_fromUtf8("lineHDis"))
        self.gridLayout.addWidget(self.lineHDis, 7, 2, 1, 1)
        self.label_10 = QtGui.QLabel(self.dockWidgetContents)
        self.label_10.setMinimumSize(QtCore.QSize(0, 0))
        self.label_10.setMaximumSize(QtCore.QSize(16777215, 16777215))
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.label_10.setFont(font)
        self.label_10.setObjectName(_fromUtf8("label_10"))
        self.gridLayout.addWidget(self.label_10, 8, 0, 1, 1)
        self.lineV = QtGui.QFrame(self.dockWidgetContents)
        self.lineV.setMinimumSize(QtCore.QSize(0, 50))
        self.lineV.setMaximumSize(QtCore.QSize(16777215, 16777215))
        self.lineV.setFrameShape(QtGui.QFrame.VLine)
        self.lineV.setFrameShadow(QtGui.QFrame.Sunken)
        self.lineV.setObjectName(_fromUtf8("lineV"))
        self.gridLayout.addWidget(self.lineV, 8, 1, 1, 1)
        self.lineVDis = QtGui.QFrame(self.dockWidgetContents)
        self.lineVDis.setEnabled(False)
        self.lineVDis.setMinimumSize(QtCore.QSize(0, 50))
        self.lineVDis.setFrameShape(QtGui.QFrame.VLine)
        self.lineVDis.setFrameShadow(QtGui.QFrame.Sunken)
        self.lineVDis.setObjectName(_fromUtf8("lineVDis"))
        self.gridLayout.addWidget(self.lineVDis, 8, 2, 1, 1)
        spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Expanding)
        self.gridLayout.addItem(spacerItem, 9, 0, 1, 1)
        self.label_37 = QtGui.QLabel(self.dockWidgetContents)
        self.label_37.setAlignment(QtCore.Qt.AlignCenter)
        self.label_37.setObjectName(_fromUtf8("label_37"))
        self.gridLayout.addWidget(self.label_37, 10, 0, 1, 3)
        self.label_2 = QtGui.QLabel(self.dockWidgetContents)
        self.label_2.setMinimumSize(QtCore.QSize(0, 0))
        self.label_2.setMaximumSize(QtCore.QSize(16777215, 16777215))
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.gridLayout.addWidget(self.label_2, 1, 1, 1, 1)
        DockWidget.setWidget(self.dockWidgetContents)

        self.retranslateUi(DockWidget)
        QtCore.QObject.connect(
            self.calendarWidget,
            QtCore.SIGNAL(_fromUtf8("currentPageChanged(int,int)")),
            self.calendarWidgetDis.setCurrentPage)
        QtCore.QObject.connect(self.calendarWidget,
                               QtCore.SIGNAL(_fromUtf8("clicked(QDate)")),
                               self.calendarWidgetDis.setSelectedDate)
        QtCore.QObject.connect(self.progressBar,
                               QtCore.SIGNAL(_fromUtf8("valueChanged(int)")),
                               self.progressBarDis.setValue)
        QtCore.QMetaObject.connectSlotsByName(DockWidget)