• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python gtcache._函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中miro.gtcache._函数的典型用法代码示例。如果您正苦于以下问题:Python _函数的具体用法?Python _怎么用?Python _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了_函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: get_metainfo

    def get_metainfo(self):
        if self.metainfo is None:
            if self.url.startswith('file://'):
                path = get_file_url_path(self.url)
                try:
                    metainfoFile = open(path, 'rb')
                except IOError:
                    self.handle_error(
                        _("Torrent file deleted"),
                        _("The torrent file for this item was deleted "
                          "outside of %(appname)s.",
                          {"appname": app.config.get(prefs.SHORT_APP_NAME)}
                          ))

                    return
                try:
                    metainfo = metainfoFile.read()
                finally:
                    metainfoFile.close()

                self.handle_metainfo(metainfo)
            else:
                self.description_client = httpclient.grab_url(self.url,
                        self.on_metainfo_download,
                        self.on_metainfo_download_error,
                        content_check_callback=self.check_description)
        else:
            self.got_metainfo()
开发者ID:nxmirrors,项目名称:miro,代码行数:28,代码来源:download.py


示例2: _run_downloader

    def _run_downloader(self, url, content_type=None, title=None):
        if not self.id_exists():
            # we got deleted while we were doing the flash scraping
            return
        if content_type is not None:
            self.content_type = content_type
        if url is not None:
            if title is not None:
                for mem in self.item_list:
                    if not mem.title:
                        mem.title = title

            self.url = url
            logging.debug("downloading url %s", self.url)
            args = dict(url=self.url, content_type=self.content_type,
                        channel_name=self.channel_name)
            app.download_state_manager.add_download(self.dlid, self)
            app.download_state_manager.queue(self.dlid,
                                             app.download_state_manager.RESUME,
                                             args)
            self.state = u'downloading'
        else:
            self.state = u'failed'
            self.short_reason_failed = _('File not found')
            self.reason_failed = _('Flash URL Scraping Error')
        self.signal_change()
开发者ID:dankamongmen,项目名称:miro,代码行数:26,代码来源:downloader.py


示例3: open_url

    def open_url(self, url):
        # It looks like the maximum URL length is about 2k. I can't
        # seem to find the exact value
        if len(url) > 2047:
            url = url[:2047]
        try:
            webbrowser.get("windows-default").open_new(url)
        except:
            logging.warn("Error opening URL: %r\n%s", url,
                    traceback.format_exc())
            recommendURL = app.config.get(prefs.RECOMMEND_URL)

            if url.startswith(app.config.get(prefs.VIDEOBOMB_URL)):
                title = _('Error Bombing Item')
            elif url.startswith(recommendURL):
                title = _('Error Recommending Item')
            else:
                title = _("Error Opening Website")

            scheme, host, path, params, query, fragment = urlparse(url)
            shortURL = '%s:%s%s' % (scheme, host, path)
            msg = _(
                "There was an error opening %(url)s.  Please try again in a few "
                "seconds",
                {"url": shortURL}
            )
            dialogs.show_message(title, msg, dialogs.WARNING_MESSAGE)
开发者ID:CodeforEvolution,项目名称:miro,代码行数:27,代码来源:application.py


示例4: build_widget

    def build_widget(self):
        vbox = widgetset.VBox()

        grid = dialogwidgets.ControlGrid()
        
        count = get_logical_cpu_count()
        max_concurrent = []
        for i in range(0, count):
            max_concurrent.append((i+1, str(i+1)))
        max_concurrent_menu = widgetset.OptionMenu([op[1] for op in max_concurrent])
        attach_combo(max_concurrent_menu, prefs.MAX_CONCURRENT_CONVERSIONS, 
            [op[0] for op in max_concurrent])

        if count == 1:
            max_concurrent_menu.disable()

        grid.pack(dialogwidgets.label_with_note(
            _("Allow this many concurrent conversions:"),
            _("(changing this will not apply to currently running conversions)")),
            dialogwidgets.ControlGrid.ALIGN_RIGHT)
        grid.pack(max_concurrent_menu)
        grid.end_line(spacing=4)
        vbox.pack_start(widgetutil.align_left(grid.make_table()))

        pack_extras(vbox, "conversions")

        return vbox
