Page 47 of 76

Posted: Sat 22 Feb 2014, 15:24
by zigbert
Try a slash in front of $

Code: Select all

<action signal=\"button-release-event\">[ \$nTabPage -eq 0 ] && xmessage \"first tab\"</action> 

Posted: Sat 22 Feb 2014, 20:40
by don570
I found that it is possible to force a button to bottom of list by a simple
trick. ---> text widget gets space-expand="true"

Code: Select all

<vbox>
<button>....</button>
...
...
<text space-expand="true"><label>""</label></text>

<button>...</button>
</vbox>
Note the button in right bottom corner. The button doesn't go
all the way to bottom, but close enough.
Image

notebook tab refresh

Posted: Sun 23 Feb 2014, 18:31
by Puma
Thanks all for the quick reply. Code example of SFR works perfect but a new
problem arised. First some explanation.

At the moment i developed a Wary Distribution with special attention to server administration of VNC, PureFtp, Hiawatha (WebServer), PHP, and MySql.

Name of the distribution is Pumalix (Pu for Puppy, Ma for Part of my Name and Lix for Linux). Distribution is based on Wary becauce of old Bios support.

Included are Firefox (latest Version), PlayOnLinux, Gimp, Virtual Box and many more. Also i adapted all GtkDialog code to support multilingual appearance.

All is controlled by a GUI shown in attachement. Each Tab of the GUI is represented by a string variable which is allocated by a Function.

Because there is some code behind each Tab (especially ther Server Tab)
i would like to avoid running this code if only Tab one is shown. In this
case only code for Tab one should run and for the other tabs there is a simple dummy function running.

But if you click Tab two then the content of the represented string should change by calling the appropriate function.

Do do this i miss a event or something i can refresh after click.

below a simple code example.

Code: Select all

#! /bin/bash


########################  EXPORT Variablen  ##############################

export cTabBlank
export cTabPage1
export cTabPage2
export cTabPage3

#typeset -i nTabPage=0
#declare -i nTabPage=1

########################  EXPORT Functions  ##############################

function GetTabPage1()
{
  cTabPage1="<frame>
    <text>
      <label>\"first tab\"</label>
    </text>
  </frame>"
  
  echo $cTabPage1 
}
export -f GetTabPage1


#########################################################################

function GetTabPage2()
{
  cTabPage2="<frame>
    <text>
      <label>\"second tab\"</label>
    </text>
  </frame>"
  
  echo $cTabPage2 
}
export -f GetTabPage2


#########################################################################

function GetTabPage3()
{
  cTabPage3="<frame>
    <text>
      <label>\"third tab\"</label>
    </text>
  </frame>"
  
  echo $cTabPage3 
}
export -f GetTabPage3

#########################################################################

function GetTabBlank()
{
  cTabBlank="<frame>
    <text>
      <label>\"blank tab\"</label>
    </text>
  </frame>"
  
  echo $cTabBlank 
}
export -f GetTabBlank

#########################################################################

function OnTabPageChanged()
{
  declare -i local nActPage

  nActPage=$1

  if [ $nActPage -eq 0 ]; then
    xmessage "content of tab one is allways the same, no changes needed"
    #cTabPage1=$(GetTabPage1) 
  elif [ $nActPage -eq 1 ]; then
    xmessage "content of tab two should change by changing variable cTabPage2"
    cTabPage2=$(GetTabPage2)   
  elif [ $nActPage -eq 2 ]; then
	xmessage "content of tab three should change by changing variable cTabPage3"
	cTabPage3=$(GetTabPage3)
  fi  
  
}
export -f OnTabPageChanged


####################  INIT Notebook Tabs ################################

cTabPage1=$(GetTabPage1)
cTabPage2=$(GetTabBlank)
cTabPage3=$(GetTabBlank)

#############################  M A I N ##################################

export MAIN="
<notebook>

  $cTabPage1
  $cTabPage2
  $cTabPage3
  
  <variable>nTabPage</variable> 
  <action signal=\"button-release-event\">[ "'$nTabPage'" -eq 0 ] && OnTabPageChanged "'$nTabPage'" && refresh:nTabPage</action>
  <action signal=\"button-release-event\">[ "'$nTabPage'" -eq 1 ] && OnTabPageChanged "'$nTabPage'" && refresh:nTabPage</action>
  <action signal=\"button-release-event\">[ "'$nTabPage'" -eq 2 ] && OnTabPageChanged "'$nTabPage'" && refresh:nTabPage</action>      

</notebook>"

#############################  T E S T ##################################

#I=$IFS; IFS=""
#for STATEMENTS in  $(gtkdialog -cp MAIN	); do
#  eval $STATEMENTS
#done
#IFS=$I 

gtkdialog -cp MAIN	

##################### UNSET Functions ################################

unset GetTabBlank
unset GetTabPage1
unset GetTabPage2
unset GetTabPage3
unset OnTabPageChanged

##################### UNSET Variablen ################################

unset cTabBlank
unset cTabPage1
unset cTabPage2
unset cTabPage3

screenshoot of control gui

Posted: Sun 23 Feb 2014, 18:38
by Puma
see attachment

next try image upload

Posted: Sun 23 Feb 2014, 18:46
by Puma
as embedded image

[img]/home/puma/Desktop/ServerControl.png[/img]

s o r r y

Posted: Sun 23 Feb 2014, 18:48
by Puma
cant upload any image neither as embedded image nor attachment

Posted: Fri 28 Feb 2014, 01:00
by don570
When I post an image I use photobucket.com as a server,
then I can use <IMG>.....</IMG> tags
_________________________________________________

