当前位置: 首页>>代码示例>>Python>>正文


Python PopupBox.show方法代码示例

本文整理汇总了Python中gui.PopupBox.PopupBox.show方法的典型用法代码示例。如果您正苦于以下问题:Python PopupBox.show方法的具体用法?Python PopupBox.show怎么用?Python PopupBox.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gui.PopupBox.PopupBox的用法示例。


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

示例1: image_list

# 需要导入模块: from gui.PopupBox import PopupBox [as 别名]
# 或者: from gui.PopupBox.PopupBox import show [as 别名]
def image_list(parent, title, user):
    """Get the image list for a specific user"""
    logger.log( 9, 'image_list(parent=%r, title=%r, user=%r)', parent, title, user)
    items = []
    web = 'http://www.flickr.com/services/rest/?method=flickr.people.getPublicPhotos&user_id=' + user + \
        '&format=json&api_key=' + config.FLICKR_KEY + '&per_page=' + str(config.FLICKR_LIMIT) + \
        '&page=1&extras=original_format'
    url=urllib.urlopen(web)
    flickr=url.read()
    flickr=flickr.replace("jsonFlickrApi(","");
    data = json.read(flickr[:-1])
    for foto in data['photos']['photo']:
            #items.append(ImageItem(y[1],parent,foto["title"]))

        mi = menu.MenuItem(foto["title"], parent.showimage, 0)
        mi.arg = (foto["title"],"http://farm3.static.flickr.com/" + foto["server"] + "/" + \
            foto["id"] + "_" + foto["originalsecret"] +  "_o.jpg",foto["id"])
        imagen = 'http://farm3.static.flickr.com/' + foto['server'] + '/' + foto['id'] + '_' + foto['secret'] + '_m.jpg'
        file = config.FLICKR_DIR + '/' + foto['id'].replace('-','_') + '_t.jpg'
        if not os.path.exists(file):
            box = PopupBox(_('Downloading thumbnail for picture "') + foto['title'] + '"', width=800)
            box.show()
            urllib.urlretrieve(imagen,file)
            box.destroy()
        mi.image = file
        items.append(mi)
    return items
开发者ID:adozenlines,项目名称:freevo1,代码行数:29,代码来源:flickr.py

示例2: search_lyrics

# 需要导入模块: from gui.PopupBox import PopupBox [as 别名]
# 或者: from gui.PopupBox.PopupBox import show [as 别名]
    def search_lyrics(self, arg=None, menuw=None):
        box = PopupBox(text=_('Searching lyrics...'))
        box.show()

        result_code = -1
        try:
            url = "http://api.leoslyrics.com/api_search.php?auth=%s&artist=%s&songtitle=%s"%(
                LEOLYRICS_AUTH,
                urllib.quote(self.item.info['artist'].encode('utf-8')),
                urllib.quote(self.item.info['title'].encode('utf-8')))
            logger.log( 9, url)
            info = urllib2.urlopen(url).read()
            result_code = re.search('.+<response code="(\d)">.+',info).group(1)
        except:
            print "Error searching for artist/title."

        box.destroy()

        if result_code == '0': #ok
            #get the hid
            filter_info = re.search('.+hid="(.+)" exactMatch="true".+', info)
            if filter_info:
                # there is a exact match
                self.fetch_lyric(arg=filter_info.group(1), menuw=menuw)
            else:
                # open a submenu with choices
                self.show_choices(menuw=menuw, info= info)
        else:
            box = PopupBox(text=_('Lyrics not found, sorry...'))
            box.show()
            time.sleep(2)
            box.destroy()
开发者ID:adozenlines,项目名称:freevo1,代码行数:34,代码来源:lyrics.py

示例3: show_choices

# 需要导入模块: from gui.PopupBox import PopupBox [as 别名]
# 或者: from gui.PopupBox.PopupBox import show [as 别名]
 def show_choices(self, menuw, info):
     items = []
     soup = BeautifulStoneSoup(info,selfClosingTags=['feat'])
     results = soup.findAll('result')
     for result in results[:20]:
         # for performance reasons show the first possibilities only,
         # the more sensible hits are at the beginning of the list
         hid = result['hid']
         title = result.titleTag.string.replace('&amp;', '&')
         artist = result.artistTag.nameTag.string.replace('&amp;','&')
         items.append(menu.MenuItem('%s - %s' % (title, artist),
                      action=self.fetch_lyric, arg=hid))
     if len(items) > 0:
         msgtext = _('No exact match. ')
         msgtext+= _('Here are some sugestions.')
         box = PopupBox(text = msgtext)
         box.show()
         time.sleep(2)
         box.destroy()
         choices_menu = menu.Menu(_('Choices'), items)
         menuw.pushmenu(choices_menu)
     else:
         box = PopupBox(text= _('Lyrics not found, sorry...'))
         box.show()
         time.sleep(3)
         box.destroy()
