GtkDialog - tips
-
- Posts: 807
- Joined: Mon 12 Oct 2009, 17:11
@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?
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?
[color=blue]B.K. Johnson
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]
http://smokey01.com/help/yad-tips-0.0.1.ncd.tar.xzWhat's the definitive link for yad commands.
-
- Posts: 807
- Joined: Mon 12 Oct 2009, 17:11
In the terminal type either of these.B.K. Johnson wrote: I did not see "timeout" and "no-buttons" anywhere I looked?
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
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
[b]Carolina:[/b] [url=http://smokey01.com/carolina/pages/recent-repo.html]Recent Repository Additions[/url]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]
-
- Posts: 807
- Joined: Mon 12 Oct 2009, 17:11
That is just wonderful Geoffrey.
Greatly appreciated.
Greatly appreciated.
[color=blue]B.K. Johnson
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]
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.
Thanks
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
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
This should do it: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.
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
I noticed that you use window-position="3" resizeable="true". AFAIK you can't resize a centered gtkdialog.
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
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.smokey01 wrote:That's great MochiMoppel but it's hiding the image and not the frame.
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 “resizableI want the GUI to shrink when there's no image
MochiMoppel wrote: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.smokey01 wrote:That's great MochiMoppel but it's hiding the image and not the frame.
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 “resizableI want the GUI to shrink when there's no image
-
- Posts: 807
- Joined: Mon 12 Oct 2009, 17:11
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
The timeout=TIMEOUT command seems to have the bizarre behaviour of wiping out the text in msgbox or text. Can someone confirm, please?
Thanks
[color=blue]B.K. Johnson
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]
This is yad?, could you give an example of how the text is read.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
Maybe it would be better to move the discussion to the YAD - Tips
[b]Carolina:[/b] [url=http://smokey01.com/carolina/pages/recent-repo.html]Recent Repository Additions[/url]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]
-
- Posts: 807
- Joined: Mon 12 Oct 2009, 17:11
Sure Geoffery
This is a slight modification of your earlier post.
The text is not displayed.
Remove the timeout and it is shown.
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"
Remove the timeout and it is shown.
[color=blue]B.K. Johnson
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]
@B.K. Johnson,
See http://murga-linux.com/puppy/viewtopic. ... 499#918499
See http://murga-linux.com/puppy/viewtopic. ... 499#918499
[b]Carolina:[/b] [url=http://smokey01.com/carolina/pages/recent-repo.html]Recent Repository Additions[/url]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
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.
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.
- Attachments
-
- window_resizable_true_false.png
- (106.77 KiB) Downloaded 720 times
[SOLVED]
Fixed by @MochiMoppel - thank you - http://www.murga-linux.com/puppy/viewto ... 479#922479
Last edited by peebee on Thu 08 Sep 2016, 15:45, edited 1 time in total.
LxPup = Puppy + LXDE
Main version used daily: LxPupSc; Assembler of UPups, ScPup & ScPup64, LxPup, LxPupSc & LxPupSc64
Main version used daily: LxPupSc; Assembler of UPups, ScPup & ScPup64, LxPup, LxPupSc & LxPupSc64
-
- Posts: 807
- Joined: Mon 12 Oct 2009, 17:11
-
- Posts: 807
- Joined: Mon 12 Oct 2009, 17:11
Request for gtkdialog lint(er), formatter/pretty printer
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.
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.
[color=blue]B.K. Johnson
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]