Ejemplo n.º 1
0
 def __init__(self):
     opts = ffi.new("notcurses_options *")
     opts.flags = lib.NCOPTION_NO_ALTERNATE_SCREEN
     self.nc = lib.notcurses_init(opts, sys.stdout)
     if not self.nc:
         raise NotcursesError("Error initializing notcurses")
     self.stdncplane = Ncplane(lib.notcurses_stdplane(self.nc))
Ejemplo n.º 2
0
 def putSimpleYX(self, y, x, ch):
     if y < -1:
         raise ValueError("Bad y position")
     if x < -1:
         raise ValueError("Bad x position")
     c = Cell(self, ch)
     if not c.simpleP():
         raise ValueError("Bad simple value")
     r = ffi.new("unsigned *")
     g = ffi.new("unsigned *")
     b = ffi.new("unsigned *")
     lib.ncplane_fg_rgb(self.n, r, g, b)
     c.setFgRGB(r[0], g[0], b[0])
     lib.ncplane_bg_rgb(self.n, r, g, b)
     c.setBgRGB(r[0], g[0], b[0])
     return lib.ncplane_putc_yx(self.n, y, x, c.getNccell())
Ejemplo n.º 3
0
 def putEGCYX(self, y, x, egc):
     if y < -1:
         raise ValueError("Bad y position")
     if x < -1:
         raise ValueError("Bad x position")
     cstr = ffi.new("char[]", egc.encode('utf-8'))
     ret = lib.ncplane_putegc_yx(self.n, y, x, cstr, ffi.NULL)
     ffi.release(cstr)
     return ret
Ejemplo n.º 4
0
 def __init__(self, ncplane, egc):
     self.ncp = ncplane
     self.c = ffi.new("cell *")
     self.c.gcluster = egc # FIXME need use cell_load
Ejemplo n.º 5
0
 def getDimensions(self):
     y = ffi.new("int *")
     x = ffi.new("int *")
     lib.ncplane_dim_yx(self.n, y, x)
     return (y[0], x[0])
Ejemplo n.º 6
0
 def __init__(self):
     opts = ffi.new("notcurses_options *")
     opts.inhibit_alternate_screen = True
     self.nc = lib.notcurses_init(opts, sys.stdout)
     self.stdncplane = Ncplane(lib.notcurses_stdplane(self.nc))
Ejemplo n.º 7
0
 def __init__(self, ncplane, egc):
     self.ncp = ncplane
     self.c = ffi.new("cell *")
     self.c.gcluster = egc
     self.c.channels = 0
     self.c.attrword = 0