GTK Terminal Window

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#21 Post by 8-bit »

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.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#22 Post by sunburnt »

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?

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#23 Post by 8-bit »

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.
Attachments
screen3.jpg
(20.47 KiB) Downloaded 1303 times
screen2.jpg
(13.03 KiB) Downloaded 1251 times
screen1.jpg
(22.14 KiB) Downloaded 1194 times

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#24 Post by sunburnt »

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

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#25 Post by 8-bit »

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.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#26 Post by sunburnt »

So the error is text displayed in rxvt from the floppy utility it`s running?
Make this script:

Code: Select all

#!/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: Select all

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

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#27 Post by 8-bit »

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.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#28 Post by sunburnt »

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.

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#29 Post by 8-bit »

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.

Post Reply