Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 22 Sep 2014, 18:37
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
GTK Terminal Window
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 2 [29 Posts]   Goto page: Previous 1, 2
Author Message
8-bit


Joined: 03 Apr 2007
Posts: 3368
Location: Oregon

PostPosted: Sun 18 Oct 2009, 15:38    Post subject:  

Has anyone had any luck with the -geometry option working fully?
I have tried it with -geometry 80x4+20+10 and have had no luck with positioning of a window.
If I understand it correctly, the first part is character size of windows and the second is placement by pixel addressing.
But the second part supposedly can be changed by adding a suffix of c to it.
Or is it prefix?
Can't remember right now.
Back to top
View user's profile Send private message 
8-bit


Joined: 03 Apr 2007
Posts: 3368
Location: Oregon

PostPosted: Sun 18 Oct 2009, 15:47    Post subject:  

sunburnt wrote:
8-bit; If you want the GUI to remain visible while your format program runs
in Xterm, use " &" on the end of the xterm command to background it.
The only problem is that the GUI won`t know when Xterm is finished.
In some of my apps. like this that was a problem, it may not be for yours.


One of my problems was to get text output of the external program to display while it was running.
But if I use rxvt or xterm [name of program] and have it send it's output to a temporary file to be read and displayed,
the external program completes before the routine to display the text starts.
Also, if I use rxvt [name of program] with an rxvt window, if the program has an error, it is sent to rxvt only and rxvt exits with no error
so checking for errors of the program run via rxvt is driving me nuts.
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5031
Location: Arizona, U.S.A.

PostPosted: Sun 18 Oct 2009, 16:49    Post subject:  

Code:
rxvt -e (run program and redirect it`s output to /tmp/file) &
GUI top app. monitoring the /tmp/file

So rxvt and the GUI top app. are running at the same time.
Back to top
View user's profile Send private message 
8-bit


Joined: 03 Apr 2007
Posts: 3368
Location: Oregon

PostPosted: Sun 18 Oct 2009, 22:35    Post subject:  

I tried that approach with running the external program in the background with it's output directed to a /temp/file and the tailings routine waited for the external program to finish before it ran.
As a result, only the tailings of the output from the external program were displayed.

Now on to another thing.
First, the -geometry option works!
You can try it in a terminal to bring up another terminal by typing
#rxvt -geometry 40x15+480+400
The 40x15 is character size of window.
The 480+400 is window position by pixel in format of horizontal+vertical.

And...
Does anyone know if it is possible to pass an error code from an external program run with rxvt -e back to the gtkdialog script?
When the external program is run with rxvt -e, and has an error, it passes it to rxvt, which closes without passing along the error to the script.
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5031
Location: Arizona, U.S.A.

PostPosted: Mon 19 Oct 2009, 04:51    Post subject:  

8-bit; Why did you have the tail output app. wait for rxvt to finish?
I thought that you wanted it to show it`s output interactively.

To answer your last Q:
First do you expect the parent app. to know what the child app. is doing
while the child is running, or get the error after the child finishes?
If after... Run it like this:
Code:
. rxvt -e

If during... The child writes a /tmp file and the parent watches for it.
Back to top
View user's profile Send private message 
8-bit


Joined: 03 Apr 2007
Posts: 3368
Location: Oregon

PostPosted: Mon 19 Oct 2009, 16:12    Post subject:  

The code you gave ". rxvt -e [program name] gives an error of not having a filename.
". /tmp/[filename] rxvt -e [program name]" gives file not found unless you create one.
".rxvt -e [program name] gives Command not found.
And even then it does not change the /tmp/file in any way.

Also, when I used tailing, the first output lines of the external program that ended with with a carriage return/linefeed displayed fine in window.
But...
After that, the output lines of the external program were termiated by ctrl-M and kicked back an error not displaying in window.

As you gathered, I am not much of a programmer, but I try to learn as I go along and mostly by examining code and researching problems.
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5031
Location: Arizona, U.S.A.

PostPosted: Mon 19 Oct 2009, 17:52    Post subject:  

You need to describe more what you are trying to do I guess.
You want to run your formatter app. and what does it display exactly?
Back to top
View user's profile Send private message 
8-bit


Joined: 03 Apr 2007
Posts: 3368
Location: Oregon

PostPosted: Mon 19 Oct 2009, 23:16    Post subject:  

It displays a main screen when you start the program with options of disk size, low level and dos filesystem.
You do your selections, click OK, and a message comes up asking you to insert a writable unmounted disk.
(That message was interim to getting error checking.)
Then the main screen is replaced by the ufiformat screen that displays 2 lines. The first stays intact while the window is open. The second line overwrites itself as formatting progresses.
After the mkdosfs screen or the ufiformat screen completes, a message box comes up to signify it and then the main screen reappears.
You exit it and the program with the QUIT button.
screen3.jpg
 Description   
 Filesize   20.47 KB
 Viewed   1153 Time(s)

screen3.jpg

screen2.jpg
 Description   
 Filesize   13.03 KB
 Viewed   1060 Time(s)

screen2.jpg

screen1.jpg
 Description   
 Filesize   22.14 KB
 Viewed   1053 Time(s)

screen1.jpg

Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5031
Location: Arizona, U.S.A.

PostPosted: Tue 20 Oct 2009, 00:27    Post subject:  

I`m not sure what the problem is, the 2 Xterms don`t popup?
Or you want the GUI to stay visible while the Xterms do their work?

You may be able to auto. detect if the floppy is a 720K or 1440K.
The 720K floppy disks don`t have a hole in the corner,
but not all floppy drives have a sensor to detect it. I think...
Back to top
View user's profile Send private message 
8-bit


