def __init__(self): self.options = ["New game", "Load game", "Settings", "Help", "Quit"] self.option = 0 self.settings = ["Controls", "Difficulty", "Something else", "Whatever", "Back"] self.setting = 0 self.set = False self.selected_setting = self.settings[self.setting] self.selected_option = self.options[self.option] self.keybinds = load_settings()
super(ParametrizedTestCase, self).__init__(methodName) self.settings = settings @staticmethod def parametrize(testcase_klass, settings=None): """ Create a suite containing all tests taken from the given subclass, passing them the parameter 'param'. """ testloader = unittest.TestLoader() testnames = testloader.getTestCaseNames(testcase_klass) suite = unittest.TestSuite() for name in testnames: suite.addTest(testcase_klass(name, settings=settings)) return suite if __name__ == "__main__": from exchanges import * from watcher import TestWatcher from api import * args = parse() settings = load_settings(args.settings) suite = unittest.TestSuite() suite.addTest(ParametrizedTestCase.parametrize(TestBitstamp, settings=settings)) suite.addTest(ParametrizedTestCase.parametrize(TestCoinbase, settings=settings)) suite.addTest(ParametrizedTestCase.parametrize(TestWatcher, settings=settings)) unittest.TextTestRunner().run(suite)
pos = 3 fil = True screen.addstr(2,0, "Folders: ") while i<len(folder_list['item_collection']['entries']): screen.addstr(pos,1, str(folder_list['item_collection']['entries'][i]['name'])) i+=1 pos+=1 if fil and folder_list['item_collection']['entries'][i]['type']=="file": screen.addstr(pos, 0, "Files ") pos+=1 screen.addstr(pos,1, str(folder_list['item_collection']['entries'][i]['name'])) pos+=1 i+=1 fil = False load_settings() folder_list = get_folder_json(0) version="v0.0.0.1" run=True screen = curses.initscr() screen.clear() screen.border(0) size = screen.getmaxyx() screen.addstr(0,0, "BoxLinux "+version) screen.addstr(1,1, "Number of Lines: "+str(screen.getmaxyx())) #print_folder_list() prompt = "Choose a Command (? for help):" while True: screen.addstr(0,0, "BoxLinux "+version) command = get_input(prompt, len(prompt))
pos, 1, str(folder_list['item_collection']['entries'][i]['name'])) i += 1 pos += 1 if fil and folder_list['item_collection']['entries'][i][ 'type'] == "file": screen.addstr(pos, 0, "Files ") pos += 1 screen.addstr( pos, 1, str(folder_list['item_collection']['entries'][i]['name'])) pos += 1 i += 1 fil = False load_settings() folder_list = get_folder_json(0) version = "v0.0.0.1" run = True screen = curses.initscr() screen.clear() screen.border(0) size = screen.getmaxyx() screen.addstr(0, 0, "BoxLinux " + version) screen.addstr(1, 1, "Number of Lines: " + str(screen.getmaxyx())) #print_folder_list() prompt = "Choose a Command (? for help):" while True: screen.addstr(0, 0, "BoxLinux " + version) command = get_input(prompt, len(prompt))
def render(self): os.system("clear") inn = None while inn != " ": self.display_title() if self.set == True: self.display_settings() else: self.display_options() inn = getch.__call__() if inn == "down": os.system("clear") if self.set == True: self.setting += 1 try: self.selected_setting = self.settings[self.setting] except IndexError: self.setting -= 1 else: if (self.option < len(self.options)): self.option += 1 try: self.selected_option = self.options[self.option] except IndexError: self.option -= 1 elif inn == "up": os.system("clear") if self.set == True: self.setting -= 1 try: self.selected_setting = self.settings[self.setting] except IndexError: self.setting += 1 else: if (self.option > 0): self.option -= 1 try: self.selected_option = self.options[self.option] except IndexError: self.option += 1 elif inn != " ": self.render() if self.set: if self.selected_setting == "Back": self.set = False self.render() if self.selected_option == "Settings": self.set = True # save_settings("a") settings = load_settings() # self.display_settings() self.render() elif self.selected_option == "Help": print("This is hull breach aka a rip off nethack only a lot worse.") print("") elif self.selected_option == "New game": self.new_game() elif self.selected_option == "Load game": print("CAN'T LOAD GAMES RIGHT NOW") elif self.selected_option == "Quit": sys.exit()