Esempio n. 1
0
def mainedit():
    with vipad.safescreen('xterm-256color') as scr:
        my, mx = scr.getmaxyx()
        height = my/2
        width = mx
        startx = 0
        starty = 0
        textwin = scr.subwin(height, width, startx, starty)
        textbox = vipad.Panelastext(textwin)
        height = my -(my/2)
        width = mx
        startx = my/2
        starty = 0
        editwin = scr.subwin(height, width, startx, starty)
        editbox = vipad.ExtendedTextbox(editwin)
        #editbox.append('EDIT')
        #editbox.refresh()
        textbox.append('TEXT')
        textbox.refresh()
        alltxt = []
        for i in range(3):
            editbox[:] = []
            txt = editbox.edit()
            alltxt.append(txt)
            for line in txt.split('\n'):
                textbox.append(line)
                textbox.refresh()
    print repr(alltxt)
Esempio n. 2
0
def main():
    with vipad.safescreen('xterm-256color') as scr:
        #curses.init_colors()
        curses.use_default_colors()
        maxy, maxx = scr.getmaxyx()
        ncols, nlines = maxx,maxy-8
        uly, ulx = 4, 1
        
        #scr.addstr(uly-2, ulx, "Use Ctrl-G to end editing.")
        win = curses.newwin(nlines, ncols, uly, ulx)
        colset = dict()
        for i in range(curses.COLORS):
            curses.init_pair(i, i, -1)
            curses.init_pair(256+i, -1, i)
                
        #textpad.rectangle(scr, uly-1, ulx-1, uly + nlines, ulx + ncols)
        scr.refresh()
        textbox = vipad.Panelastext(win)
        #tb = basictester()
        tb = []
        test_textbox(textbox, tb)
        
        win.refresh()
        win.getch()
        win.erase()
        for i in range(curses.COLORS):
            rgb = curses.color_content(i)
            if rgb not in colset:
                colset[rgb] = i
            win.addstr(' ', curses.color_pair(256+i))
            if i == 15 or i == 255-24:
                win.addstr('\n')
                
        win.addstr('\n')
        win.refresh()
        win.getch()
    
    for rgb, col in sorted(colset.items()):
        print col, rgb
    print len(colset)
Esempio n. 3
0
import curses, vipad

with vipad.safescreen() as scr:
    keys = dict()
    for k,v in curses.__dict__.items():
        if k.startswith('KEY_'):
            keys[v] = k
    
    
    scr.scrollok(1)
    p = vipad.Panelastext(scr)
    ch = 0
    while ch != ord('q'):
        ch = scr.getch()
        given = curses.keyname(ch)
        if ch in keys:
            p.append('{0:03d} :: {1}, {2}'.format(ch, given, keys[ch]))
        else:
            p.append('{0:03d} :: {1}'.format(ch, given))