Regarding updating pixmaps

Posted: Tue 04 Mar 2014, 20:31
by thanius
I just wrote an ad cycler and thought I'd share some on the pixmap updater. I saw the example here but I found it more clean to make symbolic links instead of copying the files. Here's my ad cycler:

Code: Select all

#!/bin/bash 

ln -fs ad1.png ad.png
echo 2 > /tmp/count

function cycle_ad {

# Because gtkdialog won't handle global vars for some retarded reason!
i=`cat /tmp/count`

if [ -e "ad$i.png" ]; then
  ln -fs ad$i.png ad.png
  echo $i+1|bc > /tmp/count
else
  ln -fs ad1.png ad.png
  echo 2 > /tmp/count
fi

}

export MAIN=' 
<window width-request="600" height-request="400"> 

<vbox homogeneous="true">
 <pixmap> 
  <variable>IMAGE</variable>
  <input file>ad.png</input> 
 </pixmap>
 
 <timer milliseconds="false" interval="13" visible="false"> 
   <action>exec $SHELL -c cycle_ad</action> 
   <action>sleep 2</action>
   <action type="refresh">IMAGE</action> 
 </timer>

</vbox> 
</window>' 

export -f cycle_ad

gtkdialog --center --program=MAIN

Always on top

Posted: Tue 29 Apr 2014, 01:08
by brokenman
Keeping a gtkdialog app 'always on top'

I've just read that this is possible in jwm using the .jwmrc file and launching the gtkdialog as a --class=APPLET. Is there an inbuilt way to do the same in openbox?

This could probably be achieved with other methods inside the openbox rc.xml file but I am wondering if something similar to the JWM solution si viable.

Posted: Tue 29 Apr 2014, 01:18
by disciple
"other methods inside the openbox rc.xml file" sounds similar to "using the .jwmrc file" to me...

Posted: Tue 29 Apr 2014, 15:42
by seaside
JWM can be set by placing this in /root/.jwm/jwmrc-personal-

Code: Select all

<Group>
<Name>on-top</Name>
<Class>on-top</Class>
<Option>layer:12</Option>
</Group>
Openbox set by openbox rc.xml "layer" property.
http://openbox.org/wiki/Help:Applicatio ... n_settings

Cheers,
s

Posted: Sat 24 May 2014, 07:05
by neerajkolte
Nice thread. Just bookmarking for reference.

Posted: Sat 24 May 2014, 08:44
by Argolance
Bonjour,
JWM Configuration web page wrote:layer
The layer of the tray. The default is above. Valid values are below, normal, and above.
So, depending on the JWM version you are running:

Code: Select all

<Group>
<Name>on-top</Name>
<Class>on-top</Class>
<Option>layer:12</Option>
</Group>
... is now deprecated and doesn't work properly.
It should be:

Code: Select all

<Group>
<Name>on-top</Name>
<Class>on-top</Class>
<Option>layer:above</Option>
</Group>
Cordialement.

Posted: Sun 25 May 2014, 19:33
by puppy_apprentice
I want to make buttons UP and DOWN to move item on the list/tree gadget one place up or down. Is there built-in function for this task or i will have make own bash function for this? Maybe someone has code snippet for this?

Posted: Tue 27 May 2014, 00:04
by MochiMoppel
puppy_apprentice wrote:I want to make buttons UP and DOWN to move item on the list/tree gadget one place up or down. Is there built-in function for this task or i will have make own bash function for this? Maybe someone has code snippet for this?
Zigbert provides a code snippet on the first page of this thread ("The next script shows how to move items in list by drag'n drop"). Not really buttons and I haven't tested, but maybe a start.

Posted: Tue 27 May 2014, 05:55
by zigbert
pBurn use buttons to move items up/down in a <tree>.
/usr/local/pburn/func_gui - line 351

Code: Select all

     <button tooltip-text=\" $(gettext 'Move item UP') \">
      <variable>MOVE_UP</variable>
      <input file stock=\"gtk-go-up\"></input>
      <visible>$VISIBLE_MOVE_UPDOWN</visible>
      <action>DIRECTION=up; . $APPDIR/func -move_up_down; . $APPDIR/func -info_burn</action>
      <action>refresh:BURNLIST</action>
     </button>
function -move_up_down is found in /usr/local/pburn/func - line 424

In the pMusic playqueue, you can move items by drag'n'drop.
/usr/local/pmusic/gui_playlist - line 27-29

Code: Select all

 <action signal="button-press-event">grep -F "$PLAYLIST" '$WORKDIR'/playlist > '$WORKDIR'/PLAYLIST_PRESS_EVENT; [ "$PLAYLIST" ] && . '$APPDIR'/menu_playqueue</action>
 <action signal="button-release-event">. '$APPDIR'/func -playlist_move</action> ##this will play the track as well
 <action signal="button-release-event">refresh:PLAYLIST</action>
The -playlist_move function is found in /usr/local/pmusic/func - line 479

Posted: Tue 27 May 2014, 17:38
by puppy_apprentice
thx for both of you i will check this

color cell tree

Posted: Wed 02 Jul 2014, 13:48
by titi89
Hello, saddened for my English it is possible to color a cell(unit) in a tree?
And if yes how?
Thank you

Posted: Fri 04 Jul 2014, 13:06
by zigbert
I don't think that is possible inside the <tree> widget.


Sigmund

Posted: Fri 04 Jul 2014, 15:36
by titi89
ok thank you