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

Python util.icon函数代码示例

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

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



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

示例1: update

    def update(self, dic):
        self.name = dic["name"]
        self.played = dic["played"]
        self.description = dic["description"]
        self.version = dic["version"]
        self.author = dic["author"]
        self.downloads = dic["downloads"]
        self.likes = dic["likes"]
        self.comments = dic["comments"]
        self.bugreports = dic["bugreports"]
        self.date = QtCore.QDateTime.fromTime_t(dic['date']).toString("yyyy-MM-dd")
        self.isuimod = dic["ui"]
        self.isbigmod = dic["big"]
        self.issmallmod = dic["small"]
        self.link = dic["link"] #Direct link to the zip file.
        self.thumbstr = dic["thumbnail"]# direct url to the thumbnail file.
        self.uploadedbyuser = (self.author == self.parent.client.login)

        self.thumbnail = None
        if self.thumbstr == "":
            self.setIcon(util.icon("games/unknown_map.png"))
        else:
            img = getIcon(os.path.basename(urllib2.unquote(self.thumbstr)))
            if img:
                self.setIcon(util.icon(img, False))
            else:
                self.parent.client.downloader.downloadModPreview(self.thumbstr, self)
        self.updateVisibility()
开发者ID:AThorley,项目名称:lobby,代码行数:28,代码来源:__init__.py


示例2: __init__

    def __init__(self, client, *args, **kwargs):

        BaseClass.__init__(self, *args, **kwargs)

        self.setupUi(self)

        self.client = client
        self.client.gamesTab.layout().addWidget(self)

        #Dictionary containing our actual games.
        self.games = {}

        #Ranked search UI
        self.rankedAeon.setIcon(util.icon("games/automatch/aeon.png"))
        self.rankedCybran.setIcon(util.icon("games/automatch/cybran.png"))
        self.rankedSeraphim.setIcon(util.icon("games/automatch/seraphim.png"))
        self.rankedUEF.setIcon(util.icon("games/automatch/uef.png"))
        self.rankedRandom.setIcon(util.icon("games/automatch/random.png"))


        self.connectRankedToggles()
        self.rankedTimer = QtCore.QTimer()
        self.rankedTimer.timeout.connect(self.expandSearchRanked)
        self.searchProgress.hide()

        # Ranked search state variables
        self.searching = False
        self.radius = 0
        self.race = None
        self.ispassworded = False
        self.canChooseMap = True

        self.client.modInfo.connect(self.processModInfo)
        self.client.gameInfo.connect(self.processGameInfo)

        self.client.rankedGameAeon.connect(self.togglingAeon)
        self.client.rankedGameCybran.connect(self.togglingCybran)
        self.client.rankedGameSeraphim.connect(self.togglingSeraphim)
        self.client.rankedGameUEF.connect(self.togglingUEF)
        self.client.rankedGameRandom.connect(self.togglingRandom)


        self.client.gameEnter.connect(self.stopSearchRanked)
        self.client.viewingReplay.connect(self.stopSearchRanked)

        self.gameList.setItemDelegate(GameItemDelegate(self))
        self.gameList.itemDoubleClicked.connect(self.gameDoubleClicked)

        self.modList.itemDoubleClicked.connect(self.hostGameClicked)

        try:
            self.mapSelectButton.clicked.connect(self.mapSelectClicked)
        except:
            QtGui.QMessageBox.warning(None, "Skin outdated.", "The theme you are using is outdated. Please remove it or the lobby will malfunction.")

        #Load game name from settings (yay, it's persistent!)
        self.loadGameName()
        self.loadGameMap()
        self.loadPassword()
        self.options = []
开发者ID:IDragonfire,项目名称:modular-client,代码行数:60,代码来源:_gameswidget.py


示例3: preview

def preview(mapname, pixmap = False, force=False):
    try:
        # Try to load directly from cache
        for extension in iconExtensions:
            img = os.path.join(util.CACHE_DIR, mapname + "." + extension)
            if os.path.isfile(img):
                logger.debug("Using cached preview image for: " + mapname)
                return util.icon(img, False, pixmap)
        if force :
        # Try to download from web
            img = __downloadPreviewFromWeb(mapname)
            if img and os.path.isfile(img):
                logger.debug("Using web preview image for: " + mapname)
                return util.icon(img, False, pixmap)
    
        # Try to find in local map folder    
        img = __exportPreviewFromMap(mapname)["cache"]
        if img and os.path.isfile(img):
            logger.debug("Using fresh preview image for: " + mapname)
            return util.icon(img, False, pixmap)
        
        return None
    except:
        logger.error("Error raised in maps.preview(...) for " + mapname)
        logger.error("Map Preview Exception", exc_info=sys.exc_info())