开发者ID:cool-RR,项目名称:Miro,代码行数:27,代码来源:prefpanel.py


示例5: make_subtitles_button

    def make_subtitles_button(self):
        hbox = HBox(5)

        current_track = app.video_renderer.get_enabled_subtitle_track()

        # None, -1 and 0 all mean there is no current track.
        if current_track is not None and current_track > 0:
            ccimage = 'images/cc-on.png'
            cccolor = GREEN
            cctext = _("Subtitles On")

        else:
            tracks = app.video_renderer.get_subtitle_tracks()
            if tracks is not None and len(tracks) > 0:
                ccimage = 'images/cc-available.png'
                cctext = _("Subtitles Found")
                cccolor = WHITE
            else:
                ccimage = 'images/cc-available.png'
                cctext = _("Subtitles")
                cccolor = WHITE

        cc_image_button = make_image_button(ccimage, self.handle_subtitles)
        hbox.pack_start(_align_middle(cc_image_button))
        subtitles_link = make_label(cctext, self.handle_subtitles)
        subtitles_link.set_color(cccolor)
        hbox.pack_start(_align_middle(subtitles_link))

        subtitles_image = make_image_button(
            'images/subtitles_down.png', self.handle_subtitles)
        hbox.pack_start(_align_middle(subtitles_image))
        return hbox
开发者ID:ShriramK,项目名称:miro,代码行数:32,代码来源:video.py


示例6: adjustContent

    def adjustContent(self, videoWindow, animate):
        if videoWindow.is_fullscreen:
            self.popInOutButton.setHidden_(YES)
            self.popInOutLabel.setHidden_(YES)
            self.fsButton.setImage_(NSImage.imageNamed_('fs-button-exitfullscreen'))
            self.fsButton.setAlternateImage_(NSImage.imageNamed_('fs-button-exitfullscreen-alt'))
        else:
            if app.playback_manager.detached_window is None:
                image_path = resources.path('images/popout.png')
                label = _('Pop Out')
            else:
                image_path = resources.path('images/popin.png')
                label = _('Pop In')
            self.popInOutButton.setImage_(NSImage.alloc().initWithContentsOfFile_(image_path))
            self.popInOutButton.setHidden_(NO)
            self.popInOutLabel.setHidden_(NO)
            self.popInOutLabel.setStringValue_(label)
            self.fsButton.setImage_(NSImage.imageNamed_('fs-button-enterfullscreen'))
            self.fsButton.setAlternateImage_(NSImage.imageNamed_('fs-button-enterfullscreen-alt'))

        newFrame = self.window().frame() 
        if videoWindow.is_fullscreen or app.playback_manager.detached_window is not None: 
            self.titleLabel.setHidden_(NO)
            self.feedLabel.setHidden_(NO)
            newFrame.size.height = 198 
        else: 
            self.titleLabel.setHidden_(YES)
            self.feedLabel.setHidden_(YES)
            newFrame.size.height = 144
        newFrame.origin.x = self.getHorizontalPosition(videoWindow, newFrame.size.width)
        self.window().setFrame_display_animate_(newFrame, YES, animate)
        self.playbackControls.setNeedsDisplay_(YES)
开发者ID:nxmirrors,项目名称:miro,代码行数:32,代码来源:overlay.py


示例7: run_dialog

