Exemple #1
0
    def __init__(self):
        super(ConectatePreferences, self).__init__()
        grid = QGridLayout(self)
        grid.setSpacing(20)
        grid.setColumnStretch(1, 10)

        l = QLabel(u"<b>Ingresá tus datos del portal Conectate:</b>")
        l.setTextFormat(Qt.RichText)
        grid.addWidget(l, 0, 0, 1, 2)

        grid.addWidget(QLabel(u"Usuario:"), 1, 0, 2, 1)
        prv = config.get('user', '')
        self.user_entry = QLineEdit(prv)
        self.user_entry.setPlaceholderText(u'Ingresá tu usuario de Conectate')
        grid.addWidget(self.user_entry, 1, 1, 2, 2)

        grid.addWidget(QLabel(u"Contraseña:"), 2, 0, 3, 1)
        prv = config.get('password', '')
        self.password_entry = QLineEdit(prv)
        self.password_entry.setEchoMode(QLineEdit.Password)
        self.password_entry.setPlaceholderText(
            u'Ingresá tu contraseña de Conectate')
        grid.addWidget(self.password_entry, 2, 1, 3, 2)

        self.password_mask = QCheckBox(u'Mostrar contraseña')
        self.password_mask.stateChanged.connect(self._toggle_password_mask)
        grid.addWidget(self.password_mask, 3, 1, 4, 2)

        l = QLabel(u'Si no tenés estos datos, '
                   u'<a href="{}">registrate aquí</a>'.format(URL_CONECTATE))
        l.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        l.setTextFormat(Qt.RichText)
        l.setOpenExternalLinks(True)
        grid.addWidget(l, 4, 0, 5, 3)
Exemple #2
0
    def _setup_target(self, channel, section, season, title, extension):
        """Set up the target file to download."""
        # build where to save it
        downloaddir = config.get('downloaddir', '')
        channel = multiplatform.sanitize(channel)
        section = multiplatform.sanitize(section)
        title = multiplatform.sanitize(title)

        if season is not None:
            season = multiplatform.sanitize(season)
            fname = os.path.join(downloaddir, channel, section, season,
                                 title + extension)
        else:
            fname = os.path.join(downloaddir, channel, section,
                                 title + extension)

        if config.get('clean-filenames'):
            cleaned = clean_fname(fname)
            self.log("Cleaned filename %r into %r", fname, cleaned)
            fname = cleaned

        # if the directory doesn't exist, create it
        dirsecc = os.path.dirname(fname)
        if not os.path.exists(dirsecc):
            os.makedirs(dirsecc)

        tempf = fname + str(time.time())
        return fname, tempf
Exemple #3
0
    def __init__(self):
        super(ConectatePreferences, self).__init__()
        grid = QGridLayout(self)
        grid.setSpacing(20)
        grid.setColumnStretch(1, 10)

        l = QLabel(u"<b>Ingresá tus datos del portal Conectate:</b>")
        l.setTextFormat(Qt.RichText)
        grid.addWidget(l, 0, 0, 1, 2)

        grid.addWidget(QLabel(u"Usuario:"), 1, 0, 2, 1)
        prv = config.get('user', '')
        self.user_entry = QLineEdit(prv)
        self.user_entry.setPlaceholderText(u'Ingresá tu usuario de Conectate')
        grid.addWidget(self.user_entry, 1, 1, 2, 2)

        grid.addWidget(QLabel(u"Contraseña:"), 2, 0, 3, 1)
        prv = config.get('password', '')
        self.password_entry = QLineEdit(prv)
        self.password_entry.setEchoMode(QLineEdit.Password)
        self.password_entry.setPlaceholderText(
            u'Ingresá tu contraseña de Conectate')
        grid.addWidget(self.password_entry, 2, 1, 3, 2)

        self.password_mask = QCheckBox(u'Mostrar contraseña')
        self.password_mask.stateChanged.connect(self._toggle_password_mask)
        grid.addWidget(self.password_mask, 3, 1, 4, 2)

        l = QLabel(u'Si no tenés estos datos, '
                   u'<a href="{}">registrate aquí</a>'.format(URL_CONECTATE))
        l.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        l.setTextFormat(Qt.RichText)
        l.setOpenExternalLinks(True)
        grid.addWidget(l, 4, 0, 5, 3)
