By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,595 Members | 1,433 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,595 IT Pros & Developers. It's quick & easy.

curses for different terminals

P: n/a
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
http://dickey.his.com/ncurses/ncurses-intro.html#init
this can be done using the function newterm(type,ofp,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

Jul 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Thu, 14 Apr 2005 18:39:14 +0200, rumours say that harold fellermann
<ha***************@upf.edu> might have written:
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.
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?
Concerning
http://dickey.his.com/ncurses/ncurses-intro.html#init
this can be done using the function newterm(type,ofp,ifp). However, this
function seems not to be defined in the python library. Does anyone know
how this can be done in python?


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...
Jul 19 '05 #2

P: n/a

On 14.04.2005, at 19:17, Christos TZOTZIOY Georgiou wrote:
On Thu, 14 Apr 2005 18:39:14 +0200, rumours say that harold fellermann
<ha***************@upf.edu> might have written:
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.


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?


gotcha. I want to write a TCP server that handles incoming requests in
threads (one thread per request using SocketServer.ThreadingTCPServer).
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.)
Concerning
http://dickey.his.com/ncurses/ncurses-intro.html#init
this can be done using the function newterm(type,ofp,ifp). However,
this
function seems not to be defined in the python library. Does anyone
know
how this can be done in python?


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.


great, thanks,

- harold -

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

Jul 19 '05 #3

P: n/a
On Thu, 14 Apr 2005 19:38:26 +0200, rumours say that harold fellermann
<ha***************@upf.edu> might have written:
1. Are you doing an single process application that produces output on
many terminals? ie the program is kind of like a service?
gotcha. I want to write a TCP server that handles incoming requests in
threads (one thread per request using SocketServer.ThreadingTCPServer).
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.)


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...
Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.