def run_dialog():
    """Creates and launches the New Feed dialog.  This dialog waits for
    the user to press "Create Feed" or "Cancel".

    Returns a tuple of the (url, section).
    """
    text = app.widgetapp.get_clipboard_text()
    if text and feed.validate_feed_url(text):
        text = feed.normalize_feed_url(text)
    else:
        text = ""

    title = _('Add Feed')
    description = _('Enter the URL of the feed to add')

    while 1:
        text, section = _run_dialog(title, description, initial_text=text)
        if text == None:
            return (None, None)

        normalized_url = feed.normalize_feed_url(text)
        if feed.validate_feed_url(normalized_url):
            return (normalized_url, section)

        title = _('Add Feed - Invalid URL')
        description = _('The address you entered is not a valid url.\nPlease check the URL and try again.\n\nEnter the URL of the feed to add')
开发者ID:cool-RR,项目名称:Miro,代码行数:26,代码来源:newfeed.py


示例8: _run_downloader

    def _run_downloader(self, url, contentType=None, title=None):
        if not self.id_exists():
            # we got deleted while we were doing the flash scraping
            return
        if contentType is not None:
            self.contentType = contentType
        if url is not None:
            if title is not None:
                for mem in self.item_list:
                    if not mem.title:
                        mem.title = title

            self.url = url
            logging.debug("downloading url %s", self.url)
            c = command.StartNewDownloadCommand(RemoteDownloader.dldaemon,
                                                self.url, self.dlid,
                                                self.contentType,
                                                self.channelName)
            c.send()
            _downloads[self.dlid] = self
        else:
            self.status["state"] = u'failed'
            self.status["shortReasonFailed"] = _('File not found')
            self.status["reasonFailed"] = _('Flash URL Scraping Error')
        self.signal_change()
开发者ID:cool-RR,项目名称:Miro,代码行数:25,代码来源:downloader.py


示例9: _calc_retry_time

 def _calc_retry_time(self):
     if self.status['retryTime'] > datetime.datetime.now():
         retry_delta = self.status['retryTime'] - datetime.datetime.now()
         time_str = displaytext.time_string(retry_delta.seconds)
         return _('no connection - retrying in %s') % time_str
     else:
         return _('no connection - retrying soon')
开发者ID:cool-RR,项目名称:Miro,代码行数:7,代码来源:downloader.py


示例10: _run_db_error_dialog

 def _run_db_error_dialog(self):
     if self._db_retry_callback_pending:
         return
     gettext_values = {"appname": app.config.get(prefs.SHORT_APP_NAME)}
     title = _("%(appname)s database query failed", gettext_values)
     description = _("%(appname)s was unable to read from its database.", gettext_values)
     app.db_error_handler.run_dialog(title, description, self._retry_after_db_error)
开发者ID:ktan2020,项目名称:miro,代码行数:7,代码来源:itemtrack.py


示例11: update_free_space

    def update_free_space(self):
        """Updates the free space text on the downloads tab.

        amount -- the total number of bytes free.
        """
        amount = get_available_bytes_for_movies()
        if app.config.get(prefs.PRESERVE_DISK_SPACE):
            available = (app.config.get(prefs.PRESERVE_X_GB_FREE) * 1024 * 1024 * 1024)
            available = amount - available

            if available < 0:
                available = available * -1.0
                text = _(
                    "%(available)s below downloads space limit (%(amount)s "
                    "free on disk)",
                    {"amount": displaytext.size_string(amount),
                     "available": displaytext.size_string(available)}
                )
            else:
                text = _(
                    "%(available)s free for downloads (%(amount)s free "
                    "on disk)",
                    {"amount": displaytext.size_string(amount),
                     "available": displaytext.size_string(available)}
                )
        else:
            text = _("%(amount)s free on disk",
                     {"amount": displaytext.size_string(amount)})
        self._free_disk_label.set_text(text)
开发者ID:nxmirrors,项目名称:miro,代码行数:29,代码来源:itemlistwidgets.py


示例12: add_subtitle_encoding_menu

