Gtkdialog Development

Under development: PCMCIA, wireless, etc.
Message
Author
User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#196 Post by 01micko »

...yes, we are running r220 in Slacko Beta 1,

Thanks for everything Thunor. :)
Puppy Linux Blog - contact me for access

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#197 Post by thunor »

Hi guys

Sorry about that: I needed to set the accel_group pointer to NULL after freeing it.

Fixed in r224.

Thanks Sigmund for the helpful example and yes, <togglebutton> is almost finished (actually you can create one in r224 but that's it so far) :)

Regards,
Thunor

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

#198 Post by Dougal »

taca0 wrote:Maybe this its not the best place to ask , But I want to know how I make that all the windows that I open fits on my 640x480 resolution??
What you could try is to go to /usr/bin (/usr/sbin?) and find the gtkdialog binary, rename it gtkdialog.bin, then right-click in the Rox window and select New->Script and create a script named gtkdialog.
Open the script and add to it:

Code: Select all

exec gtkdialog.bin "$*" --geometry=640x480
and see if it helps... I think Thunor fixed it to show scrollbars.
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

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

#199 Post by zigbert »

By replacing <progressbar> by <timer> in Pprocess, the pid handling become much better.


Thank you Thunor
Sigmund

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

#200 Post by zigbert »

Thunor
There is a misbehavior in the menu widget. I think (really sure) that this has arrived with 0.7.21.

The example should explain it all:

Code: Select all

#!/bin/sh

export MAIN_DIALOG='
<vbox>
  <menubar>
    <menu>
      <menuitem stock="gtk-new"></menuitem>
      <menuitem icon="gtk-new">
        <label>New - No icon if label is set manually, not from gtk-stock</label>
      </menuitem>
      <menuitem stock="gtk-open"></menuitem>
      <menuitem icon="gtk-open">
        <label>Open - YES, Icon if label is set manually, not from gtk-stock</label>
      </menuitem>
      <label>File</label>
    </menu>
  </menubar>
  <hbox>
    <button cancel></button>
    <button ok></button>
  </hbox>
</vbox>
'

gtkdialog -p MAIN_DIALOG
This happens for icon="gtk-save" and gtk-info as well. I have not checked all, but many works as expected.

A sidenote: The menubar example still uses <seperator> instead of <menuitemseperator>


Sigmund

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#201 Post by 01micko »

Hi all,

There is a backward compat issue that has surfaced.

This syntax:

Code: Select all

export DLG="<window>
	<vbox>
	 <hbox>
      <text><label>Password:</label></text>
      <entry invisible_char=\"x\" visibility=\"false\">
        <default>\"1234567890\"</default>
        <variable>VAR</variable>
       </entry>
      </hbox>
      <hbox>
        <button ok></button>
       </hbox>
      </vbox>
     </window>"
gtkdialog -p DLG
was working fine in Pupdial and Pnethood as far as I know. It formerly showed a row of x's (xxxxxxx) to blank the password, now there is no x's and no anything (no visible entry when typing, variable is fine though on exit) I guess though that is the expected result and the old way was a buggy side effect.

There is a syntax I wasn't aware of that shows dots for the password..

Code: Select all

<visible>password</visible>
.. that is backward compat, works in old Pupdial.

Code: Select all

export DLG="<window>
	<vbox>
	 <hbox>
         <text>
	  <label>Password</label>
	 </text>
	 <entry tooltip-text=\"Enter your password here\">
	    <default>\"1234567890\"</default>
	    <visible>password</visible>
	    <variable>ENCKEY</variable>
	  </entry>
      <button ok></button>
     </hbox>
    </vbox>
   </window>"
gtkdialog -p DLG
The example in the docs suggests that the behaviour of my first example is as expected.

cheers
01micko

EDIT: '<entry invisible_char=\"x\" visibility=\"false\">' in first example
Puppy Linux Blog - contact me for access

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#202 Post by thunor »

zigbert wrote:By replacing <progressbar> by <timer> in Pprocess, the pid handling become much better.
Excellent, and you're welcome.
zigbert wrote:There is a misbehavior in the menu widget. I think (really sure) that this has arrived with 0.7.21.
...
This happens for icon="gtk-save" and gtk-info as well. I have not checked all, but many works as expected.

A sidenote: The menubar example still uses <seperator> instead of <menuitemseperator>
I couldn't see anything wrong with your example. I added entries for gtk-save and gtk-info as well and took and attached a screenshot (I'm using lupu-520 with the GTK+ 2 Crux theme).

