Ejemplo n.º 1
0
def main(stdscr):
    curses.init_pair(1, curses.COLOR_RED, curses.COLOR_BLACK)
    curses.cbreak()
    curses.start_color()
    stdscr.clear()
    stdscr.move(0, 0)
    stdscr.refresh()
    y, x = stdscr.getyx()
    location = WrappingPoint(stdscr.getmaxyx(), x=x, y=y)
    formatter = PlainFormatter("import this", direct=True, language="python")
    stdscr.addstr(formatter.format())
    stdscr.move(0, 0)

    while True:
        current = stdscr.getkey()
        if current == 'q':
            break
        else:
            print(stdscr.instr(1))
            stdscr.addstr(current, curses.color_pair(1))

            location.x += 1
            if location.old.x == location.size.x - 1 and location.x == 0:
                location.y += 1
            stdscr.move(location.y, location.x)

        stdscr.refresh()
Ejemplo n.º 2
0
def main(stdscr):
    curses.init_pair(1,curses.COLOR_RED,curses.COLOR_BLACK)
    curses.cbreak()
    curses.start_color()
    stdscr.clear()
    stdscr.move(0,0)
    stdscr.refresh()
    y,x= stdscr.getyx()
    location  = WrappingPoint(stdscr.getmaxyx(),x=x,y=y)
    formatter = PlainFormatter("import this",direct=True,language="python")
    stdscr.addstr(formatter.format())
    stdscr.move(0,0)

    while True:
        current = stdscr.getkey()
        if current == 'q':
            break
        else:
            print(stdscr.instr(1))
            stdscr.addstr(current,curses.color_pair(1))

            location.x +=1
            if location.old.x==location.size.x-1 and location.x==0:
            	location.y+=1
            stdscr.move(location.y,location.x)






        stdscr.refresh()
Ejemplo n.º 3
0
	def test_basic_formatting_itself(self):
		formatter = PlainFormatter("../code_snippets/python/csv_snip.py")
		length = len(formatter.format())
		self.assertEqual(length,1392) # if it reaches here then there was no issue