def add_subtitle_encoding_menu(menubar, category_label, *encodings):
    """Helper method to set up the subtitles encoding menu.

    This method should be called for each category of subtitle encodings (East
    Asian, Western European, Unicode, etc).  Pass it the list of encodings for
    that category.

    :param category_label: human-readable name for the category
    :param encodings: list of (label, encoding) tuples.  label is a
        human-readable name, and encoding is a value that we can pass to
        VideoDisplay.select_subtitle_encoding()
    """
    subtitles_menu = menubar.get("PlaybackMenu").get("SubtitlesMenu")
    try:
        encoding_menu = subtitles_menu.get("SubtitleEncodingMenu")
    except ValueError:
        # first time calling this function, we need to set up the menu.
        encoding_menu = Menu(_("_Encoding"), "SubtitleEncodingMenu", [], groups=["PlayingVideo"])
        subtitles_menu.append(encoding_menu)
        default_item = RadioMenuItem(
            _("Default (UTF-8)"), "SubtitleEncoding-Default", "subtitle-encoding", groups=["PlayingVideo"]
        )
        encoding_menu.append(default_item)
        app.menu_manager.subtitle_encoding_enabled = True

    category_menu = Menu(category_label, "SubtitleEncodingCat%s" % encoding_menu.count(), [], groups=["PlayingVideo"])
    encoding_menu.append(category_menu)

    for encoding, name in encodings:
        label = "%s (%s)" % (name, encoding)
        category_menu.append(
            RadioMenuItem(label, "SubtitleEncoding-%s" % encoding, "subtitle-encoding", groups=["PlayingVideo"])
        )
开发者ID:nxmirrors,项目名称:miro,代码行数:33,代码来源:menus.py


示例13: run_dialog

def run_dialog():
    """Creates and launches the New Feed dialog.  This dialog waits for
    the user to press "Create Podcast" or "Cancel".

    Returns the URL, or None.
    """
    text = app.widgetapp.get_clipboard_text()
    if text and feed.validate_feed_url(text):
        text = feed.normalize_feed_url(text)
    else:
        text = ""

    title = _('Add Podcast')
    description = _('Enter the URL of the podcast to add')

    while 1:
        text = _run_dialog(title, description, initial_text=text)
        if text == None:
            return None

        normalized_url = feed.normalize_feed_url(text)
        if feed.validate_feed_url(normalized_url):
            return normalized_url

        title = _('Add Podcast - Invalid URL')
        description = _(
            'The address you entered is not a valid url.  '
            'Please check the URL and try again.'
            '\n\n'
            'Enter the URL of the podcast to add')
开发者ID:CodeforEvolution,项目名称:miro,代码行数:30,代码来源:newfeed.py


示例14: _calc_status_text

    def _calc_status_text(self):
        """Calculate the text/color for our status line.

        :returns: (text, color) tuple
        """
        if self.info.downloaded:
            if self.info.is_playable:
                if not self.info.video_watched:
                    return (_('Unplayed'), UNPLAYED_COLOR)
                elif self.info.expiration_date:
                    text = displaytext.expiration_date_short(
                            self.info.expiration_date)
                    return (text, EXPIRING_TEXT_COLOR)
        elif (self.info.download_info and
                self.info.download_info.rate == 0):
            if self.info.download_info.state == 'paused':
                return (_('paused'), DOWNLOADING_COLOR)
            elif self.info.download_info.state == 'pending':
                return (_('queued'), DOWNLOADING_COLOR)
            elif self.info.download_info.state == 'failed':
                return (self.info.download_info.short_reason_failed,
                        ERROR_COLOR)
            else:
                return (self.info.download_info.startup_activity,
                        DOWNLOADING_COLOR)
        elif not self.info.item_viewed:
            return (_('Newly Available'), AVAILABLE_COLOR)
        return ('', self.default_text_color)
开发者ID:codito,项目名称:miro,代码行数:28,代码来源:style.py


