def main(stdscr): stdscr.timeout(0) curses.noecho() curses.curs_set(False) max_y = stdscr.getmaxyx()[0] - 1 max_x = stdscr.getmaxyx()[1] - 1 def resizing_thread_function(): while True: if max_y < 39 or max_x < 159: print("\x1b[8;40;160t") resizing_thread = threading.Thread(target=resizing_thread_function, daemon=True) resizing_thread.start() k = 0 while k != ord('q'): max_y = stdscr.getmaxyx()[0] - 1 max_x = stdscr.getmaxyx()[1] - 1 if max_y >= 39 and max_x >= 159: if superglobals.information_enabled_setting: superglobals.information_enabled = True # Looping these variable declarations so it automatically updates on new year. current_year = datetime.datetime.now().year old_new_year = datetime.datetime(current_year, 1, 1, 0, 0, 0) next_new_year = datetime.datetime(current_year + 1, 1, 1, 0, 0, 0) stdscr.erase() screenfunctions.render_defaults(stdscr) stdscr.addstr(0, 45, str(datetime.datetime.now())) stdscr.addstr( 2, 45, f"PyShell Running: {time.perf_counter() - superglobals.start_time}" ) stdscr.addstr( 4, 45, f"Time Since New Year: {datetime.datetime.now() - old_new_year}" ) stdscr.addstr( 5, 45, f"Time Until New Year: {next_new_year - datetime.datetime.now()}" ) stopwatch_list = superglobals.stopwatch_list timer_list = superglobals.timer_list countdown_list = superglobals.countdown_list if not (len(stopwatch_list) > int(max_y / 2) or len(timer_list) > int(max_y / 2)): for i in range(0, max_y + 1): stdscr.addstr(i, 98, "│") stdscr.addstr(int(max_y / 2), 45, "─" * (max_x - 45)) # Displaying Stopwatches. for i, stopwatch in enumerate(stopwatch_list): stdscr.addstr( i + 1, 100, f"{stopwatch.name} : {round(time.perf_counter() - stopwatch.seconds, 2)} : {round((time.perf_counter() - stopwatch.seconds) / 60, 2)} : {round((time.perf_counter() - stopwatch.seconds) / 3600, 2)}" ) # Displaying Timers. for i, timer in enumerate(timer_list): stdscr.addstr( i + 2 + int(max_y / 2), 45, f"{timer.name} : {round(timer.seconds - time.perf_counter(), 2)} : {round((timer.seconds - time.perf_counter()) / 60, 2)} : {round((timer.seconds - time.perf_counter()) / 3600, 2)}" ) # Displaying Countdowns. for i, countdown in enumerate(countdown_list): stdscr.addstr( i + 2 + int(max_y / 2), 100, f"{countdown.name} : {round(countdown.seconds - time.perf_counter(), 2)} : {round((countdown.seconds - time.perf_counter()) / 60, 2)} : {round((countdown.seconds - time.perf_counter()) / 3600, 2)}" ) stdscr.addstr(int(max_y / 2), 43, "├") stdscr.addstr(int(max_y / 2), 98, "┼") if len(stopwatch_list) > int(max_y / 2) or len(timer_list) > int( max_y / 2): stdscr.addstr( 2, 45, "Please remove some stopwatches/timers/countdowns or") stdscr.addstr( 3, 45, "increase the window size to see your current stopwatches/timers/countdowns." ) stdscr.attron(curses.A_REVERSE) stdscr.addstr(max_y, 45, "Press 'q' to exit." + " " * (max_x - 63)) stdscr.attroff(curses.A_REVERSE) k = stdscr.getch() if max_y < 39 or max_x < 159: superglobals.information_enabled = False stdscr.addstr(0, 0, "Py-Shell requires atleast a 160x40 window size.") stdscr.getch() stdscr.erase() stdscr.timeout(-1) curses.echo() curses.curs_set(True)
def main(stdscr): page = 0 max_y = stdscr.getmaxyx()[0] - 1 max_x = stdscr.getmaxyx()[1] - 1 def resizing_thread_function(): while True: if max_y < 39 or max_x < 159: print("\x1b[8;40;160t") def read_file(file_path, max_y, max_x): curses.echo(False) def resizing_thread_function(): while True: if max_y < 39 or max_x < 159: print("\x1b[8;40;160t") resizing_thread = threading.Thread(target=resizing_thread_function, daemon=True) resizing_thread.start() page = 0 superglobals.state = "fileread" contents = [] with open(file_path, "r") as file: contents = file.readlines() display_contents = contents for i in range(page * max_y, (page + 1) * max_y): if screenfunctions.indexists(display_contents, i): if len(display_contents[i]) > max_x - 44: display_contents.insert(i + 1, display_contents[i][max_x - 45:]) display_contents[i] = display_contents[i][:max_x - 45] curses.curs_set(False) k = 0 while k != ord('q'): #try: max_y = stdscr.getmaxyx()[0] - 1 max_x = stdscr.getmaxyx()[1] - 1 if max_y >= 39 and max_x >= 159: if superglobals.information_enabled_setting: superglobals.information_enabled = True stdscr.erase() screenfunctions.render_defaults(stdscr) contents = [] with open(file_path, "r") as file: contents = file.readlines() display_contents = contents for i, _ in enumerate(display_contents): if screenfunctions.indexists(display_contents, i): if len(display_contents[i]) > max_x - 44: display_contents.insert( i + 1, display_contents[i][max_x - 45:]) display_contents[i] = display_contents[i][:max_x - 45] for index, line_num in enumerate( range(page * max_y, (page + 1) * max_y)): if screenfunctions.indexists(display_contents, line_num): stdscr.addstr(index, 44, display_contents[line_num]) stdscr.attron(curses.A_REVERSE) stdscr.addstr( max_y, 44, "Press 'q' to exit, ARROW KEYS to change pages." + " " * (max_x - 90)) stdscr.addstr(max_y, max_x - 9, f"Page: {page}") stdscr.attroff(curses.A_REVERSE) k = stdscr.getch() if k == ord('q'): break if k == curses.KEY_RIGHT and page < 255: page += 1 if k == curses.KEY_LEFT and page > 0: page -= 1 if max_y < 39 or max_x < 159: superglobals.information_enabled = False stdscr.addstr( 0, 0, "Py-Shell requires atleast a 160x40 window size.") stdscr.getch() stdscr.erase() # except Exception as e: # superglobals.error_list.append(e) resizing_thread = threading.Thread(target=resizing_thread_function, daemon=True) resizing_thread.start() while True: #try: curses.curs_set(False) curses.echo(False) max_y = stdscr.getmaxyx()[0] - 1 max_x = stdscr.getmaxyx()[1] - 1 if max_y >= 39 and max_x >= 159: if superglobals.information_enabled_setting: superglobals.information_enabled = True current_directory = os.getcwd() current_items = os.listdir(current_directory) stdscr.erase() screenfunctions.render_defaults(stdscr) stdscr.addstr(1, 45, f"Current Directory :: {current_directory}") stdscr.addstr(1, max_x - 9, f"Page: {page}") # Draws the two barriers. screenfunctions.draw_box(stdscr, 0, 44, 2, max_x - 44, 1) screenfunctions.draw_box(stdscr, 3, 44, max_y - 4, max_x - 44, 1) # Formula for amount of files on a single page (if it is full) # int((max_x - 45) / 45) * (max_y - 6) # (int((max_x - 45) / 45) * (max_y - 6)) * page # Draws all the files # Sees if the longest filename is above 45, if it is, it sets the column modulus to that filename's length. column_modulus = len(max(current_items, key=len)) + 5 if len( max(current_items, key=len)) > 45 else 45 for i in range(int((max_x - 45) / column_modulus)): for ii in range(4, max_y - 1): # (If you are debugging this, I apologize heavily.) if screenfunctions.indexists( current_items, ((ii - 4) + (max_y - 5) * i) + (int( (max_x - 45) / column_modulus) * (max_y - 6)) * page): stdscr.addstr( ii, 45 + i * column_modulus, f"{(ii + (max_y - 5) * i - 4) + (int((max_x - 45) / column_modulus) * (max_y - 6)) * page} : {current_items[((ii - 4) + (max_y - 5) * i) + (int((max_x - 45) / column_modulus) * (max_y - 6)) * page]}" ) k = stdscr.getch() if k == ord(';'): curses.echo(True) #curses.cur_set(True) # Gets input from the user. input_string = screenfunctions.curses_input( stdscr, int(max_y / 2), 0, f"{superglobals.state}:: ", 42 - len(superglobals.state) - 3) # Converts it into commands. cmds = input_string.split("; ") cmds[0] = cmds[0].lower() if cmds[0] == "cd": # Handling if the User inputs a path to a directory in the current directory. if os.path.isdir(os.path.join(os.getcwd(), cmds[1])): os.chdir(os.path.join(os.getcwd(), cmds[1])) # Handling if the User inputs a path to a directory not in the current directory. if os.path.isdir(cmds[1]): os.chdir(cmds[1]) # Handling if the User inputs ".." if cmds[1] == ".." and current_directory != "/": os.chdir(os.path.dirname(current_directory)) if cmds[0] in ["r", "read"] and screenfunctions.indexists( cmds, 1): if os.path.isfile(os.path.join(os.getcwd(), cmds[1])): read_file(os.path.join(os.getcwd(), cmds[1]), max_y, max_x) # if os.path.isfile(cmds[1]): # read_file(cmds[1], max_y, max_x) superglobals.state = "multife" if cmds[0] == "exit": break if cmds[0] == "quit": sys.exit(0) #curs_set(False) if k == curses.KEY_RIGHT and page < 255: page += 1 if k == curses.KEY_LEFT and page > 0: page -= 1 if max_y < 39 or max_x < 159: superglobals.information_enabled = False stdscr.addstr(0, 0, "Py-Shell requires atleast a 160x40 window size.") stdscr.getch() stdscr.erase() # except Exception as e: # superglobals.error_list.append(e) curses.echo(True) curses.curse_set(True)
def read_file(file_path, max_y, max_x): curses.echo(False) def resizing_thread_function(): while True: if max_y < 39 or max_x < 159: print("\x1b[8;40;160t") resizing_thread = threading.Thread(target=resizing_thread_function, daemon=True) resizing_thread.start() page = 0 superglobals.state = "fileread" contents = [] with open(file_path, "r") as file: contents = file.readlines() display_contents = contents for i in range(page * max_y, (page + 1) * max_y): if screenfunctions.indexists(display_contents, i): if len(display_contents[i]) > max_x - 44: display_contents.insert(i + 1, display_contents[i][max_x - 45:]) display_contents[i] = display_contents[i][:max_x - 45] curses.curs_set(False) k = 0 while k != ord('q'): #try: max_y = stdscr.getmaxyx()[0] - 1 max_x = stdscr.getmaxyx()[1] - 1 if max_y >= 39 and max_x >= 159: if superglobals.information_enabled_setting: superglobals.information_enabled = True stdscr.erase() screenfunctions.render_defaults(stdscr) contents = [] with open(file_path, "r") as file: contents = file.readlines() display_contents = contents for i, _ in enumerate(display_contents): if screenfunctions.indexists(display_contents, i): if len(display_contents[i]) > max_x - 44: display_contents.insert( i + 1, display_contents[i][max_x - 45:]) display_contents[i] = display_contents[i][:max_x - 45] for index, line_num in enumerate( range(page * max_y, (page + 1) * max_y)): if screenfunctions.indexists(display_contents, line_num): stdscr.addstr(index, 44, display_contents[line_num]) stdscr.attron(curses.A_REVERSE) stdscr.addstr( max_y, 44, "Press 'q' to exit, ARROW KEYS to change pages." + " " * (max_x - 90)) stdscr.addstr(max_y, max_x - 9, f"Page: {page}") stdscr.attroff(curses.A_REVERSE) k = stdscr.getch() if k == ord('q'): break if k == curses.KEY_RIGHT and page < 255: page += 1 if k == curses.KEY_LEFT and page > 0: page -= 1 if max_y < 39 or max_x < 159: superglobals.information_enabled = False stdscr.addstr( 0, 0, "Py-Shell requires atleast a 160x40 window size.") stdscr.getch() stdscr.erase()
def main(stdscr, cmds): curses.curs_set(False) page = 0 cmds = [cmd.lower() for cmd in cmds] max_y = stdscr.getmaxyx()[0] - 1 max_x = stdscr.getmaxyx()[1] - 1 def resizing_thread_function(): while True: if max_y < 39 or max_x < 159: print("\x1b[8;40;160t") resizing_thread = threading.Thread(target=resizing_thread_function, daemon=True) resizing_thread.start() k = 0 while k != ord('q'): max_y = stdscr.getmaxyx()[0] - 1 max_x = stdscr.getmaxyx()[1] - 1 if max_y >= 39 and max_x >= 159: if superglobals.information_enabled_setting: superglobals.information_enabled = True stdscr.erase() screenfunctions.render_defaults(stdscr) if k == curses.KEY_RIGHT and page < 255: page += 1 if k == curses.KEY_LEFT and page > 0: page -= 1 if screenfunctions.indexists(cmds, 1): if cmds[1] == "stopwatch": if page == 0: stdscr.addstr(0, 45, "Help Menu for \"stopwatch\" command") stdscr.addstr(2, 45, "stopwatch : Commands for a counter that can be viewed with the \"time\" command.") stdscr.addstr(3, 45, "The created stopwatch shows the amount of time since it was created.") stdscr.addstr(5, 45, "List of Commands and Usages:") stdscr.addstr(6, 45, " del; [index] : Deletes the stopwatch at [index]") stdscr.addstr(7, 45, " new; [name, optional] : Creates a new stopwatch that has the name [name]. If [name] is blank,") stdscr.addstr(8, 45, " it will set it to \"stopwatch [index + 1]\"") stdscr.addstr(9, 45, " reset; [index] : Resets the stopwatch at [index]") if cmds[1] == "timer": if page == 0: stdscr.addstr(0, 45, "Help Menu for \"timer\" command") stdscr.addstr(2, 45, "timer : Commands for a counter that can be viewed with the \"time\" command.") stdscr.addstr(3, 45, "The created timer shows the amount of time between now and a set amount of minutes after creation.") stdscr.addstr(5, 45, "List of Commands and Usages:") stdscr.addstr(6, 45, " del; [index] : Deletes the timer at [index]") stdscr.addstr(7, 45, " new; [minutes]; [name, optional] : Creates a new timer that counts to [minutes] after creation,") stdscr.addstr(8, 45, " and has the name [name]. If [name] is blank, it will set it to \"timer [index + 1]\"") stdscr.addstr(9, 45, " reset; [index] : Resets the timer at [index]") if cmds[1] == "countdown": if page == 0: stdscr.addstr(0, 45, "Help Menu for \"contdown\" command") stdscr.addstr(2, 45, "countdown : Commands for a counter that counts to a hour and minute that can be viewed with the \"time\" command.") stdscr.addstr(3, 45, "The created countdown counts down to a given hour and minute.") stdscr.addstr(5, 45, "List of Commands and Usages:") stdscr.addstr(6, 45, " del; [index] : Deletes the countdown at [index]") stdscr.addstr(7, 45, " new; [hour]; [minute]; [name, optional] : Creates a new countdown that counts down to the") stdscr.addstr(8, 45, " [minute]th minute of [hour] has the name [name]. If [name] is blank, it will set it to \"countdown [index + 1]\"") if cmds[1] == "calc": if page == 0: stdscr.addstr(0, 45, "Help Menu for \"calc\" command") stdscr.addstr(2, 45, "calc : Basic calculator for general use.") stdscr.addstr(5, 45, "List of Commands and Usages:") stdscr.addstr(6, 45, " [x] : Sets the current number to [x].") stdscr.addstr(7, 45, " add; [x] : Adds [x] to the current number.") stdscr.addstr(8, 45, " sub; [x] : Subtracts [x] from the current number.") stdscr.addstr(9, 45, " mul; [x] : Multiplies the current number by [x].") stdscr.addstr(10, 45, " div; [x] : Divides the current number by [x].") stdscr.addstr(11, 45, " pow; [x] : Exponentiates the current number by [x]") stdscr.addstr(12, 45, " root; [x] : Sets the current number to the [x]th root of the current number.") stdscr.addstr(13, 45, " log : Sets the current number to the natural log of the current number.") stdscr.addstr(14, 45, " log2 : Sets the current number to the log2 of the current number.") stdscr.addstr(15, 45, " log10 : Sets the current number to the log10 of the current number.") if cmds[1] == "time": if page == 0: stdscr.addstr(0, 45, "Help Menu for \"time\" command") stdscr.addstr(2, 45, "time : A menu displaying a variety of information about the time.") stdscr.attron(curses.A_BOLD) stdscr.addstr(5, 45, "Time does not have any commands") stdscr.attroff(curses.A_BOLD) stdscr.addstr(7, 45, "The \"time\" menu has 4 panels.") stdscr.addstr(9, 45, "The first panel displays general information, such as the current date.") stdscr.addstr(11, 45, "The second panel displays current stopwatches.") stdscr.addstr(11, 45, "The third panel displays current timers.") stdscr.addstr(13, 45, "The fourth and final panel displays current countdowns.") if not screenfunctions.indexists(cmds, 1): if page == 0: stdscr.addstr(0, 45, "Welcome to the Help Menu") stdscr.addstr(1, 45, "You can type \"help; [command]\" to find sub-commands for a command.") stdscr.addstr(2, 45, "If nothing appears, it means there are no sub-commands for that command.") stdscr.addstr(4, 45, "Basic Syntax: The basic syntax cmd; option1; option2") stdscr.addstr(6, 45, "List of Commands and Usages:") #a #b #c stdscr.addstr(7, 45, " calc : Starts the calculator.") stdscr.addstr(8, 45, " color; [col] : Changes the text color (0-255).") stdscr.addstr(9, 45, " countdown; [cmd]; {options} : Uses the countdown command, see \"help; countdown\" for more details.") #d #e #f #g #h stdscr.addstr(10, 45, " help; [cmd] : Shows help about [cmd], if no [cmd] is entered, it shows this screen.") #i stdscr.addstr(11, 45, " information : Toggles the top left information.") #j #k #l #m #n #o #p #q stdscr.addstr(12, 45, " quit : Quits PyShell.") #r #s stdscr.addstr(13, 45, " stopwatch; [cmd]; {options} : Uses the stopwatch command, see \"help; stopwatch\" for more details.") #t stdscr.addstr(9, 45, " time : Opens the time menu.") stdscr.addstr(9, 45, " timer; [cmd]; {options} : Uses the timer command, see \"help; timer\" for more details.") #u #v #w #x #y #z stdscr.attron(curses.A_REVERSE) stdscr.addstr(max_y, 45, "Press 'q' to exit, ARROW KEYS to change pages." + " " * (max_x - 91)) stdscr.addstr(max_y, max_x - 9, f"Page: {page}") stdscr.attroff(curses.A_REVERSE) k = stdscr.getch() if max_y < 39 or max_x < 159: superglobals.information_enabled = False stdscr.addstr(0, 0, "Py-Shell requires atleast a 160x40 window size.") stdscr.getch() stdscr.erase() curses.echo() curses.curs_set(True)
def main(stdscr): # Subtracting 1 from the values so I can do stuff at the end. max_y = stdscr.getmaxyx()[0] - 1 max_x = stdscr.getmaxyx()[1] - 1 superglobals.initialize() curses.start_color() curses.use_default_colors() old_dir = os.getcwd() os.chdir(os.path.dirname(sys.argv[0])) if not os.path.exists("pyshelldata.txt"): with open("pyshelldata.txt", "w") as file: file.write("color: 225") with open("pyshelldata.txt", "r") as file: all_lines = file.readlines() color = all_lines[0].split(" ")[1] curses.init_pair(1, int(color), -1) stdscr.attron(curses.color_pair(1)) os.chdir(old_dir) stdscr.keypad(True) # Using a thread for this so it auto-resizes while in a program. def resizing_thread_function(): while True: if max_y < 39 or max_x < 159: # Resizes terminal automatically. print("\x1b[8;40;160t") resizing_thread = threading.Thread(target=resizing_thread_function, daemon=True) resizing_thread.start() timer_thread = threading.Thread( target=screenfunctions.timer_thread_function, daemon=True) timer_thread.start() # String for storing the last input from the user. input_string = "" # Main loop for the entire Shell. while True: max_y = stdscr.getmaxyx()[0] - 1 max_x = stdscr.getmaxyx()[1] - 1 stdscr.erase() if max_y >= 39 and max_x >= 159: if superglobals.information_enabled_setting: superglobals.information_enabled = True screenfunctions.render_defaults(stdscr) # Getting input from user. input_string = screenfunctions.curses_input( stdscr, int(max_y / 2), 0, f"{superglobals.state}:: ", 42 - len(superglobals.state) - 3) # Maximum input length changes based off of state. cmds = input_string.split("; ") cmds[0] = cmds[0].lower() if cmds[0] in ["exit", "quit"]: break if cmds[0] in ["time", "date"]: stdscr.erase() screenfunctions.render_defaults(stdscr) superglobals.state = "time" time_command.main(stdscr) superglobals.state = "main" if cmds[0] == "stopwatch": smallcommands.stopwatch_command(cmds) if cmds[0] == "timer": smallcommands.timer_command(cmds) if cmds[0] in ["calc", "calculator"]: stdscr.erase() screenfunctions.render_defaults(stdscr) superglobals.state = "calc" calculator_command.main(stdscr) superglobals.state = "main" if cmds[0] in ["information", "informationtoggle"]: superglobals.information_enabled = not superglobals.information_enabled superglobals.information_enabled_setting = False if cmds[0] == "help": stdscr.erase() screenfunctions.render_defaults(stdscr) help_command.main(stdscr, cmds) superglobals.state = "main" if cmds[0] == "countdown": smallcommands.countdown_command(cmds) if cmds[0] == "color": smallcommands.color_command(stdscr, cmds) if cmds[0] in ["multife", "files"]: stdscr.erase() screenfunctions.render_defaults(stdscr) superglobals.state = "multife" multife_command.main(stdscr) superglobals.state = "main" if max_y < 39 or max_x < 159: superglobals.information_enabled = False stdscr.addstr(0, 0, "Py-Shell requires atleast a 160x40 window size.") stdscr.getch() stdscr.erase() curses.endwin()
def main(stdscr): max_y = stdscr.getmaxyx()[0] - 1 max_x = stdscr.getmaxyx()[1] - 1 def resizing_thread_function(): while True: if max_y < 39 or max_x < 159: print("\x1b[8;40;160t") resizing_thread = threading.Thread(target=resizing_thread_function, daemon=True) resizing_thread.start() num = decimal.Decimal(superglobals.last_calc_num) input_string = "" while True: try: max_y = stdscr.getmaxyx()[0] - 1 max_x = stdscr.getmaxyx()[1] - 1 if max_y >= 39 and max_x >= 159: if superglobals.information_enabled_setting: superglobals.information_enabled = True stdscr.erase() screenfunctions.render_defaults(stdscr) stdscr.addstr(1, 45, str(num)) screenfunctions.draw_box(stdscr, 0, 44, 2, max_x - 44, 1) screenfunctions.draw_box(stdscr, 3, 44, 7, max_x - 44, 1) stdscr.addstr(4, 45, "add; [x]") stdscr.addstr(5, 45, "sub; [x]") stdscr.addstr(6, 45, "mul; [x]") stdscr.addstr(7, 45, "div; [x]") stdscr.addstr(8, 45, "pow; [x]") stdscr.addstr(9, 45, "root; [x]") stdscr.addstr(4, 59, "log") stdscr.addstr(5, 59, "log2") stdscr.addstr(6, 59, "log10") input_string = screenfunctions.curses_input( stdscr, int(max_y / 2), 0, f"{superglobals.state}:: ", 42 - len(superglobals.state) - 3) cmds = input_string.split("; ") cmds[0] = cmds[0].lower() for i, cmd in enumerate(cmds): if i != 0: if cmds[i] == "pi": cmds[i] = "3.141592653" if cmds[i] == "tau": cmds[i] = "6.283185307" if cmds[i] == "phi": cmds[i] = "1.618033988" if cmds[i] == "e": cmds[i] = "2.718281828" if cmds[0] == "exit": superglobals.last_calc_num = num return if cmds[0] == "quit": sys.exit(0) if screenfunctions.is_float(cmds[0]): num = decimal.Decimal(cmds[0]) if cmds[0] == "log" and num > 0: num = decimal.Decimal(math.log(num)) if cmds[0] == "log2" and num > 0: num = decimal.Decimal(math.log2(num)) if cmds[0] == "log10" and num > 0: num = decimal.Decimal(math.log10(num)) if screenfunctions.indexists(cmds, 1): if cmds[0] == "add": num += decimal.Decimal(cmds[1]) if cmds[0] == "sub": num -= decimal.Decimal(cmds[1]) if cmds[0] == "mul": num *= decimal.Decimal(cmds[1]) if cmds[0] == "div" and cmds[1] != "0": num /= decimal.Decimal(cmds[1]) if cmds[0] == "pow": num **= decimal.Decimal(cmds[1]) if cmds[0] == "root" and num > 0: num **= decimal.Decimal(1 / decimal.Decimal(cmds[1])) if max_y < 39 or max_x < 159: superglobals.information_enabled = False stdscr.addstr( 0, 0, "Py-Shell requires atleast a 160x40 window size.") stdscr.getch() stdscr.erase() except Exception as e: superglobals.error_list.append(e)