Пример #1
0
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.resize(320, 105)
        self.setMaximumSize(self.size())
        self.setMinimumSize(self.size())
        self.setModal(True)
        self.setLayout(QGridLayout())

        self.nameLabel = QLabel(self)
        self.layout().addWidget(self.nameLabel, 0, 0)

        self.nameLineEdit = QLineEdit(self)
        self.layout().addWidget(self.nameLineEdit, 0, 1)

        self.typeLabel = QLabel(self)
        self.layout().addWidget(self.typeLabel, 1, 0)

        self.typeComboBox = QComboBox(self)
        for cue_class in CueSettingsRegistry().ref_classes():
            self.typeComboBox.addItem(translate('CueName', cue_class.Name),
                                      cue_class.__name__)
        self.layout().addWidget(self.typeComboBox, 1, 1)

        self.dialogButtons = QDialogButtonBox(self)
        self.dialogButtons.setStandardButtons(QDialogButtonBox.Ok
                                              | QDialogButtonBox.Cancel)
        self.dialogButtons.accepted.connect(self.accept)
        self.dialogButtons.rejected.connect(self.reject)
        self.layout().addWidget(self.dialogButtons, 2, 0, 1, 2)

        self.layout().setColumnStretch(0, 1)
        self.layout().setColumnStretch(1, 3)

        self.retranslateUi()
Пример #2
0
    def __init__(self):
        super().__init__()
        self.__handlers = {}

        # Register a Cue property to store settings
        Cue.register_property('triggers', Property({}))
        # Cue.triggers -> {trigger: [(target_id, action), ...]}

        # Register SettingsPage
        CueSettingsRegistry().add_item(TriggersSettings)

        Application().cue_model.item_added.connect(self.__cue_added)
        Application().cue_model.item_removed.connect(self.__cue_removed)
Пример #3
0
    def __init__(self):
        # Initialize GStreamer
        Gst.init(None)

        # Register GStreamer settings widgets
        AppSettings.register_settings_widget(GstSettings)
        # Add MediaCue settings widget to the CueLayout
        CueSettingsRegistry().add_item(GstMediaSettings, MediaCue)
        # Register the GstMedia cue builder
        register_factories()

        elements.load()
        settings.load()

        backend.set_backend(self)
Пример #4
0
    def __init__(self):
        super().__init__()
        self.__client = OlaTimecode()
        self.__cues = set()

        # Register a new Cue property to store settings
        Cue.register_property('timecode', Property(default={}))

        # Register cue-settings-page
        CueSettingsRegistry().add_item(TimecodeCueSettings, MediaCue)
        # Register pref-settings-page
        AppSettings.register_settings_widget(TimecodeSettings)

        # Watch cue-model changes
        Application().cue_model.item_added.connect(self.__cue_added)
        Application().cue_model.item_removed.connect(self.__cue_removed)
Пример #5
0
    def __init__(self):
        super().__init__()
        self.__map = {}
        self.__actions_map = {}
        self.__protocols = {}

        # Register a new Cue property to store settings
        Cue.register_property('controller', Property(default={}))

        # Listen cue_model changes
        Application().cue_model.item_added.connect(self.__cue_added)
        Application().cue_model.item_removed.connect(self.__cue_removed)

        # Register settings-page
        CueSettingsRegistry().add_item(ControllerSettings)
        # Load available protocols
        self.__load_protocols()
