def show_pt_diary(self): if self.pt is None: QtGui.QMessageBox.information(self, _("error"), _("No patient selected")) return def _find_appt(appt): dl.accept() self.find_appt.emit(appt) def _start_scheduling(): dl.accept() QtCore.QTimer.singleShot(100, self.start_scheduling.emit) pt_diary_widget = PtDiaryWidget() pt_diary_widget.find_appt.connect(_find_appt) pt_diary_widget.start_scheduling.connect(_start_scheduling) pt_diary_widget.appointment_selected.connect( self.appointment_model.set_current_appt) pt_diary_widget.set_patient(self.pt) pt_diary_widget.layout_ptDiary() dl = QtGui.QDialog(self) but_box = QtGui.QDialogButtonBox(dl) but = but_box.addButton(_("Close"), but_box.AcceptRole) but.clicked.connect(dl.accept) layout = QtGui.QVBoxLayout(dl) layout.addWidget(pt_diary_widget) layout.addStretch() layout.addWidget(but_box) dl.exec_() self.appointment_model.load_from_database(self.pt) self.enable_scheduling_buttons() # now force diary relayout self.appointment_selected.emit(self.appointment_model.currentAppt)
def show_pt_diary(self): if self.pt is None: QtWidgets.QMessageBox.information(self, _("error"), _("No patient selected")) return def _find_appt(appt): dl.accept() self.find_appt.emit(appt) def _start_scheduling(custom): ''' if custom, the dialog will be raised giving day of week options etc ''' dl.accept() self.get_data() self.appointment_model.selection_model.reset() appts = pt_diary_widget.selected_appointments self.update_appt_selection(appts) QtCore.QTimer.singleShot(100, partial(self.schedule_signal.emit, custom) ) pt_diary_widget = PtDiaryWidget() pt_diary_widget.find_appt.connect(_find_appt) pt_diary_widget.start_scheduling_signal.connect(_start_scheduling) pt_diary_widget.set_patient(self.pt) dl = BaseDialog(self, remove_stretch=True) dl.insertWidget(pt_diary_widget) dl.cancel_but.setText(_("OK")) dl.apply_but.hide() dl.setMinimumWidth(800) dl.setMaximumWidth(800) if not dl.exec_(): # dialog is only accepted by subroutines above self.appointment_model.load_from_database(self.pt) self.enable_scheduling_buttons()
def show_pt_diary(self): if self.pt is None: QtGui.QMessageBox.information(self, _("error"), _("No patient selected")) return def _find_appt(appt): dl.accept() self.find_appt.emit(appt) def _start_scheduling(): dl.accept() self.get_data() self.appointment_model.selection_model.reset() appts = pt_diary_widget.selected_appointments self.update_appt_selection(appts) QtCore.QTimer.singleShot(100, self.start_scheduling.emit) pt_diary_widget = PtDiaryWidget() pt_diary_widget.find_appt.connect(_find_appt) pt_diary_widget.start_scheduling.connect(_start_scheduling) pt_diary_widget.set_patient(self.pt) dl = QtGui.QDialog(self) but_box = QtGui.QDialogButtonBox(dl) but = but_box.addButton(_("Close"), but_box.AcceptRole) but.clicked.connect(dl.accept) layout = QtGui.QVBoxLayout(dl) layout.addWidget(pt_diary_widget) layout.addStretch() layout.addWidget(but_box) dl.exec_() self.appointment_model.load_from_database(self.pt) self.enable_scheduling_buttons()
def show_pt_diary(self): if self.pt is None: QtWidgets.QMessageBox.information(self, _("error"), _("No patient selected")) return def _find_appt(appt): dl.accept() self.find_appt.emit(appt) def _start_scheduling(custom): ''' if custom, the dialog will be raised giving day of week options etc ''' dl.accept() self.get_data() self.appointment_model.selection_model.reset() appts = pt_diary_widget.selected_appointments self.update_appt_selection(appts) QtCore.QTimer.singleShot( 100, partial(self.schedule_signal.emit, custom)) pt_diary_widget = PtDiaryWidget() pt_diary_widget.find_appt.connect(_find_appt) pt_diary_widget.start_scheduling_signal.connect(_start_scheduling) pt_diary_widget.set_patient(self.pt) dl = BaseDialog(self, remove_stretch=True) dl.insertWidget(pt_diary_widget) dl.cancel_but.setText(_("OK")) dl.apply_but.hide() dl.setMinimumWidth(800) dl.setMaximumWidth(800) if not dl.exec_(): # dialog is only accepted by subroutines above self.appointment_model.load_from_database(self.pt) self.enable_scheduling_buttons()