Skip to content
This repository was archived by the owner on Aug 20, 2021. It is now read-only.

Commit

Permalink
Tetris and Weather Fixes
Browse files Browse the repository at this point in the history
Summary tetris.py
echo(syncterm_setfont('cp437'))  to
echo_unbuffered(syncterm_setfont('cp437'))  Original buffered settings
makes this command output after the ANSI screen is drawn. It should push
out prior to displaying the ANSI screen.

Summary weather.py
1. loop was not saving new searches or prompting the user to save
because it was outside of the loop.  This affected current users since
it was not updating and only retrieving their last save.  And affected
new users because it would never save a new location.

2. Once this was fixed I noticed Accu Weather API doesn't return postal
code anymore on findcity.  This is causing the get.location to retrieve
a bad value on postal lookup for pre-populating the search field.
Changing this to City, State lookup solves the issues and looks nice
too.
  • Loading branch information
M-griffin committed Mar 14, 2015
1 parent e8d4cdf commit a8936cb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
8 changes: 8 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2.0.11
- bugfix: weather.py fix incorrect postal code return from Accu Weather.
Changed the default to populate search by city/state instead of
postal since this is no longer returned from accu weather correctly.
Also re-added missing save location field that was outside of
while loop to funtion exit.
- bugfix: tetris.py fix for sending terminal font sequence prior to
ansi screen display instead of after.
2.0.10
- bugfix: display updates when posting to oneliners, issue #235

Expand Down
2 changes: 1 addition & 1 deletion x84/default/tetris.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def echo(s):
getch()
# set syncterm font to cp437
if term.kind.startswith('ansi'):
echo(syncterm_setfont('cp437'))
echo_unbuffered(syncterm_setfont('cp437'))
artfile = os.path.join(os.path.dirname(__file__), 'art', 'tetris.ans')
echo_unbuffered(u'\r\n' * term.height) # cls
if os.path.exists(artfile):
Expand Down
6 changes: 4 additions & 2 deletions x84/default/weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ def do_search(term, search):
disp_notfound()
else:
disp_found(len(locations))

return locations


Expand Down Expand Up @@ -509,14 +510,15 @@ def main():
while True:
echo(u'\r\n\r\n')
location = session.user.get('location', dict())
search = location.get('postal', u'')
search = location.get('city', u'') + ', ' + location.get('state', u'')
disp_search_help()
search = get_zipsearch(search)
if search is None or 0 == len(search):
# exit (no selection)
return

locations = do_search(term, search)

if 0 != len(locations):
location = (locations.pop() if 1 == len(locations)
else chose_location(locations) or dict())
Expand Down Expand Up @@ -552,6 +554,6 @@ def main():
get_centigrade()
break
elif inp.code == term.KEY_ENTER:
chk_save_location(location)
return

chk_save_location(location)

0 comments on commit a8936cb

Please sign in to comment.