示例15: _show_save_error_dialog

 def _show_save_error_dialog(self, error_text):
     title = _("%(appname)s database save failed",
               {"appname": app.config.get(prefs.SHORT_APP_NAME)})
     description = _(
         "%(appname)s was unable to save its database.\n\n"
         "If your disk is full, we suggest freeing up some space and "
         "retrying.  If your disk is not full, it's possible that "
         "retrying will work.\n\n"
         "If retrying did not work, please quit %(appname)s and restart.  "
         "Recent changes may be lost.\n\n"
         "If you see this error often while downloading, we suggest "
         "you reduce the number of simultaneous downloads in the Options "
         "dialog in the Download tab.\n\n"
         "Error: %(error_text)s\n\n",
         {"appname": app.config.get(prefs.SHORT_APP_NAME),
          "error_text": error_text}
         )
     d = dialogs.ChoiceDialog(title, description,
             dialogs.BUTTON_RETRY, dialogs.BUTTON_QUIT)
     choice = d.run_blocking()
     if choice == dialogs.BUTTON_QUIT:
         self._quitting_from_operational_error = True
         messages.FrontendQuit().send_to_frontend()
     else:
         logging.warn("Re-running SQL statement")
开发者ID:kmshi,项目名称:miro,代码行数:25,代码来源:storedatabase.py


示例16: _playback_panel

def _playback_panel():
    extras = []

    lab = widgetset.Label(_("Renderer options:"))
    lab.set_bold(True)
    extras.append(align_left(lab))

    grid = dialogwidgets.ControlGrid()

    note = dialogwidgets.note(
        _("You must restart %(appname)s for renderer "
          "changes to take effect.",
          {"appname": app.config.get(prefs.SHORT_APP_NAME)}))
    grid.pack(align_left(note, bottom_pad=12), grid.ALIGN_LEFT, span=2)

    grid.end_line(spacing=12)

    rbg = widgetset.RadioButtonGroup()
    radio_map = {}
    for mem in renderers.get_renderer_list():
        radio_map[mem] = widgetset.RadioButton(mem, rbg)

    buttons = [(v, k) for k, v in radio_map.items()]
    attach_radio(buttons, options.USE_RENDERER)

    grid.pack_label(_("Video renderer:"), grid.ALIGN_RIGHT)
    grid.pack(dialogwidgets.radio_button_list(*radio_map.values()))

    grid.end_line(spacing=12)

    extras.append(align_left(grid.make_table()))

    return extras
开发者ID:cool-RR,项目名称:Miro,代码行数:33,代码来源:prefpanelset.py


示例17: awakeFromNib

    def awakeFromNib(self):
        self.shareButton.setImage_(getOverlayButtonImage(self.shareButton.bounds().size))
        self.shareButton.setAlternateImage_(getOverlayButtonAlternateImage(self.shareButton.bounds().size))
        self.shareButton.setTitle_(_("Share"))

        self.keepButton.setImage_(getOverlayButtonImage(self.keepButton.bounds().size))
        self.keepButton.setAlternateImage_(getOverlayButtonAlternateImage(self.keepButton.bounds().size))
        self.keepButton.setTitle_(_("Keep"))

        self.deleteButton.setImage_(getOverlayButtonImage(self.deleteButton.bounds().size))
        self.deleteButton.setAlternateImage_(getOverlayButtonAlternateImage(self.deleteButton.bounds().size))
        self.deleteButton.setTitle_(_("Delete"))

        self.seekForwardButton.setCell_(SkipSeekButtonCell.cellFromButtonCell_direction_delay_(self.seekForwardButton.cell(), 1, 0.0))
        self.seekForwardButton.cell().setAllowsSkipping(False)
        self.seekBackwardButton.setCell_(SkipSeekButtonCell.cellFromButtonCell_direction_delay_(self.seekBackwardButton.cell(), -1, 0.0))
        self.seekBackwardButton.cell().setAllowsSkipping(False)

        self.progressSlider.cursor = NSImage.imageNamed_(u'fs-progress-slider')
        self.progressSlider.sliderWasClicked = self.progressSliderWasClicked
        self.progressSlider.sliderWasDragged = self.progressSliderWasDragged
        self.progressSlider.sliderWasReleased = self.progressSliderWasReleased
        self.progressSlider.setShowCursor_(True)

        self.volumeSlider.cursor = NSImage.imageNamed_(u'fs-volume-slider')
        self.volumeSlider.sliderWasClicked = self.volumeSliderWasClicked
        self.volumeSlider.sliderWasDragged = self.volumeSliderWasDragged
        self.volumeSlider.sliderWasReleased = self.volumeSliderWasReleased
        self.volumeSlider.setShowCursor_(True)
