Page 56 of 76

Posted: Sun 14 Aug 2016, 14:35
by B.K. Johnson
@Geoffrey
Thanks for those 2 examples.

Bonus question:
What's the definitive link for yad commands. I did not see "timeout" and "no-buttons" anywhere I looked?

Posted: Sun 14 Aug 2016, 19:27
by Wognath
What's the definitive link for yad commands.
http://smokey01.com/help/yad-tips-0.0.1.ncd.tar.xz

Posted: Sun 14 Aug 2016, 19:34
by B.K. Johnson
@Wognath
Thanks for the link.

Posted: Sun 14 Aug 2016, 21:42
by Geoffrey
B.K. Johnson wrote: I did not see "timeout" and "no-buttons" anywhere I looked?
In the terminal type either of these.

Code: Select all

Help Options:
  -h, --help                                     Show help options
  --help-all                                     Show all help options
  --help-general                                 Show general options
  --help-common                                  Show common options
  --help-calendar                                Show calendar options
  --help-color                                   Show color selection options
  --help-dnd                                     Show drag-n-drop options
  --help-entry                                   Show text entry options
  --help-file                                    Show file selection options
  --help-font                                    Show font selection options
  --help-form                                    Show form options
  --help-icons                                   Show icons box options
  --help-list                                    Show list options
  --help-multi-progress                          Show multi progress bars options
  --help-notebook                                Show notebook dialog options
  --help-notification                            Show notification icon options
  --help-paned                                   Show paned dialog options
  --help-picture                                 Show picture dialog options
  --help-print                                   Show print dialog options
  --help-progress                                Show progress options
  --help-scale                                   Show scale options
  --help-text                                    Show text information options
  --help-filter                                  Show file filter options
  --help-misc                                    Show miscellaneous options
  --help-gtk
The general help options show the commands you seek.

Code: Select all

# yad --help-general
Usage:
  yad [OPTION...] - Yet another dialoging program

General options
  --title=TITLE                                  Set the dialog title
  --window-icon=ICONPATH                         Set the window icon
  --width=WIDTH                                  Set the width
  --height=HEIGHT                                Set the height
  --geometry=WxH+X+Y                             Set the window geometry
  --timeout=TIMEOUT                              Set dialog timeout in seconds
  --timeout-indicator=POS                        Show remaining time indicator (top, bottom, left, right)
  --text=TEXT                                    Set the dialog text
  --text-align=TYPE                              Set the dialog text alignment (left, center, right, fill)
  --image=IMAGE                                  Set the dialog image
  --image-on-top                                 Show image above main widget
  --icon-theme=THEME                             Use specified icon theme instead of default
  --expander=TEXT                                Hide main widget with expander
  --button=NAME:ID                               Add dialog button (may be used multiple times)
  --no-buttons                                   Don't show buttons
  --buttons-layout=TYPE                          Set buttons layout type (spread, edge, start, end or center)
  --no-markup                                    Don't use pango markup language in dialog's text
  --no-escape                                    Don't close dialog if Escape was pressed
  --borders=NUMBER                               Set window borders
  --always-print-result                          Always print result
  --selectable-labels                            Dialog text can be selected
  --sticky                                       Set window sticky
  --fixed                                        Set window unresizable
  --on-top                                       Place window on top
  --center                                       Place window on center of screen
  --mouse                                        Place window at the mouse position
  --undecorated                                  Set window undecorated
  --skip-taskbar                                 Don't show window in taskbar
  --maximized                                    Set window maximized
  --fullscreen                                   Set window fulscreen
  --no-focus                                     Don't focus dialog window
  --splash                                       Open window as a splashscreen
  --plug=KEY                                     Special type of dialog for XEMBED
  --tabnum=NUMBER                                Tab nubmer of this dialog
  --parent-win=XID                               XID of parent window
  --kill-parent=SIGNAL                           Send SIGNAL to parent
  --print-xid                                    Print X Window Id to the stderr
  --image-path=PATH                              Add path for search icons by name

Posted: Mon 15 Aug 2016, 03:02
by B.K. Johnson
That is just wonderful Geoffrey.
Greatly appreciated.

