SHARE
TWEET

Untitled

a guest Jun 20th, 2019 53 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 part4 import main
  8.  
  9.  
  10. class Ui_MainWindow(object):
  11.  
  12.     def Editor(self):
  13.         self.window = QtWidgets.QMainWindow()
  14.         self.ui = main()
  15.         self.ui.setupUi(self.window)
  16.         self.window.show()
  17.  
  18.     def setupUi(self, MainWindow):
  19.         MainWindow.setObjectName("MainWindow")
  20.         MainWindow.resize(544, 385)
  21.         self.centralwidget = QtWidgets.QWidget(MainWindow)
  22.         self.centralwidget.setObjectName("centralwidget")
  23.  
  24.         # This button should open the Text Editor
  25.         self.sav_btn = QtWidgets.QPushButton(self.centralwidget)
  26.         self.sav_btn.setGeometry(QtCore.QRect(440, 310, 51, 21))
  27.         self.sav_btn.setObjectName("openeditor")
  28.         self.sav_btn.clicked.connect(self.Editor)
  29.         if self.sav_btn.clicked.connect(self.Editor) == True and __name__ == "__main__":
  30.             main()
  31.  
  32.  
  33.         self.sav_btn.raise_()
  34.         MainWindow.setCentralWidget(self.centralwidget)
  35.         self.statusbar = QtWidgets.QStatusBar(MainWindow)
  36.         self.statusbar.setObjectName("statusbar")
  37.         MainWindow.setStatusBar(self.statusbar)
  38.  
  39.         self.retranslateUi(MainWindow)
  40.         QtCore.QMetaObject.connectSlotsByName(MainWindow)
  41.  
  42.     def retranslateUi(self, MainWindow):
  43.         _translate = QtCore.QCoreApplication.translate
  44.         MainWindow.setWindowTitle(_translate("MainWindow", "Patient Manager"))
  45.         self.sav_btn.setText(_translate("MainWindow", "Editor"))
  46.  
  47.  
  48. if __name__ == "__main__":
  49.     import sys
  50.     app = QtWidgets.QApplication(sys.argv)
  51.     MainWindow = QtWidgets.QMainWindow()
  52.     ui = Ui_MainWindow()
  53.     ui.setupUi(MainWindow)
  54.     MainWindow.show()
  55.     sys.exit(app.exec_())
  56.      
  57. part4Window = part4.Main()
  58. part4Window.show()
  59.      
  60. from sys import exit as sysExit
  61.  
  62. from PyQt5.QtCore    import *
  63. from PyQt5.QtGui     import *
  64. from PyQt5.QtWidgets import *
  65.  
  66. class MenuToolBar(QDockWidget):
  67.     def __init__(self, MainWin):
  68.         QDockWidget.__init__(self)
  69.  
  70.         self.MainMenu = MainWin.menuBar()
  71.  
  72.         # ******* Create the Edit Menu *******
  73.         self.EditMenu  = self.MainMenu.addMenu('Edit')
  74.  
  75.         self.OpnEditAct = QAction('Edit', self)
  76.         self.OpnEditAct.setStatusTip('Open Editor')
  77.         self.OpnEditAct.triggered.connect(MainWin.OpenEditor)
  78.  
  79.         self.EditMenu.addAction(self.OpnEditAct)
  80.  
  81.         self.InitToolBar(MainWin)
  82.  
  83.     def InitToolBar(self, MainWin):
  84.         self.mainToolBar = MainWin.addToolBar("Quick Access")
  85.  
  86.         self.mainToolBar.addAction(self.OpnEditAct)
  87.  
  88. class SecondPanel(QWidget):
  89.     def __init__(self, MainWin):
  90.         QWidget.__init__(self)
  91.  
  92.         self.My2ndEditor = QTextEdit('This is the second Editor')
  93.  
  94.         CntrPane2 = QVBoxLayout(self)
  95.  
  96.         CntrPane2.addWidget(self.My2ndEditor)
  97.  
  98.         self.setLayout(CntrPane2)
  99.  
  100. class CenterPanel(QWidget):
  101.     def __init__(self, MainWin):
  102.         QWidget.__init__(self)
  103.  
  104.         self.MyEditor = QTextEdit('This is the first Editor')
  105.  
  106.         CntrPane = QVBoxLayout(self)
  107.  
  108.         CntrPane.addWidget(self.MyEditor)
  109.  
  110.         self.setLayout(CntrPane)
  111.  
  112. class UI_MainWindow(QMainWindow):
  113.     def __init__(self):
  114.         super(UI_MainWindow, self).__init__()
  115.         self.setWindowTitle('Patient Manager')
  116.       # Left, Top, Width, Height
  117.         self.setGeometry(200, 200, 544, 385)
  118.  
  119.         self.CenterPane = CenterPanel(self)
  120.         self.setCentralWidget(self.CenterPane)
  121.  
  122.         self.MenuToolBar = MenuToolBar(self)
  123.  
  124.     def OpenEditor(self):
  125.         self.CenterPane2 = SecondPanel(self)
  126.         self.setCentralWidget(self.CenterPane2)
  127.  
  128. if __name__ == '__main__':
  129.     MainApp = QApplication([])
  130.  
  131.     MainGui = UI_MainWindow()
  132.     MainGui.show()
  133.  
  134.     sysExit(MainApp.exec_())
  135.      
  136. from PyQt5 import QtCore, QtGui, QtWidgets
  137.      
  138. from PyQt5.QtCore import QSize
  139. from PyQt5.QtWidgets import QApplication, QMainWindow, QTableWidget, QFileDialog, QWidget, QTextEdit
  140. from PyQt5.QtWidgets import QPushButton, QVBoxLayout, QHBoxLayout, QAction, qApp, QInputDialog
  141.      
  142. import os
  143. import sys
  144.      
  145. if __name__ == "__main__":
  146.     import sys
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