开发者ID:adozenlines,项目名称:freevo1,代码行数:28,代码来源:lyrics.py

示例4: getMameItemInfoList

# 需要导入模块: from gui.PopupBox import PopupBox [as 别名]
# 或者: from gui.PopupBox.PopupBox import show [as 别名]
def getMameItemInfoList(mame_files, mame_cmd):
    items = []
    rm_files = []

    print "Call MAME command : %s" % mame_cmd
    # Only build the cache if it doesn't exis.
    if not os.path.isfile(config.GAMES_MAME_CACHE):
        waitmsg = PopupBox(text=_('Generating MAME cache, please wait.'))
        waitmsg.show()
        mame_ok = updateMameRomList(mame_cmd)
        waitmsg.destroy()

        if not mame_ok:
            return (mame_files, [])

    mameRomList = getMameRomList()
    roms = mameRomList.getMameRoms()

    for romfile in mame_files:
        key = os.path.splitext(os.path.basename(romfile))[0]
        if roms.has_key(key):
            rom = roms[key]
            info = { 'manufacturer': rom.manufacturer,
                     'name': rom.name,
                     'description': rom.description,
                     'year': rom.year,
                     'cloneof': rom.cloneof,
                     'romof': rom.romof }
            items += [(rom.description, romfile, None, info)]
            rm_files.append(romfile)

    return (rm_files, items)
开发者ID:adozenlines,项目名称:freevo1,代码行数:34,代码来源:mame_cache.py

示例5: create_podcast_submenu

# 需要导入模块: from gui.PopupBox import PopupBox [as 别名]
# 或者: from gui.PopupBox.PopupBox import show [as 别名]
    def create_podcast_submenu(self, arg=None, menuw=None, image=None):
        popup = PopupBox(text=_("Fetching podcasts..."))
        popup.show()
        url = arg[1]
        p = podcast()
        p.open_rss(url)
        p.rss_title()
        p.rss_count()
        image = os.path.join(config.APODCAST_DIR, arg[0], "cover.jpg")

        podcast_items = []
        for pc_location in range(p.rss.count):
            p.rss_item(pc_location)
            podcast_item = ApodcastItem()
            podcast_item.name = p.title
            podcast_item.url = p.enclosure
            podcast_item.type = "audio"
            podcast_item.description = p.description
            podcast_item.image = image
            podcast_item.mplayer_options = ""
            podcast_item.filename = os.path.join(config.APODCAST_DIR, arg[0], os.path.split(p.enclosure)[1])
            podcast_item.network_play = 1
            podcast_item.length = 0
            podcast_item.remain = 0
            podcast_item.elapsed = 0
            podcast_item.info = {"album": "", "artist": "", "trackno": "", "title": ""}
            podcast_items += [podcast_item]

        popup.destroy()
        if len(podcast_items) == 0:
            podcast_items += [menu.MenuItem(_("No Podcast locations found"), menwu.back_one_menu, 0)]
        podcast_sub_menu = menu.Menu(_("AUDIO PODCAST"), podcast_items)
        menuw.pushmenu(podcast_sub_menu)
        menuw.refresh()
开发者ID:jduda,项目名称:freevo1,代码行数:36,代码来源:apodcast.py

示例6: create_podcast_menu

# 需要导入模块: from gui.PopupBox import PopupBox [as 别名]
# 或者: from gui.PopupBox.PopupBox import show [as 别名]
    def create_podcast_menu(self, arg=None, menuw=None):
        popup = PopupBox(text=_("Fetching podcast..."))
        popup.show()
        podcast_menu_items = []

        for location in config.APODCAST_LOCATIONS:
            url = location[1]
            image_path = os.path.join(config.APODCAST_DIR, location[0], "cover.jpg")
            if self.check_logo(image_path):
                p = podcast()
                p.open_rss(url)
                p.rss_title()
                name = p.rss_title
                image_url = p.rss_image
                self.download(image_url, image_path)

            if len(config.APODCAST_DIR) == 0:
                podcast_items += [menu.MenuItem(_("Set APODCAST_DIR in local_conf.py"), menwu.back_one_menu, 0)]
            podcast_menu_items += [
                menu.MenuItem(_(location[0]), action=self.create_podcast_submenu, arg=location, image=image_path)
            ]

        popup.destroy()
        podcast_main_menu = menu.Menu(_("AUDIO PODCAST"), podcast_menu_items)
        menuw.pushmenu(podcast_main_menu)
        menuw.refresh()
开发者ID:jduda,项目名称:freevo1,代码行数:28,代码来源:apodcast.py

