def getScreen(stdscr): return Screen(stdscr, 8, 4, [Text(1, 2, 'Register')], [[TextInput(2, 2, "Name")], [TextInput(3, 2, "ShortDsc")], [TextInput(4, 2, "Desc")], [TextInput(5, 2, "Value")], [TextInput(6, 2, "Category")], [AddButton(7, 1, "Add"), BackButton(7, 3, "Back")]])
def getScreen(stdscr): return Screen( stdscr, 8, 4, [Text(1, 2, 'Register')], [[TextInput(2, 2, "Username")], [TextInput(3, 2, "Password")], [TextInput(4, 2, "First")], [TextInput(5, 2, "Last")], [TextInput(6, 2, "Role")], [RegisterButton(7, 1, "Register"), BackButton(7, 3, "Back")]])
def __init__(self, screen: pygame.Surface, score: int): self.running = True self.bg = (0, 130, 0) self.screen_w = screen.get_width() self.screen_h = screen.get_height() # Buttons self.btn_w = 120 self.btn_h = 50 self.btn_ds_x = (self.screen_w - self.btn_w) // 3.3 self.btn_s_x = (self.screen_w - self.btn_w) // 1.4 self.btn_y = (self.screen_h - self.btn_h) // 2 self.btn_dont_save = Button(self.btn_ds_x, self.btn_y, self.btn_w, self.btn_h, (200, 0, 0), (255, 0, 0), "Don't Save", self.close_hiscore) self.btn_save = Button(self.btn_s_x, self.btn_y, self.btn_w, self.btn_h, (0, 0, 200), (0, 0, 255), 'Save', self.close_hiscore) self.buttons = (self.btn_dont_save, self.btn_save) # Input Field self.field_w = 150 self.field_h = 50 self.field_x = (self.screen_w - self.field_w) // 2 self.field_y = (self.screen_h - self.field_h) // 3 self.initials_field = Input_Field(self.field_x, self.field_y, self.field_w, self.field_h, (255, 255, 255), (200, 200, 200)) # Score Text self.score = score self.score_text = Text(self.screen_w // 3, self.screen_h // 1.7, 22, f'Your score is {self.score}!') # Initials Text self.initials_text = Text(self.screen_w // 5, self.screen_h // 4.2, 18, 'Enter your initials to save your score') self.drawables = (self.btn_dont_save, self.btn_save, self.initials_field, self.score_text, self.initials_text)
def find_unique_tele_numbers(texts, calls): uniq_tele_nums = set({}) # using set instead of dict for call in calls: call = Call(call) uniq_tele_nums.add(call.incoming) uniq_tele_nums.add(call.answering) for text in texts: text = Text(text) uniq_tele_nums.add(text.incoming) uniq_tele_nums.add(text.answering) return len(uniq_tele_nums)
def getScreen(stdscr): sess = utils.getSession() inps = [ SearchButton(2, 1, "Search"), AddButton(2, 2, "Add"), BackButton(2, 3, "Back") ] if sess['role'] == 'employees' or sess['role'] == 'managers' else [ SearchButton(2, 1, "Search"), BackButton(2, 3, "Back") ] return Screen( stdscr, 3, 4, [Text(1, 2, 'Would you like to add or search for donations?')], [inps])
def find_telemarkers(calls, texts): outgoing = set({}) non_tele = set({}) for call in calls: call = Call(call) outgoing.add(call.incoming) non_tele.add(call.answering) for text in texts: text = Text(text) non_tele.add(text.incoming) non_tele.add(text.answering) possible_tele = list(outgoing - non_tele) possible_tele.sort() return possible_tele
def getScreen(stdscr, location): loc = { 'name': 0, 'type': 1, 'latitude': 2, 'longitude': 3, 'address': 4, 'phone': 5 } txts = [ Text(loc[k] + 1, 1, ((k.upper() + ': ').ljust(15)) + str(location[k]).ljust(50)) for k in location.keys() if k in loc ] return Screen(stdscr, 8, 2, txts, [[BackButton(7, 1, "Back")]])
def getScreen(stdscr): r = requests.get(API_URL + '/locations') js = r.json() rows = len(js['locations']) + 4 locations = [[LocationButton(i + 2, 2, js['locations'][i]['name'], js['locations'][i])] for i in range(len(js['locations']))] locations += [[DonationsButton(rows - 1, 1, "Donations"), MapButton(rows - 1, 2, "Map"), BackButton(rows - 1, 3, "Back")]] sess = utils.getSession() return Screen( stdscr, rows, 4, [ Text(1, 2, 'Welcome %s %s you are a %s.' % (sess['firstname'], sess['lastname'], sess['role'][:len(sess['role']) - 1])) ], locations )
def getScreen(stdscr, donation): don = { 'name': 0, 'locationid': 1, 'tstamp': 2, 'shortdescription': 3, 'description': 4, 'comments': 5, 'value': 6, 'category': 7 } txts = [ Text(don[k] + 1, 1, ((k.upper() + ': ').ljust(20)) + str(donation[k]).ljust(50)) for k in donation.keys() if k in don ] return Screen(stdscr, 10, 2, txts, [[BackButton(9, 1, "Back")]])
def getScreen(stdscr): return Screen( stdscr, 5, 4, [Text(1, 2, 'Search')], [[TextInput(2, 2, "Category")], [TextInput(3, 2, "Name")], [SearchResultsButton(4, 1, "Search"), BackButton(4, 3, "Back")]])
def getScreen(stdscr): return Screen( stdscr, 5, 4, [Text(1, 2, 'Login')], [[TextInput(2, 2, "Username")], [TextInput(3, 2, "Password")], [LoginButton(4, 1, "Login"), BackButton(4, 3, "Back")]])
def getScreen(stdscr): return Screen( stdscr, 3, 4, [Text(1, 2, 'Welcome to Donation Tracker')], [[LoginButton(2, 1, "Login"), RegisterButton(2, 3, "Register")]])
def __init__(self): # Liste des modules self.modules = OrderedDict({ "header": { "active": True, "filter": False, "exec": self.module_header }, "text": { "active": False, "filter": False, "exec": self.module_text }, "mdldyna": { "active": False, "filter": False, "exec": self.module_mdldyna }, "mdlobj": { "active": False, "filter": False, "exec": self.module_mdlobj }, "item": { "active": False, "filter": False, "exec": self.module_item }, "mover": { "active": False, "filter": False, "exec": self.module_mover }, "world": { "active": True, "filter": False, "exec": self.module_world }, "quest": { "active": False, "filter": False, "exec": self.module_quest }, "drop": { "active": False, "filter": False, "exec": self.module_quest }, "ai": { "active": False, "filter": False, "exec": self.module_ai }, "event_monster": { "active": False, "filter": False, "exec": self.module_event_monster }, "skill": { "active": False, "filter": False, "exec": self.module_skill }, "ctrl": { "active": False, "filter": False, "exec": self.module_ctrl }, "karma": { "active": False, "filter": False, "exec": self.module_karma }, "diepenalty": { "active": False, "filter": False, "exec": self.module_die_penalty }, "filter": { "active": False, "filter": False, "exec": None }, "invalid": { "active": False, "filter": False, "exec": self.module_invalid }, "letter": { "active": False, "filter": False, "exec": self.module_letter } }) # Liste des textes chargé self.texts = OrderedDict({ "ctrl": Text(), "item": Text(), "karma": Text(), "mover": Text(), "skill": Text(), "troupeskill": Text(), "dubear": Text(), "dudadk": Text(), "dudreadfulcave": Text(), "duflmas": Text(), "dukrr": Text(), "dumuscle": Text(), "duominous": Text(), "duominous_1": Text(), "durustia": Text(), "durustia_1": Text(), "dusatemple": Text(), "dusatempleboss": Text(), "wdarena": Text(), "wdguildhouselarge": Text(), "wdguildhousemiddle": Text(), "wdguildhousesmall": Text(), "wdguildwar": Text(), "wdguildwar1to1": Text(), "wdheaven01": Text(), "wdheaven02": Text(), "wdheaven03": Text(), "wdheaven04": Text(), "wdheaven05": Text(), "wdheaven06": Text(), "wdheaven06_1": Text(), "wdkebaras": Text(), "wdmadrigal": Text(), "wdminiroom": Text(), "wdquiz": Text(), "wdvolcane": Text(), "wdvolcanered": Text(), "wdvolcaneyellow": Text(), "faq": Text(), "gameguard": Text(), "guide": Text(), "help": Text(), "instanthelp": Text(), "minigame_alphabet": Text(), "patchclient": Text(), "tip": Text(), "treehelp": Text(), "tutorial": Text(), "character_etc": Text(), "character_school": Text(), "character": Text(), "etc": Text(), "honorlist": Text(), "lordskill": Text(), "patroldestination": Text(), "propitemetc": Text(), "propmotion": Text(), "propquest_dungeonandpk": Text(), "propquest_requestbox": Text(), "propquest_requestbox2": Text(), "propquest_scenario": Text(), "propquest": Text(), "questdestination": Text(), "resdata": Text(), "textclient": Text(), "textemotion": Text(), "dubear": Text(), "dudadk": Text(), "dudreadfulcave": Text(), "duflmas": Text(), "dukrr": Text(), "dumuscle": Text(), "duominous": Text(), "duominous_1": Text(), "durustia": Text(), "durustia_1": Text(), "dusatempleboss": Text(), "wdarena": Text(), "wdguildhouselarge": Text(), "wdguildhousemiddle": Text(), "wdguildhousesmall": Text(), "wdguildwar": Text(), "wdheaven01": Text(), "wdheaven02": Text(), "wdheaven03": Text(), "wdheaven04": Text(), "wdheaven05": Text(), "wdheaven06": Text(), "wdheaven06_1": Text(), "wdkebaras": Text(), "wdmadrigal": Text(), "wdminiroom": Text(), "wdquiz": Text(), "wdvolcane": Text(), "wdvolcanered": Text(), "wdvolcaneyellow": Text(), "world": Text() }) # Liste des defines self.defines = OrderedDict({ "define": Define(), "attribute": Define(), "item": Define(), "item_kind": Define(), "job": Define(), "neuz": Define(), "obj": Define(), "skill": Define(), "sound": Define(), "world": Define(), "continent": Define(), "event": Define(), "lord_skill": Define(), "quest": Define(), "honor": Define(), "lang": Define(), "msghdr": Define(), "resdata": Define(), "wnd_style": Define(), }) # Instance des object et mondes self.mdl_dyna = MdlDyna() self.mdl_obj = MdlObj() self.worlds_manager= WorldManager() # Instance des classes Propriétés self.prop_item = PropItem() self.prop_mover = PropMover() self.prop_mover_ex = PropMoverEx() self.prop_ai = PropMoverExAI() self.prop_ctrl = PropCtrl() self.prop_skill = PropSkill() self.prop_troupe_skill = PropTroupeSkill() self.prop_karma = PropKarma() self.prop_quest = PropQuest() # Instance des classes utiles self.filter = Filter() self.letter = Letter() self.invalid = Invalid() # Instance des classes events self.die_penalty = DiePenalty() self.random_event_monster = RandomEventMonster()