开发者ID:IDragonfire,项目名称:modular-client,代码行数:25,代码来源:maps.py


示例4: __init__

    def __init__(self, client, *args, **kwargs):
        BaseClass.__init__(self, *args, **kwargs)

        self.setupUi(self)

        self.client = client
        self.client.gamesTab.layout().addWidget(self)

        self.mods = {}

        # Dictionary containing our actual games.
        self.games = {}

        self.canChooseMap = True

        #Ranked search UI
        self._ranked_icons = {
            Factions.AEON: self.rankedAeon,
            Factions.CYBRAN: self.rankedCybran,
            Factions.SERAPHIM: self.rankedSeraphim,
            Factions.UEF: self.rankedUEF,
            Factions.RANDOM: self.rankedRandom
        }
        self.rankedAeon.setIcon(util.icon("games/automatch/aeon.png"))
        self.rankedCybran.setIcon(util.icon("games/automatch/cybran.png"))
        self.rankedSeraphim.setIcon(util.icon("games/automatch/seraphim.png"))
        self.rankedUEF.setIcon(util.icon("games/automatch/uef.png"))
        self.rankedRandom.setIcon(util.icon("games/automatch/random.png"))

        for faction, icon in self._ranked_icons.items():
            icon.clicked.connect(partial(self.toggle_search, faction=faction))

        self.searchProgress.hide()

        # Ranked search state variables
        self.searching = False
        self.race = None
        self.ispassworded = False

        self.client.modInfo.connect(self.processModInfo)
        self.client.gameInfo.connect(self.processGameInfo)
        self.client.disconnected.connect(self.clear_games)

        self.client.gameEnter.connect(self.stopSearchRanked)
        self.client.viewingReplay.connect(self.stopSearchRanked)

        self.gameList.setItemDelegate(GameItemDelegate(self))
        self.gameList.itemDoubleClicked.connect(self.gameDoubleClicked)
        self.gameList.sortBy = 0  # Default Sorting is By Players count

        self.sortGamesComboBox.addItems(['By Players', 'By Game Quality', 'By avg. Player Rating'])
        self.sortGamesComboBox.currentIndexChanged.connect(self.sortGamesComboChanged)

        self.hideGamesWithPw.stateChanged.connect(self.togglePrivateGames)

        self.modList.itemDoubleClicked.connect(self.hostGameClicked)
开发者ID:Arkonen8,项目名称:client,代码行数:56,代码来源:_gameswidget.py


示例5: categories

def categories():
#	util.add_dir(__addon__.getLocalizedString(30001),{'top':BASE_URL+'/videozebricky/poslednich-50-videi'},util.icon('new.png'))
	util.add_dir('Top 200',{'top':furl('/videozebricky/top-100')},util.icon('top.png'))
	util.add_local_dir(__language__(30037),__addon__.getSetting('downloads'),util.icon('download.png'))
	data = util.request(BASE_URL)
	data = util.substr(data,'<ul id=\"headerMenu2\">','</ul>')
	pattern = '<a href=\"(?P<url>[^\"]+)(.+?)>(?P<name>[^<]+)'
	for m in re.finditer(pattern, data, re.IGNORECASE | re.DOTALL ):
		if m.group('url') == '/':
			continue
		util.add_dir(m.group('name'),{'cat':furl(m.group('url'))})
开发者ID:skata890,项目名称:xbmc-doplnky,代码行数:11,代码来源:default.py


示例6: __init__

    def __init__(self, message, *args, **kwargs):
        QtGui.QListWidgetItem.__init__(self, *args, **kwargs)

        self.mod  = message["name"]
        self.name = message["fullname"]
        self.options = message["options"]
        #Load Icon and Tooltip

        tip = message["desc"]      
        self.setToolTip(tip)
        
        if message["icon"] == None :
            icon = util.icon("games/mods/faf.png")        
            self.setIcon(icon)
        else :
            # TODO : download the icon from the remote path.
            pass
        
        
        if  self.mod in mod_crucial:
            color = client.instance.getColor("self")
        else:
            color = client.instance.getColor("player")
            
        self.setTextColor(QtGui.QColor(color))
        self.setText(self.name)
开发者ID:AThorley,项目名称:lobby,代码行数:26,代码来源:moditem.py


示例7: categories

def categories():
	#search.item()
	util.add_local_dir(__language__(30037),__addon__.getSetting('downloads'),util.icon('download.png'))
	util.add_dir('Všechny',{'list-all':''})
	for index,letter in enumerate(letters):
		util.add_dir(letter,{'list':str(index)})
	xbmcplugin.endOfDirectory(int(sys.argv[1]))