示例7: cover_search_file

# 需要导入模块: from gui.PopupBox import PopupBox [as 别名]
# 或者: from gui.PopupBox.PopupBox import show [as 别名]
    def cover_search_file(self, arg=None, menuw=None):
        """
        search Amazon for this item
        """
        logger.debug('cover_search_file(arg=%r, menuw=%r)', arg, menuw)
        box = PopupBox(text=_('searching Amazon...'))
        box.show()

        album = self.item.getattr('album')
        if not album:
            album = self.item.getattr('title')

        artist = self.item.getattr('artist')

        # Maybe the search string need encoding to config.LOCALE
        search_string = '%s %s' % (artist.encode(config.AMAZON_QUERY_ENCODING),
                                   album.encode(config.AMAZON_QUERY_ENCODING))
        search_string = re.sub('[\(\[].*[\)\]]', '', search_string)
        logger.debug('search_string=%r', search_string)
        try:
            cover = amazon.ItemSearch(search_string, SearchIndex='Music', ResponseGroup='Images,ItemAttributes')
        except amazon.AWSException, why:
            box.destroy()
            title = '\n'.join([artist, album])
            dict_tmp = { 'artist': artist, 'album': album }
            print '%(artist)s - %(album)s' % (dict_tmp)
            print '%r' % why
            box = PopupBox(text=artist+'\n'+album+'\n'+why[:40])
            box.show()
            time.sleep(2)
            box.destroy()
            return
开发者ID:adozenlines,项目名称:freevo1,代码行数:34,代码来源:coversearch.py

示例8: cover_create

# 需要导入模块: from gui.PopupBox import PopupBox [as 别名]
# 或者: from gui.PopupBox.PopupBox import show [as 别名]
    def cover_create(self, arg=None, menuw=None):
        """
        create cover file for the item
        """
        import directory

        box = PopupBox(text= _('getting data...'))
        box.show()

        #filename = os.path.splitext(self.item.filename)[0]
        if self.item.type == 'audiocd':
            filename = '%s/disc/metadata/%s.jpg' % (config.OVERLAY_DIR, self.item.info['id'])
        elif self.item.type == 'dir':
            filename = os.path.join(self.item.dir, 'cover.jpg')
        else:
            filename = '%s/cover.jpg' % (os.path.dirname(self.item.filename))

        fp = urllib2.urlopen(str(arg))
        m = vfs.open(filename,'wb')
        m.write(fp.read())
        m.close()
        fp.close()

        # try to crop the image to avoid ugly borders
        try:
            image = imlib2.open(filename)
            width, height = image.size
            image.crop((2, 2), (width-4, height-4)).save(filename)
            util.cache_image(filename)
        except Exception, why:
            logger.warning(why)
开发者ID:adozenlines,项目名称:freevo1,代码行数:33,代码来源:coversearch.py

示例9: fetchheadlinesfromurl

# 需要导入模块: from gui.PopupBox import PopupBox [as 别名]
# 或者: from gui.PopupBox.PopupBox import show [as 别名]
    def fetchheadlinesfromurl(self):
        headlines = []

        popup = PopupBox(text=_('Fetching headlines...'))
        popup.show()
        try:
            # parse the document
            doc = util.feedparser.parse(self.url)
            if doc.status < 400:
                for entry in doc['entries']:
                    try:
                        title = Unicode(entry.title)
                        link  = Unicode(entry.link)
                        if entry.has_key('content') and len(entry['content']) >= 1:
                            description = Unicode(entry['content'][0].value)
                        else:
                            description = Unicode(entry['summary_detail'].value)
                        headlines.append((title, link, description))
                    except AttributeError:
                        pass
            else:
                logger.debug('Error %s, getting %r', doc.status, self.url)

            #write the file
            if len(headlines) > 0:
                pfile = os.path.join(self.cachedir, 'headlines-%i' % self.location_index)
                util.save_pickle(headlines, pfile)
        finally:
            popup.destroy()

        return headlines
开发者ID:adozenlines,项目名称:freevo1,代码行数:33,代码来源:headlines.py

示例10: selected_quality

# 需要导入模块: from gui.PopupBox import PopupBox [as 别名]
# 或者: from gui.PopupBox.PopupBox import show [as 别名]
    def selected_quality(self, arg, menuw):
        api, show, season, episode, host, quality = arg

        self.video_item = None
        self.menuw = menuw
        self.file_object = episode
        self.selected_host = host
        self.selected_quality = quality
        config.VIDEO_SHOW_DATA_DIR = '/media/disk/video'
        self.file_path = os.path.join(config.VIDEO_SHOW_DATA_DIR, self.get_filename(episode))
        box = PopupBox(text='Starting download... will start playing shortly')
        box.show()
        time.sleep(2)
        box.destroy()

        if os.path.exists(self.file_path):
            # TODO: check file completition?
            self.play()
            return

        url_open = UrlOpen()
        url = self.file_object.get_subtitle_url(quality=self.selected_quality)
        filename = self.file_path.replace(".mp4", ".srt")
        url_open(url, filename=filename)

        print episode.file_hosts[host][quality]
        self.gui_manager.background_task(self.pre_download, self.play)
        self.downloader = Downloaders.get(host, self.gui_manager, episode.file_hosts[host][quality])
        self.downloader.process_url(None, self.file_path)
