Xdialog Yes/No buttons bug

L18L discovered this. The documentation for Xdialog states that the "--yesno" window will display buttons labeled "Yes" and "No". The proof is here:
http://xdialog.free.fr/doc/box.html

Perhaps this did work correctly with an earlier version of Xdialog? Anyway, now it doesn't, and the buttons display as "OK" and "Cancel".

This is where L18L reported the problem:
http://murga-linux.com/puppy/viewtopic.php?t=76182&start=105

I have fixed a bunch of scripts in /usr/sbin in Woof, haven't checked anywhere else.

These are gettext'ed scripts that will need to be updated:
alsaconf, burniso2cd, cups_shell, modemtest, pupdial, puppyinstaller, puppypdf, remove_builtin

I didn't notice this one before. It was created by 01micko I think, and had t12s internationalization. I have converted it to gettext:
nouveau_unload

These are not internationalized:
Pudd, remasterpup2, xgamma-gui

Woof commit:
http://bkhome.org/fossil/woof2.cgi/info/bcf91a7cc8


Posted on 29 Mar 2012, 9:56


Comments:

Posted on 29 Mar 2012, 12:31 by technosaurus
sdialog
I have started working on a simple dialog tool that's functionality falls in between the bare metal of gtk-server and the xml-ness of gtkdialog, yet with the simplicity of traditional dialog tools. The formatting capabilities are on par with gtkdialog (multiple widgets, box-packing etc...) but with syntax closer to that of {,c,X}dialog and yad. I know there are already a ton of them out there, but none of them are both simple and extensible. Let me know if you have a wish list and I will try to accomodate in the gtk2 version at least (I am planning to support multiple backends, including gtk1,2,3, followed by libagar since it is the only decent bsd licensed widget toolkit I can find written in C).

While I was at it I threw together a generic trayicon tool as a separate program because it was just to easy to push out once I figured out the widget. It supports as many icons as your tray will fit, and they can change on the fly with configurable refresh rate, tooltips and left/right mouse click actions. (Yes, this means you can have all of your tray icons supplied by one program and controlled by a single shell script)
http://www.murga-linux.com/puppy/viewtopic.php?t=76431
the tarball containing source build script and binary is only 2.8kb, so it won't break the bank either


Posted on 29 Mar 2012, 13:42 by lobster
xml-ness of gtkdialog
For various reasons, including long term potential and if possible, a 'no window' command, clearing screen space around a program would be useful. Hope that is possible.


Posted on 29 Mar 2012, 16:30 by BarryK
Re Sdialog
technosaurus,
Yes, there are heaps of them out there, including my own recent efforts 'pupdialog' and 'pupmessage' -- but mine are only shell script pre-processors for gtkdialog, so not the most efficient.

A better replacement for xmessage would be nice, that really does work like xmessage (except uses GTK). Would it be possible for Sdialog to also be able to handle the xmessage commandline syntax?

My pupmessage does the basics of xmessage, see:
http://bkhome.org/fossil/woof2.cgi/artifact/3f119e03fa1850c687f4056e33f1c57be8242d28

...handling of the '-buttons' parameter would make it much more useful.

maybe Sdialog could be kind of chameleon-like, detecting what commandline-syntax is being used, say xmessage, Xdialog, (etc.) and use that automatically.

Note, I have JWM configured to display xmessage windows without window decorations, and for consistency pupmessage also displays without decorations -- the '-title' actually displays a bold "backtitle" message within the window.



Posted on 29 Mar 2012, 17:01 by BarryK
Re sit
technosaurus,
Your 'simple icon tray' is extremely interesting!

Perhaps it could be used to get Puppy free of our dependency on ROX-Filer. The desktop drive icons, trash, etc. could all go into sit.

Then, we would be able to use any file manager.

I don't know how we would handle those PCs that have a lot of drive partitions -- some people have more than a dozen. Currently, they expand onto a second line above the first.



Posted on 29 Mar 2012, 19:40 by maxerro
re: lots of partitions
There should be a choice for users if they want all of the partitions to show-up in tray as separate icons (if the number is low) OR just the physical drives with partition-submenus (which appears to be more logical) OR just a single mount-tray-icon with customizable drive/partition menu layouts (flat or submenus)...