Exemple #4
0
    def _download(self, canal, seccion, season, titulo, url, cb_progress):
        """Download an episode to disk."""
        self.cancelled = False

        # levantamos el browser
        qinput = DeferredQueue()
        bquit = Event()
        self.browser_quit.add(bquit)
        authuser = config.get('user', '')
        authpass = config.get('password', '')

        # build where to save it
        fname, tempf = self._setup_target(canal, seccion, season,
                                          titulo, u".avi")
        logger.debug("Downloading to temporal file %r", tempf)

        logger.info("Download episode %r: browser started", url)
        brow = MiBrowser(self, authuser, authpass, url, tempf, qinput, bquit)
        brow.start()

        # loop reading until finished
        self._prev_progress = None

        logger.info("Downloader started receiving bytes")
        while True:
            # get all data and just use the last item
            payload = yield qinput.deferred_get()
            if self.cancelled:
                logger.debug("Cancelled! Quit browser, wait, and clean.")
                bquit.set()
                yield qinput.deferred_get()
                if os.path.exists(tempf):
                    os.remove(tempf)
                logger.debug("Cancelled! Cleaned up.")
                raise CancelledError()

            # special situations
            if payload is None:
                # no data, let's try again
                continue
            data = payload[-1]
            if isinstance(data, Exception):
                raise data
            if data == DONE_TOKEN:
                break

            # actualizamos si hay algo nuevo
            if data != self._prev_progress:
                cb_progress(data)
                self._prev_progress = data

        # movemos al nombre correcto y terminamos
        logger.info("Downloading done, renaming temp to %r", fname)
        os.rename(tempf, fname)
        self.browser_quit.remove(bquit)
        defer.return_value(fname)
Exemple #5
0
    def __init__(self, main_window):
        super(WizardDialog, self).__init__()
        self.mw = main_window
        vbox = QVBoxLayout(self)

        # label and checkbox
        self.main_text = QLabel("init text")
        vbox.addWidget(self.main_text)
        self.notthisagain = QCheckBox("No mostrar automáticamente esta ayuda")
        nowizard = config.get('nowizard', False)
        self.notthisagain.setCheckState(nowizard)
        self.notthisagain.stateChanged.connect(self._notthisagain_toggled)
        vbox.addWidget(self.notthisagain)

        # buttons
        bbox = QDialogButtonBox()
        self.navbut_actn = QPushButton("init text")
        bbox.addButton(self.navbut_actn, QDialogButtonBox.ActionRole)
        self.navbut_prev = QPushButton("Anterior")
        bbox.addButton(self.navbut_prev, QDialogButtonBox.ActionRole)
        self.navbut_next = QPushButton("Siguiente")
        bbox.addButton(self.navbut_next, QDialogButtonBox.ActionRole)
        vbox.addWidget(bbox)

        self.show()
        self.step = 0
        self._move(0)
Exemple #6
0
    def __init__(self, main_window):
        super(WizardDialog, self).__init__()
        self.mw = main_window
        vbox = QVBoxLayout(self)

        # label and checkbox
        self.main_text = QLabel(u"init text")
        vbox.addWidget(self.main_text)
        self.notthisagain = QCheckBox(u"No mostrar automáticamente esta ayuda")
        nowizard = config.get('nowizard', False)
        self.notthisagain.setCheckState(nowizard)
        self.notthisagain.stateChanged.connect(self._notthisagain_toggled)
        vbox.addWidget(self.notthisagain)

        # buttons
        bbox = QDialogButtonBox()
        self.navbut_actn = QPushButton(u"init text")
        bbox.addButton(self.navbut_actn, QDialogButtonBox.ActionRole)
        self.navbut_prev = QPushButton(u"Anterior")
        bbox.addButton(self.navbut_prev, QDialogButtonBox.ActionRole)
        self.navbut_next = QPushButton(u"Siguiente")
        bbox.addButton(self.navbut_next, QDialogButtonBox.ActionRole)
        vbox.addWidget(bbox)

        self.show()
        self.step = 0
        self._move(0)