[EDIT] I use /usr/sbin/gtkdialog so I still have the /usr/sbin/gtkdialog3 0.7.20 Patriot Edition which I tried and all the icons are present except that originally menuitem theme icons from icon="imagename" were hardcoded to 20px whereas I set them to 16px (the GTK+ function that loads theme icons ultimately chooses the size from the nearest available).

Cheers, I've updated both menubar examples.

Regards,
Thunor
Attachments
zigbert-menuitem-icon-issue.png
(11.55 KiB) Downloaded 1351 times

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#203 Post by thunor »

01micko wrote:There is a backward compat issue that has surfaced.
...
It formerly showed a row of x's (xxxxxxx) to blank the password, now there is no x's and no anything...
I've found the issue :)

Firstly I should point out that both "invisible-char" and "visibility" are GTK+ properties and all that Gtkdialog does with them is pass them onto GTK+ to set.

A short while back I fixed some code that was passing variables of type guint (GTK+ unsigned integer) to GTK+ as a gchar, and this was the reason why "border-width" never worked before. Well, "invisible-char" is a guint but because the code was bugged and sending the value to GTK+ as a gchar, the value shown in the examples is "x" when it should've been "120" ;) Therefore the Gtkdialog documented "invisible-char" is wrong.

"invisible-char" isn't even required as GTK+ uses a default asterisk according to the documentation, so the visibility="false" tag attribute or the <sensitive>password</sensitive> directive should suffice.

Yes, the <sensitive>password</sensitive> directive works (I deprecated <visible> but you can still use it).

[EDIT] I've fixed my entry example and updated examples/02.01-entry_attributes.

Regards,
Thunor
Last edited by thunor on Sun 21 Aug 2011, 14:46, edited 1 time in total.

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#204 Post by rcrsn51 »

thunor wrote:(I deprecated <visible> but you can still use it).
Hopefully, that's all you plan to do with it. The Samba-TNG client tools have always used the <visible> tag to hide passwords.

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#205 Post by thunor »

rcrsn51 wrote:Hopefully, that's all you plan to do with it. The Samba-TNG client tools have always used the <visible> tag to hide passwords.
Hello rcrsn51

The <visible> directive is used to hold "enabled" or "disabled" ("password" in your case which is unique) which describes the widget's sensitive state of "true" or "false". This is equivalent to the tag attribute (GTK+ property) of sensitive="true/false" but it makes no sense whatsoever being called <visible> or holding "enabled" or "disabled" (<enabled>true/false</enabled> would be an improvement). Now, part of what I am doing is making things consistent and sensible, therefore removing <visible>enabled/disabled</visible> from the documentation and replacing it with <sensitive>true/false</sensitive> to me seems like a very sensible thing to do -- even more so when you consider that there exists a visible="false" tag attribute to hide a widget! -- but I'd have to be a complete moron to remove support for <visible> as it would break a very high percentage of every Gtkdialog application ever written.

Anyway, thanks for your positive input as I find it very helpful :)

Kindest regards,
Thunor

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

#206 Post by 8-bit »

01micko wrote:Hi all,

There is a backward compat issue that has surfaced.

This syntax:

Code: Select all

export DLG="<window>
	<vbox>
	 <hbox>
      <text><label>Password:</label></text>
      <entry invisible_char="x" visibility="false">
        <default>"1234567890"</default>
        <variable>VAR</variable>
       </entry>
      </hbox>
      <hbox>
        <button ok></button>
       </hbox>
      </vbox>
     </window>"
gtkdialog -p DLG
was working fine in Pupdial and Pnethood as far as I know. It formerly showed a row of x's (xxxxxxx) to blank the password, now there is no x's and no anything (no visible entry when typing, variable is fine though on exit) I guess though that is the expected result and the old way was a buggy side effect.