Posted: Mon 15 Aug 2016, 06:04
by smokey01
I'm trying to find a way to make the GUI refresh depending if a file called checkfile exists in /root.

The create button creates the file and the delete buttons deletes it. I want the frame to hide if no checkfile exist and show if it does. It works fine if the GUI is restarted.

Code: Select all

#!/bin/bash

[ -z $GTKDIALOG ] && GTKDIALOG=gtkdialog

CHECK () {
if [ -f /root/checkfile ]; then
    eth0=true
else
    eth0=false
fi
}
export -f CHECK

CHECK

export MAIN_DIALOG='
<window window-position="3" icon-name="gtk-network" title="'"$eth0"'" resizable="true" border-width="0">
<vbox>
	<frame Create/Delete>
		<hbox>
			<button>
			<input file stock="gtk-add"></input>
				<label>Create</label>
				<action>echo checkfile > /root/checkfile &</action>
			</button>
			<button>
			<input file stock="gtk-delete"></input>
				<label>Delete</label>
				<action>rm /root/checkfile &</action>
			</button>	
</hbox>
	</frame>
<vbox visible="'"$eth0"'">
	<frame Boo>
		<hbox homogeneous="true" auto-refresh="true">
			<button>
				<input file>/usr/share/pixmaps/midi-icons/home48.png</input>
				<action>yad --text="Bingo" --center &</action>
				<action>CHECK</action>
				<action type="refresh">eth0</action>
				<variable>eth0</variable>
			</button>
		</hbox>
	</frame>
</vbox>
<vbox>	
		<hbox>
			<button ok>
			</button>
		</hbox>
</vbox>
</vbox>
</window>'

case $1 in
	-d | --dump) echo "$MAIN_DIALOG" ;;
	*) $GTKDIALOG --program=MAIN_DIALOG ;;
esac
Thanks

Posted: Mon 15 Aug 2016, 07:16
by MochiMoppel
smokey01 wrote:I'm trying to find a way to make the GUI refresh depending if a file called checkfile exists in /root.

The create button creates the file and the delete buttons deletes it.
This should do it:

Code: Select all

#! /bin/sh
export MAIN_DIALOG=' 
<window window-position="3" icon-name="gtk-network"  resizable="true" border-width="0"> 
<vbox> 
<frame Create/Delete> 
   <hbox> 
	  <button> 
	  <input file stock="gtk-add"></input> 
		 <label>Create</label> 
		 <action>echo checkfile > /root/checkfile &</action> 
         <action>show:vBOO</action>
        <action>refresh:vWIN</action>
	  </button> 
	  <button> 
	  <input file stock="gtk-delete"></input> 
		 <label>Delete</label> 
		 <action>rm /root/checkfile &</action> 
        <action>hide:vBOO</action>
        <action>refresh:vWIN</action>
	  </button>    
</hbox> 
</frame> 

<vbox> 
<frame Boo> 
   <hbox homogeneous="true" auto-refresh="true"> 
	  <button> 
		 <input file>/usr/share/pixmaps/midi-icons/home48.png</input> 
		 <action>yad --text="Bingo" --center &</action> 
	  </button> 
   </hbox> 
</frame>
<variable>vBOO</variable> 
</vbox> 
<vbox>    
   <hbox> 
	  <button ok> 
	  </button> 
   </hbox> 
</vbox> 
</vbox> 
<action signal="show" condition="command_is_true([[ -f /root/checkfile ]] || echo true )">hide:vBOO</action>
<variable>vWIN</variable>
<input>[[ -f /root/checkfile ]] && echo checkfile exists || echo no checkfile</input>
</window>' 

gtkdialog --program=MAIN_DIALOG
EDIT: My earlier version didn't update your window title. Now it does.
I noticed that you use window-position="3" resizeable="true". AFAIK you can't resize a centered gtkdialog.

Posted: Mon 15 Aug 2016, 09:28
by smokey01
That's great MochiMoppel but it's hiding the image and not the frame.

I want the GUI to shrink when there's no image.

Thanks

Posted: Mon 15 Aug 2016, 09:37
by Geoffrey
smokey01 wrote:I want the GUI to shrink when there's no image.
make it resizable="false", that will do it.