Пример #6
0
    def __init__(self, cue_model, **kwargs):
        super().__init__(cue_model=cue_model, **kwargs)
        self.setLayout(QGridLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)

        self._model_adapter = CueListModel(self._cue_model)
        self._model_adapter.item_added.connect(self.__cue_added)
        self._model_adapter.item_removed.connect(self.__cue_removed)

        self._playing_model = RunningCueModel(self._cue_model)
        self._context_item = None
        self._next_cue_index = 0

        self._show_dbmeter = config['ListLayout'].getboolean('ShowDbMeters')
        self._seek_visible = config['ListLayout'].getboolean('ShowSeek')
        self._accurate_time = config['ListLayout'].getboolean('ShowAccurate')
        self._auto_continue = config['ListLayout'].getboolean('AutoContinue')
        self._show_playing = config['ListLayout'].getboolean('ShowPlaying')
        self._go_key = config['ListLayout']['GoKey']
        self._go_key_sequence = QKeySequence(self._go_key,
                                             QKeySequence.NativeText)

        try:
            self._end_list = EndListBehavior(config['ListLayout']['EndList'])
        except ValueError:
            self._end_list = EndListBehavior.Stop

        # Add layout-specific menus
        self.showPlayingAction = QAction(self)
        self.showPlayingAction.setCheckable(True)
        self.showPlayingAction.setChecked(self._show_playing)
        self.showPlayingAction.triggered.connect(self.set_playing_visible)

        self.showDbMeterAction = QAction(self)
        self.showDbMeterAction.setCheckable(True)
        self.showDbMeterAction.setChecked(self._show_dbmeter)
        self.showDbMeterAction.triggered.connect(self.set_dbmeter_visible)

        self.showSeekAction = QAction(self)
        self.showSeekAction.setCheckable(True)
        self.showSeekAction.setChecked(self._seek_visible)
        self.showSeekAction.triggered.connect(self.set_seek_visible)

        self.accurateTimingAction = QAction(self)
        self.accurateTimingAction.setCheckable(True)
        self.accurateTimingAction.setChecked(self._accurate_time)
        self.accurateTimingAction.triggered.connect(self.set_accurate_time)

        self.autoNextAction = QAction(self)
        self.autoNextAction.setCheckable(True)
        self.autoNextAction.setChecked(self._auto_continue)
        self.autoNextAction.triggered.connect(self.set_auto_next)

        MainWindow().menuLayout.addAction(self.showPlayingAction)
        MainWindow().menuLayout.addAction(self.showDbMeterAction)
        MainWindow().menuLayout.addAction(self.showSeekAction)
        MainWindow().menuLayout.addAction(self.accurateTimingAction)
        MainWindow().menuLayout.addAction(self.autoNextAction)

        # GO-BUTTON (top-left)
        self.goButton = QPushButton('GO', self)
        self.goButton.setFocusPolicy(Qt.NoFocus)
        self.goButton.setFixedWidth(120)
        self.goButton.setFixedHeight(100)
        self.goButton.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding)
        self.goButton.setStyleSheet('font-size: 48pt;')
        self.goButton.clicked.connect(self.__go_slot)
        self.layout().addWidget(self.goButton, 0, 0)

        # INFO PANEL (top center)
        self.infoPanel = InfoPanel()
        self.infoPanel.setFixedHeight(100)
        self.layout().addWidget(self.infoPanel, 0, 1)

        # CONTROL-BUTTONS (top-right)
        self.controlButtons = ShowControlButtons(parent=self)
        self.controlButtons.setFixedHeight(100)
        self.controlButtons.stopButton.clicked.connect(self.stop_all)
        self.controlButtons.pauseButton.clicked.connect(self.pause_all)
        self.controlButtons.fadeInButton.clicked.connect(self.fadein_all)
        self.controlButtons.fadeOutButton.clicked.connect(self.fadeout_all)
        self.controlButtons.resumeButton.clicked.connect(self.restart_all)
        self.controlButtons.interruptButton.clicked.connect(self.interrupt_all)
        self.layout().addWidget(self.controlButtons, 0, 2)

        # CUE VIEW (center left)
        self.listView = CueListView(self._model_adapter, self)
        self.listView.itemDoubleClicked.connect(self.double_clicked)
        self.listView.currentItemChanged.connect(self.__current_changed)
        self.listView.context_event.connect(self.context_event)
        self.listView.key_event.connect(self.onKeyPressEvent)
        self.listView.select_cue_event.connect(self.select_event)
        self.layout().addWidget(self.listView, 1, 0, 1, 2)

        # PLAYING VIEW (center right)
        self.playView = RunningCuesListWidget(self._playing_model, parent=self)
        self.playView.dbmeter_visible = self._show_dbmeter
        self.playView.accurate_time = self._accurate_time
        self.playView.seek_visible = self._seek_visible
        self.playView.setMinimumWidth(300)
        self.playView.setMaximumWidth(300)
        self.layout().addWidget(self.playView, 1, 2)

        self.set_playing_visible(self._show_playing)

        # TODO: maybe can be moved outside the layout
        # Add cue preferences widgets
        CueSettingsRegistry().add_item(CueGeneralSettings, Cue)
        CueSettingsRegistry().add_item(MediaCueSettings, MediaCue)
        CueSettingsRegistry().add_item(Appearance)

        # Context menu actions
        self.edit_action = QAction(self)
        self.edit_action.triggered.connect(self.edit_context_cue)

        self.remove_action = QAction(self)
        self.remove_action.triggered.connect(self.remove_context_cue)

        self.select_action = QAction(self)
        self.select_action.triggered.connect(self.select_context_cue)

        self.cm_registry.add_item(self.edit_action)
        self.sep1 = self.cm_registry.add_separator()
        self.cm_registry.add_item(self.remove_action)
        self.cm_registry.add_item(self.select_action)

        self.retranslateUi()
        return conf

    def load_settings(self, settings):
        cue = Application().cue_model.get(settings.get('target_id', ''))
        if cue is not None:
            self.cue_id = settings['target_id']
            self.cueLabel.setText(cue.name)

        self.volumeEdit.setValue(settings.get('volume', 0) * 100)
        self.fadeSpin.setValue(settings.get('duration', 0) / 1000)
        self.fadeCurveCombo.setCurrentType(settings.get('fade_type', ''))

    def __volume_change(self, value):
        if not self.__v_edit_flag:
            try:
                self.__v_edit_flag = True
                self.volumeDbEdit.setValue(linear_to_db(value / 100))
            finally:
                self.__v_edit_flag = False

    def __db_volume_change(self, value):
        if not self.__v_edit_flag:
            try:
                self.__v_edit_flag = True
                self.volumeEdit.setValue(db_to_linear(value) * 100)
            finally:
                self.__v_edit_flag = False


