GtkDialog - tips

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
step
Posts: 1349
Joined: Fri 04 May 2012, 11:20

#1096 Post by step »

zigbert wrote:block-function-signals was introduced after my request. See
http://www.murga-linux.com/puppy/viewto ... 704#544704
So, based on this, my understanding is that the motivation for using block-function-signals is function and not performance. Set it true to fence off actions that do not correspond to manual user changes. For example set it true if you want to trigger the skip forward/backward action only when a user changes the slider value (by dragging it) and for no other reason. Hopefully I'm getting it right.
[url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Fatdog64-810[/url]|[url=http://goo.gl/hqZtiB]+Packages[/url]|[url=http://goo.gl/6dbEzT]Kodi[/url]|[url=http://goo.gl/JQC4Vz]gtkmenuplus[/url]

User avatar
recobayu
Posts: 387
Joined: Wed 15 Sep 2010, 22:48
Location: indonesia

#1097 Post by recobayu »

Can we cange label based on entry? I mean when we change text on entry, the label change directly live perform.

User avatar
trio
Posts: 2076
Joined: Sun 21 Dec 2008, 15:50
Location: अनà¥￾मोदना

#1098 Post by trio »

recobayu wrote:Can we cange label based on entry? I mean when we change text on entry, the label change directly live perform.
edit: ini mgkn yg anda mau

Code: Select all

#!/bin/bash -a

function echotext ()
{
echo "$NEWTEXT" > /tmp/text.txt
}
echo "OLD TEXT" > /tmp/text.txt 
export GUI="
<window title="Auto" icon-name="gtk-edit">
<vbox>
	<timer milliseconds="true" interval="200" visible="false">
      <action type="refresh">TEXT</action>
      <action type="refresh">NEWTEXT</action>
      </timer>
	<text>
	<input>cat /tmp/text.txt</input><variable>TEXT</variable>
	</text>
		<entry>
		<variable>"NEWTEXT"</variable>
		<action>echotext &</action>
		</entry>
</vbox>
</window>"		
gtkdialog --program=GUI
lihat widget timer nya ... selamat mencoba

User avatar
recobayu
Posts: 387
Joined: Wed 15 Sep 2010, 22:48
Location: indonesia

#1099 Post by recobayu »

Terima kasih mas Trio..
Saya nyoba sendiri bisa ternyata. Alhamdulillah..

Code: Select all

#!/bin/sh
echo > labelku
export a='<window>
<vbox>
 <entry>
  <action signal="changed">echo $e > labelku</action>
  <action signal="changed">refresh:t</action>
  <variable>e</variable>
 </entry>
 
  <text>
   <input file>labelku</input>
   <variable>t</variable>
  </text>
</vbox> 
</window>'
gtkdialog -p a
Lebih cepet malahan.. :D

User avatar
trio
Posts: 2076
Joined: Sun 21 Dec 2008, 15:50
Location: अनà¥￾मोदना

#1100 Post by trio »

Mantap

Code: Select all

<action signal="changed">

jlst

#1101 Post by jlst »

how do i make a dialog show maximized?

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#1102 Post by zigbert »

I don't know how to do this in GTK, but there is a workaround setting a JWM class

from the first post:
---------------------------------------------------------------
Override JWM-settings - skip taskbar, sticky, layer, border
This is how to override default settings in your JWM configuration.

Your gtkdialog gui must be called with the --class parameter

Code: Select all

gtkdialog --class=APPLET -f myfile
Then this code must be in your jwm configuration file - $HOME/.jwmrc (to be set permanently, it must be added to /etc/xdg/templates/_root_.jwmrc)

Code: Select all

<Group>
 <Class>APPLET</Class>
 <Option>nolist</Option>
 <Option>sticky</Option>
 <Option>noborder</Option>
 <Option>layer:12</Option>
</Group>
>> The option 'nolist' does avoid your app showing up in the taskbar.
>> The option 'sticky' shows your app on all desktops.
>> The option 'noborder' is equal to the gtkdialog attribute <window decorated="false">.
>> The option 'layer:x' defines if other windows should cover your app, or if it should be on top. layers can be 0-12 where 12 is the on-top setting.

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#1103 Post by MochiMoppel »

jlst wrote:how do i make a dialog show maximized?
Unlike yad gtkdialog doesn't seem to have a way to set a window to maximized state, but you could use gtkdialog's geometry option -G to achieve almost the same effect:
  • #! /bin/sh
    XWININFO=$(xwininfo -root)
    GEOMETRY=${XWININFO#*-geometry }
    echo '
    <window allow-shrink="true">
    <text label="Dialog set to geometry '$GEOMETRY'" space-expand="true"></text>
    </window>'|gtkdialog -G $GEOMETRY -s


Above example uses the command xwininfo -root to read the geometry of the root window, which happens to be the maximum window size. The window manager honors this size - minus the size it may need for its tray. The result should be visually the same as a maximized window.

The geometry option actually sets the minimum size, i.e. the user can't resize the window smaller. Use the allow-shrink="true" option if you need unrestricted resizing.

B.K. Johnson
Posts: 807
Joined: Mon 12 Oct 2009, 17:11

#1104 Post by B.K. Johnson »

Hi all
How do I create a dialogbox with gtkdialog or yad or zenity which displays text, but shows neither Cancel nor OK button, and with a timeout so that the box vanishes after a specified timeout interval?
[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]

jlst

#1105 Post by jlst »

thanks for the advice. for such a complex and complete gtk gui... this is outrageous

gtkdialog has the --center option. well, center, maximized... i guess these are gtk window properties. i mean this could be implemented replicating the --center option, changing one line perhaps..

i remember asking the yad developer to add the --no-escape option to make yad dialogs behave gtkdialog, and basically the opposite can be applied to gtkdialog.

there are patches for everything somewhere, i actually found one that was submitted like 2-3 years before it got applied!
https://sourceforge.net/p/yad-dialog/tickets/253/

Sailor Enceladus
Posts: 1543
Joined: Mon 22 Feb 2016, 19:43

#1106 Post by Sailor Enceladus »

B.K. Johnson wrote:Hi all
How do I create a dialogbox with gtkdialog or yad or zenity which displays text, but shows neither Cancel nor OK button, and with a timeout so that the box vanishes after a specified timeout interval?
In Puppy I see they use yaf-splash a lot for those, but maybe that's not what you want?

Code: Select all

yaf-splash -bg pink -placement top -close never -timeout 5 -text "This message will self-destruct in 5 seconds"

B.K. Johnson
Posts: 807
Joined: Mon 12 Oct 2009, 17:11

#1107 Post by B.K. Johnson »

@Sailor Enceladus
Thanks for responding.
You are correct that I don't want this:

Code: Select all

yaf-splash -bg pink -placement top -timeout 5 -text "This message will self-destruct in 5 seconds
[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]

User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

#1108 Post by Geoffrey »

B.K. Johnson wrote:Hi all
How do I create a dialogbox with gtkdialog or yad or zenity which displays text, but shows neither Cancel nor OK button, and with a timeout so that the box vanishes after a specified timeout interval?
This works as a message box.

Code: Select all

yad --title="Yad Message Box" --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"
Last edited by Geoffrey on Sun 14 Aug 2016, 06:56, edited 1 time in total.
[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]

mcewanw
Posts: 3169
Joined: Thu 16 Aug 2007, 10:48
Contact:

#1109 Post by mcewanw »

You can create a splash in gtkdialog by using a progress bar - just put a sleep inside that and after force the progress bar to complete to its 100 total. Sorry, I don't have the exact code at my fingertips just now. The progress bar itself can be constructed with <invisible> tags or something like that.

EDIT: Actually, just noted that zigbert gives a splash screen example in his first post of this thread - near the end of his post.

William
github mcewanw

User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

#1110 Post by Geoffrey »

This works for gtkdialog, Ah it does skip the taskbar using skip_taskbar_hint="true"

Code: Select all

#! /bin/bash
TEXT="<big><b>
This is a gtkdialog message box
</b></big>"

export Message_Box='	
<window title="Message Box" icon-name="gtk-dialog-info" resizable="false" skip_taskbar_hint="true">
<vbox>
<text wrap="false" xalign="0" use-markup="true">
			<label>"'$TEXT'"</label>
			</text>
</vbox>
<timer seconds="true" interval="5" visible="false">
    <action>EXIT:exit</action>
    </timer>
</window>'
gtkdialog --program=Message_Box
[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]

B.K. Johnson
Posts: 807
Joined: Mon 12 Oct 2009, 17:11

#1111 Post 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?
[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]

Wognath
Posts: 423
Joined: Sun 19 Apr 2009, 17:23

#1112 Post by Wognath »

What's the definitive link for yad commands.
http://smokey01.com/help/yad-tips-0.0.1.ncd.tar.xz

B.K. Johnson
Posts: 807
Joined: Mon 12 Oct 2009, 17:11

#1113 Post by B.K. Johnson »

@Wognath
Thanks for the link.
[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]

User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

#1114 Post 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
[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]

B.K. Johnson
Posts: 807
Joined: Mon 12 Oct 2009, 17:11

#1115 Post by B.K. Johnson »

That is just wonderful Geoffrey.
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]

Post Reply