Gtkdialog Development

Under development: PCMCIA, wireless, etc.
Message
Author
User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#811 Post by don570 »

When you create a button to do an action you can also
set how the exit variable is set. For instance
<action>exit:EXIT</action> sets the exit variable to "EXIT"
When you run your script in the terminal the variable is printed.
(a nice feature of terminal 8) )

Code: Select all

funcbtnType0Create3() { 
   echo '<button image-position="'$1'" use-stock="true"   tooltip-text="'$(gettext 'Relaunch Bulldog Finder')'"> 
         <input file stock="gtk-ok"></input> 
         <label>"'$(gettext 'Relaunch')'"</label> 
          <action>bulldog-finder "$FPATH" &</action> 
          <action>exit:EXIT</action> 
        </button>'
Then after gtkdialog has run you can put a line that can
decide what is done next . Here's an example in my bulldog-finder
program.

Code: Select all

for STATEMENTS in  $($GTKDIALOG -c -p SETTINGS); do
  eval $STATEMENTS
done
IFS=$I

if [ "$EXIT" = "EXIT" ] || [ "$EXIT" = "abort" ];then  # delete temp
rm -rf $TEMPDIR
exit 0
fi
In my example I do a deletion , in your case you would want to launch
gtkdialog again

simargl7

#812 Post by simargl7 »

Will there be stable Gtk3 based version soon?

In Gtk 3.10 icons from menus are removed without option for user to enable them, Gtk.Stock is deprecated. Icons on menus and buttons must be explicitly added by application's developer.

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#813 Post by don570 »

Thunor has looked into a GTK3 version but he
doesn't seem to feel there's a high priority.

________________________________________-

jfi
Posts: 1
Joined: Fri 15 Nov 2013, 21:22

memory leak?

#814 Post by jfi »

Am I doing this wrong or is there a memory leak in gtkdialog?

I ran a gtkdialog script that I'm working on for a day. After about 8 hours it ran out of RAM (there wasn't very much available to start with). The script was sitting idle all day only updating clock display twice a second so I tried removing the clock. Gtkdialog process stopped growing.

Then I narrowed it down to this script that just updates date and time:

Code: Select all

    #!/bin/bash
     
    GTKDIALOG=gtkdialog
     
    MAIN_DIALOG='
    <window title="memory leak test">
      <vbox>
        <text use-markup="true">
          <variable>TIMEDISPLAY</variable>
            <input>date +%H:%M:%S</input>
        </text>
        <text>
            <variable>DATEDISPLAY</variable>
            <input>date +%A\ %-d.%m.%Y</input>
        </text>
        <timer milliseconds="true" interval="50" visible="false">
          <action>clear:TIMEDISPLAY</action>
          <action>refresh:TIMEDISPLAY</action>
          <action>clear:DATEDISPLAY</action>
          <action>refresh:DATEDISPLAY</action>
        </timer>
      </vbox>
    </window>
    '
     
    export MAIN_DIALOG
    $GTKDIALOG --program=MAIN_DIALOG
and watched it grow:

Code: Select all

chmod u+x leaktest
./leaktest&
while [ 1 ]; do date; ps -C "gtkdialog" u; sleep 10; done

I tried this under Ubuntu 10.04 Lucid Lynx (x86_64 desktop) and an A13-OLinuXino-WIFI board running Debian Wheezy (armhf). Bash versions are 4.1.5 for the desktop and 4.2.20 for the arm board.
I tried gtkdialog 0.8.3 tarball on both platforms and on desktop I also tried svn rev 514. All kept growing.

P.S. Those "clear" actions were added for testing, it leaks without them as well. The timer was originally 500 ms, I sped it up to maybe get it to leak more.

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#815 Post by don570 »

Additional info: Thunor did a timer example. The shell may be important.
Thunor used the bash 3.0 shell.

Ubuntu uses dash.

http://code.google.com/p/gtkdialog/sour ... n493&r=493

________________________________________

brokenman
Posts: 25
Joined: Thu 20 Oct 2011, 23:00

hide and show

#816 Post by brokenman »

I am trying to hide a button on a 'notebook' page when the page is shown. The page has the an entry widget and radiobutton widgets (as well as the button). I can't seem to get the button to hide using signal="show" for any widgets. It hides OK if i put the action into a radiobutton 'if true' action.

Any ideas how I can realize this?

PS: Is there a donation system for gtkdialog?

Code: Select all

<vbox margin="10">
	<hbox>
		<text><label>Select a file: </label></text>
		<entry fs-action="file" editable="false" block-function-signals="true">
			<variable>SELPKG</variable>
		</entry>
		<button>
			<label>Select</label>
			<action function="fileselect">SELPKG</action>
			<action>echo $SELPKG</action>
		</button>
	</hbox>
	<radiobutton>
		<label>Example</label>
	</radiobutton>
	<button>
		<label>Vanish</label>
		<variable>butDownload</variable>
	</button>
