Page 39 of 76

Posted: Thu 04 Apr 2013, 21:34
by SFR
Tasty stuff. :)
Here are Gtkdialog versions, but indeed, they're quite heavy, so on weaker CPUs there may be need to increase 'interval' value.

Thanks & Greetings!

Posted: Thu 04 Apr 2013, 22:06
by vovchik
Dear SFR,

Very nice. I had to increase the interval from:

Code: Select all

interval="60"
to

Code: Select all

interval="120"
in spiral_4.sh (line 1203) to get my old beater of a computer to respond. It now shows the animated SVG nicely. :)

With kind regards,
vovchik

script to explain comboboxtext widget

Posted: Tue 09 Apr 2013, 00:20
by don570
Script to explain comboboxtext widget

I wanted a simpler explanation for the comboboxtext widget
so I wrote this script to show a simple implementation.
Two different methods are shown. The first shows a menu
composed of 'items'. The second has the menu composed from
a list stored in a file on your hard drive.


Image

-------------------------------------------------------------------

Posted: Tue 09 Apr 2013, 01:59
by technosaurus
to eliminate excessive disk writes you can use the ram based file systems on /dev/shm or /tmp for your temporary files ... just don't forget to remove them when you are done.

Posted: Tue 09 Apr 2013, 14:07
by SFR
Hey Technosaurus

Yes, I'm using it ever since you told me about it in SelfCrypText thread.
And I prefer /dev/shm, because (AFAIK) /tmp might not be kept in RAM in case of full installs.

_______________

Hmm, windows can grow... Tested under JWM/IceWM.

Code: Select all

#!/bin/bash

# Grow! by SFR'2013
# GPLv2 applies
# Req: Gtkdialog >=0.8.0, Bash

USE_BASH=; [ "`readlink /bin/sh`" != bash ] && USE_BASH="bash -c "

export TEMPDIR=/dev/shm/grow_$$
mkdir $TEMPDIR
trap 'rm -rf $TEMPDIR' EXIT

export PIC=$TEMPDIR/pic.svg
export SIZE=$TEMPDIR/size
echo 16 > $SIZE

grow () {
S=$(<$SIZE); S=$(($S+2)); echo $S > $SIZE
[ $S -ge 512 ] && exit

echo '<svg viewBox="'$((256-($S/2)))' '$((256-($S/2)))' '$S' '$S'" xmlns="http://www.w3.org/2000/svg" version="1.1">
  <circle cx="256" cy="256" r="248" stroke="black" fill="yellow" stroke-width="10" />
  <circle cx="192" cy="160" r="24" stroke="black" fill="black" />
  <circle cx="320" cy="160" r="24" stroke="black" fill="black" />
  <path d="M 128 320 Q 256 416 384 320" stroke="black" fill="none" stroke-width="16" stroke-linecap="round" />
</svg>' > $PIC
}
export -f grow

export MAIN='
<window title="Grow! Grow! GROOOOOW!!!!!      ...ok, that'"'"'s enough...;)">
  <vbox>
    <pixmap>
      <variable>PICTURE</variable>
      <input file>'$PIC'</input>
    </pixmap>
    <timer visible="false" milliseconds="true" interval="75">
      <action>'$USE_BASH'grow</action>
      <action>refresh:PICTURE</action>
    </timer>
  </vbox>
<action signal="hide">exit:abort</action>
</window>
'

gtkdialog -cp MAIN
Have a nice day &
Greetings!

Posted: Sun 14 Apr 2013, 12:02
by hannysabbagh
Hello.

anybody knows how to get out of this? :)
http://www.murga-linux.com/puppy/viewtopic.php?t=85640

ThankS!

Hyperlinks

Posted: Tue 16 Apr 2013, 05:41
by DocSalvage
I'm working on an awk program that converts Zim pages to GtkDialogs for checklists and such so it needs to have functional hyperlinks.

I've learned that the Pango markup "<span><a>..." formats the hypertext just fine but taking action on the click is the problem. I've made it work by wrapping the GtkDialog <text> widget in its own <hbox> which is, in turn, wrapped in an <hbox > for the entire line of text. Conceptually, the code looks something like...

Code: Select all

<hbox>
  <hbox>
    <text>
      <label>"<span>non-link-text</span>"</label>
    </text>
  </hbox>
  <hbox>
    <text>
      <label>"<span><a href="...">link-text</a></span>"</label>
      <action signal="button-press-event">...</action>
    </text>
  </hbox>
  <hbox>
    <text>
      <label>"<span>non-link-text</span>"</label>
    </text>
  </hbox>
</hbox>
Very much a work in progress, but maybe this will help others trying to use hyperlinks.

One cuestion.

Posted: Thu 23 May 2013, 14:12
by mister_electronico
Why don't work this program, and how I can get work.

#! /bin/bash
export CHOOSER
export MAIN_DIALOG='
<vbox>
<chooser>
<height>500</height><width>600</width>
<variable>CHOOSER</variable>
</chooser>
<hbox>
<button help></button>
<button ok></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG
exec mplayer CHOOSER