There is a syntax I wasn't aware of that shows dots for the password..

Code: Select all

<visible>password</visible>
.. that is backward compat, works in old Pupdial.

Code: Select all

export DLG="<window>
	<vbox>
	 <hbox>
         <text>
	  <label>Password</label>
	 </text>
	 <entry tooltip-text="Enter your password here">
	    <default>"1234567890"</default>
	    <visible>password</visible>
	    <variable>ENCKEY</variable>
	  </entry>
      <button ok></button>
     </hbox>
    </vbox>
   </window>"
gtkdialog -p DLG
The example in the docs suggests that the behaviour of my first example is as expected.

cheers
01micko

EDIT: '<entry invisible_char="x" visibility="false">' in first example
In your first example, it looks like it is working just like most linux login password prompts as I do not remember any ever echoing any keyboard input.

I checked both from a terminal with an added "echo $ENCKEY" to see what was passed and that was as expected.

In both examples, if the default is set to an empty string, the entry box looks a lot cleaner.
ie <default>""</default>>

The question is if using the second example for password input is being used in existing puppy applications or changes to gtkdialog break them.

Also, one might want to include the "Enter_ok" code so that if the user presses Enter after entering the password, it acts the same as clicking the OK button.

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

#207 Post by 8-bit »

I just tried to add the "Enter_OK" code and evidently it does not work with an entry window.
Too bad, unless someone can show me how it could work.

Maybe the entry widget needs to accept the Enter key as an "end_of_entry_input".
Would this cause any problems?

User avatar
Moose On The Loose
Posts: 965
Joined: Thu 24 Feb 2011, 14:54

style addition

#208 Post by Moose On The Loose »

I often have to do something like:

Code: Select all

echo 'style "specialwarning"
  {  fg[NORMAL] = { 1.0, 0, 0 } }
  widget "*warning" style "specialwarning"
  class "GtkText*" style "specialwarning"
style "specialmono"
  {  font = "mono 12" }
  widget "*mono" style "specialmono"
  class "GtkText*" style "specialmono"' >$GTK_RC_FILE
to make a style for something unusual in the dialog boxes. Doing this could be automated. I can do it by putting a wrapper script around gtkdialog that loos for the "<style>" tag and makes the file needed and then removes it again after the dialog is closed. This could also be built into the gtkdialog.

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#209 Post by thunor »

8-bit: invisible_char="x" is an error in the original Gtkdialog documentation but it worked because the Gtkdialog C code that passed "x" to GTK+ to set was bugged. In fact ALL guint GTK+ properties would've been affected by this bug, but I don't think that there are many of them.

Fixed code and bug: http://code.google.com/p/gtkdialog/sour ... 4&r=194#95

Nothing within the second example is being changed to break anything. <visible>password</visible> has always worked and will always work.

When you say "Enter_OK code", are you describing pressing the Enter key within an entry widget to activate a default OK button? If so the very first entry widget in the entry example does exactly this. I've also connected-up the "activate" signal so that it is emitted when pressing Enter within the widget which can be used to do anything you wish. I recommend that you play with the example.

Regards,
Thunor

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

#210 Post by 8-bit »

Thank you thunor,
With your latest example in hand, I figured out the problem.
Sometimes it takes looking at an example from someone that knows how it all works for a blind man to see the light!

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#211 Post by thunor »

Added togglebutton widget

The widget reference is available here.

This widget uses the exact same code (same functions in fact) as the button widget with the following changes:
  • <default>true/false<default> will set the default active state
  • <input>command</input> will set the default active state and again on refresh
  • <action>if true function:parameter</action> conditional action function execution is supported
  • The widget's variable will contain "true" (pressed-in) or "false" (normal)
  • The default signal is "toggled"
  • The save action function will save "true" or "false" to an outputfile
<togglebutton> widget example (attached images required):

Code: Select all

#!/bin/sh

# NOTE: This example requires at least gtkdialog-0.7.21 (please visit
# http://code.google.com/p/gtkdialog/). Additionally if you are using
# Puppy Linux then you may find that an historical version of gtkdialog
# already exists in /usr/sbin, and if that is the case then you should
# modify the shell variable below to point to the new gtkdialog binary.

