def show_challenges(self, bundle_id): self._bundle_id = bundle_id repository = challrepo.get_global_repository() self._challenges = repository.get_challenges(self._bundle_id) self.listmodel.clear() for challenge in self._challenges.values(): description = challenge.get_description().format(target=challenge.get_result().get_target()) self.listmodel.append([challenge.get_id(), description])
def show_challenges(self, bundle_id): self._bundle_id = bundle_id repository = challrepo.get_global_repository() self._challenges = repository.get_challenges(self._bundle_id) self.listmodel.clear() for challenge in self._challenges.values(): description = challenge.get_description().format( target=challenge.get_result().get_target()) self.listmodel.append([challenge.get_id(), description])
def check_achievements(self, operator): challenge_id = operatorchallenge[operator] repo = challrepo.get_global_repository() result = repo.get_result(BUNDLE_ID, challenge_id) if result.get_result() is not None: if (result.get_result() >= self._correct[operator]): return #higher result already recorded result.set_result(self._correct[operator]) repo.set_result(BUNDLE_ID, challenge_id, result)
def check_achievements(self, operator): challenge_id = operatorchallenge[operator] repo = challrepo.get_global_repository() result = repo.get_result(BUNDLE_ID, challenge_id) if result.get_result() is not None: if (result.get_result() >= self._correct[operator]): return #higher result already recorded result.set_result(self._correct[operator]) repo.set_result(BUNDLE_ID, challenge_id, result)
def __init__(self, handle): # This runs the constructor for an activity activity.Activity.__init__(self, handle) # Creates the Toolbox. It contains the Activity Toolbar, which is the # bar that appears on every Sugar window and contains essential # functionalities toolbox = activity.ActivityToolbox(self) self.set_toolbox(toolbox) toolbox.show() # Create the main mathogen practice window self.layout = MathogenPracGui(_CORRECT_ANSWERS_TO_WIN) self.set_canvas(self.layout) repository = challrepo.get_global_repository() repository.update_challenges(mathogen_prac.BUNDLE_ID, mathogen_prac.challenges)
def __init__(self, handle): # This runs the constructor for an activity activity.Activity.__init__(self, handle) # Creates the Toolbox. It contains the Activity Toolbar, which is the # bar that appears on every Sugar window and contains essential # functionalities toolbox = activity.ActivityToolbox(self) self.set_toolbox(toolbox) toolbox.show() # Create the main mathogen practice window self.layout = MathogenPracGui(_CORRECT_ANSWERS_TO_WIN) self.set_canvas(self.layout) repository = challrepo.get_global_repository() repository.update_challenges(mathogen_prac.BUNDLE_ID, mathogen_prac.challenges)
def __init__(self): gtk.VBox.__init__(self, False, 0) # store mathogen prac activity when it is found mpa = None self.label = gtk.Label("") self.pack_start(self.label, True, True, 5) self.label.show() # testing challenge repository challreg = challrepo.get_global_repository() self.writeline(str(challreg._challenges)) # retrieve the activity bundle info # make a label with the name of each registry = bundleregistry.get_registry() for info in registry: if info.get_bundle_id() == "org.davidmason.mathogen_prac": thing = ", ".join([info.get_name(), info.get_bundle_id()]) self.writeline(thing) mpa = info if mpa is None: self.writeline("activity not found") else: self.writeline("activity found") query = {'activity': mpa.get_bundle_id()} properties = [ 'uid', 'title', 'icon-color', 'activity', 'activity_id', 'mime_type', 'mountpoint' ] datastore.find(query, sorting=['+timestamp'], limit=5, properties=properties, reply_handler=self._query_reply_handler_cb, error_handler=self._query_error_handler_cb) self.writeline("sent datastore find command") self.show()
def __init__(self): gtk.VBox.__init__(self, False, 0) # store mathogen prac activity when it is found mpa = None self.label = gtk.Label("") self.pack_start(self.label, True, True, 5) self.label.show() # testing challenge repository challreg = challrepo.get_global_repository() self.writeline(str(challreg._challenges)) # retrieve the activity bundle info # make a label with the name of each registry = bundleregistry.get_registry() for info in registry: if info.get_bundle_id() == "org.davidmason.mathogen_prac": thing = ", ".join([info.get_name(), info.get_bundle_id()]) self.writeline(thing) mpa = info if mpa is None: self.writeline("activity not found") else: self.writeline("activity found") query = {'activity': mpa.get_bundle_id()} properties = ['uid', 'title', 'icon-color', 'activity', 'activity_id', 'mime_type', 'mountpoint'] datastore.find(query, sorting=['+timestamp'], limit=5, properties=properties, reply_handler=self._query_reply_handler_cb, error_handler=self._query_error_handler_cb) self.writeline("sent datastore find command") self.show()