</vbox>
Last edited by brokenman on Wed 12 Feb 2014, 13:06, edited 1 time in total.

User avatar
dejan555
Posts: 2798
Joined: Sun 30 Nov 2008, 11:57
Location: Montenegro
Contact:

#817 Post by dejan555 »

Did you try: <button visible="false"> ?
puppy.b0x.me stuff mirrored [url=https://drive.google.com/open?id=0B_Mb589v0iCXNnhSZWRwd3R2UWs]HERE[/url] or [url=http://archive.org/details/Puppy_Linux_puppy.b0x.me_mirror]HERE[/url]

brokenman
Posts: 25
Joined: Thu 20 Oct 2011, 23:00

#818 Post by brokenman »

I want the button to be visible until a certain 'notebook' page is shown. So what I need is something similar to an "onshow" parameter for one of the widgets. When the widget is shown, the button vanishes. The original state of the button should be visible so this attribute is no good for me. Thanks.

Essentially I would like the button in the above code to be invisible when the script is run, but done so without using anything within the button widget itself.

brokenman
Posts: 25
Joined: Thu 20 Oct 2011, 23:00

#819 Post by brokenman »

Ok I got it. Since the button I want to vanish is created after the other widgets, they can't do what I want since the button doesn't exist at the point when they are created. I need to have a widget somewhere in the code AFTER the button I want to vanish. Makes sense.

Code: Select all

<vbox margin="10">
	<hbox>
		<text><label>Select a file: </label></text>
		<entry fs-action="file" editable="false" block-function-signals="true">
			<variable>SELPKG</variable>
		</entry>
		<button>
			<label>Select</label>
			<action function="fileselect">SELPKG</action>
			<action>echo $SELPKG</action>
		</button>
	</hbox>
	<radiobutton>
		<label>Example</label>
		<action>if true show:butDownload</action>
	</radiobutton>
	<radiobutton>
		<label>Example2</label>
		<action>if true hide:butDownload</action>
	</radiobutton>
	<button visible="true">
		<label>Vanish</label>
		<variable>butDownload</variable>
	</button>
<statusbar has-resize-grip="false">
	<variable>stb0</variable>
	<input>echo statusbar</input>
	<action signal="show">hide:butDownload</action>
</statusbar>
</vbox>

User avatar
dejan555
Posts: 2798
Joined: Sun 30 Nov 2008, 11:57
Location: Montenegro
Contact:

#820 Post by dejan555 »

Not sure if I understand but why not put it inside one frame of notebook if that's only where it should be shown instead after notebook code?
puppy.b0x.me stuff mirrored [url=https://drive.google.com/open?id=0B_Mb589v0iCXNnhSZWRwd3R2UWs]HERE[/url] or [url=http://archive.org/details/Puppy_Linux_puppy.b0x.me_mirror]HERE[/url]

brokenman
Posts: 25
Joined: Thu 20 Oct 2011, 23:00

#821 Post by brokenman »

I should have explained more clearly, sorry. There is a set of buttons at the bottom of the application. They are static and exist to move from one notebook page to the next. Like a back button. While the notebook pages may change, these buttons stay where they are all the time.

For this reason they are the last widgets to be drawn (last in the code) and as such I believe the widgets above this can not affect them with a signal="show" action. I have found a solution in any case. Thanks.

BTW, I would still like to know about any donation options Thunor. I get a lot of mileage out of gtkdialog. Many thanks for your work.

tele1234567891
Posts: 13
Joined: Sat 15 Nov 2014, 20:53

#822 Post by tele1234567891 »

Hi!
1. I have problem with gtkdialog apps,
Because when I
open gtkdialog app running (
( I click button and this doing long script)
, I see this app
then I open on full screen for example firefox
and gtkdialog app is empty.
When gdtkdialog app finished script, I see all good

Is the same problem on Puppy Linux?
I use PCLinuxOS 64bit Mate.

2. I have problems with buttons,
http://murga-linux.com/puppy/viewtopic. ... 856#862856
files v5

When I paste

Code: Select all

			<action>FuncAskInstall</action>
buttons not working correct after click,
when I removed function buttons working good.

Code: Select all

			<button sensitive="'"$SensitiveKdeInstall"'">
				<label>Kde  Install</label>
				<variable>KdeInststall</variable>
				<input file icon="bottom"></input>
				<action>echo "You pressed button Kde Install"</action>
				<action>GRAPHIC=KDE; ACTION=Install; echo -e "$GRAPHIC\n$ACTION" > /tmp/gdi/action</action>
				<action>FuncAskInstall</action>
				<action function="'Disable'">'KdeInstall'</action>
				<action function="'Enable'">'KdeUninstall'</action>
				<action>ln -sf `pwd`/green_ball.png "$TMPDIR"/StateBallKde.png</action>
				<action function="refresh">BallKde</action>
			</button>
			<button sensitive="'"$SensitiveKdeUninstall"'">
				<label>Kde  Uninstall</label>
				<variable>KdeUninstall</variable>
				<input file icon="editdelete"></input>
				<action>echo "You pressed button Kde Uninstall."</action>
				<action>GRAPHIC=KDE; ACTION=Uninstall; echo -e "$GRAPHIC\n$ACTION" > /tmp/gdi/action</action>
				<action>FuncAskUninstall</action>
				<action function="'Enable'">'KdeInstall'</action>
				<action function="'Disable'">'KdeUninstall'</action>
				<action>ln -sf `pwd`/red_ball.png "$TMPDIR"/StateBallKde.png</action>
				<action function="refresh">BallKde</action>
			</button>
3. I have problems with variables
from above code FuncAskUninstall and FuncAskUninstall
there are files funtions,
this functions open window with warning ( window is in next file )

Code: Select all

$ ls
functions    gdi.png         test1.png             WarningRoot*
gdi*         green_ball.png  WarningAskInstall*    WindowAbout*
gdi.desktop  red_ball.png    WarningAskUninstall*
Like this I created app:
click gdi button install -->function --> "WarningAskInstall" click Yes--> function

and when I added "WarningAskInstall" I can not export variable from button to function (or from functions file)
So I saved variables to file, and I skipped problem.

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#823 Post by don570 »

I would check if your function FuncAskInstall is working correctly and is defined .

Replace the code in the function with something simple

Code: Select all

xmessage  here
as a test.

____________________________

TecnoGuy458
Posts: 123
Joined: Mon 26 Jan 2015, 20:38
Location: Ohio

want to stretch the width of a pixmap...

#824 Post by TecnoGuy458 »

I need to stretch a pixmap to the width of the dialog automatically.

reason: im making a little piano app in gtkdialog and would like the key number bar image i made to stretch to the size of the dialog. (automatically)

is this do-able and if so, how?

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#825 Post by don570 »

I'm not sure. It's normally the inverse i.e. the window will automatically
resize to fit the widgets properly.

Here are three examples to study
http://gtkdialog.googlecode.com/svn/tru ... es/pixmap/


______________________________________________

TecnoGuy458
Posts: 123
Joined: Mon 26 Jan 2015, 20:38
Location: Ohio

want to stretch the width of a pixmap...

#826 Post by TecnoGuy458 »

its just the buttons that are the keys often vary in size. oh well, i guess the number bar can still serve as a visual aid of sorts.

you see the number bar is above the keys. it shows the key numbers in order. the technical side of things work. the 21-40 piano keys and 4 piece percussion all work.

EDIT: those examples didn't help the number bar issue, but i was able to get the "piano keys" to scale up when you enlarge the window!

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#827 Post by don570 »

A trick I often use is to center a button in a column

Code: Select all

<hbox homogeneous="true">
<hbox>
<button>
				<text><label>"mtpaint"</label></text>
                             <action>mtpaint</action>
</button>
</hbox></hbox>

http://gtkdialog.googlecode.com/svn/tru ... _alignment

____________________________________________


...and a column width can be controlled by a width request

Code: Select all

<vbox  width-request="500">
...
...
...
</vbox>

http://gtkdialog.googlecode.com/svn/tru ... scrollable

TecnoGuy458
Posts: 123
Joined: Mon 26 Jan 2015, 20:38
Location: Ohio

worked around it.

#828 Post by TecnoGuy458 »

ended up splitting the number bar into icons. which worked.

EDIT: its now finished, PET can be found here:
http://murga-linux.com/puppy/viewtopic.php?t=101714

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#829 Post by don570 »

Here's a change I suggest for the about button...

Code: Select all

[url]<window title="Thomas Virtual Piano -about" image-name="Thomas-Virtual-Piano.png"  resizable="false">[/url]

resizable="false" ---> fixes strange resizing of window in some cases

_____________________________________________________

It would be cool if pressing the keyboard keys worked as well
but that might take some C programming.

___________________________________________

Putting the version number in the window title is good practice..
I first start my scripts by defining VERSION

Code: Select all

VERSION=1.3
then I can use it latter in script

______________________________________________

If you want to make the window color stand out
Here is an example pupmemo that is simple to understand

http://www.murga-linux.com/puppy/viewto ... 09d2fd2cae

___________________________________________

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

#830 Post by mcewanw »

With the recent news that Roxterm is not going to be further developed owing to major issues getting to working with gtk3, I was wondering if gtkdialog is still being developed such that it is gtk3 compatible?

I imagine, gtk2 will mainly vanish from our systems one day in the not-so-distant future, just as gtk1 did previously.

William
github mcewanw

Post Reply