GTKDIALOG=gtkdialog

ln -sf true.svg tgb0.svg; ln -sf false.svg tgb1.svg

export MAIN_DIALOG='
<window title="tgbToggleButton" resizable="false" border-width="0">
	<vbox>
		<menubar>
			<menu use-underline="true">
				<menuitem stock-id="gtk-quit" accel-key="0x51" accel-mods="4">
					<action>exit:Quit</action>
				</menuitem>
				<label>"_File"</label>
				<variable>mnuFile</variable>
				<sensitive>false</sensitive>
			</menu>
		</menubar>
		<vbox border-width="20" spacing="20">
			<hbox>
				<togglebutton>
					<default>true</default>
					<label>Toggle</label>
					<variable>tgb0</variable>
					<input file>tgb0.svg</input>
					<action>ln -sf $tgb0.svg tgb0.svg</action>
					<action>refresh:tgb0</action>
					<action>save:tgb0</action>
					<action>refresh:ent0</action>
					<output file>outputfile</output>
				</togglebutton>
				<entry>
					<default>true</default>
					<variable>ent0</variable>
					<input>echo $tgb0</input>
				</entry>
			</hbox>
			<hseparator></hseparator>
			<hbox homogeneous="true">
				<togglebutton>
					<variable>tgb1</variable>
					<height>128</height>
					<width>128</width>
					<input file>tgb1.svg</input>
					<action>ln -sf $tgb1.svg tgb1.svg</action>
					<action>refresh:tgb1</action>
					<action>if true enable:mnuFile</action>
					<action>if false disable:mnuFile</action>
				</togglebutton>
			</hbox>
		</vbox>
	</vbox>
	<action signal="hide">exit:Exit</action>
</window>
'

$GTKDIALOG --center --program=MAIN_DIALOG
Regards,
Thunor
Attachments
true-false.svg.tar.gz
Two SVG images from the Elementary Icons
(1.25 KiB) Downloaded 530 times
Last edited by thunor on Sat 27 Aug 2011, 22:43, edited 1 time in total.

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

#212 Post by zigbert »

More info about the menu-icon issue
I am not sure if this issue should be targeted here, so I will post a link in the Slacko thread as well.

The problem is that icons in the menu shows well in Puppy 5 but not in Slacko. This only happens to some of the builtin icons (like gtk-new, gtk-save, gtk-information). My first thought was that this has to be an gtk issue in Slacko (Puppy 5.xx uses gtk 2.20, Slacko uses gtk 2.24), but programs like Abiword, Gnumeric and Geany does not have this problem with their icons NOT taken from the gtk-stock. It _seems_ to only happen for gtkdialog apps.

In Slacko the Pmusic menu looks like this (gtkdialog-rev224).
Image

In Puppy 511, it appears like it is meant to be (same gtkdialog).
Image

This might be related to an old gtkdialog behavior I have wondered about. Why menuitems does not support gtk-undo, gtk-redo (together with other icons) else using the gtk-stock. That means <menuitem icon="gtk-undo"> fails but setting <menuitem stock="gtk-undo"> will work - but now you are not allowed to give it another label than the stock-label. Even more strange is it that gtk-media-stop works with both icon and stock setting, while gtk-media-play only works with the stock.


Sigmund

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#213 Post by 01micko »

Hi zigbert, thunor

just some info on Slacko, may or may not be relevant.

*Slacko uses gtk+-2.24.4 version [pkgname: gtk+2-2.24.4-i486-1.txz]

*source and patches

*some icons in gnome-mplayer don't work, so maybe there is a clue there (I suspect other apps too)

*Slackware sources are nearly always patched, they don't care about looks, stability is paramount.

Hope this helps
Puppy Linux Blog - contact me for access

User avatar
ttuuxxx
Posts: 11171
Joined: Sat 05 May 2007, 10:00
Location: Ontario Canada,Sydney Australia
Contact:

#214 Post by ttuuxxx »