Exemple #7
0
    def __init__(self, version, app_quit, update_source):
        super(MainUI, self).__init__()
        self.app_quit = app_quit
        self.finished = False
        self.version = version
        self.update_source = update_source
        self.downloaders = {}
        self.setWindowTitle('Encuentro')

        self.programs_data = data.ProgramsData(self, self._programs_file)
        self._touch_config()

        # finish all gui stuff
        self.big_panel = central_panel.BigPanel(self)
        self.episodes_list = self.big_panel.episodes
        self.episodes_download = self.big_panel.downloads_widget
        self.episode_channels = [CHANNELS_ALL] + sorted(
            set(e.channel
                for e in self.episodes_list._model.episodes if e.channel))
        self.setCentralWidget(self.big_panel)

        # the setting of menubar should be almost in the end, because it may
        # trigger the wizard, which needs big_panel and etc.
        self.action_play = self.action_download = None
        self.filter_line = self.filter_cbox = self.needsomething_alert = None
        self._menubar()

        systray.show(self)

        if config.get('autorefresh'):
            ue = update.UpdateEpisodes(self, update_source)
            ue.background()
        else:
            # refresh data if never done before or if last
            # update was 7 days ago
            last_refresh = config.get('autorefresh_last_time')
            if last_refresh is None or (dt.datetime.now() - last_refresh >
                                        dt.timedelta(7)):
                ue = update.UpdateEpisodes(self, update_source)
                ue.background()

        self.show()

        self.episodes_download.load_pending()
        logger.debug("Main UI started ok")
Exemple #8
0
 def _f(title, message):
     """The method that will really notify."""
     if config.get('notification', True):
         try:
             n = notify2.Notification(title, message)
             n.show()
         except Exception as err:
             logger.warning("Unable to notify! %s(%s) (imported is %r)",
                            err.__class__.__name__, err, notify2)
Exemple #9
0
    def __init__(self, version, app_quit):
        super(MainUI, self).__init__()
        self.app_quit = app_quit
        self.finished = False
        self.version = version
        self.setWindowTitle('Encuentro')

        self.programs_data = data.ProgramsData(self, self._programs_file)
        self._touch_config()

        self.downloaders = {}
        for downtype, dloader_class in all_downloaders.iteritems():
            self.downloaders[downtype] = dloader_class()

        # finish all gui stuff
        self.big_panel = central_panel.BigPanel(self)
        self.episodes_list = self.big_panel.episodes
        self.episodes_download = self.big_panel.downloads_widget
        self.setCentralWidget(self.big_panel)

        # the setting of menubar should be almost in the end, because it may
        # trigger the wizard, which needs big_panel and etc.
        self.action_play = self.action_download = None
        self.filter_line = self.filter_cbox = self.needsomething_alert = None
        self._menubar()

        systray.show(self)

        if config.get('autorefresh'):
            ue = update.UpdateEpisodes(self)
            ue.background()
        else:
            # refresh data if never done before or if last
            # update was 7 days ago
            last_refresh = config.get('autorefresh_last_time')
            if last_refresh is None or (
                    dt.datetime.now() - last_refresh > dt.timedelta(7)):
                ue = update.UpdateEpisodes(self)
                ue.background()

        self.show()

        self.episodes_download.load_pending()
        logger.debug("Main UI started ok")
