Skip to content

Commit

Permalink
Only run the update checker if running uh leads to a plain main screen
Browse files Browse the repository at this point in the history
This excludes direct start parameters and gui tests.
  • Loading branch information
totycro committed Apr 18, 2012
1 parent ff0be64 commit 64d9f80
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions horizons/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,21 +167,6 @@ def start(_command_line_arguments):
preload_thread = threading.Thread(target=preload_game_data, args=(preload_lock,))
preloading = (preload_thread, preload_lock)

# initalize update checker
from horizons.util.checkupdates import UpdateInfo, check_for_updates, show_new_version_hint
update_info = UpdateInfo()
update_check_thread = threading.Thread(target=check_for_updates, args=(update_info,))
update_check_thread.start()
def update_info_handler(info):
if info.status == UpdateInfo.UNINITIALISED:
ExtScheduler().add_new_object(Callback(update_info_handler, info), info)
elif info.status == UpdateInfo.READY:
show_new_version_hint(_modules.gui, info)
elif info.status == UpdateInfo.INVALID:
pass # couldn't retrieve file or nothing relevant in there

update_info_handler(update_info) # schedules checks by itself

# Singleplayer seed needs to be changed before startup.
if command_line_arguments.sp_seed:
SINGLEPLAYER.SEED = command_line_arguments.sp_seed
Expand Down Expand Up @@ -225,6 +210,23 @@ def update_info_handler(info):
_modules.gui.show_multi()
_modules.gui.join_mp_game()
else: # no commandline parameter, show main screen

# initalize update checker
if not command_line_arguments.gui_test:
from horizons.util.checkupdates import UpdateInfo, check_for_updates, show_new_version_hint
update_info = UpdateInfo()
update_check_thread = threading.Thread(target=check_for_updates, args=(update_info,))
update_check_thread.start()
def update_info_handler(info):
if info.status == UpdateInfo.UNINITIALISED:
ExtScheduler().add_new_object(Callback(update_info_handler, info), info)
elif info.status == UpdateInfo.READY:
show_new_version_hint(_modules.gui, info)
elif info.status == UpdateInfo.INVALID:
pass # couldn't retrieve file or nothing relevant in there

update_info_handler(update_info) # schedules checks by itself

_modules.gui.show_main()
if not command_line_arguments.nopreload:
preloading[0].start()
Expand Down

0 comments on commit 64d9f80

Please sign in to comment.