I have lots of partitions, and actually find it easiest to type a command (through customized scripts), but users should have an easier choice.



Posted on 29 Mar 2012, 23:10 by L18L
xgamma-gui
It is not clear why values are allowed from 0 to 199
xgamma wants them between 1 and 100 / 0.1 and 10.0

Anyhow here is internationalized version

#!/bin/bash

#Written by PANZERKOPF
#100215 hacked by BK
#120329 i18n

. gettext.sh
export TEXTDOMAIN=xgamma-gui
export OUTPUT_CHARSET=UTF-8


TITLE="$(gettext 'Monitor Gamma calibration')"
BACKTITLE="$(gettext 'Set percentage value for each colour,\nor adjust equally if only want to adjust\nbrightness of screen')"

if [ "`which xgamma`" = "" ]; then
Xdialog --title "${TITLE}" --msgbox "$(gettext 'xgamma not found.')" 0 0
exit
fi

GAMMA='100/100/100'
#file contains one line like this: xgamma -rgamma 1.00 -ggamma 1.00 -bgamma 1.00 #100/100/100
[ -f $HOME/.xgamma-gamma ] && GAMMA="`cat $HOME/.xgamma-gamma | cut -f 2 -d '#'`"

EXCODE="0"


to be continued...



Posted on 29 Mar 2012, 23:12 by L18L
xgamma-gui part 2
while [ "${EXCODE}" = "0" ]; do


if [ ! -z ${xGAMMA} ]; then
echo ${xGAMMA}
#xgamma -rgamma ${xGAMMA:0:1}.${xGAMMA:1:2} -ggamma ${xGAMMA:4:1}.${xGAMMA:5:2} -bgamma ${xGAMMA:8:1}.${xGAMMA:9:2}
rg=`echo ${xGAMMA} | cut -d '/' -f1 | rev` ; rg=`echo "${rg:0:1}.${rg:1:2}" | rev`
gg=`echo ${xGAMMA} | cut -d '/' -f2 | rev` ; gg=`echo "${gg:0:1}.${gg:1:2}" | rev`
bg=`echo ${xGAMMA} | cut -d '/' -f3 | rev` ; bg=`echo "${bg:0:1}.${bg:1:2}" | rev`
echo $rg $gg $bg
xgamma -rgamma $rg -ggamma $gg -bgamma $bg
sGAMMA=${xGAMMA}
xgamma
fi

# xGAMMA=`Xdialog --screen-center --left --backtitle "${BACKTITLE}" --title "${TITLE}" --stdout --buttons-style "text" --icon "/usr/share/images/xgamma-gui.xpm" --ok-label "$(gettext 'Apply')" --cancel-label "$(gettext 'Exit')" \
#--3spinsbox "" 0 0 "0" "199" "${GAMMA:0:3}" "$(gettext 'Red')" "0" "199" "${GAMMA:4:3}" "$(gettext 'Green')" "0" "199" "${GAMMA:8:3}" "$(gettext 'Blue')"`
xGAMMA=`Xdialog --screen-center --left --backtitle "${BACKTITLE}" --title "${TITLE}" --stdout --buttons-style "text" --icon "/usr/share/images/xgamma-gui.xpm" --ok-label "$(gettext 'Apply')" --cancel-label "$(gettext 'Exit')" \
--3spinsbox "" 0 0 "0" "199" "${GAMMA:0:3}" "$(gettext 'Red')" "0" "199" "${GAMMA:4:3}" "$(gettext 'Green')" "0" "199" "${GAMMA:7:3}" "$(gettext 'Blue')"`
EXCODE=${?}

done




Posted on 29 Mar 2012, 23:13 by L18L
xgamma-gui part 3
if [ ! -z ${sGAMMA} ]; then

Xdialog --yesno "$(gettext 'Save current configuration?')" 0 0
if [ ${?} -eq 0 ]; then
#echo -n "xgamma -rgamma ${sGAMMA:0:1}.${sGAMMA:1:2} -ggamma ${sGAMMA:4:1}.${sGAMMA:5:2} -bgamma ${sGAMMA:8:1}.${sGAMMA:9:2}"' &' > $HOME/.xgamma-gamma
echo -n "xgamma -rgamma $rg -ggamma $gg -bgamma $bg"' &' > $HOME/.xgamma-gamma
echo " #${sGAMMA}" >> $HOME/.xgamma-gamma
#...xgamma is executed in /root/.xinitrc
echo "$(gettext 'Saved')"
#ummm, but if defaults, don't need xgamma...
[ "$sGAMMA" = "100/100/100" ] && rm -f $HOME/.xgamma-gamma #saves time in .xinitrc
fi
fi

###END###



Posted on 30 Mar 2012, 3:41 by technosaurus
Re: sit/sdialog
re: sit
Tray apps _really_ only need to do the things I have sit set up to do. Namely display an icon (with optional tooltip) and allow interaction via right/left mouse click (This stuff can and should be done externally using a gtkdialog script for instance). The only thing I may add is some validity checks and although it is fairly light on memory, the cpu usage could be lower if I figure out how to compare the time stamp on the file before refreshing the image (it may not be necessary to redraw, but currently it does anyhow).

re: sdialog
I already have buttons, labels, and quite a few widgets working ... the only difference is that a few extra tags are needed -button "label1" "action" -button "label2" "action" ... instead of -buttons label1:action,label2:action
The reason for this is that often you would want
[button] <image> text
[button] <image> text
However it wouldn't be too difficult to implement, so I may end up adding those and c/Xdialog and zenity/yad syntax support (as compile time options) and in the mean time keep them as a separate package by fixing gxmessage - is there a reason it is a symlink to xmessage?
For xmessage I would need to implement:
-default "action" (just monitor for keypress event)
-timeout <int> (already implemented in gtk - just use gtk_main_quit)
-print (currently this is the default option - scripts could wait for OK/Cancel before processing if they want/need - the idea is to establish a two way pipe for direct interaction)
-file /path/file (open(), scanf(), close())
-center/-nearmouse (not sure, but should be easy to pick it out of another program)


Posted on 30 Mar 2012, 8:26 by BarryK
Re xgamma-gui
L18L,
Thanks, xgamma-gui now internationalized.



Posted on 30 Mar 2012, 20:53 by L18L
re re xgamma-gui
Sorry, I had forgotten to change the yesno because of many other fixes.
Uploaded script to:
http://208.109.22.214/puppy/viewtopic.php?t=76182&start=201



Posted on 25 Apr 2012, 3:23 by L18L
cdburner-wizard 1
#!/bin/sh

#cd-burner wizard
#Barry Kauler (c) copyright 2003,2004,2005
#Lesser GPL licence v2 (http://www.fsf.org/licensing/licenses/lgpl.html). 2007 www.puppylinux.com
#updated for v1.0.5
#updated for 2.17
#v431 man, this script is ancient! have done some fixing.
#120323 partial replace 'xmessage' with 'pupmessage'.
#120424 exit if SELECTIONS="" avoids "Usage of Xdialog"; gettext´ed

. gettext.sh
export TEXTDOMAIN=cdburner-wizard

DRIVESFND="`probedisk2`"
OPTICALDRVSFND="`echo "$DRIVESFND" | grep '|optical|'`"

SELECTIONS="`echo "$OPTICALDRVSFND" | cut -f 1,3 -d "|" | tr " " "_" | tr "|" " " | tr '$' "_"`"
if [ -z "$SELECTIONS" ]; then #120424
pupmessage -bg "red" -center -name "burnwiz" -title "$(gettext 'CD/DVD driver Wizard: FAILURE')" "$(gettext 'no optical drive found')"
exit 0
fi

nothing="$(gettext 'nothing')"
CDROMDEV=$nothing
CDROMLINK=$nothing
if [ -e /dev/cdrom ];then
CDROMDEV="/dev/`readlink /dev/cdrom | sed -e 's%/dev/%%'`"
CDROMLINK="`readlink /dev/cdrom`"
fi

DVDDEV=$nothing
DVDLINK=$nothing
if [ -e /dev/dvd ];then
DVDDEV="/dev/`readlink /dev/dvd | sed -e 's%/dev/%%'`"
DVDLINK="`readlink /dev/dvd`"
fi

MSG1="$(gettext 'Welcome to my CD and DVD Drive Wizard!')"
BGCOLOR1="#ffc0c0"

CHOSECD="$(gettext 'Choose_cdrom')"
CHOSEDVD="$(gettext 'Choose_dvd')"




