本文整理汇总了Python中util.icon函数的典型用法代码示例。如果您正苦于以下问题:Python icon函数的具体用法?Python icon怎么用?Python icon使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了icon函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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()
示例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 = []
示例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())
示例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)
示例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'))})
示例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)
示例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]))
示例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)
示例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)
示例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]))
示例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)
示例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"))
示例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)
示例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]
示例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()