Exemple #10
0
    def __init__(self):
        super(GeneralPreferences, self).__init__()
        grid = QGridLayout(self)
        grid.setSpacing(20)
        grid.setColumnStretch(1, 10)

        # directory auto completer
        completer = QCompleter(self)
        dirs = QDirModel(self)
        dirs.setFilter(QDir.AllDirs | QDir.NoDotAndDotDot)
        completer.setModel(dirs)
        completer.setCaseSensitivity(Qt.CaseInsensitive)
        completer.setCompletionMode(QCompleter.PopupCompletion)

        l = QLabel(
            u"<b>Ingresá el directorio donde descargar los videos...</b>")
        l.setTextFormat(Qt.RichText)
        grid.addWidget(l, 0, 0, 1, 2)

        grid.addWidget(QLabel(u"Descargar en:"), 1, 0, 2, 1)
        prv = config.get('downloaddir', '')
        self.downloaddir_entry = QLineEdit(prv)
        self.downloaddir_entry.setCompleter(completer)
        self.downloaddir_entry.setPlaceholderText(u'Ingresá un directorio')
        grid.addWidget(self.downloaddir_entry, 1, 1, 2, 2)

        self.downloaddir_buttn = QPushButton(u"Elegir un directorio")
        self.downloaddir_buttn.clicked.connect(self._choose_dir)
        grid.addWidget(self.downloaddir_buttn, 2, 1, 3, 2)

        self.autoreload_checkbox = QCheckBox(
            u"Recargar automáticamente la lista de episodios al iniciar")
        prv = config.get('autorefresh', False)
        self.autoreload_checkbox.setChecked(prv)
        grid.addWidget(self.autoreload_checkbox, 3, 0, 4, 2)

        self.shownotifs_checkbox = QCheckBox(
            u"Mostrar una notificación cuando termina cada descarga")
        prv = config.get('notification', True)
        self.shownotifs_checkbox.setChecked(prv)
        grid.addWidget(self.shownotifs_checkbox, 4, 0, 5, 2)
Exemple #11
0
    def __init__(self):
        super(GeneralPreferences, self).__init__()
        grid = QGridLayout(self)
        grid.setSpacing(20)
        grid.setColumnStretch(1, 10)

        # directory auto completer
        completer = QCompleter(self)
        dirs = QDirModel(self)
        dirs.setFilter(QDir.AllDirs | QDir.NoDotAndDotDot)
        completer.setModel(dirs)
        completer.setCaseSensitivity(Qt.CaseInsensitive)
        completer.setCompletionMode(QCompleter.PopupCompletion)

        l = QLabel(
            u"<b>Ingresá el directorio donde descargar los videos...</b>")
        l.setTextFormat(Qt.RichText)
        grid.addWidget(l, 0, 0, 1, 2)

        grid.addWidget(QLabel(u"Descargar en:"), 1, 0, 2, 1)
        prv = config.get('downloaddir', '')
        self.downloaddir_entry = QLineEdit(prv)
        self.downloaddir_entry.setCompleter(completer)
        self.downloaddir_entry.setPlaceholderText(u'Ingresá un directorio')
        grid.addWidget(self.downloaddir_entry, 1, 1, 2, 2)

        self.downloaddir_buttn = QPushButton(u"Elegir un directorio")
        self.downloaddir_buttn.clicked.connect(self._choose_dir)
        grid.addWidget(self.downloaddir_buttn, 2, 1, 3, 2)

        self.autoreload_checkbox = QCheckBox(
            u"Recargar automáticamente la lista de episodios al iniciar")
        prv = config.get('autorefresh', False)
        self.autoreload_checkbox.setChecked(prv)
        grid.addWidget(self.autoreload_checkbox, 3, 0, 4, 2)

        self.shownotifs_checkbox = QCheckBox(
            u"Mostrar una notificación cuando termina cada descarga")
        prv = config.get('notification', True)
        self.shownotifs_checkbox.setChecked(prv)
        grid.addWidget(self.shownotifs_checkbox, 4, 0, 5, 2)
