473,794 Members | 2,983 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
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?

cheers,

- harold -

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

Jul 19 '05 #1
3 2809
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,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?


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

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.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.)
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?


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
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.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.)


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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
4430
by: Brian Victor | last post by:
I am attempting to write a curses-based program. I would like to use the default terminal background rather than a black one (a significant difference with transluscent terminals, regardless of one's opinion of them). It appears that in the C ncurses interface, this is accomplished via use_default_colors() and assume_default_colors(). However, these functions don't seem to have parallels in the python binding. Is there some way to...
7
2862
by: M.Senthil Kumar | last post by:
hai all, I need a help from you. I 'm working in a project using "curses.h" in Linux using 'C'. I have some doughts regarding menus and line. 1. I used to draw box in window using ACS_HLINE,ACS_VLINE. But what happened is, the line is not a straight line. Instead of that it look continus hypen ( - ) for HLINE and continuous ( | ) for VLINE. I'm using curses version : 5.3.20030118 came along with RedHat 9.0 . Please tellme how to draw...
30
6119
by: Ian Ward | last post by:
When I run the following code in a terminal with the encoding set to UTF-8 I get garbage on the first line, but the correct output on the second. import curses s = curses.initscr() s.addstr('\xc3\x85 U+00C5 LATIN CAPITAL LETTER A WITH RING ABOVE\n') s.addstr('\xc3\xa5 U+00F5 LATIN SMALL LETTER O WITH TILDE') s.refresh() s.getstr()
4
2208
by: meLlamanJefe | last post by:
I have a C++ application that instantiates various instances of the same object (let's call it MainExec) and puts them into a vector. Each instance of a MainExec runs in its own thread. The code was originally written to run only one instance (thread) of the MainExec object and it uses Curses to interact with the user. The Curses session runs on the same physical terminal screen where the program was executed in and is used to read user commands...
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10435
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10213
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10163
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6779
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.