class WebPopupWindow(QWidget): def __init__(self, profile): super().__init__() self._view = QWebEngineView(self) super().setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose) super().setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) layout = QVBoxLayout() super().setLayout(layout) layout.addWidget(self._view) self._view.setPage(QWebEnginePage(profile, self._view)) self._view.titleChanged.connect(super().setWindowTitle) self._view.page().geometryChangeRequested.connect( self.handleGeometryChangeRequested ) self._view.page().windowCloseRequested.connect(super().close) def view(self): return self._view @pyqtSlot("const QRect") def handleGeometryChangeRequested(self, newGeometry): self._view.setMinimumSize(newGeometry.width(), newGeometry.height()) super().move(newGeometry.topLeft() - self._view.pos()) super().resize(0, 0) super().show()
class Ui_Form(object): def __init__(self, k): config = configparser.ConfigParser() config.read('gameSetting.ini') self.URL = config['BROWSER']['URL' + str(k)] self.gain = config.getfloat('BROWSER', 'gain' + str(k)) self.Dialog = QtWidgets.QDialog() self.setupUi(self.Dialog) def setupUi(self, Form): Form.setObjectName("Form") Form.resize(1300, 800) Form.setMinimumSize(QtCore.QSize(1300, 800)) Form.setMaximumSize(QtCore.QSize(1300, 800)) Form.setMouseTracking(True) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap("media/cat.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off) Form.setWindowIcon(icon) self.webEngineView = QWebEngineView(Form) self.webEngineView.setGeometry(QtCore.QRect(0, 0, 1300, 800)) self.webEngineView.setMinimumSize(QtCore.QSize(1300, 800)) self.webEngineView.setMaximumSize(QtCore.QSize(1300, 800)) self.webEngineView.setMouseTracking(False) self.webEngineView.setUrl(QtCore.QUrl(self.URL)) self.webEngineView.setZoomFactor(self.gain) self.webEngineView.setObjectName("webEngineView") self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) def retranslateUi(self, Form): _translate = QtCore.QCoreApplication.translate Form.setWindowTitle(_translate("Form", "黑猫浏览器"))
class LookUp(QApplication): def __init__(self): QApplication.__init__(self, []) self.window = QtWidgets.QWidget() self.window.setWindowTitle("IP Geolocator lookup") icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/ico/python.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.window.setWindowFlags(PyQt5.QtCore.Qt.WindowStaysOnTopHint) self.window.setWindowIcon(icon) self.web = QWebEngineView(self.window) self.web.setMinimumSize(1024, 800) # self.web().mainFrame().evaluateJavaScript(self.window) self.web.setHtml(maphtml) # self.layout = PyQt5.QtWebEngineWidgets.QWebEngineSettings(self.window) # self.layout.addWidget(self.web) self.window.show() self.exec_()
class Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") Form.resize(728, 480) self.horizontalLayout = QtWidgets.QHBoxLayout(Form) self.horizontalLayout.setObjectName("horizontalLayout") self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.label = QtWidgets.QPlainTextEdit(Form) self.label.setMinimumSize(QtCore.QSize(80, 0)) self.label.setReadOnly(True) self.label.appendPlainText("") self.label.setObjectName("label") self.verticalLayout.addWidget(self.label) self.pushButton = QtWidgets.QPushButton(Form) self.pushButton.setObjectName("pushButton") self.pushButton1 = QtWidgets.QPushButton(Form) self.pushButton1.setObjectName("pushButton1") self.lineEdit = QtWidgets.QLineEdit(Form) self.lineEdit.setMinimumSize(QtCore.QSize(80, 0)) self.lineEdit.setObjectName("lineEdit") self.verticalLayout.addWidget(self.lineEdit) self.verticalLayout.addWidget(self.pushButton) self.verticalLayout.addWidget(self.pushButton1) self.horizontalLayout.addLayout(self.verticalLayout) self.webView = QWebEngineView(Form) #self.webView.setUrl(QtCore.QUrl("about:blank")) self.webView.setObjectName("webView") self.webView.setMinimumSize(QtCore.QSize(500, 0)) self.horizontalLayout.addWidget(self.webView) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) def retranslateUi(self, Form): _translate = QtCore.QCoreApplication.translate Form.setWindowTitle(_translate("Form", "web")) self.pushButton.setText(_translate("Form", "发送(run js)")) self.pushButton1.setText(_translate("Form", "发送(信号槽)"))
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(800, 600) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.horizontalLayout_4 = QtWidgets.QHBoxLayout(self.centralwidget) self.horizontalLayout_4.setObjectName("horizontalLayout_4") self.scrollArea = QtWidgets.QScrollArea(self.centralwidget) self.scrollArea.setWidgetResizable(True) self.scrollArea.setObjectName("scrollArea") self.scrollAreaWidgetContents = QtWidgets.QWidget() self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 780, 535)) self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents") self.horizontalLayout_3 = QtWidgets.QHBoxLayout( self.scrollAreaWidgetContents) self.horizontalLayout_3.setContentsMargins(0, 0, 0, 0) self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.widget_parameter_tree = QtWidgets.QWidget( self.scrollAreaWidgetContents) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.widget_parameter_tree.sizePolicy().hasHeightForWidth()) self.widget_parameter_tree.setSizePolicy(sizePolicy) self.widget_parameter_tree.setMinimumSize(QtCore.QSize(100, 0)) self.widget_parameter_tree.setObjectName("widget_parameter_tree") self.horizontalLayout_2.addWidget(self.widget_parameter_tree) self.verticalLayout_3 = QtWidgets.QVBoxLayout() self.verticalLayout_3.setObjectName("verticalLayout_3") self.QWebEngineView_ProductVsHs300 = QWebEngineView( self.scrollAreaWidgetContents) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.QWebEngineView_ProductVsHs300. sizePolicy().hasHeightForWidth()) self.QWebEngineView_ProductVsHs300.setSizePolicy(sizePolicy) self.QWebEngineView_ProductVsHs300.setMinimumSize(QtCore.QSize(0, 100)) self.QWebEngineView_ProductVsHs300.setStyleSheet( "background-color: rgb(170, 170, 127);") self.QWebEngineView_ProductVsHs300.setObjectName( "QWebEngineView_ProductVsHs300") self.verticalLayout_3.addWidget(self.QWebEngineView_ProductVsHs300) self.tabWidget = QtWidgets.QTabWidget(self.scrollAreaWidgetContents) self.tabWidget.setMinimumSize(QtCore.QSize(200, 200)) self.tabWidget.setObjectName("tabWidget") self.tab = QtWidgets.QWidget() self.tab.setObjectName("tab") self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.tab) self.verticalLayout_2.setContentsMargins(0, 0, 0, 0) self.verticalLayout_2.setObjectName("verticalLayout_2") self.QWebEngineview_MonthReturn = QWebEngineView(self.tab) self.QWebEngineview_MonthReturn.setStyleSheet( "background-color: rgb(170, 170, 127);") self.QWebEngineview_MonthReturn.setObjectName( "QWebEngineview_MonthReturn") self.verticalLayout_2.addWidget(self.QWebEngineview_MonthReturn) self.tabWidget.addTab(self.tab, "") self.tab_2 = QtWidgets.QWidget() self.tab_2.setObjectName("tab_2") self.horizontalLayout = QtWidgets.QHBoxLayout(self.tab_2) self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.horizontalLayout.setObjectName("horizontalLayout") self.QWebEngineView_PeriodReturn = QWebEngineView(self.tab_2) self.QWebEngineView_PeriodReturn.setStyleSheet( "background-color: rgb(170, 170, 127);") self.QWebEngineView_PeriodReturn.setObjectName( "QWebEngineView_PeriodReturn") self.horizontalLayout.addWidget(self.QWebEngineView_PeriodReturn) self.tabWidget.addTab(self.tab_2, "") self.tab_3 = QtWidgets.QWidget() self.tab_3.setObjectName("tab_3") self.verticalLayout = QtWidgets.QVBoxLayout(self.tab_3) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setObjectName("verticalLayout") self.QWebEngineView_LagestBack = QWebEngineView(self.tab_3) self.QWebEngineView_LagestBack.setStyleSheet( "background-color: rgb(170, 170, 127);") self.QWebEngineView_LagestBack.setObjectName( "QWebEngineView_LagestBack") self.verticalLayout.addWidget(self.QWebEngineView_LagestBack) self.tabWidget.addTab(self.tab_3, "") self.verticalLayout_3.addWidget(self.tabWidget) self.horizontalLayout_2.addLayout(self.verticalLayout_3) self.horizontalLayout_3.addLayout(self.horizontalLayout_2) self.scrollArea.setWidget(self.scrollAreaWidgetContents) self.horizontalLayout_4.addWidget(self.scrollArea) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 23)) self.menubar.setObjectName("menubar") MainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) self.tabWidget.setCurrentIndex(1) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "基金量化投研系统v0.11")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("MainWindow", "月度收益")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("MainWindow", "区间收益")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), _translate("MainWindow", "回撤情况"))
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.setEnabled(True) MainWindow.resize(913, 971) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(3) sizePolicy.setVerticalStretch(33) sizePolicy.setHeightForWidth( MainWindow.sizePolicy().hasHeightForWidth()) MainWindow.setSizePolicy(sizePolicy) MainWindow.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu) MainWindow.setAutoFillBackground(True) MainWindow.setStyleSheet("") MainWindow.setAnimated(True) self.centralWidget = QtWidgets.QWidget(MainWindow) self.centralWidget.setObjectName("centralWidget") self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.centralWidget) self.verticalLayout_5.setObjectName("verticalLayout_5") self.tabWidget_PGMS = QtWidgets.QTabWidget(self.centralWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(20) sizePolicy.setVerticalStretch(44) sizePolicy.setHeightForWidth( self.tabWidget_PGMS.sizePolicy().hasHeightForWidth()) self.tabWidget_PGMS.setSizePolicy(sizePolicy) self.tabWidget_PGMS.setMinimumSize(QtCore.QSize(800, 700)) self.tabWidget_PGMS.setLayoutDirection(QtCore.Qt.LeftToRight) self.tabWidget_PGMS.setAutoFillBackground(True) self.tabWidget_PGMS.setStyleSheet("") self.tabWidget_PGMS.setTabBarAutoHide(True) self.tabWidget_PGMS.setObjectName("tabWidget_PGMS") self.tab_Combination = QtWidgets.QWidget() self.tab_Combination.setObjectName("tab_Combination") self.horizontalLayout_6 = QtWidgets.QHBoxLayout(self.tab_Combination) self.horizontalLayout_6.setContentsMargins(0, 0, 0, 0) self.horizontalLayout_6.setObjectName("horizontalLayout_6") self.scrollArea_3 = QtWidgets.QScrollArea(self.tab_Combination) self.scrollArea_3.setWidgetResizable(True) self.scrollArea_3.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop) self.scrollArea_3.setObjectName("scrollArea_3") self.scrollAreaWidgetContents_3 = QtWidgets.QWidget() self.scrollAreaWidgetContents_3.setGeometry( QtCore.QRect(0, 0, 852, 958)) self.scrollAreaWidgetContents_3.setObjectName( "scrollAreaWidgetContents_3") self.verticalLayout_8 = QtWidgets.QVBoxLayout( self.scrollAreaWidgetContents_3) self.verticalLayout_8.setContentsMargins(0, 0, 0, 0) self.verticalLayout_8.setObjectName("verticalLayout_8") self.verticalLayout_6 = QtWidgets.QVBoxLayout() self.verticalLayout_6.setObjectName("verticalLayout_6") self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem) self.verticalLayout_7 = QtWidgets.QVBoxLayout() self.verticalLayout_7.setObjectName("verticalLayout_7") self.label_7 = QtWidgets.QLabel(self.scrollAreaWidgetContents_3) self.label_7.setText("") self.label_7.setObjectName("label_7") self.verticalLayout_7.addWidget(self.label_7) self.label_10 = QtWidgets.QLabel(self.scrollAreaWidgetContents_3) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.label_10.sizePolicy().hasHeightForWidth()) self.label_10.setSizePolicy(sizePolicy) self.label_10.setObjectName("label_10") self.verticalLayout_7.addWidget(self.label_10) self.label_11 = QtWidgets.QLabel(self.scrollAreaWidgetContents_3) self.label_11.setObjectName("label_11") self.verticalLayout_7.addWidget(self.label_11) self.label_12 = QtWidgets.QLabel(self.scrollAreaWidgetContents_3) self.label_12.setObjectName("label_12") self.verticalLayout_7.addWidget(self.label_12) self.horizontalLayout_3.addLayout(self.verticalLayout_7) spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.horizontalLayout_3.addItem(spacerItem1) self.gridLayout_5 = QtWidgets.QGridLayout() self.gridLayout_5.setObjectName("gridLayout_5") self.label_8 = QtWidgets.QLabel(self.scrollAreaWidgetContents_3) self.label_8.setObjectName("label_8") self.gridLayout_5.addWidget(self.label_8, 0, 0, 1, 1) self.label_9 = QtWidgets.QLabel(self.scrollAreaWidgetContents_3) self.label_9.setObjectName("label_9") self.gridLayout_5.addWidget(self.label_9, 0, 1, 1, 1) self.doubleSpinBox_returns_min = QtWidgets.QDoubleSpinBox( self.scrollAreaWidgetContents_3) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.doubleSpinBox_returns_min.sizePolicy().hasHeightForWidth()) self.doubleSpinBox_returns_min.setSizePolicy(sizePolicy) self.doubleSpinBox_returns_min.setMaximum(0.3) self.doubleSpinBox_returns_min.setSingleStep(0.01) self.doubleSpinBox_returns_min.setProperty("value", 0.0) self.doubleSpinBox_returns_min.setObjectName( "doubleSpinBox_returns_min") self.gridLayout_5.addWidget(self.doubleSpinBox_returns_min, 1, 0, 1, 1) self.doubleSpinBox_returns_max = QtWidgets.QDoubleSpinBox( self.scrollAreaWidgetContents_3) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.doubleSpinBox_returns_max.sizePolicy().hasHeightForWidth()) self.doubleSpinBox_returns_max.setSizePolicy(sizePolicy) self.doubleSpinBox_returns_max.setMinimum(0.0) self.doubleSpinBox_returns_max.setMaximum(10.0) self.doubleSpinBox_returns_max.setSingleStep(0.1) self.doubleSpinBox_returns_max.setProperty("value", 0.0) self.doubleSpinBox_returns_max.setObjectName( "doubleSpinBox_returns_max") self.gridLayout_5.addWidget(self.doubleSpinBox_returns_max, 1, 1, 1, 1) self.doubleSpinBox_maxdrawdown_min = QtWidgets.QDoubleSpinBox( self.scrollAreaWidgetContents_3) self.doubleSpinBox_maxdrawdown_min.setMinimum(0.1) self.doubleSpinBox_maxdrawdown_min.setMaximum(1.0) self.doubleSpinBox_maxdrawdown_min.setSingleStep(0.01) self.doubleSpinBox_maxdrawdown_min.setProperty("value", 0.7) self.doubleSpinBox_maxdrawdown_min.setObjectName( "doubleSpinBox_maxdrawdown_min") self.gridLayout_5.addWidget(self.doubleSpinBox_maxdrawdown_min, 2, 0, 1, 1) self.doubleSpinBox_maxdrawdown_max = QtWidgets.QDoubleSpinBox( self.scrollAreaWidgetContents_3) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.doubleSpinBox_maxdrawdown_max. sizePolicy().hasHeightForWidth()) self.doubleSpinBox_maxdrawdown_max.setSizePolicy(sizePolicy) self.doubleSpinBox_maxdrawdown_max.setMinimum(0.2) self.doubleSpinBox_maxdrawdown_max.setMaximum(1.0) self.doubleSpinBox_maxdrawdown_max.setSingleStep(0.01) self.doubleSpinBox_maxdrawdown_max.setProperty("value", 1.0) self.doubleSpinBox_maxdrawdown_max.setObjectName( "doubleSpinBox_maxdrawdown_max") self.gridLayout_5.addWidget(self.doubleSpinBox_maxdrawdown_max, 2, 1, 1, 1) self.doubleSpinBox_sharp_min = QtWidgets.QDoubleSpinBox( self.scrollAreaWidgetContents_3) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.doubleSpinBox_sharp_min.sizePolicy().hasHeightForWidth()) self.doubleSpinBox_sharp_min.setSizePolicy(sizePolicy) self.doubleSpinBox_sharp_min.setMaximum(40.0) self.doubleSpinBox_sharp_min.setSingleStep(0.05) self.doubleSpinBox_sharp_min.setObjectName("doubleSpinBox_sharp_min") self.gridLayout_5.addWidget(self.doubleSpinBox_sharp_min, 3, 0, 1, 1) self.doubleSpinBox_sharp_max = QtWidgets.QDoubleSpinBox( self.scrollAreaWidgetContents_3) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.doubleSpinBox_sharp_max.sizePolicy().hasHeightForWidth()) self.doubleSpinBox_sharp_max.setSizePolicy(sizePolicy) self.doubleSpinBox_sharp_max.setProperty("value", 10.0) self.doubleSpinBox_sharp_max.setObjectName("doubleSpinBox_sharp_max") self.gridLayout_5.addWidget(self.doubleSpinBox_sharp_max, 3, 1, 1, 1) self.horizontalLayout_3.addLayout(self.gridLayout_5) self.line_2 = QtWidgets.QFrame(self.scrollAreaWidgetContents_3) self.line_2.setFrameShape(QtWidgets.QFrame.VLine) self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_2.setObjectName("line_2") self.horizontalLayout_3.addWidget(self.line_2) spacerItem2 = QtWidgets.QSpacerItem(200, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem2) self.pushButton_start_combination = QtWidgets.QPushButton( self.scrollAreaWidgetContents_3) self.pushButton_start_combination.setObjectName( "pushButton_start_combination") self.horizontalLayout_3.addWidget(self.pushButton_start_combination) spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem3) self.verticalLayout_6.addLayout(self.horizontalLayout_3) self.horizontalLayout_7 = QtWidgets.QHBoxLayout() self.horizontalLayout_7.setObjectName("horizontalLayout_7") self.checkBox_stock = QtWidgets.QCheckBox( self.scrollAreaWidgetContents_3) self.checkBox_stock.setObjectName("checkBox_stock") self.horizontalLayout_7.addWidget(self.checkBox_stock) self.checkBox_compound = QtWidgets.QCheckBox( self.scrollAreaWidgetContents_3) self.checkBox_compound.setObjectName("checkBox_compound") self.horizontalLayout_7.addWidget(self.checkBox_compound) self.checkBox_future_manage = QtWidgets.QCheckBox( self.scrollAreaWidgetContents_3) self.checkBox_future_manage.setObjectName("checkBox_future_manage") self.horizontalLayout_7.addWidget(self.checkBox_future_manage) self.checkBox_event = QtWidgets.QCheckBox( self.scrollAreaWidgetContents_3) self.checkBox_event.setObjectName("checkBox_event") self.horizontalLayout_7.addWidget(self.checkBox_event) self.checkBox_bond = QtWidgets.QCheckBox( self.scrollAreaWidgetContents_3) self.checkBox_bond.setObjectName("checkBox_bond") self.horizontalLayout_7.addWidget(self.checkBox_bond) self.checkBox_macro = QtWidgets.QCheckBox( self.scrollAreaWidgetContents_3) self.checkBox_macro.setObjectName("checkBox_macro") self.horizontalLayout_7.addWidget(self.checkBox_macro) self.checkBox_combination_fund = QtWidgets.QCheckBox( self.scrollAreaWidgetContents_3) self.checkBox_combination_fund.setObjectName( "checkBox_combination_fund") self.horizontalLayout_7.addWidget(self.checkBox_combination_fund) self.checkBox_relative_fund = QtWidgets.QCheckBox( self.scrollAreaWidgetContents_3) self.checkBox_relative_fund.setObjectName("checkBox_relative_fund") self.horizontalLayout_7.addWidget(self.checkBox_relative_fund) self.checkBox_others = QtWidgets.QCheckBox( self.scrollAreaWidgetContents_3) self.checkBox_others.setObjectName("checkBox_others") self.horizontalLayout_7.addWidget(self.checkBox_others) self.verticalLayout_6.addLayout(self.horizontalLayout_7) self.verticalLayout_8.addLayout(self.verticalLayout_6) self.QWebEngineview_Combination_monte_markovitz = QWebEngineView( self.scrollAreaWidgetContents_3) self.QWebEngineview_Combination_monte_markovitz.setMinimumSize( QtCore.QSize(0, 300)) self.QWebEngineview_Combination_monte_markovitz.setStyleSheet( "background-color: rgb(170, 170, 127);") self.QWebEngineview_Combination_monte_markovitz.setObjectName( "QWebEngineview_Combination_monte_markovitz") self.verticalLayout_8.addWidget( self.QWebEngineview_Combination_monte_markovitz) self.horizontalLayout_5 = QtWidgets.QHBoxLayout() self.horizontalLayout_5.setObjectName("horizontalLayout_5") self.QWebEngineview_Combination_Pie = QWebEngineView( self.scrollAreaWidgetContents_3) self.QWebEngineview_Combination_Pie.setMinimumSize( QtCore.QSize(50, 200)) self.QWebEngineview_Combination_Pie.setStyleSheet( "background-color: rgb(170, 170, 127);") self.QWebEngineview_Combination_Pie.setObjectName( "QWebEngineview_Combination_Pie") self.horizontalLayout_5.addWidget(self.QWebEngineview_Combination_Pie) self.QWebEngineview_Combination_Table = QWebEngineView( self.scrollAreaWidgetContents_3) self.QWebEngineview_Combination_Table.setMinimumSize( QtCore.QSize(0, 200)) self.QWebEngineview_Combination_Table.setStyleSheet( "background-color: rgb(170, 170, 127);") self.QWebEngineview_Combination_Table.setObjectName( "QWebEngineview_Combination_Table") self.horizontalLayout_5.addWidget( self.QWebEngineview_Combination_Table) self.verticalLayout_8.addLayout(self.horizontalLayout_5) self.QWebEngineview_Combination_Versus = QWebEngineView( self.scrollAreaWidgetContents_3) self.QWebEngineview_Combination_Versus.setEnabled(True) self.QWebEngineview_Combination_Versus.setMinimumSize( QtCore.QSize(0, 300)) self.QWebEngineview_Combination_Versus.setStyleSheet( "background-color: rgb(170, 170, 127);") self.QWebEngineview_Combination_Versus.setObjectName( "QWebEngineview_Combination_Versus") self.verticalLayout_8.addWidget(self.QWebEngineview_Combination_Versus) self.QWebEngineview_Combination_monte_markovitz.raise_() self.QWebEngineview_Combination_Versus.raise_() self.scrollArea_3.setWidget(self.scrollAreaWidgetContents_3) self.horizontalLayout_6.addWidget(self.scrollArea_3) self.tabWidget_PGMS.addTab(self.tab_Combination, "") self.verticalLayout_5.addWidget(self.tabWidget_PGMS) MainWindow.setCentralWidget(self.centralWidget) self.menuBar = QtWidgets.QMenuBar(MainWindow) self.menuBar.setGeometry(QtCore.QRect(0, 0, 913, 23)) self.menuBar.setObjectName("menuBar") MainWindow.setMenuBar(self.menuBar) self.action = QtWidgets.QAction(MainWindow) self.action.setObjectName("action") self.action_2 = QtWidgets.QAction(MainWindow) self.action_2.setObjectName("action_2") self.action_3 = QtWidgets.QAction(MainWindow) self.action_3.setObjectName("action_3") self.action_4 = QtWidgets.QAction(MainWindow) self.action_4.setObjectName("action_4") self.action_5 = QtWidgets.QAction(MainWindow) self.action_5.setObjectName("action_5") self.action_6 = QtWidgets.QAction(MainWindow) self.action_6.setObjectName("action_6") self.action_8 = QtWidgets.QAction(MainWindow) self.action_8.setObjectName("action_8") self.action_9 = QtWidgets.QAction(MainWindow) self.action_9.setObjectName("action_9") self.action_10 = QtWidgets.QAction(MainWindow) self.action_10.setObjectName("action_10") self.action_11 = QtWidgets.QAction(MainWindow) self.action_11.setObjectName("action_11") self.action_Qt = QtWidgets.QAction(MainWindow) self.action_Qt.setObjectName("action_Qt") self.action_PyQt = QtWidgets.QAction(MainWindow) self.action_PyQt.setObjectName("action_PyQt") self.action_12 = QtWidgets.QAction(MainWindow) self.action_12.setObjectName("action_12") self.retranslateUi(MainWindow) self.tabWidget_PGMS.setCurrentIndex(0) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "基金量化投研系統v0.11")) self.label_10.setText(_translate("MainWindow", "收益")) self.label_11.setText(_translate("MainWindow", "最大回撤")) self.label_12.setText(_translate("MainWindow", "Sharp比")) self.label_8.setText(_translate("MainWindow", "最小範圍")) self.label_9.setText(_translate("MainWindow", "最大範圍")) self.pushButton_start_combination.setText( _translate("MainWindow", "開始")) self.checkBox_stock.setText(_translate("MainWindow", "股票策略")) self.checkBox_compound.setText(_translate("MainWindow", "複合策略")) self.checkBox_future_manage.setText(_translate("MainWindow", "管理期貨")) self.checkBox_event.setText(_translate("MainWindow", "事件驅動")) self.checkBox_bond.setText(_translate("MainWindow", "債券策略")) self.checkBox_macro.setText(_translate("MainWindow", "宏觀策略")) self.checkBox_combination_fund.setText(_translate( "MainWindow", "組合基金")) self.checkBox_relative_fund.setText(_translate("MainWindow", "相對價值")) self.checkBox_others.setText(_translate("MainWindow", "其他策略")) self.tabWidget_PGMS.setTabText( self.tabWidget_PGMS.indexOf(self.tab_Combination), _translate("MainWindow", "產品組合管理")) self.action.setText(_translate("MainWindow", "開啟")) self.action_2.setText(_translate("MainWindow", "關閉")) self.action_3.setText(_translate("MainWindow", "儲存")) self.action_4.setText(_translate("MainWindow", "退出")) self.action_5.setText(_translate("MainWindow", "複製")) self.action_6.setText(_translate("MainWindow", "貼上")) self.action_8.setText(_translate("MainWindow", "哈哈")) self.action_9.setText(_translate("MainWindow", "關於")) self.action_10.setText(_translate("MainWindow", "使用說明")) self.action_11.setText(_translate("MainWindow", "關於軟體")) self.action_Qt.setText(_translate("MainWindow", "關於Qt")) self.action_PyQt.setText(_translate("MainWindow", "關於PyQt")) self.action_12.setText(_translate("MainWindow", "其他"))
class Prueba(QMainWindow): _singleton = None @classmethod def get_instance(cls, *args, **kwargs): if not cls._singleton: cls._singleton = Prueba() return cls._singleton def __init__(self): super().__init__() self.log = {} self.hMiHilo = MiHilo() self.hMiHilo.start() self.hMiHilo.signal_recive.connect(self.recibirMensaje) self.hMiHilo.signal_connected.connect(self.actualizarListaUsuarios) # hMiHilo.finished.connect(self.recibirMensaje) self.initUI() self.show() def initUI(self): # Add core elements for the window self.lblDesign = QLabel("", self) self.lblDesign.setStyleSheet( "background-color: #019A74; font-weight: bold; color: White; font-family: century gothic; font-size: 16px" ) self.lblDesign.setMinimumSize(1000, 70) self.img_logo = QLabel(self) pixmap = QPixmap("Images/mini_Teacher3.png") self.img_logo.setPixmap(pixmap) self.img_logo.move(20, -12) self.img_logo.setMinimumSize(100, 100) self.lbl_tittle1 = QLabel("Aula ", self) self.lbl_tittle1.setStyleSheet( "font-weight: b old; color: white; font-family: century gothic; font-size: 32px" ) self.lbl_tittle1.move(415, 90) self.lbl_tittle2 = QLabel("Virtual", self) self.lbl_tittle2.setStyleSheet( "font-weight: bold; color: white; font-family: century gothic; font-size: 32px" ) self.lbl_tittle2.setMinimumSize(110, 30) self.lbl_tittle2.move(507, 90) # This window # self.setFixedSize(1366, 768) self.setFixedSize(1000, 700) self.setWindowTitle('Aula virtual') palette = QPalette() palette.setBrush(QPalette.Background, QBrush(QColor("#1B528A"))) # # Slides # self.lbl_slides = QLabel("", self) # self.lbl_slides.setStyleSheet( # "background-color: #019A74; font-weight: bold; color: White; font-family: century gothic; font-size: 16px") # self.lbl_slides.setMinimumSize(645, 355) # self.lbl_slides.move(293, 140) # Camera self.lbl_camera = QVBoxLayout() self.web = QWebEngineView(self) settings = QWebEngineSettings.globalSettings().setAttribute( QWebEngineSettings.PluginsEnabled, True) settings = QWebEngineSettings.globalSettings().setAttribute( QWebEngineSettings.AllowRunningInsecureContent, True) self.web.page().featurePermissionRequested.connect(self.permisos) self.web.page().setUrl( QUrl("http://192.168.43.105:5080/demos/simpleSubscriber.html")) # self.web.load(QUrl("http://localhost:5080/demos/simpleSubscriber.html")) self.web.setMinimumSize(370, 300) self.web.move(60, 140) self.web.show() self.lbl_camera.addWidget(self.web) # self.lbl_camera.setStyleSheet( # "background-color: #019A74; font-weight: bold; color: White; font-family: century gothic; font-size: 16px") self.lbl_camera # self.lbl_camera. # Chat self.lbl_chat = QLabel("", self) self.lbl_chat.setStyleSheet( "background-color: White; font-weight: bold; color: White; font-family: century gothic; font-size: 16px" ) self.lbl_chat.setMinimumSize(645, 220) self.lbl_chat.move(293, 460) self.txt_messages = QTextEdit("", self) self.txt_messages.setStyleSheet( "font-weight: bold; color: black; font-family: century gothic; font-size: 16px" ) self.txt_messages.setMinimumSize(630, 130) self.txt_messages.move(300, 477) self.txt_messages.setReadOnly(True) # Text field self.txt_message = QTextEdit("", self) self.txt_message.setStyleSheet( "font-weight: bold; color: black; font-family: century gothic; font-size: 16px" ) self.txt_message.setMinimumSize(520, 55) self.txt_message.move(300, 615) # Send button self.btn_send = QPushButton('Enviar', self) self.btn_send.move(830, 635) self.btn_send.setStyleSheet( "background-color: #08AE9E; font-weight: bold; color: White; font-family: century gothic; font-size: 16px" ) self.btn_send.clicked.connect(self.click) # Student's list self.lbl_list = QLabel("", self) self.lbl_list.setStyleSheet( "background-color: #019A74; font-weight: bold; color: White; font-family: century gothic; font-size: 16px" ) self.lbl_list.setMinimumSize(190, 19) self.lbl_list.move(60, 510) self.lbl_last_name_m = QLabel("Alumnos conectados", self) self.lbl_last_name_m.setStyleSheet( "font-weight: bold; color: white; font-family: century gothic; font-size: 15px" ) self.lbl_last_name_m.setMinimumSize(190, 25) self.lbl_last_name_m.move(70, 510) self.list = QListWidget(self) self.list.setMinimumSize(190, 140) self.list.move(60, 540) self.model = QStandardItemModel(self.list) # Set default items self.list.show() # Participation button self.btn_participate = QPushButton('Pedir participacion', self) self.btn_participate.move(60, 460) self.btn_participate.setStyleSheet( "background-color: #08AE9E; font-weight: bold; color: White; font-family: century gothic; font-size: 16px" ) self.btn_participate.setMinimumSize(190, 30) # self.btn_participate.clicked.connect(self.btn_participate) # Log out button self.lbl_logout = QLabel('Cerrar sesión', self) self.lbl_logout.move(830, 40) self.lbl_logout.setStyleSheet( "font-weight: bold; color: white; font-family: century gothic; font-size: 14px" ) self.lbl_logout.setMinimumSize(100, 15) # self.lbl_clase = QLabel(self.clase["CLASE"], self) # self.lbl_clase.move(110, 40) # self.lbl_clase.setStyleSheet( # "font-weight: bold; color: white; font-family: century gothic; font-size: 16px") # self.lbl_clase.setMinimumSize(350, 15) # self.btn_logout.clicked.connect(self.btn_participate) # QListView para la lista de alumnos # self.client.enviarMensaje("Hola") # 2F4D6B" # Connect! self.setPalette(palette) self.show() def recibirMensaje(self, mensaje): self.txt_messages.append(mensaje) print("Señal recibida") def actualizarListaUsuarios(self, conectados): self.list.clear() alumnos = conectados for alumno in alumnos: self.list.addItem(alumno) # item = QStandardItem(alumno) # self.model.appendRow(item) # self.list.setModel(self.model) print("Señal recibida") def click(self): transport2 = TSocket.TSocket('localhost', 9090) # Buffering is critical. Raw sockets are very slow transport2 = TTransport.TBufferedTransport(transport2) # Wrap in a protocol protocol = TBinaryProtocol.TBinaryProtocol(transport2) # Create a client to use the protocol encoder client = servicios.Client(protocol) transport2.open() # handler = self # processor = servicios.Processor(handler) # transport2 = TSocket.TServerSocket(port=1010) # tfactory = TTransport.TBufferedTransportFactory() # pfactory = TBinaryProtocol.TBinaryProtocolFactory() # server = TServer.TSimpleServer(processor, transport2, tfactory, pfactory) # server.serve() # hMiHilo = MiHilo() # hMiHilo.start() self.msg = self.txt_message.toPlainText() print(self.msg) client.entrarAula("Susana", "localhost", "IA") client.enviarMensaje(self.msg) transport2.close() print("Salida") def permisos(self, url, feature): self.web.page().setFeaturePermission( QUrl("http://localhost:5080/demos/simpleBroadcaster.html"), QWebEnginePage.MediaAudioVideoCapture, QWebEnginePage.PermissionGrantedByUser)
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.setEnabled(True) MainWindow.resize(913, 971) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(3) sizePolicy.setVerticalStretch(33) sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth()) MainWindow.setSizePolicy(sizePolicy) MainWindow.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu) MainWindow.setAutoFillBackground(True) MainWindow.setStyleSheet("") MainWindow.setAnimated(True) self.centralWidget = QtWidgets.QWidget(MainWindow) self.centralWidget.setObjectName("centralWidget") self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.centralWidget) self.verticalLayout_5.setObjectName("verticalLayout_5") self.tabWidget_PGMS = QtWidgets.QTabWidget(self.centralWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(20) sizePolicy.setVerticalStretch(44) sizePolicy.setHeightForWidth(self.tabWidget_PGMS.sizePolicy().hasHeightForWidth()) self.tabWidget_PGMS.setSizePolicy(sizePolicy) self.tabWidget_PGMS.setMinimumSize(QtCore.QSize(800, 700)) self.tabWidget_PGMS.setLayoutDirection(QtCore.Qt.LeftToRight) self.tabWidget_PGMS.setAutoFillBackground(True) self.tabWidget_PGMS.setStyleSheet("") self.tabWidget_PGMS.setTabBarAutoHide(True) self.tabWidget_PGMS.setObjectName("tabWidget_PGMS") self.tab_Combination = QtWidgets.QWidget() self.tab_Combination.setObjectName("tab_Combination") self.horizontalLayout_6 = QtWidgets.QHBoxLayout(self.tab_Combination) self.horizontalLayout_6.setContentsMargins(0, 0, 0, 0) self.horizontalLayout_6.setObjectName("horizontalLayout_6") self.scrollArea_3 = QtWidgets.QScrollArea(self.tab_Combination) self.scrollArea_3.setWidgetResizable(True) self.scrollArea_3.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) self.scrollArea_3.setObjectName("scrollArea_3") self.scrollAreaWidgetContents_3 = QtWidgets.QWidget() self.scrollAreaWidgetContents_3.setGeometry(QtCore.QRect(0, 0, 852, 958)) self.scrollAreaWidgetContents_3.setObjectName("scrollAreaWidgetContents_3") self.verticalLayout_8 = QtWidgets.QVBoxLayout(self.scrollAreaWidgetContents_3) self.verticalLayout_8.setContentsMargins(0, 0, 0, 0) self.verticalLayout_8.setObjectName("verticalLayout_8") self.verticalLayout_6 = QtWidgets.QVBoxLayout() self.verticalLayout_6.setObjectName("verticalLayout_6") self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem) self.verticalLayout_7 = QtWidgets.QVBoxLayout() self.verticalLayout_7.setObjectName("verticalLayout_7") self.label_7 = QtWidgets.QLabel(self.scrollAreaWidgetContents_3) self.label_7.setText("") self.label_7.setObjectName("label_7") self.verticalLayout_7.addWidget(self.label_7) self.label_10 = QtWidgets.QLabel(self.scrollAreaWidgetContents_3) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_10.sizePolicy().hasHeightForWidth()) self.label_10.setSizePolicy(sizePolicy) self.label_10.setObjectName("label_10") self.verticalLayout_7.addWidget(self.label_10) self.label_11 = QtWidgets.QLabel(self.scrollAreaWidgetContents_3) self.label_11.setObjectName("label_11") self.verticalLayout_7.addWidget(self.label_11) self.label_12 = QtWidgets.QLabel(self.scrollAreaWidgetContents_3) self.label_12.setObjectName("label_12") self.verticalLayout_7.addWidget(self.label_12) self.horizontalLayout_3.addLayout(self.verticalLayout_7) spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.horizontalLayout_3.addItem(spacerItem1) self.gridLayout_5 = QtWidgets.QGridLayout() self.gridLayout_5.setObjectName("gridLayout_5") self.label_8 = QtWidgets.QLabel(self.scrollAreaWidgetContents_3) self.label_8.setObjectName("label_8") self.gridLayout_5.addWidget(self.label_8, 0, 0, 1, 1) self.label_9 = QtWidgets.QLabel(self.scrollAreaWidgetContents_3) self.label_9.setObjectName("label_9") self.gridLayout_5.addWidget(self.label_9, 0, 1, 1, 1) self.doubleSpinBox_returns_min = QtWidgets.QDoubleSpinBox(self.scrollAreaWidgetContents_3) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.doubleSpinBox_returns_min.sizePolicy().hasHeightForWidth()) self.doubleSpinBox_returns_min.setSizePolicy(sizePolicy) self.doubleSpinBox_returns_min.setMaximum(0.3) self.doubleSpinBox_returns_min.setSingleStep(0.01) self.doubleSpinBox_returns_min.setProperty("value", 0.0) self.doubleSpinBox_returns_min.setObjectName("doubleSpinBox_returns_min") self.gridLayout_5.addWidget(self.doubleSpinBox_returns_min, 1, 0, 1, 1) self.doubleSpinBox_returns_max = QtWidgets.QDoubleSpinBox(self.scrollAreaWidgetContents_3) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.doubleSpinBox_returns_max.sizePolicy().hasHeightForWidth()) self.doubleSpinBox_returns_max.setSizePolicy(sizePolicy) self.doubleSpinBox_returns_max.setMinimum(0.0) self.doubleSpinBox_returns_max.setMaximum(10.0) self.doubleSpinBox_returns_max.setSingleStep(0.1) self.doubleSpinBox_returns_max.setProperty("value", 0.0) self.doubleSpinBox_returns_max.setObjectName("doubleSpinBox_returns_max") self.gridLayout_5.addWidget(self.doubleSpinBox_returns_max, 1, 1, 1, 1) self.doubleSpinBox_maxdrawdown_min = QtWidgets.QDoubleSpinBox(self.scrollAreaWidgetContents_3) self.doubleSpinBox_maxdrawdown_min.setMinimum(0.1) self.doubleSpinBox_maxdrawdown_min.setMaximum(1.0) self.doubleSpinBox_maxdrawdown_min.setSingleStep(0.01) self.doubleSpinBox_maxdrawdown_min.setProperty("value", 0.7) self.doubleSpinBox_maxdrawdown_min.setObjectName("doubleSpinBox_maxdrawdown_min") self.gridLayout_5.addWidget(self.doubleSpinBox_maxdrawdown_min, 2, 0, 1, 1) self.doubleSpinBox_maxdrawdown_max = QtWidgets.QDoubleSpinBox(self.scrollAreaWidgetContents_3) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.doubleSpinBox_maxdrawdown_max.sizePolicy().hasHeightForWidth()) self.doubleSpinBox_maxdrawdown_max.setSizePolicy(sizePolicy) self.doubleSpinBox_maxdrawdown_max.setMinimum(0.2) self.doubleSpinBox_maxdrawdown_max.setMaximum(1.0) self.doubleSpinBox_maxdrawdown_max.setSingleStep(0.01) self.doubleSpinBox_maxdrawdown_max.setProperty("value", 1.0) self.doubleSpinBox_maxdrawdown_max.setObjectName("doubleSpinBox_maxdrawdown_max") self.gridLayout_5.addWidget(self.doubleSpinBox_maxdrawdown_max, 2, 1, 1, 1) self.doubleSpinBox_sharp_min = QtWidgets.QDoubleSpinBox(self.scrollAreaWidgetContents_3) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.doubleSpinBox_sharp_min.sizePolicy().hasHeightForWidth()) self.doubleSpinBox_sharp_min.setSizePolicy(sizePolicy) self.doubleSpinBox_sharp_min.setMaximum(40.0) self.doubleSpinBox_sharp_min.setSingleStep(0.05) self.doubleSpinBox_sharp_min.setObjectName("doubleSpinBox_sharp_min") self.gridLayout_5.addWidget(self.doubleSpinBox_sharp_min, 3, 0, 1, 1) self.doubleSpinBox_sharp_max = QtWidgets.QDoubleSpinBox(self.scrollAreaWidgetContents_3) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.doubleSpinBox_sharp_max.sizePolicy().hasHeightForWidth()) self.doubleSpinBox_sharp_max.setSizePolicy(sizePolicy) self.doubleSpinBox_sharp_max.setProperty("value", 10.0) self.doubleSpinBox_sharp_max.setObjectName("doubleSpinBox_sharp_max") self.gridLayout_5.addWidget(self.doubleSpinBox_sharp_max, 3, 1, 1, 1) self.horizontalLayout_3.addLayout(self.gridLayout_5) self.line_2 = QtWidgets.QFrame(self.scrollAreaWidgetContents_3) self.line_2.setFrameShape(QtWidgets.QFrame.VLine) self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_2.setObjectName("line_2") self.horizontalLayout_3.addWidget(self.line_2) spacerItem2 = QtWidgets.QSpacerItem(200, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem2) self.pushButton_start_combination = QtWidgets.QPushButton(self.scrollAreaWidgetContents_3) self.pushButton_start_combination.setObjectName("pushButton_start_combination") self.horizontalLayout_3.addWidget(self.pushButton_start_combination) spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem3) self.verticalLayout_6.addLayout(self.horizontalLayout_3) self.horizontalLayout_7 = QtWidgets.QHBoxLayout() self.horizontalLayout_7.setObjectName("horizontalLayout_7") self.checkBox_stock = QtWidgets.QCheckBox(self.scrollAreaWidgetContents_3) self.checkBox_stock.setObjectName("checkBox_stock") self.horizontalLayout_7.addWidget(self.checkBox_stock) self.checkBox_compound = QtWidgets.QCheckBox(self.scrollAreaWidgetContents_3) self.checkBox_compound.setObjectName("checkBox_compound") self.horizontalLayout_7.addWidget(self.checkBox_compound) self.checkBox_future_manage = QtWidgets.QCheckBox(self.scrollAreaWidgetContents_3) self.checkBox_future_manage.setObjectName("checkBox_future_manage") self.horizontalLayout_7.addWidget(self.checkBox_future_manage) self.checkBox_event = QtWidgets.QCheckBox(self.scrollAreaWidgetContents_3) self.checkBox_event.setObjectName("checkBox_event") self.horizontalLayout_7.addWidget(self.checkBox_event) self.checkBox_bond = QtWidgets.QCheckBox(self.scrollAreaWidgetContents_3) self.checkBox_bond.setObjectName("checkBox_bond") self.horizontalLayout_7.addWidget(self.checkBox_bond) self.checkBox_macro = QtWidgets.QCheckBox(self.scrollAreaWidgetContents_3) self.checkBox_macro.setObjectName("checkBox_macro") self.horizontalLayout_7.addWidget(self.checkBox_macro) self.checkBox_combination_fund = QtWidgets.QCheckBox(self.scrollAreaWidgetContents_3) self.checkBox_combination_fund.setObjectName("checkBox_combination_fund") self.horizontalLayout_7.addWidget(self.checkBox_combination_fund) self.checkBox_relative_fund = QtWidgets.QCheckBox(self.scrollAreaWidgetContents_3) self.checkBox_relative_fund.setObjectName("checkBox_relative_fund") self.horizontalLayout_7.addWidget(self.checkBox_relative_fund) self.checkBox_others = QtWidgets.QCheckBox(self.scrollAreaWidgetContents_3) self.checkBox_others.setObjectName("checkBox_others") self.horizontalLayout_7.addWidget(self.checkBox_others) self.verticalLayout_6.addLayout(self.horizontalLayout_7) self.verticalLayout_8.addLayout(self.verticalLayout_6) self.QWebEngineview_Combination_monte_markovitz = QWebEngineView(self.scrollAreaWidgetContents_3) self.QWebEngineview_Combination_monte_markovitz.setMinimumSize(QtCore.QSize(0, 300)) self.QWebEngineview_Combination_monte_markovitz.setStyleSheet("background-color: rgb(170, 170, 127);") self.QWebEngineview_Combination_monte_markovitz.setObjectName("QWebEngineview_Combination_monte_markovitz") self.verticalLayout_8.addWidget(self.QWebEngineview_Combination_monte_markovitz) self.horizontalLayout_5 = QtWidgets.QHBoxLayout() self.horizontalLayout_5.setObjectName("horizontalLayout_5") self.QWebEngineview_Combination_Pie = QWebEngineView(self.scrollAreaWidgetContents_3) self.QWebEngineview_Combination_Pie.setMinimumSize(QtCore.QSize(50, 200)) self.QWebEngineview_Combination_Pie.setStyleSheet("background-color: rgb(170, 170, 127);") self.QWebEngineview_Combination_Pie.setObjectName("QWebEngineview_Combination_Pie") self.horizontalLayout_5.addWidget(self.QWebEngineview_Combination_Pie) self.QWebEngineview_Combination_Table = QWebEngineView(self.scrollAreaWidgetContents_3) self.QWebEngineview_Combination_Table.setMinimumSize(QtCore.QSize(0, 200)) self.QWebEngineview_Combination_Table.setStyleSheet("background-color: rgb(170, 170, 127);") self.QWebEngineview_Combination_Table.setObjectName("QWebEngineview_Combination_Table") self.horizontalLayout_5.addWidget(self.QWebEngineview_Combination_Table) self.verticalLayout_8.addLayout(self.horizontalLayout_5) self.QWebEngineview_Combination_Versus = QWebEngineView(self.scrollAreaWidgetContents_3) self.QWebEngineview_Combination_Versus.setEnabled(True) self.QWebEngineview_Combination_Versus.setMinimumSize(QtCore.QSize(0, 300)) self.QWebEngineview_Combination_Versus.setStyleSheet("background-color: rgb(170, 170, 127);") self.QWebEngineview_Combination_Versus.setObjectName("QWebEngineview_Combination_Versus") self.verticalLayout_8.addWidget(self.QWebEngineview_Combination_Versus) self.QWebEngineview_Combination_monte_markovitz.raise_() self.QWebEngineview_Combination_Versus.raise_() self.scrollArea_3.setWidget(self.scrollAreaWidgetContents_3) self.horizontalLayout_6.addWidget(self.scrollArea_3) self.tabWidget_PGMS.addTab(self.tab_Combination, "") self.verticalLayout_5.addWidget(self.tabWidget_PGMS) MainWindow.setCentralWidget(self.centralWidget) self.menuBar = QtWidgets.QMenuBar(MainWindow) self.menuBar.setGeometry(QtCore.QRect(0, 0, 913, 23)) self.menuBar.setObjectName("menuBar") MainWindow.setMenuBar(self.menuBar) self.action = QtWidgets.QAction(MainWindow) self.action.setObjectName("action") self.action_2 = QtWidgets.QAction(MainWindow) self.action_2.setObjectName("action_2") self.action_3 = QtWidgets.QAction(MainWindow) self.action_3.setObjectName("action_3") self.action_4 = QtWidgets.QAction(MainWindow) self.action_4.setObjectName("action_4") self.action_5 = QtWidgets.QAction(MainWindow) self.action_5.setObjectName("action_5") self.action_6 = QtWidgets.QAction(MainWindow) self.action_6.setObjectName("action_6") self.action_8 = QtWidgets.QAction(MainWindow) self.action_8.setObjectName("action_8") self.action_9 = QtWidgets.QAction(MainWindow) self.action_9.setObjectName("action_9") self.action_10 = QtWidgets.QAction(MainWindow) self.action_10.setObjectName("action_10") self.action_11 = QtWidgets.QAction(MainWindow) self.action_11.setObjectName("action_11") self.action_Qt = QtWidgets.QAction(MainWindow) self.action_Qt.setObjectName("action_Qt") self.action_PyQt = QtWidgets.QAction(MainWindow) self.action_PyQt.setObjectName("action_PyQt") self.action_12 = QtWidgets.QAction(MainWindow) self.action_12.setObjectName("action_12") self.retranslateUi(MainWindow) self.tabWidget_PGMS.setCurrentIndex(0) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "基金量化投研系统v0.11")) self.label_10.setText(_translate("MainWindow", "收益")) self.label_11.setText(_translate("MainWindow", "最大回撤")) self.label_12.setText(_translate("MainWindow", "Sharp比")) self.label_8.setText(_translate("MainWindow", "最小范围")) self.label_9.setText(_translate("MainWindow", "最大范围")) self.pushButton_start_combination.setText(_translate("MainWindow", "开始")) self.checkBox_stock.setText(_translate("MainWindow", "股票策略")) self.checkBox_compound.setText(_translate("MainWindow", "复合策略")) self.checkBox_future_manage.setText(_translate("MainWindow", "管理期货")) self.checkBox_event.setText(_translate("MainWindow", "事件驱动")) self.checkBox_bond.setText(_translate("MainWindow", "债券策略")) self.checkBox_macro.setText(_translate("MainWindow", "宏观策略")) self.checkBox_combination_fund.setText(_translate("MainWindow", "组合基金")) self.checkBox_relative_fund.setText(_translate("MainWindow", "相对价值")) self.checkBox_others.setText(_translate("MainWindow", "其它策略")) self.tabWidget_PGMS.setTabText(self.tabWidget_PGMS.indexOf(self.tab_Combination), _translate("MainWindow", "产品组合管理")) self.action.setText(_translate("MainWindow", "打开")) self.action_2.setText(_translate("MainWindow", "关闭")) self.action_3.setText(_translate("MainWindow", "保存")) self.action_4.setText(_translate("MainWindow", "退出")) self.action_5.setText(_translate("MainWindow", "复制")) self.action_6.setText(_translate("MainWindow", "黏贴")) self.action_8.setText(_translate("MainWindow", "哈哈")) self.action_9.setText(_translate("MainWindow", "关于")) self.action_10.setText(_translate("MainWindow", "使用说明")) self.action_11.setText(_translate("MainWindow", "关于软件")) self.action_Qt.setText(_translate("MainWindow", "关于Qt")) self.action_PyQt.setText(_translate("MainWindow", "关于PyQt")) self.action_12.setText(_translate("MainWindow", "其他"))
class ReporteWindowWidget(object): def __init__(self, Form, url): self.setupUi(Form, url) def setupUi(self, Form, url): """ Método empleado para especificar el contenido de la Interfáz gráfica, es generado por pyuic5. Args: Form: Ventana en la que se deplegará la interfáz gráfica (es un tipo de dato QtWidget.QWidget) """ Form.setObjectName("Form") Form.resize(800, 598) self.verticalLayoutWidget = QtWidgets.QWidget(Form) self.verticalLayoutWidget.setGeometry(QtCore.QRect(220, 0, 581, 541)) self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setObjectName("verticalLayout") self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.lblLogo = QtWidgets.QLabel(self.verticalLayoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.lblLogo.sizePolicy().hasHeightForWidth()) self.lblLogo.setSizePolicy(sizePolicy) self.lblLogo.setMaximumSize(QtCore.QSize(1697/3.5, 312/3.5)) self.lblLogo.setLineWidth(1) self.lblLogo.setText("") self.lblLogo.setPixmap(QtGui.QPixmap(APPCTXT().get_resource("logo3.png"))) self.lblLogo.setScaledContents(True) self.lblLogo.setAlignment(QtCore.Qt.AlignCenter) self.lblLogo.setObjectName("lblLogo") self.horizontalLayout.addWidget(self.lblLogo) self.verticalLayout.addLayout(self.horizontalLayout) self.verticalLayout_2 = QtWidgets.QVBoxLayout() self.verticalLayout_2.setObjectName("verticalLayout_2") self.label_4 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_4.setToolTip("") self.label_4.setAlignment(QtCore.Qt.AlignCenter) self.label_4.setObjectName("label_4") self.verticalLayout_2.addWidget(self.label_4) self.webEngineWidget = QWebEngineView(self.verticalLayoutWidget) self.webEngineWidget.setObjectName("webEngineWidget") self.webEngineWidget.setMinimumSize(QtCore.QSize(0, 381)) #url = QUrl.fromLocalFile(QDir.currentPath()+"/Reporte/reporte.html") urlReporte = QUrl.fromLocalFile(url) self.webEngineWidget.load(urlReporte) self.verticalLayout_2.addWidget(self.webEngineWidget) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint) self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.pbStart = QtWidgets.QPushButton(self.verticalLayoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.pbStart.sizePolicy().hasHeightForWidth()) self.pbStart.setSizePolicy(sizePolicy) self.pbStart.setLayoutDirection(QtCore.Qt.LeftToRight) self.pbStart.setObjectName("pbStart") self.horizontalLayout_2.addWidget(self.pbStart) self.pdSaveCsv = QtWidgets.QPushButton(self.verticalLayoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.pdSaveCsv.sizePolicy().hasHeightForWidth()) self.pdSaveCsv.setSizePolicy(sizePolicy) self.pdSaveCsv.setLayoutDirection(QtCore.Qt.LeftToRight) self.pdSaveCsv.setObjectName("pdSaveCsv") self.horizontalLayout_2.addWidget(self.pdSaveCsv) self.pbRestart = QtWidgets.QPushButton(self.verticalLayoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.pbRestart.sizePolicy().hasHeightForWidth()) self.pbRestart.setSizePolicy(sizePolicy) self.pbRestart.setLayoutDirection(QtCore.Qt.LeftToRight) self.pbRestart.setObjectName("pbRestart") self.horizontalLayout_2.addWidget(self.pbRestart) self.verticalLayout_2.addLayout(self.horizontalLayout_2) self.verticalLayout_2.setStretch(0, 1) self.verticalLayout_2.setStretch(1, 5) self.verticalLayout.addLayout(self.verticalLayout_2) self.verticalLayout.setStretch(0, 1) self.verticalLayout.setStretch(0, 0) self.lWVistas = QtWidgets.QListWidget(Form) self.lWVistas.setGeometry(QtCore.QRect(0, 90, 221, 451)) self.lWVistas.setObjectName("lWVistas") self.progressBar = QtWidgets.QProgressBar(Form) self.progressBar.setGeometry(QtCore.QRect(127, 560, 601, 23)) self.progressBar.setProperty("value", 24) self.progressBar.setObjectName("progressBar") self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) def retranslateUi(self, Form): """ Método empleado paraasignar el contenido de la Interfáz gráfica, es generado por pyuic5. Args: Form: Ventana en la que se deplegará la interfáz gráfica (es un tipo de dato QtWidget.QWidget) """ _translate = QtCore.QCoreApplication.translate Form.setWindowTitle(_translate("Form", "Reporte")) # self.lblLogo.setText(_translate("Form", "Logo")) # self.label.setText(_translate("Form", "SYNAPPS")) self.label_4.setText(_translate("Form", "Vista previa del reporte")) self.pbStart.setText(_translate("Form", "Abrir en Navegador")) self.pdSaveCsv.setText(_translate("Form", "Guardar csv")) self.pbRestart.setText(_translate("Form", "Nuevo Reporte"))
class WindowClassroom(QMainWindow): URL_TEACHER = "http://localhost:5080/demos/simpleBroadcaster.html" URL_STUDENT = "http://192.168.43.2:5080/demos/simpleSubscriber.html" def __init__(self, client, transport, clase, usuario, nombre): super().__init__() self.btn_participate = QPushButton('Pedir participacion', self) self.setVisible(False) self.client = client self.transport = transport self.clase = clase self.usuario = usuario self.nombre_usuario = nombre self.hMiHilo = MiHilo.get_instance() self.hMiHilo.start() self.hMiHilo.signal_recive.connect(self.recibirMensaje) self.hMiHilo.signal_connected.connect(self.actualizarListaUsuarios) self.hMiHilo.signal_activate_participation.connect( self.activar_btn_participacion) self.hMiHilo.signal_desactivate_participation.connect( self.desactivar_btn_participacion) self.hMiHilo.signal_show_solicitud.connect(self.show_reques) self.hMiHilo.signal_get_control.connect(self.tomar_control_video) self.hMiHilo.signal_leave_control.connect(self.ceder_control_video) # self.hMiHilo.signal_show_solicitud.connect(self.) # self.client=client # self.transport=transport self.initUI() self.show() def initUI(self): # Add core elements for the window # Add core elements for the window self.lblDesign = QLabel("", self) self.lblDesign.setStyleSheet( "background-color: #019A74; font-weight: bold; color: White; font-family: century gothic; font-size: 16px" ) self.lblDesign.setMinimumSize(1000, 70) self.img_logo = QLabel(self) pixmap = QPixmap("Images/mini_Teacher3.png") self.img_logo.setPixmap(pixmap) self.img_logo.move(20, -12) self.img_logo.setMinimumSize(100, 100) self.lbl_tittle1 = QLabel("Aula ", self) self.lbl_tittle1.setStyleSheet( "font-weight: b old; color: white; font-family: century gothic; font-size: 32px" ) self.lbl_tittle1.move(415, 90) self.lbl_tittle2 = QLabel("Virtual", self) self.lbl_tittle2.setStyleSheet( "font-weight: bold; color: white; font-family: century gothic; font-size: 32px" ) self.lbl_tittle2.setMinimumSize(110, 30) self.lbl_tittle2.move(507, 90) # This window # self.setFixedSize(1366, 768) self.setFixedSize(1000, 700) self.setWindowTitle('Aula virtual') palette = QPalette() palette.setBrush(QPalette.Background, QBrush(QColor("#1B528A"))) # # Slides # self.lbl_slides = QLabel("", self) # self.lbl_slides.setStyleSheet( # "background-color: #019A74; font-weight: bold; color: White; font-family: century gothic; font-size: 16px") # self.lbl_slides.setMinimumSize(645, 355) # self.lbl_slides.move(293, 140) # Camera self.lbl_camera = QVBoxLayout() self.web = QWebEngineView(self) settings = QWebEngineSettings.globalSettings().setAttribute( QWebEngineSettings.PluginsEnabled, True) settings = QWebEngineSettings.globalSettings().setAttribute( QWebEngineSettings.AllowRunningInsecureContent, True) self.web.page().featurePermissionRequested.connect(self.permisos) self.iniciar_video() # self.web.page().setUrl(QUrl("http://localhost:5080/demos/simpleSubscriber.html")) # self.web.load(QUrl("http://localhost:5080/demos/simpleSubscriber.html")) self.web.setMinimumSize(370, 300) self.web.move(60, 140) self.web.show() self.lbl_camera.addWidget(self.web) self.lbl_slides = QVBoxLayout() self.web_slides = QWebEngineView(self) print(self.clase["CARPETA_COMPARTIDA"]) self.web_slides.page().setUrl(QUrl(self.clase["CARPETA_COMPARTIDA"])) # self.web_slides.setEnabled(False) self.web_slides.setMinimumSize(480, 300) self.web_slides.move(450, 140) self.web_slides.show() self.lbl_slides.addWidget(self.web_slides) # self.lbl_camera.setStyleSheet( # "background-color: #019A74; font-weight: bold; color: White; font-family: century gothic; font-size: 16px") # self.lbl_camera. # Chat self.lbl_chat = QLabel("", self) self.lbl_chat.setStyleSheet( "background-color: White; font-weight: bold; color: White; font-family: century gothic; font-size: 16px" ) self.lbl_chat.setMinimumSize(645, 220) self.lbl_chat.move(293, 460) self.txt_messages = QTextEdit("", self) self.txt_messages.setStyleSheet( "font-weight: bold; color: black; font-family: century gothic; font-size: 16px" ) self.txt_messages.setMinimumSize(630, 130) self.txt_messages.move(300, 477) self.txt_messages.setReadOnly(True) # Text field self.txt_message = QTextEdit("", self) self.txt_message.setStyleSheet( "font-weight: bold; color: black; font-family: century gothic; font-size: 16px" ) self.txt_message.setMinimumSize(520, 55) self.txt_message.move(300, 615) # Send button self.btn_send = QPushButton('Enviar', self) self.btn_send.move(830, 635) self.btn_send.setStyleSheet( "background-color: #08AE9E; font-weight: bold; color: White; font-family: century gothic; font-size: 16px" ) self.btn_send.clicked.connect(self.click_send) # Student's list self.lbl_list = QLabel("", self) self.lbl_list.setStyleSheet( "background-color: #019A74; font-weight: bold; color: White; font-family: century gothic; font-size: 16px" ) self.lbl_list.setMinimumSize(190, 19) self.lbl_list.move(60, 510) self.lbl_last_name_m = QLabel("Alumnos conectados", self) self.lbl_last_name_m.setStyleSheet( "font-weight: bold; color: white; font-family: century gothic; font-size: 15px" ) self.lbl_last_name_m.setMinimumSize(190, 25) self.lbl_last_name_m.move(70, 510) self.list = QListWidget(self) self.list.setMinimumSize(190, 140) self.list.move(60, 540) # self.model = QStandardItemModel(self.list) # # #Set default items # alumnos = ['Ana Paola', 'Susana', 'Erasmo Carlos'] # for alumno in alumnos: # item = QStandardItem(alumno) # self.model.appendRow(item) # # self.list.setModel(self.model) self.list.show() self.iniciar_conectados() #Participation button self.cargar_botones() #Log out button self.lbl_logout = QLabel('Cerrar sesión', self) self.lbl_logout.move(830, 40) self.lbl_logout.setStyleSheet( "font-weight: bold; color: white; font-family: century gothic; font-size: 14px" ) self.lbl_logout.setMinimumSize(100, 15) self.lbl_logout.mousePressEvent = self.click_exit self.lbl_clase = QLabel(self.clase["CLASE"], self) self.lbl_clase.move(110, 40) self.lbl_clase.setStyleSheet( "font-weight: bold; color: white; font-family: century gothic; font-size: 16px" ) self.lbl_clase.setMinimumSize(350, 15) # 2F4D6B" self.setPalette(palette) self.show() def iniciar_video(self): if self.clase["ROL"] == "Alumno": self.web.page().setUrl(QUrl(self.URL_STUDENT)) else: self.web.page().setUrl(QUrl(self.URL_TEACHER)) def cargar_botones(self): if self.clase["ROL"] == "Alumno": self.btn_participate.move(60, 460) self.btn_participate.setStyleSheet( "background-color: #08AE9E; font-weight: bold; color: White; font-family: century gothic; font-size: 16px" ) self.btn_participate.setMinimumSize(190, 30) self.btn_participate.setEnabled(False) self.btn_participate.clicked.connect(self.click_participate) else: self.btn_give_participate = QPushButton('Ceder', self) self.btn_give_participate.move(60, 460) self.btn_give_participate.setStyleSheet( "background-color: #08AE9E; font-weight: bold; color: White; font-family: century gothic; font-size: 16px" ) self.btn_give_participate.setMinimumSize(60, 30) self.btn_give_participate.setEnabled(False) self.btn_give_participate.clicked.connect( self.click_give_participation) self.btn_recover = QPushButton('Recuperar', self) self.btn_recover.move(160, 460) self.btn_recover.setStyleSheet( "background-color: #08AE9E; font-weight: bold; color: White; font-family: century gothic; font-size: 16px" ) self.btn_recover.setMinimumSize(100, 30) self.btn_recover.setEnabled(False) self.btn_recover.clicked.connect(self.click_recover) def activar_btn_participacion(self): self.btn_participate.setEnabled(True) self.btn_participate.clicked.connect(self.click_participate) def desactivar_btn_participacion(self): self.btn_participate.setEnabled(False) def click_participate(self): self.transport.open() nombre_equipo = socket.gethostname() direccion_equipo = socket.gethostbyname(nombre_equipo) self.client.pedirParticipacion(self.nombre_usuario, direccion_equipo) self.transport.close() def click_give_participation(self): self.lbl_reques.setVisible(False) self.btn_recover.setEnabled(True) self.transport.open() self.client.otorgarParticipacion(self.ip_solicitante) self.lbl_reques.setVisible(False) self.transport.close() def click_recover(self): self.transport.open() self.client.recuperarControl(self.ip_solicitante) self.transport.close() def iniciar_conectados(self): self.transport.open() nombre_equipo = socket.gethostname() direccion_equipo = socket.gethostbyname(nombre_equipo) print(direccion_equipo) self.rol = 1 if self.clase["ROL"] == "Alumno": self.rol = 0 self.client.entrarAula(self.nombre_usuario, direccion_equipo, self.clase["CLASE"], self.rol) # client.entrarAula("Susana González", "localhost", "Inteligencia") self.transport.close() def actualizarListaUsuarios(self, conectados): self.list.clear() alumnos = conectados for alumno in alumnos: self.list.addItem(alumno) # item = QStandardItem(alumno) # self.model.appendRow(item) # self.list.setModel(self.model) print("Señal recibida") def recibirMensaje(self, mensaje): self.txt_messages.append(mensaje) print("Señal recibida") # self.close() # windowClasses = WindowClasses def click_exit(self, event): nombre_equipo = socket.gethostname() direccion_equipo = socket.gethostbyname(nombre_equipo) self.transport.open() self.client.salirAula(self.nombre_usuario, direccion_equipo, self.clase["CLASE"], self.rol) self.transport.close() self.close() # windowClasses=WindowClasses def click_send(self): self.transport.open() self.msg = self.txt_message.toPlainText() print(self.msg) self.txt_message.setText("") self.client.enviarMensaje(self.nombre_usuario + ": " + self.msg, self.clase["CLASE"]) self.transport.close() print("Salida") def ask_participation(self): self.lbl_logout = QLabel('Cerrar sesión', self) self.lbl_logout.move(830, 40) self.lbl_logout.setStyleSheet( "font-weight: bold; color: white; font-family: century gothic; font-size: 14px" ) self.lbl_logout.setMinimumSize(100, 15) self.lbl_logout.mousePressEvent = self.click_exit def ceder_control_video(self): self.web.page().setUrl(QUrl(self.URL_STUDENT)) def tomar_control_video(self): self.web.page().setUrl(QUrl(self.URL_TEACHER)) def show_reques(self, datos_alumno): self.alumno_solicitante = datos_alumno[0] self.ip_solicitante = datos_alumno[1] self.btn_give_participate.setEnabled(True) self.lbl_reques = QLabel( 'Solicitud del control de video de: ' + datos_alumno[0], self) self.lbl_reques.move(60, 110) self.lbl_reques.setStyleSheet( "font-weight: bold; color: orange; font-family: century gothic; font-size: 14px" ) self.lbl_reques.setMinimumSize(500, 15) self.lbl_reques.setVisible(True) def permisos(self, url, feature): self.web.page().setFeaturePermission( QUrl("http://localhost:5080/demos/simpleBroadcaster.html"), QWebEnginePage.MediaAudioVideoCapture, QWebEnginePage.PermissionGrantedByUser)
class Main(QtWidgets.QMainWindow): def __init__(self): QtWidgets.QMainWindow.__init__(self) self.CreateUI() def CreateUI(self): # Create Necessary Widgets self.centralwidget = QtWidgets.QWidget(self) self.line = QtWidgets.QLineEdit(self) self.line.setMinimumSize(500, 20) self.line.setStyleSheet('font-size:15px;') # Enter URL self.enter = QtWidgets.QPushButton(self) self.enter.resize(0,0) self.enter.clicked.connect(self.set_url) self.enter.setShortcut('Return') # Reload Button self.reload = QtWidgets.QPushButton('↻',self) self.reload.setMinimumSize(20, 20) self.reload.setShortcut('F5') self.reload.setStyleSheet('font-size:23px;') self.reload.clicked.connect(self.reload_page) # Back Button self.back = QtWidgets.QPushButton('←',self) self.back.setMinimumSize(20, 20) self.back.setStyleSheet('font-size:23px;') self.back.clicked.connect(self.go_back) # Forward Button self.forward = QtWidgets.QPushButton('→',self) self.forward.setMinimumSize(20, 20) self.forward.setStyleSheet('font-size:23px;') self.forward.clicked.connect(self.go_forwardard) # Create Progress Bar self.pbar = QtWidgets.QProgressBar() self.pbar.setMaximumWidth(120) # Update Progress Bar, Window Title etc. self.web = QWebEngineView(loadProgress = self.pbar.setValue, loadFinished = self.pbar.hide, loadStarted = self.pbar.show, titleChanged = self.setWindowTitle) self.web.setMinimumSize(1200, 600) # Check for url changes self.web.urlChanged.connect(self.if_url_changed) # Check for user liink hovering self.web.page().linkHovered.connect(self.if_link_hover) # Set Grid grid = QtWidgets.QGridLayout() # Set Widget Locations grid.addWidget(self.back,0,0, 1, 1) grid.addWidget(self.line,0,3, 1, 1) grid.addWidget(self.forward,0,1, 1, 1) grid.addWidget(self.reload,0,2, 1, 1) grid.addWidget(self.web, 2, 0, 1, 6) self.centralwidget.setLayout(grid) # Window Settings # Default Window Size and Location self.setGeometry(25, 100, 1200, 600) # Window Title self.setWindowTitle('Browsey') # Window Icon self.setWindowIcon(QtGui.QIcon('')) # Window Colour self.setStyleSheet('background-color:') # Window Status Bar self.status = self.statusBar() self.status.addPermanentWidget(self.pbar) self.status.hide() self.setCentralWidget(self.centralwidget) # Function to Handle URLs def set_url(self): # Get default URL global url url = self.line.text() # Set URL Prefixes http = 'http://' www = 'www.' # Check and Set if www in url and http not in url: url = http + url elif http in url and www not in url: url = url[:7] + www + url[7:] # If no suffix used make it a google search elif '.' not in url: url = 'http://www.google.com/search?q='+url elif http and www not in url: url = http + www + url self.line.setText(url) # Load site at URL self.web.load(QtCore.QUrl(url)) # Show URL self.status.show() # Navigation functions def go_back(self): self.web.back() def go_forwardard(self): self.web.forwardard() def reload_page(self): self.web.reload() #Check if user has entered new URL def if_url_changed(self): self.line.setText(self.web.url().toString()) # Show link in statusbar if user hovers def if_link_hover(self, l): self.status.showMessage(l)
class MainUi(Ui_Main_2): def __init__(self): super().__init__() self.init_ui() def init_ui(self): self.setObjectName("InterFace_1") self.resize(1300, 900) #设置整个界面的大小、背景 1100, 680 #背景图 self.setStyleSheet("#InterFace_1{border-image:url(./image/background.png)}") self.gridLayout = QtWidgets.QGridLayout() self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.label = QtWidgets.QLabel() self.label.setMinimumSize(QtCore.QSize(0, 70)) self.label.setMaximumSize(QtCore.QSize(85, 70)) self.label = QtWidgets.QLabel("晨曦识别") font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(22) self.label.setFont(font) self.label.setStyleSheet("#label{border-image:url(./image/total_title.png);color:rgb(0, 255, 255)}") self.label.setAlignment(QtCore.Qt.AlignHCenter|QtCore.Qt.AlignTop) self.label.setObjectName("label") #上方标题 :居中,字体类型、大小 self.main_widget = QtWidgets.QWidget() # 创建窗口主部件 self.main_layout = QtWidgets.QGridLayout() # 创建主部件的网格布局 self.main_widget.setLayout(self.main_layout) # 设置窗口主部件布局为网格布局 self.up_widget = QtWidgets.QWidget() # 创建上侧部件 self.up_widget.setObjectName('up_widget') self.up_layout = QtWidgets.QGridLayout() self.up_widget.setLayout(self.up_layout) # 设置上侧部件布局为网格 self.up_layout.addWidget(self.label, 0, 0, 3, 13) self.left_widget = QtWidgets.QWidget() # 创建左侧部件 self.left_widget.setObjectName('left_widget') self.left_layout = QtWidgets.QGridLayout() # 创建左侧部件的网格布局层 self.left_widget.setLayout(self.left_layout) # 设置左侧部件布局为网格 self.right_widget = QtWidgets.QWidget() # 创建右侧部件 self.right_widget.setObjectName('right_widget') self.right_layout = QtWidgets.QGridLayout() self.right_widget.setLayout(self.right_layout) # 设置右侧部件布局为网格 self.right_widget_2 = QtWidgets.QWidget() # 创建部件 self.right_widget_2.setObjectName('right_widget_2') self.right_layout_2 = QtWidgets.QGridLayout() self.right_widget_3 = QtWidgets.QWidget() # 创建部件 self.right_widget_3.setObjectName('right_widget_3') self.right_layout_3 = QtWidgets.QGridLayout() self.main_layout.addWidget(self.up_widget, 0, 0, 3, 13) self.main_layout.addWidget(self.right_widget, 4, 0, 2, 13) # (0,0,12,2)左侧部件在第0行第0列,占14行2列 总共12列, self.setCentralWidget(self.main_widget) # 设置窗口主部件 self.up_widget1 = QWebEngineView() # 创建上侧部件 self.up_widget1.setObjectName('up_widget1') self.up_widget1.setMinimumSize(QtCore.QSize(20, 0)) self.up_widget1.setMaximumSize(QtCore.QSize(70, 40)) self.up_widget1.page().setBackgroundColor(QColor('transparent')) self.main_layout.addWidget(self.up_widget1,0, 12, 3, 1) self.up_button_1 = QtWidgets.QPushButton("") self.up_button_1.setObjectName('up') self.up_button_3 = QtWidgets.QPushButton("") self.up_button_3.setObjectName('up') self.up_button_1.setIcon(QIcon(QPixmap('xiaobiao/minus5.png'))) self.up_button_3.setIcon(QIcon(QPixmap('xiaobiao/times5.png'))) self.g = 0 #全屏 正常 记录 self.h = 0 #收 正常 记录 self.up_button_3.clicked.connect(self.close) #关闭窗口 self.up_button_1.clicked.connect(self.show_2) self.up_button_1.setFixedSize(70, 40) self.up_button_3.setFixedSize(50, 40) self.main_layout.addWidget(self.up_button_1, 0, 11, 3, 1) self.main_layout.addWidget(self.up_button_3, 0, 12, 3, 1) self.main_widget.setStyleSheet(''' #up { font-family:KaiTi; font-size:17px; font-weight:200; border:none;} ''') # 然后再以电子病历确定开始功能 self.x_1 = Ui_Main_2() self.right_widget_2.setStyleSheet(''' background:#082E54; ''') self.right_layout_2.addWidget(self.x_1, 5, 0, 27, 13) self.right_widget_2.setLayout(self.right_layout_2) # 设置右侧部件布局为网格 self.main_layout.addWidget(self.right_widget_2, 5, 0, 27, 13) self.right_widget_2.show() self.setWindowOpacity(1) # 设置窗口透明度 self.setWindowFlag(QtCore.Qt.FramelessWindowHint) # 隐藏边框 self.main_layout.setSpacing(0) def mousePressEvent(self, event): if event.button() == QtCore.Qt.LeftButton: self.m_flag = True self.m_Position = event.globalPos() - self.pos() # 获取鼠标相对窗口的位置 event.accept() self.setCursor(QtGui.QCursor(QtCore.Qt.OpenHandCursor)) # 更改鼠标图标 def mouseMoveEvent(self, QMouseEvent): if QtCore.Qt.LeftButton and self.m_flag: self.move(QMouseEvent.globalPos() - self.m_Position) # 更改窗口位置 QMouseEvent.accept() def mouseReleaseEvent(self, QMouseEvent): self.m_flag = False self.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor)) def show_1(self): self.g +=1 x = self.g%2 if (x== 1): self.showNormal() else: self.showMaximized() def show_2(self): self.h +=1 h = self.h%2 if (h == 1): self.showMinimized() else: self.showMinimized()
class Ui_mainForm(object): def setupUi(self, mainForm): mainForm.setObjectName("mainForm") mainForm.resize(1200, 880) self.gridLayout_2 = QtWidgets.QGridLayout(mainForm) self.gridLayout_2.setContentsMargins(0, 0, 0, 0) self.gridLayout_2.setSpacing(0) self.gridLayout_2.setObjectName("gridLayout_2") self.browser = QWebEngineView(mainForm) self.browser.setMinimumSize(QtCore.QSize(0, 500)) self.browser.setMaximumSize(QtCore.QSize(16777215, 800)) self.browser.setObjectName("browser") self.gridLayout_2.addWidget(self.browser, 1, 0, 1, 2) self.console_secondary = QtWidgets.QTextEdit(mainForm) self.console_secondary.setMinimumSize(QtCore.QSize(0, 190)) self.console_secondary.setMaximumSize(QtCore.QSize(16777215, 190)) self.console_secondary.setStyleSheet("color: rgb(255, 255, 255);\n" "background-color: rgb(0, 0, 0);\n" "font: 12pt \"微软雅黑\";") self.console_secondary.setObjectName("console_secondary") self.gridLayout_2.addWidget(self.console_secondary, 5, 1, 1, 1) self.console_main = QtWidgets.QTextEdit(mainForm) self.console_main.setMinimumSize(QtCore.QSize(0, 190)) self.console_main.setMaximumSize(QtCore.QSize(16777215, 190)) self.console_main.setStyleSheet("color: rgb(255, 255, 255);\n" "background-color: rgb(0, 0, 0);\n" "font: 12pt \"微软雅黑\";") self.console_main.setObjectName("console_main") self.gridLayout_2.addWidget(self.console_main, 5, 0, 1, 1) self.widgetBar = QtWidgets.QWidget(mainForm) self.widgetBar.setMinimumSize(QtCore.QSize(0, 30)) self.widgetBar.setMaximumSize(QtCore.QSize(16777215, 30)) self.widgetBar.setObjectName("widgetBar") self.gridLayout = QtWidgets.QGridLayout(self.widgetBar) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setSpacing(0) self.gridLayout.setObjectName("gridLayout") self.btnBack = QtWidgets.QPushButton(self.widgetBar) self.btnBack.setMinimumSize(QtCore.QSize(0, 30)) self.btnBack.setObjectName("btnBack") self.gridLayout.addWidget(self.btnBack, 0, 3, 1, 1) self.urlBar = QtWidgets.QLineEdit(self.widgetBar) self.urlBar.setStyleSheet("font: 12pt \"微软雅黑\";") self.urlBar.setText("") self.urlBar.setReadOnly(True) self.urlBar.setObjectName("urlBar") self.gridLayout.addWidget(self.urlBar, 0, 1, 1, 1) self.btnCopyLink = QtWidgets.QPushButton(self.widgetBar) self.btnCopyLink.setMinimumSize(QtCore.QSize(0, 30)) self.btnCopyLink.setObjectName("btnCopyLink") self.gridLayout.addWidget(self.btnCopyLink, 0, 0, 1, 1) self.btnHome = QtWidgets.QPushButton(self.widgetBar) self.btnHome.setMinimumSize(QtCore.QSize(0, 30)) self.btnHome.setObjectName("btnHome") self.gridLayout.addWidget(self.btnHome, 0, 2, 1, 1) self.gridLayout_2.addWidget(self.widgetBar, 0, 0, 1, 2) self.widgetTools = QtWidgets.QWidget(mainForm) self.widgetTools.setMinimumSize(QtCore.QSize(0, 30)) self.widgetTools.setMaximumSize(QtCore.QSize(16777215, 30)) self.widgetTools.setStyleSheet("") self.widgetTools.setObjectName("widgetTools") self.gridLayout_3 = QtWidgets.QGridLayout(self.widgetTools) self.gridLayout_3.setContentsMargins(0, 0, 0, 0) self.gridLayout_3.setSpacing(0) self.gridLayout_3.setObjectName("gridLayout_3") self.btnGetAllLinks = QtWidgets.QPushButton(self.widgetTools) self.btnGetAllLinks.setEnabled(False) self.btnGetAllLinks.setMinimumSize(QtCore.QSize(0, 30)) self.btnGetAllLinks.setMaximumSize(QtCore.QSize(16777215, 30)) self.btnGetAllLinks.setObjectName("btnGetAllLinks") self.gridLayout_3.addWidget(self.btnGetAllLinks, 0, 0, 1, 1) self.btnOpenSource = QtWidgets.QPushButton(self.widgetTools) self.btnOpenSource.setMinimumSize(QtCore.QSize(0, 30)) self.btnOpenSource.setMaximumSize(QtCore.QSize(16777215, 30)) self.btnOpenSource.setObjectName("btnOpenSource") self.gridLayout_3.addWidget(self.btnOpenSource, 0, 2, 1, 1) self.lblLastPlayEpisodeName = QtWidgets.QLabel(self.widgetTools) self.lblLastPlayEpisodeName.setObjectName("lblLastPlayEpisodeName") self.gridLayout_3.addWidget(self.lblLastPlayEpisodeName, 0, 5, 1, 1) self.lblSpace02 = QtWidgets.QLabel(self.widgetTools) self.lblSpace02.setText("") self.lblSpace02.setObjectName("lblSpace02") self.gridLayout_3.addWidget(self.lblSpace02, 0, 8, 1, 1) self.lblLastPlay = QtWidgets.QLabel(self.widgetTools) self.lblLastPlay.setObjectName("lblLastPlay") self.gridLayout_3.addWidget(self.lblLastPlay, 0, 4, 1, 1) self.btnAbout = QtWidgets.QPushButton(self.widgetTools) self.btnAbout.setMinimumSize(QtCore.QSize(0, 30)) self.btnAbout.setMaximumSize(QtCore.QSize(16777215, 30)) self.btnAbout.setObjectName("btnAbout") self.gridLayout_3.addWidget(self.btnAbout, 0, 1, 1, 1) self.lblLastPlayEpisodeNum = QtWidgets.QLabel(self.widgetTools) self.lblLastPlayEpisodeNum.setObjectName("lblLastPlayEpisodeNum") self.gridLayout_3.addWidget(self.lblLastPlayEpisodeNum, 0, 7, 1, 1) spacerItem = QtWidgets.QSpacerItem(828, 27, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.gridLayout_3.addItem(spacerItem, 0, 3, 1, 1) self.lblSpace01 = QtWidgets.QLabel(self.widgetTools) self.lblSpace01.setObjectName("lblSpace01") self.gridLayout_3.addWidget(self.lblSpace01, 0, 6, 1, 1) self.gridLayout_2.addWidget(self.widgetTools, 2, 0, 1, 2) self.retranslateUi(mainForm) QtCore.QMetaObject.connectSlotsByName(mainForm) def retranslateUi(self, mainForm): _translate = QtCore.QCoreApplication.translate mainForm.setWindowTitle(_translate("mainForm", "看番神器 V1.0")) self.console_main.setHtml(_translate("mainForm", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:\'微软雅黑\'; font-size:12pt; font-weight:400; font-style:normal;\">\n" "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>")) self.btnBack.setText(_translate("mainForm", "返回")) self.btnCopyLink.setText(_translate("mainForm", "复制链接")) self.btnHome.setText(_translate("mainForm", "主页")) self.btnGetAllLinks.setText(_translate("mainForm", "抓取链接")) self.btnOpenSource.setText(_translate("mainForm", "项目地址")) self.lblLastPlayEpisodeName.setText(_translate("mainForm", "无")) self.lblLastPlay.setText(_translate("mainForm", "最近一次播放:")) self.btnAbout.setText(_translate("mainForm", "关于")) self.lblLastPlayEpisodeNum.setText(_translate("mainForm", "第0集")) self.lblSpace01.setText(_translate("mainForm", " "))