Пример #1
0
    def __init__(self, parent=None):
        QtGui.QStackedWidget.__init__(self, parent)
        self.diary_widget = parent
        self.patient_label = QtGui.QLabel()

        icon = QtGui.QIcon(":/search.png")
        self.get_patient_button = QtGui.QPushButton(icon, "")
        self.get_patient_button.setMaximumWidth(40)

        self.appt_listView = DraggableList(self)
        self.block_listView = DraggableList(self)
        self.item_delegate = ColouredItemDelegate(self)

        self.appointment_model = SimpleListModel(self)
        self.appt_listView.setModel(self.appointment_model)
        self.appt_listView.setItemDelegate(self.item_delegate)
        self.appt_listView.setSelectionModel(
            self.appointment_model.selection_model)
        self.appt_listView.setSelectionMode(
            QtGui.QListView.ContiguousSelection)

        block_model = BlockListModel(self)
        self.block_listView.setModel(block_model)

        icon = QtGui.QIcon(":vcalendar.png")
        diary_button = QtGui.QPushButton(icon, _("Diary"))
        diary_button.setToolTip(_("Open the patient's diary"))

        icon = QtGui.QIcon(":settings.png")
        settings_button = QtGui.QPushButton(icon, _("Options"))
        settings_button.setToolTip(_("Appointment Settings"))

        icon = QtGui.QIcon(":back.png")
        self.prev_appt_button = QtGui.QPushButton(icon, "")
        self.prev_appt_button.setToolTip(_("Previous appointment"))

        icon = QtGui.QIcon(":forward.png")
        self.next_appt_button = QtGui.QPushButton(icon, "")
        self.next_appt_button.setToolTip(_("Next available appointment"))

        icon = QtGui.QIcon(":forward.png")
        self.next_day_button = QtGui.QPushButton(icon, "")
        self.next_day_button.setToolTip(_("Next Day or Week"))

        icon = QtGui.QIcon(":back.png")
        self.prev_day_button = QtGui.QPushButton(icon, "")
        self.prev_day_button.setToolTip(_("Previous Day or Week"))

        icon = QtGui.QIcon(":first.png")
        self.first_appt_button = QtGui.QPushButton(icon, "")
        self.first_appt_button.setToolTip(_("First available appointment"))

        self.appt_controls_frame = QtGui.QWidget()
        layout = QtGui.QGridLayout(self.appt_controls_frame)
        layout.setMargin(1)
        layout.setSpacing(2)
        layout.addWidget(diary_button, 0, 0, 1, 2)
        layout.addWidget(settings_button, 0, 3, 1, 2)
        layout.addWidget(self.prev_day_button, 1, 0)
        layout.addWidget(self.prev_appt_button, 1, 1)
        layout.addWidget(self.first_appt_button, 1, 2)
        layout.addWidget(self.next_appt_button, 1, 3)
        layout.addWidget(self.next_day_button, 1, 4)

        self.appt_controls_frame.setSizePolicy(
            QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
                              QtGui.QSizePolicy.Minimum))

        self.search_criteria_webview = QtWebKit.QWebView(self)
        self.search_criteria_webview.setMinimumHeight(100)
        self.search_criteria_webview.setHtml(
            _("No appointment selected for scheduling"))

        # now arrange the stacked widget

        # page 0 - Browsing mode
        self.browsing_webview = QtWebKit.QWebView()
        self.reset_browsing_webview()
        self.addWidget(self.browsing_webview)

        # page 1 -- scheduling mode
        widg = QtGui.QWidget()
        layout = QtGui.QGridLayout(widg)
        layout.setMargin(0)
        layout.addWidget(self.patient_label, 0, 0)
        layout.addWidget(self.get_patient_button, 0, 1)
        layout.addWidget(self.appt_listView, 2, 0, 1, 2)
        layout.addWidget(self.appt_controls_frame, 3, 0, 1, 2)
        layout.addWidget(self.search_criteria_webview, 4, 0, 1, 2)
        self.addWidget(widg)

        # page 2 -- blocking mode
        widg = QtGui.QWidget()
        layout = QtGui.QVBoxLayout(widg)
        layout.addWidget(self.block_listView)
        self.addWidget(widg)

        # page 4 -- notes mode
        self.notes_label = QtGui.QLabel(_("Select a patient to edit notes"))
        self.addWidget(self.notes_label)

        # connect signals
        self.get_patient_button.clicked.connect(self.find_patient)
        settings_button.clicked.connect(self.show_settings_dialog)
        self.prev_appt_button.clicked.connect(self.show_prev_appt)
        self.next_appt_button.clicked.connect(self.show_next_appt)
        self.prev_day_button.clicked.connect(self.show_prev_day)
        self.next_day_button.clicked.connect(self.show_next_day)
        self.first_appt_button.clicked.connect(self.find_first_appointment)

        diary_button.clicked.connect(self.show_pt_diary)

        self.appt_listView.selectionModel().selectionChanged.connect(
            self.selection_changed)
        self.appt_listView.doubleClicked.connect(self.appointment_2x_clicked)