CueSettingsRegistry().add_item(VolumeSettings, VolumeControl)
Пример #8
0
                    QTime.fromMSecsSinceStartOfDay(cue.media.duration))
                self.cueLabel.setText(cue.name)

    def enable_check(self, enabled):
        self.cueGroup.setCheckable(enabled)
        self.cueGroup.setChecked(False)

        self.seekGroup.setCheckable(enabled)
        self.seekGroup.setChecked(False)

    def get_settings(self):
        return {
            'target_id': self.cue_id,
            'time': self.seekEdit.time().msecsSinceStartOfDay()
        }

    def load_settings(self, settings):
        if settings is not None:
            cue = Application().cue_model.get(settings.get('target_id'))
            if cue is not None:
                self.cue_id = settings['target_id']
                self.seekEdit.setMaximumTime(
                    QTime.fromMSecsSinceStartOfDay(cue.media.duration))
                self.cueLabel.setText(cue.name)

            self.seekEdit.setTime(
                QTime.fromMSecsSinceStartOfDay(settings.get('time', 0)))


CueSettingsRegistry().add_item(SeekCueSettings, SeekCue)
        if not (checkable and not self.indexGroup.isChecked()):
            conf['relative'] = self.relativeCheck.isChecked()
            conf['target_index'] = self.targetIndexSpin.value()
        if not (checkable and not self.actionGroup.isChecked()):
            conf['action'] = self.actionCombo.currentData()

        return conf

    def load_settings(self, settings):
        self._cue_index = settings.get('index', -1)

        self.relativeCheck.setChecked(settings.get('relative', True))
        self.targetIndexSpin.setValue(settings.get('target_index', -1))
        self.actionCombo.setCurrentText(
            translate('CueAction', settings.get('action', '')))

    def _relative_changed(self):
        max_index = len(Application().cue_model) - 1

        if not self.relativeCheck.isChecked():
            self.targetIndexSpin.setRange(0, max_index)
        else:
            if self._cue_index >= 0:
                self.targetIndexSpin.setRange(-self._cue_index,
                                              max_index - self._cue_index)
            else:
                self.targetIndexSpin.setRange(-max_index, max_index)


CueSettingsRegistry().add_item(IndexActionCueSettings, IndexActionCue)
Пример #10
0
            CueSelectionDelegate(cue_select),
            CueActionDelegate()
        ]

        for column, delegate in enumerate(self.delegates):
            self.setItemDelegateForColumn(column, delegate)


class CollectionModel(SimpleCueListModel):
    def __init__(self):
        # NOTE: The model does fixed-indices operations based on this list
        super().__init__([
            translate('CollectionCue', 'Cue'),
            translate('CollectionCue', 'Action')
        ])

    def setData(self, index, value, role=Qt.DisplayRole):
        result = super().setData(index, value, role)

        if result and role == CueClassRole:
            if self.rows[index.row()][1] not in value.CueActions:
                self.rows[index.row()][1] = value.CueActions[0]
                self.dataChanged.emit(self.index(index.row(), 1),
                                      self.index(index.row(), 1),
                                      [Qt.DisplayRole, Qt.EditRole])

        return result


