class Groom(QWidget): def __init__ (self): super().__init__() # self.qt = QWidget() # self.qt = screenWindow self.init_ui() def init_ui(self): # self.qt.showFullScreen() # self.qt.resize(800, 800) # Set background black # self.darkPalette = QPalette() # self.darkPalette.setColor(QPalette.Background, Qt.black) # self.qt.setPalette(self.darkPalette) effect = QGraphicsDropShadowEffect() effect.setOffset(0, 0) effect.setBlurRadius(300) effect.setColor(QColor(255,255,255)) self.frame = QFrame() self.frame.setFrameShape(QFrame.Box) self.frame.setLineWidth(15) self.frame.setMidLineWidth(5) self.frame.setFrameShadow(QFrame.Raised) self.frame.setGraphicsEffect(effect)
class MainWindow(QWidget): def __init__(self): super().__init__() self.resize(500, 500) self.initUi() def initUi(self): self.color = QGraphicsColorizeEffect() self.color.setColor(QColor('black')) self.frame = QFrame(self) self.frame.setGeometry(100, 100, 100, 100) self.frame.setStyleSheet('background-color: black;') self.frame.setGraphicsEffect(self.color) self.button = QPushButton(self) self.button.setGeometry(250, 100, 100, 100) self.button.setText('Анимация') self.button.clicked.connect(self.Animation) def Animation(self): self.anim = QPropertyAnimation(self.color, b"color") self.anim.setDuration(3000) self.anim.setStartValue(QColor('black')) self.anim.setEndValue(QColor('red')) self.anim.start()
class QAnchorDialogForStudent(QFrame): def __init__(self,parent): super(QAnchorDialogForStudent,self).__init__(parent) self.setWindowFlags(Qt.FramelessWindowHint|Qt.Dialog) self.__initUI() def __initUI(self): self.frame = QFrame(self) self.layout = MyVBoxLayout(self) self.layout.addWidget(self.frame) self.setShadow() pass def setShadow(self): shadow = QGraphicsDropShadowEffect(blurRadius=15, xOffset=13, yOffset=13) self.frame.setGraphicsEffect(shadow)
def initUI(self): TextBr = QTextBrowser(self) TextBr.setGeometry(400, 300, 300, 100) TextBr.setText('Test') rbtn = QPushButton('Red', self) rbtn.setObjectName("Red") rbtn.setGeometry(10, 30, 50, 50) gbtn = QPushButton('Green', self) gbtn.setObjectName("Green") gbtn.setGeometry(10, 90, 50, 50) bbtn = QPushButton('Blue', self) bbtn.setObjectName("Blue") bbtn.setGeometry(10, 160, 50, 50) frm = QFrame(self) frm.setGeometry(200, 50, 500, 500) frm.setObjectName("frame1") frm2 = QFrame(self) frm2.setGeometry(100, 100, 100, 100) frm2.setObjectName("frame2") self.setGeometry(300, 200, 1000, 500) self.setWindowTitle('QSS learning') # self.setStyleSheet('QPushButton{background-color:rgb(0,255,0)}') self.setStyleSheet( '#frame1{background-color:rgb(0,255,0)}' '#frame1:hover{background-color:rgb(0,255,235)}' '#frame2{background-color:rgb(0,255,0);border-radius:15px;}' '#Red{background-color:rgb(128,0,0);border-radius:5px;}' '#Red:hover{background-color:rgb(255,125,125);border-radius:25px;}' '#Red:pressed {background-color:rgb(255,125,125)}') self.shadow = QGraphicsDropShadowEffect(self) self.shadow.setBlurRadius(50) self.shadow.setXOffset(2) self.shadow.setYOffset(5) self.shadow.setColor(QColor(0, 0, 0, 255)) frm2.setGraphicsEffect(self.shadow) self.show()
def initUI(self): self.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint) self.setAttribute(Qt.WA_TranslucentBackground, True) layout = QVBoxLayout() layout.addWidget(QLabel('hello world')) rootWidget = QFrame() rootWidget.setLayout(layout) rootWidget.setObjectName("rootWidget") shadow = QGraphicsDropShadowEffect(self) shadow.setColor(Qt.black); shadow.setBlurRadius(10) shadow.setOffset(0,0) rootWidget.setGraphicsEffect(shadow) rootLayout = QVBoxLayout() rootLayout.addWidget(rootWidget) self.setLayout(rootLayout) self.setStyleSheet(utils.translate.style.Style) self.resize(200,200)
def init_ui(self): """ Initialises all the GUI elements required for the nutrient processing window :return: """ try: self.setFont(QFont('Segoe UI')) self.setWindowModality(Qt.WindowModal) self.setWindowFlags(Qt.WindowMinimizeButtonHint | Qt.WindowMaximizeButtonHint | Qt.WindowCloseButtonHint) #self.showMaximized() mainMenu = self.menuBar() fileMenu = mainMenu.addMenu('File') editMenu = mainMenu.addMenu('Edit') self.analysistraceLabel = QLabel( '<b>Processing file: </b>' + str(self.file) + ' | <b>Analysis Trace: </b>' + str(self.current_nutrient).capitalize()) self.analysistraceLabel.setProperty('headertext', True) tracelabelframe = QFrame() tracelabelframe.setProperty('nutrientHeadFrame', True) tracelabelframeshadow = QtWidgets.QGraphicsDropShadowEffect() tracelabelframeshadow.setBlurRadius(6) tracelabelframeshadow.setColor(QtGui.QColor('#e1e6ea')) tracelabelframeshadow.setYOffset(2) tracelabelframeshadow.setXOffset(3) tracelabelframe.setGraphicsEffect(tracelabelframeshadow) traceframe = QFrame() traceframe.setProperty('nutrientFrame', True) traceframeshadow = QtWidgets.QGraphicsDropShadowEffect() traceframeshadow.setBlurRadius(6) traceframeshadow.setColor(QtGui.QColor('#e1e6ea')) traceframeshadow.setYOffset(2) traceframeshadow.setXOffset(3) traceframe.setGraphicsEffect(traceframeshadow) self.qctabsLabel = QLabel('<b>QC Charts:</b>', ) self.qctabsLabel.setProperty('headertext', True) qclabelframe = QFrame() qclabelframe.setProperty('nutrientHeadFrame', True) qclabelframeshadow = QtWidgets.QGraphicsDropShadowEffect() qclabelframeshadow.setBlurRadius(6) qclabelframeshadow.setColor(QtGui.QColor('#e1e6ea')) qclabelframeshadow.setYOffset(2) qclabelframeshadow.setXOffset(3) qclabelframe.setGraphicsEffect(qclabelframeshadow) self.qctabs = QTabWidget() qctabsframe = QFrame() qctabsframe.setProperty('nutrientFrame', True) qctabsframeshadow = QtWidgets.QGraphicsDropShadowEffect() qctabsframeshadow.setBlurRadius(6) qctabsframeshadow.setColor(QtGui.QColor('#e1e6ea')) qctabsframeshadow.setYOffset(3) qctabsframeshadow.setXOffset(3) qctabsframe.setGraphicsEffect(qctabsframeshadow) buttonsframe = QFrame() buttonsframe.setFixedHeight(60) #buttonsframe.setFixedWidth(300) buttonsframe.setProperty('nutrientButtonFrame', True) self.auto_size = QCheckBox('Auto zoom') leftonxaxis = QPushButton() leftonxaxis.clicked.connect(self.move_camera_left) leftonxaxis.setIcon(QIcon(':/assets/greenleftarrow.svg')) leftonxaxis.setIconSize(QSize(33, 33)) leftonxaxis.setProperty('nutrientControls', True) leftonxaxis.setFixedWidth(50) rightonxaxis = QPushButton() rightonxaxis.clicked.connect(self.move_camera_right) rightonxaxis.setIcon(QIcon(':/assets/greenrightarrow.svg')) rightonxaxis.setIconSize(QSize(33, 33)) rightonxaxis.setProperty('nutrientControls', True) rightonxaxis.setFixedWidth(50) zoomin = QPushButton() zoomin.clicked.connect(self.zoom_in) zoomin.setIcon(QIcon(':/assets/zoomin.svg')) zoomin.setIconSize(QSize(33, 33)) zoomin.setProperty('nutrientControls', True) zoomin.setFixedWidth(50) zoomout = QPushButton() zoomout.clicked.connect(self.zoom_out) zoomout.setIcon(QIcon(':/assets/zoomout.svg')) zoomout.setIconSize(QSize(33, 33)) zoomout.setProperty('nutrientControls', True) zoomout.setFixedWidth(50) zoomfit = QPushButton() zoomfit.clicked.connect(self.zoom_fit) zoomfit.setIcon(QIcon(':/assets/expand.svg')) zoomfit.setIconSize(QSize(33, 33)) zoomfit.setProperty('nutrientControls', True) zoomfit.setFixedWidth(50) self.find_lat_lons = QCheckBox('Find Lat/Longs') okcanframe = QFrame() okcanframe.setMinimumHeight(40) okcanframe.setProperty('nutrientFrame2', True) okcanframeshadow = QtWidgets.QGraphicsDropShadowEffect() okcanframeshadow.setBlurRadius(6) okcanframeshadow.setColor(QtGui.QColor('#e1e6ea')) okcanframeshadow.setYOffset(2) okcanframeshadow.setXOffset(3) okcanframe.setGraphicsEffect(okcanframeshadow) okbut = QPushButton('Proceed') okbut.setFixedHeight(25) okbut.setFixedWidth(100) okbut.clicked.connect(self.proceed) okbut.setProperty('nutrientControls', True) cancelbut = QPushButton('Cancel') cancelbut.clicked.connect(self.cancel) cancelbut.setProperty('nutrientControls', True) cancelbut.setFixedHeight(25) cancelbut.setFixedWidth(95) if not self.perf_mode: pg.setConfigOptions(antialias=True) self.graph_widget = pg.PlotWidget() if self.ultra_perf_mode: self.graph_widget.useOpenGL(True) label_style = { 'color': '#C1C1C1', 'font-size': '10pt', 'font-family': 'Segoe UI' } self.graph_widget.setLabel('left', 'A/D Value', **label_style) self.graph_widget.setLabel('bottom', 'Time (s)', **label_style) self.graph_widget.showGrid(x=True, y=True) self.vertical_line = pg.InfiniteLine(angle=90, movable=False) self.vertical_line.setZValue(10) self.graph_widget.addItem(self.vertical_line, ignoreBounds=True) if self.theme == 'normal': self.graph_widget.setBackground('w') graph_pen = pg.mkPen(color=(25, 25, 30), width=1.2) else: self.graph_widget.setBackground((25, 25, 25)) graph_pen = pg.mkPen(color=(211, 211, 211), width=1.2) # This is the plot that holds the signal trace self.plotted_data = self.graph_widget.plot(pen=graph_pen) self.plotted_data.scene().sigMouseClicked.connect(self.on_click) self.plotted_data.scene().sigMouseMoved.connect( self.move_crosshair) # These are for holding the lines representing the drift and baseline across the run baseline_pen = pg.mkPen(color=('#d69f20'), width=2) self.baseline_plotted = self.graph_widget.plot(pen=baseline_pen) drift_pen = pg.mkPen(color=('#c6c600'), width=2) self.drift_plotted = self.graph_widget.plot(pen=drift_pen) self.hovered_peak_lineedit = QLineEdit() self.hovered_peak_lineedit.setFont(QFont('Segoe UI')) # Setting everything into the layout self.grid_layout.addWidget(tracelabelframe, 0, 0, 1, 11) self.grid_layout.addWidget(self.analysistraceLabel, 0, 0, 1, 5, Qt.AlignCenter) self.grid_layout.addWidget(qclabelframe, 0, 11, 1, 5) self.grid_layout.addWidget(self.qctabsLabel, 0, 11, 1, 1, Qt.AlignCenter) self.grid_layout.addWidget(traceframe, 1, 0, 20, 11) self.grid_layout.addWidget(self.graph_widget, 1, 0, 17, 11) self.grid_layout.addWidget(self.hovered_peak_lineedit, 18, 0, 1, 11) self.grid_layout.addWidget(qctabsframe, 1, 11, 19, 5) self.grid_layout.addWidget(self.qctabs, 1, 11, 19, 5) self.grid_layout.addWidget(self.auto_size, 20, 0, Qt.AlignCenter) self.grid_layout.addWidget(buttonsframe, 19, 3, 2, 5) self.grid_layout.addWidget(leftonxaxis, 19, 3, 2, 1, Qt.AlignHCenter) self.grid_layout.addWidget(rightonxaxis, 19, 4, 2, 1, Qt.AlignHCenter) self.grid_layout.addWidget(zoomfit, 19, 5, 2, 1, Qt.AlignHCenter) self.grid_layout.addWidget(zoomin, 19, 6, 2, 1, Qt.AlignHCenter) self.grid_layout.addWidget(zoomout, 19, 7, 2, 1, Qt.AlignHCenter) self.grid_layout.addWidget(self.find_lat_lons, 19, 0, Qt.AlignCenter) self.grid_layout.addWidget(okcanframe, 20, 11, 1, 5) self.grid_layout.addWidget(okbut, 20, 12, 1, 2, Qt.AlignJustify) self.grid_layout.addWidget(cancelbut, 20, 13, 1, 2, Qt.AlignJustify) self.bootup = True self.show() except Exception: print(traceback.print_exc())
def __init__(self, parent, title="Title", width=500, height=180): self.parent = parent self.dragPosition = None self.width = width self.height = height super().__init__(parent) self.setWindowFlags(Qt.FramelessWindowHint) self.setAttribute(Qt.WA_TranslucentBackground) self.gap = 10 self.center(self.width + self.gap, self.height + self.gap) self.setAcceptDrops(True) layout = QVBoxLayout() layout.setSpacing(0) layout.setAlignment(Qt.AlignTop) layout.setContentsMargins(0, 0, 0, 0) # Title title = QLabel(title) title.setObjectName('title') def trigger_close(_): self.close() close_btn = Builder().text('x').name('close_btn').click( trigger_close).build() header = QHBoxLayout() header.addWidget(title) header.addStretch(1) header.addWidget(close_btn) self.close_btn = close_btn dlgHeader = QFrame() dlgHeader.setObjectName('header') dlgHeader.setMaximumWidth(width) dlgHeader.setLayout(header) layout.addWidget(dlgHeader) widget = QWidget(self) self.main = self.ui(widget) widget.setObjectName('main') widget.setLayout(self.main) widget.setMaximumWidth(width) layout.addWidget(widget) _main = QWidget() _main.setContentsMargins(0, 0, 0, 10) _main.setLayout(layout) _main.setStyleSheet(self.style()) _main.setWindowOpacity(0.5) _main_layout = QStackedLayout() _main_layout.setContentsMargins(20, 20, 20, 20) _main_layout.setAlignment(Qt.AlignCenter) _main_layout.setStackingMode(QStackedLayout.StackAll) _backgound = QFrame() _backgound.setMinimumWidth(width) _backgound.setMinimumHeight(height) _backgound.setMaximumWidth(width) _backgound.setMaximumHeight(height) _backgound.setStyleSheet("background: #fafafa; border-radius:5px;") if not app.is_windows(): _main_layout.addWidget(_backgound) _main_layout.addWidget(_main) self.setLayout(_main_layout) self.effect = QGraphicsDropShadowEffect(_backgound) self.effect.setOffset(0, 0) self.effect.setBlurRadius(30) # self.effect.setEnabled(False) _backgound.setGraphicsEffect(self.effect)
class ViewsController(QMainWindow): """This class will handle all the views of the application. Responsible for showing the differnet views in a specific order depending on the input of the user. If the application is launched with a profile (configuration file), the main view of the application will be shown; otherwise, the title and the configuration views will be shown prior to the main view. """ home_singal = pyqtSignal() robot_select_signal = pyqtSignal() def __init__(self, parent, configuration, controller=None): """Constructor of the class. Arguments: parent {ui.gui.views_controller.ParentWindow} -- Parent of this. configuration {utils.configuration.Config} -- Configuration instance of the application Keyword Arguments: controller {utils.controller.Controller} -- Controller of the application (default: {None}) """ QMainWindow.__init__(self) self.parent = parent self.controller = controller self.configuration = configuration self.main_view = None self.thread_gui = ThreadGUI(self) self.thread_gui.daemon = True # self.home_singal.connect(self.show_title) # self.robot_select_signal.connect(self.show_robot_selection) def show_title(self): """Shows the title view""" title = TitleWindow(self.parent) title.switch_window.connect(self.show_robot_selection) self.parent.main_layout.addWidget(title) self.fadein_animation() def show_robot_selection(self): """Shows the robot selection view""" from views.robot_selection import RobotSelection delete_widgets_from(self.parent.main_layout) robot_selector = RobotSelection(self.parent) robot_selector.switch_window.connect(self.show_world_selection) self.parent.main_layout.addWidget(robot_selector, 0) self.fadein_animation() def show_world_selection(self): """Shows the world selection view""" from views.world_selection import WorldSelection delete_widgets_from(self.parent.main_layout) world_selector = WorldSelection(self.parent.robot_selection, self.configuration, self.parent) world_selector.switch_window.connect(self.show_layout_selection) self.parent.main_layout.addWidget(world_selector) self.fadein_animation() def show_layout_selection(self): """Show the layout configuration view""" delete_widgets_from(self.parent.main_layout) self.layout_selector = LayoutSelection(self.configuration, self.parent) self.layout_selector.switch_window.connect(self.show_main_view_proxy) self.parent.main_layout.addWidget(self.layout_selector) self.fadein_animation() def show_main_view_proxy(self): """Helper function to show the main view. Will close the parent window to create a new one""" # self.show_main_view(False) self.parent.close() def show_main_view(self, from_main): """Shows the main window depending on where the application comes from. If the from_main flag is true, the configuration comes from the previous GUI views. Otherwise, the configuration comes from a configuration file. Eitherway, the main view will be shown with the proper configuration. Arguments: from_main {bool} -- tells if the configuration comes from either configuration file or GUI. """ if not from_main: layout_configuration = self.layout_selector.get_config() delete_widgets_from(self.parent.main_layout) else: layout_configuration = None self.main_view = MainView(layout_configuration, self.configuration, self.controller, self.parent) self.parent.main_layout.addWidget(self.main_view) self.fadein_animation() self.start_thread() def start_thread(self): """Start the GUI refresing loop""" self.thread_gui.start() def fadein_animation(self): """Start a fadein animation for views transitions""" self.w = QFrame(self.parent) # self.parent.main_layout.addWidget(self.w, 0) self.w.setFixedSize(WIDTH, HEIGHT) self.w.setStyleSheet('background-color: rgba(51,51,51,1)') self.w.show() effect = QGraphicsOpacityEffect() self.w.setGraphicsEffect(effect) self.animation = QPropertyAnimation(effect, b"opacity") self.animation.setDuration(500) self.animation.setStartValue(1) self.animation.setEndValue(0) self.animation.start(QPropertyAnimation.DeleteWhenStopped) self.animation.finished.connect(self.fade_animation) def fade_animation(self): """Safe kill the animation""" self.w.close() del self.w del self.animation def update_gui(self): """Update the GUI. Called from the refresing loop thread""" while not self.parent.closing: if self.main_view: self.main_view.update_gui() time.sleep(0.1)
def init_ui(self): # TODO: make first time start up own function # Complete setup if this is the first time running on the system newpath = 'C:/HyPro' if not os.path.exists(newpath): os.makedirs(newpath) # Make settings json file paramfile = 'C:/HyPro/hyprosettings.json' if not os.path.isfile(paramfile): params = { 'processors': [], 'projects': {}, 'activeprocessor': '', 'activeproject': '', 'theme': 'normal' } with open('C:/HyPro/hyprosettings.json', 'w+') as file: json.dump(params, file) with open('C:/HyPro/hyprosettings.json', 'r') as f: hyprosettings = json.load(f) # Set the current project, if there is already one set of course, if not = no active project if hyprosettings['activeproject'] != "": self.currproject = hyprosettings['activeproject'] project = True else: self.currproject = 'No active project' project = False deffont = QFont('Segoe UI') self.setFont(deffont) gridlayout = QGridLayout() gridlayout.setSpacing(6) gridlayout.setContentsMargins(0, 0, 5, 0) self.setGeometry(400, 400, 900, 440) qtRectangle = self.frameGeometry() screen = QtWidgets.QApplication.desktop().screenNumber( QtWidgets.QApplication.desktop().cursor().pos()) centerPoint = QtWidgets.QApplication.desktop().screenGeometry( screen).center() qtRectangle.moveCenter(centerPoint) self.move(qtRectangle.topLeft()) self.setWindowFlags(QtCore.Qt.WindowMinimizeButtonHint | QtCore.Qt.WindowCloseButtonHint) # self.setFixedSize(self.size()) self.setWindowTitle('HyPro - Main Menu') # self.statusBar().showMessage('Load a project') # Initialise menu buttons and options mainMenu = self.menuBar() fileMenu = mainMenu.addMenu('File') editMenu = mainMenu.addMenu('Edit') viewMenu = mainMenu.addMenu('View') toolMenu = mainMenu.addMenu('Tools') helpMenu = mainMenu.addMenu('Help') createNewProjectMenu = QAction(QIcon(':/assets/newfile.svg'), 'New Project', self) createNewProjectMenu.triggered.connect(self.create_new_project) fileMenu.addAction(createNewProjectMenu) openProjectMenu = QAction(QIcon(':/assets/open.svg'), 'Open Project', self) openProjectMenu.triggered.connect(self.load_project) fileMenu.addAction(openProjectMenu) importProjectMenu = QAction(QIcon(':/assets/import.svg'), 'Import Project', self) importProjectMenu.triggered.connect(self.import_project) fileMenu.addAction(importProjectMenu) fileMenu.addSeparator() exitMenu = QAction(QIcon(':/assets/exit.svg'), 'Exit', self) exitMenu.triggered.connect(self.close) fileMenu.addAction(exitMenu) editRMNSMenu = QAction(QIcon(':/assets/food.svg'), 'Edit RMNS', self) editRMNSMenu.triggered.connect(self.rmns_standards) editMenu.addAction(editRMNSMenu) editOSILMenu = QAction(QIcon(':/assets/saltshaker.svg'), 'Edit OSIL', self) editOSILMenu.triggered.connect(self.osil_standards) editMenu.addAction(editOSILMenu) enableDarkMode = QAction('Dark Mode', self, checkable=True) if hyprosettings['theme'] == 'dark': enableDarkMode.setChecked(True) enableDarkMode.triggered.connect(self.enable_dark_mode) editMenu.addAction(enableDarkMode) viewDataMenu = QAction(QIcon(':/assets/search.svg'), 'View Data', self) viewDataMenu.triggered.connect(self.view_data) viewMenu.addAction(viewDataMenu) mapPlotMenu = QAction(QIcon(':/assets/mapmarker.svg'), 'Map Plotting', self) mapPlotMenu.triggered.connect(self.mapplot) viewMenu.addAction(mapPlotMenu) triaxusPlotMenu = QAction(QIcon(), 'Triaxus Plotting', self) triaxusPlotMenu.triggered.connect(self.triaxusplot) viewMenu.addAction(triaxusPlotMenu) aboutMenu = QAction(QIcon(':/assets/roundquestionmark.svg'), 'About', self) aboutMenu.triggered.connect(self.about_information) helpMenu.addAction(aboutMenu) manualMenu = QAction(QIcon(':/assets/roundinfo.svg'), 'Manual', self) manualMenu.triggered.connect(self.show_manual) helpMenu.addAction(manualMenu) headerlogo = QLabel(self) headerlogo.setPixmap( QPixmap(':/assets/2dropsshadow.ico').scaled( 32, 32, Qt.KeepAspectRatio)) headerlogo.setProperty('headerlogo', True) # Labels headerframe = QFrame() headerframe.setProperty('headerframe', True) headerlabel = QLabel(' HyPro②') headerlabel.setProperty('headertext', True) currprojectframe = QFrame(self) currprojectframe.setProperty('projectframe', True) currprojectframeshadow = QtWidgets.QGraphicsDropShadowEffect() currprojectframeshadow.setBlurRadius(6) currprojectframeshadow.setColor(QtGui.QColor('#e1e6ea')) currprojectframeshadow.setYOffset(2) currprojectframeshadow.setXOffset(3) currprojectframe.setGraphicsEffect(currprojectframeshadow) sidebarframe = QFrame(self) sidebarframe.setProperty('sidebarframe', True) self.currprojectlabel = QLabel('Active Project: ') self.currprojectlabel.setProperty('projecttext', True) self.currprojectdisp = QLabel(str(self.currproject)) self.currprojectdisp.setProperty('activeprojtext', True) selprojectlabel = QLabel('Select Active Project') selprojectlabel.setAlignment(Qt.AlignCenter) selprojectlabel.setProperty('sidebartext', True) processorlabel = QLabel('Processor') processorlabel.setProperty('sidebartext', True) optionlabel = QLabel('Options') optionlabel.setProperty('sidebartext', True) # Dropdowns self.processor = QComboBox() self.processor.setFixedWidth(100) self.processor.setFixedHeight(20) self.processor.setEditable(True) self.processor.lineEdit().setAlignment(QtCore.Qt.AlignHCenter) self.processor.lineEdit().setReadOnly(True) with open('C:/HyPro/hyprosettings.json', 'r') as f: hyprosettings = json.load(f) for x in hyprosettings['processors']: self.processor.addItem(x) self.processor.setProperty('sidebarbox', True) self.processor.activated.connect(self.active_processor_function) self.processor.setCurrentText(hyprosettings['activeprocessor']) # Buttons button1 = QPushButton('Create New Project') button1.setProperty('sidebar', True) button1.setObjectName('StyledButton') button1.clicked.connect(self.create_new_project) button2 = QPushButton('Load Existing Project') button2.setProperty('sidebar', True) button2.clicked.connect(self.load_project) button3 = QPushButton('Import Project') button3.setProperty('sidebar', True) button3.clicked.connect(self.import_project) button4 = QPushButton('Edit RMNS Standards') button4.setProperty('sidebar', True) button4.clicked.connect(self.rmns_standards) button5 = QPushButton('Add Processor') button5.setProperty('sidebar', True) button5.clicked.connect(self.add_processor) button6 = QPushButton('View Data') button6.setProperty('sidebar', True) button6.clicked.connect(self.view_data) button7 = QPushButton('Open Processing') button7.setProperty('procbutton', True) button7.clicked.connect(self.open_processing) # Set up grid layout gridlayout.addWidget(headerframe, 0, 0, 3, 1) gridlayout.addWidget(headerlogo, 0, 0, 2, 1, QtCore.Qt.AlignLeft) gridlayout.addWidget(headerlabel, 0, 0, 2, 1, QtCore.Qt.AlignCenter) gridlayout.addWidget(currprojectframe, 0, 1, 2, 3) gridlayout.addWidget(self.currprojectlabel, 0, 1, 2, 1, QtCore.Qt.AlignRight) gridlayout.addWidget(self.currprojectdisp, 0, 2, 2, 1, QtCore.Qt.AlignLeft) gridlayout.addWidget(button7, 0, 3, 2, 1, QtCore.Qt.AlignLeft) gridlayout.addWidget(sidebarframe, 2, 0, 16, 1) gridlayout.addWidget(selprojectlabel, 3, 0) gridlayout.addWidget(button1, 4, 0) gridlayout.addWidget(button2, 5, 0) gridlayout.addWidget(button3, 6, 0) gridlayout.addWidget(optionlabel, 8, 0, QtCore.Qt.AlignCenter) gridlayout.addWidget(button4, 9, 0) gridlayout.addWidget(button6, 10, 0) gridlayout.addWidget(processorlabel, 12, 0, 1, 1, QtCore.Qt.AlignCenter) gridlayout.addWidget(self.processor, 13, 0, QtCore.Qt.AlignCenter) gridlayout.addWidget(button5, 14, 0) # Dashboard elements # Project information pathframe = QFrame(self) pathframe.setProperty('dashboardframe', True) pathframeshadow = QtWidgets.QGraphicsDropShadowEffect() pathframeshadow.setBlurRadius(6) pathframeshadow.setColor(QtGui.QColor('#e1e6ea')) pathframeshadow.setYOffset(2) pathframeshadow.setXOffset(3) pathframe.setGraphicsEffect(pathframeshadow) projectinfo = QLabel('<b>Project Information</b>') projectinfo.setFont(deffont) projectinfo.setProperty('dashboardtext', True) pathlabel = QLabel('<b>Path:</b>', self) pathlabel.setFont(deffont) pathlabel.setProperty('dashboardtext', True) # self.projectpath = QPushButton(str(hyprosettings['projects'][hyprosettings['activeproject']]['path']), self) self.projectpath = QPushButton('Project path', self) self.projectpath.setFont(deffont) self.projectpath.setProperty('stealth', True) self.projectpath.setMaximumWidth(400) self.projectpath.clicked.connect(self.open_explorer) # self.projecttype = QLabel( # '<b>Project Type:</b> ' + hyprosettings['projects'][hyprosettings['activeproject']]['type'], self) self.projecttype = QLabel('Project Type', self) self.projecttype.setFont(deffont) self.projecttype.setProperty('dashboardtext', True) gridlayout.addWidget(pathframe, 2, 1, 5, 2) gridlayout.addWidget(projectinfo, 2, 1, 2, 2, QtCore.Qt.AlignCenter) gridlayout.addWidget(pathlabel, 3, 1, 2, 2) gridlayout.addWidget(self.projectpath, 4, 1, 2, 2) gridlayout.addWidget(self.projecttype, 5, 1, 2, 2) # Date created and last accessed dateframe = QFrame(self) dateframe.setProperty('dashboardframe', True) dateframeshadow = QtWidgets.QGraphicsDropShadowEffect() dateframeshadow.setBlurRadius(6) dateframeshadow.setColor(QtGui.QColor('#e1e6ea')) dateframeshadow.setYOffset(2) dateframeshadow.setXOffset(3) dateframe.setGraphicsEffect(dateframeshadow) projectcreatedlabel = QLabel('<b>Date Created:</b>', self) projectcreatedlabel.setFont(deffont) projectcreatedlabel.setProperty('dashboardtext', True) self.projectcreated = QLabel('Project created', self) self.projectcreated.setFont(deffont) self.projectcreated.setProperty('dashboardtext', True) projectmodifedlabel = QLabel('<b>Date Last Accessed:</b>', self) projectmodifedlabel.setFont(deffont) projectmodifedlabel.setProperty('dashboardtext', True) self.projectmodified = QLabel('Project modified', self) self.projectmodified.setFont(deffont) self.projectmodified.setProperty('dashboardtext', True) gridlayout.addWidget(dateframe, 2, 3, 5, 1) gridlayout.addWidget(projectcreatedlabel, 2, 3, 2, 1) gridlayout.addWidget(self.projectcreated, 3, 3, 2, 1) gridlayout.addWidget(projectmodifedlabel, 4, 3, 2, 1) gridlayout.addWidget(self.projectmodified, 5, 3, 2, 1) # analysis display analysisframe = QFrame(self) analysisframe.setProperty('dashboardframe', True) analysisframeshadow = QtWidgets.QGraphicsDropShadowEffect() analysisframeshadow.setBlurRadius(6) analysisframeshadow.setColor(QtGui.QColor('#e1e6ea')) analysisframeshadow.setYOffset(2) analysisframeshadow.setXOffset(3) analysisframe.setGraphicsEffect(analysisframeshadow) analyses_activated_label = QLabel('<b>Analysis</b>') analyses_activated_label.setProperty('dashboardtext', True) activated_label = QLabel('<b>Active</b>') activated_label.setProperty('dashboardtext', True) number_files_processed_label = QLabel('<b>Files processed:</b>') number_files_processed_label.setProperty('dashboardtext', True) number_samples_processed_label = QLabel('<b>Samples processed:</b>') number_samples_processed_label.setProperty('dashboardtext', True) nutrients_activated_label = QLabel('Seal Nutrients') nutrients_activated_label.setProperty('dashboardtext', True) self.nutrients_activated_state = QLabel('No') self.nutrients_activated_state.setProperty('dashboardtext', True) self.nutrients_files_processed = QLabel('0') self.nutrients_files_processed.setProperty('dashboardtext', True) self.nutrients_samples_processed = QLabel('0') self.nutrients_samples_processed.setProperty('dashboardtext', True) salinity_activated_label = QLabel('Guildline Salinity') salinity_activated_label.setProperty('dashboardtext', True) self.salinity_activated_state = QLabel('No') self.salinity_activated_state.setProperty('dashboardtext', True) self.salinity_files_processed = QLabel('0') self.salinity_files_processed.setProperty('dashboardtext', True) self.salinity_samples_processed = QLabel('0') self.salinity_samples_processed.setProperty('dashboardtext', True) oxygen_activated_label = QLabel('Scripps Oxygen') oxygen_activated_label.setProperty('dashboardtext', True) self.oxygen_activated_state = QLabel('No') self.oxygen_activated_state.setProperty('dashboardtext', True) self.oxygen_files_processed = QLabel('0') self.oxygen_files_processed.setProperty('dashboardtext', True) self.oxygen_samples_processed = QLabel('0') self.oxygen_samples_processed.setProperty('dashboardtext', True) sub_grid_layout = QGridLayout() gridlayout.addWidget(analysisframe, 7, 1, 10, 3) sub_grid_layout.addWidget(analyses_activated_label, 0, 1) sub_grid_layout.addWidget(activated_label, 0, 2) sub_grid_layout.addWidget(number_files_processed_label, 0, 3) sub_grid_layout.addWidget(number_samples_processed_label, 0, 4) sub_grid_layout.addWidget(nutrients_activated_label, 1, 1) sub_grid_layout.addWidget(self.nutrients_activated_state, 1, 2) sub_grid_layout.addWidget(self.nutrients_files_processed, 1, 3) sub_grid_layout.addWidget(self.nutrients_samples_processed, 1, 4) sub_grid_layout.addWidget(salinity_activated_label, 2, 1) sub_grid_layout.addWidget(self.salinity_activated_state, 2, 2) sub_grid_layout.addWidget(self.salinity_files_processed, 2, 3) sub_grid_layout.addWidget(self.salinity_samples_processed, 2, 4) sub_grid_layout.addWidget(oxygen_activated_label, 3, 1) sub_grid_layout.addWidget(self.oxygen_activated_state, 3, 2) sub_grid_layout.addWidget(self.oxygen_files_processed, 3, 3) sub_grid_layout.addWidget(self.oxygen_samples_processed, 3, 4) gridlayout.addLayout(sub_grid_layout, 7, 1, 10, 3) # Set grid layout to overarching main window central layout self.centralWidget().setLayout(gridlayout) if project: self.populate_dashboards() self.show() # Make Hypro settings database file if not os.path.isdir('C:/HyPro/Settings'): os.makedirs('C:/HyPro/Settings') # Put hypro settings database in the settings subfolder conn = sqlite3.connect('C:/HyPro/Settings/hypro.db') c = conn.cursor() c.execute('''CREATE TABLE IF NOT EXISTS rmnsData (lot TEXT, phosphate FLOAT, phosphateU FLOAT, silicate FLOAT, silicateU FLOAT, nitrate FLOAT, nitrateU FLOAT, nitrite FLOAT, nitriteU FLOAT, ammonia FLOAT, ammoniaU FLOAT, UNIQUE(lot))''') c.execute('''CREATE TABLE IF NOT EXISTS osilData (lot TEXT, salinity FLOAT, UNIQUE(lot))''') c.close()
class MainWindow(QMainWindow): def __init__(self): super().__init__() self.setWindowTitle("Tree Viewer v2") self.setGeometry(0,0,800,600) self.setObjectName("Layer1") self.offsets = [0, 35, 0, 2] self.removeThread = None self.searchThread = None self.addThread = None self.selected = None self.knotsSize = 30 self.fontSize = 10 self.windowError = QMessageBox() self.windowError.setIcon(QMessageBox.Information) self.windowError.setObjectName("Error") self.setUI() def setUI(self): s = QGraphicsDropShadowEffect() s.setColor(QColor("#000000")) s.setBlurRadius(5) s.setOffset(1,1) self.frameTree = QFrame(self) self.frameTree.setGeometry(0, 0, 600, 600) self.defaultTree() self.frameInfo = QFrame(self) self.frameInfo.setGeometry(605, 5, 190, 590) self.frameInfo.setObjectName("Layer2") self.frameInfo.setGraphicsEffect(s) self.labelAddKnot = QLabel("Add Knot:", self.frameInfo) self.labelAddKnot.setGeometry(10, 150, 60, 30) self.labelAddKnot.setAlignment(Qt.AlignCenter) self.labelAddKnot.setObjectName("Layer2NoBG") self.labelAddKnot.setFont(QFont("Arial", 15)) self.entryAddKnot = QLineEdit(self.frameInfo) self.entryAddKnot.setGeometry(120, 150, 60, 30) self.entryAddKnot.setAlignment(Qt.AlignCenter) self.entryAddKnot.setObjectName("Layer2") self.entryAddKnot.setFont(QFont("Arial", 15)) self.entryAddKnot.setValidator(QRegExpValidator(QRegExp("[0-9]+"), self.entryAddKnot)) self.buttonAddKnot = QPushButton(QApplication.style().standardIcon(QStyle.SP_DialogApplyButton), '', self.frameInfo) self.buttonAddKnot.setGeometry(180, 150, 60, 30) self.buttonAddKnot.setObjectName("Layer2") self.buttonAddKnot.clicked.connect(self.addKnot) self.labelVisualizeKnot = QLabel("Search for:", self.frameInfo) self.labelVisualizeKnot.setGeometry(10, 300, 60, 30) self.labelVisualizeKnot.setAlignment(Qt.AlignCenter) self.labelVisualizeKnot.setObjectName("Layer2NoBG") self.labelVisualizeKnot.setFont(QFont("Arial", 15)) self.entryVisualizeKnot = QLineEdit(self.frameInfo) self.entryVisualizeKnot.setGeometry(70, 300, 60, 30) self.entryVisualizeKnot.setAlignment(Qt.AlignCenter) self.entryVisualizeKnot.setObjectName("Layer2") self.entryVisualizeKnot.setFont(QFont("Arial", 15)) self.entryVisualizeKnot.setValidator(QRegExpValidator(QRegExp("[0-9]+"), self.entryVisualizeKnot)) self.buttonVisualizeStartPause = QPushButton(QApplication.style().standardIcon(QStyle.SP_MediaPlay), '', self.frameInfo) self.buttonVisualizeStartPause.setGeometry(130, 300, 60, 30) self.buttonVisualizeStartPause.setObjectName("Layer2") self.buttonVisualizeStartPause.clicked.connect(self.startSearch) self.labelRemoveKnot = QLabel("Remove\nKnot:", self.frameInfo) self.labelRemoveKnot.setGeometry(10, 450, 60, 40) self.labelRemoveKnot.setAlignment(Qt.AlignCenter) self.labelRemoveKnot.setObjectName("Layer2NoBG") self.labelRemoveKnot.setFont(QFont("Arial", 15)) self.entryRemoveKnot = QLineEdit(self.frameInfo) self.entryRemoveKnot.setGeometry(70, 450, 60, 30) self.entryRemoveKnot.setAlignment(Qt.AlignCenter) self.entryRemoveKnot.setObjectName("Layer2") self.entryRemoveKnot.setFont(QFont("Arial", 15)) self.entryRemoveKnot.setValidator(QRegExpValidator(QRegExp("[0-9]+"), self.entryRemoveKnot)) self.buttonRemoveKnot = QPushButton(QApplication.style().standardIcon(QStyle.SP_TrashIcon), '', self.frameInfo) self.buttonRemoveKnot.setGeometry(130, 450, 60, 30) self.buttonRemoveKnot.setObjectName("Layer2") self.buttonRemoveKnot.clicked.connect(self.deleteKnot) self.labelSize = QLabel("Change Knots Size:", self.frameInfo) self.labelSize.setGeometry(10, 540, 180, 30) self.labelSize.setAlignment(Qt.AlignCenter) self.labelSize.setObjectName("Layer2NoBG") self.labelSize.setFont(QFont("Arial", 15)) self.buttonMinusSize = QPushButton("-", self.frameInfo) self.buttonMinusSize.setGeometry(10, 560, 90, 30) self.buttonMinusSize.setObjectName("Layer2") self.buttonMinusSize.setFont(QFont("Arial", 20)) self.buttonMinusSize.clicked.connect(lambda: self.changeSize('-')) self.buttonMinusSize.setAutoRepeat(True) self.buttonPlusSize = QPushButton("+", self.frameInfo) self.buttonPlusSize.setGeometry(170, 560, 90, 30) self.buttonPlusSize.setObjectName("Layer2") self.buttonPlusSize.setFont(QFont("Arial", 20)) self.buttonPlusSize.clicked.connect(lambda: self.changeSize('+')) self.buttonPlusSize.setAutoRepeat(True) def defaultTree(self): self.rootTree = sortedKnot(20, parent=self) self.rootTree.addSorted(5) self.rootTree.addSorted(3) self.rootTree.addSorted(12) self.rootTree.addSorted(8) self.rootTree.addSorted(6) self.rootTree.addSorted(13) self.rootTree.addSorted(25) self.rootTree.addSorted(21) self.rootTree.addSorted(28) self.rootTree.addSorted(29) self.rootTree.addSorted(24) self.rootTree.update() def deleteKnot(self): if self.entryRemoveKnot.text(): if int(self.entryRemoveKnot.text()) != self.rootTree.value: if not self.removeThread: self.buttonRemoveKnot.setIcon(QApplication.style().standardIcon(QStyle.SP_DialogDiscardButton)) self.removeThread = visualRemoveThread(self, int(self.entryRemoveKnot.text())) self.removeThread.finished.connect(self.deleteRemoveThread) self.removeThread.start() else: self.deleteRemoveThread() else: self.showError("You can't remove the root", "Deletion Error") else: self.showError("You have to enter a valid value to remove", "Deletion Error") def startSearch(self): if self.entryVisualizeKnot.text(): if not self.searchThread: self.buttonVisualizeStartPause.setIcon(QApplication.style().standardIcon(QStyle.SP_MediaStop)) self.searchThread = visualSearchThread(self, int(self.entryVisualizeKnot.text())) self.searchThread.finished.connect(self.deleteSearchThread) self.searchThread.start() else: self.deleteSearchThread() else: self.showError("You have to enter a valid value to search for", "Search Error") def addKnot(self): if self.entryAddKnot.text(): if not self.addThread: self.buttonAddKnot.setIcon(QApplication.style().standardIcon(QStyle.SP_DialogCancelButton)) self.addThread = visualAddThread(self, int(self.entryAddKnot.text())) self.addThread.finished.connect(self.deleteAddThread) self.addThread.start() else: self.deleteAddThread() else: self.showError("You have to enter a valid value to insert", "Insertion Error") def deleteRemoveThread(self): if self.removeThread: self.buttonRemoveKnot.setIcon(QApplication.style().standardIcon(QStyle.SP_TrashIcon)) for i in self.removeThread.labels: i.setParent(None) self.showError("The knot you wanted to remove has been succesfully annihilated", "Knot Deleted") if self.removeThread.deleted else self.showError("The knot you tried to remove encountered an error", "Deletion Error") if self.removeThread.isRunning(): self.removeThread.terminate() self.removeThread = None self.selected = None self.rootTree.update() self.update() def deleteAddThread(self): if self.addThread: self.buttonAddKnot.setIcon(QApplication.style().standardIcon(QStyle.SP_DialogApplyButton)) if self.addThread.added: self.addThread.added[0].addLeft(self.addThread.toAdd) if self.addThread.added[1] == 'left' else self.addThread.added[0].addRight(self.addThread.toAdd) self.addThread.added[0].left.label.show() if self.addThread.added[1] == 'left' else self.addThread.added[0].right.label.show() self.showError("Your knot has been added with success", "Added Knot") else: self.showError("The value you tried to insert is already taken", "Value Error") if self.addThread.isRunning(): self.addThread.terminate() self.addThread = None self.selected = None self.rootTree.update() self.update() def deleteSearchThread(self): if self.searchThread: self.buttonVisualizeStartPause.setIcon(QApplication.style().standardIcon(QStyle.SP_MediaPlay)) self.showError("The knot you were searching for has been found", "Knot Found") if self.searchThread.found else self.showError("The knot you were searching for was not found", "Knot Not Found") if self.searchThread.isRunning(): self.searchThread.terminate() self.searchThread = None self.selected = None self.update() def changeSize(self, mode): if mode == '-': if self.fontSize-2 >= 10: self.fontSize -= 2 self.knotsSize -= 4 for i in self.frameTree.children(): i.setGeometry(i.x()+2, i.y()+2, self.knotsSize, self.knotsSize) i.setFont(QFont("Arial", self.fontSize)) self.offsets[0] -= 0 self.offsets[1] -= .18 self.offsets[2] += 0 self.offsets[3] += .18 elif mode == '+': if self.fontSize+2 <= 42: self.fontSize += 2 self.knotsSize += 4 for i in self.frameTree.children(): i.setGeometry(i.x()-2, i.y()-2, i.width()+4, i.height()+4) i.setFont(QFont("Arial", self.fontSize)) self.offsets[0] += 0 self.offsets[1] += .18 self.offsets[2] -= 0 self.offsets[3] -= .18 self.update() def paintEvent(self, event): painter = QPainter() painter.begin(self) painter.setPen(QPen(QColor(3,218,197), 3, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin)) for cos in self.knotCoordinates: painter.drawLine(int(cos[0]+self.offsets[0]), int(cos[1]+self.offsets[1]), int(cos[2]+self.offsets[2]), int(cos[3]+self.offsets[3])) if self.selected: painter.setPen(QPen(QColor("#D8DEE9"), 3, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin)) painter.drawLine(int(self.selected[0]+self.offsets[0]), int(self.selected[1]+self.offsets[1]), int(self.selected[2]+self.offsets[2]), int(self.selected[3]+self.offsets[3])) painter.end() def resizeEvent(self, event): self.frameTree.setGeometry(0, 0, int(6*(self.width()/8)), self.height()) self.frameInfo.setGeometry(int(6*(self.width()/8))+5, 10, int(2*(self.width()/8))-10, self.height()-20) self.labelAddKnot.setGeometry(10, int(self.frameInfo.height()/4)-30, int((self.frameInfo.width()-20)/3), 30) self.entryAddKnot.setGeometry(10 + int((self.frameInfo.width()-20)/3), int(self.frameInfo.height()/4)-30, int((self.frameInfo.width()-20)/3), 30) self.buttonAddKnot.setGeometry(10 + 2*int((self.frameInfo.width()-20)/3), int(self.frameInfo.height()/4)-30, int((self.frameInfo.width()-20)/3), 30) self.labelVisualizeKnot.setGeometry(10, int(self.frameInfo.height()/2), int((self.frameInfo.width()-20)/3), 30) self.entryVisualizeKnot.setGeometry(10 + int((self.frameInfo.width()-20)/3), int(self.frameInfo.height()/2), int((self.frameInfo.width()-20)/3), 30) self.buttonVisualizeStartPause.setGeometry(10 + 2*int((self.frameInfo.width()-20)/3), int(self.frameInfo.height()/2), int((self.frameInfo.width()-20)/3), 30) self.labelRemoveKnot.setGeometry(10, 3*int(self.frameInfo.height()/4)-10, int((self.frameInfo.width()-20)/3), 50) self.entryRemoveKnot.setGeometry(10 + int((self.frameInfo.width()-20)/3), 3*int(self.frameInfo.height()/4), int((self.frameInfo.width()-20)/3), 30) self.buttonRemoveKnot.setGeometry(10 + 2*int((self.frameInfo.width()-20)/3), 3*int(self.frameInfo.height()/4), int((self.frameInfo.width()-20)/3), 30) self.labelSize.setGeometry(10, self.frameInfo.height()-70, self.frameInfo.width()-30, 30) self.buttonPlusSize.setGeometry(int((self.frameInfo.width()-20)/2+10), self.frameInfo.height()-40, int((self.frameInfo.width()-30)/2), 30) self.buttonMinusSize.setGeometry(10, self.frameInfo.height()-40, int((self.frameInfo.width()-30)/2), 30) self.rootTree.update() def showError(self, text, title): self.windowError.setText(text) self.windowError.setWindowTitle(title) self.windowError.show()
class Interface(QMainWindow): def __init__(self, parent=None): QMainWindow.__init__(self) self.setWindowIcon(QIcon("")) self.setWindowTitle("G-Calculator") self.setWindowFlags(Qt.WindowTitleHint | Qt.WindowCloseButtonHint | Qt.WindowMinimizeButtonHint) self.setFixedSize(670, 650) self.setWindowFlags((Qt.FramelessWindowHint)) self.setStyleSheet( "QMainWindow{\n" "background-color: qlineargradient(spread:pad, x1:0.063, y1:0.346591, x2:0.982955, y2:0.477, stop:0 rgba(220,20,60,1), stop:1 rgba(102,0,0,1));\n" "border-radius: 22px;" "}\n" "") self.initUi() def initUi(self): # Stilos #=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=# frame = ("QFrame{\n" "color:#1b231f;\n" "background-color: rgba(255,255,255,0.8);\n" "border-radius: 22px;\n" "}") frame_2 = ("QFrame{\n" "color:#1b231f;\n" "background-color: rgba(255,255,255,1);\n" "border-radius: 10px;\n" "}") frame_pantalla = ("QLineEdit{\n" "color:white;\n" "background-color: rgba(0,0,0,0.8);\n" "border-radius: 10px;\n" "}") label_titulo = ("QLabel{\n" "color:rgb(24, 24, 24);\n" "}") botonCierre = ( "QPushButton{\n" "border:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(0, 0, 0, 0), stop:1 rgba(255, 255, 255, 0));\n" "background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(0, 0, 0, 0), stop:1 rgba(255, 255, 255, 0));\n" "color:rgb(255, 255, 255);\n" "}\n" "QPushButton:hover{\n" "background-color:rgb(255, 0, 0);\n" "color:rgb(255, 255, 255);\n" "}") botonStandar = ( "QPushButton{\n" "border:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(0, 0, 0, 0), stop:1 rgba(255, 255, 255, 0));\n" "background-color: rgba(255,255,255,1);\n" "border-radius: 10px;" "color:rgb(0, 0, 0);\n" "}\n" "QPushButton:hover{\n" "background-color:rgb(10, 0, 0);\n" "color:rgb(255, 255, 255);\n" "}") botonSpecial = ( "QPushButton{\n" "border:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(0, 0, 0, 0), stop:1 rgba(255, 255, 255, 0));\n" "background-color: rgba(207, 0, 89);\n" "border-radius: 10px;" "color:rgb(0, 0, 0);\n" "}\n" "QPushButton:hover{\n" "background-color:rgb(71,13,191);\n" "color:rgb(255, 255, 255);\n" "}") #=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=# self.frame_principal = QFrame(self) self.frame_principal.setGeometry(QRect(30, 120, 610, 500)) self.frame_principal.setStyleSheet(frame) self.frame_principal.move(30, 100) # Label y frame del encabezado self.frame_titulo = QFrame(self) self.frame_titulo.setGeometry(QRect(30, 30, 135, 50)) self.frame_titulo.setStyleSheet(frame_2) self.frame_titulo.move(268, 20) self.sombra_2 = QGraphicsDropShadowEffect() self.sombra_2.setBlurRadius(23) self.frame_titulo.setGraphicsEffect(self.sombra_2) self.Label = QLabel(self) self.Label.setGeometry(QRect(30, 30, 121, 51)) self.Label.setText("G-Calculator") self.Label.setStyleSheet(label_titulo) self.Label.setFont(QtGui.QFont("Lobster", 17, QtGui.QFont.Bold)) self.Label.move(280, 20) self.sombra = QGraphicsDropShadowEffect() self.sombra.setBlurRadius(22) self.Label.setGraphicsEffect(self.sombra) self.botonCerrar = QPushButton(self) self.botonCerrar.setGeometry(QRect(30, 30, 40, 30)) self.botonCerrar.setIcon(QIcon("icons/close.svg")) self.botonCerrar.move(590, 10) self.botonCerrar.setStyleSheet(botonCierre) self.botonMinimizar = QPushButton(self) self.botonMinimizar.setIcon(QIcon("icons/shuffle.svg")) self.botonMinimizar.setGeometry(QRect(30, 30, 30, 30)) self.botonMinimizar.move(560, 10) self.botonMinimizar.setStyleSheet(botonCierre) self.acercaDe = QPushButton(self) self.acercaDe.setIcon(QIcon("icons/menu.svg")) self.acercaDe.setGeometry(QRect(30, 30, 30, 30)) self.acercaDe.move(10, 10) self.acercaDe.setStyleSheet(botonCierre) # botones del contenido numérico#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=# self.frame_pantalla = QtWidgets.QLineEdit(self.frame_principal) self.frame_pantalla.setGeometry(QRect(40, 40, 520, 120)) self.frame_pantalla.setStyleSheet(frame_pantalla) self.frame_pantalla.move(45, 10) self.frame_pantalla.setFont(QtGui.QFont("Roboto", 50, QtGui.QFont.Bold)) self.frame_pantalla.setReadOnly(True) self.frame_pantalla.setCursor(QtGui.QCursor(QtCore.Qt.IBeamCursor)) self.frame_pantalla.setMaxLength(100) self.frame_pantalla.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.sombra_3 = QGraphicsDropShadowEffect() self.sombra_3.setBlurRadius(22) self.frame_pantalla.setGraphicsEffect(self.sombra_3) self.boton_Nro1 = QPushButton(self.frame_principal) self.boton_Nro1.setGeometry(QRect(40, 40, 50, 50)) self.boton_Nro1.setStyleSheet(botonStandar) self.boton_Nro1.setFont(QtGui.QFont("Lobster", 14, QtGui.QFont.Bold)) self.boton_Nro1.setText("1") self.boton_Nro1.move(45, 160) self.sombra_4 = QGraphicsDropShadowEffect() self.sombra_4.setBlurRadius(22) self.boton_Nro1.setGraphicsEffect(self.sombra_4) self.boton_Nro2 = QPushButton(self.frame_principal) self.boton_Nro2.setGeometry(QRect(40, 40, 50, 50)) self.boton_Nro2.setStyleSheet(botonStandar) self.boton_Nro2.setFont(QtGui.QFont("Lobster", 14, QtGui.QFont.Bold)) self.boton_Nro2.setText("2") self.boton_Nro2.move(110, 160) self.sombra_5 = QGraphicsDropShadowEffect() self.sombra_5.setBlurRadius(22) self.boton_Nro2.setGraphicsEffect(self.sombra_5) self.boton_Nro3 = QPushButton(self.frame_principal) self.boton_Nro3.setGeometry(QRect(40, 40, 50, 50)) self.boton_Nro3.setStyleSheet(botonStandar) self.boton_Nro3.setFont(QtGui.QFont("Lobster", 14, QtGui.QFont.Bold)) self.boton_Nro3.setText("3") self.boton_Nro3.move(175, 160) self.sombra_6 = QGraphicsDropShadowEffect() self.sombra_6.setBlurRadius(22) self.boton_Nro3.setGraphicsEffect(self.sombra_6) self.boton_Nro4 = QPushButton(self.frame_principal) self.boton_Nro4.setGeometry(QRect(40, 40, 50, 50)) self.boton_Nro4.setStyleSheet(botonStandar) self.boton_Nro4.setFont(QtGui.QFont("Lobster", 14, QtGui.QFont.Bold)) self.boton_Nro4.setText("4") self.boton_Nro4.move(45, 230) self.sombra_7 = QGraphicsDropShadowEffect() self.sombra_7.setBlurRadius(22) self.boton_Nro4.setGraphicsEffect(self.sombra_7) self.boton_Nro5 = QPushButton(self.frame_principal) self.boton_Nro5.setGeometry(QRect(40, 40, 50, 50)) self.boton_Nro5.setStyleSheet(botonStandar) self.boton_Nro5.setFont(QtGui.QFont("Lobster", 14, QtGui.QFont.Bold)) self.boton_Nro5.setText("5") self.boton_Nro5.move(110, 230) self.sombra_8 = QGraphicsDropShadowEffect() self.sombra_8.setBlurRadius(22) self.boton_Nro5.setGraphicsEffect(self.sombra_8) self.boton_Nro6 = QPushButton(self.frame_principal) self.boton_Nro6.setGeometry(QRect(40, 40, 50, 50)) self.boton_Nro6.setStyleSheet(botonStandar) self.boton_Nro6.setFont(QtGui.QFont("Lobster", 14, QtGui.QFont.Bold)) self.boton_Nro6.setText("6") self.boton_Nro6.move(175, 230) self.sombra_9 = QGraphicsDropShadowEffect() self.sombra_9.setBlurRadius(22) self.boton_Nro6.setGraphicsEffect(self.sombra_9) self.boton_Nro7 = QPushButton(self.frame_principal) self.boton_Nro7.setGeometry(QRect(40, 40, 50, 50)) self.boton_Nro7.setStyleSheet(botonStandar) self.boton_Nro7.setFont(QtGui.QFont("Lobster", 14, QtGui.QFont.Bold)) self.boton_Nro7.setText("7") self.boton_Nro7.move(45, 300) self.sombra_10 = QGraphicsDropShadowEffect() self.sombra_10.setBlurRadius(22) self.boton_Nro7.setGraphicsEffect(self.sombra_10) self.boton_Nro8 = QPushButton(self.frame_principal) self.boton_Nro8.setGeometry(QRect(40, 40, 50, 50)) self.boton_Nro8.setStyleSheet(botonStandar) self.boton_Nro8.setFont(QtGui.QFont("Lobster", 14, QtGui.QFont.Bold)) self.boton_Nro8.setText("8") self.boton_Nro8.move(110, 300) self.sombra_11 = QGraphicsDropShadowEffect() self.sombra_11.setBlurRadius(22) self.boton_Nro8.setGraphicsEffect(self.sombra_11) self.boton_Nro9 = QPushButton(self.frame_principal) self.boton_Nro9.setGeometry(QRect(40, 40, 50, 50)) self.boton_Nro9.setStyleSheet(botonStandar) self.boton_Nro9.setFont(QtGui.QFont("Lobster", 14, QtGui.QFont.Bold)) self.boton_Nro9.setText("9") self.boton_Nro9.move(175, 300) self.sombra_12 = QGraphicsDropShadowEffect() self.sombra_12.setBlurRadius(22) self.boton_Nro9.setGraphicsEffect(self.sombra_12) self.boton_Point = QPushButton(self.frame_principal) self.boton_Point.setGeometry(QRect(40, 40, 50, 50)) self.boton_Point.setStyleSheet(botonStandar) self.boton_Point.setFont(QtGui.QFont("Lobster", 14, QtGui.QFont.Bold)) self.boton_Point.setText(".") self.boton_Point.move(45, 370) self.sombra_13 = QGraphicsDropShadowEffect() self.sombra_13.setBlurRadius(22) self.boton_Point.setGraphicsEffect(self.sombra_13) self.boton_Nro0 = QPushButton(self.frame_principal) self.boton_Nro0.setGeometry(QRect(40, 40, 50, 50)) self.boton_Nro0.setStyleSheet(botonStandar) self.boton_Nro0.setFont(QtGui.QFont("Lobster", 14, QtGui.QFont.Bold)) self.boton_Nro0.setText("0") self.boton_Nro0.move(110, 370) self.sombra_14 = QGraphicsDropShadowEffect() self.sombra_14.setBlurRadius(22) self.boton_Nro0.setGraphicsEffect(self.sombra_14) self.boton_Equal = QPushButton(self.frame_principal) self.boton_Equal.setGeometry(QRect(40, 40, 50, 50)) self.boton_Equal.setStyleSheet(botonSpecial) self.boton_Equal.setFont(QtGui.QFont("Lobster", 14, QtGui.QFont.Bold)) self.boton_Equal.setText("=") self.boton_Equal.move(175, 370) self.sombra_15 = QGraphicsDropShadowEffect() self.sombra_15.setBlurRadius(22) self.boton_Equal.setGraphicsEffect(self.sombra_15) self.boton_Clear = QPushButton(self.frame_principal) self.boton_Clear.setGeometry(QRect(40, 40, 50, 50)) self.boton_Clear.setStyleSheet(botonSpecial) self.boton_Clear.setFont(QtGui.QFont("Lobster", 14, QtGui.QFont.Bold)) self.boton_Clear.setText("DEL") self.boton_Clear.move(250, 160) self.sombra_16 = QGraphicsDropShadowEffect() self.sombra_16.setBlurRadius(22) self.boton_Clear.setGraphicsEffect(self.sombra_16) self.boton_Clear2 = QPushButton(self.frame_principal) self.boton_Clear2.setGeometry(QRect(40, 40, 50, 50)) self.boton_Clear2.setStyleSheet(botonSpecial) self.boton_Clear2.setFont(QtGui.QFont("Lobster", 14, QtGui.QFont.Bold)) self.boton_Clear2.setText("Clear") self.boton_Clear2.move(315, 160) self.sombra_17 = QGraphicsDropShadowEffect() self.sombra_17.setBlurRadius(22) self.boton_Clear2.setGraphicsEffect(self.sombra_17) self.boton_suma = QPushButton(self.frame_principal) self.boton_suma.setGeometry(QRect(40, 40, 50, 50)) self.boton_suma.setStyleSheet(botonStandar) self.boton_suma.setFont(QtGui.QFont("Lobster", 14, QtGui.QFont.Bold)) self.boton_suma.setText("+") self.boton_suma.move(250, 230) self.sombra_19 = QGraphicsDropShadowEffect() self.sombra_19.setBlurRadius(22) self.boton_suma.setGraphicsEffect(self.sombra_19) self.boton_Resta = QPushButton(self.frame_principal) self.boton_Resta.setGeometry(QRect(40, 40, 50, 50)) self.boton_Resta.setStyleSheet(botonStandar) self.boton_Resta.setFont(QtGui.QFont("Lobster", 14, QtGui.QFont.Bold)) self.boton_Resta.setText("-") self.boton_Resta.move(315, 230) self.sombra_20 = QGraphicsDropShadowEffect() self.sombra_20.setBlurRadius(22) self.boton_Resta.setGraphicsEffect(self.sombra_20) self.boton_Divide = QPushButton(self.frame_principal) self.boton_Divide.setGeometry(QRect(40, 40, 50, 50)) self.boton_Divide.setStyleSheet(botonStandar) self.boton_Divide.setFont(QtGui.QFont("Lobster", 14, QtGui.QFont.Bold)) self.boton_Divide.setText("/") self.boton_Divide.move(250, 300) self.sombra_21 = QGraphicsDropShadowEffect() self.sombra_21.setBlurRadius(22) self.boton_Divide.setGraphicsEffect(self.sombra_21) self.boton_X = QPushButton(self.frame_principal) self.boton_X.setGeometry(QRect(40, 40, 50, 50)) self.boton_X.setStyleSheet(botonStandar) self.boton_X.setFont(QtGui.QFont("Lobster", 14, QtGui.QFont.Bold)) self.boton_X.setText("X") self.boton_X.move(315, 300) self.sombra_18 = QGraphicsDropShadowEffect() self.sombra_18.setBlurRadius(22) self.boton_X.setGraphicsEffect(self.sombra_18) self.boton_parent = QPushButton(self.frame_principal) self.boton_parent.setGeometry(QRect(40, 40, 50, 50)) self.boton_parent.setStyleSheet(botonStandar) self.boton_parent.setFont(QtGui.QFont("Lobster", 14, QtGui.QFont.Bold)) self.boton_parent.setText("(") self.boton_parent.move(250, 370) self.sombra_19 = QGraphicsDropShadowEffect() self.sombra_19.setBlurRadius(22) self.boton_parent.setGraphicsEffect(self.sombra_19) self.boton_parent2 = QPushButton(self.frame_principal) self.boton_parent2.setGeometry(QRect(40, 40, 50, 50)) self.boton_parent2.setStyleSheet(botonStandar) self.boton_parent2.setFont(QtGui.QFont("Lobster", 14, QtGui.QFont.Bold)) self.boton_parent2.setText(")") self.boton_parent2.move(315, 370) self.sombra_20 = QGraphicsDropShadowEffect() self.sombra_20.setBlurRadius(22) self.boton_parent2.setGraphicsEffect(self.sombra_20) self.seno = QPushButton(self.frame_principal) self.seno.setGeometry(QRect(40, 40, 50, 50)) self.seno.setStyleSheet(botonStandar) self.seno.setFont(QtGui.QFont("Lobster", 14, QtGui.QFont.Bold)) self.seno.setText("Sen") self.seno.move(390, 160) self.sombra_21 = QGraphicsDropShadowEffect() self.sombra_21.setBlurRadius(22) self.seno.setGraphicsEffect(self.sombra_21) self.coseno = QPushButton(self.frame_principal) self.coseno.setGeometry(QRect(40, 40, 50, 50)) self.coseno.setStyleSheet(botonStandar) self.coseno.setFont(QtGui.QFont("Lobster", 14, QtGui.QFont.Bold)) self.coseno.setText("Cos") self.coseno.move(450, 160) self.sombra_22 = QGraphicsDropShadowEffect() self.sombra_22.setBlurRadius(22) self.coseno.setGraphicsEffect(self.sombra_22) self.tangente = QPushButton(self.frame_principal) self.tangente.setGeometry(QRect(40, 40, 50, 50)) self.tangente.setStyleSheet(botonStandar) self.tangente.setFont(QtGui.QFont("Lobster", 14, QtGui.QFont.Bold)) self.tangente.setText("Tan") self.tangente.move(510, 160) self.sombra_23 = QGraphicsDropShadowEffect() self.sombra_23.setBlurRadius(22) self.tangente.setGraphicsEffect(self.sombra_23) self.arcsen = QPushButton(self.frame_principal) self.arcsen.setGeometry(QRect(40, 40, 50, 50)) self.arcsen.setStyleSheet(botonStandar) self.arcsen.setFont(QtGui.QFont("Lobster", 12, QtGui.QFont.Bold)) self.arcsen.setText("ArcSen") self.arcsen.move(390, 220) self.sombra_24 = QGraphicsDropShadowEffect() self.sombra_24.setBlurRadius(22) self.arcsen.setGraphicsEffect(self.sombra_24) self.arccos = QPushButton(self.frame_principal) self.arccos.setGeometry(QRect(40, 40, 50, 50)) self.arccos.setStyleSheet(botonStandar) self.arccos.setFont(QtGui.QFont("Lobster", 12, QtGui.QFont.Bold)) self.arccos.setText("ArcCos") self.arccos.move(450, 220) self.sombra_25 = QGraphicsDropShadowEffect() self.sombra_25.setBlurRadius(22) self.arccos.setGraphicsEffect(self.sombra_25) self.arctang = QPushButton(self.frame_principal) self.arctang.setGeometry(QRect(40, 40, 50, 50)) self.arctang.setStyleSheet(botonStandar) self.arctang.setFont(QtGui.QFont("Lobster", 12, QtGui.QFont.Bold)) self.arctang.setText("ArcTan") self.arctang.move(510, 220) self.sombra_26 = QGraphicsDropShadowEffect() self.sombra_26.setBlurRadius(22) self.arctang.setGraphicsEffect(self.sombra_26) self.raiz = QPushButton(self.frame_principal) self.raiz.setGeometry(QRect(40, 40, 50, 50)) self.raiz.setStyleSheet(botonStandar) self.raiz.setText("ELpepe") self.raiz.move(390, 280) self.sombra_27 = QGraphicsDropShadowEffect() self.sombra_27.setBlurRadius(22) self.raiz.setGraphicsEffect(self.sombra_27) #=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=# #=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=# # Eventos self.botonCerrar.clicked.connect(self.closeButton) self.botonMinimizar.clicked.connect(self.minimize) #Pad de Botones self.boton_Nro1.clicked.connect( lambda: self.frame_pantalla.insert('1')) self.boton_Nro2.clicked.connect( lambda: self.frame_pantalla.insert('2')) self.boton_Nro3.clicked.connect( lambda: self.frame_pantalla.insert('3')) self.boton_Nro4.clicked.connect( lambda: self.frame_pantalla.insert('4')) self.boton_Nro5.clicked.connect( lambda: self.frame_pantalla.insert('5')) self.boton_Nro6.clicked.connect( lambda: self.frame_pantalla.insert('6')) self.boton_Nro7.clicked.connect( lambda: self.frame_pantalla.insert('7')) self.boton_Nro8.clicked.connect( lambda: self.frame_pantalla.insert('8')) self.boton_Nro9.clicked.connect( lambda: self.frame_pantalla.insert('9')) self.boton_Nro0.clicked.connect( lambda: self.frame_pantalla.insert('0')) self.boton_Point.clicked.connect( lambda: self.frame_pantalla.insert('.')) self.boton_Equal.clicked.connect(lambda: self.evaluacion()) self.boton_Clear.clicked.connect( lambda: self.frame_pantalla.backspace()) self.boton_Clear2.clicked.connect(lambda: self.frame_pantalla.clear()) self.boton_suma.clicked.connect( lambda: self.frame_pantalla.insert('+')) self.boton_Resta.clicked.connect( lambda: self.frame_pantalla.insert('-')) self.boton_Divide.clicked.connect( lambda: self.frame_pantalla.insert('/')) self.boton_X.clicked.connect(lambda: self.frame_pantalla.insert('*')) self.boton_parent.clicked.connect( lambda: self.frame_pantalla.insert('(')) self.boton_parent2.clicked.connect( lambda: self.frame_pantalla.insert(')')) self.seno.clicked.connect(lambda: self.frame_pantalla.insert('sin(')) self.coseno.clicked.connect(lambda: self.frame_pantalla.insert('cos(')) self.tangente.clicked.connect( lambda: self.frame_pantalla.insert('tan(')) self.arcsen.clicked.connect( lambda: self.frame_pantalla.insert('asin(')) self.arccos.clicked.connect( lambda: self.frame_pantalla.insert('acos(')) self.arctang.clicked.connect( lambda: self.frame_pantalla.insert('atan(')) self.raiz.clicked.connect(lambda: self.frame_pantalla.insert('ELpepe')) # Lógica#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=# def evaluacion(self): try: pantalla = self.frame_pantalla.text() self.resultado = eval(pantalla) self.frame_pantalla.setText(str(self.resultado)) except: self.frame_pantalla.setText('SINTAXIS ERROR') def closeButton(self): exit = QMessageBox(self) exit.setWindowTitle("¿Salir de VESOR?") exit.setIcon(QMessageBox.Question) exit.setText("¿Estás seguro que desea cerrar esta ventana?") buttonExit = exit.addButton("Salir", QMessageBox.YesRole) botonCancelar = exit.addButton("Cancelar", QMessageBox.NoRole) exit.exec_() if exit.clickedButton() == buttonExit: self.destroy() else: pass def minimize(self, event): self.setWindowState(Qt.WindowMinimized) def mousePressEvent(self, event): if event.button() == Qt.LeftButton: self.dragPosition = event.globalPos() - self.frameGeometry( ).topLeft() event.accept() def mouseMoveEvent(self, event): if event.buttons() == Qt.LeftButton: self.move(event.globalPos() - self.dragPosition) event.accept()
class main(QMainWindow): def __init__(self, parent=None): QMainWindow.__init__(self) self.setWindowTitle("Main Ui") self.setFixedSize(800, 600) self.setStyleSheet(estiloFondo) self.initUi() def initUi(self): globalFont = (QtGui.QFont("Roboto", 16, QtGui.QFont.Bold)) titulofont = (QtGui.QFont("Roboto", 20, QtGui.QFont.Bold)) font_line = (QtGui.QFont("Roboto", 12, QtGui.QFont.Bold)) fontCondiciones = (QtGui.QFont("Roboto", 11, QtGui.QFont.Bold)) self.frameizquierda = QFrame(self) self.frameizquierda.setStyleSheet(estiloFrame) self.frameizquierda.setGeometry(QRect(0, 0, 400, 600)) self.sombra = QGraphicsDropShadowEffect() self.sombra.setBlurRadius(100) self.frameizquierda.setGraphicsEffect(self.sombra) self.encabezado = QLabel(self) self.encabezado.setStyleSheet(estiloTitulo) self.encabezado.setGeometry(QRect(460, 50, 200, 100)) self.encabezado.setText("REGISTRO") self.encabezado.setFont(titulofont) self.encabezado.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.boton1 = QPushButton(self) self.boton1.setStyleSheet(estiloR) self.boton1.setGeometry(QRect(650, 10, 70, 30)) self.boton1.setFont(fontCondiciones) self.boton1.setText("registro") self.sombra3 = QGraphicsDropShadowEffect() self.sombra3.setBlurRadius(100) self.boton1.setGraphicsEffect(self.sombra3) self.boton2 = QPushButton(self) self.boton2.setStyleSheet(estiloD) self.boton2.setGeometry(QRect(720, 10, 70, 30)) self.boton2.setFont(fontCondiciones) self.boton2.setText("inicio") self.sombra4 = QGraphicsDropShadowEffect() self.sombra4.setBlurRadius(100) self.boton2.setGraphicsEffect(self.sombra4) self.nombre = QLabel(self) self.nombre.setStyleSheet(estiloNombre) self.nombre.setGeometry(QRect(450, 100, 100, 100)) self.nombre.setText("NOMBRE") self.nombre.setFont(globalFont) self.nombre.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.nombre_edit = QLineEdit(self) self.nombre_edit.setStyleSheet(estiloLine) self.nombre_edit.setFont(font_line) self.nombre_edit.setGeometry(QRect(460, 165, 100, 30)) self.nombre_edit.setPlaceholderText("Nombre") self.apellido = QLabel(self) self.apellido.setStyleSheet(estiloNombre) self.apellido.setGeometry(QRect(625, 100, 100, 100)) self.apellido.setText("APELLIDO") self.apellido.setFont(globalFont) self.apellido.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.apellido_edit = QLineEdit(self) self.apellido_edit.setStyleSheet(estiloLine) self.apellido_edit.setFont(font_line) self.apellido_edit.setGeometry(QRect(630, 165, 100, 30)) self.apellido_edit.setPlaceholderText("Apellido") self.contrasena = QLabel(self) self.contrasena.setStyleSheet(estiloNombre) self.contrasena.setFont(globalFont) self.contrasena.setGeometry(QRect(450, 200, 150, 100)) self.contrasena.setText("CONTRASEÑA") self.contrasena.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.contrasena_edit = QLineEdit(self) self.contrasena_edit.setStyleSheet(estiloLine) self.contrasena_edit.setFont(font_line) self.contrasena_edit.setGeometry(QRect(460, 265, 300, 30)) self.contrasena_edit.setPlaceholderText("Contraseña") self.email = QLabel(self) self.email.setStyleSheet(estiloNombre) self.email.setFont(globalFont) self.email.setGeometry(QRect(465, 300, 100, 100)) self.email.setText("Email") self.email_edit = QLineEdit(self) self.email_edit.setStyleSheet(estiloLine) self.email_edit.setFont(font_line) self.email_edit.setGeometry(QRect(465, 365, 300, 30)) self.email_edit.setPlaceholderText("*****@*****.**") self.chequer = QCheckBox(self) self.chequer.setGeometry(QRect(465, 400, 20, 30)) self.chequer.setStyleSheet(estiloCheck) self.condiciones = QLabel(self) self.condiciones.setStyleSheet(estilo_condiciones) self.condiciones.setFont(fontCondiciones) self.condiciones.setText("Aceptar términos y condiciones") self.condiciones.setGeometry(QRect(490, 365, 250, 100)) self.btn_registro = QPushButton(self) self.btn_registro.setStyleSheet(estiloBoton) self.btn_registro.setGeometry(QRect(460, 450, 300, 50)) self.btn_registro.setFont(globalFont) self.btn_registro.setText("Registrarse") self.sombra2 = QGraphicsDropShadowEffect() self.sombra2.setBlurRadius(100) self.btn_registro.setGraphicsEffect(self.sombra2) self.copyrigth = QLabel(self) self.copyrigth.setStyleSheet(estilo_condiciones) self.copyrigth.setFont(fontCondiciones) self.copyrigth.setText("by Cristian Cala ❤️") self.copyrigth.setGeometry(QRect(660, 530, 150, 100))