hi guys on 2.14X the next version will have gtk+-2.24.5, I just compiled so I installed pmusic and well I only had a total of 4 icons for all three menus combined. But Firefox 6.0 had the regular amount, but pburn had all the menu icons. ?? looks more like a pmusic issue, than gtk2+
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games :)

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#215 Post by thunor »

Overhauled the fileselect action function
  • The existing accept="filename/savefilename/directory/newdirectory" custom tag attribute has been deprecated in favour of fs-action="file/newfile/folder/newfolder" which better represents the file chooser dialog actions.
  • Added fs-folder="/path/to/current/folder" custom tag attribute.
  • Added fs-filters="pattern|pattern|..." custom tag attribute.
  • Added fs-filters-mime="mime/type|mime/type|..." custom tag attribute.
  • Added fs-title="File Chooser Dialog Title" custom tag attribute.
Note that this is not the <chooser> widget, it is the fileselect action function type as used in <action>fileselect:ENTRY1</action> and within Gtkdialog they are both seperate entities.

Note too that fs-action="newfolder" (accept="newdirectory") is temperamental and the file chooser dialog will hang if you select nothing other than "OK", and for example going back a level and not selecting a folder and then selecting "OK" will return NULL and therefore not update the entry widget. Since this particular file chooser action only wants the user to create a new folder then fs-action="folder" (accept="directory") will suffice as there's a "Create" folder button anyway.

I did notice that the target widget's <label> directive can be used for the file chooser dialog's title which can be seen in the 16.00-fileselect example, but I'm not sure if this is widely known. Anyway, "fs-title" can be used now which will be documented.

Code: Select all

#!/bin/sh

# NOTE: This example requires at least gtkdialog-0.7.21 (please visit
# http://code.google.com/p/gtkdialog/). Additionally if you are using
# Puppy Linux then you may find that an historical version of gtkdialog
# already exists in /usr/sbin, and if that is the case then you should
# modify the shell variable below to point to the new gtkdialog binary.

GTKDIALOG=gtkdialog

function funcbtnCreate() {
	echo '<button>
			<input file stock="gtk-'$2'"></input>
			<action>fileselect:ent'$1'</action>
		</button>'
}

export MAIN_DIALOG='
<window title="Fileselect" resizable="false" width-request="500">
	<vbox>
		<vbox border-width="20" spacing="10">
			<hbox>
				<text label="All defaults" width-request="80"></text>
				<entry>
					<variable>ent0</variable>
				</entry>
				'"$(funcbtnCreate 0 new)"'
			</hbox>
			<hseparator></hseparator>
			<hbox>
				<text label="file" width-request="80"></text>
				<entry fs-action="file" fs-folder="/usr/share/doc"
					fs-filters="*.txt|*.html"
					fs-title="Select an existing file">
					<variable>ent1</variable>
				</entry>
				'"$(funcbtnCreate 1 new)"'
			</hbox>
			<hseparator></hseparator>
			<hbox>
				<text label="newfile" width-request="80"></text>
				<entry fs-action="newfile" fs-folder="'$HOME'"
					fs-filters-mime="text/plain|text/html"
					fs-title="Select an existing file or type in a new filename">
					<variable>ent2</variable>
				</entry>
				'"$(funcbtnCreate 2 new)"'
			</hbox>
			<hseparator></hseparator>
			<hbox>
				<text label="folder" width-request="80"></text>
				<entry fs-title="Select an existing folder" fs-action="folder">
					<variable>ent3</variable>
				</entry>
				'"$(funcbtnCreate 3 open)"'
			</hbox>
			<hseparator></hseparator>
			<hbox>
				<text label="newfolder" width-request="80"></text>
				<entry fs-action="newfolder"
					fs-title="Select an existing folder or type in a new folder name">
					<default>This fileselect action type is temperamental</default>
					<variable>ent4</variable>
				</entry>
				'"$(funcbtnCreate 4 open)"'
			</hbox>
		</vbox>
		<hseparator></hseparator>
		<hbox homogeneous="true">
			<button ok></button>
		</hbox>
	</vbox>
	<action signal="hide">exit:Exit</action>
</window>
'

$GTKDIALOG --center --program=MAIN_DIALOG
Regards,
Thunor

Post Reply