CueSettingsRegistry().add_item(CollectionCueSettings, CollectionCue)
Пример #11
0
                CueAction.FadeOutPause, CueAction.Interrupt,
                CueAction.FadeOutInterrupt
        ]:
            self.actionCombo.addItem(translate('CueAction', action.name),
                                     action.value)
        self.group.layout().addWidget(self.actionCombo)

        self.retranslateUi()

    def retranslateUi(self):
        self.group.setTitle(translate('StopAll', 'Stop Action'))

    def enable_check(self, enabled):
        self.group.setCheckable(enabled)
        self.group.setChecked(False)

    def get_settings(self):
        conf = {}

        if not (self.group.isCheckable() and not self.group.isChecked()):
            conf['action'] = self.actionCombo.currentData()

        return conf

    def load_settings(self, settings):
        self.actionCombo.setCurrentText(
            translate('CueAction', settings.get('action', '')))


CueSettingsRegistry().add_item(StopAllSettings, StopAll)
Пример #12
0
        if enabled:
            self.killCheckBox.setCheckState(Qt.PartiallyChecked)

        self.killCheckBox.setTristate(enabled)
        if enabled:
            self.killCheckBox.setCheckState(Qt.PartiallyChecked)

    def load_settings(self, settings):
        self.commandLineEdit.setText(settings.get('command', ''))
        self.noOutputCheckBox.setChecked(settings.get('no_output', True))
        self.noErrorCheckBox.setChecked(settings.get('no_error', True))
        self.killCheckBox.setChecked(settings.get('kill', False))

    def get_settings(self):
        settings = {}

        if not (self.group.isCheckable() and not self.group.isChecked()):
            if self.commandLineEdit.text().strip():
                settings['command'] = self.commandLineEdit.text()
        if self.noOutputCheckBox.checkState() != Qt.PartiallyChecked:
            settings['no_output'] = self.noOutputCheckBox.isChecked()
        if self.noErrorCheckBox.checkState() != Qt.PartiallyChecked:
            settings['no_error'] = self.noErrorCheckBox.isChecked()
        if self.killCheckBox.checkState() != Qt.PartiallyChecked:
            settings['kill'] = self.killCheckBox.isChecked()

        return settings


CueSettingsRegistry().add_item(CommandCueSettings, CommandCue)
Пример #13
0
                    *self.ATTRIBUTES_RANGE.get(attr_name, (0, 0, 0))[0:2])

    def get_settings(self):
        msg_type = self.msgTypeCombo.currentText()
        msg_dict = {'type': msg_type}

        for label, spin, attr_name in self.__attributes(msg_type):
            if spin.isEnabled():
                offset = self.ATTRIBUTES_RANGE.get(attr_name, (0, 0, 0))[2]
                msg_dict[attr_name] = spin.value() + offset

        return {'message': dict_msg_to_str(msg_dict)}

    def __attributes(self, msg_type):
        for (label, spin), attr in zip(self._data_widgets,
                                       self.MSGS_ATTRIBUTES[msg_type]):
            yield label, spin, attr

    def load_settings(self, settings):
        str_msg = settings.get('message', '')
        if str_msg:
            dict_msg = str_msg_to_dict(str_msg)
            self.msgTypeCombo.setCurrentText(dict_msg['type'])

            for label, spin, attr_name in self.__attributes(dict_msg['type']):
                offset = self.ATTRIBUTES_RANGE.get(attr_name, (0, 0, 0))[2]
                spin.setValue(dict_msg.get(label.text().lower(), 0) - offset)


