Ejemplo n.º 1
0
    def __init__(self, parent=None, flags=0):
        super().__init__(parent)

        uic.loadUi('ui/fullscreenToolbar.ui', self)

        self.setWindowFlags(Qt.Tool|Qt.Widget|Qt.FramelessWindowHint);
        self.setAttribute(Qt.WA_NoSystemBackground, True);
        self.setAttribute(Qt.WA_TranslucentBackground, True); 

        app = QApplication.instance()
        settings = app.settings_manager

        if settings.value("player/volume"):
            self.volume_slider.setValue(int(settings.value("player/volume")))

        parent.playback_started.connect(self.video_playback_started)
        parent.playback_paused.connect(self.video_playback_paused)
        parent.playback_stopped.connect(self.video_playback_stopped)
        parent.playback_error.connect(self.video_playback_error)
        parent.volume_changed.connect(self.video_volume_changed)

        self.play_btn.clicked.connect(self.play_btn_clicked)
        self.stop_btn.clicked.connect(self.stop_btn_clicked)
        self.fullscreen_btn.clicked.connect(self.switch_fullscreen_mode)
        self.volume_slider.sliderMoved.connect(self.volume_changed)

        self.timer = None
        self.epg = None
        self.epg_list = []

        # Set custom icons
        self.play_btn.setIcon(TXIcon('icons/play-button.svg', Qt.white))
        self.stop_btn.setIcon(TXIcon('icons/stop-button.svg', Qt.white))
        self.fullscreen_btn.setIcon(TXIcon('icons/unfullscreen.svg', Qt.white))

        self.show_progress.hide()
Ejemplo n.º 2
0
 def video_playback_error(self, channel):
     if channel.play_index + 1 < len(channel.streamurls):
         self.progress_bar.setMinimum(0)
         self.progress_bar.setMaximum(0)
         self.progress_bar.show()
         self.progress_label.setText(
             self.tr("Retrying: {0} ({1})".format(
                 channel.name, channel.streamurls[channel.play_index + 1])))
         self.video_player.play_channel(channel, channel.play_index + 1)
     else:
         self.play_btn.setIcon(TXIcon('icons/play-button.svg'))
         self.progress_label.setText(
             self.tr("Channel not available: {0}".format(channel.name)))
         self.progress_bar.hide()
         self.progress_bar.setMaximum(1)
Ejemplo n.º 3
0
    def contextMenuEvent(self, event):
        current_item = self.currentItem()
        play_menu_actions = []

        menu = QMenu(self)
        play_action = menu.addAction(TXIcon('icons/play-button.svg'),
                                     self.tr("Play"))
        if len(current_item.channel.streamurls) > 1:
            play_action.setVisible(False)
            play_menu = menu.addMenu(TXIcon('icons/play-button.svg'),
                                     self.tr("Play"))
            for streamurl in current_item.channel.streamurls:
                play_menu_actions.append(play_menu.addAction(streamurl))
        record_action = menu.addAction(TXIcon('icons/record-button.svg'),
                                       self.tr("Record"))
        menu.addSeparator()
        info_action = menu.addAction(TXIcon('icons/information.svg'),
                                     self.tr("Channel info"))
        epg_action = menu.addAction(TXIcon('icons/calendar-icon.svg'),
                                    self.tr("EPG"))
        menu.addSeparator()
        delete_action = menu.addAction(TXIcon('icons/trash.svg'),
                                       self.tr("Delete channel"))
        undelete_action = menu.addAction(TXIcon('icons/untrash.svg'),
                                         self.tr("Undelete channel"))
        if current_item.channel.id not in self.deleted_channels:
            undelete_action.setVisible(False)
        else:
            delete_action.setVisible(False)
        action = menu.exec_(self.mapToGlobal(event.pos()))

        if action in play_menu_actions:
            self.channelActivated.emit(current_item.channel,
                                       play_menu_actions.index(action))
        elif action == play_action:
            self.channelActivated.emit(current_item.channel, 0)
        elif action == delete_action:
            self.deleteChannel(current_item.channel)
        elif action == undelete_action:
            self.undeleteChannel(current_item.channel)
        elif action == info_action:
            self.showChannelInfo(current_item.channel)
        elif action == epg_action:
            self.showChannelEPG(current_item.channel)
Ejemplo n.º 4
0
 def video_playback_error(self, channel):
     self.play_btn.setIcon(TXIcon('icons/play-button.svg', Qt.white))