I was searching everywhere and I can't see how choose one file and open with some application program, like this example or if I want open file by Menubar.

Thanks for any help.

Posted: Thu 23 May 2013, 15:43
by zigbert

Code: Select all

exec mplayer "$CHOOSER"

No work.

Posted: Sat 25 May 2013, 10:42
by mister_electronico
Thanks zigbert for answering but don't work.

The problem with the variable CHOOSER inside of GTKDIALOG is local variable, I not know how export variable outside of GTKDIALOG.

The only way I met is :

Code: Select all

#! /bin/bash
export MAIN_DIALOG='
<vbox>
  <chooser>
   <height>500</height><width>600</width>
   <variable>CHOOSER</variable>
  </chooser>
 <hbox>
   <button ok>
      <action>"echo $CHOOSER > /tmp/tmp"</action>
	  <action>exit:Exit</action>
   </button>
 </hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG
A=$(cat /tmp/tmp)
echo "$A"
exec mplayer $A

But I think is not very elegant.

Anyway Thanks for you reply.

Posted: Sat 25 May 2013, 11:43
by Geoffrey
Making it a function works

Code: Select all

#! /bin/bash
CHOSEN(){
mplayer $CHOOSER
}
export -f  CHOSEN
export MAIN_DIALOG='
<vbox>
  <chooser>
   <height>500</height><width>600</width>
   <variable>CHOOSER</variable>
  </chooser>
 <hbox>
   <button ok>
	  <action>CHOSEN</action>
	  <action>exit:Exit</action>
   </button>
 </hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

Works...

Posted: Sat 25 May 2013, 14:17
by mister_electronico
Amazing Geoffrey! Works.

When call to the variable trough function works.

Have a problem when you try to choose mplayer file in other partition or hard drive.

Thanks for teaching this way

Posted: Sat 25 May 2013, 15:36
by seaside
You can also do it this way-

Code: Select all

eval `gtkdialog --program=MAIN_DIALOG`


This runs the gtkdialog program between the backtics and then evaluates (sets the variables for further use)

Cheers,
s

Thanks seaside

Posted: Sat 25 May 2013, 19:07
by mister_electronico
Thanks seaside... works perfect.

I check it in the first program, and work perfect and I can open one mplayer file well, even if the file is in other partition or other hardrive.

So thanks for teaching this way too.

Good teachers in this Forum.

Multiple defaults in tree

Posted: Wed 29 May 2013, 18:06
by jmrichardson
Hello,

Does anyone know of a way set multiple defaults in the tree widget? I see a selected-row tag but that only sets a single default. Does anyone know of how to do this? Thanks in advance!

John

gtkdialog changing shell variable

Posted: Thu 06 Jun 2013, 19:25
by jmrichardson
Hello,

I have been trying to figure out how to change a bash variable value within gtkdialog. That is, I load a config file to set my variables within gtkdialog. However, i would like to change the variable value based on user input. When i change the value with an action, it doesn't change the value on exit (it stays the same). I think the action function is kicking off a sub shell, changig the variable there, then returning back to the main shell. If that is correct, any way to change the parent shell variable value without using files for storage?

Thanks,
John

Posted: Sat 08 Jun 2013, 20:25
by don570
I'm no expert but if 'export VARIABLE' doesn't work
then I use 'echo $VARIABLE > /path/to/file'

Then I reload in a new function or application.

VARIABLE=`cat /path/to/file`

or

read VARIABLE < /path/to/file

________________________________

list/tree/table with checkbox

Posted: Tue 30 Jul 2013, 04:05
by box579
Hey guys,

is there any option to have checkboxes within a gtkdialog tree/list/table? I would like to select multiple items.

Input is optained from a textfile:
monitor1|true|option1
monitor2|false|option2
monitor3|true|option3
Output is written to a textfile.

Thanks & regards,
box579.

Posted: Tue 30 Jul 2013, 15:25
by ASRI éducation
Hello !
I'm trying to create a GUI (GTK) and I need help.
I use the combobox option and I do not want the user could edit the items offered (so that he can choose only in the list of items proposed by the script).
Currently, my combobox like this:

Code: Select all

<vbox>
<text><label>Live Support</label></text>
<combobox width-request=\""$COMBOBOX_WIDTH"\" tooltip-text=\" Select the live support \">
<variable>CheckLiveSupport</variable>
$LIVE_SUPPORT_ITEMS
</combobox>
</vbox>
My question: is it possible to prevent the publishing of the items proposed by the combobox?

Cordialement,

Posted: Wed 31 Jul 2013, 09:34
by box579
Hi ASRI education,
to prevent users from editing your items use <comboboxtext> instead of <combobox>. See below, for specs read this:
http://code.google.com/p/gtkdialog/wiki/comboboxtext

Code: Select all

<vbox>
<text><label>Live Support</label></text>
<comboboxtext width-request=\""$COMBOBOX_WIDTH"\" tooltip-text=\" Select the live support \">
<variable>CheckLiveSupport</variable>
$LIVE_SUPPORT_ITEMS
</comboboxtext>
</vbox>
BR, box579.