Exemple #12
0
    def _touch_config(self):
        """Do some config processing."""
        # log the config, but without user and pass
        logger.debug("Configuration loaded: %s", config)

        # we have a default for download dir
        if not config.get('downloaddir'):
            config['downloaddir'] = multiplatform.get_download_dir()

        # maybe clean some config
        if self.programs_data.reset_config_from_migration:
            config['user'] = ''
            config['password'] = ''
            config.pop('cols_width', None)
            config.pop('cols_order', None)
            config.pop('selected_row', None)
Exemple #13
0
    def _touch_config(self):
        """Do some config processing."""
        # log the config, but without user and pass
        safecfg = config.sanitized_config()
        logger.debug("Configuration loaded: %s", safecfg)

        # we have a default for download dir
        if not config.get('downloaddir'):
            config['downloaddir'] = multiplatform.get_download_dir()

        # maybe clean some config
        if self.programs_data.reset_config_from_migration:
            config['user'] = ''
            config['password'] = ''
            config.pop('cols_width', None)
            config.pop('cols_order', None)
            config.pop('selected_row', None)
Exemple #14
0
    def play_episode(self, episode):
        """Play an episode."""
        downloaddir = config.get('downloaddir', '')
        filename = os.path.join(downloaddir, episode.filename)

        logger.info("Play requested of %s", episode)
        if os.path.exists(filename):
            # pass file:// url with absolute path
            fullpath = 'file://' + os.path.abspath(filename)
            logger.info("Playing %r", fullpath)
            multiplatform.open_file(fullpath)
        else:
            logger.warning("Aborted playing, file not found: %r", filename)
            msg = (u"No se encontró el archivo para reproducir: " +
                   repr(filename))
            self.show_message('Error al reproducir', msg)
            episode.state = Status.none
            self.episodes_list.set_color(episode)
Exemple #15
0
    def play_episode(self, episode):
        """Play an episode."""
        downloaddir = config.get('downloaddir', '')
        filename = os.path.join(downloaddir, episode.filename)

        logger.info("Play requested of %s", episode)
        if os.path.exists(filename):
            # pass file:// url with absolute path
            fullpath = 'file://' + os.path.abspath(filename)
            logger.info("Playing %r", fullpath)
            multiplatform.open_file(fullpath)
        else:
            logger.warning("Aborted playing, file not found: %r", filename)
            msg = "No se encontró el archivo para reproducir: " + repr(
                filename)
            self.show_message('Error al reproducir', msg)
            episode.state = Status.none
            self.episodes_list.set_color(episode)
Exemple #16
0
    def _setup_target(self, channel, section, season, title, extension):
        """Set up the target file to download."""
        # build where to save it
        downloaddir = config.get('downloaddir', '')
        channel = multiplatform.sanitize(channel)
        section = multiplatform.sanitize(section)
        title = multiplatform.sanitize(title)

        if season is not None:
            season = multiplatform.sanitize(season)
            fname = os.path.join(downloaddir, channel, section,
                                 season, title + extension)
        else:
            fname = os.path.join(downloaddir, channel, section,
                                 title + extension)

        # if the directory doesn't exist, create it
        dirsecc = os.path.dirname(fname)
        if not os.path.exists(dirsecc):
            os.makedirs(dirsecc)

        tempf = fname + str(time.time())
        return fname, tempf
