Skip to content

Commit

Permalink
Update update_live_stats.py (#3985)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kassadd authored and elicwhite committed Aug 17, 2016
1 parent 7136348 commit 3d5e270
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions pokemongo_bot/cell_workers/update_live_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,25 @@ def _update_title(self, title, platform):
:raise: RuntimeError: When the given platform isn't supported.
"""

if platform == "linux" or platform == "linux2" or platform == "cygwin":
stdout.write("\x1b]2;{}\x07".format(title))
stdout.flush()
elif platform == "darwin":
stdout.write("\033]0;{}\007".format(title))
stdout.flush()
elif platform == "win32":
ctypes.windll.kernel32.SetConsoleTitleA(title.encode())
else:
raise RuntimeError("unsupported platform '{}'".format(platform))
try:
if platform == "linux" or platform == "linux2" or platform == "cygwin":
stdout.write("\x1b]2;{}\x07".format(title))
stdout.flush()
elif platform == "darwin":
stdout.write("\033]0;{}\007".format(title))
stdout.flush()
elif platform == "win32":
ctypes.windll.kernel32.SetConsoleTitleA(title.encode())
else:
raise RuntimeError("unsupported platform '{}'".format(platform))
except AttributeError:
self.emit_event(
'log_stats',
level = 'error',
formatted = "Unable to write window title"
)
self.terminal_title = False

self._compute_next_update()

def _get_stats_line(self, player_stats):
Expand Down

0 comments on commit 3d5e270

Please sign in to comment.