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:
            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)