Exemple #17
0
    def __init__(self):
        super(GeneralPreferences, self).__init__()
        grid = QGridLayout(self)
        grid.setSpacing(20)
        grid.setColumnStretch(1, 10)

        # directory auto completer
        completer = QCompleter(self)
        dirs = QDirModel(self)
        dirs.setFilter(QDir.AllDirs | QDir.NoDotAndDotDot)
        completer.setModel(dirs)
        completer.setCaseSensitivity(Qt.CaseInsensitive)
        completer.setCompletionMode(QCompleter.PopupCompletion)

        label = QLabel(
            "<b>Ingresá el directorio donde descargar los videos...</b>")
        label.setTextFormat(Qt.RichText)
        grid.addWidget(label, 0, 0, 1, 2)

        grid.addWidget(QLabel("Descargar en:"), 1, 0, 2, 1)
        prv = config.get('downloaddir', '')
        self.downloaddir_entry = QLineEdit(prv)
        self.downloaddir_entry.setCompleter(completer)
        self.downloaddir_entry.setPlaceholderText('Ingresá un directorio')
        grid.addWidget(self.downloaddir_entry, 1, 1, 2, 2)

        self.downloaddir_buttn = QPushButton("Elegir un directorio")
        self.downloaddir_buttn.clicked.connect(self._choose_dir)
        grid.addWidget(self.downloaddir_buttn, 2, 1, 3, 2)

        self.autoreload_checkbox = QCheckBox(
            "Recargar automáticamente la lista de episodios al iniciar")
        self.autoreload_checkbox.setToolTip(
            "Cada vez que arranca el programa refrescar la lista de episodios."
        )
        prv = config.get('autorefresh', False)
        self.autoreload_checkbox.setChecked(prv)
        grid.addWidget(self.autoreload_checkbox, 3, 0, 4, 2)

        self.shownotifs_checkbox = QCheckBox(
            "Mostrar una notificación cuando termina cada descarga")
        self.shownotifs_checkbox.setToolTip(
            "Hacer que el escritorio muestre una notificación cada vez que una descarga "
            "se complete.")
        prv = config.get('notification', True)
        self.shownotifs_checkbox.setChecked(prv)
        grid.addWidget(self.shownotifs_checkbox, 4, 0, 5, 2)

        self.cleanfnames_checkbox = QCheckBox(
            "Limpiar nombres para que se pueda guardar en cualquier lado")
        self.cleanfnames_checkbox.setToolTip(
            "Convertir caracteres extraños en títulos para que el archivo se pueda grabar en "
            "cualquier disco o pendrive.")
        prv = config.get('clean-filenames', False)
        self.cleanfnames_checkbox.setChecked(prv)
        grid.addWidget(self.cleanfnames_checkbox, 5, 0, 6, 2)

        lq = QLabel(
            "<b>Ingrese la Calidad de Video Preferida para las Descargas:</b>")
        lq.setTextFormat(Qt.RichText)
        grid.addWidget(lq, 8, 0, 7, 2)

        lqd = QLabel("* En caso de no existir se eligirá la más conveniente.")
        lqd.setTextFormat(Qt.RichText)
        grid.addWidget(lqd, 9, 0, 8, 2)

        self.select_quality = QComboBox()
        self.select_quality.setGeometry(QRect())
        self.select_quality.setObjectName("Calidad de Video Preferida")
        self.select_quality.addItem("1080p")  # HD
        self.select_quality.addItem("720p")  # ALTA
        self.select_quality.addItem("480p")  # MEDIA
        self.select_quality.addItem("360p")  # BAJA
        self.select_quality.addItem("240p")  # MALA
        self.select_quality.activated[str].connect(self.selected)

        prv = config.get('quality', '720p')
        self.select_quality.setCurrentText(prv)
        grid.addWidget(self.select_quality, 10, 0, 9, 2)