Пример #2
0
    def __init__(self, parent=None):
        QtGui.QStackedWidget.__init__(self, parent)
        self.patient_label = QtGui.QLabel()

        icon = QtGui.QIcon(":/search.png")
        self.get_patient_button = QtGui.QPushButton(icon, "")
        self.get_patient_button.setMaximumWidth(40)

        self.appt_listView = DraggableList(True, self)
        self.block_listView = DraggableList(False, self)

        self.appointment_model = SimpleListModel(self)
        self.appt_listView.setModel(self.appointment_model)
        self.appt_listView.setSelectionModel(
            self.appointment_model.selection_model)
        self.appt_listView.setSelectionMode(QtGui.QListView.SingleSelection)

        block_model = BlockListModel(self)
        self.block_listView.setModel(block_model)

        icon = QtGui.QIcon(":vcalendar.png")
        diary_button = QtGui.QPushButton(icon, "")
        diary_button.setToolTip(_("Open the patient's diary"))

        icon = QtGui.QIcon(":first.png")
        self.first_appt_button = QtGui.QPushButton(icon, "")
        self.first_appt_button.setToolTip(_("Launch the Appointment Wizard"))

        icon = QtGui.QIcon(":back.png")
        self.prev_appt_button = QtGui.QPushButton(icon, "")
        self.prev_appt_button.setToolTip(_("Previous appointment"))

        icon = QtGui.QIcon(":forward.png")
        self.next_appt_button = QtGui.QPushButton(icon, "")
        self.next_appt_button.setToolTip(_("Next available appointment"))

        self.appt_controls_frame = QtGui.QWidget()
        layout = QtGui.QGridLayout(self.appt_controls_frame)
        layout.setMargin(1)
        layout.addWidget(diary_button, 0, 0)
        layout.addWidget(self.first_appt_button, 0, 1)
        layout.addWidget(self.prev_appt_button, 0, 2)
        layout.addWidget(self.next_appt_button, 0, 3)
        self.appt_controls_frame.setSizePolicy(
            QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
                              QtGui.QSizePolicy.Minimum))

        # now arrange the stacked widget

        # page 0 - Browsing mode
        self.addWidget(QtGui.QLabel("Browsing"))

        # page 1 -- scheduling mode
        widg = QtGui.QWidget()
        layout = QtGui.QGridLayout(widg)
        layout.setMargin(0)
        layout.addWidget(self.patient_label, 0, 0)
        layout.addWidget(self.get_patient_button, 0, 1)
        layout.addWidget(self.appt_listView, 2, 0, 1, 2)
        layout.addWidget(self.appt_controls_frame, 3, 0, 1, 2)

        self.addWidget(widg)

        # page 2 -- blocking mode
        widg = QtGui.QWidget()
        layout = QtGui.QVBoxLayout(widg)
        layout.addWidget(self.block_listView)
        self.addWidget(widg)

        # page 4 -- notes mode
        self.addWidget(QtGui.QLabel("Notes"))

        # connect signals

        self.appointment_model.appointment_selected.connect(
            self.update_selected_appointment)

        self.get_patient_button.clicked.connect(self.find_patient)

        self.first_appt_button.clicked.connect(self.show_first_appt)
        self.prev_appt_button.clicked.connect(self.show_prev_appt)
        self.next_appt_button.clicked.connect(self.show_next_appt)

        diary_button.clicked.connect(self.show_pt_diary)

        self.appt_listView.pressed.connect(self.appointment_pressed)
        self.appt_listView.clicked.connect(self.appointment_clicked)
        self.appt_listView.doubleClicked.connect(self.appointment_2x_clicked)