开发者ID:vrockai,项目名称:xbmc-doplnky,代码行数:7,代码来源:default.py


示例8: mapChanged

 def mapChanged(self, index):
     self.parent.gamemap = self.mapList.itemData(index)
     icon = maps.preview(self.parent.gamemap, True)
     if not icon:
         icon = util.icon("games/unknown_map.png", False, True)
     #self.mapPreview.setPixmap(icon)
     self.message['mapname'] = self.parent.gamemap
     self.game.update(self.message, self.parent.client)
开发者ID:AThorley,项目名称:lobby,代码行数:8,代码来源:hostgamewidget.py


示例9: __init__

    def __init__(self, client, *args, **kwargs):
        BaseClass.__init__(self, *args, **kwargs)

        self.setupUi(self)
        self.client = client

        self.labelIcon.setPixmap(util.icon("client/tray_icon.png", pix=True).scaled(32, 32))
        self.standardIcon = util.icon("client/comment.png", pix=True)

        screen = QtGui.QDesktopWidget().screenGeometry()
        dialog_size = self.geometry()

        # TODO: more positions
        # bottom right
        self.move(screen.width() - dialog_size.width(), screen.height() - dialog_size.height())

        # Frameless, always on top, steal no focus & no entry at the taskbar
        self.setWindowFlags(QtCore.Qt.ToolTip)
开发者ID:Arkonen8,项目名称:client,代码行数:18,代码来源:ns_dialog.py


示例10: search_plugin

def search_plugin(plugin, url, action):
    info = scrapper.get_info(url)
    titles = info["search-title"]
    params = {}
    if __addon__.getSetting("search-integration-update-history") == "false":
        params["search-no-history"] = ""
    for title in info["search-title"]:
        params[action] = title
        add_plugin_call(__language__(30008) + ": " + title, plugin, params, util.icon("search.png"))
    xbmcplugin.endOfDirectory(int(sys.argv[1]))
开发者ID:lzoubek,项目名称:xbmc-doplnky-old,代码行数:10,代码来源:default.py


示例11: __init__

    def __init__(self, client):
        self.client = client

        self.dialog = NotficationDialog(self.client)
        self.events = []
        self.disabledStartup = True
        self.lock = Lock()

        self.settings = NsSettingsDialog(self.client)

        self.user = util.icon("client/user.png", pix=True)
开发者ID:IDragonfire,项目名称:modular-client,代码行数:11,代码来源:__init__.py


示例12: update

    def update(self):
        """
        Updates the appearance of this chatter in the nicklist
         according to its lobby and irc states
        """
        # Color handling
        self.set_color()

        player = self.lobby.client.players[self.id]
        if not player and not self.id == -1:  # We should have a player object for this
            player = self.lobby.client.players[self.name]
            print("Looked up {} to {}".format(self.id, player))

        # Weed out IRC users and those we don't know about early.
        if self.id == -1 or player is None:
            self.rankItem.setIcon(util.icon("chat/rank/civilian.png"))
            self.rankItem.setToolTip("IRC User")
            return

        country = player.country
        if country is not None:
            self.setIcon(util.icon("chat/countries/%s.png" % country.lower()))
            self.setToolTip(country)

        if player.avatar != self.avatar:
            self.avatar = player.avatar
            self.updateAvatar()

        self.rating = player.rating_estimate()

        self.clan = player.clan
        if self.clan is not None:
            self.setText("[%s]%s" % (self.clan,self.name))

        rating = self.rating

        # Status icon handling
        if self.name in client.instance.urls:
            url = client.instance.urls[self.name]
            if url:
                if url.scheme() == "fafgame":
                    self.statusItem.setIcon(util.icon("chat/status/lobby.png"))
                    self.statusItem.setToolTip("In Game Lobby<br/>"+url.toString())
                elif url.scheme() == "faflive":
                    self.statusItem.setIcon(util.icon("chat/status/playing.png"))
                    self.statusItem.setToolTip("Playing Game<br/>"+url.toString())
        else:
            self.statusItem.setIcon(QtGui.QIcon())
            self.statusItem.setToolTip("Idle")

        #Rating icon choice
        #TODO: These are very basic and primitive
        self.rankItem.setToolTip("Global Rating: " + str(int(rating)))

        league = player.league
        if league is not None:
            self.rankItem.setToolTip("Division : " + league["division"]+ "\nGlobal Rating: " + str(int(rating)))
            self.rankItem.setIcon(util.icon("chat/rank/%s.png" % league["league"]))
        else:
            self.rankItem.setIcon(util.icon("chat/rank/newplayer.png"))