CueSettingsRegistry().add_item(MidiCueSettings, MidiCue)
Пример #14
0
    def __init__(self, cue_model, **kwargs):
        super().__init__(cue_model=cue_model, **kwargs)
        self.tabBar().setObjectName('CartTabBar')

        self.__columns = int(config['CartLayout']['GridColumns'])
        self.__rows = int(config['CartLayout']['GridRows'])
        self.__pages = []
        self.__context_widget = None

        self._show_seek = config['CartLayout'].getboolean('ShowSeek')
        self._show_dbmeter = config['CartLayout'].getboolean('ShowDbMeters')
        self._show_volume = config['CartLayout'].getboolean('ShowVolume')
        self._accurate_timing = config['CartLayout'].getboolean('ShowAccurate')
        self._countdown_mode = config['CartLayout'].getboolean('CountDown')
        self._auto_add_page = config['CartLayout'].getboolean('AutoAddPage')

        self._model_adapter = CueCartModel(cue_model, self.__rows,
                                           self.__columns)
        self._model_adapter.item_added.connect(self.__cue_added,
                                               Connection.QtQueued)
        self._model_adapter.item_removed.connect(self.__cue_removed,
                                                 Connection.QtQueued)
        self._model_adapter.item_moved.connect(self.__cue_moved,
                                               Connection.QtQueued)
        self._model_adapter.model_reset.connect(self.__model_reset)

        # Add layout-specific menus
        self.new_page_action = QAction(self)
        self.new_page_action.triggered.connect(self.add_page)
        self.new_pages_action = QAction(self)
        self.new_pages_action.triggered.connect(self.add_pages)
        self.rm_current_page_action = QAction(self)
        self.rm_current_page_action.triggered.connect(self.remove_current_page)

        self.countdown_mode = QAction(self)
        self.countdown_mode.setCheckable(True)
        self.countdown_mode.setChecked(self._countdown_mode)
        self.countdown_mode.triggered.connect(self.set_countdown_mode)

        self.show_seek_action = QAction(self)
        self.show_seek_action.setCheckable(True)
        self.show_seek_action.setChecked(self._show_seek)
        self.show_seek_action.triggered.connect(self.set_seek_visible)

        self.show_dbmeter_action = QAction(self)
        self.show_dbmeter_action.setCheckable(True)
        self.show_dbmeter_action.setChecked(self._show_dbmeter)
        self.show_dbmeter_action.triggered.connect(self.set_dbmeter_visible)

        self.show_volume_action = QAction(self)
        self.show_volume_action.setCheckable(True)
        self.show_volume_action.setChecked(self._show_volume)
        self.show_volume_action.triggered.connect(self.set_volume_visible)

        self.show_accurate_action = QAction(self)
        self.show_accurate_action.setCheckable(True)
        self.show_accurate_action.setChecked(self._accurate_timing)
        self.show_accurate_action.triggered.connect(self.set_accurate)

        layoutMenu = MainWindow().menuLayout
        layoutMenu.addAction(self.new_page_action)
        layoutMenu.addAction(self.new_pages_action)
        layoutMenu.addAction(self.rm_current_page_action)
        layoutMenu.addSeparator()
        layoutMenu.addAction(self.countdown_mode)
        layoutMenu.addAction(self.show_seek_action)
        layoutMenu.addAction(self.show_dbmeter_action)
        layoutMenu.addAction(self.show_volume_action)
        layoutMenu.addAction(self.show_accurate_action)

        # TODO: maybe can be moved outside the layout
        # Add cue preferences widgets
        CueSettingsRegistry().add_item(CueGeneralSettings, Cue)
        CueSettingsRegistry().add_item(MediaCueSettings, MediaCue)
        CueSettingsRegistry().add_item(Appearance)

        # Cue(s) context-menu actions
        self.edit_action = QAction(self)
        self.edit_action.triggered.connect(self._edit_cue_action)
        self.cm_registry.add_item(self.edit_action)

        self.sep1 = self.cm_registry.add_separator()

        self.remove_action = QAction(self)
        self.remove_action.triggered.connect(self._remove_cue_action)
        self.cm_registry.add_item(self.remove_action)

        self.select_action = QAction(self)
        self.select_action.triggered.connect(self.select_context_cue)
        self.cm_registry.add_item(self.select_action)

        self.sep2 = self.cm_registry.add_separator(MediaCue)

        # MediaCue(s) context-menu actions
        self.play_action = QAction(self)
        self.play_action.triggered.connect(self._play_context_cue)
        self.cm_registry.add_item(self.play_action, MediaCue)

        self.pause_action = QAction(self)
        self.pause_action.triggered.connect(self._pause_context_cue)
        self.cm_registry.add_item(self.pause_action, MediaCue)

        self.stop_action = QAction(self)
        self.stop_action.triggered.connect(self._stop_context_cue)
        self.cm_registry.add_item(self.stop_action, MediaCue)

        self.reset_volume_action = QAction(self)
        self.reset_volume_action.triggered.connect(self._reset_cue_volume)
        self.cm_registry.add_item(self.reset_volume_action, MediaCue)

        self.setAcceptDrops(True)
        self.retranslateUi()

        self.add_page()