Joined: 03 Apr 2007
Posts: 3368
Location: Oregon

PostPosted: Tue 20 Oct 2009, 01:00    Post subject:  

I am using rxvt sized and positioned windows which pop up fine and disappear on completion returning to the main window after a completion message.
I am still trying to get any errors from the command run in rxvt to be returned to my gtkdialog script to act upon.
I have tried a few different types of error checking and none seem to work.
Lets say the write protect tab is set on the floppy.
ufiformat or mkdosfs run in a terminal window return an error to the terminal window and it closes.
But the instance of rxvt does not return the error to the script.
If I run them directly, my error checking works, but I have no display window.
And again, the tailings routine using a temp file does not seem to work.
I think it has to do with the format of the text it is sending to the temp file when acted upon by the tailings function.
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5031
Location: Arizona, U.S.A.

PostPosted: Tue 20 Oct 2009, 01:42    Post subject:  

So the error is text displayed in rxvt from the floppy utility it`s running?
Make this script:
Code:
#!/bin/sh
(command to run floppy utility)
echo $? > /tmp/floppyUtil.err

Have the GUI run rxvt and it runs this script instead of the floppy utility.
The last line writes the error code returned by the utility to a /tmp file.
Have the GUI monitor the /tmp file and display your own error text.

Have the GUI look for the /tmp file, it appears when rxvt is done.
Code:
(command to run rxvt and above script)
while :
do
 sleep 2
 if [ -e /tmp/floppyUtil.err ];then
 ERR=$(</tmp/floppyUtil.err)
 rm -f /tmp/floppyUtil.err
 break
fi
done

$ERR has the error code that you write popup warning screens for.
You must make the utility error all of the errors to get the codes.
But... The error codes may be the same for some errors.
Back to top
View user's profile Send private message 
8-bit


Joined: 03 Apr 2007
Posts: 3368
Location: Oregon

PostPosted: Tue 20 Oct 2009, 19:49    Post subject:  

Well, I tried your example scripts with my internal and external script and though a tmp file was created, it returned a zero with and without the floppy inserted.
The pop up window was mainly to let the user see what was happening.
But to a certain extent, that is geeky.
So I am running the externals directly from the script with a persistant message that stays until the external process finishes or kicks back an error.
The script then handles the error, displays a message, and takes one back to the main menu.
I tried to borrow the error handling from Barry's floppy-format script and it works for low level formating even with a retry option.
But for the mkdosfs function, the retry button reruns the lowlevel function and not the mkdosfs function.
So at this point, I can remove the retry buttons and just have the script return to the main menu after displaying the error message.
Works for me anyway.
One more comment is that I have a box of poor quality floppys I was using for testing. After a bunch of reformats, they failed.
I do not blame this on the program as the same disks failed with Microsoft too!
So now, it is just a matter of creating a Pet package with my GTKdialog script, a desktop file, and the ufiformat package with the man page.
So, do you think a pop up message box that says "Please Wait....Formatting Disk" or "Writing dos filesystem to disk would suffice?
And, those messages are only seen if there are no errors.
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5031
Location: Arizona, U.S.A.

PostPosted: Tue 20 Oct 2009, 19:55    Post subject:  

That sort of message is how Barry does it...
Yeah, floppys are about as unreliable as the government.
I think everyone is using USB drives, even FireWire is on it`s way out.
Back to top
View user's profile Send private message 
8-bit


Joined: 03 Apr 2007
Posts: 3368
Location: Oregon

PostPosted: Tue 20 Oct 2009, 20:34    Post subject:  

sunburnt wrote:
That sort of message is how Barry does it...
Yeah, floppys are about as unreliable as the government.
I think everyone is using USB drives, even FireWire is on it`s way out.


As to floppys being unreliable, I have a very old Osborne Luggable Portable running CPM that still boots from a 5.25" floppy that still boots up.
Seems like a word processor as well as a few utilities were included on it.
The monocrome 6" screen still works too.
But the keyboard is showing it's age.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 2 of 2 [29 Posts]   Goto page: Previous 1, 2
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0796s ][ Queries: 13 (0.0050s) ][ GZIP on ]