开发者ID:Blackclaws,项目名称:client,代码行数:60,代码来源:chatter.py


示例13: __init__

    def __init__(self, message, *args, **kwargs):
        QtGui.QListWidgetItem.__init__(self, *args, **kwargs)

        self.mod  = message["name"]
        self.order = message.get("order", 0)
        self.name = message["fullname"]
        #Load Icon and Tooltip

        tip = message["desc"]      
        self.setToolTip(tip)

        icon = util.icon(os.path.join("games/mods/", self.mod + ".png"))
        if icon.isNull():
            icon = util.icon("games/mods/default.png")
        self.setIcon(icon)

        if self.mod in mod_crucial:
            color = client.instance.getColor("self")
        else:
            color = client.instance.getColor("player")
            
        self.setTextColor(QtGui.QColor(color))
        self.setText(self.name)
开发者ID:Arkonen8,项目名称:client,代码行数:23,代码来源:moditem.py


示例14: finishedDownload

    def finishedDownload(self,reply):
        ''' finishing downloads '''
        urlstring = reply.url().toString()
        reqlist = []
        if urlstring in self.mapRequests: reqlist = self.mapRequests[urlstring]
        if urlstring in self.modRequests: reqlist = self.modRequests[urlstring]
        if reqlist:
            #save the map from cache
            name = os.path.basename(reply.url().toString())
            pathimg = os.path.join(util.CACHE_DIR, name)
            img = QtCore.QFile(pathimg)
            img.open(QtCore.QIODevice.WriteOnly)
            img.write(reply.readAll())
            img.close()
            if os.path.exists(pathimg):
                #Create alpha-mapped preview image
                try:
                    pass # the server already sends 100x100 pic
#                    img = QtGui.QImage(pathimg).scaled(100,100)
#                    img.save(pathimg)
                except:
                    pathimg = "games/unknown_map.png"
                    logger.info("Failed to resize " + name)
            else :
                pathimg = "games/unknown_map.png"
                logger.debug("Web Preview failed for: " + name)
            logger.debug("Web Preview used for: " + name)
            for requester in reqlist:
                if requester:
                    if requester in self.mapRequestsItem:
                        requester.setIcon(0, util.icon(pathimg, False))
                        self.mapRequestsItem.remove(requester)
                    else:
                        requester.setIcon(util.icon(pathimg, False))
            if urlstring in self.mapRequests: del self.mapRequests[urlstring]
            if urlstring in self.modRequests: del self.modRequests[urlstring]
开发者ID:Arkonen8,项目名称:client,代码行数:36,代码来源:__init__.py


示例15: loadPixmap

    def loadPixmap(self):
        self.pix = QtGui.QPixmap(40+16 + self.indent, 20)
        self.pix.fill(QtCore.Qt.transparent)
        painter = QtGui.QPainter(self.pix)

        self.avatar =  self.group.client.getUserAvatar(self.username)
        if  self.avatar:
            avatarPix = util.respix(self.avatar['url'])
            if avatarPix:
                painter.drawPixmap(0, 0, avatarPix)
                self.avatarNotLoaded = False
            else:
                self.avatarNotLoaded = True

        if self.country != None:
            painter.drawPixmap(40 + self.indent, 2, util.icon("chat/countries/%s.png" % self.country.lower(), pix=True))
        painter.end()
开发者ID:IDragonfire,项目名称:modular-client,代码行数:17,代码来源:friendlistudialog.py


示例16: update

    def update(self, message):  
        self.uid = message["idmap"]
        self.mapname = maps.link2name(message['maprealname'])  
        # Map preview code

        self.mapdisplayname = maps.getDisplayName(self.mapname)
        icon = maps.preview(self.mapname)
        if not icon:
            self.parent.downloader.downloadMap(self.mapname, self)
            icon = util.icon("games/unknown_map.png")


        self.selected = message["selected"]  
            

        self.setIcon(icon)
        text = "<font valign=center><b>%s</b></font>" % self.mapdisplayname
        self.setText(text)
开发者ID:AThorley,项目名称:lobby,代码行数:18,代码来源:_mapSelectWidget.py


示例17: parse_page