开发者ID:nxmirrors,项目名称:miro,代码行数:29,代码来源:overlay.py


示例18: _conversions_panel

def _conversions_panel():
    extras = []

    lab = widgetset.Label(_("Binaries to use:"))
    lab.set_bold(True)
    extras.append(align_left(lab))

    grid = dialogwidgets.ControlGrid()

    grid.pack_label(_("ffmpeg binary path:"), grid.ALIGN_RIGHT)
    ffmpeg_binary = widgetset.TextEntry()
    attach_text(ffmpeg_binary, options.FFMPEG_BINARY)
    grid.pack(ffmpeg_binary)

    grid.end_line(spacing=4)

    grid.pack_label(_("ffmpeg2theora binary path:"), grid.ALIGN_RIGHT)
    ffmpeg2theora_binary = widgetset.TextEntry()
    attach_text(ffmpeg2theora_binary, options.FFMPEG2THEORA_BINARY)
    grid.pack(ffmpeg2theora_binary)

    grid.end_line(spacing=4)

    extras.append(align_left(grid.make_table()))

    return extras
开发者ID:cool-RR,项目名称:Miro,代码行数:26,代码来源:prefpanelset.py


示例19: __init__

    def __init__(self):
        widgetset.VBox.__init__(self)
        label = widgetset.Label()
        label.set_text(
            _("Your device isn't telling us its exact model number."))
        self.pack_start(widgetutil.align_center(label, left_pad=20, top_pad=50,
                                              bottom_pad=20))
        label = widgetset.Label()
        label.set_text(
            _('For optimal video conversion, select the device model.'))
        label.set_bold(True)
        self.pack_start(widgetutil.align_center(label, left_pad=20,
                                                bottom_pad=20)),

        self.device_choices = widgetset.VBox()
        self.pack_start(widgetutil.align_center(self.device_choices,
                                                left_pad=20, top_pad=20,
                                                bottom_pad=20))

        image = widgetset.ImageDisplay(
            imagepool.get(resources.path('images/sync-unknown.png')))
        self.pack_start(widgetutil.align_center(image, left_pad=20,
                                                bottom_pad=20))

        label = widgetset.Label()
        label.set_text(_("If you don't know the model or it doesn't appear "
                         "in the list, it's fine to choose the 'Generic' "
                         "device option."))
        label.set_bold(True)
        self.pack_start(widgetutil.align_center(label, left_pad=20,
                                                bottom_pad=20))
开发者ID:kmshi,项目名称:miro,代码行数:31,代码来源:devicecontroller.py


示例20: make_folder_context_menu

 def make_folder_context_menu(self, obj):
     return [
         (_('Update Podcasts In Folder'),
          app.widgetapp.update_selected_feeds),
         (_('Rename Podcast Folder'), app.widgetapp.rename_something),
         (_('Remove'), app.widgetapp.remove_something)
     ]
开发者ID:pombredanne,项目名称:miro,代码行数:7,代码来源:tablist.py



注:本文中的miro.gtcache._函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python gtcache.ngettext函数代码示例发布时间:2022-05-27
下一篇:
Python widgetutil.pad函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap