def track(name): # Comes in as str, returns as dict activities = Activities() activity = activities.get(name, create=True) this_moment = datetime.now() activity.start = this_moment activities.save(activity)
def kaput(names): activities = Activities() for name in names: try: activities.delete(name) print "Deleted %s" % name except KeyError as e: print "Couldn't find \"%s\"" % name
def tag(name, tags): # tags comes as list activities = Activities() if not activities.exists(name): quit("Couldn't find anything by that name.", 0) activity = activities.get(name) # todo: if it's not tracking, identify which previous track to tag activity.tags = tags activities.save(activity)
def stop(name): activities = Activities() if not activities.exists(name): quit("Couldn't find anything by that name.", 0) activity = activities.get(name) start, now, delta = activity.current_delta() activity.previous.append( {'start': activity.start, 'end': now, 'delta': delta, 'tags': activity.tags, }) print '%s stopped. Tracked %s.' % (activity.name, delta) if len(activity.tags) > 0: print 'Tagged %s.' % activity.joined_tags() else: print "You might want to consider tagging the activity." activity.clear_current() activities.save(activity)
def login(self, email, password): """ Login user to Producteev. """ response = self.__request( 'users/login', email=email, password=password) self.token = response['login']['token'] self.users = Users(self) self.tasks = Tasks(self) self.dashboards = Dashboards(self) self.labels = Labels(self) self.activities = Activities(self) self.subtasks = Subtasks(self)
from pprint import pprint from location import Location from activities import Activities from inventory import Inventory from enemies import Enemies loop = True activities = Activities() inventory = Inventory() location = Location() enemies = Enemies() while loop: print('You are at ' + str(location.get_current_region_text(inventory, activities))) if inventory.playerInventory['health'] <= 0: print('You died!') print('You had ' + str(inventory.playerInventory['EXP']) + ' EXP!') loop = False else: print('Your health is ' + str(inventory.playerInventory['health'])) if inventory.playerInventory['house']: if activities.inventory_new_recipes == 'Unchecked': print('New crafting recipes learned!')
def show(args = None): activities = Activities() for name, activity in activities.get_all().iteritems(): activity.show(args)