Posted on 25 Apr 2012, 3:28 by L18L
cdburner-wizard part 2
while :; do


xmessage -bg "$BGCOLOR1" -center -name "burnwiz" -title "$(gettext 'Optical Drive Wizard')" -buttons \
"${CHOSECD}":11,"${CHOSEDVD}":20,"$(gettext 'HELP')":15,"$(gettext 'EXIT')":13 \
-file -<<FILETXT

$MSG1
$(gettext 'Puppy has probed your PC and found these CD/DVD drives:')
$SELECTIONS

`eval_gettext 'Puppy thinks the default CDROM drive is: ${CDROMDEV}'`
`eval_gettext 'Puppy thinks the default DVD drive is: ${DVDDEV}'`

DEVICE LINKS:
`eval_gettext '/dev/cdrom is currently linked to: ${CDROMLINK}.'`
`eval_gettext '/dev/dvd is currently linked to: ${DVDLINK}.'`

`eval_gettext 'If you disagree with these choices, click the "${CHOSECD}"
or "${CHOSEDVD}" to change the selection.'`
FILETXT

XREPLY=$?


if [ $XREPLY -eq 11 ];then #choose cdrom
BGCOLOR1="#c0e0ff"
#v1.0.0
CDROMD0="`Xdialog --wmclass "burnwiz" --title "$(gettext 'CD/DVD drive Wizard')" --stdout --menubox "$(gettext 'Choose which is the CDROM drive:')" 0 48 4 $SELECTIONS 2> /dev/null `"
if [ ! $? -eq 0 ];then
MSG1="`eval_gettext 'YOU MADE NO CHOICE FOR CDROM DRIVE, KEEPING ${CDROMDEV}'`"
else
MSG1="`eval_gettext 'YOU JUST CHOSE ${CDROMD0} AS THE CDROM DRIVE'`"
CDROMDEV="$CDROMD0"
CDROMLINK="$CDROMD0"
#strip off the leading "/dev/"...
echo -n $CDROMLINK | cut -f 3 -d '/' > /etc/cdromdevice
rm -f /dev/cdrom
ln -s $CDROMLINK /dev/cdrom
fi
fi




Posted on 25 Apr 2012, 3:30 by L18L
cdburner-wizard part 3
if [ $XREPLY -eq 20 ];then #choose dvd

BGCOLOR1="#c0e0ff"
#v1.0.0
DVDD0="`Xdialog --wmclass "burnwiz" --title "$(gettext 'CD/DVD drive Wizard')" --stdout --menubox "$(gettext 'Choose which is the DVD drive:')" 0 48 4 $SELECTIONS 2> /dev/null `"
if [ ! $? -eq 0 ];then
MSG1="`eval_gettext 'YOU MADE NO CHOICE FOR DVD DRIVE, KEEPING ${DVDDEV}'`"
else
MSG1="`eval_gettext 'YOU JUST CHOSE ${DVDD0} AS THE DVD DRIVE'`"
DVDDEV="$DVDD0"
DVDLINK="$DVDD0"
#strip off the leading "/dev/"...
echo -n $DVDLINK | cut -f 3 -d '/' > /etc/dvddevice
rm -f /dev/dvd
ln -s $DVDLINK /dev/dvd
fi
fi


if [ $XREPLY -eq 15 ];then #help
pupmessage -bg "purple" -center -title "$(gettext 'CD/DVD driver Wizard: HELP')" "$(gettext '/dev/dvd and /dev/cdrom are links to the actual devices,
for example, a link to /dev/sdc.
These should point to the drives that you want to read from.
For example, my PC has two drives,
a DVD read-only drive and a CD-burner drive.
I point *both* /dev/dvd and /dev/cdrom to the DVD drive,
although I could have pointed /dev/cdrom to the burner drive
(a DVD drive can also read CDs, so I chose it as my default
for reading both CDs and DVDs).

There are various applications for reading from CD or DVD.
For example, Gxine can play audio CDs and video DVDs.
Most of these applications require that /dev/cdrom
or /dev/dvd point to the correct devices.')"
fi

if [ $XREPLY -eq 13 ];then #exit
break
fi
if [ $XREPLY -eq 0 ];then #exit
break
fi
if [ $XREPLY -eq 1 ];then #exit
break
fi

done
##END##