Exemple #18
0
    def _menubar(self):
        """Set up the menu bar."""
        menubar = self.menuBar()

        # applications menu
        menu_appl = menubar.addMenu(u'&Aplicación')

        icon = self.style().standardIcon(QStyle.SP_BrowserReload)
        action_reload = QAction(icon, '&Refrescar', self)
        action_reload.setShortcut('Ctrl+R')
        action_reload.setToolTip(u'Recarga la lista de programas')
        action_reload.triggered.connect(self.refresh_episodes)
        menu_appl.addAction(action_reload)

        icon = self.style().standardIcon(QStyle.SP_FileDialogDetailedView)
        action_preferences = QAction(icon, u'&Preferencias', self)
        action_preferences.triggered.connect(self.open_preferences)
        action_preferences.setToolTip(
            u'Configurar distintos parámetros del programa')
        menu_appl.addAction(action_preferences)

        menu_appl.addSeparator()

        icon = self.style().standardIcon(QStyle.SP_MessageBoxInformation)
        _act = QAction(icon, '&Acerca de', self)
        _act.triggered.connect(self.open_about_dialog)
        _act.setToolTip(u'Muestra información de la aplicación')
        menu_appl.addAction(_act)

        icon = self.style().standardIcon(QStyle.SP_DialogCloseButton)
        _act = QAction(icon, '&Salir', self)
        _act.setShortcut('Ctrl+Q')
        _act.setToolTip(u'Sale de la aplicación')
        _act.triggered.connect(self.on_close)
        menu_appl.addAction(_act)

        # program menu
        menu_prog = menubar.addMenu(u'&Programa')

        icon = self.style().standardIcon(QStyle.SP_ArrowDown)
        self.action_download = QAction(icon, '&Descargar', self)
        self.action_download.setShortcut('Ctrl+D')
        self.action_download.setEnabled(False)
        self.action_download.setToolTip(TTIP_DOWNLOAD_D)
        self.action_download.triggered.connect(self.download_episode)
        menu_prog.addAction(self.action_download)

        icon = self.style().standardIcon(QStyle.SP_MediaPlay)
        self.action_play = QAction(icon, '&Reproducir', self)
        self.action_play.setEnabled(False)
        self.action_play.setToolTip(TTIP_PLAY_D)
        self.action_play.triggered.connect(self.on_play_action)
        menu_prog.addAction(self.action_play)

        # toolbar for buttons
        toolbar = self.addToolBar('main')
        toolbar.addAction(self.action_download)
        toolbar.addAction(self.action_play)
        toolbar.addSeparator()
        toolbar.addAction(action_reload)
        toolbar.addAction(action_preferences)

        # filter text and button, to the right
        spacer = QWidget()
        spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        toolbar.addWidget(spacer)
        toolbar.addWidget(QLabel(u"Filtro: "))
        self.filter_line = QLineEdit()
        self.filter_line.setMaximumWidth(150)
        self.filter_line.textChanged.connect(self.on_filter_changed)
        toolbar.addWidget(self.filter_line)
        self.filter_cbox = QCheckBox(u"Sólo descargados")
        self.filter_cbox.stateChanged.connect(self.on_filter_changed)
        toolbar.addWidget(self.filter_cbox)

        # if needed, a warning that stuff needs to be configured
        icon = self.style().standardIcon(QStyle.SP_MessageBoxWarning)
        m = u"Necesita configurar algo; haga click aquí para abrir el wizard"
        self.needsomething_alert = QAction(icon, m, self)
        self.needsomething_alert.triggered.connect(self._start_wizard)
        toolbar.addAction(self.needsomething_alert)
        if not config.get('nowizard'):
            self._start_wizard()
        self._review_need_something_indicator()
Exemple #19
0
 def have_config(self):
     """Return if some config is needed."""
     return config.get('user') and config.get('password')
Exemple #20
0
 def have_config(self):
     """Return if some config is needed."""
     return config.get('user') and config.get('password')
