SHARE
TWEET

Untitled

a guest Jun 18th, 2019 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import os
  2.     import sys
  3.     from PyQt5.QtCore import QSize
  4.     from PyQt5.QtWidgets import QApplication, QMainWindow, QTableWidget, QFileDialog, QWidget, QTextEdit
  5.     from PyQt5.QtWidgets import QPushButton, QVBoxLayout, QHBoxLayout, QAction, qApp, QInputDialog
  6.     from PyQt5 import QtCore, QtGui, QtWidgets
  7.     from AddPatient import Ui_Addpatient
  8.     from ProgramTurno import Ui_Programarturno
  9.     from part4 import MyEditor
  10.     from part4 import main
  11.     import part4
  12.  
  13.     import pymysql
  14.     import pymysql.cursors
  15.  
  16.     class Login(QtWidgets.QDialog):
  17.     def __init__(self, parent=None):
  18.         super(Login, self).__init__(parent)
  19.         self.textName = QtWidgets.QLineEdit(self)
  20.         self.textPass = QtWidgets.QLineEdit(self)
  21.         self.textName.setGeometry(QtCore.QRect(140, 10, 113, 20))
  22.         self.textPass.setGeometry(QtCore.QRect(140, 40, 113, 20))
  23.         self.textPass.setEchoMode(QtWidgets.QLineEdit.Password)
  24.         self.resize(298, 160)
  25.         self.setWindowTitle('Login')
  26.  
  27.         self.Usuario = QtWidgets.QLabel('Usuario:', self)
  28.         self.Usuario.setGeometry(QtCore.QRect(10, 10, 711, 21))
  29.         font = QtGui.QFont()
  30.         font.setPointSize(14)
  31.         self.Usuario.setFont(font)
  32.         self.Contrasena = QtWidgets.QLabel('Contrase帽a:',self)
  33.         self.Contrasena.setGeometry(QtCore.QRect(10, 70, 711, 21))
  34.         font = QtGui.QFont()
  35.         font.setPointSize(14)
  36.         self.Contrasena.setFont(font)
  37.  
  38.         self.buttonLogin = QtWidgets.QPushButton('Aceptar', self)
  39.         self.buttonLogin.setGeometry(QtCore.QRect(10, 130, 120, 21))
  40.         self.Logincancel = QtWidgets.QPushButton('Cancelar', self)
  41.         self.Logincancel.setGeometry(QtCore.QRect(168, 130, 120, 21))
  42.         self.Logincancel.clicked.connect(sys.exit)
  43.         self.buttonLogin.clicked.connect(self.handleLogin)
  44.  
  45.  
  46.         layout = QtWidgets.QVBoxLayout(self)
  47.         layout.addWidget(self.textName)
  48.         layout.addWidget(self.textPass)
  49.  
  50.     def handleLogin(self):
  51.         if (self.textName.text() == '' and
  52.             self.textPass.text() == ''):
  53.             self.accept()
  54.         else:
  55.             QtWidgets.QMessageBox.warning(
  56.                 self, 'Error', 'Usuario y/o contrase帽a incorrectas.')
  57.  
  58.     def retranslateUi(self, login):
  59.         _translate = QtCore.QCoreApplication.translate
  60.         login.setWindowTitle(_translate("login", "Login"))
  61.         self.Usuario.setText(_translate("login", "Usuario:"))
  62.         self.Contrasena.setText(_translate("login", "Contrase帽a:"))
  63.  
  64.  
  65.     class Ui_MainWindow(object):
  66.  
  67.     def DBConnect(self):
  68.         connection = pymysql.connect(host='localhost',
  69.                                      user='root',
  70.                                      password='xmlLans89',
  71.                                      db='patient',
  72.                                      charset='utf8mb4',
  73.                                      cursorclass=pymysql.cursors.DictCursor)
  74.  
  75.     def PacienteAdd(self):
  76.         self.window = QtWidgets.QMainWindow()
  77.         self.ui = Ui_Addpatient()
  78.         self.ui.setupUi(self.window)
  79.         self.window.show()
  80.  
  81.     def Editor(self):
  82.         self.window = QtWidgets.QMainWindow()
  83.         self.ui = main()
  84.         self.ui.setupUi(self.window)
  85.         self.window.show()
  86.  
  87.  
  88.  
  89.     def Programarturno(self):
  90.         self.window = QtWidgets.QMainWindow()
  91.         self.ui = Ui_Programarturno()
  92.         self.ui.setupUi(self.window)
  93.         self.window.show()
  94.  
  95.     def setupUi(self, MainWindow):
  96.         MainWindow.setObjectName("MainWindow")
  97.         MainWindow.resize(544, 385)
  98.         icon = QtGui.QIcon()
  99.         icon.addPixmap(QtGui.QPixmap("../../dermatology.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
  100.         MainWindow.setWindowIcon(icon)
  101.         self.centralwidget = QtWidgets.QWidget(MainWindow)
  102.         self.centralwidget.setObjectName("centralwidget")
  103.         self.tableWidget = QtWidgets.QTableWidget(self.centralwidget)
  104.         self.tableWidget.setGeometry(QtCore.QRect(0, 0, 301, 311))
  105.         self.tableWidget.setObjectName("tableWidget")
  106.         self.tableWidget.setColumnCount(2)
  107.         self.tableWidget.setRowCount(13)
  108.         item = QtWidgets.QTableWidgetItem()
  109.         self.tableWidget.setVerticalHeaderItem(0, item)
  110.         item = QtWidgets.QTableWidgetItem()
  111.         self.tableWidget.setVerticalHeaderItem(1, item)
  112.         item = QtWidgets.QTableWidgetItem()
  113.         self.tableWidget.setVerticalHeaderItem(2, item)
  114.         item = QtWidgets.QTableWidgetItem()
  115.         self.tableWidget.setVerticalHeaderItem(3, item)
  116.         item = QtWidgets.QTableWidgetItem()
  117.         self.tableWidget.setVerticalHeaderItem(4, item)
  118.         item = QtWidgets.QTableWidgetItem()
  119.         self.tableWidget.setVerticalHeaderItem(5, item)
  120.         item = QtWidgets.QTableWidgetItem()
  121.         self.tableWidget.setVerticalHeaderItem(6, item)
  122.         item = QtWidgets.QTableWidgetItem()
  123.         self.tableWidget.setVerticalHeaderItem(7, item)
  124.         item = QtWidgets.QTableWidgetItem()
  125.         self.tableWidget.setVerticalHeaderItem(8, item)
  126.         item = QtWidgets.QTableWidgetItem()
  127.         self.tableWidget.setVerticalHeaderItem(9, item)
  128.         item = QtWidgets.QTableWidgetItem()
  129.         self.tableWidget.setVerticalHeaderItem(10, item)
  130.         item = QtWidgets.QTableWidgetItem()
  131.         self.tableWidget.setVerticalHeaderItem(11, item)
  132.         item = QtWidgets.QTableWidgetItem()
  133.         self.tableWidget.setVerticalHeaderItem(12, item)
  134.         item = QtWidgets.QTableWidgetItem()
  135.         self.tableWidget.setHorizontalHeaderItem(0, item)
  136.         item = QtWidgets.QTableWidgetItem()
  137.         self.tableWidget.setHorizontalHeaderItem(1, item)
  138.         item = QtWidgets.QTableWidgetItem()
  139.         self.tableWidget.setItem(0, 0, item)
  140.         item = QtWidgets.QTableWidgetItem()
  141.         self.tableWidget.setItem(0, 1, item)
  142.  
  143.  
  144.         self.text = QtWidgets.QPlainTextEdit(self.centralwidget)
  145.         self.text.setGeometry(QtCore.QRect(310, 0, 231, 301))
  146.         self.text.setObjectName("text")
  147.  
  148.  
  149.         self.opn_btn = QtWidgets.QPushButton(self.centralwidget)
  150.         self.opn_btn.setGeometry(QtCore.QRect(360, 310, 51, 21))
  151.         self.opn_btn.setObjectName("open")
  152.         self.opn_btn.setStyleSheet("background-color: cyan")
  153.  
  154.         self.sav_btn = QtWidgets.QPushButton(self.centralwidget)
  155.         self.sav_btn.setGeometry(QtCore.QRect(440, 310, 51, 21))
  156.         self.sav_btn.setObjectName("openeditor")
  157.         self.sav_btn.clicked.connect(self.Editor)
  158.         if self.sav_btn.clicked.connect(self.Editor) == True and __name__ == "__main__":
  159.             main()
  160.  
  161.         self.pushButton = QtWidgets.QPushButton(self.centralwidget)
  162.         self.pushButton.setGeometry(QtCore.QRect(0, 320, 91, 23))
  163.         self.pushButton.setObjectName("pushButton")
  164.         self.Anadirpatientmain = QtWidgets.QPushButton(self.centralwidget)
  165.         self.Anadirpatientmain.setGeometry(QtCore.QRect(100, 320, 91, 23))
  166.         self.Anadirpatientmain.setObjectName("Anadirpatientmain")
  167.         self.Anadirpatientmain.clicked.connect(self.PacienteAdd)
  168.         self.Anadirpatientmain.clicked.connect(self.DBConnect)
  169.         self.pushButton_3 = QtWidgets.QPushButton(self.centralwidget)
  170.         self.pushButton_3.setGeometry(QtCore.QRect(200, 320, 101, 23))
  171.         self.pushButton_3.setObjectName("pushButton_3")
  172.         self.tableWidget.raise_()
  173.         self.text.raise_()
  174.         self.pushButton.raise_()
  175.         self.Anadirpatientmain.raise_()
  176.         self.pushButton_3.raise_()
  177.         self.opn_btn.raise_()
  178.         self.sav_btn.raise_()
  179.         MainWindow.setCentralWidget(self.centralwidget)
  180.         self.statusbar = QtWidgets.QStatusBar(MainWindow)
  181.         self.statusbar.setObjectName("statusbar")
  182.         MainWindow.setStatusBar(self.statusbar)
  183.         self.menubar = QtWidgets.QMenuBar(MainWindow)
  184.         self.menubar.setGeometry(QtCore.QRect(0, 0, 544, 21))
  185.         self.menubar.setObjectName("menubar")
  186.         self.menuArchivo = QtWidgets.QMenu(self.menubar)
  187.         self.menuArchivo.setObjectName("menuArchivo")
  188.         MainWindow.setMenuBar(self.menubar)
  189.         self.actionA_adir_Paciente = QtWidgets.QAction(MainWindow)
  190.         self.actionA_adir_Paciente.setObjectName("actionA_adir_Paciente")
  191.         self.actionBuscar = QtWidgets.QAction(MainWindow)
  192.         self.actionBuscar.setObjectName("actionBuscar")
  193.         self.actionConfiguraci_n = QtWidgets.QAction(MainWindow)
  194.         self.actionConfiguraci_n.setObjectName("actionConfiguraci_n")
  195.         self.actionProgramar_Turno = QtWidgets.QAction(MainWindow)
  196.         self.actionProgramar_Turno.setObjectName("actionProgramar_Turno")
  197.  
  198.         self.actionProgramar_Turno_2 = QtWidgets.QAction(MainWindow)
  199.         self.actionProgramar_Turno_2.setObjectName("actionProgramar_Turno_2")
  200.         self.actionProgramar_Turno_2.triggered.connect(self.Programarturno)
  201.  
  202.         self.actionConfiguraci_n_2 = QtWidgets.QAction(MainWindow)
  203.         self.actionConfiguraci_n_2.setObjectName("actionConfiguraci_n_2")
  204.         self.actionSalir = QtWidgets.QAction(MainWindow)
  205.         self.actionSalir.setObjectName("actionSalir")
  206.         self.menuArchivo.addAction(self.actionProgramar_Turno_2)
  207.         self.menuArchivo.addAction(self.actionConfiguraci_n_2)
  208.         self.menuArchivo.addAction(self.actionSalir)
  209.         self.menubar.addAction(self.menuArchivo.menuAction())
  210.  
  211.         self.retranslateUi(MainWindow)
  212.         QtCore.QMetaObject.connectSlotsByName(MainWindow)
  213.  
  214.     def retranslateUi(self, MainWindow):
  215.         _translate = QtCore.QCoreApplication.translate
  216.         MainWindow.setWindowTitle(_translate("MainWindow", "Patient Manager"))
  217.         item = self.tableWidget.verticalHeaderItem(0)
  218.         item.setText(_translate("MainWindow", "Emiliano Tomsnfs"))
  219.         item = self.tableWidget.verticalHeaderItem(1)
  220.         item.setText(_translate("MainWindow", "Juliana Aaaaaaaaaa"))
  221.         item = self.tableWidget.verticalHeaderItem(2)
  222.         item.setText(_translate("MainWindow", "Armando Test"))
  223.         item = self.tableWidget.verticalHeaderItem(3)
  224.         item.setText(_translate("MainWindow", "Oscar Test"))
  225.         item = self.tableWidget.verticalHeaderItem(4)
  226.         item.setText(_translate("MainWindow", "Esteban Test"))
  227.         item = self.tableWidget.verticalHeaderItem(5)
  228.         item.setText(_translate("MainWindow", "Roberto Test"))
  229.         item = self.tableWidget.verticalHeaderItem(6)
  230.         item.setText(_translate("MainWindow", "Nicolas Test"))
  231.         item = self.tableWidget.verticalHeaderItem(7)
  232.         item.setText(_translate("MainWindow", "Susana Test"))
  233.         item = self.tableWidget.verticalHeaderItem(8)
  234.         item.setText(_translate("MainWindow", "Silvia Test"))
  235.         item = self.tableWidget.verticalHeaderItem(9)
  236.         item.setText(_translate("MainWindow", "Rodrigo Test"))
  237.         item = self.tableWidget.verticalHeaderItem(10)
  238.         item.setText(_translate("MainWindow", "Mauro Test"))
  239.         item = self.tableWidget.verticalHeaderItem(11)
  240.         item.setText(_translate("MainWindow", "Bruno Test"))
  241.         item = self.tableWidget.verticalHeaderItem(12)
  242.         item.setText(_translate("MainWindow", "Gabriel Test"))
  243.         item = self.tableWidget.horizontalHeaderItem(0)
  244.         item.setText(_translate("MainWindow", "脷ltima Edici贸n"))
  245.         item = self.tableWidget.horizontalHeaderItem(1)
  246.         item.setText(_translate("MainWindow", "Pr贸ximo Turno"))
  247.         __sortingEnabled = self.tableWidget.isSortingEnabled()
  248.         self.tableWidget.setSortingEnabled(False)
  249.         item = self.tableWidget.item(0, 0)
  250.         item.setText(_translate("MainWindow", " 25/04/18"))
  251.         item = self.tableWidget.item(0, 1)
  252.         item.setText(_translate("MainWindow", " 29/03/19"))
  253.         self.tableWidget.setSortingEnabled(__sortingEnabled)
  254.         self.text.setPlainText(_translate("MainWindow", "Condici贸n M茅dican"
  255.     "n"))
  256.         self.opn_btn.setText(_translate("MainWindow", "Abrir"))
  257.         self.sav_btn.setText(_translate("MainWindow", "Abrir Editor"))
  258.         self.pushButton.setText(_translate("MainWindow", "Buscar Paciente"))
  259.         self.Anadirpatientmain.setText(_translate("MainWindow", "A帽adir Paciente"))
  260.         self.pushButton_3.setText(_translate("MainWindow", "Eliminar Paciente"))
  261.         self.menuArchivo.setTitle(_translate("MainWindow", "Archivo"))
  262.         self.actionA_adir_Paciente.setText(_translate("MainWindow", "A帽adir Paciente"))
  263.         self.actionBuscar.setText(_translate("MainWindow", "Buscar"))
  264.         self.actionConfiguraci_n.setText(_translate("MainWindow", "Configuraci贸n"))
  265.         self.actionProgramar_Turno.setText(_translate("MainWindow", "Programar Turno"))
  266.         self.actionProgramar_Turno_2.setText(_translate("MainWindow", "Programar Turno"))
  267.         self.actionConfiguraci_n_2.setText(_translate("MainWindow", "Configuraci贸n"))
  268.         self.actionSalir.setText(_translate("MainWindow", "Salir"))
  269.  
  270.  
  271.     if __name__ == "__main__":
  272.     import sys
  273.     app = QtWidgets.QApplication(sys.argv)
  274.     MainWindow = QtWidgets.QMainWindow()
  275.     login = Login()
  276.     if login.exec_() == QtWidgets.QDialog.Accepted:
  277.         ui = Ui_MainWindow()
  278.         ui.setupUi(MainWindow)
  279.         MainWindow.show()
  280.         sys.exit(app.exec_())
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top