def draw_pointer_form(self, widget): if self.mode: user_action = lib.prompt(self, "Are you sure about 'pointer' type?\nOther type data will be destroy!") if user_action: # self.mode.destroy() # FIXME self.mode = Pointer() return self.mode = Pointer()
def draw_dynamic_form(self, widget): if self.mode: user_action = lib.prompt(self, "Are you sure about 'dynamic' type?\nOther type data will be destroy!") if user_action: # self.mode.destroy() # FIXME self.mode = Dynamic() return self.mode = Dynamic()
def main(): try: api_key = argv[1] except IndexError: print('Pass in AP key') exit(0) print('\nGet the weather by city and country\n') cityname = lib.prompt('City: ') countryname = lib.prompt('Country: ') payload = lib.Payload(cityname, countryname, api_key) r = requests.get("http://api.openweathermap.org/data/2.5/weather", params=payload.req) weather_data = r.json() lib.print_data(weather_data)
def test_prompt(self): text = "While [torging] through the [toads] the man [trills]." test_prompt = None try: test_prompt = prompt(text) except: print "Error" self.assertNotEqual(test_prompt, None) self.assertEqual(test_prompt.text, text) self.assertEqual(test_prompt.links, ['torging','toads','trills'])
def main(): #init() system('clear') story = prompt('start') register(story.goodbye) story.display() story.pause() t = threading.Thread(target=loop, args=[story]) t.daemon = True t.start() while True: story.onKeyPress()
# [Author] # Tehseen Sajjad # [Summary] # A small personal script that unclutters my desktop when working on an # assignment or lab project. # [Usage/Requirements] # * Python > 3.5.x # * files need to have '-' characters in their name. # * The second word after the first '-' will be the folder to which the files # will be moved. # * Names of the folders are changed to title cases. import lib if __name__ == '__main__': Handle = lib.FileHandler() file_paths_dict = Handle.get_paths() if file_paths_dict: Handle.make_folder(file_paths_dict) else: lib.prompt(lib.NO_WORK_FILES_TO_COPY_MESSAGE) Handle.move_files(file_paths_dict) print("Moved Files: ") for folder, files in file_paths_dict.items(): print(f"+-{lib.get_name_from_path(folder)}") for file in files: print(f'|----{lib.get_name_from_path(file)}') lib.prompt("Done!")