Posted: Mon 15 Aug 2016, 11:53
by MochiMoppel
smokey01 wrote:That's great MochiMoppel but it's hiding the image and not the frame.
It does exactly what you asked for ("I want the frame to hide if no checkfile exist and show if it does"). It is hiding the frame.
I want the GUI to shrink when there's no image
Geoffrey's trick does it and I have no idea why. I haven't found any explanation of a window tag attribute resizable , not in this tutorial and not in the gtkdialog reference though the GtkWindow Manual lists the “resizable

Posted: Mon 15 Aug 2016, 13:32
by smokey01
MochiMoppel wrote:
smokey01 wrote:That's great MochiMoppel but it's hiding the image and not the frame.
It does exactly what you asked for ("I want the frame to hide if no checkfile exist and show if it does"). It is hiding the frame.
I want the GUI to shrink when there's no image
Geoffrey's trick does it and I have no idea why. I haven't found any explanation of a window tag attribute resizable , not in this tutorial and not in the gtkdialog reference though the GtkWindow Manual lists the “resizable

Posted: Mon 15 Aug 2016, 14:19
by B.K. Johnson
Hi guys
The timeout=TIMEOUT command seems to have the bizarre behaviour of wiping out the text in msgbox or text. Can someone confirm, please?
Thanks

Posted: Tue 16 Aug 2016, 02:08
by Geoffrey
B.K. Johnson wrote:Hi guys
The timeout=TIMEOUT command seems to have the bizarre behaviour of wiping out the text in msgbox or text. Can someone confirm, please?
Thanks
This is yad?, could you give an example of how the text is read.

Maybe it would be better to move the discussion to the YAD - Tips

Posted: Tue 16 Aug 2016, 03:31
by B.K. Johnson
Sure Geoffery
This is a slight modification of your earlier post.

Code: Select all

#!/bin/bash
yad --title="Yad Message Box" --width=200 --height=150 --fixed --text-align="center" --skip-taskbar --window-icon="gtk-dialog-info" \
--text="<big><b>
This is a Yad message box
</b></big>" --no-buttons --timeout="3" 
The text is not displayed.
Remove the timeout and it is shown.

Posted: Tue 16 Aug 2016, 05:09
by Geoffrey

Posted: Tue 23 Aug 2016, 05:02
by MochiMoppel
Back to topic and to the confusing "resizable" attribute. It turns out that I used it before for the exact purpose it was invented. It removes the "Resize" item from the window menu and prevents user resizing.

With its surprising side effects I can now solve a problem that puzzled me for a long time.

I've created a tiny image viewer with the pixmap widget. Pretty much like Viewnior it uses one dialog window to read images one after another. The problem is that while the dialog window will automatically expand when reading an image bigger than the previous image (that's good!), it will not shrink when the following image is smaller. This puts ugly empty space around the image (see screenshot).

With resizable="false" the window will expand as well, but it will also shrink, adapting window size always to the size of the image. Very neat.

[SOLVED]

Posted: Tue 06 Sep 2016, 11:50
by peebee
Fixed by @MochiMoppel - thank you - http://www.murga-linux.com/puppy/viewto ... 479#922479

Posted: Tue 06 Sep 2016, 18:13
by torm
<action signal="type">activity</action>
if "button-release-event" is the event
does GtkStatusbar widget support that?
Or there is no release event.. ?? it appears to accept button press event..
Maybe I'm barking at the wrong tree, dunno.. zzz :(
Or any good workaround :roll:

Posted: Tue 06 Sep 2016, 18:50
by B.K. Johnson
Post made in wrong thread - DELETED

Request for gtkdialog lint(er), formatter/pretty printer

Posted: Tue 06 Sep 2016, 19:50
by B.K. Johnson
I chose to place this request here rather than under REQUESTS. No ruffled feathers, I hope.

Is there a lint(er) a.k.a. code formatting tool; a.k.a. pretty-printer (to screen) for gtkdialog code?
I would not want one that automatically lints as I type. I think I would find that really distracting. I'd rather use a linter that processes my code after I’ve finished my work.