Example #1
0
 def __init__(self, parent=None):
     QtGui.QWidget.__init__(self, parent)
     self.layout = QtGui.QVBoxLayout(self)
     self.tableWidget = AddDelTableWidget(self)
     self.layout.addWidget(self.tableWidget)
     self.tableWidget.setItemDelegateForColumn(1, TimeDelegate(self))
     self.setModel(StandardEventTimesModel(self))
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.layout = QtGui.QHBoxLayout(self)
        self.list_widget = AddDelTableWidget(self)
        self.layout.addWidget(self.list_widget)
        self.list_widget.objectSelected.connect(self.setEvent)

        self.event_widget = widget_template.EventTemplateWidget(self)
        self.layout.addWidget(self.event_widget)
        self.event_widget.commandIssued.connect(self.emitCommand)
        self.event_widget.criticalCommandIssued.connect(self.emitCriticalCommand)
Example #3
0
class StandardEventTimesWidget(QtGui.QWidget):
    commandIssued = QtCore.pyqtSignal(QtGui.QUndoCommand)
    criticalCommandIssued = QtCore.pyqtSignal()

    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.layout = QtGui.QVBoxLayout(self)
        self.tableWidget = AddDelTableWidget(self)
        self.layout.addWidget(self.tableWidget)
        self.tableWidget.setItemDelegateForColumn(1, TimeDelegate(self))
        self.setModel(StandardEventTimesModel(self))

    def institution(self, i):
        self.tableWidget.update()

    def setModel(self, model):
        self.tableWidget.setModel(model)
        model.commandIssued.connect(self.emitCommand)
        model.criticalCommandIssued.connect(self.emitCriticalCommand)

    @QtCore.pyqtSlot(QtGui.QUndoCommand)
    def emitCommand(self, command):
        self.commandIssued.emit(command)

    @QtCore.pyqtSlot()
    def emitCriticalCommand(self):
        self.criticalCommandIssued.emit()
class EventWidget(QtGui.QWidget):
    commandIssued = QtCore.pyqtSignal(QtGui.QUndoCommand)
    criticalCommandIssued = QtCore.pyqtSignal()

    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.layout = QtGui.QHBoxLayout(self)
        self.list_widget = AddDelTableWidget(self)
        self.layout.addWidget(self.list_widget)
        self.list_widget.objectSelected.connect(self.setEvent)

        self.list_widget.setItemDelegateForColumn(1, DateDelegate(self))

        self.event_widget = widget_event.EventWidget(self)
        self.layout.addWidget(self.event_widget)
        self.event_widget.commandIssued.connect(self.emitCommand)
        self.event_widget.criticalCommandIssued.connect(self.emitCriticalCommand)

    def _set_model(self, model):
        self.list_widget.setModel(model)
        model.commandIssued.connect(self.emitCommand)
        model.criticalCommandIssued.connect(self.emitCriticalCommand)

    @QtCore.pyqtSlot(QtCore.QObject)
    def duration(self, duration):
        model = EventsModel(duration)
        self._set_model(model)
        return model

    @QtCore.pyqtSlot(QtCore.QObject)
    def setEvent(self, item):
        self.event_widget.setEvent(item)

    @QtCore.pyqtSlot(QtGui.QUndoCommand)
    def emitCommand(self, command):
        self.commandIssued.emit(command)

    @QtCore.pyqtSlot()
    def emitCriticalCommand(self):
        self.criticalCommandIssued.emit()
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.layout = QtGui.QHBoxLayout(self)
        self.list_widget = AddDelTableWidget(self)
        self.layout.addWidget(self.list_widget)
        self.list_widget.objectSelected.connect(self.setEvent)

        self.list_widget.setItemDelegateForColumn(1, DateDelegate(self))

        self.event_widget = widget_event.EventWidget(self)
        self.layout.addWidget(self.event_widget)
        self.event_widget.commandIssued.connect(self.emitCommand)
        self.event_widget.criticalCommandIssued.connect(self.emitCriticalCommand)
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.layout = QtGui.QGridLayout(self)

        self.rolesComboBox = QtGui.QComboBox(self)
        self.rolesComboBox.activated.connect(self.roleSelected)
        self.layout.addWidget(self.rolesComboBox, 0, 0, 1, 1)

        self.tableWidget = AddDelTableWidget(self)
        self.layout.addWidget(self.tableWidget, 1, 0, 1, 2)

        self.reset()
        GlobalRoleList.rolesChanged.connect(self.reset)
        self.setModel(AppointmentsTableModel(self))
class AppointmentsListWidget(QtGui.QWidget):
    commandIssued = QtCore.pyqtSignal(QtGui.QUndoCommand)
    criticalCommandIssued = QtCore.pyqtSignal()

    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.layout = QtGui.QGridLayout(self)

        self.rolesComboBox = QtGui.QComboBox(self)
        self.rolesComboBox.activated.connect(self.roleSelected)
        self.layout.addWidget(self.rolesComboBox, 0, 0, 1, 1)

        self.tableWidget = AddDelTableWidget(self)
        self.layout.addWidget(self.tableWidget, 1, 0, 1, 2)

        self.reset()
        GlobalRoleList.rolesChanged.connect(self.reset)
        self.setModel(AppointmentsTableModel(self))

    @QtCore.pyqtSlot(int)
    def roleSelected(self, i):
        role = GlobalRoleList.roles[i]
        self.tableWidget.getModel().roleSelected(role)

    @QtCore.pyqtSlot(int)
    def reset(self):
        self.rolesComboBox.clear()
        self.rolesComboBox.insertItems(0, map(description, GlobalRoleList.roles))

    def setModel(self, model):
        self.tableWidget.setModel(model)
        model.commandIssued.connect(self.emitCommand)
        model.criticalCommandIssued.connect(self.emitCriticalCommand)

    def setEvent(self, newEvent):
        self.tableWidget.getModel().setEvent(newEvent)

    @QtCore.pyqtSlot(QtGui.QUndoCommand)
    def emitCommand(self, command):
        self.commandIssued.emit(command)

    @QtCore.pyqtSlot()
    def emitCriticalCommand(self):
        self.criticalCommandIssued.emit()