Пример #1
0
class SingleDurationWidget(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.tabWidget = QtGui.QTabWidget(self)
        self.layout.addWidget(self.tabWidget)

        self.eventsWidget = EventWidget(self)
        self.availabilityWidget = AvailabilitySelectionWidget(self)
        self.vacanciesWidget = VacanciesWidget(self)
        self.checkingWidget = CheckingWidget(self)
        self.reportsWidget = ReportWidget(self)

        self.tabWidget.addTab(self.eventsWidget, "Events")
        self.addComandContributer(self.eventsWidget)
        self.tabWidget.addTab(self.availabilityWidget, "Availability")
        self.addComandContributer(self.availabilityWidget)
        self.tabWidget.addTab(self.vacanciesWidget, "Vacancies")
        self.addComandContributer(self.vacanciesWidget)
        self.tabWidget.addTab(self.checkingWidget,"Checking")
        self.tabWidget.addTab(self.reportsWidget,"Reports")

        self._population_model = None
        self.duration = None

    def setPopulationModel(self, pop_model):
        self._population_model = pop_model
        self.vacanciesWidget.populationModel(self._population_model)
        self.checkingWidget.population(self._population_model.population)
        self.reportsWidget.setPopulationModel(self._population_model)

    def setDuration(self, duration):
        self.duration = duration
        self._event_model = self.eventsWidget.duration(duration)
        if self._population_model:
            self.availabilityWidget.set_models(self._event_model, self._population_model)
        self.vacanciesWidget.eventsModel(self._event_model)
        self.reportsWidget.setEventsModel(self._event_model)
        self.checkingWidget.duration(duration)

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

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

    def addComandContributer(self, otherModel):
        otherModel.commandIssued.connect(self.emitCommand)
        otherModel.criticalCommandIssued.connect(self.emitCriticalCommand)
Пример #2
0
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.layout = QtGui.QVBoxLayout(self)
        self.tabWidget = QtGui.QTabWidget(self)
        self.layout.addWidget(self.tabWidget)

        self.eventsWidget = EventWidget(self)
        self.availabilityWidget = AvailabilitySelectionWidget(self)
        self.vacanciesWidget = VacanciesWidget(self)
        self.checkingWidget = CheckingWidget(self)
        self.reportsWidget = ReportWidget(self)

        self.tabWidget.addTab(self.eventsWidget, "Events")
        self.addComandContributer(self.eventsWidget)
        self.tabWidget.addTab(self.availabilityWidget, "Availability")
        self.addComandContributer(self.availabilityWidget)
        self.tabWidget.addTab(self.vacanciesWidget, "Vacancies")
        self.addComandContributer(self.vacanciesWidget)
        self.tabWidget.addTab(self.checkingWidget,"Checking")
        self.tabWidget.addTab(self.reportsWidget,"Reports")

        self._population_model = None
        self.duration = None