def parse_page(page,url):
	data = util.substr(page,'<div class=\"vypis','<div class=\"right')
	pattern = '<div class=\"tale_char_div\"(.+?)<img(.+?)src=\"(?P<img>[^\"]+)(.+?)<a(.+?)href=\"(?P<url>[^\"]+)[^>]+>(?P<name>[^<]+)<(.+?)<p[^>]*>(?P<plot>[^<]+)'
	for m in re.finditer(pattern, data, re.IGNORECASE | re.DOTALL):
		util.add_video(
			m.group('name'),
			{'play':furl(m.group('url'))},
			m.group('img'),
			infoLabels={'Plot':m.group('plot')},
			menuItems={xbmc.getLocalizedString(33003):{'name':m.group('name'),'download':furl(m.group('url'))}}
		)
	data = util.substr(page,'<p class=\"p_wrapper','</p>')
	index =  url.find('?')
	if index > 0:
		url = url[:index]
	n = re.search('<a(.+?)href=\"(?P<url>[^\"]+)\"[^>]*>&gt;<',data)
	if n:
		util.add_dir(__language__(30012),{'tale':furl(url+n.group('url'))},util.icon('next.png'))
	xbmcplugin.endOfDirectory(int(sys.argv[1]))
开发者ID:vrockai,项目名称:xbmc-doplnky,代码行数:19,代码来源:default.py


示例18: update

    def update(self, message, client):
        '''
        Updates this item from the message dictionary supplied
        '''
        
        
        self.client  = client
        
        self.name       = message["name"]
        self.mapname    = message["map"]
        self.duration   = time.strftime('%H:%M:%S', time.gmtime(message["duration"]))
        self.startHour  = time.strftime("%H:%M", time.localtime(message['start']))
        self.startDate  = time.strftime("%Y-%m-%d", time.localtime(message['start']))
        self.mod        = message["mod"]
         
        # Map preview code
        self.mapdisplayname = maps.getDisplayName(self.mapname)
      
        self.icon = maps.preview(self.mapname)
        if not self.icon:
            self.client.downloader.downloadMap(self.mapname, self, True)
            self.icon = util.icon("games/unknown_map.png")        
        #self.setIcon(0, self.icon)
        
        self.moddisplayname = self.mod
        self.modoptions = []

        if self.mod in mods :
            self.moddisplayname = mods[self.mod].name 

#        self.title      = message['title']
#        self.host       = message['host']
#        self.teams      = message['teams']
#        self.access     = message.get('access', 'public')
#        self.mod        = message['featured_mod']
#        self.options    = message.get('options', [])
#        self.numplayers = message.get('num_players', 0) 
#        self.slots      = message.get('max_players',12)

        self.viewtext = (self.FORMATTER_REPLAY.format(time=self.startHour, name=self.name, map = self.mapdisplayname, duration = self.duration, mod = self.moddisplayname))
开发者ID:AThorley,项目名称:lobby,代码行数:40,代码来源:replayitem.py


示例19: updateOnlineTree

 def updateOnlineTree(self):
     self.replayInfos.clear()
     self.onlineTree.clear()
     buckets = {}
     for uid in self.onlineReplays :
         bucket = buckets.setdefault(self.onlineReplays[uid].startDate, [])
         bucket.append(self.onlineReplays[uid])
         
     for bucket in buckets.keys():
         bucket_item = QtGui.QTreeWidgetItem()
         self.onlineTree.addTopLevelItem(bucket_item)
         
         bucket_item.setIcon(0, util.icon("replays/bucket.png"))                                
         bucket_item.setText(0, "<font color='white'>" + bucket+"</font>")
         bucket_item.setText(1,"<font color='white'>" + str(len(buckets[bucket])) + " replays</font>")
         
         
         
         for replay in buckets[bucket]:
             bucket_item.addChild(replay)
             replay.setFirstColumnSpanned(True)
             replay.setIcon(0, replay.icon)
             
         bucket_item.setExpanded(True)
开发者ID:Arkonen8,项目名称:client,代码行数:24,代码来源:_replayswidget.py


示例20: update

    def update(self, message, client):
        '''
        Updates this item from the message dictionary supplied
        '''
        
        
        self.client = client
        self.tutorial      = message['tutorial']
        self.description   = message['description']
        self.url           = "http://content.faforever.com/faf/tutorials/" + message['url']

        # Map preview code
        if self.mapname != message['mapname']:
            self.mapname = message['mapname']
            self.mapdisplayname = maps.getDisplayName(self.mapname)

            icon = maps.preview(self.mapname)
            if not icon:
                icon = util.icon("games/unknown_map.png")
                self.client.downloader.downloadMap(self.mapname, self)
                                        
            self.setIcon(icon)

        self.setText(self.FORMATTER_TUTORIAL.format(mapdisplayname=self.mapdisplayname, title=self.tutorial, description=self.description))
开发者ID:AThorley,项目名称:lobby,代码行数:24,代码来源:tutorialitem.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python util.image_to_scratch函数代码示例发布时间:2022-05-26
下一篇:
Python util.homify函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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