def __init__(self, master=None): super().__init__(master) self.master = master # Create login window login_window = login.Login(root) # Create Notebook and Tabs tab_names = ['Communication Interface Configuration', 'HDMI Configuration', 'Register Control', 'Terminal'] nb = ttk.Notebook(root) nb.pack(expand=1, fill=BOTH) tabs = nbtb.create_tabs(nb, tab_names) # Create Menu Bar menu.Menubar(root) # Fill Terminal Tab ter = terminal.Terminal(tabs, tab_names.index('Terminal')) # Fill Driver Configuration Tab dri = communicationInterface.CommunicationInterface(nb, tabs, tab_names, ter) # Fill HDMI Configuration Tab hdmi.HDMI(nb, tabs, tab_names.index('HDMI Configuration'), ter) # Fill Register Control Tab registers.Registers(tabs, tab_names.index('Register Control'))
def aid_list(): """ Returns the set of aids supported by the card. """ AID_INDEX = 0 DESCRIPTION_INDEX = 1 term = terminal.Terminal() supp_app = set([]) # PSE selection. pse_aid = emv.aid['pse'] sel_pse_c, sel_pse_r, sel_pse_s = term.select(pse_aid[AID_INDEX]) # If the application supports PSE, add it to the set of supported # applications. if sel_pse_s == 0x9000: supp_app.add(pse_aid) # extract the list of applications supported by the card based on the # PSE response. sfi = supertlv.find("88", sel_pse_r) if sfi: status = 0x9000 while status == 0x9000: # read all the possible record of that SFIbran break
def on_close_terminal_button_clicked(self, widget): t = terminal.Terminal() t.close(Tinybldlin) self.close_terminal.set_sensitive(0) self.send_data.set_sensitive(0) self.terminal_window.set_sensitive(0) self.open_terminal.set_sensitive(1)
def on_open_terminal_button_released(self, widget): port = self.port_entry.get_text() speed = int(self.speed_terminal_combo.get_active_text()) self.close_terminal.set_sensitive(1) self.send_data.set_sensitive(1) self.terminal_window.set_sensitive(1) self.open_terminal.set_sensitive(0) t = terminal.Terminal() t.open(Tinybldlin, port, speed)
def on_send_terminal_button_clicked(self, widget): tx_type = self.tx_type_combo.get_active_text() data = self.tx_data_combo.get_active_text() t = terminal.Terminal() if tx_type == 'char': t.send_data(data) if tx_type == 'char\\': t.send_data(data) t.send_data('\r')
def test(): pygame.init() display = pygame.display.set_mode((500, 350)) term = terminal.Terminal(display) sys.stdout = term sys.stdin = term print(input()) input()
def on_terminal_key_press_event(self, widget, event): type = self.tx_type_combo.child.get_text() data = event.keyval if event.keyval == gtk.keysyms.Return: data = 0x0D elif event.keyval == gtk.keysyms.BackSpace: data = 0x7f try: if type == 'Type': t = terminal.Terminal() t.terminal_type(data) if type == 'TypEcho': t = terminal.Terminal() t.write_message(Tinybldlin, chr(data)) t.terminal_type(data) except ValueError: print data
def test_1_parsing_performance(self): "\033[1mRunning Performance Test 1\033[0;0m" term = terminal.Terminal(ROWS, COLS) start = time.time() for i, x in enumerate(xrange(4)): with open('saved_stream.txt') as stream: for char in stream.read(): term.write(char) print(i) end = time.time() elapsed = end - start print('It took %0.2fms to process the input' % (elapsed * 1000.0)) pprint(term.dump_html())
def connect_ssh(self): self.client = paramiko.SSHClient() self.client.set_missing_host_key_policy(paramiko.WarningPolicy()) self.client.connect(hostname=self.sessionConfig.HostName, port=int(self.sessionConfig.Port), username=self.sessionConfig.User, password=self.sessionConfig.Password) self.stdin, self.stdout, self.stderr = self.client.exec_command('bash') self.term = terminal.Terminal(40, 150, temppath=tempfile.gettempdir()) self.timer = QtCore.QTimer(self) self.connect(self.timer, QtCore.SIGNAL("timeout()"), self.update) self.timer.start(5)
def clone(aid): term = terminal.Terminal() # Application selection. select_c, select_r, select_s = term.select(aid) if select_s == 0x9000: print "*" * 10 + "Select Response" + "*" * 10 print supertlv.human(select_r) else: print "select command returned error status {0}".format(hex(select_s)) # get processing option. gpo_c, gpo_r, gpo_s = term.get_processing_options() if gpo_s == 0x9000: print "*" * 10 + "Get processing Option Response" + "*" * 10 print supertlv.human(gpo_r) else: print "gpo command returned error status {0}".format(hex(select_s))
def on_rx_type_combo_changed(self, widget): try: buffer=self.terminal.get_buffer() start, end = buffer.get_bounds() t=terminal.Terminal() rx_type=self.rx_type_combo.get_active_text() text = buffer.get_text(start, end, include_hidden_chars=True) text_hex='' text_char='' if rx_type=='Hex': for i in range(0,len(text)): hexa=str(hex(ord(text[i])))[2:4] if len(hexa)<2: hexa='0'+hexa text_hex=text_hex+hexa+ ' ' buffer.set_text('') t.write_message(Tinybldlin,text_hex) if rx_type=='char': buffer_hex=text.split(' ') for i in range(0,len(buffer_hex)): try: c=chr(eval('0x'+buffer_hex[i])) except: c=' ' text_char=text_char+c buffer.set_text('') t.write_message(Tinybldlin,text_char) while gtk.events_pending(): gtk.main_iteration() except: return
def main(): display = terminal.Terminal() display.display_startup_sequence() is_server = display.ask_if_server() if is_server: user = display.display_server_config_sequence() server = ftp_server.FTPServer(user) print('\nThe server will start. In order to shut it down use Ctrl - C', '(NT) or Ctrl - D(POSIX)\n') server.start_server() else: host = display.display_client_config_sequence() client = ftp_client.FTPClient(host) while True: print(client.ftp.pwd()) cmd = display.get_user_input() print('\n') client.execute_cmd(cmd) listener = client.get_return_value() if listener == 'exit': break elif listener == 'help': display.display_help_message() client.clear_return_value() listener = '' print('\n')
def on_terminal_data_entry(self, widget, event): data = self.terminal_data_entry.get_text() t = terminal.Terminal() t.send_data(data)
system.init(system) colorama.init() from colorama import Fore sysCont = save.load() if not sysCont: sysCont = system.SystemsController() #If user broke their system then quit bootPath = system.FilePath('/sys/boot.sys', sysCont.userSystem.fileSystem, True, system.sysFileHashes['boot.sys']) if bootPath.status != system.PathStatuses.PATH_VALID: sysCont.userSystem.status = system.Statuses.UNBOOTABLE comCont = commands.CommandController() terminal = terminal.Terminal(comCont) terminal.out(colorama.Style.BRIGHT, colorama.Fore.GREEN, False, False) if 'idlelib.run' in sysModule.modules: print("You probably want to run this from the command line.") else: terminal.out(""" ██╗ ██╗ █████╗ ██████╗██╗ ██╗███████╗██╗ ██╗███████╗\n\ ██║ ██║██╔══██╗██╔════╝██║ ██╔╝██╔════╝╚██╗ ██╔╝██╔════╝\n\ ███████║███████║██║ █████╔╝ ███████╗ ╚████╔╝ ███████╗\n\ ██╔══██║██╔══██║██║ ██╔═██╗ ╚════██║ ╚██╔╝ ╚════██║\n\ ██║ ██║██║ ██║╚██████╗██║ ██╗███████║ ██║ ███████║\n\ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚══════╝\n\ version {} """.format(__version__)) time.sleep(2)
import terminal import logger ##################### # Global ##################### with open("keys.json") as json_file: data = json.load(json_file) TOKEN = data["discordKey"] logger = logger.Logger("app.log") client = commands.Bot(command_prefix="!") # CREATE testTerminal for the bash and cwd commands testTerminal = terminal.Terminal("test1", "/bin/bash") #################### # Helper methods #################### def remove_command_prefix(operand: str): """ Removes however many characters are necessary to remove the command prefix from operand. """ newOperand = operand[len(client.command_prefix):len(operand)] return newOperand
def setup_and_dispatch(server_chan, terminal_url, use_pty, cmd, start_clojurescript_repl=False, initial_request=None, window_control=None): # client process (pty or plain process) client = terminalio.AsyncResettableTerminal( use_pty=use_pty, cmd=cmd, ) # terminal term = terminal.Terminal(client, url=terminal_url, start_clojurescript_repl=start_clojurescript_repl, window_control=window_control) if initial_request: term.request(initial_request) channels = [client.out, server_chan] while True: res = True try: ch, val = chan.chanselect(consumers=channels, producers=[]) closed = False except chan.ChanClosed, co: ch = co.which val = None closed = True if ch == client.out: assert not closed # output from the terminal process res = term.input(val) elif ch == server_chan: assert not closed msgtype = val[0] if msgtype == 'request': res = term.request(val[1]) elif msgtype == 'websocket_connect': res = term.websocket_connect(val[1]) elif msgtype == 'websocket_receive': res = term.websocket_receive(val[1], val[2]) else: assert 'unknown msgtype: %r' % (msgtype, ) else: assert False # deal with the returnvalue if res == 'reload': return 'reload', val[1] # the initial request elif res is False: return False, None
import machine import ssd1306 import network import terminal import time import ujson import join_network import ESPblynk as ISAblynk i2c = machine.I2C(-1, machine.Pin(4), machine.Pin(5)) oled = ssd1306.SSD1306_I2C(128, 64, i2c) term = terminal.Terminal(oled) class Notify: def __init__(self, _terminal): self.terminal = _terminal self.postboard_linestart = 3 # last 3 lines are used as notifications - i.e lineno 3,4,5 self.postboard_lineend = 6 # last 3 lines are used as notifications self.postboard_linepos = self.postboard_linestart def postboard(self, text): self.terminal.println(text, self.postboard_linepos) print(self.postboard_linepos) self.postboard_linepos += 1 self.postboard_linepos = self.postboard_linestart + ( self.postboard_linepos - self.postboard_linestart) % ( self.postboard_lineend - self.postboard_linestart)
import terminal if __name__ == '__main__': t = terminal.Terminal() t.is_menu_showed = True
def make_terminal(self, **kwargs): """Make a Terminal""" import terminal return (terminal.Terminal())
import package_imu as pk_imu import distributor as d import terminal as term import package as pk import packaging_handler as pn import json_handler as jn import encoder pk.PackageConfig.timestamp = "millis" pk.PackageConfig.value = "values" accelerationName = "MPL Accelerometer" rotationName = "Rotation Vector" terminalDistributor = d.SingleDistributor() terminal = term.Terminal(terminalDistributor) loadDistributor = d.NamingDistributor() loader = jn.JsonLoadHandler() loader.setDistributor(loadDistributor) joiner = imu.QuaternionVectorJoiningNode.makeFromNames( quaternionName=rotationName, vectorName=accelerationName) dumpDistributor = d.SingleDistributor() dumper = jn.JsonDumpHandler(encoder.PackageEncoder) dumper.setDistributor(dumpDistributor) stdoutWriter = term.StdoutWriter() fileWriter = term.FileWriter(f"{os.path.dirname(sys.argv[1])}/imu.json")
screen.typeout("System initialisation procedures.\n", wpm=200) screen.typeout("What should your first attack be called?\n\n", wpm=200) while (atkname := screen.getline()) is not None: # If we have a valid name, break out of this loop. if not atkname.isspace() and atkname != "": break screen.print("Invalid name. Try another!\n") return (playername, atkname) if __name__ == "__main__": engine = en.Engine() screen = term.Terminal() engine.terminal = screen if len(sys.argv) != 2 or sys.argv[1] != "skip": # Print a fake bootsplash if no skip command was issued. bootsplash(engine) # Finish initialisation of the game engine. playername, atkname = getnames() completeinit(engine, playername, atkname) screen.clear() screen.print(dt.header) screen.typeout( "You awake to the sound of an alarm. Everything around you stands still as red light floods the room.\n", wpm=200)