示例#1
0
    def __init__(self, parent=None):
        QtWidgets.QWidget.__init__(self, parent)
        self.clinician_select_model = ClinicianSelectModel(self)

        self.clinicianSelection_comboBox = QtWidgets.QComboBox()
        self.clinicianSelection_comboBox.setModel(self.clinician_select_model)

        mode_but = QtWidgets.QPushButton("....")
        mode_but.setMaximumWidth(40)
        self.mode_label = QtWidgets.QLabel(_("Browsing Mode"))

        mode_frame = QtWidgets.QWidget()
        mode_layout = QtWidgets.QHBoxLayout(mode_frame)
        mode_layout.setContentsMargins(0, 0, 0, 0)
        mode_layout.addWidget(self.mode_label)
        mode_layout.addWidget(mode_but)

        layout = QtWidgets.QVBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self.clinicianSelection_comboBox)
        layout.addWidget(mode_frame)

        self.clinicianSelection_comboBox.currentIndexChanged.connect(
            self.update_needed.emit)
        mode_but.clicked.connect(self.change_appt_mode)
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.clinician_select_model = ClinicianSelectModel(self)

        self.clinicianSelection_comboBox = QtGui.QComboBox()
        self.clinicianSelection_comboBox.setModel(self.clinician_select_model)

        mode_but = QtGui.QPushButton("....")
        mode_but.setMaximumWidth(40)
        self.mode_label = QtGui.QLabel(_("Browsing Mode"))

        mode_frame = QtGui.QWidget()
        mode_layout = QtGui.QHBoxLayout(mode_frame)
        mode_layout.setMargin(0)
        mode_layout.addWidget(self.mode_label)
        mode_layout.addWidget(mode_but)

        layout = QtGui.QVBoxLayout(self)
        layout.setMargin(0)
        layout.addWidget(self.clinicianSelection_comboBox)
        layout.addWidget(mode_frame)

        self.clinicianSelection_comboBox.currentIndexChanged.connect(
            self.update_needed.emit)
        mode_but.clicked.connect(self.change_appt_mode)
class DiaryViewController(QtGui.QWidget):
    VIEW_MODE = 0
    SCHEDULING_MODE = 1
    BLOCKING_MODE = 2
    NOTES_MODE = 3

    mode = VIEW_MODE

    update_needed = QtCore.pyqtSignal()
    apt_mode_changed = QtCore.pyqtSignal(object)

    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.clinician_select_model = ClinicianSelectModel(self)

        self.clinicianSelection_comboBox = QtGui.QComboBox()
        self.clinicianSelection_comboBox.setModel(self.clinician_select_model)

        mode_but = QtGui.QPushButton("....")
        mode_but.setMaximumWidth(40)
        self.mode_label = QtGui.QLabel(_("Browsing Mode"))

        mode_frame = QtGui.QWidget()
        mode_layout = QtGui.QHBoxLayout(mode_frame)
        mode_layout.setMargin(0)
        mode_layout.addWidget(self.mode_label)
        mode_layout.addWidget(mode_but)

        layout = QtGui.QVBoxLayout(self)
        layout.setMargin(0)
        layout.addWidget(self.clinicianSelection_comboBox)
        layout.addWidget(mode_frame)

        self.clinicianSelection_comboBox.currentIndexChanged.connect(
            self.update_needed.emit)
        mode_but.clicked.connect(self.change_appt_mode)

    def set_mode(self, mode):
        if self.mode == mode:
            return
        self.mode = mode
        if self.mode == self.SCHEDULING_MODE:
            value = _("Scheduling Mode")
        elif self.mode == self.BLOCKING_MODE:
            value = _("Blocking Mode")
        elif self.mode == self.NOTES_MODE:
            value = _("Notes Mode")
        else:
            value = _("Browsing Mode")

        self.mode_label.setText(value)
        self.apt_mode_changed.emit(self.mode)

    def change_appt_mode(self):
        dl = ApptModeDialog(self)
        if dl.exec_():
            self.set_mode(dl.mode)

    def clinician_days(self, adate):
        i = self.clinicianSelection_comboBox.currentIndex()
        return tuple(self.clinician_select_model.clinician_list(i, adate))

    def clinician_list(self, adate):
        '''
        get a list of DentistDay types to who the diaries on for a given date
        '''
        clinician_list = []
        for dent in self.clinician_days(adate):
            clinician_list.append(dent.ix)
        return tuple(clinician_list)
示例#4
0
class DiaryViewController(QtWidgets.QWidget):
    VIEW_MODE = 0
    SCHEDULING_MODE = 1
    BLOCKING_MODE = 2
    NOTES_MODE = 3

    mode = VIEW_MODE

    update_needed = QtCore.pyqtSignal()
    apt_mode_changed = QtCore.pyqtSignal(object)

    def __init__(self, parent=None):
        QtWidgets.QWidget.__init__(self, parent)
        self.clinician_select_model = ClinicianSelectModel(self)

        self.clinicianSelection_comboBox = QtWidgets.QComboBox()
        self.clinicianSelection_comboBox.setModel(self.clinician_select_model)

        mode_but = QtWidgets.QPushButton("....")
        mode_but.setMaximumWidth(40)
        self.mode_label = QtWidgets.QLabel(_("Browsing Mode"))

        mode_frame = QtWidgets.QWidget()
        mode_layout = QtWidgets.QHBoxLayout(mode_frame)
        mode_layout.setContentsMargins(0, 0, 0, 0)
        mode_layout.addWidget(self.mode_label)
        mode_layout.addWidget(mode_but)

        layout = QtWidgets.QVBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self.clinicianSelection_comboBox)
        layout.addWidget(mode_frame)

        self.clinicianSelection_comboBox.currentIndexChanged.connect(
            self.update_needed.emit)
        mode_but.clicked.connect(self.change_appt_mode)

    def set_mode(self, mode):
        if self.mode == mode:
            return
        self.mode = mode
        if self.mode == self.SCHEDULING_MODE:
            value = _("Scheduling Mode")
        elif self.mode == self.BLOCKING_MODE:
            value = _("Blocking Mode")
        elif self.mode == self.NOTES_MODE:
            value = _("Notes Mode")
        else:
            value = _("Browsing Mode")

        self.mode_label.setText(value)
        self.apt_mode_changed.emit(self.mode)

    def change_appt_mode(self):
        dl = ApptModeDialog(self)
        if dl.exec_():
            self.set_mode(dl.mode)

    def clinician_days(self, adate):
        i = self.clinicianSelection_comboBox.currentIndex()
        return tuple(self.clinician_select_model.clinician_list(i, adate))

    def clinician_list(self, adate):
        '''
        get a list of DentistDay types to who the diaries on for a given date
        '''
        clinician_list = []
        for dent in self.clinician_days(adate):
            clinician_list.append(dent.ix)
        return tuple(clinician_list)