Skip to content

Commit

Permalink
Fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
carolineclark committed Jul 21, 2015
1 parent 678d624 commit 5191769
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
9 changes: 7 additions & 2 deletions bin/kano-egg
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python

"""
Modify the egg stats and display the status.
Expand All @@ -11,17 +13,20 @@ Options:
"""

import docopt
import sys
from kano_profile_gui.MissionScreen import MissionScreen

if __name__ == "__main__":
args = docopt.docopt(__doc__)

save = args['save']
load = args['load']
notification = args['--notification']
notification = args['-n'] or args['--notification']

if save:
level_number = args['<level>']
MissionScreen.save_egg_level(level_number)
if notification:
MissionScreen.show_egg_notification()
elif load:
return MissionScreen.read_egg_level()
sys.exit(MissionScreen.read_egg_level())
9 changes: 4 additions & 5 deletions kano_profile_gui/MissionScreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,12 @@ def read_egg_stage():
return load_app_state_variable("kano-egg", "level")

@staticmethod
def save_egg_level(stage, level):
def save_egg_level(level):
save_app_state_variable("kano-egg", "level", level)
MissionScreen.show_egg_notification()

@staticmethod
def show_egg_notification():
stage = MissionScreen.read_egg_stage()
stage = int(MissionScreen.read_egg_stage())

if stage in [1, 2]:
# Needs to be 280 by 170
Expand Down Expand Up @@ -78,10 +77,10 @@ def show_stage(self, stage):
save_app_state_variable("kano-egg", "level", 0)
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(self.egg_path, -1, 300)
self.title.set_text("It will only hatch if you're more active")
elif stage == 1:
elif stage == "1":
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(self.cracked_egg_path, -1, 300)
self.title.set_text("Ooh! It's making noises!")
elif stage == 2:
elif stage == "2":
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(self.hatched_path, -1, 300)
self.title.set_text("Congratulations, it's hatched!")

Expand Down
4 changes: 2 additions & 2 deletions kano_profile_gui/character_screens.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ def __init__(self, win):
self._win.show_all()

def put_pet_on_char_creator(self):
# Check for pet. If pet has been hatched, then show on the character
# Check for pet. If pet has been hatched, then show on the character
# creator
egg_hatched = load_app_state_variable("kano-egg", "level") == 2
egg_hatched = (load_app_state_variable("kano-egg", "level") == "2")
if egg_hatched:
hatched_path = os.path.join(
os.path.expanduser("~"),
Expand Down

0 comments on commit 5191769

Please sign in to comment.