def initUI(self): frame = QFrame() frame.setStyleSheet("background-color: rgb(30, 45, 66);") frame.setFrameShape(QFrame.StyledPanel) frame.setFrameShadow(QFrame.Raised) frame.setFixedWidth(200) frame.setFixedHeight(150) main_label = QLabel(frame) main_label.setAlignment(Qt.AlignCenter) main_label.setGeometry(QRect(40, 10, 120, 41)) main_label.setStyleSheet("font: 75 28pt \"MS Shell Dlg 2\";\n" "color: rgb(255, 255, 255);\n" "font: 36pt \"MS Shell Dlg 2\";") main_label.setText("Orders") data = self.get_orders() sales = QLabel(frame) sales.setAlignment(Qt.AlignCenter) sales.setGeometry(QRect(40, 60, 120, 41)) sales.setStyleSheet("font: 75 18pt \"MS Shell Dlg 2\";\n" "color: rgb(255, 255, 255);\n" "font: 20pt \"MS Shell Dlg 2\";") sales.setText(str(data)) layout = QVBoxLayout() layout.addWidget(frame) layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) self.setLayout(layout) self.setGeometry(QRect(30, 5, 200, 150))
def __init__(self, parent=None, update_func=None, params=None): super().__init__(parent) self.setMaximumWidth(200) self.params = params self.H1_HEIGHT = 50 self.H2_HEIGHT = 50 self.SIDE_MARGIN = 5 self.H1_FONT_SIZE = 18 self.H2_FONT_SIZE = 18 self.H3_FONT_SIZE = 16 self.TEXT_FONT_SIZE = 14 style = ''' QPushButton:flat{ text-align: left; padding: 1ex; } QPushButton:pressed{ background-color: silver; } QPushButton:hover:!pressed{ font: bold; } ''' self.setStyleSheet(style) self.update_func = update_func self.inner = QWidget(self) self.vbox = QVBoxLayout(self.inner) self.vbox.setSpacing(0) self.vbox.setContentsMargins(0, 0, 0, 0) self.vbox.setAlignment(Qt.AlignTop) topframe = QFrame() topframe.setStyleSheet('background-color: white') topframe.setFixedHeight(self.H1_HEIGHT) lbl_h1 = QLabel('Contents', topframe) fnt = lbl_h1.font() fnt.setPointSize(self.H1_FONT_SIZE) lbl_h1.setFont(fnt) lbl_h1.setFixedHeight(self.H1_HEIGHT) lbl_h1.setMargin(self.SIDE_MARGIN) self.vbox.addWidget(topframe) self.list_button = [] if self.params.lang == 'en': self.edit_button('Introduction') else: self.edit_button('はじめに') self.inner.setLayout(self.vbox) self.setWidget(self.inner)
def initUI(self, parent): print("Parent: ") print(type(parent)) print(parent) frame = QFrame() # frame.setStyleSheet("background-color: rgb(30, 45, 66);") frame.setFrameShape(QFrame.StyledPanel) frame.setFrameShadow(QFrame.Raised) frame.setFixedWidth(250) frame.setFixedHeight(50) self.food_label = QLabel() self.food_label.setText(parent[0]) self.food_price_label = QLabel() self.food_price_label.setText(str(parent[1])) test_layout = QHBoxLayout(frame) test_layout.addWidget(self.food_label) test_layout.addStretch() test_layout.addWidget(self.food_price_label) layout = QVBoxLayout() layout.addWidget(frame) layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) self.setLayout(layout) # self.resize(250, 50) # self.setContentsMargins(0, 0, 0, 0) # self.setGeometry(QRect(0, 0, 450, 50))
def add_frame(widget, layout=VERTICAL, height=None, width=None, name=None, stylesheet=None, t_m=0, b_m=0, l_m=0, r_m=0, space=0): section_frame = QFrame(widget) if height: section_frame.setFixedHeight(height) if width: section_frame.setFixedWidth(width) if stylesheet: section_frame.setStyleSheet(stylesheet) if name: section_frame.setObjectName(name) section_layout = add_layout(section_frame, layout, t_m=t_m, b_m=b_m, l_m=l_m, r_m=r_m, space=space) return section_frame, section_layout
def __init__(self, dispositivoCamara, parent=None): super(Widgets, self).__init__(parent) self.parent = parent self.estadoFoto = False self.byteArrayFoto = QByteArray() # ========================================================== frame = QFrame(self) frame.setFrameShape(QFrame.Box) frame.setFrameShadow(QFrame.Sunken) frame.setFixedWidth(505) frame.setFixedHeight(380) frame.move(10, 10) # Instancias self.paginaVisor = QVideoWidget() self.paginaVisor.resize(500, 375) self.visor = QCameraViewfinder(self.paginaVisor) self.visor.resize(500, 375) self.labelFoto = QLabel() self.labelFoto.setAlignment(Qt.AlignCenter) self.labelFoto.resize(500, 375) # QStackedWidget self.stackedWidget = QStackedWidget(frame) self.stackedWidget.addWidget(self.paginaVisor) self.stackedWidget.addWidget(self.labelFoto) self.stackedWidget.resize(500, 375) self.stackedWidget.move(2, 2) # ======================== BOTONES ========================= self.buttonTomarFoto = QPushButton("Tomar foto", self) self.buttonTomarFoto.resize(110, 26) self.buttonTomarFoto.move(525, 10) self.buttonEliminarFoto = QPushButton("Eliminar foto", self) self.buttonEliminarFoto.resize(110, 26) self.buttonEliminarFoto.move(525, 50) self.buttonGuardarFoto = QPushButton("Guardar foto", self) self.buttonGuardarFoto.resize(110, 26) self.buttonGuardarFoto.move(525, 82) # ======================== EVENTOS ========================= self.buttonTomarFoto.clicked.connect(self.tomarFoto) self.buttonEliminarFoto.clicked.connect(self.eliminarFoto) self.buttonGuardarFoto.clicked.connect(self.guardarFoto) # ================== FUNCIONES AUTOMÁTICAS ================= self.setCamara(dispositivoCamara)
def initUI(self, addButton): frame = QFrame() # frame.setStyleSheet("background-color: rgb(30, 45, 66);") frame.setFrameShape(QFrame.StyledPanel) frame.setFrameShadow(QFrame.Raised) frame.setMinimumWidth(960) frame.setFixedHeight(80) frame.setStyleSheet("border: none") self.add_button = QPushButton(frame) self.add_button.setGeometry(QRect(20, 10, 180, 41)) self.add_button.setStyleSheet("font: 75 12pt \"MS Shell Dlg 2\";\n" "background-color: rgb(30, 45, 66);\n" "color: rgb(255, 255, 255);") if addButton == "employees": self.add_button.setText("Add Employee") elif addButton == "reservations": self.add_button.setText("Add Reservations") elif addButton == "category": self.add_button.setText("Add Category") elif addButton == "tables": self.add_button.setText("Add Table") elif addButton == "stocks": self.add_button.setText("Add Stocks") elif addButton == "menu": self.add_button.setText("Add Menu Item") elif addButton == "bill": self.add_button.setText("Add Bill") self.add_button.setMinimumWidth(180) self.add_button.setMinimumHeight(40) # self.add_button.clicked.connect(lambda: self.findClick(addButton)) self.search_box = QLineEdit(frame) self.search_box.setGeometry(QRect(230, 10, 560, 41)) self.search_box.setMinimumWidth(540) self.search_box.setMinimumHeight(40) self.search_button = QPushButton(frame) self.search_button.setGeometry(QRect(810, 10, 130, 41)) self.search_button.setStyleSheet("font: 75 12pt \"MS Shell Dlg 2\";\n" "background-color: rgb(30, 45, 66);\n" "color: rgb(255, 255, 255);") self.search_button.setText("Search") self.search_button.setMinimumWidth(130) self.search_button.setMinimumHeight(40) layout = QHBoxLayout() layout.addWidget(frame) layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) self.setLayout(layout)
def _createTopBar(self): topbar = QFrame() topbar.setFixedHeight(50) topbar.setLayout(QHBoxLayout()) topbar.setContentsMargins(10, 0, 0, 0) topbar.setSizePolicy(QSizePolicy(1, 0)) topbar.setObjectName("topbar") self.titleText = QLabel("Produtos") topbar.layout().addWidget(self.titleText) return topbar
def adiciona_filtro(self): gb = QGroupBox("Filtro") self.instancia_filtro = QSearchForm.get(None, self.filters()) self.instancia_filtro.update_layout_height(2) gb.setLayout(self.instancia_filtro) gb.setFixedHeight(120) f = QFrame(self) mainLayout = QVBoxLayoutWithMargins() mainLayout.addWidget(gb) f.setLayout(mainLayout) f.setFixedHeight(140) return f
def initUI(self): self.txt2func = { 'はじめに': Introduction, 'Introduction': Introduction, '分析タスク': TypeOfTask, 'Task': TypeOfTask, '入力データ': SetFile, 'Input data': SetFile, 'データの確認': DataCheck, 'Data check': DataCheck, '過学習': Overfitting, 'Overfitting': Overfitting, '分析の実行': Analysis, 'Analysis': Analysis, '結果の確認': Results, 'Results': Results, 'バイアスとバリアンス': BiasVariance, 'Bias and Variance': BiasVariance, '学習曲線': LearningCurve, 'Learning curve': LearningCurve, '特徴量選択': FeatureSelection, 'Feature selection': FeatureSelection, '結果の確認2': Results2, 'Results 2': Results2, '学習曲線2': LearningCurve2, 'Learning curve 2': LearningCurve2, '予測': Prediction, 'Prediction': Prediction, 'Error': Error} self.setMinimumSize(1280, 960) self.setStyleSheet('background-color: rgb(242, 242, 242)') vbox = QVBoxLayout(self) vbox.setSpacing(0) vbox.setContentsMargins(0, 0, 0, 0) top = QFrame(self) top.setFrameShape(QFrame.StyledPanel) top.setFixedHeight(50) top.setStyleSheet('background-color: white') self.splitter = QSplitter(Qt.Horizontal, self) self.splitter.setHandleWidth(0) self.menuview = MenuView(self.splitter, self.update_content, self.params) self.menuview.setWidgetResizable(True) self.contentview = Introduction(self.splitter, self.menuview.edit_button, self.params) self.contentview.setWidgetResizable(True) self.splitter.addWidget(self.menuview) self.splitter.addWidget(self.contentview) vbox.addWidget(top) vbox.addWidget(self.splitter) self.setLayout(vbox) self.center() # self.showMaximized() self.setWindowTitle('MALSS interactive') self.show()
def new_event(self, event): oneEventFrame = QFrame() heightSlot = event.duration * self.oneMinSlot #oneEventFrame.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)) #oneEventFrame.resize(Ui_MainWindow.widthSlot, heightSlot) oneEventFrame.setFixedHeight(heightSlot) oneEventFrame.setContentsMargins(0, 0, 0, 0) oneEventFrame.setStyleSheet("background-color: rgb(2, 116, 205); border-bottom: 1px solid rgb(128, 128, 255);") #color = QtGui.QColor(233, 10, 150) oneEventLayout = QHBoxLayout() oneEventLayout.setContentsMargins(0, 0, 0, 0) oneEventLayout.setObjectName("oneEventLayout") oneEventFrame.setLayout(oneEventLayout) oneEventLayout.setSpacing(0) labelNameEvent = QLabel() labelNameEvent.setToolTipDuration(10) labelNameEvent.setObjectName("labelNameEvent") #labelNameEvent.setText(event.time + " " + event.name) labelNameEvent.setAutoFillBackground(True) labelNameEvent.setFixedHeight(heightSlot) if event.link is not None: link = f'<a href="{event.link}">event.time + " " + event.name</a>' else: link = event.time + " " + event.name print(link) labelNameEvent.setText(link) labelNameEvent.setOpenExternalLinks(True) labelNameEvent.setStyleSheet("color: white;") sheet = "a { text-decoration: underline; color: white }" #labelNameEvent.setDefaultStyleSheet(sheet) #labelNameEvent.resize(Ui_MainWindow.widthSlot, oneEventFrame.height()) oneEventLayout.addWidget(labelNameEvent) print(event.link) if event.link is not None: labelLinkImg = QLabel(link) labelLinkImg.setOpenExternalLinks(True) labelLinkImg.setMouseTracking(False) labelLinkImg.setLayoutDirection(QtCore.Qt.RightToLeft) labelLinkImg.setText("") labelLinkImg.setPixmap(QtGui.QPixmap("linkk.png")) labelLinkImg.setCursor(QCursor(QtCore.Qt.PointingHandCursor)) #self.label_img.setOpenExternalLinks(True) #self.label_img.setObjectName("label_img") oneEventLayout.addWidget(labelLinkImg) return oneEventFrame
def __init__(self, parent=None): super(Main_Ayuda, self).__init__(parent) self.setWindowTitle("EXADATA (AYUDA)") self.setFixedSize(800, 600) self.setWindowIcon(QIcon("icono.jpg")) # FRAME paleta = QPalette() paleta.setColor(QPalette.Background, QColor(51, 0, 102)) frame = QFrame(self) frame.setFrameShape(QFrame.NoFrame) frame.setFrameShadow(QFrame.Sunken) frame.setAutoFillBackground(True) frame.setPalette(paleta) frame.setFixedWidth(800) frame.setFixedHeight(100) frame.move(0, 0) labelIcono = QLabel(frame) labelIcono.setFixedWidth(65) labelIcono.setFixedHeight(65) labelIcono.setPixmap( QPixmap("icono.jpg").scaled(65, 65, Qt.KeepAspectRatio, Qt.SmoothTransformation)) labelIcono.move(10, 28) fuenteTitulo = QFont() fuenteTitulo.setPointSize(25) fuenteTitulo.setBold(True) labelTitulo = QLabel("<font color='white'>EXADATA</font>", frame) labelTitulo.setFont(fuenteTitulo) labelTitulo.move(85, 30) fuenteSubtitulo = QFont() fuenteSubtitulo.setPointSize(13) labelSubtitulo = QLabel("<font color='white'>Análisis de Tweets ", frame) labelSubtitulo.setFont(fuenteSubtitulo) labelSubtitulo.move(85, 68) # LOGO self.centralwidget = QtWidgets.QWidget(self) self.setCentralWidget(self.centralwidget) # CUADRO TEXTO self.textBrowser = QtWidgets.QTextBrowser(self.centralwidget) self.textBrowser.setGeometry(QtCore.QRect(10, 110, 780, 480))
def create_frame_bottom(self): frame = QFrame() frame.setFrameStyle(QFrame.StyledPanel) frame.setFixedHeight(200) layout = QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) tabs = QTabWidget() tabs.addTab(self.kafka_log, "Kafka") layout.addWidget(tabs) frame.setLayout(layout) return frame
def __addClientPanel(self, conn): panel = QWidget() panelLayout = QVBoxLayout() panelLayout.setContentsMargins(0, 5, 0, 0) panelLayout.setAlignment(Qt.AlignTop) panel.setLayout(panelLayout) nameWidget = QWidget() nameLayout = QHBoxLayout() nameWidget.setLayout(nameLayout) nameLayout.setContentsMargins(0, 0, 0, 0) nameLayout.setAlignment(Qt.AlignTop) name = QLabel(conn.getName()) server = QLabel('Server:') self.serverStatus = QLabel('-') nameLayout.addWidget(name) nameLayout.addWidget(server) nameLayout.addWidget(self.serverStatus) connection = QLabel('Connection: ' + conn.getConnectionDetails()) accWidget = QWidget() accLayout = QHBoxLayout() accLayout.setContentsMargins(0, 0, 0, 0) accWidget.setLayout(accLayout) accuracy = QLabel('Accuracy: -') accLayout.addWidget(accuracy) conn.setQLabels(accuracy, self.serverStatus) getAccBtn = QPushButton('Update model') getAccBtn.setFixedWidth(100) getAccBtn.clicked.connect(lambda: conn.send([ComCodes.GET_ACCURACY])) accLayout.addWidget(getAccBtn) self.accBtns.append(getAccBtn) bottomLine = QFrame() bottomLine.setFixedHeight(1) bottomLine.setFrameStyle(1) panelLayout.addWidget(nameWidget) panelLayout.addWidget(connection) panelLayout.addWidget(accWidget) panelLayout.addWidget(bottomLine) return panel
def add_row(self, label_text: Union[str, QLabel], field_object: FieldType, stretch_field: bool = False) -> Optional[QLabel]: result: Optional[QLabel] = None if self.frame_layout.count() > 0: line = QFrame() line.setObjectName("FormSeparatorLine") line.setFrameShape(QFrame.HLine) line.setFixedHeight(1) self.frame_layout.addWidget(line) if isinstance(label_text, QLabel): label = label_text else: if not label_text.endswith(":"): label_text += ":" label = QLabel(label_text) result = label label.setObjectName("FormSectionLabel") label.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) grid_layout = QGridLayout() grid_layout.setContentsMargins(0, 0, 0, 0) grid_layout.addWidget(label, 0, 0, Qt.AlignRight | Qt.AlignTop) if stretch_field: if isinstance(field_object, QLayout): grid_layout.addLayout(field_object, 0, 1, Qt.AlignTop) else: grid_layout.addWidget(field_object, 0, 1, Qt.AlignTop) else: field_layout = QHBoxLayout() field_layout.setContentsMargins(0, 0, 0, 0) if isinstance(field_object, QLayout): field_layout.addLayout(field_object) else: field_layout.addWidget(field_object) field_layout.addStretch(1) grid_layout.addLayout(field_layout, 0, 1, Qt.AlignTop) grid_layout.setColumnMinimumWidth(0, self.minimum_label_width) grid_layout.setColumnStretch(0, 0) grid_layout.setColumnStretch(1, 1) grid_layout.setHorizontalSpacing(10) grid_layout.setSizeConstraint(QLayout.SetMinimumSize) self.frame_layout.addLayout(grid_layout) return result
def initUI(self, title): frame = QFrame() frame.setStyleSheet("background-color: rgb(30, 45, 66);") frame.setFrameShape(QFrame.StyledPanel) frame.setFrameShadow(QFrame.Raised) frame.setMinimumWidth(800) frame.setFixedHeight(160) main_label = QLabel(frame) main_label.setGeometry(QRect(300, 60, 233, 57)) main_label.setStyleSheet("font: 75 28pt \"MS Shell Dlg 2\";\n" "color: rgb(255, 255, 255);\n" "font: 36pt \"MS Shell Dlg 2\";") if title == "login": main_label.setText("Food Fest") elif title == "dashboard": main_label.setText("Dashboard") elif title == "employees": main_label.setText("Employees") elif title == "users": main_label.setText("Users") elif title == "tables": main_label.setText("Tables") elif title == "reservations": main_label.setText("Reservations") elif title == "category": main_label.setText("Categories") elif title == "orders": main_label.setText("Orders") elif title == "menu": main_label.setText("Menu") elif title == "settings": main_label.setText("Settings") elif title == "bills": main_label.setText("Bills") layout = QVBoxLayout() layout.addWidget(frame) layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) self.setLayout(layout)
def initUI(self): frame2 = QFrame(self) # frame2.setGeometry(QRect(0, 700, 800, 160)) frame2.setStyleSheet("background-color: rgb(30, 45, 66);") frame2.setFrameShape(QFrame.StyledPanel) frame2.setFrameShadow(QFrame.Raised) # frame.setObjectName("frame") # frame2.setFixedWidth(self.width()) frame2.setMinimumWidth(800) frame2.setFixedHeight(50) layout = QVBoxLayout() layout.addWidget(frame2) layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) self.setLayout(layout)
def createTopBar(self): topbar = QFrame() topbar.setFixedHeight(50) topbar.setObjectName("topbar") topbar.setLayout(QHBoxLayout()) topbar.layout().setAlignment(Qt.AlignLeft) """buttonClose = loader.buttonIcon("close", 35, 35) buttonClose.setObjectName("buttonClose") buttonClose.setFixedSize(35, 35) buttonClose.setFlat(True) buttonClose.clicked.connect(self.close) """ self._title = QLabel() topbar.layout().addWidget(self._title) topbar.layout().addStretch() #topbar.layout().addWidget(buttonClose) return topbar
def add_row(self, label_text: QWidget, field_widget: QWidget, stretch_field: bool=False) -> None: line = QFrame() line.setObjectName("PaymentSeparatorLine") line.setFrameShape(QFrame.HLine) line.setFixedHeight(1) self.frame_layout.addWidget(line) label = QLabel(label_text) label.setObjectName("PaymentSectionLabel") label.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) help_label = QLabel() help_label.setPixmap( QPixmap(icon_path("icons8-help.svg")).scaledToWidth(16, Qt.SmoothTransformation)) help_label.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) label_layout = QHBoxLayout() label_layout.addWidget(label) label_layout.addWidget(help_label) # Ensure that the top-aligned vertical spacing matches the fields. label_layout.setContentsMargins(0,2,0,2) label_layout.setSizeConstraint(QLayout.SetFixedSize) grid_layout = QGridLayout() grid_layout.addLayout(label_layout, 0, 0, Qt.AlignLeft | Qt.AlignTop) if stretch_field: grid_layout.addWidget(field_widget, 0, 1) else: field_layout = QHBoxLayout() field_layout.setContentsMargins(0, 0, 0, 0) field_layout.addWidget(field_widget) field_layout.addStretch(1) grid_layout.addLayout(field_layout, 0, 1) grid_layout.setColumnMinimumWidth(0, 80) grid_layout.setColumnStretch(0, 0) grid_layout.setColumnStretch(1, 1) grid_layout.setHorizontalSpacing(0) grid_layout.setSizeConstraint(QLayout.SetMinimumSize) self.frame_layout.addLayout(grid_layout)
def __setup_ui(self): # Create frames and populate stack self.__slide_stack.addWidget(AccountDetailsFrame(self.__slide_stack)) self.__slide_stack.addWidget(NetworkDetailsFrame(self.__slide_stack)) self.__slide_stack.hide() # Set up welcome top-half content_frame = QFrame() content_frame.setFrameShape(QFrame.StyledPanel) content_frame.setFrameShadow(QFrame.Raised) content_frame.setObjectName("create-account-top") content_layout = QVBoxLayout(content_frame) # # Create labels welcome_lbl = QLabel('Welcome to UChat.') welcome_lbl.setObjectName('create-account-welcome') sub_lbl = QLabel('A secure and stateless, peer-to-peer messaging client') sub_lbl.setObjectName('sub-lbl') # # # Create separation line line = QFrame() line.setFixedHeight(1) line.setObjectName("line") line.setFrameShape(QFrame.HLine) line.setFrameShadow(QFrame.Sunken) # Configure proceed button self.__proceed_btn.setFixedSize(QSize(85, 35)) # # Layout content_layout.addWidget(welcome_lbl) content_layout.addWidget(sub_lbl) content_layout.addSpacing(10) content_layout.addWidget(line) content_layout.addWidget(self.__slide_stack) self.__layout_manager.addWidget(content_frame) self.__layout_manager.addSpacing(35) self.__layout_manager.addWidget(self.__proceed_btn) self.__layout_manager.addStretch()
def __init__(self, parent=None, title='', params=None): super().__init__(parent) self.params = params self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.lbl_img_list = [] self.pixmap_list = [] self.H1_HEIGHT = 50 self.H2_HEIGHT = 50 self.SIDE_MARGIN = 5 self.H1_FONT_SIZE = 18 self.H2_FONT_SIZE = 18 self.H3_FONT_SIZE = 16 self.TEXT_FONT_SIZE = 14 self.inner = QWidget(self) self.vbox = QVBoxLayout(self.inner) self.vbox.setSpacing(10) self.vbox.setContentsMargins(0, 0, 0, 0) topframe = QFrame() topframe.setStyleSheet('background-color: white') topframe.setFixedHeight(self.H1_HEIGHT) self.title = title lbl_h1 = QLabel(title, topframe) fnt = lbl_h1.font() fnt.setPointSize(self.H1_FONT_SIZE) lbl_h1.setFont(fnt) lbl_h1.setFixedHeight(self.H1_HEIGHT) lbl_h1.setMargin(self.SIDE_MARGIN) self.vbox.addWidget(topframe) self.inner.setLayout(self.vbox) self.setWidget(self.inner)
def __init__(self, parent=None, title='', params=None): super().__init__(parent) self.params = params self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.lbl_img_list = [] self.pixmap_list = [] self.H1_HEIGHT = 50 self.H2_HEIGHT = 50 self.SIDE_MARGIN = 5 self.H1_FONT_SIZE = 18 self.H2_FONT_SIZE = 18 self.H3_FONT_SIZE = 16 self.TEXT_FONT_SIZE = 14 self.inner = QWidget(self) self.vbox = QVBoxLayout(self.inner) self.vbox.setSpacing(10) self.vbox.setContentsMargins(0, 0, 0, 0) topframe = QFrame() topframe.setStyleSheet('background-color: white') topframe.setFixedHeight(self.H1_HEIGHT) lbl_h1 = QLabel(title, topframe) fnt = lbl_h1.font() fnt.setPointSize(self.H1_FONT_SIZE) lbl_h1.setFont(fnt) lbl_h1.setFixedHeight(self.H1_HEIGHT) lbl_h1.setMargin(self.SIDE_MARGIN) self.vbox.addWidget(topframe) self.inner.setLayout(self.vbox) self.setWidget(self.inner)
def ui(self): frame = QFrame() layout = QHBoxLayout(frame) undo_button = QPushButton() redo_button = QPushButton() text_button = QPushButton('T') for buttons in [undo_button, redo_button, text_button]: buttons.setFixedSize(self.BUTTON_SIZE) buttons.setIconSize(self.ICON_SIZE) undo_button.setIcon(QIcon("resources/icons/undo.svg")) redo_button.setIconSize(self.ICON_SIZE) redo_button.setIcon(QIcon("resources/icons/redo.svg")) undo_button.clicked.connect(self.undo_event) redo_button.clicked.connect(self.redo_event) text_button.clicked.connect(self.textInScene) layout.addWidget(undo_button) layout.addWidget(redo_button) layout.addWidget(text_button) frame.setFixedHeight(self.TOOLBAR_HEIGHT) modules_frame = QFrame() frame_layout = QVBoxLayout(modules_frame) self.App.combobox_modules = QComboBox() self.App.combobox_modules.addItem('selecione um módulo') self.App.combobox_modules.addItems(self.App.modules) self.App.combobox_modules.model().item(0).setEnabled(False) self.App.combobox_modules.currentIndexChanged.connect(self.App.selected_module) frame_layout.addWidget(self.App.combobox_modules) layout.addWidget(modules_frame) return frame
def __init__(self, parent): super().__init__() self.setContextMenuPolicy(Qt.CustomContextMenu) self.customContextMenuRequested.connect(self.show_context_menu) self.del_hash = None self.parent = parent self.main_v = QVBoxLayout() self.date = QLabel() self.type = QLabel() info_wrap = QHBoxLayout() self.info = QLineEdit() self.info_copy_open = QPushButton("Copy") info_wrap.addWidget(self.info_copy_open, 20) info_wrap.addWidget(self.info, 80) self.info.setReadOnly(True) self.main_v.addWidget(self.date) self.main_v.addWidget(self.type) self.main_v.addStretch(1) self.main_v.addItem(info_wrap) self.main_h_wrap = QHBoxLayout() self.thumb = QLabel() self.main_h_wrap.addLayout(self.main_v, 1) self.main_h_wrap.addWidget(self.thumb, 0) w = QFrame() w.setFrameStyle(QFrame().StyledPanel | QFrame().Raised) w.setLayout(self.main_h_wrap) w.setFixedHeight(110) framewrap = QVBoxLayout() framewrap.addWidget(w) self.setLayout(framewrap)
def initUI(self): frame = QFrame() # frame.setStyleSheet("background-color: rgb(30, 45, 66);") frame.setFrameShape(QFrame.StyledPanel) frame.setFrameShadow(QFrame.Raised) frame.setMinimumWidth(200) frame.setFixedHeight(150) frame.setStyleSheet("border: none") details = self.get_restaurant_details() restname = QLabel(frame) # restname.setAlignment(Qt.AlignCenter) restname.setGeometry(QRect(100, 0, 300, 41)) restname.setStyleSheet("color: rgb(30, 45, 66);" 'font: 75 16pt "MS Shell Dlg 2";') restname.setText(details[0]) address = QLabel(frame) # address.setAlignment(Qt.AlignCenter) address.setGeometry(QRect(100, 40, 300, 41)) address.setStyleSheet("color: rgb(30, 45, 66);" 'font: 75 16pt "MS Shell Dlg 2";') address.setText(details[1]) number = QLabel(frame) # number.setAlignment(Qt.AlignCenter) number.setGeometry(QRect(100, 80, 300, 41)) number.setStyleSheet("color: rgb(30, 45, 66);" 'font: 75 16pt "MS Shell Dlg 2";') number.setText(details[2]) layout = QVBoxLayout() layout.addWidget(frame) layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) self.setLayout(layout)
def setupUI(self, animarBotones): paleta = QPalette() paleta.setColor(QPalette.Background, QColor(0, 0, 93)) frame = QFrame(self) frame.setFrameShape(QFrame.NoFrame) frame.setFrameShadow(QFrame.Sunken) frame.setAutoFillBackground(True) frame.setPalette(paleta) frame.setFixedWidth(400) frame.setFixedHeight(84) frame.move(0, 0) labelIcono = QLabel(frame) labelIcono.setFixedWidth(40) labelIcono.setFixedHeight(40) labelIcono.setPixmap( QPixmap("mundo.png").scaled(40, 40, Qt.KeepAspectRatio, Qt.SmoothTransformation)) labelIcono.move(37, 22) fuenteTitulo = QFont() fuenteTitulo.setPointSize(16) fuenteTitulo.setBold(True) labelTitulo = QLabel("<font color='white'>BIENVENIDO</font>", frame) labelTitulo.setFont(fuenteTitulo) labelTitulo.move(83, 20) frameUsuario = QFrame(self) frameUsuario.setFrameShape(QFrame.StyledPanel) frameUsuario.setFixedWidth(100) frameUsuario.setFixedHeight(28) frameUsuario.move(90, 50) self.lineEditUsuario1 = QLineEdit(frameUsuario) self.lineEditUsuario1.setReadOnly(True) self.lineEditUsuario1.setFrame(False) self.lineEditUsuario1.setTextMargins(8, 0, 4, 1) self.lineEditUsuario1.setFixedWidth(100) self.lineEditUsuario1.setFixedHeight(26) self.lineEditUsuario1.move(0, 1) fuenteSubtitulo = QFont() fuenteSubtitulo.setPointSize(9) labelSubtitulo = QLabel("<font color='white'" "(Python).</font>", frame) labelSubtitulo.setFont(fuenteSubtitulo) labelSubtitulo.move(111, 46) self.button = ui_menu(self) self.button.setText("MIS CURSOS") self.button.setCursor(Qt.PointingHandCursor) self.button.setAutoDefault(False) self.button.setGeometry(40, 150, 160, 60) self.button.clicked.connect(self.abrirmenuuser) self.buttonDos = ui_menu(self) self.buttonDos.setText("UNIRSE A \nUN CURSO") self.buttonDos.setCursor(Qt.PointingHandCursor) self.buttonDos.setAutoDefault(False) self.buttonDos.setGeometry(220, 150, 160, 60) self.buttonDos.clicked.connect(self.openanadirclase)
class GridCard(QFrame, QObject): def __init__(self, parent=None, debug=False, with_actions=True, with_title=True): super(GridCard, self).__init__(parent) self._buttons = [] self._content_layout = QVBoxLayout() self._content_layout.setContentsMargins(0, 0, 0, 0) self._content_layout.setSpacing(0) self.setLayout(self._content_layout) self.setFixedHeight(150) self._title_widget = QLabel() self._title_widget.setStyleSheet("QLabel { font-size : 14px;}") self._title_widget.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter) self._title_widget.setScaledContents(True) self._sub_title_widget = QLabel() self._sub_title_widget.setStyleSheet("QLabel { font-size : 10px;}") self._sub_title_widget.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter) self._sub_title_widget.setScaledContents(True) self._body_widget = None # layouts self._body_frame = QFrame() self._body_frame.setMinimumWidth(150) self._body_frame.setObjectName("image_container") self._body_frame.setLayout(QVBoxLayout()) self._body_frame.layout().setContentsMargins(2, 2, 2, 2) self._body_frame.layout().setAlignment(QtCore.Qt.AlignHCenter) size_policy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) size_policy.setVerticalStretch(4) self._body_frame.setSizePolicy(size_policy) self._title_frame = QFrame() self._title_frame.setLayout(QVBoxLayout()) self._title_frame.layout().setContentsMargins(2, 2, 2, 2) self._title_frame.layout().addWidget(self._title_widget) self._title_frame.layout().addWidget(self._sub_title_widget) size_policy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) size_policy.setVerticalStretch(1) self._title_frame.setSizePolicy(size_policy) self._actions_frame = QFrame() self._actions_frame.setLayout(QHBoxLayout()) self._actions_frame.setFixedHeight(30) self._actions_frame.layout().setContentsMargins(0, 0, 0, 0) size_policy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) size_policy.setVerticalStretch(2) self._actions_frame.setSizePolicy(size_policy) # self._body_frame.setSizePolicy(QSizePolicy.Minimum,QSizePolicy.Ex) # self._title_frame.setSizePolicy(QSizePolicy.Minimum,QSizePolicy.Minimum) # self._actions_frame.setSizePolicy(QSizePolicy.Minimum,QSizePolicy.Minimum) self._content_layout.addWidget(self._body_frame) if with_title: self._content_layout.addWidget(self._title_frame) if with_actions: self._content_layout.addWidget(self._actions_frame, alignment=QtCore.Qt.AlignCenter) if debug: self.setFrameStyle(QFrame.Box) self._body_frame.setFrameStyle(QFrame.Box) self._title_frame.setFrameStyle(QFrame.Box) self._actions_frame.setFrameStyle(QFrame.Box) def add_buttons(self, args: typing.Any): if isinstance(args, QPushButton): self._actions_frame.layout().addWidget(args) else: for btn in args: if isinstance(btn, QPushButton): self._actions_frame.layout().addWidget(btn) @property def body(self) -> QWidget: return self._body_widget @body.setter def body(self, value): self._body_widget = value self._body_frame.layout().addWidget(value) @property def body_frame(self): return self._body_frame @property def label(self): return self._title_widget @label.setter def label(self, value): self._title_widget.setText(value) @property def label2(self): return self._sub_title_widget @label2.setter def label2(self, value): self._sub_title_widget.setText(value) @property def buttons(self): return self._buttons @buttons.setter def buttons(self, value): self._buttons = value for btn in self._buttons: self._actions_frame.layout().addWidget(btn)
def initui(self): palette = QPalette() palette.setColor(QPalette.Background, QColor(100, 100, 100)) # ************ Header ************ # ------------ Frame ---------- frame = QFrame(self) frame.setFrameShape(QFrame.NoFrame) frame.setFrameShadow(QFrame.Sunken) frame.setAutoFillBackground(True) frame.setPalette(palette) frame.setFixedWidth(800) frame.setFixedHeight(84) frame.move(0, 0) # ------------ Icon ---------- label_icon = QLabel(frame) label_icon.setFixedWidth(40) label_icon.setFixedHeight(40) label_icon.setPixmap( QPixmap("./images/LoginIcon.png").scaled(40, 40, Qt.KeepAspectRatio, Qt.SmoothTransformation)) label_icon.move(57, 22) # ------------ Tittle ---------- tittle_font = QFont() tittle_font.setPixelSize(16) tittle_font.setBold(True) tittle_label = QLabel("<font color='white'> Ariadna </rfont>", frame) tittle_label.setFont(tittle_font) tittle_label.move(103, 20) # ------------ Sub Tittle ---------- sub_tittle_font = QFont() sub_tittle_font.setPointSize(9) sub_tittle_label = QLabel( "<font color='white'> Labyrinth Solver </font>", frame) sub_tittle_label.setFont(sub_tittle_font) sub_tittle_label.move(111, 46) # ************ Body ************ # ------------ Frame ---------- instructions_frame = QFrame(self) instructions_frame.setFrameShape(QFrame.NoFrame) instructions_frame.setFrameShadow(QFrame.Sunken) instructions_frame.setAutoFillBackground(False) instructions_frame.setFixedWidth(300) instructions_frame.setFixedHeight(500) instructions_frame.move(0, 84) # ---------- Instructions ---------- instructions_font = QFont() instructions_font.setPointSize(9) instructions_label = QLabel( "<font style='font-family:times new roman;font-size:15px;' color='white'><b> " "<br/>Pre-resquisitos:" "<br/><br/>Para que la imagen pueda ser " "<br/>reconocida por el sistema, el " "<br/>laberinto debe ser dibujado en " "<br/>una hoja blanca con un marcador o" "<br/>esfero de color negro y debe tener" "<br/>una forma rectangular." "<br/><br/>Pasos:" "<br/><br/>1. Seleccionar la opcion " "<br/>'Nuevo Laberinto'." "<br/><br/>2. Seleccionar la opcion " "<br/>'Cargar laberinto', en esta opcion se." "<br/>soluciona el laberinto de manera " "<br/>automatica." "</b></font>", instructions_frame) instructions_label.setFont(instructions_font) instructions_label.move(20, 20) # ---------- Buttons ---------- back_main_menu_button = QPushButton("Volver al Menu Principal", self) back_main_menu_button.setFixedWidth(200) back_main_menu_button.setFixedHeight(28) back_main_menu_button.move(300, 660) # ---------- Button's Events ---------- back_main_menu_button.clicked.connect(self.back_main_menu)
def initUI(self): labelTitulo = QLabel("CAPTURA DE ", self) labelTitulo.setFont(QFont("MS Shell Dlg 2", 11)) labelTitulo.setStyleSheet('color:white') labelTitulo.move(300, 10) labelTitulo2 = QLabel("ALUMNOS", self) labelTitulo2.setFont(QFont("MS Shell Dlg 2", 11)) labelTitulo2.setStyleSheet('color:white') labelTitulo2.move(390, 10) buttonGuardar = QPushButton("Grabar", self) buttonGuardar.setFixedWidth(135) buttonGuardar.setFixedHeight(28) buttonGuardar.move(150, 500) buttonGuardar.setIcon(QIcon("save.png")) buttonGuardar.setIconSize(QtCore.QSize(30, 30)) buttonEscribir = QPushButton("Escribir", self) buttonEscribir.setFixedWidth(135) buttonEscribir.setFixedHeight(28) buttonEscribir.move(310, 500) buttonEscribir.setIcon(QIcon("excel.png")) buttonEscribir.setIconSize(QtCore.QSize(25, 25)) buttonLimpiar = QPushButton("Limpiar", self) buttonLimpiar.setFixedWidth(135) buttonLimpiar.setFixedHeight(28) buttonLimpiar.move(470, 500) buttonLimpiar.setIcon(QIcon("limpiar.png")) buttonLimpiar.setIconSize(QtCore.QSize(25, 25)) buttonGuardar.clicked.connect(self.guardar) buttonEscribir.clicked.connect(self.escribir) buttonLimpiar.clicked.connect(self.limpiar) labelNombre = QLabel("Nombre", self) labelNombre.setFont(QFont("MS Shell Dlg 2", 9)) labelNombre.setStyleSheet('color:white') labelNombre.move(7, 60) frameNombre = QFrame(self) frameNombre.setFixedWidth(285) frameNombre.setFixedHeight(28) frameNombre.move(60, 60) self.lineEditNombre = QLineEdit(frameNombre) self.lineEditNombre.setFrame(True) self.lineEditNombre.setTextMargins(7, 1, 6, 1) self.lineEditNombre.setFixedWidth(245) self.lineEditNombre.setFixedHeight(29) self.lineEditNombre.move(40, 1) labelApellido_Paterno = QLabel("Apellido Paterno", self) labelApellido_Paterno.setFont(QFont("MS Shell Dlg 2", 9)) labelApellido_Paterno.setStyleSheet('color:white') labelApellido_Paterno.setLineWidth(8) labelApellido_Paterno.move(7, 120) frameApellido_Paterno = QFrame(self) frameApellido_Paterno.setFixedWidth(290) frameApellido_Paterno.setFixedHeight(29) frameApellido_Paterno.move(60, 120) self.lineEditApellido_Paterno = QLineEdit(frameApellido_Paterno) self.lineEditApellido_Paterno.setFrame(True) self.lineEditApellido_Paterno.setTextMargins(7, 1, 6, 1) self.lineEditApellido_Paterno.setFixedWidth(245) self.lineEditApellido_Paterno.setFixedHeight(29) self.lineEditApellido_Paterno.move(40, 1) labelApellido_Materno = QLabel("Apellido Materno", self) labelApellido_Materno.setFont(QFont("MS Shell Dlg 2", 9)) labelApellido_Materno.setStyleSheet('color:white') labelApellido_Materno.move(7, 180) frameApellido_Materno = QFrame(self) frameApellido_Materno.setFixedWidth(290) frameApellido_Materno.setFixedHeight(29) frameApellido_Materno.move(60, 180) self.lineEditApellido_Materno = QLineEdit(frameApellido_Materno) self.lineEditApellido_Materno.setFrame(True) self.lineEditApellido_Materno.setTextMargins(7, 1, 6, 1) self.lineEditApellido_Materno.setFixedWidth(245) self.lineEditApellido_Materno.setFixedHeight(29) self.lineEditApellido_Materno.move(40, 1) labelMatricula = QLabel("Matrícula", self) labelMatricula.setFont(QFont("MS Shell Dlg 2", 9)) labelMatricula.setStyleSheet('color:white') labelMatricula.move(7, 240) frameMatricula = QFrame(self) frameMatricula.setFixedWidth(290) frameMatricula.setFixedHeight(29) frameMatricula.move(60, 240) self.lineEditMatricula = QLineEdit(frameMatricula) self.lineEditMatricula.setFrame(True) self.lineEditMatricula.setTextMargins(7, 1, 6, 1) self.lineEditMatricula.setFixedWidth(245) self.lineEditMatricula.setFixedHeight(29) self.lineEditMatricula.move(40, 1) self.lineEditMatricula.setValidator(QIntValidator()) labelEdad = QLabel("Edad", self) labelEdad.setFont(QFont("MS Shell Dlg 2", 9)) labelEdad.setStyleSheet('color:white') labelEdad.move(7, 300) frameEdad = QFrame(self) frameEdad.setFixedWidth(290) frameEdad.setFixedHeight(29) frameEdad.move(60, 300) self.lineEditEdad = QLineEdit(frameEdad) self.lineEditEdad.setFrame(True) self.lineEditEdad.setTextMargins(7, 1, 6, 1) self.lineEditEdad.setFixedWidth(245) self.lineEditEdad.setFixedHeight(29) self.lineEditEdad.move(40, 1) self.lineEditEdad.setValidator(QIntValidator()) labelCalle = QLabel("Calle y Numero", self) labelCalle.setFont(QFont("MS Shell Dlg 2", 9)) labelCalle.setStyleSheet('color:white') labelCalle.move(7, 360) frameCalle = QFrame(self) frameCalle.setFixedWidth(290) frameCalle.setFixedHeight(29) frameCalle.move(60, 360) self.lineEditCalle = QLineEdit(frameCalle) self.lineEditCalle.setFrame(True) self.lineEditCalle.setTextMargins(7, 1, 6, 1) self.lineEditCalle.setFixedWidth(245) self.lineEditCalle.setFixedHeight(29) self.lineEditCalle.move(40, 1) labelMunicipio = QLabel("Municipio", self) labelMunicipio.setFont(QFont("MS Shell Dlg 2", 9)) labelMunicipio.setStyleSheet('color:white') labelMunicipio.move(515, 60) self.comboBoxMunicipio = QComboBox(self) self.comboBoxMunicipio.addItems([ "Apodaca", "Cadereyta Jimenez", "Escobedo", "Garcia", "Guadalupe", "Juarez", "Monterrey", "Salinas Victoria", "San Nicolas de los Garza", "San Pedro Garza Garcia", "Santa Catarina", "Santiago", "Cienega de Flores", "General Zuazua", "Pesqueria" ]) self.comboBoxMunicipio.setCurrentIndex(-1) self.comboBoxMunicipio.setFixedWidth(290) self.comboBoxMunicipio.setFixedHeight(29) self.comboBoxMunicipio.move(400, 95) labelEstado = QLabel("Estado", self) labelEstado.setFont(QFont("MS Shell Dlg 2", 9)) labelEstado.setStyleSheet('color:white') labelEstado.move(515, 150) self.comboBoxEstado = QComboBox(self) self.comboBoxEstado.addItems(["Nuevo Leon"]) self.comboBoxEstado.setCurrentIndex(-1) self.comboBoxEstado.setFixedWidth(290) self.comboBoxEstado.setFixedHeight(29) self.comboBoxEstado.move(400, 175) labelBeca = QLabel("BECA %", self) labelBeca.setFont(QFont("MS Shell Dlg 2", 9)) labelBeca.setStyleSheet('color:white') labelBeca.move(515, 240) self.radio_cero = QRadioButton('0%', self) self.radio_cero.setStyleSheet('color:white') self.radio_cero.move(400, 270) self.radio_25 = QRadioButton('25%', self) self.radio_25.setStyleSheet('color:white') self.radio_25.move(470, 270) self.radio_50 = QRadioButton('50%', self) self.radio_50.setStyleSheet('color:white') self.radio_50.move(540, 270) self.radio_cien = QRadioButton('100%', self) self.radio_cien.setStyleSheet('color:white') self.radio_cien.move(610, 270) self.Programacionbox = QCheckBox('Progra', self) self.Programacionbox.move(380, 340) self.Programacionbox.setFont(QFont("MS Shell Dlg 2", 9)) self.Programacionbox.setStyleSheet('color:white') label_macion = QLabel("macion", self) label_macion.setFont(QFont("MS Shell Dlg 2", 9)) label_macion.setStyleSheet('color:white') label_macion.move(434, 340) self.Contabilidadbox = QCheckBox('Contabilidad', self) self.Contabilidadbox.move(500, 340) self.Contabilidadbox.setFont(QFont("MS Shell Dlg 2", 9)) self.Contabilidadbox.setStyleSheet('color:white') self.boxEstadistica = QCheckBox('Estadistica', self) self.boxEstadistica.move(610, 340) self.boxEstadistica.setFont(QFont("MS Shell Dlg 2", 9)) self.boxEstadistica.setStyleSheet('color:white') self.Basebox = QCheckBox('Base de Datos', self) self.Basebox.move(380, 370) self.Basebox.setFont(QFont("MS Shell Dlg 2", 9)) self.Basebox.setStyleSheet('color:white') self.Investigacionbox = QCheckBox('Investigación', self) self.Investigacionbox.move(500, 370) self.Investigacionbox.setFont(QFont("MS Shell Dlg 2", 9)) self.Investigacionbox.setStyleSheet('color:white') Investigacion_label = QLabel("de Operaciones", self) Investigacion_label.move(595, 370) Investigacion_label.setFont(QFont("MS Shell Dlg 2", 9)) Investigacion_label.setStyleSheet('color:white')
def initui(self): palette = QPalette() palette.setColor(QPalette.Background, QColor(100, 100, 100)) # ************ Header ************ # ------------ Frame ---------- frame = QFrame(self) frame.setFrameShape(QFrame.NoFrame) frame.setFrameShadow(QFrame.Sunken) frame.setAutoFillBackground(True) frame.setPalette(palette) frame.setFixedWidth(500) frame.setFixedHeight(84) frame.move(0, 0) # ------------ Icon ---------- label_icon = QLabel(frame) label_icon.setFixedWidth(40) label_icon.setFixedHeight(40) label_icon.setPixmap( QPixmap("./images/LoginIcon.png").scaled(40, 40, Qt.KeepAspectRatio, Qt.SmoothTransformation)) label_icon.move(57, 22) # ------------ Tittle ---------- tittle_font = QFont() tittle_font.setPixelSize(16) tittle_font.setBold(True) tittle_label = QLabel("<font color='white'> Ariadna Sign In </rfont>", frame) tittle_label.setFont(tittle_font) tittle_label.move(103, 20) # ------------ Sub Tittle ---------- sub_tittle_font = QFont() sub_tittle_font.setPointSize(9) sub_tittle_label = QLabel( "<font color='white'> Labyrinth Solver </font>", frame) sub_tittle_label.setFont(sub_tittle_font) sub_tittle_label.move(111, 46) # ************ Login ************ # ---------- User ---------- user_label = QLabel('Usuario', self) user_label.move(90, 110) user_frame = QFrame(self) user_frame.setFrameShape(QFrame.StyledPanel) user_frame.setFixedWidth(338) user_frame.setFixedHeight(28) user_frame.move(90, 136) user_icon = QLabel(user_frame) user_icon.setPixmap( QPixmap("./images/UserIcon.png").scaled(20, 20, Qt.KeepAspectRatio, Qt.SmoothTransformation)) user_icon.move(10, 4) self.line_edit_user = QLineEdit(user_frame) self.line_edit_user.setFrame(False) self.line_edit_user.setTextMargins(8, 0, 4, 1) self.line_edit_user.setFixedWidth(297) self.line_edit_user.setFixedHeight(26) self.line_edit_user.move(40, 1) # ---------- Password ---------- password_label = QLabel("Contraseña", self) password_label.move(90, 170) password_frame = QFrame(self) password_frame.setFrameShape(QFrame.StyledPanel) password_frame.setFixedWidth(338) password_frame.setFixedHeight(28) password_frame.move(90, 196) password_icon = QLabel(password_frame) password_icon.setPixmap( QPixmap("./images/PasswordIcon.png").scaled( 20, 20, Qt.KeepAspectRatio, Qt.SmoothTransformation)) password_icon.move(10, 4) self.line_edit_password = QLineEdit(password_frame) self.line_edit_password.setFrame(False) self.line_edit_password.setEchoMode(QLineEdit.Password) self.line_edit_password.setTextMargins(8, 0, 4, 1) self.line_edit_password.setFixedWidth(297) self.line_edit_password.setFixedHeight(26) self.line_edit_password.move(40, 1) # ---------- Confirm Password ---------- confirm_password_label = QLabel("Confirmar Contraseña", self) confirm_password_label.move(90, 224) confirm_password_frame = QFrame(self) confirm_password_frame.setFrameShape(QFrame.StyledPanel) confirm_password_frame.setFixedWidth(338) confirm_password_frame.setFixedHeight(28) confirm_password_frame.move(90, 250) confirm_password_icon = QLabel(confirm_password_frame) confirm_password_icon.setPixmap( QPixmap("./images/PasswordIcon.png").scaled( 20, 20, Qt.KeepAspectRatio, Qt.SmoothTransformation)) confirm_password_icon.move(10, 4) self.line_edit_confirm_password = QLineEdit(confirm_password_frame) self.line_edit_confirm_password.setFrame(False) self.line_edit_confirm_password.setEchoMode(QLineEdit.Password) self.line_edit_confirm_password.setTextMargins(8, 0, 4, 1) self.line_edit_confirm_password.setFixedWidth(297) self.line_edit_confirm_password.setFixedHeight(26) self.line_edit_confirm_password.move(40, 1) # ---------- Buttons ---------- sign_in_button = QPushButton("Registrarse", self) sign_in_button.setFixedWidth(175) sign_in_button.setFixedHeight(28) sign_in_button.move(170, 300) login_button = QPushButton("Volver a Login", self) login_button.setFixedWidth(175) login_button.setFixedHeight(28) login_button.move(170, 334) cancel_button = QPushButton("Cancelar", self) cancel_button.setFixedWidth(135) cancel_button.setFixedHeight(28) cancel_button.move(192, 368) # ---------- Button's Events ---------- sign_in_button.clicked.connect(self.sign_in) login_button.clicked.connect(self.login) cancel_button.clicked.connect(self.close)
def initUI(self): # ==================== FRAME ENCABEZADO ==================== paleta = QPalette() paleta.setColor(QPalette.Background, QColor(51, 0, 102)) frame = QFrame(self) frame.setFrameShape(QFrame.NoFrame) frame.setFrameShadow(QFrame.Sunken) frame.setAutoFillBackground(True) frame.setPalette(paleta) frame.setFixedWidth(400) frame.setFixedHeight(84) frame.move(0, 0) labelIcono = QLabel(frame) labelIcono.setFixedWidth(40) labelIcono.setFixedHeight(40) labelIcono.setPixmap( QPixmap("icono.png").scaled(40, 40, Qt.KeepAspectRatio, Qt.SmoothTransformation)) labelIcono.move(37, 22) fuenteTitulo = QFont() fuenteTitulo.setPointSize(16) fuenteTitulo.setBold(True) labelTitulo = QLabel("<font color='white'>Login</font>", frame) labelTitulo.setFont(fuenteTitulo) labelTitulo.move(83, 20) # ===================== WIDGETS LOGIN ====================== # ======================================================== labelUsuario = QLabel("Usuario", self) labelUsuario.move(60, 120) frameUsuario = QFrame(self) frameUsuario.setFrameShape(QFrame.StyledPanel) frameUsuario.setFixedWidth(280) frameUsuario.setFixedHeight(28) frameUsuario.move(60, 146) self.lineEditUsuario = QLineEdit(frameUsuario) self.lineEditUsuario.setFrame(False) self.lineEditUsuario.setTextMargins(8, 0, 4, 1) self.lineEditUsuario.setFixedWidth(238) self.lineEditUsuario.setFixedHeight(26) self.lineEditUsuario.move(40, 1) # ======================================================== labelContrasenia = QLabel("Contraseña", self) labelContrasenia.move(60, 174) frameContrasenia = QFrame(self) frameContrasenia.setFrameShape(QFrame.StyledPanel) frameContrasenia.setFixedWidth(280) frameContrasenia.setFixedHeight(28) frameContrasenia.move(60, 200) self.lineEditContrasenia = QLineEdit(frameContrasenia) self.lineEditContrasenia.setFrame(False) self.lineEditContrasenia.setEchoMode(QLineEdit.Password) self.lineEditContrasenia.setTextMargins(8, 0, 4, 1) self.lineEditContrasenia.setFixedWidth(238) self.lineEditContrasenia.setFixedHeight(26) self.lineEditContrasenia.move(40, 1) labelToken = QLabel("Token", self) labelToken.move(60, 224) frameToken = QFrame(self) frameToken.setFrameShape(QFrame.StyledPanel) frameToken.setFixedWidth(280) frameToken.setFixedHeight(28) frameToken.move(60, 250) self.lineEditToken = QLineEdit(frameToken) self.lineEditToken.setFrame(False) self.lineEditToken.setEchoMode(QLineEdit.Password) self.lineEditToken.setTextMargins(8, 0, 4, 1) self.lineEditToken.setFixedWidth(238) self.lineEditToken.setFixedHeight(26) self.lineEditToken.move(40, 1) # ================== WIDGETS QPUSHBUTTON =================== buttonLogin = QPushButton("Iniciar sesión", self) buttonLogin.setFixedWidth(135) buttonLogin.setFixedHeight(28) buttonLogin.move(60, 286) buttonCancelar = QPushButton("Cancelar", self) buttonCancelar.setFixedWidth(135) buttonCancelar.setFixedHeight(28) buttonCancelar.move(205, 286) # ==================== MÁS INFORMACIÓN ===================== # ==================== SEÑALES BOTONES ===================== buttonLogin.clicked.connect(self.Login) buttonCancelar.clicked.connect(self.close)
class window(QWidget): def __init__(self, parent=None): super(window, self).__init__() self.worker = predict_worker(parent=self) self.init_ui() def init_ui(self): self.setFixedHeight(600) self.setFixedWidth(450) self.setWindowTitle("MNIST Digit Prediction") self.hasDrawing = False self.mouseHeld = False self.path = drawing_path() self.rect = QRect(0, 50, 400, 400) self.label = QLabel("Click and hold the left mouse button to draw.", self) self.label.move(25, 10) self.label.setFixedWidth(300) self.label2 = QLabel("Classifications include numerals (0-9).", self) self.label2.move(25, 35) self.label2.setFixedWidth(300) self.results = QLabel("Results will appear here", self) self.results.move(25, 540) self.results.setFixedWidth(300) self.result_label = QLabel("", self) self.result_label.move(330, 490) self.clear_button = QPushButton("Clear", self) self.clear_button.move(330, 535) self.clear_button.clicked.connect(self.clear) self.upper_line = QFrame(self) self.upper_line.setFrameShape(QFrame.HLine) self.upper_line.move(25, 85) self.upper_line.setFixedWidth(400) self.lower_line = QFrame(self) self.lower_line.setFrameShape(QFrame.HLine) self.lower_line.move(25, 485) self.lower_line.setFixedWidth(400) self.left_line = QFrame(self) self.left_line.setFrameShape(QFrame.VLine) self.left_line.move(-25, 100) self.left_line.setFixedHeight(400) self.right_line = QFrame(self) self.right_line.setFrameShape(QFrame.VLine) self.right_line.move(375, 100) self.right_line.setFixedHeight(400) self.show() def clear(self): self.path.clear_path() self.update() def mousePressEvent(self, event): x = event.x() y = event.y() self.path.clear_path() if 100 < y < 500: if 25 < x < 425: if self.hasDrawing == True: self.path.clear() self.mouseHeld = True position = event.pos() self.path.add_point(x, y) self.results.setText("Position = " + str(position)) return else: self.results.setText("Position out of range") self.mouseHeld = False return self.mouseHeld = False self.results.setText("Position out of range") return def mouseMoveEvent(self, event): x = event.x() y = event.y() if 100 < y < 500: if 25 < x < 425: if self.mouseHeld == True: position = event.pos() self.path.add_point(x, y) self.results.setText("Position = " + str(position)) self.update() return else: self.results.setText("Position out of range") else: self.results.setText("Position out of range") def paintEvent(self, event): painter = QPainter() painter.begin(self) last_x = 0 last_y = 0 for x, y in list(zip(self.path.x_pos, self.path.y_pos)): if last_x == 0: last_x = x last_y = y else: painter.drawLine(last_x, last_y, x, y) last_x = x last_y = y # painter.drawLine(self.last_x, self.last_y, self.cur_x, self.cur_y) painter.end() def mouseReleaseEvent(self, event): self.mouseHeld = False if len(self.path.x_pos) < 4: return self.results.setText("Processing Data...") self.worker.process_data(self.path) def update_label(self, text): self.results.setText(text)
def __init__(self, parent=None): super(Main_MUESTRA, self).__init__(parent) self.setWindowTitle("EXADATA") self.setFixedSize(900, 600) self.centralwidget = QtWidgets.QWidget(self) self.centralwidget.setObjectName("centralwidget") # FRAME paleta = QPalette() paleta.setColor(QPalette.Background, QColor(51, 0, 102)) frame = QFrame(self) frame.setFrameShape(QFrame.NoFrame) frame.setFrameShadow(QFrame.Sunken) frame.setAutoFillBackground(True) frame.setPalette(paleta) frame.setFixedWidth(950) frame.setFixedHeight(100) frame.move(0, 0) labelIcono = QLabel(frame) labelIcono.setFixedWidth(65) labelIcono.setFixedHeight(65) labelIcono.setPixmap(QPixmap("icono.jpg").scaled(65, 65, Qt.KeepAspectRatio, Qt.SmoothTransformation)) labelIcono.move(10, 28) fuenteTitulo = QFont() fuenteTitulo.setPointSize(25) fuenteTitulo.setBold(True) labelTitulo = QLabel("<font color='white'>EXADATA</font>", frame) labelTitulo.setFont(fuenteTitulo) labelTitulo.move(85, 30) fuenteSubtitulo = QFont() fuenteSubtitulo.setPointSize(13) labelSubtitulo = QLabel("<font color='white'>Análisis de Tweets " , frame) labelSubtitulo.setFont(fuenteSubtitulo) labelSubtitulo.move(85, 68) # BARRA self.progressBar = QtWidgets.QProgressBar(self.centralwidget) self.progressBar.setGeometry(QtCore.QRect(10, 480, 510, 23)) self.progressBar.setProperty("value", 24) self.progressBar.setTextVisible(False) self.progressBar.setObjectName("progressBar") #inicio tabla self.tabla = QtWidgets.QTableWidget(self.centralwidget) # formato tabla posx,posy,tamx,tamy self.tabla.setGeometry(QtCore.QRect(10, 120, 510, 400)) self.tabla.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.tabla.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents) self.tabla.setColumnCount(4) self.tabla.setObjectName("tabla") self.tabla.setRowCount(0) item = QtWidgets.QTableWidgetItem() self.tabla.setHorizontalHeaderItem(0, item) item = QtWidgets.QTableWidgetItem() self.tabla.setHorizontalHeaderItem(1, item) item = QtWidgets.QTableWidgetItem() self.tabla.setHorizontalHeaderItem(2, item) item = QtWidgets.QTableWidgetItem() self.tabla.setHorizontalHeaderItem(3, item) self.tabla.horizontalHeader().setDefaultSectionSize(120) self.tabla.horizontalHeader().setStretchLastSection(True) self.tabla.verticalHeader().setStretchLastSection(False) self.tabla.cellClicked.connect(self.ConsultarFecha) #fin tabla # BOTONES # boton exportar_bd self.bt_exportar_bd = QtWidgets.QPushButton(self.centralwidget) self.bt_exportar_bd.setGeometry(QtCore.QRect(550, 400, 100, 20)) self.bt_exportar_bd.setObjectName("bt_exportar_bd") self.bt_exportar_bd.clicked.connect(self.Exportar_Fecha) # boton exportar_bd2 self.bt_exportar_bd2 = QtWidgets.QPushButton(self.centralwidget) self.bt_exportar_bd2.setGeometry(QtCore.QRect(635, 460, 100, 20)) self.bt_exportar_bd2.setObjectName("bt_exportar_bd2") self.bt_exportar_bd2.clicked.connect(self.Exportar_Cantidad) # CUADRO TEXTO self.muestra_cantidad = QtWidgets.QLineEdit(self.centralwidget) self.muestra_cantidad.setGeometry(QtCore.QRect(550, 460, 50, 20)) self.muestra_cantidad.setObjectName("muestra_cantidad") #================================================================================= self.setCentralWidget(self.centralwidget) #CALENDARIO # formato tabla posx,posy,tamx,tamy self.calendario = QtWidgets.QCalendarWidget(self.centralwidget) self.calendario.setGeometry(QtCore.QRect(550, 120, 312, 183)) self.calendario.setStyleSheet("") self.calendario.setStyleSheet("alternate-background-color: rgb(118, 148, 255);") self.calendario.setObjectName("calendario") #LABEL MUESTRA POR FECHA self.label_muestraFecha = QtWidgets.QLabel(self.centralwidget) self.label_muestraFecha.setGeometry(QtCore.QRect(550, 330, 121, 16)) self.label_muestraFecha.setObjectName("label_muestraFecha") #LABEL MUESTRA DE TODA LA BASE self.label_muestraToda = QtWidgets.QLabel(self.centralwidget) self.label_muestraToda.setGeometry(QtCore.QRect(550, 440, 200, 16)) self.label_muestraToda.setObjectName("label_muestraToda") self.fechaInicio = QtWidgets.QDateEdit(self.centralwidget) self.fechaInicio.setGeometry(QtCore.QRect(550, 370, 110, 22)) self.fechaInicio.setObjectName("fechaInicio") self.fechaInicio.setCalendarPopup(True) self.fechaTermino = QtWidgets.QDateEdit(self.centralwidget) self.fechaTermino.setGeometry(QtCore.QRect(720, 370, 110, 22)) self.fechaTermino.setObjectName("fechaTermino") self.fechaTermino.setCalendarPopup(True) self.fechaInicio.setDate(QtCore.QDate.currentDate()) self.fechaTermino.setDate(QtCore.QDate.currentDate()) self.incioLetra = QtWidgets.QLabel(self.centralwidget) self.incioLetra.setGeometry(QtCore.QRect(550, 350, 111, 16)) self.incioLetra.setObjectName("incioLetra") self.terminoLetra = QtWidgets.QLabel(self.centralwidget) self.terminoLetra.setGeometry(QtCore.QRect(720, 350, 111, 16)) self.terminoLetra.setObjectName("terminoLetra") #BARRA MENU self.menubar = QtWidgets.QMenuBar(self) self.menubar.setGeometry(QtCore.QRect(0, 0, 1000, 21)) self.menubar.setObjectName("menubar") self.Programas = QtWidgets.QMenu(self.menubar) self.BaseDeDatos = QtWidgets.QAction(self) self.menubar.addAction(self.Programas.menuAction()) self.Programas.addAction(self.BaseDeDatos) self.BaseDeDatos.triggered.connect(self.close) self.Ayuda = QtWidgets.QMenu(self.menubar) self.SobreQue = QtWidgets.QAction(self) self.menubar.addAction(self.Ayuda.menuAction()) self.Ayuda.addAction(self.SobreQue) self.SobreQue.triggered.connect(self.AYUDA) # boton recarga_bd self.bt_recarga_bd = QtWidgets.QPushButton(self.centralwidget) self.bt_recarga_bd.setGeometry(QtCore.QRect(10, 530, 510, 20)) self.bt_recarga_bd.setObjectName("bt_recarga_bd") self.bt_recarga_bd.clicked.connect(self.CargarTabla) self.retranslateUi(self) QtCore.QMetaObject.connectSlotsByName(self) #new table self.tabla_master() self.CargarTabla() self.progressBar.hide()