Ejemplo n.º 5
0
 def video_playback_started(self, channel):
     self.play_btn.setIcon(TXIcon('icons/pause-button.svg', Qt.white))
     self.osd_channel_name.setText(channel.name)
     self.epg = EPGRetriever(channel, datetime.datetime.now().strftime("%Y-%m-%d"))
     self.epg.epg_data_available.connect(self.epg_data_available)
     self.epg.retrieve_epg()
Ejemplo n.º 6
0
 def video_playback_stopped(self, channel):
     self.play_btn.setIcon(TXIcon('icons/play-button.svg'))
     self.progress_label.setText(self.tr("Idle"))
     self.progress_bar.hide()
     self.progress_bar.setMaximum(1)
Ejemplo n.º 7
0
 def video_playback_paused(self, channel):
     self.play_btn.setIcon(TXIcon('icons/play-button.svg'))
Ejemplo n.º 8
0
    def __init__(self, parent):
        super(QMainWindow, self).__init__(parent)
        uic.loadUi('ui/mainWindow.ui', self)

        self.play_btn.clicked.connect(self.play_btn_clicked)
        self.stop_btn.clicked.connect(self.stop_btn_clicked)
        self.fullscreen_btn.clicked.connect(self.switch_fullscreen_mode)
        self.volume_slider.sliderMoved.connect(self.volume_changed)
        self.tv_channel_list.channelActivated.connect(self.activated_channel)
        self.radio_channel_list.channelActivated.connect(
            self.activated_channel)

        self.video_player.playback_started.connect(self.video_playback_started)
        self.video_player.playback_paused.connect(self.video_playback_paused)
        self.video_player.playback_stopped.connect(self.video_playback_stopped)
        self.video_player.playback_error.connect(self.video_playback_error)
        self.video_player.volume_changed.connect(self.video_volume_changed)
        self.video_player.chromecast_available.connect(
            self.chromecast_available)
        self.video_player.chromecast_connected.connect(
            self.chromecast_connected)

        self.chlist_manager = ChannelListManager()
        self.chlist_manager.channel_added.connect(self.channel_added)
        self.chlist_manager.channellist_available.connect(
            self.channel_list_available)

        self.statusbar.addPermanentWidget(self.bottom_bar, 1)
        self.splitter.setStretchFactor(1, 1)
        self.progress_bar.hide()
        self.progress_label.setText(self.tr("Idle"))
        self.video_player.set_volume(self.volume_slider.value())

        self.channellist_show_actiongroup = QActionGroup(self)
        self.channellist_show_actiongroup.triggered.connect(
            self.show_channel_list)
        chlist_showall_action = QAction(self.tr("All"), self.menu_show_chlist)
        chlist_showall_action.setCheckable(True)
        chlist_showall_action.setChecked(True)
        chlist_showall_action.setActionGroup(self.channellist_show_actiongroup)
        self.menu_show_chlist.addAction(chlist_showall_action)

        os_type = platform.system()
        log.info('Detected OS type: {0}'.format(os_type))
        if os_type == 'Darwin':
            from AppKit import NSWindow, NSUserDefaults
            NSWindow.setAllowsAutomaticWindowTabbing_(False)
            NSUserDefaults.standardUserDefaults().setBool_forKey_(
                False, "NSFullScreenMenuItemEverywhere")
            self.playlist_tab_widget.setDocumentMode(True)

            channel_list_action = self.menubar.actions()[0].menu().actions()[0]
            preferences_list_action = self.menubar.actions()[0].menu().actions(
            )[1]
            self.menubar.removeAction(self.menubar.actions()[0])
            channel_list_action.menu().addAction(preferences_list_action)
            self.menubar.insertAction(self.menubar.actions()[0],
                                      channel_list_action)

        self.load_settings()

        # Set custom icons
        self.play_btn.setIcon(TXIcon('icons/play-button.svg'))
        self.stop_btn.setIcon(TXIcon('icons/stop-button.svg'))
        self.fullscreen_btn.setIcon(TXIcon('icons/fullscreen.svg'))
        self.cast_btn.setIcon(TXIcon('icons/cast.svg'))

        self.cast_label_pixmap.setHidden(True)
        self.cast_label.setHidden(True)
        self.cast_btn.hide()
Ejemplo n.º 9
0
 def video_playback_started(self, channel):
     self.play_btn.setIcon(TXIcon('icons/pause-button.svg'))
     self.progress_bar.hide()
     self.progress_bar.setMaximum(1)
     self.progress_label.setText(
         self.tr("Now playing: {0}".format(channel.name)))