Exemple #21
0
    def _menubar(self):
        """Set up the menu bar."""
        menubar = self.menuBar()

        # applications menu
        menu_appl = menubar.addMenu('&Aplicación')

        icon = self.style().standardIcon(QStyle.SP_BrowserReload)
        action_reload = QAction(icon, '&Refrescar', self)
        action_reload.setShortcut('Ctrl+R')
        action_reload.setToolTip('Recarga la lista de programas')
        action_reload.triggered.connect(self.refresh_episodes)
        menu_appl.addAction(action_reload)

        icon = self.style().standardIcon(QStyle.SP_FileDialogDetailedView)
        action_preferences = QAction(icon, '&Preferencias', self)
        action_preferences.triggered.connect(self.open_preferences)
        action_preferences.setToolTip(
            'Configurar distintos parámetros del programa')
        menu_appl.addAction(action_preferences)

        menu_appl.addSeparator()

        icon = self.style().standardIcon(QStyle.SP_MessageBoxInformation)
        _act = QAction(icon, '&Acerca de', self)
        _act.triggered.connect(self.open_about_dialog)
        _act.setToolTip('Muestra información de la aplicación')
        menu_appl.addAction(_act)

        icon = self.style().standardIcon(QStyle.SP_DialogCloseButton)
        _act = QAction(icon, '&Salir', self)
        _act.setShortcut('Ctrl+Q')
        _act.setToolTip('Sale de la aplicación')
        _act.triggered.connect(self.on_close)
        menu_appl.addAction(_act)

        # program menu
        menu_prog = menubar.addMenu('&Programa')

        icon = self.style().standardIcon(QStyle.SP_ArrowDown)
        self.action_download = QAction(icon, '&Descargar', self)
        self.action_download.setShortcut('Ctrl+D')
        self.action_download.setEnabled(False)
        self.action_download.setToolTip(TTIP_DOWNLOAD_D)
        self.action_download.triggered.connect(self.download_episode)
        menu_prog.addAction(self.action_download)

        icon = self.style().standardIcon(QStyle.SP_MediaPlay)
        self.action_play = QAction(icon, '&Reproducir', self)
        self.action_play.setEnabled(False)
        self.action_play.setToolTip(TTIP_PLAY_D)
        self.action_play.triggered.connect(self.on_play_action)
        menu_prog.addAction(self.action_play)

        # toolbar for buttons and filters
        toolbar = self.addToolBar('main')
        toolbar.layout().setSpacing(10)

        # basic buttons
        toolbar.addAction(self.action_download)
        toolbar.addAction(self.action_play)
        toolbar.addSeparator()
        toolbar.addAction(action_reload)
        toolbar.addAction(action_preferences)

        # spacer to move all filters to the right
        spacer = QWidget()
        spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        toolbar.addWidget(spacer)

        # channel selection combobox
        toolbar.addWidget(QLabel("Canal: "))
        self.filter_chan = QComboBox()
        for c in self.episode_channels:
            self.filter_chan.addItem(c)
        self.filter_chan.activated.connect(self.on_filter_changed)
        toolbar.addWidget(self.filter_chan)

        # filter text and button
        toolbar.addWidget(QLabel("Filtro: "))
        self.filter_line = QLineEdit()
        self.filter_line.setMaximumWidth(150)
        self.filter_line.textChanged.connect(self.on_filter_changed)
        toolbar.addWidget(self.filter_line)
        self.filter_cbox = QCheckBox("Sólo descargados")
        self.filter_cbox.stateChanged.connect(self.on_filter_changed)
        toolbar.addWidget(self.filter_cbox)
        QShortcut(QKeySequence("Ctrl+F"), self, self.filter_line.setFocus)

        # if needed, a warning that stuff needs to be configured
        icon = self.style().standardIcon(QStyle.SP_MessageBoxWarning)
        m = "Necesita configurar algo; haga click aquí para abrir el wizard"
        self.needsomething_alert = QAction(icon, m, self)
        self.needsomething_alert.triggered.connect(self._start_wizard)
        toolbar.addAction(self.needsomething_alert)
        if not config.get('nowizard'):
            self._start_wizard()
        self._review_need_something_indicator()
Exemple #22
0
 def _f(title, message):
     """The method that will really notify."""
     if config.get('notification', True):
         n = pynotify.Notification(title, message)
         n.show()
Exemple #23
0
 def _f(title, message):
     """The method that will really notify."""
     if config.get('notification', True):
         n = pynotify.Notification(title, message)
         n.show()
Exemple #24
0
 def __init__(self):
     super(M3u8YTDownloader, self).__init__()
     self.quality = config.get('quality', '480p')