curses for different terminals

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • harold fellermann

    #1

    curses for different terminals

    Hi all,

    I want to use curses in a server application that provides a GUI for
    telnet clients. Therefore, I need the functionality to open and handle
    several
    screens. Concerning

    this can be done using the function newterm(type,of p,ifp). However, this
    function seems not to be defined in the python library. Does anyone know
    how this can be done in python?

    cheers,

    - harold -

    --
    Life is what happens while you're busy making other plans
    -- John Lennon

  • Christos TZOTZIOY Georgiou

    #2
    Re: curses for different terminals

    On Thu, 14 Apr 2005 18:39:14 +0200, rumours say that harold fellermann
    <harold.fellerm ann@upf.edu> might have written:
    [color=blue]
    >Hi all,[/color]
    [color=blue]
    >I want to use curses in a server application that provides a GUI for
    >telnet clients. Therefore, I need the functionality to open and handle
    >several
    >screens.[/color]

    Just to make sure we understand what you want to do:

    1. Are you doing an single process application that produces output on
    many terminals? ie the program is kind of like a service?

    2. Are you doing an application with one session per terminal? ie a
    user starts your app in every terminal, no multi-term output from a
    single process.

    3. Are you doing an application that runs on one terminal but with many
    "virtual" sessions (or screens), kind of like the `screen(1)` program or
    the behaviour of the linux or Novell console?
    [color=blue]
    >Concerning
    >http://dickey.his.com/ncurses/ncurses-intro.html#init
    >this can be done using the function newterm(type,of p,ifp). However, this
    >function seems not to be defined in the python library. Does anyone know
    >how this can be done in python?[/color]

    Select one of the above, or describe more the desired situation if I
    didn't cover your case, and we will try to help you more.

    --
    TZOTZIOY, I speak England very best.
    "Be strict when sending and tolerant when receiving." (from RFC1958)
    I really should keep that in mind when talking with people, actually...

    Comment

    • harold fellermann

      #3
      Re: curses for different terminals


      On 14.04.2005, at 19:17, Christos TZOTZIOY Georgiou wrote:
      [color=blue]
      > On Thu, 14 Apr 2005 18:39:14 +0200, rumours say that harold fellermann
      > <harold.fellerm ann@upf.edu> might have written:
      >[color=green]
      >> Hi all,[/color]
      >[color=green]
      >> I want to use curses in a server application that provides a GUI for
      >> telnet clients. Therefore, I need the functionality to open and handle
      >> several
      >> screens.[/color]
      >
      > Just to make sure we understand what you want to do:
      >
      > 1. Are you doing an single process application that produces output on
      > many terminals? ie the program is kind of like a service?[/color]

      gotcha. I want to write a TCP server that handles incoming requests in
      threads (one thread per request using SocketServer.Th readingTCPServe r).
      Now, I want the server to use curses for client-server communication
      (client will be telnet). Thus, my programm runs in a single process
      (although several threads) and provides several curses screens (one for
      each client.)
      [color=blue][color=green]
      >> Concerning
      >> http://dickey.his.com/ncurses/ncurses-intro.html#init
      >> this can be done using the function newterm(type,of p,ifp). However,
      >> this
      >> function seems not to be defined in the python library. Does anyone
      >> know
      >> how this can be done in python?[/color]
      >
      > Select one of the above, or describe more the desired situation if I
      > didn't cover your case, and we will try to help you more.[/color]

      great, thanks,

      - harold -

      --
      Dieses Schreiben wurde maschinell erstellt und bedarf daher keiner
      Unterschrift.
      --

      Comment

      • Christos TZOTZIOY Georgiou

        #4
        Re: curses for different terminals

        On Thu, 14 Apr 2005 19:38:26 +0200, rumours say that harold fellermann
        <harold.fellerm ann@upf.edu> might have written:
        [color=blue][color=green]
        >> 1. Are you doing an single process application that produces output on
        >> many terminals? ie the program is kind of like a service?[/color][/color]
        [color=blue]
        >gotcha. I want to write a TCP server that handles incoming requests in
        >threads (one thread per request using SocketServer.Th readingTCPServe r).
        >Now, I want the server to use curses for client-server communication
        >(client will be telnet). Thus, my programm runs in a single process
        >(although several threads) and provides several curses screens (one for
        >each client.)[/color]

        I see. At first, here is some relevant source from
        Modules/_cursesmodule.c :

        """
        A number of SysV or ncurses functions don't have wrappers yet; if you
        need
        a given function, add it and send a patch. Here's a list of currently
        unsupported functions:

        addchnstr addchstr chgat color_set define_key
        del_curterm delscreen dupwin inchnstr inchstr innstr keyok
        mcprint mvaddchnstr mvaddchstr mvchgat mvcur mvinchnstr
        mvinchstr mvinnstr mmvwaddchnstr mvwaddchstr mvwchgat
        mvwgetnstr mvwinchnstr mvwinchstr mvwinnstr newterm
        resizeterm restartterm ripoffline scr_dump
        scr_init scr_restore scr_set scrl set_curterm set_term setterm
        tgetent tgetflag tgetnum tgetstr tgoto timeout tputs
        vidattr vidputs waddchnstr waddchstr wchgat
        wcolor_set winchnstr winchstr winnstr wmouse_trafo wscrl
        """

        So the answer is that, no, you can't use newterm currently.

        But even if you did, it's not certain that you could use multiterminal
        ncurses in a multithreaded environment; AFAIK in ncurses you just change
        the "current" term and then go on with normal curses calls; is there a
        "current" term per thread, or is there one per process? I couldn't find
        an answer in the short search I did.

        I am afraid you will have to make it into a 3-tier arch; that is, your
        server has the data model and absolutely no curses knowledge, and the
        clients run a middle application, interfacing ncurses I/O and server
        protocol.
        --
        TZOTZIOY, I speak England very best.
        "Be strict when sending and tolerant when receiving." (from RFC1958)
        I really should keep that in mind when talking with people, actually...

        Comment

        Working...