@@ -73,6 +73,8 @@ def __init__(self, parent, user, channel, chat_widget, me):
73
73
self .mapItem .setFlags (QtCore .Qt .ItemIsEnabled )
74
74
self .mapItem .setTextAlignment (QtCore .Qt .AlignHCenter )
75
75
76
+ self ._ladder_hide = False
77
+
76
78
self ._user = None
77
79
self ._user_player = None
78
80
self ._user_game = None
@@ -317,14 +319,31 @@ def update_rank(self):
317
319
self .rankItem .setToolTip (tooltip_str )
318
320
319
321
def updateGame (self ):
322
+ self .check_game_status ()
320
323
self .update_status_tooltip ()
321
324
self .update_status_icon ()
322
325
self .update_map ()
323
326
327
+ def check_game_status (self ):
328
+ self ._ladder_hide = False
329
+ if self ._me .player is None or self ._me .player .login != self .user .name :
330
+ return
331
+ game = self .user_game
332
+ if game is None or game .closed ():
333
+ return
334
+ if game .featured_mod == "ladder1v1" and game .state == GameState .OPEN :
335
+ self ._ladder_hide = True
336
+
324
337
def update_status_tooltip (self ):
325
338
# Status tooltip handling
326
339
game = self .user_game
327
340
if game is not None and not game .closed ():
341
+ if self ._ladder_hide :
342
+ game_map = "<i>[delayed reveal]</i>"
343
+ game_title = "<i>[delayed reveal]</i>"
344
+ else :
345
+ game_map = game .mapdisplayname
346
+ game_title = game .title
328
347
private_str = " (private)" if game .password_protected else ""
329
348
delay_str = ""
330
349
if game .state == GameState .OPEN :
@@ -340,7 +359,7 @@ def update_status_tooltip(self):
340
359
head_str = "Playing maybe ...</b>"
341
360
formatting = "<b>{}<br/>title: {}<br/>mod: {}<br/>map: {}<br/>players: {} / {}<br/>id: {}"
342
361
game_str = formatting .format (head_str .format (private = private_str , delay = delay_str , host = game .host ),
343
- game . title , game .featured_mod , maps . getDisplayName ( game . mapname ) ,
362
+ game_title , game .featured_mod , game_map ,
344
363
game .num_players , game .max_players , game .uid )
345
364
else : # game is None or closed
346
365
game_str = "Idle"
@@ -372,14 +391,18 @@ def update_map(self):
372
391
# Map icon handling - if we're in game, show the map if toggled on
373
392
game = self .user_game
374
393
if game is not None and not game .closed () and util .settings .value ("chat/chatmaps" , False ):
375
- mapname = game .mapname
376
- icon = maps .preview (mapname )
377
- if not icon :
378
- self .chat_widget .client .downloader .downloadMapPreview (mapname , self .mapItem ) # Calls setIcon
394
+ if self ._ladder_hide :
395
+ self .mapItem .setIcon (util .THEME .icon ("chat/status/unknown.png" ))
396
+ self .mapItem .setToolTip ("<i>[delayed reveal]</i>" )
379
397
else :
380
- self .mapItem .setIcon (icon )
398
+ mapname = game .mapname
399
+ icon = maps .preview (mapname )
400
+ if not icon :
401
+ self .chat_widget .client .downloader .downloadMapPreview (mapname , self .mapItem ) # Calls setIcon
402
+ else :
403
+ self .mapItem .setIcon (icon )
381
404
382
- self .mapItem .setToolTip (game .mapdisplayname )
405
+ self .mapItem .setToolTip (game .mapdisplayname )
383
406
else :
384
407
self .mapItem .setIcon (QtGui .QIcon ())
385
408
self .mapItem .setToolTip ("" )
0 commit comments