开发者ID:seppo0010,项目名称:freevocavane,代码行数:31,代码来源:fcmenu.py

示例11: filmaffinity_create_fxd

# 需要导入模块: from gui.PopupBox import PopupBox [as 别名]
# 或者: from gui.PopupBox.PopupBox import show [as 别名]
    def filmaffinity_create_fxd(self, arg=None, menuw=None):
        """
        create fxd file for the item
        """
        box = PopupBox(text=_('Fetching movie information'))
        box.show()

        #if this exists we got a cdrom/dvdrom
        if self.item.media and self.item.media.devicename:
            devicename = self.item.media.devicename
        else:
            devicename = None

        self.getFilmAffinityPage(arg[0])

        if self.disc_set:
            self.setDiscset(devicename, None)
        else:
            if self.item.subitems:
                for i in range(len(self.item.subitems)):
                    video = makeVideo('file', 'f%s' % i,
                                      os.path.basename(self.item.subitems[i].filename),
                                      device=devicename)
                    self.setVideo(video)
            else:
                video = makeVideo('file', 'f1', os.path.basename(self.item.filename),
                                  device=devicename)
                self.setVideo(video)
            self.setFxdFile(os.path.splitext(self.item.filename)[0])

        self.writeFxd()
        self.filmaffinity_menu_back(menuw)
        box.destroy()
开发者ID:golaizola,项目名称:freevo1,代码行数:35,代码来源:filmaffinity.py

示例12: get_feed_menu

# 需要导入模块: from gui.PopupBox import PopupBox [as 别名]
# 或者: from gui.PopupBox.PopupBox import show [as 别名]
 def get_feed_menu(self, feed):
     service = gdata.service.GDataService(server='gdata.youtube.com')
     gfeed = service.GetFeed(feed)
     box = PopupBox(text=_('Loading video list'))
     box.show()
     menu =  YoutubeVideoMenu(service, gfeed, self)
     box.destroy()
     return menu
开发者ID:adozenlines,项目名称:freevo1,代码行数:10,代码来源:youtube.py

示例13: download_play

# 需要导入模块: from gui.PopupBox import PopupBox [as 别名]
# 或者: from gui.PopupBox.PopupBox import show [as 别名]
 def download_play(self, arg=None, menuw=None):
     pop = PopupBox("Descargando programa")
     pop.show()
     video = VideoItem(_fetch_image(arg["flv"]), self)
     pop.destroy()
     video.image = _fetch_image(arg["image"])
     video.menuw = menuw
     video.play()
开发者ID:golaizola,项目名称:freevo1,代码行数:10,代码来源:rtve.py

示例14: make_menu

# 需要导入模块: from gui.PopupBox import PopupBox [as 别名]
# 或者: from gui.PopupBox.PopupBox import show [as 别名]
 def make_menu(self, arg=None, menuw=None):
     try:
         menuw.pushmenu(menu.Menu('Albums',
         [ AlbumItem(x, self, self.service) for x in self.service.getAlbums()]))
     except MusicIPException, x:
         pop = PopupBox(text=_(str(x)))
         pop.show()
         time.sleep(2)
         pop.destroy()
         return
开发者ID:adozenlines,项目名称:freevo1,代码行数:12,代码来源:musicip.py

示例15: showimage

# 需要导入模块: from gui.PopupBox import PopupBox [as 别名]
# 或者: from gui.PopupBox.PopupBox import show [as 别名]
 def showimage(self, arg=None, menuw=None):
     """Save in file and watch it"""
     logger.log( 9, 'showimage(arg=%r, menuw=%r)', arg, menuw)
     file = config.FLICKR_DIR + "/" + arg[2].replace("-","_") + ".jpg"
     if not os.path.exists(file):
         box = PopupBox(_("Downloading picture \"") + arg[0] + '"', width=600)
         box.show()
         urllib.urlretrieve(arg[1],file)
         box.destroy()
     imgitem = ImageItem(file, self, arg[0])
     imgitem.menuw=menuw
     imgitem.view(menuw=menuw)
开发者ID:adozenlines,项目名称:freevo1,代码行数:14,代码来源:flickr.py


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