Пример #3
0
    def __init__(self, parent=None):
        QtGui.QDialog.__init__(self, parent)
        self.setWindowTitle("Drag Drop Test")
        self.pt = duckPt()

        layout = QtGui.QGridLayout(self)

        self.model = SimpleListModel()

        appts = appointments.get_pts_appts(duckPt())

        self.model.set_appointments(appts, appts[1])

        self.appt_listView = DraggableList(True)
        self.appt_listView.setModel(self.model)

        self.block_model = BlockListModel()
        self.blockView = DraggableList(False)
        self.blockView.setModel(self.block_model)

        self.book = appointmentwidget.AppointmentWidget("1000", "1200", self)
        self.book.setDentist(1)
        self.book.setStartTime(1015)
        self.book.setEndTime(1145)
        for appoint in ((1, 1030, 1045, 'MCDONALD I', 6155, 'EXAM', '', '', '',
                         1, 73, 0, 0, datetime.datetime.now()),
                        (1, 1115, 1130, 'EMERGENCY', 0, '', '', '', '', -128,
                         0, 0, 0, datetime.datetime.now())):
            self.book.setAppointment(appoint)

        self.OVbook = AppointmentOverviewWidget("1000", "1200", 15, 2, self)

        d1 = appointments.DentistDay(1)
        d1.start = 1015
        d1.end = 1145
        d1.memo = "hello"

        d2 = appointments.DentistDay(4)
        d2.start = 1015
        d2.end = 1145

        self.OVbook.dents = [d1, d2]
        self.OVbook.clear()
        self.OVbook.init_dicts()

        for d in (d1, d2):
            self.OVbook.setStartTime(d)
            self.OVbook.setEndTime(d)
            self.OVbook.setMemo(d)
            self.OVbook.setFlags(d)

        slot = appointments.FreeSlot(datetime.datetime(2009, 2, 2, 10, 45), 1,
                                     20)
        slot2 = appointments.FreeSlot(datetime.datetime(2009, 2, 2, 11, 0o5),
                                      4, 60)

        self.OVbook.addSlot(slot)
        self.OVbook.addSlot(slot2)

        appt = appointments.WeekViewAppointment()
        appt.mpm = 10 * 60 + 30
        appt.length = 15
        appt.dent = 1
        self.OVbook.appts[1] = (appt, )

        emerg = appointments.WeekViewAppointment()
        emerg.mpm = 11 * 60 + 15
        emerg.length = 15
        emerg.reason = "emergency"
        self.OVbook.eTimes[1] = (emerg, )
        self.OVbook.setMinimumWidth(200)

        self.tw = QtGui.QTabWidget(self)
        self.tw.addTab(self.book, "day")
        self.tw.addTab(self.OVbook, "week")

        layout.addWidget(self.appt_listView, 0, 0)
        layout.addWidget(self.blockView, 2, 0)

        layout.addWidget(self.tw, 0, 1, 3, 1)
        # self.tw.setCurrentIndex(1)

        self.model.appointment_selected.connect(slot_catcher)