class Ui_Main_Window(object): def setup_ui(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1800, 1600) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") # self.widget.setGeometry(QtCore.QRect(10, 10, 258, 451)) # self.widget.setObjectName("widget") self.gridLayout = QtWidgets.QGridLayout(self.centralwidget) self.gridLayout.setContentsMargins(15, 15, 15, 15) self.gridLayout.setObjectName("gridLayout") self.splitter_0 = QtWidgets.QSplitter(self.centralwidget) self.splitter_0.setOrientation(QtCore.Qt.Horizontal) self.splitter_0.setObjectName("splitter_0") self.weibo_id_label = QtWidgets.QLabel(self.splitter_0) self.weibo_id_label.setObjectName("Weibo ID Label") self.weibo_id_label.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignVCenter) self.search_edit_text = QtWidgets.QLineEdit(self.splitter_0) self.search_edit_text.setObjectName("lineEdit") # self.search_edit_text.setFixedSize(QtCore.QSize(60, 30)) self.stock_option_combobox = QtWidgets.QComboBox(self.splitter_0) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.stock_option_combobox.sizePolicy().hasHeightForWidth()) self.stock_option_combobox.setSizePolicy(sizePolicy) self.stock_option_combobox.setObjectName("stock_option_combobox") self.stock_option_combobox.addItems( ["K线", "复权", "分笔数据", "历史分钟", "十大股东"]) self.gridLayout.addWidget(self.splitter_0, 0, 0, 1, 2) self.start_date_label = QtWidgets.QLabel(self.centralwidget) self.start_date_label.setObjectName("Start Date") self.gridLayout.addWidget(self.start_date_label, 2, 0, 1, 1) self.end_date_label = QtWidgets.QLabel(self.centralwidget) self.end_date_label.setObjectName("End Date") self.gridLayout.addWidget(self.end_date_label, 2, 1, 1, 1) self.splitter_2 = QtWidgets.QSplitter(self.centralwidget) self.splitter_2.setOrientation(QtCore.Qt.Horizontal) self.splitter_2.setObjectName("splitter_2") self.start_date_edit = QtWidgets.QDateEdit(self.splitter_2) self.start_date_edit.setObjectName("StartDateEdit") self.end_date_edit = QtWidgets.QDateEdit(self.splitter_2) self.end_date_edit.setObjectName("EndDateEdit") self.gridLayout.addWidget(self.splitter_2, 3, 0, 1, 2) self.splitter_1 = QtWidgets.QSplitter(self.centralwidget) self.splitter_1.setOrientation(QtCore.Qt.Horizontal) self.splitter_1.setObjectName("splitter_1") self.interval_combobox = QtWidgets.QComboBox(self.splitter_1) self.interval_combobox.setObjectName("IntervalComboBox") self.interval_combobox.addItems(["D", "W", "M", "5", "15", "30", "60"]) # self.stock_combobox = QtWidgets.QComboBox(self.splitter_1) # sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) # sizePolicy.setHorizontalStretch(0) # sizePolicy.setVerticalStretch(0) # sizePolicy.setHeightForWidth(self.stock_combobox.sizePolicy().hasHeightForWidth()) # self.stock_combobox.setSizePolicy(sizePolicy) # self.stock_combobox.setObjectName("stock_combobox") # self.stock_combobox.addItems(["K线", "复权", "分笔数据", "历史分钟", "十大股东"]) self.search_btn = QtWidgets.QPushButton(self.splitter_1) self.search_btn.setObjectName("SearchButton") self.gridLayout.addWidget(self.splitter_1, 4, 0, 1, 2) self.stocks_tree = QtWidgets.QTreeWidget(self.centralwidget) self.stocks_tree.setObjectName("Stocks") self.stocks_tree.headerItem().setText(0, "Stocks") self.gridLayout.addWidget(self.stocks_tree, 5, 0, 1, 2) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 80, 12)) self.menubar.setObjectName("menubar") MainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.webView = QWebEngineView(self.centralwidget) self.webView.setEnabled(True) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.webView.sizePolicy().hasHeightForWidth()) self.webView.setSizePolicy(sizePolicy) self.webView.setMinimumSize(QtCore.QSize(200, 200)) self.webView.setMaximumSize(QtCore.QSize(800, 16777215)) self.webView.setUrl(QtCore.QUrl("about:blank")) self.webView.setObjectName("webView") self.gridLayout.addWidget(self.webView, 0, 2, 9, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QToolBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 90, 23)) self.menubar.setObjectName(_fromUtf8("menubar")) MainWindow.addToolBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName(_fromUtf8("statusbar")) MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) self.weibo_id_label.setText(_translate("MainWindow", "Weibo ID")) self.start_date_label.setText(_translate("MainWindow", "Start Date")) self.end_date_label.setText(_translate("MainWindow", "End Date")) self.search_btn.setText(_translate("MainWindow", "Search")) self.interval_combobox.setItemText( 0, _translate("MainWindow", "D", "by date")) self.interval_combobox.setItemText(1, _translate("MainWindow", "W", None)) self.interval_combobox.setItemText(2, _translate("MainWindow", "M", None)) self.interval_combobox.setItemText(3, _translate("MainWindow", "5", None)) self.interval_combobox.setItemText( 4, _translate("MainWindow", "15", None)) self.interval_combobox.setItemText( 5, _translate("MainWindow", "30", None)) self.interval_combobox.setItemText( 6, _translate("MainWindow", "60", None))
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1350, 700) #主窗口大小 self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.gridLayout = QtWidgets.QGridLayout(self.centralwidget) self.gridLayout.setObjectName("gridLayout") self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.combobox = QtWidgets.QComboBox(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth( self.combobox.sizePolicy().hasHeightForWidth()) self.combobox.setSizePolicy(sizePolicy) self.combobox.setObjectName("combobox") self.combobox.setStyleSheet("\n" "font: 85 13pt \"微软雅黑\";\n") self.combobox.addItems( ["回测分析系统", "分析十大股东", "获取历史K线", "获取复权数据", "获取分笔数据", "获取历史分钟数据"]) self.horizontalLayout_3.addWidget(self.combobox) #左侧选着窗口大小 spacerItem = QtWidgets.QSpacerItem(210, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem) self.gridLayout.addLayout(self.horizontalLayout_3, 0, 0, 1, 1) #k线下选框 self.horizontalLayout_5 = QtWidgets.QHBoxLayout() self.horizontalLayout_5.setObjectName("horizontalLayout_5") self.init_category_btn = QtWidgets.QPushButton(self.centralwidget) self.init_category_btn.setMinimumSize(QtCore.QSize(150, 0)) #分类显示摁钮 self.init_category_btn.setMaximumSize(QtCore.QSize(190, 16777215)) self.init_category_btn.setObjectName("init_category_btn") self.horizontalLayout_5.addWidget(self.init_category_btn) self.init_code_btn = QtWidgets.QPushButton(self.centralwidget) self.init_code_btn.setMinimumSize(QtCore.QSize(150, 0)) #按编号显示股票 摁钮 self.init_code_btn.setMaximumSize(QtCore.QSize(190, 16777215)) self.init_code_btn.setObjectName("init_code_btn") self.horizontalLayout_5.addWidget(self.init_code_btn) self.gridLayout.addLayout(self.horizontalLayout_5, 2, 0, 1, 1) self.horizontalLayout_8 = QtWidgets.QHBoxLayout() self.horizontalLayout_8.setObjectName("horizontalLayout_8") self.interval_label = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.interval_label.sizePolicy().hasHeightForWidth()) self.interval_label.setSizePolicy(sizePolicy) self.interval_label.setMinimumSize(QtCore.QSize(100, 0)) #每条线时间间隔lable self.interval_label.setMaximumSize(QtCore.QSize(150, 16777215)) self.interval_label.setObjectName("interval_label") self.horizontalLayout_8.addWidget(self.interval_label) self.comboBox = QtWidgets.QComboBox(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.comboBox.sizePolicy().hasHeightForWidth()) self.comboBox.setSizePolicy(sizePolicy) self.comboBox.setMaximumSize(QtCore.QSize(180, 16777215)) #时间间隔下拉框 self.comboBox.setObjectName("comboBox") self.horizontalLayout_8.addWidget(self.comboBox) self.gridLayout.addLayout(self.horizontalLayout_8, 4, 0, 1, 1) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.dateEdit = QtWidgets.QDateEdit(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.dateEdit.sizePolicy().hasHeightForWidth()) self.dateEdit.setSizePolicy(sizePolicy) self.dateEdit.setMinimumSize(QtCore.QSize(140, 0)) #时间1 self.dateEdit.setMaximumSize(QtCore.QSize(150, 16777215)) self.dateEdit.setObjectName("dateEdit") self.horizontalLayout_2.addWidget(self.dateEdit) self.dateEdit_2 = QtWidgets.QDateEdit(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.dateEdit_2.sizePolicy().hasHeightForWidth()) self.dateEdit_2.setSizePolicy(sizePolicy) self.dateEdit_2.setMinimumSize(QtCore.QSize(140, 0)) #时间2 self.dateEdit_2.setMaximumSize(QtCore.QSize(150, 16777215)) self.dateEdit_2.setObjectName("dateEdit_2") self.horizontalLayout_2.addWidget(self.dateEdit_2) self.gridLayout.addLayout(self.horizontalLayout_2, 6, 0, 1, 1) self.treeWidget = QtWidgets.QTreeWidget(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.treeWidget.sizePolicy().hasHeightForWidth()) self.treeWidget.setSizePolicy(sizePolicy) self.treeWidget.setMinimumSize(QtCore.QSize(160, 0)) self.treeWidget.setMaximumSize(QtCore.QSize(400, 16777215)) self.treeWidget.setObjectName("treeWidget") self.treeWidget.headerItem().setText(0, "历史数据---右键菜单选择") self.gridLayout.addWidget(self.treeWidget, 3, 0, 1, 1) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.label_4 = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.label_4.sizePolicy().hasHeightForWidth()) self.label_4.setSizePolicy(sizePolicy) self.label_4.setMaximumSize(QtCore.QSize(150, 16777215)) #搜索label大小 self.label_4.setObjectName("label_4") self.horizontalLayout.addWidget(self.label_4) self.search_lineEdit = QtWidgets.QLineEdit(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.search_lineEdit.sizePolicy().hasHeightForWidth()) self.search_lineEdit.setSizePolicy(sizePolicy) self.search_lineEdit.setMinimumSize(QtCore.QSize(100, 0)) #搜索框 self.search_lineEdit.setMaximumSize(QtCore.QSize(150, 16777215)) self.search_lineEdit.setMaxLength(20) self.search_lineEdit.setObjectName("search_lineEdit") self.horizontalLayout.addWidget(self.search_lineEdit) self.search_btn = QtWidgets.QPushButton(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.search_btn.sizePolicy().hasHeightForWidth()) self.search_btn.setSizePolicy(sizePolicy) self.search_btn.setMinimumSize(QtCore.QSize(40, 0)) #搜索框摁钮 self.search_btn.setMaximumSize(QtCore.QSize(30, 16777215)) self.search_btn.setObjectName("search_btn") self.horizontalLayout.addWidget(self.search_btn) self.log_btn = QtWidgets.QPushButton(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.log_btn.sizePolicy().hasHeightForWidth()) self.log_btn.setSizePolicy(sizePolicy) self.log_btn.setMinimumSize(QtCore.QSize(140, 0)) #log框摁钮 self.log_btn.setMaximumSize(QtCore.QSize(30, 16777215)) self.log_btn.setObjectName("log_btn") self.horizontalLayout.addWidget(self.log_btn) self.gridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 1) self.horizontalLayout_4 = QtWidgets.QHBoxLayout() self.horizontalLayout_4.setObjectName("horizontalLayout_4") self.staDate_label = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.staDate_label.sizePolicy().hasHeightForWidth()) self.staDate_label.setSizePolicy(sizePolicy) self.staDate_label.setMinimumSize(QtCore.QSize(80, 0)) self.staDate_label.setMaximumSize(QtCore.QSize(90, 16777215)) self.staDate_label.setObjectName("staDate_label") self.horizontalLayout_4.addWidget(self.staDate_label) self.label_2 = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.label_2.sizePolicy().hasHeightForWidth()) self.label_2.setSizePolicy(sizePolicy) self.label_2.setMinimumSize(QtCore.QSize(80, 0)) self.label_2.setMaximumSize(QtCore.QSize(90, 16777215)) self.label_2.setObjectName("label_2") self.horizontalLayout_4.addWidget(self.label_2) self.gridLayout.addLayout(self.horizontalLayout_4, 5, 0, 1, 1) self.treeWidget_2 = QtWidgets.QTreeWidget(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.treeWidget_2.sizePolicy().hasHeightForWidth()) self.treeWidget_2.setSizePolicy(sizePolicy) self.treeWidget_2.setMinimumSize(QtCore.QSize(160, 0)) self.treeWidget_2.setMaximumSize(QtCore.QSize(400, 16777215)) self.treeWidget_2.setObjectName("treeWidget_2") font = QtGui.QFont("Times", 12, QtGui.QFont.Bold) self.treeWidget_2.setFont(font) self.gridLayout.addWidget(self.treeWidget_2, 8, 0, 1, 1) self.commandLinkButton = QtWidgets.QCommandLinkButton( self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.commandLinkButton.sizePolicy().hasHeightForWidth()) self.commandLinkButton.setSizePolicy(sizePolicy) self.commandLinkButton.setMaximumSize(QtCore.QSize(110, 16777215)) font = QtGui.QFont() font.setFamily("Segoe UI") font.setPointSize(11) self.commandLinkButton.setFont(font) self.commandLinkButton.setObjectName("commandLinkButton") self.gridLayout.addWidget(self.commandLinkButton, 7, 0, 1, 1) self.webView = QWebEngineView(self.centralwidget) self.webView.setEnabled(True) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.webView.sizePolicy().hasHeightForWidth()) self.webView.setSizePolicy(sizePolicy) self.webView.setMinimumSize(QtCore.QSize(700, 400)) self.webView.setUrl(QtCore.QUrl("about:blank")) self.webView.setObjectName("webView") self.gridLayout.addWidget(self.webView, 0, 1, 9, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 1105, 23)) self.menubar.setObjectName("menubar") MainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.action123 = QtWidgets.QAction(MainWindow) self.action123.setObjectName("action123") MainWindow.setWindowTitle("金融数据获取分析系统") self.init_category_btn.setText("分类显示股票") self.init_code_btn.setText("按编号显示股票") self.interval_label.setText("每条线时间间隔") self.label_4.setText("搜索股票") self.search_btn.setText("搜索") self.log_btn.setText("个人中心") self.log_btn.setStyleSheet("background-color: rgb(209, 175, 222);\n" "color: rgb(255, 255, 255);") self.staDate_label.setText("开始时间") self.label_2.setText("结束时间") self.treeWidget_2.headerItem().setText(0, "列表") self.commandLinkButton.setText("开始") self.action123.setText("123")
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1105, 583) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.gridLayout = QtWidgets.QGridLayout(self.centralwidget) self.gridLayout.setObjectName("gridLayout") self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.combobox = QtWidgets.QComboBox(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.combobox.sizePolicy().hasHeightForWidth()) self.combobox.setSizePolicy(sizePolicy) self.combobox.setObjectName("combobox") self.combobox.addItems(["K线", "复权", "分笔数据", "历史分钟", "十大股东"]) self.horizontalLayout_3.addWidget(self.combobox) spacerItem = QtWidgets.QSpacerItem(110, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem) self.gridLayout.addLayout(self.horizontalLayout_3, 0, 0, 1, 1) self.horizontalLayout_5 = QtWidgets.QHBoxLayout() self.horizontalLayout_5.setObjectName("horizontalLayout_5") self.init_category_btn = QtWidgets.QPushButton(self.centralwidget) self.init_category_btn.setMaximumSize(QtCore.QSize(90, 16777215)) self.init_category_btn.setObjectName("init_category_btn") self.horizontalLayout_5.addWidget(self.init_category_btn) self.init_code_btn = QtWidgets.QPushButton(self.centralwidget) self.init_code_btn.setMinimumSize(QtCore.QSize(90, 0)) self.init_code_btn.setMaximumSize(QtCore.QSize(90, 16777215)) self.init_code_btn.setObjectName("init_code_btn") self.horizontalLayout_5.addWidget(self.init_code_btn) self.gridLayout.addLayout(self.horizontalLayout_5, 2, 0, 1, 1) self.horizontalLayout_8 = QtWidgets.QHBoxLayout() self.horizontalLayout_8.setObjectName("horizontalLayout_8") self.interval_label = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.interval_label.sizePolicy().hasHeightForWidth()) self.interval_label.setSizePolicy(sizePolicy) self.interval_label.setMinimumSize(QtCore.QSize(0, 0)) self.interval_label.setMaximumSize(QtCore.QSize(100, 16777215)) self.interval_label.setObjectName("interval_label") self.horizontalLayout_8.addWidget(self.interval_label) self.comboBox = QtWidgets.QComboBox(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.comboBox.sizePolicy().hasHeightForWidth()) self.comboBox.setSizePolicy(sizePolicy) self.comboBox.setMaximumSize(QtCore.QSize(80, 16777215)) self.comboBox.setObjectName("comboBox") self.horizontalLayout_8.addWidget(self.comboBox) self.gridLayout.addLayout(self.horizontalLayout_8, 4, 0, 1, 1) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.dateEdit = QtWidgets.QDateEdit(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.dateEdit.sizePolicy().hasHeightForWidth()) self.dateEdit.setSizePolicy(sizePolicy) self.dateEdit.setMinimumSize(QtCore.QSize(80, 0)) self.dateEdit.setMaximumSize(QtCore.QSize(90, 16777215)) self.dateEdit.setObjectName("dateEdit") self.horizontalLayout_2.addWidget(self.dateEdit) self.dateEdit_2 = QtWidgets.QDateEdit(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.dateEdit_2.sizePolicy().hasHeightForWidth()) self.dateEdit_2.setSizePolicy(sizePolicy) self.dateEdit_2.setMinimumSize(QtCore.QSize(85, 0)) self.dateEdit_2.setMaximumSize(QtCore.QSize(90, 16777215)) self.dateEdit_2.setObjectName("dateEdit_2") self.horizontalLayout_2.addWidget(self.dateEdit_2) self.gridLayout.addLayout(self.horizontalLayout_2, 6, 0, 1, 1) self.treeWidget = QtWidgets.QTreeWidget(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.treeWidget.sizePolicy().hasHeightForWidth()) self.treeWidget.setSizePolicy(sizePolicy) self.treeWidget.setMinimumSize(QtCore.QSize(160, 0)) self.treeWidget.setMaximumSize(QtCore.QSize(200, 16777215)) self.treeWidget.setObjectName("treeWidget") self.treeWidget.headerItem().setText(0, "历史数据---右键菜单选择") self.gridLayout.addWidget(self.treeWidget, 3, 0, 1, 1) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.label_4 = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_4.sizePolicy().hasHeightForWidth()) self.label_4.setSizePolicy(sizePolicy) self.label_4.setMaximumSize(QtCore.QSize(48, 16777215)) self.label_4.setObjectName("label_4") self.horizontalLayout.addWidget(self.label_4) self.search_lineEdit = QtWidgets.QLineEdit(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.search_lineEdit.sizePolicy().hasHeightForWidth()) self.search_lineEdit.setSizePolicy(sizePolicy) self.search_lineEdit.setMinimumSize(QtCore.QSize(75, 0)) self.search_lineEdit.setMaximumSize(QtCore.QSize(90, 16777215)) self.search_lineEdit.setMaxLength(20) self.search_lineEdit.setObjectName("search_lineEdit") self.horizontalLayout.addWidget(self.search_lineEdit) self.search_btn = QtWidgets.QPushButton(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.search_btn.sizePolicy().hasHeightForWidth()) self.search_btn.setSizePolicy(sizePolicy) self.search_btn.setMinimumSize(QtCore.QSize(40, 0)) self.search_btn.setMaximumSize(QtCore.QSize(30, 16777215)) self.search_btn.setObjectName("search_btn") self.horizontalLayout.addWidget(self.search_btn) self.gridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 1) self.horizontalLayout_4 = QtWidgets.QHBoxLayout() self.horizontalLayout_4.setObjectName("horizontalLayout_4") self.staDate_label = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.staDate_label.sizePolicy().hasHeightForWidth()) self.staDate_label.setSizePolicy(sizePolicy) self.staDate_label.setMinimumSize(QtCore.QSize(80, 0)) self.staDate_label.setMaximumSize(QtCore.QSize(90, 16777215)) self.staDate_label.setObjectName("staDate_label") self.horizontalLayout_4.addWidget(self.staDate_label) self.label_2 = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth()) self.label_2.setSizePolicy(sizePolicy) self.label_2.setMinimumSize(QtCore.QSize(80, 0)) self.label_2.setMaximumSize(QtCore.QSize(90, 16777215)) self.label_2.setObjectName("label_2") self.horizontalLayout_4.addWidget(self.label_2) self.gridLayout.addLayout(self.horizontalLayout_4, 5, 0, 1, 1) self.treeWidget_2 = QtWidgets.QTreeWidget(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.treeWidget_2.sizePolicy().hasHeightForWidth()) self.treeWidget_2.setSizePolicy(sizePolicy) self.treeWidget_2.setMinimumSize(QtCore.QSize(160, 0)) self.treeWidget_2.setMaximumSize(QtCore.QSize(200, 16777215)) self.treeWidget_2.setObjectName("treeWidget_2") font = QtGui.QFont("Times", 12, QtGui.QFont.Bold) self.treeWidget_2.setFont(font) self.gridLayout.addWidget(self.treeWidget_2, 8, 0, 1, 1) self.commandLinkButton = QtWidgets.QCommandLinkButton(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.commandLinkButton.sizePolicy().hasHeightForWidth()) self.commandLinkButton.setSizePolicy(sizePolicy) self.commandLinkButton.setMaximumSize(QtCore.QSize(110, 16777215)) font = QtGui.QFont() font.setFamily("Segoe UI") font.setPointSize(11) self.commandLinkButton.setFont(font) self.commandLinkButton.setObjectName("commandLinkButton") self.gridLayout.addWidget(self.commandLinkButton, 7, 0, 1, 1) self.webView = QWebEngineView(self.centralwidget) self.webView.setEnabled(True) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.webView.sizePolicy().hasHeightForWidth()) self.webView.setSizePolicy(sizePolicy) self.webView.setMinimumSize(QtCore.QSize(500, 400)) self.webView.setUrl(QtCore.QUrl("about:blank")) self.webView.setObjectName("webView") self.gridLayout.addWidget(self.webView, 0, 1, 9, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 1105, 23)) self.menubar.setObjectName("menubar") MainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.action123 = QtWidgets.QAction(MainWindow) self.action123.setObjectName("action123") MainWindow.setWindowTitle("Tuchart") self.init_category_btn.setText("分类显示股票") self.init_code_btn.setText("按编号显示股票") self.interval_label.setText("每条线时间间隔") self.label_4.setText("搜索股票") self.search_btn.setText("搜索") self.staDate_label.setText("开始时间") self.label_2.setText("结束时间") self.treeWidget_2.headerItem().setText(0,"绘图项") self.commandLinkButton.setText("开始绘图") self.action123.setText("123")
class MainWindow_UI(object): def __init__(self): self.WindowStyle="""background-color:rgba(0, 0, 0, 0); border-width: 1px; border-style: solid solid solid solid; border-color: white black black white; border-radius: 4px; """ self.WingetStyle=""" background:white; border-width: 0.5px; border-style: solid solid solid solid; border-color: black; border-radius: 2px; """ self.LogText ="""2018-3-8 15:09:18 开始奔跑,good luck!/n""" def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1350,750) MainWindow.setWindowTitle('GUI 界面') sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth()) MainWindow.setSizePolicy(sizePolicy) self.create_window(MainWindow) self.p=PatientLoginWindow() #按钮的动作 self.webButtonAction() self.PatientButtonAction() def create_window(self,MainWindow): self.centralwidget = QtWidgets.QWidget(MainWindow) #主框 self.centralwidget.setStyleSheet(self.WindowStyle) MainWindow.setCentralWidget(self.centralwidget) self.centralwidget.setEnabled(True) self.centralwidget.setObjectName("centralwidget") self.createLeftGroupBox() self.createGraphBox() self.createRightGroupBox() self.creatFormGroupBox() mainLayout = QtWidgets.QVBoxLayout(self.centralwidget) hboxLayout = QtWidgets.QHBoxLayout() #hboxLayout.addStretch() hboxLayout.addWidget(self.LeftGroupBox) hboxLayout.addWidget(self.GraphTab) hboxLayout.addWidget(self.RightGroupBox) hboxLayout.setSpacing(10) #设置间隔信息 hboxLayout.setStretch(0,5) hboxLayout.setStretch(1,400) hboxLayout.setStretch(2,60) mainLayout.addLayout(hboxLayout) mainLayout.addWidget(self.formGroupBox) mainLayout.setStretch(0, 90) mainLayout.setStretch(1, 10) #self.setLayout(mainLayout) def createGraphBox(self): self.GraphTab=QtWidgets.QTabWidget() self.GraphTab.setStyleSheet(self.WingetStyle) self.GraphTab.setObjectName("Graph Tab") self.createTAB() def createTAB(self): self.webView = QWebEngineView(self.centralwidget) self.webView.setMinimumSize(QtCore.QSize(500, 400)) self.webView.setUrl(QtCore.QUrl("about:blank")) self.webView.setObjectName("webView") self.WebTab=self.GraphTab.addTab(self.webView,'Web view') #self.GraphBox=QtWidgets.QWidget() #self.GraphTab=self.GraphTab.addTab(self.GraphBox,'graph view') def setQbutton(self,QButton,pixPATH,name): self.ButtonStyle=""" background:rgba(0, 0, 0, 0); border-width: 0.5px; border-style: none; border-color: black; border-radius: 2px; icon-size:50px 5px; """ QButton.setText(name) QButton.setIcon(QtGui.QIcon(QtGui.QPixmap(pixPATH))) QButton.setFixedSize(68,68)#设置按钮大小 QButton.setStyleSheet(self.ButtonStyle) QButton.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)#设置文字在图标面 #QButton.setIconSize(150,150) def createLeftGroupBox(self): self.LeftGroupBox = QtWidgets.QGroupBox("Grid layout") self.LeftGroupBox.setStyleSheet(self.WingetStyle) #self.LeftGroupBox.setFixedSize(200,600) layout = QtWidgets.QGridLayout() ''' 创建按钮 ''' self.DatasButton=QtWidgets.QToolButton()#数据按钮 self.GraphButton=QtWidgets.QToolButton()#绘图 self.ContactsButton=QtWidgets.QToolButton()#联系人 self.PatientButton=QtWidgets.QToolButton()#病人信息 self.FileButton=QtWidgets.QToolButton()#文件 self.WebButton=QtWidgets.QToolButton()#网络 self.CloudButton=QtWidgets.QToolButton() self.ScanButton=QtWidgets.QToolButton() ''' 设置按钮的外观 ''' self.setQbutton(self.DatasButton,'ICON\\pie.ico',"Date") self.setQbutton(self.GraphButton,'ICON\\bar.ico',"Graph") self.setQbutton(self.ContactsButton,'ICON\\contacts.ico',"contacts") self.setQbutton(self.PatientButton,'ICON\\patient.ico',"patient") self.setQbutton(self.FileButton,'ICON\\file.ico',"File") self.setQbutton(self.WebButton,'ICON\\baidu.ico',"Web") self.setQbutton(self.CloudButton,'ICON\\Cloud.ico',"Cloud") self.setQbutton(self.ScanButton,'ICON\\Scan.png',"Scan") ''' 设置按钮位置信息 ''' layout.setSpacing(2) layout.addWidget(self.DatasButton,0,0) layout.addWidget(self.GraphButton,1,0) layout.addWidget(self.ContactsButton,0,1) layout.addWidget(self.PatientButton,1,1) layout.addWidget(self.FileButton,2,0) layout.addWidget(self.WebButton,2,1) layout.addWidget(self.CloudButton,3,0) layout.addWidget(self.ScanButton,4,0) self.LeftGroupBox.setLayout(layout) def createRightGroupBox(self): self.RightGroupBox = QtWidgets.QGroupBox("Vbox layout") self.RightGroupBox.setStyleSheet(self.WingetStyle) layout = QtWidgets.QGridLayout() bigEditor = QtWidgets.QTextEdit() bigEditor.setPlainText("搭载了空间冷原子钟等14项应用载荷,以及失重心血管研究等航天医学实验设备 " "开展空间科学及技术试验.") layout.addWidget(bigEditor) self.RightGroupBox.setLayout(layout) def creatFormGroupBox(self): self.formGroupBox = QtWidgets.QGroupBox("Form layout") self.formGroupBox.setStyleSheet(self.WingetStyle) layout = QtWidgets.QFormLayout() performanceLabel = QtWidgets.QLabel("Console:") performanceEditor = QtWidgets.QLineEdit("目前显示的都是<信息>") planLabel = QtWidgets.QLabel("History Log:") self.planEditor = QtWidgets.QTextEdit() self.planEditor.setPlainText(self.LogText) layout.addRow(performanceLabel,performanceEditor) layout.addRow(planLabel,self.planEditor) self.formGroupBox.setLayout(layout) def setPlanEditor(self,msg): self.LogText =self.LogText + msg+ "\n" self.planEditor.setPlainText(self.LogText) def CreatWebTab(self):#穿件一个TAB 用于网络 现在占时定义为百度 if self.webTabFlag == False: self.BaiduView = QWebEngineView(self.centralwidget) self.BaiduView.setMinimumSize(QtCore.QSize(500, 400)) self.BaiduView.setUrl(QtCore.QUrl("https://www.baidu.com/")) self.BaiduView.setObjectName("search") self.WebTab=self.GraphTab.addTab(self.BaiduView,'百度 view') self.setPlanEditor('打开web 信息') self.webTabFlag = True elif self.webTabFlag == True: self.WebTab=self.GraphTab.removeTab(1) self.setPlanEditor('关闭web 信息') self.webTabFlag = False def webButtonAction(self): # 百度按钮的 动作 self.webTabFlag=False self.WebButton.clicked.connect(self.CreatWebTab) def PatientButtonAction(self): self.PatientButton.clicked.connect(self.p.handle_click) self.setPlanEditor('打开Patient 信息')
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.resize(1350, 750) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( MainWindow.sizePolicy().hasHeightForWidth()) MainWindow.setSizePolicy(sizePolicy) self.create_kline_page(MainWindow) #self.stacked_layout = QtWidgets.QStackedLayout() #self.stacked_layout.addWidget(self.create_kline_page(MainWindow)) @LOG.debug_fun def create_kline_page(self, MainWindow): self.centralwidget = QtWidgets.QWidget(MainWindow) #主框 self.centralwidget.setEnabled(True) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) #main window self.mainLayout = QtWidgets.QGridLayout(self.centralwidget) self.mainLayout.setObjectName(_fromUtf8("mainLayout")) self.topLayout(self.mainLayout, 0, 0) self.bottomLayout = QtWidgets.QHBoxLayout( ) # 底层layout 设置 框 包括gridLayout self.bottomLayout.setObjectName(_fromUtf8("bottomLayout")) self.mainLayout.addLayout(self.bottomLayout, 1, 0) self.gridLayout = QtWidgets.QGridLayout() #左侧区域 self.gridLayout.setContentsMargins( -1, -1, -1, 0) # I have no idea how layouts work self.gridLayout.setHorizontalSpacing(0) self.gridLayout.setObjectName(_fromUtf8("gridLayout")) self.dateEdit_2 = QtWidgets.QDateEdit(self.centralwidget) #End Date sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.dateEdit_2.sizePolicy().hasHeightForWidth()) self.dateEdit_2.setSizePolicy(sizePolicy) self.dateEdit_2.setObjectName(_fromUtf8("dateEdit_2")) self.gridLayout.addWidget(self.dateEdit_2, 4, 1, 1, 1) self.label = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.label.sizePolicy().hasHeightForWidth()) self.label.setSizePolicy(sizePolicy) self.label.setObjectName(_fromUtf8("label")) self.gridLayout.addWidget(self.label, 3, 0, 1, 1) self.dateEdit = QtWidgets.QDateEdit(self.centralwidget) #Start date sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.dateEdit.sizePolicy().hasHeightForWidth()) self.dateEdit.setSizePolicy(sizePolicy) self.dateEdit.setObjectName(_fromUtf8("dateEdit")) self.gridLayout.addWidget(self.dateEdit, 4, 0, 1, 1) self.label_2 = QtWidgets.QLabel(self.centralwidget) #Shows "enddate" sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.label_2.sizePolicy().hasHeightForWidth()) self.label_2.setSizePolicy(sizePolicy) self.label_2.setObjectName(_fromUtf8("label_2")) self.gridLayout.addWidget(self.label_2, 3, 1, 1, 1) self.verticalLayout_3 = QtWidgets.QVBoxLayout() self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3")) self.treeWidget = QtWidgets.QTreeWidget( self.centralwidget) #Displays stock according to business type sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(2) sizePolicy.setHeightForWidth( self.treeWidget.sizePolicy().hasHeightForWidth()) self.treeWidget.setSizePolicy(sizePolicy) self.treeWidget.setObjectName(_fromUtf8("treeWidget")) self.treeWidget.headerItem().setText(0, _fromUtf8("历史数据")) self.verticalLayout_3.addWidget(self.treeWidget) self.gridLayout.addLayout(self.verticalLayout_3, 1, 0, 1, 3) ''' 设置日期按钮 ''' self.DateLinkButton = QtWidgets.QPushButton(self.centralwidget) self.DateButtonATT() self.gridLayout.addWidget(self.DateLinkButton, 4, 2, 1, 1) self.comboBox = QtWidgets.QComboBox( self.centralwidget) #Combobox for Selecting type of graph sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.comboBox.sizePolicy().hasHeightForWidth()) self.comboBox.setSizePolicy(sizePolicy) self.comboBox.setObjectName(_fromUtf8("comboBox")) self.gridLayout.addWidget(self.comboBox, 3, 2, 1, 1) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Maximum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(1) ''' 废弃 左下角 标签 self.treeWidget_2 = QtWidgets.QTreeWidget(self.centralwidget) sizePolicy.setHeightForWidth(self.treeWidget_2.sizePolicy().hasHeightForWidth()) self.treeWidget_2.setSizePolicy(sizePolicy)#Shows what graphs are selected self.treeWidget_2.setObjectName(_fromUtf8("treeWidget_2")) self.treeWidget_2.headerItem().setText(0, _fromUtf8("绘图项")) #self.gridLayout.addWidget(self.treeWidget_2, 5, 0, 1, 3)# 左侧列表 绘图项 #self.treeWidget_2_structure() ''' ''' 左下角 Tab ''' self.TabPart = QtWidgets.QTabWidget(self.centralwidget) sizePolicy.setHeightForWidth( self.TabPart.sizePolicy().hasHeightForWidth()) self.TabPart.setObjectName(_fromUtf8("tabpart")) self.gridLayout.addWidget(self.TabPart, 5, 0, 1, 3) self.TabPartLayout() self.gridLayout.setColumnStretch(0, 60) self.gridLayout.setColumnStretch(1, 20) self.gridLayout.setColumnStretch(2, 20) self.bottomLayout.addLayout(self.gridLayout) ''' 设置绘图区 ''' #self.verticalLayout = QtWidgets.QGridLayout()# #self.verticalLayout.setObjectName(_fromUtf8("grph")) self.GraphTab = QtWidgets.QTabWidget(self.centralwidget) self.GraphTab.setObjectName(_fromUtf8("Graph Tab")) #self.verticalLayout.addWidget(self.GraphTab) self.widget = QtWidgets.QGraphicsView(self.centralwidget) #设置输入图画 sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth( self.widget.sizePolicy().hasHeightForWidth()) self.widget.setSizePolicy(sizePolicy) self.widget.setObjectName(_fromUtf8("widget")) #设置第二页 #self.IndexLink=self.GraphTab.addTab(self.widget,'Index Link') self.webView = QWebEngineView(self.centralwidget) self.webView.setMinimumSize(QtCore.QSize(500, 400)) self.webView.setUrl(QtCore.QUrl("about:blank")) self.webView.setObjectName("webView") self.WebTab = self.GraphTab.addTab(self.webView, 'top10') #self.widget = Action_main.PlotCanvas(self,width=5,hegit=4) #This is for displaying html content generated by pyecharts # self.widget = QWebEngineView()#This is for displaying html content generated by pyecharts #self.verticalLayout.addWidget(self.widget) #self.bottomLayout.addLayout(self.verticalLayout) self.bottomLayout.addWidget(self.GraphTab) self.bottomLayout.setStretch(0, 1) self.bottomLayout.setStretch(1, 15) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QToolBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 900, 23)) self.menubar.setObjectName(_fromUtf8("menubar")) #self.menubar.setNativeMenuBar(False) self.combobox = QtWidgets.QComboBox() self.menubar.addWidget(self.combobox) self.combobox.addItems(["K线", "复权", "分笔数据", "历史分钟", "十大股东"]) self.comboBox.setFixedSize(55, 40) MainWindow.addToolBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName(_fromUtf8("statusbar")) MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) #顶层 layout ''' 设置日期按钮属性定义 ''' def DateButtonATT(self): self.DateLinkButton.setObjectName(_fromUtf8("SetDate")) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.DateLinkButton.sizePolicy().hasHeightForWidth()) self.DateLinkButton.setSizePolicy(sizePolicy) self.DateLinkButton.setText(_fromUtf8("")) self.DateLinkButton.setIcon( QtGui.QIcon(QtGui.QPixmap('scr/ico/date_r.ico'))) self.DateLinkButton.setFlat(True) self.DateLinkButton.setIconSize(QtCore.QSize(20, 20)) #self.DateLinkButton.released.connect(self.DateLinkButton.setIcon(QtGui.QIcon(QtGui.QPixmap('scr/ico/date_r.ico')))) def topLayout(self, layout, x=0, y=0): self.topGrid = QtWidgets.QGridLayout() self.topGrid.setObjectName(_fromUtf8("topGrid")) layout.addLayout(self.topGrid, x, y) self.topGrid.setColumnStretch(0, 20) self.topGrid.setColumnStretch(1, 20) self.topGrid.setColumnStretch(2, 20) self.topGrid.setColumnStretch(3, 60) self.topGrid.setColumnStretch(4, 20) self.topGrid.setColumnStretch(5, 20) self.topGrid.setColumnStretch(6, 20) self.clockui() self.topGrid.setSpacing(2) self.topGrid.addWidget(self.lcd, 0, 6) #输入栏 self.code_line = self.code_layout('code') self.topGrid.addLayout(self.code_line, 0, 3) #self.startButton=QtWidgets.QPushButton('Run') #self.topGrid.addWidget(self.startButton,0,0) self.codelabel = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.codelabel.sizePolicy().hasHeightForWidth()) self.codelabel.setSizePolicy(sizePolicy) self.codelabel.setObjectName(_fromUtf8("label")) self.codelabel.setText(_translate("MainWindow", "上海", None)) self.topGrid.addWidget(self.codelabel, 0, 1) #进程 self.pbar = QtWidgets.QProgressBar() self.topGrid.addWidget(self.pbar, 0, 5) self.ProgressBarLayout() def TabPartLayout(self): self.TabPart.setStyleSheet("background: lightgray") self.Funtab = self.TabPart.addTab(QtWidgets.QWidget(), 'Function') self.FDTtab = self.TabPart.addTab(QtWidgets.QWidget(), 'Fundamentals') self.PFTtab = self.TabPart.addTab(QtWidgets.QWidget(), 'Profit') #self.TabFun return ''' def treeWidget_2_structure(self): self.Tree2CYQ=QtWidgets.QTreeWidgetItem(self.treeWidget_2) self.Tree2CYQ.setText(0,'CYQ') self.Tree2CYQ.checkState(0) ''' def code_layout(self, name): lineGrid = QtWidgets.QGridLayout() self.code_edit = QtWidgets.QLineEdit() self.code_edit.setPlaceholderText('输入code') self.code_edit.setAlignment(QtCore.Qt.AlignCenter) lineGrid.addWidget(self.code_edit, 0, 0) self.searchButton = QtWidgets.QPushButton() self.searchButton.setIcon( QtGui.QIcon(QtGui.QPixmap('scr/ico/search_r.ico'))) self.searchButton.setFlat(True) self.searchButton.setIconSize(QtCore.QSize(20, 20)) #self.searchButton.setStyleSheet("border: 0px") lineGrid.addWidget(self.searchButton, 0, 1) return lineGrid def ProgressBarLayout(self): self.pbar.reset() self.pbar.setRange(0, 100) ''' 进度条步进 ''' def ProgressBarStep(self): if self.step >= 100: self.timer.stop() self.btn.setText('Finished') return self.step = self.step + 1 self.pbar.setValue(self.step) #设置时钟UI def clockui(self): self.lcd = QtWidgets.QLCDNumber() self.lcd.setDigitCount(10) self.lcd.setMode(self.lcd.Dec) self.lcd.display(time.strftime("%X", time.localtime())) self.timer = QtCore.QTimer() self.timer.setInterval(1000) self.timer.start() self.timer.timeout.connect(self.onTimerOut) #LED aydispl def onTimerOut(self): self.lcd.display(time.strftime("%X", time.localtime())) def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(_translate("Tuchart", "Tuchart", None)) self.label.setText(_translate("MainWindow", "Start", None)) self.label_2.setText(_translate("MainWindow", "End", None))
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1105, 583) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.gridLayout = QtWidgets.QGridLayout(self.centralwidget) self.gridLayout.setObjectName("gridLayout") self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.combobox = QtWidgets.QComboBox(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.combobox.sizePolicy().hasHeightForWidth()) self.combobox.setSizePolicy(sizePolicy) self.combobox.setObjectName("combobox") self.combobox.addItems(["K线", "复权", "分笔数据", "历史分钟", "十大股东"]) self.horizontalLayout_3.addWidget(self.combobox) spacerItem = QtWidgets.QSpacerItem(110, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem) self.gridLayout.addLayout(self.horizontalLayout_3, 0, 0, 1, 1) self.horizontalLayout_5 = QtWidgets.QHBoxLayout() self.horizontalLayout_5.setObjectName("horizontalLayout_5") self.init_category_btn = QtWidgets.QPushButton(self.centralwidget) self.init_category_btn.setMaximumSize(QtCore.QSize(90, 16777215)) self.init_category_btn.setObjectName("init_category_btn") self.horizontalLayout_5.addWidget(self.init_category_btn) self.init_code_btn = QtWidgets.QPushButton(self.centralwidget) self.init_code_btn.setMinimumSize(QtCore.QSize(90, 0)) self.init_code_btn.setMaximumSize(QtCore.QSize(90, 16777215)) self.init_code_btn.setObjectName("init_code_btn") self.horizontalLayout_5.addWidget(self.init_code_btn) self.gridLayout.addLayout(self.horizontalLayout_5, 2, 0, 1, 1) self.horizontalLayout_8 = QtWidgets.QHBoxLayout() self.horizontalLayout_8.setObjectName("horizontalLayout_8") self.interval_label = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.interval_label.sizePolicy().hasHeightForWidth()) self.interval_label.setSizePolicy(sizePolicy) self.interval_label.setMinimumSize(QtCore.QSize(0, 0)) self.interval_label.setMaximumSize(QtCore.QSize(100, 16777215)) self.interval_label.setObjectName("interval_label") self.horizontalLayout_8.addWidget(self.interval_label) self.comboBox = QtWidgets.QComboBox(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.comboBox.sizePolicy().hasHeightForWidth()) self.comboBox.setSizePolicy(sizePolicy) self.comboBox.setMaximumSize(QtCore.QSize(80, 16777215)) self.comboBox.setObjectName("comboBox") self.horizontalLayout_8.addWidget(self.comboBox) self.gridLayout.addLayout(self.horizontalLayout_8, 4, 0, 1, 1) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.dateEdit = QtWidgets.QDateEdit(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.dateEdit.sizePolicy().hasHeightForWidth()) self.dateEdit.setSizePolicy(sizePolicy) self.dateEdit.setMinimumSize(QtCore.QSize(80, 0)) self.dateEdit.setMaximumSize(QtCore.QSize(90, 16777215)) self.dateEdit.setObjectName("dateEdit") self.horizontalLayout_2.addWidget(self.dateEdit) self.dateEdit_2 = QtWidgets.QDateEdit(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.dateEdit_2.sizePolicy().hasHeightForWidth()) self.dateEdit_2.setSizePolicy(sizePolicy) self.dateEdit_2.setMinimumSize(QtCore.QSize(85, 0)) self.dateEdit_2.setMaximumSize(QtCore.QSize(90, 16777215)) self.dateEdit_2.setObjectName("dateEdit_2") self.horizontalLayout_2.addWidget(self.dateEdit_2) self.gridLayout.addLayout(self.horizontalLayout_2, 6, 0, 1, 1) self.treeWidget = QtWidgets.QTreeWidget(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.treeWidget.sizePolicy().hasHeightForWidth()) self.treeWidget.setSizePolicy(sizePolicy) self.treeWidget.setMinimumSize(QtCore.QSize(160, 0)) self.treeWidget.setMaximumSize(QtCore.QSize(200, 16777215)) self.treeWidget.setObjectName("treeWidget") self.treeWidget.headerItem().setText(0, "历史数据---右键菜单选择") self.gridLayout.addWidget(self.treeWidget, 3, 0, 1, 1) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.label_4 = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.label_4.sizePolicy().hasHeightForWidth()) self.label_4.setSizePolicy(sizePolicy) self.label_4.setMaximumSize(QtCore.QSize(48, 16777215)) self.label_4.setObjectName("label_4") self.horizontalLayout.addWidget(self.label_4) self.search_lineEdit = QtWidgets.QLineEdit(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.search_lineEdit.sizePolicy().hasHeightForWidth()) self.search_lineEdit.setSizePolicy(sizePolicy) self.search_lineEdit.setMinimumSize(QtCore.QSize(75, 0)) self.search_lineEdit.setMaximumSize(QtCore.QSize(90, 16777215)) self.search_lineEdit.setMaxLength(20) self.search_lineEdit.setObjectName("search_lineEdit") self.horizontalLayout.addWidget(self.search_lineEdit) self.search_btn = QtWidgets.QPushButton(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.search_btn.sizePolicy().hasHeightForWidth()) self.search_btn.setSizePolicy(sizePolicy) self.search_btn.setMinimumSize(QtCore.QSize(40, 0)) self.search_btn.setMaximumSize(QtCore.QSize(30, 16777215)) self.search_btn.setObjectName("search_btn") self.horizontalLayout.addWidget(self.search_btn) self.gridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 1) self.horizontalLayout_4 = QtWidgets.QHBoxLayout() self.horizontalLayout_4.setObjectName("horizontalLayout_4") self.staDate_label = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.staDate_label.sizePolicy().hasHeightForWidth()) self.staDate_label.setSizePolicy(sizePolicy) self.staDate_label.setMinimumSize(QtCore.QSize(80, 0)) self.staDate_label.setMaximumSize(QtCore.QSize(90, 16777215)) self.staDate_label.setObjectName("staDate_label") self.horizontalLayout_4.addWidget(self.staDate_label) self.label_2 = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.label_2.sizePolicy().hasHeightForWidth()) self.label_2.setSizePolicy(sizePolicy) self.label_2.setMinimumSize(QtCore.QSize(80, 0)) self.label_2.setMaximumSize(QtCore.QSize(90, 16777215)) self.label_2.setObjectName("label_2") self.horizontalLayout_4.addWidget(self.label_2) self.gridLayout.addLayout(self.horizontalLayout_4, 5, 0, 1, 1) self.treeWidget_2 = QtWidgets.QTreeWidget(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.treeWidget_2.sizePolicy().hasHeightForWidth()) self.treeWidget_2.setSizePolicy(sizePolicy) self.treeWidget_2.setMinimumSize(QtCore.QSize(160, 0)) self.treeWidget_2.setMaximumSize(QtCore.QSize(200, 16777215)) self.treeWidget_2.setObjectName("treeWidget_2") font = QtGui.QFont("Times", 12, QtGui.QFont.Bold) self.treeWidget_2.setFont(font) self.gridLayout.addWidget(self.treeWidget_2, 8, 0, 1, 1) self.commandLinkButton = QtWidgets.QCommandLinkButton( self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.commandLinkButton.sizePolicy().hasHeightForWidth()) self.commandLinkButton.setSizePolicy(sizePolicy) self.commandLinkButton.setMaximumSize(QtCore.QSize(110, 16777215)) font = QtGui.QFont() font.setFamily("Segoe UI") font.setPointSize(11) self.commandLinkButton.setFont(font) self.commandLinkButton.setObjectName("commandLinkButton") self.gridLayout.addWidget(self.commandLinkButton, 7, 0, 1, 1) self.webView = QWebEngineView(self.centralwidget) self.webView.setEnabled(True) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.webView.sizePolicy().hasHeightForWidth()) self.webView.setSizePolicy(sizePolicy) self.webView.setMinimumSize(QtCore.QSize(500, 400)) self.webView.setUrl(QtCore.QUrl("about:blank")) self.webView.setObjectName("webView") self.gridLayout.addWidget(self.webView, 0, 1, 9, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 1105, 23)) self.menubar.setObjectName("menubar") MainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.action123 = QtWidgets.QAction(MainWindow) self.action123.setObjectName("action123") MainWindow.setWindowTitle("Tuchart") self.init_category_btn.setText("分类显示股票") self.init_code_btn.setText("按编号显示股票") self.interval_label.setText("每条线时间间隔") self.label_4.setText("搜索股票") self.search_btn.setText("搜索") self.staDate_label.setText("开始时间") self.label_2.setText("结束时间") self.treeWidget_2.headerItem().setText(0, "绘图项") self.commandLinkButton.setText("开始绘图") self.action123.setText("123")