class MainWindowRoomManager(QMainWindow): def __init__(self, user): QMainWindow.__init__(self, None) self.initUI() self.initLayout() self.user = user def initUI(self): posX, posY, sizeW, sizeH = Setting.GEOMETRY_MAINWIDOW self.setGeometry(posX, posY, sizeW, sizeH) self.setWindowTitle("RoomManager Main Window") self.setTab() self.show() def initLayout(self): layout = QGridLayout() layout.addWidget(self.tabWidget) centralWidget = QWidget() centralWidget.setLayout(layout) self.setCentralWidget(centralWidget) def setTab(self): self.tabWidget = QTabWidget() self.tabWidget.setStyleSheet( "QTabBar::tab { height: 35px; width: 100px; }") self.tab1 = Tab1_AllRoomClass.Tab1AllRoom() self.tab2 = Tab2_ManagePatientClass.Tab2ManagePatient() self.tabWidget.addTab(self.tab1, "Manage Room") self.tabWidget.addTab(self.tab2, "Patient")
class MainWindowNurse(QMainWindow): def __init__(self, user, parent=None): QMainWindow.__init__(self, None) self.parent = parent self.user = user self.crtlDatabase = Nurse.NurseApplication() self.initUI() self.initLayout() def initUI(self): posX, posY, sizeW, sizeH = Setting.GEOMETRY_MAINWIDOW self.setGeometry(posX, posY, sizeW, sizeH) self.setWindowTitle("Nurse window") self.setTab() self.show() def initLayout(self): layout = QGridLayout() layout.addWidget(self.tabWidget) centralWidget = QWidget() centralWidget.setLayout(layout) self.setCentralWidget(centralWidget) def setTab(self): self.tabWidget = QTabWidget() self.tabWidget.setStyleSheet(Setting.SS_TabWidget) self.tab1 = Tab1_PatientClass.Tab1Patient(self.user, self) self.tabWidget.addTab(self.tab1, "Patient") def getPatientByAN(self, AN): return self.crtlDatabase.getPatientByAN(AN) def getAppointmentByAN(self, AN): return self.crtlDatabase.getAppointmentByAN(AN)
def __init__(self): QWidget.__init__(self) self.title = u"Web对象管理" # Page _page = PageContainer() # Window _window = ViewWindow() # Widget _widget = WidgetContainer() # 页面 tab _tab = QTabWidget() _tab.addTab(_page, _page.title) _tab.addTab(_window, _window.title) _tab.addTab(_widget, _widget.title) _tab.setTabPosition(QTabWidget.West) _tab.setStyleSheet(get_theme("TabViewWeb")) # 测试区 self.__test = WidgetTest() self.__test.setStyleSheet(get_theme("TestWidget")) # 主layout _layout = QHBoxLayout() _layout.addWidget(_tab) _layout.addWidget(self.__test) _layout.setStretch(0, 5) _layout.setStretch(1, 1) _layout.setContentsMargins(0, 0, 0, 0) _layout.setSpacing(0) self.setLayout(_layout) # 信号 _page.sig_selected.connect(self.set_page) _widget.sig_selected.connect(self.set_widget) self.__test.sig_exec.connect(self.send)
class AboutDialog(QDialog): """ About Dialog for Embroidermodder. """ def __init__(self, parent=None): """Default class constructor.""" super(AboutDialog, self).__init__(parent) p = self.palette() p.setColor(self.backgroundRole(), Qt.white) self.setPalette(p) if parent: self.gImgDir = parent.gImgDir self.gIconDir = parent.gIconDir elif __name__ == '__main__': self.gImgDir = gAppDir + os.sep + 'images' self.gIconDir = gAppDir + os.sep + 'icons' + os.sep + 'default' # The tiled theme background texture. self.bgLogo = QPixmap(self.gImgDir + os.sep + 'texture-spirals.png') self.bgBrush = QBrush(self.bgLogo) self.setWhatsThis(self.tr("""\ The background is a tiled image of an actual design that was stitched out during the pre-alpha stage. It was created by Nina Paley and Theodore Gray using Mathematica in conjunction with our software. They have graciously allowed us to use it for the project in whichever way we wish. We thought it looked so good, that it has become the new theme for Embroidermodder 2. To check out some of the more interesting embroidery projects they are working on, visit http://blog.ninapaley.com/""")) self.imgLbl = EmbroidermodderLogo(self) aboutLbl = QTextBrowser(self) aboutLbl.setReadOnly(True) aboutLbl.setOpenExternalLinks(True) aboutLbl.setText('<b>%s</b>' % '<br>'.join(__doc__.split('\n'))) aboutLbl.setWhatsThis(self.tr('This is the AWESOME people that brought Embroidermodder 2 to life.')) # We want very slight opacity of the white background # so the seamless texture shows slightly through. opacityStyleSheet = """\ QTextEdit:read-only { color: rgb(50, 50, 50); font-size: 12px; font-weight: bold; background-color: rgba(255, 255, 255, 240); border: 1px solid rgba(0, 0, 0, 255); } """ aboutLbl.setStyleSheet(opacityStyleSheet) op = QGraphicsOpacityEffect(aboutLbl) op.setOpacity(0.95) aboutLbl.setGraphicsEffect(op) self.notebook = QTabWidget(self) self.notebook.setMinimumWidth(500) self.notebook.addTab(aboutLbl, self.tr('About')) self.notebook.setTabIcon(0, QIcon(self.gIconDir + os.sep + 'app.png')) self.notebook.setTabIcon(1, QIcon(self.gImgDir + os.sep + 'kickstarter-logo-k-color.png')) notebookStyleSheet = """\ QTabWidget::pane { /* The tab widget frame */ border-top: 1px solid #000000; position: absolute; top: -0.5em; } QTabWidget::tab-bar { alignment: center; } /* Style the tab using the tab sub-control. Note that it reads QTabBar _not_ QTabWidget */ QTabBar::tab { margin-top: 2px; /* make non-selected tabs look smaller */ font-size: 14px; font-weight: bold; background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #E1E1E1, stop: 0.4 #DDDDDD, stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3); border: 1px solid #000000; /* border-bottom-color: #C2C7CB; */ /* same as the pane color */ border-top-left-radius: 4px; border-top-right-radius: 4px; min-width: 40ex; min-height: 5ex; padding: 3px; } QTabBar::tab:selected { margin-top: 0px; font-size: 16px; font-weight: bold; background: qlineargradient(x1: 0, y1: 0, x2: 2, y2: 2, stop: 0 #0C6AB0, stop: 0.15 #55C4E6, stop: 0.15 #55C4E6, stop: 0.5 #FFFFFF, stop: 0.5 #FFFFFF, stop: 0.85 #55C4E6, stop: 0.85 #55C4E6, stop: 1.0 #0C6AB0); border: 1px solid #000000; } QTabBar::tab:!selected:hover { margin-top: 2px; /* make non-selected tabs look smaller */ font-size: 14px; font-weight: bold; background: qlineargradient(x1: 0, y1: 0, x2: 2, y2: 2, stop: 0 #888888, stop: 0.15 #BBBBBB, stop: 0.15 #BBBBBB, stop: 0.5 #FFFFFF, stop: 0.5 #FFFFFF, stop: 0.85 #BBBBBB, stop: 0.85 #BBBBBB, stop: 1.0 #888888); border: 1px solid #000000; } QTabBar::tab:selected { border-color: #000000; border-bottom-color: #000000; /* same as pane color */ } """ self.notebook.setStyleSheet(notebookStyleSheet) self.notebook.currentChanged.connect(self.CurrentTabChanged) buttonbox = QDialogButtonBox(Qt.Horizontal, self) button = QPushButton(self) button.setText(self.tr("Oh, Yeah!")) button.setWhatsThis(self.tr('This is the Oh, Yeah! button!') + '\n' + self.tr('Oh, Yeah!')) buttonbox.addButton(button, QDialogButtonBox.AcceptRole) buttonbox.setCenterButtons(True) buttonbox.accepted.connect(self.accept) hbLayout1 = QHBoxLayout() hbLayout2 = QHBoxLayout() vbLayout = QVBoxLayout() hbLayout1.addStretch() hbLayout1.addWidget(self.imgLbl) hbLayout1.addStretch() hbLayout2.addStretch() hbLayout2.addWidget(self.notebook) hbLayout2.addStretch() vbLayout.addLayout(hbLayout1) vbLayout.addLayout(hbLayout2) vbLayout.addWidget(buttonbox) self.setLayout(vbLayout) self.setWindowTitle(self.tr('About Embroidermodder Version 2.0')) QApplication.restoreOverrideCursor() # TODO/???/PORT# don't mess with the window resize cursors. # def __del__(self): # """Class destructor""" # QApplication.restoreOverrideCursor() def CurrentTabChanged(self): tt = self.notebook.tabText(self.notebook.currentIndex()) if tt == self.tr('About'): self.imgLbl.paintThisText = 'About' elif tt == self.tr('Supporters'): self.imgLbl.paintThisText = 'Kickstarter' self.imgLbl.repaint() def paintEvent(self, event): """ Handles the ``paintEvent`` event for :class:`AboutDialog`. :param `event`: a `QPaintEvent` event to be processed. """ rect = self.rect() painter = QPainter(self) painter.setRenderHint(painter.SmoothPixmapTransform) # Always fill with a solid color first painter.fillRect(rect, Qt.white) # Then overlay the texture painter.fillRect(rect, self.bgBrush)
class MainWindowDoctor(QMainWindow): def __init__(self, user, parent=None): QMainWindow.__init__(self, None) self.crtlDatabase = Doctor.DoctorApplication() self.parent = parent self.user = user self.initUI() self.initLayout() def initUI(self): posX, posY, sizeW, sizeH = Setting.GEOMETRY_MAINWIDOW self.setGeometry(posX, posY, sizeW, sizeH) self.setWindowTitle("Doctor window") self.setTab() self.show() def initLayout(self): layout = QGridLayout() layout.addWidget(self.tabWidget) centralWidget = QWidget() centralWidget.setLayout(layout) self.setCentralWidget(centralWidget) def setTab(self): self.tabWidget = QTabWidget() self.tabWidget.setStyleSheet(Setting.SS_TabWidget) self.tab1 = Tab1_CalendarClass.Tab1Calendar(self.user, self) self.tab2 = Tab2_PatientClass.Tab2Patient(self.user, self) self.tab3 = Tab3_AppointmentClass.Tab3Appointment(self.user, self) self.tabWidget.addTab(self.tab1, "Dashboard") self.tabWidget.addTab(self.tab2, "Patient") self.tabWidget.addTab(self.tab3, "Appointment") def updateTable(self, tab): if tab == 'Appointment': self.tab3.updateTable() elif tab == 'Patient': self.tab2.updateTable() else: raise TypeError """-----------------------------DOCTOR APP---------------------------------------""" """-----PATIENT-----""" def getCurrentCaseID(self): return self.crtlDatabase.getCurrentCaseID() def addNewPatient(self, newPatient): self.crtlDatabase.addNewPatient(newPatient) def editPatient(self, oldPatient): self.crtlDatabase.editPatient(oldPatient) def patientValid(self, AN): return self.crtlDatabase.patientValid(AN) def oldPatientValid(self, AN, patient_name): return self.crtlDatabase.oldPatientValid(AN, patient_name) def deleteButtonPressed(self, AN): title = "Confirm deleting" text_info = "Delete this Patient" question = "Do you sure to delete " + str(AN) dialog = ConfirmMsgClass.ConfirmYesNo(title, text_info, question) if dialog.ans: patients = self.crtlDatabase.getPatientFromDatabase() appointments = self.crtlDatabase.getAppointmentFromDatabase() for patient in patients: if patient.AN == AN: patients.remove(patient) self.crtlDatabase.updatePatientDatabase(patients) self.tab2.updateTable() break for appointment in appointments: if appointment.patient.AN == AN: appointments.remove(appointment) self.crtlDatabase.updateAppointmentDatabase(appointments) self.tab3.updateTable() break else: pass """-----APPOINTMENT----""" def getAppointment(self): return self.crtlDatabase.getAppointmentByDoctor(self.user.id) def addNewAppointment(self, newAppointment): self.crtlDatabase.addNewAppointment(newAppointment) def appointmentValid(self, date, time, doctor): return self.crtlDatabase.appointmentValid(date, time, doctor) def getPatientByCaseId(self, case_id): return self.crtlDatabase.getPatientByCaseId(case_id, self.user.id) def getAppointmentByAN(self, AN): return self.crtlDatabase.getAppointmentByAN(AN) def getHistoryReportByAN(self, AN): return self.crtlDatabase.getHistoryReportByAN(AN)
class AboutDialog(QDialog): """ Subclass of `QDialog`_ About Dialog for Embroidermodder. .. sphinx_generate_methods_summary:: AboutDialog """ def __init__(self, parent=None): """ Default class constructor. :param `parent`: Pointer to a parent widget instance. :type `parent`: `QWidget`_ """ super(AboutDialog, self).__init__(parent) p = self.palette() p.setColor(self.backgroundRole(), Qt.white) self.setPalette(p) if parent: self.gImgDir = parent.gImgDir self.gIconDir = parent.gIconDir elif __name__ == '__main__': self.gImgDir = gAppDir + os.sep + 'images' self.gIconDir = gAppDir + os.sep + 'icons' + os.sep + 'default' # The tiled theme background texture. self.bgLogo = QPixmap(self.gImgDir + os.sep + 'texture-spirals.png') self.bgBrush = QBrush(self.bgLogo) self.setWhatsThis( self.tr("""\ The background is a tiled image of an actual design that was stitched out during the pre-alpha stage. It was created by Nina Paley and Theodore Gray using Mathematica in conjunction with our software. They have graciously allowed us to use it for the project in whichever way we wish. We thought it looked so good, that it has become the new theme for Embroidermodder 2. To check out some of the more interesting embroidery projects they are working on, visit http://blog.ninapaley.com/""")) self.imgLbl = EmbroidermodderLogo(self) aboutLbl = QTextBrowser(self) aboutLbl.setReadOnly(True) aboutLbl.setOpenExternalLinks(True) aboutLbl.setText('<b>%s</b>' % '<br>'.join(ABOUT.split('\n'))) aboutLbl.setWhatsThis( self. tr('This is the AWESOME people that brought Embroidermodder 2 to life.' )) # We want very slight opacity of the white background # so the seamless texture shows slightly through. opacityStyleSheet = """\ QTextEdit:read-only { color: rgb(50, 50, 50); font-size: 12px; font-weight: bold; background-color: rgba(255, 255, 255, 240); border: 1px solid rgba(0, 0, 0, 255); } """ aboutLbl.setStyleSheet(opacityStyleSheet) op = QGraphicsOpacityEffect(aboutLbl) op.setOpacity(0.95) aboutLbl.setGraphicsEffect(op) self.notebook = QTabWidget(self) self.notebook.setMinimumWidth(500) self.notebook.addTab(aboutLbl, self.tr('About')) self.notebook.setTabIcon(0, QIcon(self.gIconDir + os.sep + 'app.png')) self.notebook.setTabIcon( 1, QIcon(self.gImgDir + os.sep + 'kickstarter-logo-k-color.png')) notebookStyleSheet = """\ QTabWidget::pane { /* The tab widget frame */ border-top: 1px solid #000000; position: absolute; top: -0.5em; } QTabWidget::tab-bar { alignment: center; } /* Style the tab using the tab sub-control. Note that it reads QTabBar _not_ QTabWidget */ QTabBar::tab { margin-top: 2px; /* make non-selected tabs look smaller */ font-size: 14px; font-weight: bold; background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #E1E1E1, stop: 0.4 #DDDDDD, stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3); border: 1px solid #000000; /* border-bottom-color: #C2C7CB; */ /* same as the pane color */ border-top-left-radius: 4px; border-top-right-radius: 4px; min-width: 40ex; min-height: 5ex; padding: 3px; } QTabBar::tab:selected { margin-top: 0px; font-size: 16px; font-weight: bold; background: qlineargradient(x1: 0, y1: 0, x2: 2, y2: 2, stop: 0 #0C6AB0, stop: 0.15 #55C4E6, stop: 0.15 #55C4E6, stop: 0.5 #FFFFFF, stop: 0.5 #FFFFFF, stop: 0.85 #55C4E6, stop: 0.85 #55C4E6, stop: 1.0 #0C6AB0); border: 1px solid #000000; } QTabBar::tab:!selected:hover { margin-top: 2px; /* make non-selected tabs look smaller */ font-size: 14px; font-weight: bold; background: qlineargradient(x1: 0, y1: 0, x2: 2, y2: 2, stop: 0 #888888, stop: 0.15 #BBBBBB, stop: 0.15 #BBBBBB, stop: 0.5 #FFFFFF, stop: 0.5 #FFFFFF, stop: 0.85 #BBBBBB, stop: 0.85 #BBBBBB, stop: 1.0 #888888); border: 1px solid #000000; } QTabBar::tab:selected { border-color: #000000; border-bottom-color: #000000; /* same as pane color */ } """ self.notebook.setStyleSheet(notebookStyleSheet) self.notebook.currentChanged.connect(self.CurrentTabChanged) buttonbox = QDialogButtonBox(Qt.Horizontal, self) button = QPushButton(self) button.setText(self.tr("Oh, Yeah!")) button.setWhatsThis( self.tr('This is the Oh, Yeah! button!') + '\n' + self.tr('Oh, Yeah!')) buttonbox.addButton(button, QDialogButtonBox.AcceptRole) buttonbox.setCenterButtons(True) buttonbox.accepted.connect(self.accept) hbLayout1 = QHBoxLayout() hbLayout2 = QHBoxLayout() vbLayout = QVBoxLayout() hbLayout1.addStretch() hbLayout1.addWidget(self.imgLbl) hbLayout1.addStretch() hbLayout2.addStretch() hbLayout2.addWidget(self.notebook) hbLayout2.addStretch() vbLayout.addLayout(hbLayout1) vbLayout.addLayout(hbLayout2) vbLayout.addWidget(buttonbox) self.setLayout(vbLayout) self.setWindowTitle(self.tr('About Embroidermodder Version 2.0')) QApplication.restoreOverrideCursor( ) # TODO/???/PORT# don't mess with the window resize cursors. # def __del__(self): # """Class destructor""" # QApplication.restoreOverrideCursor() def CurrentTabChanged(self): tt = self.notebook.tabText(self.notebook.currentIndex()) if tt == self.tr('About'): self.imgLbl.paintThisText = 'About' elif tt == self.tr('Supporters'): self.imgLbl.paintThisText = 'Kickstarter' self.imgLbl.repaint() def paintEvent(self, event): """ Handles the ``paintEvent`` event for :class:`AboutDialog`. :param `event`: A `QPaintEvent`_ to be processed. """ rect = self.rect() painter = QPainter(self) painter.setRenderHint(painter.SmoothPixmapTransform) # Always fill with a solid color first painter.fillRect(rect, Qt.white) # Then overlay the texture painter.fillRect(rect, self.bgBrush)
class StartView(QMainWindow): def __init__(self): super(StartView, self).__init__() self.setWindowTitle("hello") self.resize(1024, 768) # Menu main_menu = self.menuBar() self.create = main_menu.addMenu('&Create') self.run = main_menu.addMenu('&Run') self.report = main_menu.addMenu('&Report') self.help = main_menu.addMenu('&Help') action_batch = self.create.addAction('&Batch') action_case = self.create.addAction('&Case') action_data = self.create.addAction('&Data') action_web = self.create.addAction('&Web') action_run = self.run.addAction('&Run') action_test = self.run.addAction('&Test') action_report = self.report.addAction('&Report') self.connect(action_batch, SIGNAL('triggered()'), self.open_batch) self.connect(action_case, SIGNAL('triggered()'), self.open_case) self.connect(action_test, SIGNAL('triggered()'), self.open_test) self.connect(action_data, SIGNAL('triggered()'), self.open_data) self.connect(action_web, SIGNAL('triggered()'), self.open_web_object) self.connect(action_run, SIGNAL('triggered()'), self.open_run) self.connect(action_report, SIGNAL('triggered()'), self.open_report) # Dock self.dock_category = DockCategory() # category widget self.dock_log = DockBottom() # log widget self.dock_detail = DockDetail() # detail widget self.__dock_displayed = False # center widget self.__wid_center = QTabWidget() self.setCentralWidget(self.__wid_center) self.__wid_center.setStyleSheet(get_theme("TabViewMain")) self.__wid_center.setTabsClosable(True) self.connect(self.__wid_center, SIGNAL("tabCloseRequested(int)"), self.close_tab) def close_tab(self): index = self.__wid_center.currentIndex() self.__wid_center.removeTab(index) def open_data(self): _view = ViewDataMag() self.__add_tab(_view) def open_batch(self): _view = ViewBatchDefMag() _view.sig_batch_det[dict].connect(self.open_case_select) self.__add_tab(_view) def open_case(self): _view = ViewCaseDefMag() _view.sig_case_det[dict].connect(self.open_step) self.__add_tab(_view) def open_case_select(self, p_data): _view = ViewBatchDetMag(p_data) self.__add_tab(_view) def open_step(self, p_data): _view = StepContainer(p_data) self.__add_tab(_view) def open_web_object(self): _view = ViewWebMain() self.__add_tab(_view) def open_run(self): _view = ViewRunMain() self.__add_tab(_view) def open_report(self): _view = ViewReportMain() self.__add_tab(_view) def open_test(self): self.__show_dock() def __add_tab(self, p_view): self.__wid_center.addTab(p_view, p_view.title) self.__wid_center.setCurrentWidget(p_view) def __show_dock(self): if not self.__dock_displayed: self.addDockWidget(Qt.BottomDockWidgetArea, self.dock_log) # self.addDockWidget(Qt.LeftDockWidgetArea, self.dock_category) # self.addDockWidget(Qt.RightDockWidgetArea, self.dock_detail) pass
class MainWindowNurse(QMainWindow): def __init__(self, user, parent=None): QMainWindow.__init__(self, None) self.nurse_app = Nurse.NurseApplication() self.parent = parent self.user = user self.initUI() self.initLayout() def initUI(self): posX, posY, sizeW, sizeH = Setting.GEOMETRY_MAINWIDOW self.setGeometry(posX, posY, sizeW, sizeH) self.setWindowTitle("Nurse window") self.setTab() self.show() def initLayout(self): layout = QGridLayout() layout.addWidget(self.tabWidget) centralWidget = QWidget() centralWidget.setLayout(layout) self.setCentralWidget(centralWidget) def setTab(self): self.tabWidget = QTabWidget() self.tabWidget.setStyleSheet(Setting.SS_TabWidget) self.tab1 = Tab1_PatientClass.Tab1Patient(self.user, self) self.tabWidget.addTab(self.tab1, "Patient") def getPatientByAN(self, AN): return self.nurse_app.getPatientByAN(AN) def getAppointmentByAN(self, AN): return self.nurse_app.getAppointmentByAN(AN) def deleteButtonPressed(self, AN): title = "Confirm deleting" text_info = "Delete this Patient" question = "Do you sure to delete " + str(AN) dialog = ConfirmMsgClass.ConfirmYesNo(title, text_info, question) if dialog.ans: patients = self.nurse_app.getPatientFromDatabase() appointments = self.nurse_app.getAppointmentFromDatabase() for patient in patients: if patient.AN == AN: patients.remove(patient) self.nurse_app.updatePatientDatabase(patients) self.tab1.updateTable() break for appointment in appointments: if appointment.patient.AN == AN: appointments.remove(appointment) self.nurse_app.updateAppointmentDatabase(appointments) break else: pass def updatePatient(self, patient): return self.nurse_app.editPatient(patient) def createHistory(self, new_history_report): self.nurse_app.createHistory(new_history_report)
class Gui(): """main gui class""" def __init__(self): self.mainwindow = QMainWindow() settings.get_settings() self.access = tuple(settings.access.items()) self.progress = QProgressDialog("Setting up modules...", "cancel", 0, 7, self.mainwindow) self.progress.setWindowTitle( QApplication.translate("MainWindow", str(settings.company), None, QApplication.UnicodeUTF8)) def setup(self): """initializes the uio of the erp client""" self.progress.setFixedWidth(1000) self.progress.setCancelButton(None) # self.progress.setWindowModality(Qt.WindowModal) self.progress.setValue(1) self.mainwindow.setObjectName("MainWindow") self.mainwindow.resize(832, 668) self.mainwindow.setStyleSheet( "QToolBar{\n" "background: qlineargradient(x1:0, y1:0, x2:1, y2:1,\n" "stop:0 rgba(0,0,0),stop:1 rgb(162, 162, 162, 162));\n" "border: 0px;\n" "}\n" "QToolBar > QWidget{\n" "color:white;\n" "}\n" "QToolBar > QWidget:hover {\n" "background:transparent;\n" " }\n" "QToolBar > QWidget:checked {\n" "background:transparent;\n" " }\n" "#MainWindow{\n" "background: qlineargradient(x1:0, y1:0, x2:1, y2:1,\n" "stop:0 rgba(0,0,0),stop:1 rgb(162, 162, 162, 162));\n" "border: 0px;\n" "}\n" "") self.centralWidget = QWidget(self.mainwindow) self.centralWidget.setObjectName("centralWidget") self.gridLayout_2 = QGridLayout(self.centralWidget) self.gridLayout_2.setObjectName("gridLayout_2") self.stackedWidget = QStackedWidget(self.centralWidget) self.stackedWidget.setStyleSheet("") self.stackedWidget.setObjectName("stackedWidget") self.shortcut = NewShortcut() scroll = QScrollArea() scroll.setWidget(self.shortcut.shortcut_setting) self.stackedWidget.addWidget(self.shortcut.shortcut_setting) self.home_page = QWidget() self.home_page.setObjectName("home_page") self.gridLayout = QGridLayout(self.home_page) self.gridLayout.setObjectName("gridLayout") self.billing_frame_2 = QFrame(self.home_page) self.billing_frame_2.setStyleSheet( "background-image:url(:/images/billing_frame.png);\n" "background-repeat: no-repeat;\n" "background-position: center;\n" "background-color:#6CBED2;") self.billing_frame_2.setFrameShape(QFrame.StyledPanel) self.billing_frame_2.setFrameShadow(QFrame.Raised) self.billing_frame_2.setObjectName("billing_frame_2") self.verticalLayout_4 = QVBoxLayout(self.billing_frame_2) self.verticalLayout_4.setObjectName("verticalLayout_4") spacerItem = QSpacerItem(20, 217, QSizePolicy.Minimum, QSizePolicy.Expanding) self.verticalLayout_4.addItem(spacerItem) self.label_10 = QLabel(self.billing_frame_2) self.label_10.setStyleSheet("background:transparent;") self.label_10.setObjectName("label_10") self.verticalLayout_4.addWidget(self.label_10) self.gridLayout.addWidget(self.billing_frame_2, 0, 1, 1, 1) self.employee_frame_3 = QFrame(self.home_page) self.employee_frame_3.setStyleSheet( "background-image:url(:/images/employee_frame.png);\n" "background-repeat: no-repeat;\n" "background-position: center;\n" "background-color:#0099CC;") self.employee_frame_3.setFrameShape(QFrame.StyledPanel) self.employee_frame_3.setFrameShadow(QFrame.Raised) self.employee_frame_3.setObjectName("employee_frame_3") self.verticalLayout_5 = QVBoxLayout(self.employee_frame_3) self.verticalLayout_5.setObjectName("verticalLayout_5") spacerItem1 = QSpacerItem(20, 217, QSizePolicy.Minimum, QSizePolicy.Expanding) self.verticalLayout_5.addItem(spacerItem1) self.label_11 = QLabel(self.employee_frame_3) self.label_11.setStyleSheet("background:transparent;") self.label_11.setObjectName("label_11") self.verticalLayout_5.addWidget(self.label_11) self.gridLayout.addWidget(self.employee_frame_3, 0, 2, 1, 1) self.menu_frame_4 = QFrame(self.home_page) self.menu_frame_4.setStyleSheet( "background-image:url(:/images/menu_frame.png);\n" "background-repeat: no-repeat;\n" "background-position: center;\n" "background-color:#297ACC;") self.menu_frame_4.setFrameShape(QFrame.StyledPanel) self.menu_frame_4.setFrameShadow(QFrame.Raised) self.menu_frame_4.setObjectName("menu_frame_4") self.verticalLayout_3 = QVBoxLayout(self.menu_frame_4) self.verticalLayout_3.setObjectName("verticalLayout_3") spacerItem2 = QSpacerItem(20, 216, QSizePolicy.Minimum, QSizePolicy.Expanding) self.verticalLayout_3.addItem(spacerItem2) self.label_12 = QLabel(self.menu_frame_4) self.label_12.setStyleSheet("background:transparent;") self.label_12.setObjectName("label_12") self.verticalLayout_3.addWidget(self.label_12) self.gridLayout.addWidget(self.menu_frame_4, 1, 0, 1, 1) self.report_frame_5 = QFrame(self.home_page) self.report_frame_5.setStyleSheet( "background-image:url(:/images/report_frame.png);\n" "background-repeat: no-repeat;\n" "background-position: center;\n" "background-color:#006BB2;") self.report_frame_5.setFrameShape(QFrame.StyledPanel) self.report_frame_5.setFrameShadow(QFrame.Raised) self.report_frame_5.setObjectName("report_frame_5") self.verticalLayout_6 = QVBoxLayout(self.report_frame_5) self.verticalLayout_6.setObjectName("verticalLayout_6") spacerItem3 = QSpacerItem(20, 216, QSizePolicy.Minimum, QSizePolicy.Expanding) self.verticalLayout_6.addItem(spacerItem3) self.label_13 = QLabel(self.report_frame_5) self.label_13.setStyleSheet("background:transparent;") self.label_13.setObjectName("label_13") self.verticalLayout_6.addWidget(self.label_13) self.gridLayout.addWidget(self.report_frame_5, 1, 1, 1, 1) self.waste_frame_6 = QFrame(self.home_page) self.waste_frame_6.setStyleSheet( "background-image:url(:/images/waste_frame.png);\n" "background-repeat: no-repeat;\n" "background-position: center;\n" "background-color:#003D7A;") self.waste_frame_6.setFrameShape(QFrame.StyledPanel) self.waste_frame_6.setFrameShadow(QFrame.Raised) self.waste_frame_6.setObjectName("waste_frame_6") self.verticalLayout_7 = QVBoxLayout(self.waste_frame_6) self.verticalLayout_7.setObjectName("verticalLayout_7") spacerItem4 = QSpacerItem(20, 216, QSizePolicy.Minimum, QSizePolicy.Expanding) self.verticalLayout_7.addItem(spacerItem4) self.label_14 = QLabel(self.waste_frame_6) self.label_14.setStyleSheet("background:transparent;") self.label_14.setObjectName("label_14") self.verticalLayout_7.addWidget(self.label_14) self.gridLayout.addWidget(self.waste_frame_6, 1, 2, 1, 1) self.inventory_frame_1 = QFrame(self.home_page) self.inventory_frame_1.setStyleSheet( "background-image:url(:/images/inventory_frame.png);\n" "background-repeat: no-repeat;\n" "background-position: center;\n" "background-color:#ADEBFF;") self.inventory_frame_1.setFrameShape(QFrame.StyledPanel) self.inventory_frame_1.setFrameShadow(QFrame.Raised) self.inventory_frame_1.setObjectName("inventory_frame_1") self.verticalLayout_2 = QVBoxLayout(self.inventory_frame_1) self.verticalLayout_2.setObjectName("verticalLayout_2") spacerItem5 = QSpacerItem(20, 217, QSizePolicy.Minimum, QSizePolicy.Expanding) self.verticalLayout_2.addItem(spacerItem5) self.label_9 = QLabel(self.inventory_frame_1) self.label_9.setStyleSheet("background:transparent;") self.label_9.setObjectName("label_9") self.verticalLayout_2.addWidget(self.label_9) self.gridLayout.addWidget(self.inventory_frame_1, 0, 0, 1, 1) self.stackedWidget.addWidget(self.home_page) self.detail_page = QWidget() self.detail_page.setObjectName("detail_page") self.horizontalLayout_2 = QHBoxLayout(self.detail_page) self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.main_tabWidget = QTabWidget(self.detail_page) self.main_tabWidget.setAutoFillBackground(False) self.main_tabWidget.setStyleSheet("") self.main_tabWidget.setTabPosition(QTabWidget.West) self.main_tabWidget.setIconSize(QSize(60, 60)) self.main_tabWidget.setElideMode(Qt.ElideNone) self.main_tabWidget.setObjectName("main_tabWidget") ##initializes the tabs self.add_tabs() self.main_tabWidget.setFocusPolicy(Qt.StrongFocus) self.main_tabWidget.focusInEvent = self.change_focus self.main_tabWidget.currentChanged.connect(self.change_focus) self.stackedWidget.currentChanged.connect(self.change_focus) ###### self.horizontalLayout_2.addWidget(self.main_tabWidget) self.stackedWidget.addWidget(self.detail_page) if ('Admin', True) in self.access: self.stackedWidget.addWidget(Admin(self.mainwindow)) notification = NotificationTab() tab = notification.notificationTab_tab_4 tab.custom_class_object = notification # class_object is used to access the api through the self.stackedWidget.addWidget(tab) self.gridLayout_2.addWidget(self.stackedWidget, 0, 0, 1, 1) self.mainwindow.setCentralWidget(self.centralWidget) self.menuBar = QMenuBar(self.mainwindow) self.menuBar.setGeometry(QRect(0, 0, 832, 29)) self.menuBar.setObjectName("menuBar") self.mainwindow.setMenuBar(self.menuBar) self.mainToolBar = QToolBar(self.mainwindow) self.mainToolBar.setLayoutDirection(Qt.RightToLeft) self.mainToolBar.setStyleSheet("") self.mainToolBar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) self.mainToolBar.setObjectName("mainToolBar") self.mainwindow.addToolBar(Qt.TopToolBarArea, self.mainToolBar) self.statusBar = QStatusBar(self.mainwindow) self.statusBar.setObjectName("statusBar") self.mainwindow.setStatusBar(self.statusBar) self.toolBar = QToolBar(self.mainwindow) self.toolBar.setLayoutDirection(Qt.RightToLeft) self.toolBar.setStyleSheet("") self.toolBar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) self.toolBar.setObjectName("toolBar") self.mainwindow.addToolBar(Qt.TopToolBarArea, self.toolBar) self.actionNotification = QAction(self.mainwindow) self.actionNotification.setCheckable(True) self.actionNotification.setChecked(False) self.actionNotification.setEnabled(True) icon6 = QIcon() icon6.addPixmap(QPixmap(":/images/notification.png"), QIcon.Normal, QIcon.Off) self.actionNotification.setIcon(icon6) self.actionNotification.setAutoRepeat(True) self.actionNotification.setVisible(True) self.actionNotification.setIconVisibleInMenu(False) self.actionNotification.setObjectName("actionNotification") self.actionNotification self.actionAdmin = QAction(self.mainwindow) # self.actionAdmin.setCheckable(True) icon7 = QIcon() icon7.addPixmap(QPixmap(":/images/admin.png"), QIcon.Normal, QIcon.Off) self.actionAdmin.setIcon(icon7) self.actionAdmin.setObjectName("actionAdmin") self.actionRefresh = QAction(self.mainwindow) icon8 = QIcon() icon8.addPixmap(QPixmap(":/images/refresh.png"), QIcon.Normal, QIcon.Off) self.actionRefresh.setIcon(icon8) self.actionRefresh.setObjectName("actionRefresh") self.actionHome = QAction(self.mainwindow) # self.actionHome.setCheckable(True) icon9 = QIcon() icon9.addPixmap(QPixmap(":/images/home.png"), QIcon.Normal, QIcon.Off) self.actionHome.setIcon(icon9) self.actionHome.setObjectName("actionHome") self.actionSettings = QAction(self.mainwindow) icon10 = QIcon() icon10.addPixmap(QPixmap(":/images/settings.png"), QIcon.Normal, QIcon.Off) self.actionSettings.setIcon(icon10) self.actionSettings.setObjectName("actionRefresh") self.toolBar.addAction(self.actionNotification) self.toolBar.addSeparator() self.toolBar.addAction(self.actionAdmin) if ('Admin', True) in self.access: self.toolBar.addSeparator() else: self.actionAdmin.setVisible(False) self.toolBar.addAction(self.actionHome) self.toolBar.addSeparator() self.toolBar.addAction(self.actionRefresh) self.toolBar.addSeparator() self.toolBar.addAction(self.actionSettings) ##retranslates self.mainwindow.setWindowTitle( QApplication.translate("MainWindow", settings.company, None, QApplication.UnicodeUTF8)) self.label_10.setText( QApplication.translate( "MainWindow", "<html><head/><body><p align=\"center\">BILLING</p></body></html>", None, QApplication.UnicodeUTF8)) self.label_11.setText( QApplication.translate( "MainWindow", "<html><head/><body><p align=\"center\">EMPLOYEE</p></body></html>", None, QApplication.UnicodeUTF8)) self.label_12.setText( QApplication.translate( "MainWindow", "<html><head/><body><p align=\"center\">MENU</p></body></html>", None, QApplication.UnicodeUTF8)) self.label_13.setText( QApplication.translate( "MainWindow", "<html><head/><body><p align=\"center\">REPORT</p></body></html>", None, QApplication.UnicodeUTF8)) self.label_14.setText( QApplication.translate( "MainWindow", "<html><head/><body><p align=\"center\">WASTE</p></body></html>", None, QApplication.UnicodeUTF8)) self.label_9.setText( QApplication.translate( "MainWindow", "<html><head/><body><p align=\"center\">INVENTORY</p></body></html>", None, QApplication.UnicodeUTF8)) self.inventory_frame_1.setToolTip( QApplication.translate("MainWindow", "Go to the Inventory Tab", None, QApplication.UnicodeUTF8)) self.billing_frame_2.setToolTip( QApplication.translate("MainWindow", "Go to the Billing Tab", None, QApplication.UnicodeUTF8)) self.employee_frame_3.setToolTip( QApplication.translate("MainWindow", "Go to the Employee Tab", None, QApplication.UnicodeUTF8)) self.menu_frame_4.setToolTip( QApplication.translate("MainWindow", "Go to the Menu Tab", None, QApplication.UnicodeUTF8)) self.report_frame_5.setToolTip( QApplication.translate("MainWindow", "Go to the Report Tab", None, QApplication.UnicodeUTF8)) self.waste_frame_6.setToolTip( QApplication.translate("MainWindow", "Go to the Waste Tab", None, QApplication.UnicodeUTF8)) self.toolBar.setWindowTitle( QApplication.translate("MainWindow", "toolBar", None, QApplication.UnicodeUTF8)) self.actionNotification.setText("&&Notification") # QApplication.translate("MainWindow", "&Notification", None, QApplication.UnicodeUTF8)) self.actionNotification.setToolTip( QApplication.translate("MainWindow", "Click to see new notifications", None, QApplication.UnicodeUTF8)) # self.actionNotification.setShortcut( # QApplication.translate("MainWindow", "Ctrl+Shift+N", None, QApplication.UnicodeUTF8)) self.actionAdmin.setText('&&Admin') # QApplication.translate("MainWindow", "Admin", None, QApplication.UnicodeUTF8)) self.actionAdmin.setToolTip( QApplication.translate("MainWindow", "Click to go to admin interface", None, QApplication.UnicodeUTF8)) # self.actionAdmin.setShortcut( # QApplication.translate("MainWindow", "Ctrl+Shift+A", None, QApplication.UnicodeUTF8)) self.actionRefresh.setText("&&Refresh") # QApplication.translate("MainWindow", "Refresh", None, QApplication.UnicodeUTF8)) self.actionRefresh.setToolTip( QApplication.translate("MainWindow", "refreshes the data from the server", None, QApplication.UnicodeUTF8)) # self.actionRefresh.setShortcut( # QApplication.translate("MainWindow", "Ctrl+Shift+R", None, QApplication.UnicodeUTF8)) self.actionHome.setText('&&Home') # QApplication.translate("MainWindow", "Home", None, QApplication.UnicodeUTF8)) self.actionHome.setToolTip( QApplication.translate("MainWindow", "Go back to the home screen", None, QApplication.UnicodeUTF8)) self.actionSettings.setText('&&Settings') # QApplication.translate("MainWindow", "Settings", None, QApplication.UnicodeUTF8)) self.actionSettings.setToolTip( QApplication.translate("MainWindow", "Go to the settings panel", None, QApplication.UnicodeUTF8)) # self.actionHome.setShortcut( # QApplication.translate("MainWindow", "Ctrl+Shift+H", None, QApplication.UnicodeUTF8)) self.stackedWidget.setCurrentIndex(1) self.main_tabWidget.setCurrentIndex(0) self.ob = self.main_tabWidget.tabBar() # self.add_tool_tip(self.ob) todo avoided due to segmentation fault error, left for future fixes self.tb = EventHandlerForTabBar() self.ob.installEventFilter(self.tb) QMetaObject.connectSlotsByName(self.mainwindow) def add_tabs(self): """ adds new tabs """ global logger if ('Inventory', True) in self.access: logger.info('initiating Inventory') icon = QIcon() icon.addPixmap(QPixmap(":/images/inventory.png"), QIcon.Normal, QIcon.Off) from inventory.inventory import Inventory inventory = Inventory() # inventory.inventory_tab_1.setToolTip("Inventory Section") self.main_tabWidget.addTab(inventory.inventory_tab_1, icon, "") inventory.inventory_detail_tabWidget.setCurrentIndex(0) else: self.inventory_frame_1.setVisible(False) self.progress.setLabelText('Inventory Done....') self.progress.setValue(2) if ('Billing', True) in self.access: logger.info('initiating Billing') icon1 = QIcon() icon1.addPixmap(QPixmap(":/images/billing.png"), QIcon.Normal, QIcon.Off) from billing.billing import Billing bill = Billing() # bill.billing_tab_2.setToolTip("Billing Section") self.main_tabWidget.addTab(bill.billing_tab_2, icon1, "") bill.billing_detail_tabWidget.setCurrentIndex(0) else: self.billing_frame_2.setVisible(False) self.progress.setLabelText('Billing Done...') self.progress.setValue(3) if ('Employee', True) in self.access: logger.info('initiating Employee') icon2 = QIcon() icon2.addPixmap(QPixmap(":/images/employee.png"), QIcon.Normal, QIcon.Off) from employee.employee import Employee employee = Employee() # employee.employee_tab_3.setToolTip("Employee Section") self.main_tabWidget.addTab(employee.employee_tab_3, icon2, "") employee.employee_detail_tabWidget.setCurrentIndex(0) else: self.employee_frame_3.setVisible(False) self.progress.setLabelText('Employee Done...') self.progress.setValue(4) if ('Menu', True) in self.access: logger.info('initiating Menu') icon3 = QIcon() icon3.addPixmap(QPixmap(":/images/menu.png"), QIcon.Normal, QIcon.Off) from menu.menu import Menu menu = Menu() # menu.menu_tab_4.setToolTip("Menu Section") self.main_tabWidget.addTab(menu.menu_tab_4, icon3, "") menu.menu_detail_tabWidget.setCurrentIndex(0) else: self.menu_frame_4.setVisible(False) self.progress.setLabelText('Menu Done....') self.progress.setValue(5) if ('Report', True) in self.access: logger.info('initiating Report') icon4 = QIcon() icon4.addPixmap(QPixmap(":/images/report.png"), QIcon.Normal, QIcon.Off) from report.report import Report report = Report() # report.report_tab_5.setToolTip("Report Section") self.main_tabWidget.addTab(report.report_tab_5, icon4, "") report.report_detail_tabWidget.setCurrentIndex(0) else: self.report_frame_5.setVisible(False) self.progress.setLabelText('Report Done....') self.progress.setValue(6) if ('Waste', True) in self.access: logger.info('initiating Waste') icon5 = QIcon() icon5.addPixmap(QPixmap(":/images/waste.png"), QIcon.Normal, QIcon.Off) from waste.waste import Waste waste = Waste() # waste.waste_tab_6.setToolTip("Waste Section") self.main_tabWidget.addTab(waste.waste_tab_6, icon5, "") waste.waste_detail_tabWidget.setCurrentIndex(0) else: self.waste_frame_6.setVisible(False) self.progress.setLabelText('Waste Done....') self.progress.setValue(7) def change_focus(self, event=None): """ focus method to set focus to a tab to initialize the corresponding events of the tab """ wid = self.main_tabWidget.currentWidget() if wid: if wid.isVisible(): # print wid.objectName() # print '1y' wid.setFocus() def add_tool_tip( self, ob ): # todo not working causing segmentation fault, avoided calling this function """ method to add tool tip to the tabs :param ob: Tab bar """ obj = ob count = obj.count() hardcode = { 0: 'Inventory Section', 1: "Billing Section", 2: "Employee Section", 3: "Menu Section", 4: "Report Section", 5: "Waste Section" } for i in range(count): obj.setTabToolTip(i, hardcode[i])
class MainWindowDoctor(QMainWindow): def __init__(self, user, parent=None): QMainWindow.__init__(self, None) self.parent = parent self.user = user self.crtlDatabase = Doctor.DoctorApplication() self.initUI() self.initLayout() def initUI(self): posX, posY, sizeW, sizeH = Setting.GEOMETRY_MAINWIDOW self.setGeometry(posX, posY, sizeW, sizeH) self.setWindowTitle("Doctor window") self.setTab() self.show() def initLayout(self): layout = QGridLayout() layout.addWidget(self.tabWidget) centralWidget = QWidget() centralWidget.setLayout(layout) self.setCentralWidget(centralWidget) def setTab(self): self.tabWidget = QTabWidget() self.tabWidget.setStyleSheet(Setting.SS_TabWidget) self.tab1 = Tab1_CalendarClass.Tab1Calendar(self.user, self) self.tab2 = Tab2_PatientClass.Tab2Patient(self.user, self) self.tab3 = Tab3_AppointmentClass.Tab3Appointment(self.user, self) self.tabWidget.addTab(self.tab1, "Dashboard") self.tabWidget.addTab(self.tab2, "Patient") self.tabWidget.addTab(self.tab3, "Appointment") def addNewAppointment(self, newAppointment): self.crtlDatabase.addNewAppointment(newAppointment) def getCurrentCaseID(self): return self.crtlDatabase.getCurrentCaseID() def getAppointment(self): print("in get Appointment") print(self.user.id) return self.crtlDatabase.getAppointmentByDoctor(self.user.id) def appointmentValid(self, date, time, doctor): return self.crtlDatabase.appointmentValid(date, time, doctor) def addNewPatient(self, newPatient): self.crtlDatabase.addNewPatient(newPatient) def editPatient(self, oldPatient): self.crtlDatabase.editPatient(oldPatient) def patientValid(self, AN): return self.crtlDatabase.patientValid(AN) def oldPatientValid(self, AN, patient_name): return self.crtlDatabase.oldPatientValid(AN, patient_name) def getPatientByCaseId(self, case_id): return self.crtlDatabase.getPatientByCaseId(case_id, self.user.id)