Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 01 Jul 2015, 02:40
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
GtkDialog - tips
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 64 of 68 Posts_count   Goto page: Previous 1, 2, 3, ..., 62, 63, 64, 65, 66, 67, 68 Next
Author Message
don570


Joined: 10 Mar 2010
Posts: 3778
Location: Ontario

PostPosted: Sat 02 Aug 2014, 16:22    Post_subject:  

Note to mister_electronico..

If you're learning gtkdialog then I recommend
reading my togglebutton example page. Very neat Cool

http://208.109.22.214/puppy/viewtopic.php?p=758918&sid=8e64b48a0f9a012b4112c0f714757e5a
_____________________________________________
Back to top
View user's profile Send_private_message 
mister_electronico


Joined: 20 Jan 2008
Posts: 824
Location: Asturias_ España

PostPosted: Sat 02 Aug 2014, 19:59    Post_subject: Hi don570  

Hi don570, I like you post like other you did, but I ddn't find the relationship with my two last post.

See you.



______________________________________________________________________
My blog

https://misterelectronicoes.wordpress.com/

Edited_time_total
Back to top
View user's profile Send_private_message Visit_website YIM 
mister_electronico


Joined: 20 Jan 2008
Posts: 824
Location: Asturias_ España

PostPosted: Sun 31 Aug 2014, 16:32    Post_subject: Display meter-panel.  

I always look for a display to display data from my electronic circuits, so that I did this program gtkdialog, I think I can be useful and other people.... I hope so

The program would look like.



______________________________________________________________________
My blog

https://misterelectronicoes.wordpress.com/
meter_panel.png
 Description   
 Filesize   40.24 KB
 Viewed   782 Time(s)

meter_panel.png


Edited_time_total
Back to top
View user's profile Send_private_message Visit_website YIM 
mister_electronico


Joined: 20 Jan 2008
Posts: 824
Location: Asturias_ España

PostPosted: Sun 31 Aug 2014, 16:38    Post_subject: The program  

This program can accommodate the needs that we have.

Greetings




______________________________________________________________________
My blog

https://misterelectronicoes.wordpress.com/
meter.tar.gz
Description 
gz

 Download 
Filename  meter.tar.gz 
Filesize  62.31 KB 
Downloaded  160 Time(s) 

Edited_time_total
Back to top
View user's profile Send_private_message Visit_website YIM 
mister_electronico


Joined: 20 Jan 2008
Posts: 824
Location: Asturias_ España

PostPosted: Sun 07 Sep 2014, 19:18    Post_subject: Mobile sign  

One mobile sign:

Code:

#!/bin/bash
[ -z $GTKDIALOG ] && GTKDIALOG=gtkdialog

export DAT=/dev/shm/var1
echo "800" > $DAT


# Letro movil
funcion1 () {
VAR=( `cat $DAT` )
echo '<svg width="800" height="150" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<text x="'$VAR'" y="46" xml:space="preserve" style="font-family:monospace;font-size:64px;" font-weight="bold" fill="#7F0D0D" opacity="0.8">MOBILE SIGN WORKING</text>
</svg>' > /dev/shm/var2.svg

  VAR=`echo "$VAR - 10" | bc -l`
  echo ${VAR} > $DAT
  NUM=${VAR%%}
  if [ $NUM -lt -720 ]; then  echo "800" > $DAT; else deci=0; fi     

export -f funcion1

export MAIN='
<window title="Mobile sign" resizable="false">
  <vbox>
    <pixmap>
      <variable>IMG</variable>
      <input file>/dev/shm/var2.svg</input>
    </pixmap>
    <button ok></button>
    <timer visible="false" milliseconds="true" interval="100">
      <action>funcion1</action>
      <action type="refresh">IMG</action>
    </timer>
  </vbox>
</window>
'

case $1 in
   -d | --dump) echo "$MAIN" ;;
   *) $GTKDIALOG -cp MAIN ;;
esac
unset mobile_sign
unset funcion1
killall -9 mobile_sign.sh


Greetings


______________________________________________________________________
My blog

https://misterelectronicoes.wordpress.com/

Edited_time_total
Back to top
View user's profile Send_private_message Visit_website YIM 
Argolance


Joined: 06 Jan 2008
Posts: 2062
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Thu 18 Sep 2014, 10:21    Post_subject: <notebook> tabs height?  

Hello,
Is there a way to fix the notebook tabs height when they are right or left of a window to make them entirely fill it? Something like:
Code:
<notebook tab-height=\"xx\"...</notebook>

??
Thank you!
Cordialement.
140918_165227_756x494_easyshot.jpg
 Description   
 Filesize   38.96 KB
 Viewed   642 Time(s)

140918_165227_756x494_easyshot.jpg


_________________

Back to top
View user's profile Send_private_message Visit_website 
don570


Joined: 10 Mar 2010
Posts: 3778
Location: Ontario

PostPosted: Sat 20 Sep 2014, 16:39    Post_subject:  

To Argolance..

The space-expand and space-fill set to true are the only way I know how to
change where widgets appear. I got the info from Thunor

Code:

A text widget that has space-expand and space-fill set to true can be used as a spacer to push neighbouring widgets in certain directions.

Here the spacer text is "[]" so you can see it -- drag the window out and watch the button.
   
#!/bin/sh

GTKDIALOG=gtkdialog

Spacer="[]"

MAIN_DIALOG='
<window title="Spacer Test" window-position="1">
   <vbox>
      <hbox>
         <button space-expand="false" space-fill="false">
            <label>This button will stay put</label>
            <input file stock="gtk-about"></input>
         </button>
         <text space-expand="true" space-fill="true">
            <label>"'$Spacer'"</label>
         </text>
      </hbox>
   </vbox>
</window>
'
export MAIN_DIALOG

case $1 in
   -d | --dump) echo "$MAIN_DIALOG" ;;
   *) $GTKDIALOG --program=MAIN_DIALOG ;;
esac   

Regards,
Thunor
__________________________________________



Looking at the info on the notebook widget it says that it supports
space-expand and space-fill but I'm not sure what part of notebook
widget is affected.




gtkdialog wrote:

#summary notebook widget reference

= notebook widget =

A [http://developer.gnome.org/gtk2/2.24/GtkNotebook.html GtkNotebook]

----

== Definition ==

{{{
<notebook tag_attr="value"...>
widget...
<variable>varname</variable>
<input>command</input>
<input file>filename</input>
<sensitive>state</sensitive>
<action signal="type">activity</action>...
<output file>filename</output>
</notebook>
}}}

"..." denotes acceptance of multiples of the same thing.

== Tag Attributes ==

See the [http://developer.gnome.org/gtk2/2.24/GtkNotebook.html#GtkNotebook.object-hierarchy GtkNotebook] widget and ancestor class properties.

The following custom tag attributes are available:

<wiki:comment>ExportTableStart</wiki:comment>
|| *Name* || *Description* || *Value* || *Since* ||
|| space-expand || Pack widget expanding into space || {{{true}}} or {{{false}}} || 0.7.21 ||
|| space-fill || Pack widget filling space || {{{true}}} or {{{false}}} || 0.7.21 ||
|| block-function-signals || Block signal emissions from functions || {{{true}}} or {{{false}}} || 0.7.21 ||
|| file-monitor || Emit signal when input file(s) change || {{{true}}} or {{{false}}} || 0.8.1 ||
|| auto-refresh || Auto refresh when input file(s) change || {{{true}}} or {{{false}}} || 0.8.1 ||
|| tab-base-index || Tab label start page number || Integer || 0.7.21 ||
|| tab-labels || Tab labels || _label0_ {{{|}}} _label1_ {{{|}}} ... || 0.7.21 ||
|| tab-prefix || Tab label prefix || || 0.7.21 ||
|| tab-suffix || Tab label suffix || || 0.7.21 ||
<wiki:comment>ExportTableEnd</wiki:comment>

== Directives ==

Some of these may have tag attribute equivalents.

<wiki:comment>ExportTableStart</wiki:comment>
|| *Name* || *Description* || *Contents* || *Since* ||
|| variable || Variable name || || 0.7.21 ||
|| variable export="false" || Variable name, not exported to shell || || 0.8.3 ||
|| input^[1]^ || Data input source || Shell command || 0.7.21 ||
|| input file^[1]^ || Data input source || Filename || 0.7.21 ||
|| sensitive || Sensitive state || {{{true}}} or {{{false}}} || 0.7.21 ||
|| action signal="_type_" || Execute command on signal || Shell command || ||
|| action signal="_type_" || Perform function on signal || _function_:_parameter_ || ||
|| action signal="_type_" condition="_type_" || Execute command on signal conditionally || Shell command || 0.8.3 ||
|| action signal="_type_" condition="_type_" || Perform function on signal conditionally || _function_:_parameter_ || 0.8.3 ||
|| output file || Data output target || Filename || 0.7.21 ||
<wiki:comment>ExportTableEnd</wiki:comment>

== Signals ==

There is no default signal for this widget.

The "file-changed" signal is emitted if file-monitor is true and the input file being monitored has changed.

The following signals are connected-up for all widgets:

[http://developer.gnome.org/gtk2/2.24/GtkWidget.html#GtkWidget-button-press-event button-press-event], [http://developer.gnome.org/gtk2/2.24/GtkWidget.html#GtkWidget-button-release-event button-release-event], [http://developer.gnome.org/gtk2/2.24/GtkWidget.html#GtkWidget-configure-event configure-event], [http://developer.gnome.org/gtk2/2.24/GtkWidget.html#GtkWidget-enter-notify-event enter-notify-event], [http://developer.gnome.org/gtk2/2.24/GtkWidget.html#GtkWidget-leave-notify-event leave-notify-event], [http://developer.gnome.org/gtk2/2.24/GtkWidget.html#GtkWidget-focus-in-event focus-in-event], [http://developer.gnome.org/gtk2/2.24/GtkWidget.html#GtkWidget-focus-out-event focus-out-event], [http://developer.gnome.org/gtk2/2.24/GtkWidget.html#GtkWidget-hide hide], [http://developer.gnome.org/gtk2/2.24/GtkWidget.html#GtkWidget-show show], [http://developer.gnome.org/gtk2/2.24/GtkWidget.html#GtkWidget-realize realize], [http://developer.gnome.org/gtk2/2.24/GtkWidget.html#GtkWidget-key-press-event key-press-event], [http://developer.gnome.org/gtk2/2.24/GtkWidget.html#GtkWidget-key-release-event key-release-event], [http://developer.gnome.org/gtk2/2.24/GtkWidget.html#GtkWidget-map-event map-event], [http://developer.gnome.org/gtk2/2.24/GtkWidget.html#GtkWidget-unmap-event unmap-event]

== Functions ==

The following functions can be performed upon this widget by any widget capable of emitting signals:

<wiki:comment>ExportTableStart</wiki:comment>
|| *Type* || *Description* || *Parameter* || *Since* ||
|| enable || Sensitise widget || Variable name || ||
|| disable || Desensitise widget || Variable name || ||
|| show || Show widget || Variable name || 0.8.1 ||
|| hide || Hide widget || Variable name || 0.8.1 ||
|| grabfocus || Grab input focus || Variable name || 0.8.1 ||
|| refresh || Reload input data || Variable name || 0.7.21 ||
|| save || Save widget data || Variable name || 0.7.21 ||
<wiki:comment>ExportTableEnd</wiki:comment>

The following general functions can be performed by any widget capable of emitting signals:

<wiki:comment>ExportTableStart</wiki:comment>
|| *Type* || *Description* || *Parameter* || *Since* ||
|| break || Break out of actions list || None || 0.8.3 ||
|| command || Execute command || Shell command || ||
|| exit || Exit dialog || A value for the {{{EXIT}}} variable || ||
|| closewindow || Close dialog || Variable name || ||
|| launch || Launch dialog || Variable name || ||
|| presentwindow || [http://developer.gnome.org/gtk2/2.24/GtkWindow.html#gtk-window-present Present] dialog || Variable name || 0.8.1 ||
<wiki:comment>ExportTableEnd</wiki:comment>

== Conditions ==

The following conditions can be used within the condition attribute of action directives:

<wiki:comment>ExportTableStart</wiki:comment>
|| *Type* || *Description* || *Argument* || *Since* ||
|| active_is_true(_argument_) || Active state of toggle widget || Variable name || 0.8.3 ||
|| active_is_false(_argument_) || Active state of toggle widget || Variable name || 0.8.3 ||
|| command_is_true(_argument_) || Output of shell command || Shell command || 0.8.3 ||
|| command_is_false(_argument_) || Output of shell command || Shell command || 0.8.3 ||
|| file_is_true(_argument_) || Contents of a file || Filename || 0.8.3 ||
|| file_is_false(_argument_) || Contents of a file || Filename || 0.8.3 ||
|| sensitive_is_true(_argument_) || Sensitive state of widget || Variable name || 0.8.3 ||
|| sensitive_is_false(_argument_) || Sensitive state of widget || Variable name || 0.8.3 ||
|| visible_is_true(_argument_) || Visible state of widget || Variable name || 0.8.3 ||
|| visible_is_false(_argument_) || Visible state of widget || Variable name || 0.8.3 ||
<wiki:comment>ExportTableEnd</wiki:comment>

true means "true", "yes" or a non-zero value, false means "false", "no" or zero, therefore the shell command is expected to echo one of these values to stdout.

== Notes ==

1. This widget does not accept setting a default page before being shown (there's a note about it [http://developer.gnome.org/gtk2/2.24/GtkNotebook.html#gtk-notebook-set-current-page here]) which will result in input data being discarded at start-up. This issue can be overcome by using the "[http://developer.gnome.org/gtk2/2.24/GtkNotebook.html#GtkNotebook--page page]" tag attribute which will be applied after the widget is shown.


Back to top
View user's profile Send_private_message 
Argolance


Joined: 06 Jan 2008
Posts: 2062
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Wed 24 Sep 2014, 06:48    Post_subject:  

Hello don570,
Sorry, I didn't see your message before (though I asked to be notified when a reply is posted).
Thanks a lot (#summary notebook widget reference very interesting indeed!)
Quote:
Looking at the info on the notebook widget it says that it supports
space-expand and space-fill but I'm not sure what part of notebook
widget is affected.

All the same... Sad

Cordialement.

_________________

Back to top
View user's profile Send_private_message Visit_website 
don570


Joined: 10 Mar 2010
Posts: 3778
Location: Ontario

PostPosted: Sat 18 Oct 2014, 15:21    Post_subject:  

Can the frame heading be color?? I guess not, however here is a replacement technique.

Normally widgets flow from right side of a hbox to left side, but Thunor found
a method to modify this behaviour.
Just fill with empty text on right side with this widget....
<text space-expand="true" space-fill="true">

then use

<text space-expand="false">

for the left side of window.

Code:

#!/bin/sh

export MAIN_DIALOG='<window title="Examples" icon-name="gtk-info" resizable="false">

<vbox width-request="200">
    <hbox>
        <text space-expand="false"  use-markup="true"><label>"<u><span size='"'large'"' color='"'red'"'>Heading</span></u>"</label></text>   
        <text space-expand="true" space-fill="true"><label>""</label> </text>
    </hbox>
    <edit editable="false">
         <variable>EDITOR</variable>
         <height>150</height>
         <width>350</width>
         <default>
"This is the default
text of the editor."
         </default>
      </edit>
</vbox>

</window>
'

gtkdialog --program=MAIN_DIALOG





Edited_times_total
Back to top
View user's profile Send_private_message 
don570


Joined: 10 Mar 2010
Posts: 3778
Location: Ontario

PostPosted: Sat 18 Oct 2014, 15:49    Post_subject:  

This script will change the color of text according to gtk theme.
Certain theme names will trigger the change. Blue turns to orange.
Code:

#!/bin/sh
export COLOUR=3272C0
[ "`egrep "Stardust_dark_mouse|Stardust_dark_touch|Azenis|TerraNova-Aquarius|terminus|Murrina-Black|DarkRoomCompact|PenOSmaster" /root/.gtkrc-2.0`"  ] && COLOUR=FFD900

 export MAIN_DIALOG='
<window title="Example"  window-position="1">
 <vbox>
<text use-markup="true"><label>"<b><span size='"'x-large'"'>p</span><span size='"'x-large'"' color='"'#$COLOUR'"'>Archive</span></b>"</label></text>
</vbox>
</window>'
 
 gtkdialog -p MAIN_DIALOG
 


Back to top
View user's profile Send_private_message 
trio


Joined: 21 Dec 2008
Posts: 1965
Location: अनुमोदना

PostPosted: Tue 28 Oct 2014, 04:48    Post_subject:  

Sigmund,

Quote:

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:
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:
<Group>
<Class>APPLET</Class>
<Option>nolist</Option>
<Option>sticky</Option>
<Option>noborder</Option>
<Option>layer:12</Option>
</Group>


I tried <window skip-taskbar-hint="true"> and it works.

Regards,

Trio

_________________
My apps
Back to top
View user's profile Send_private_message 
don570


Joined: 10 Mar 2010
Posts: 3778
Location: Ontario

PostPosted: Tue 16 Dec 2014, 21:28    Post_subject:  

Example: Make a destination folder choice so it shows next time the app is run

When the user clicks a button (Save in the example below)
the choice is saved in a secret place

Code:
<action>echo  "$SAVEFOLDER" >  $WORKDIR/destination</action>




Code:

#!/bin/sh
# example to define a destination folder

mkdir -p /root/.config/example
export WORKDIR=/root/.config/example #  export is needed for input directive

[ ! -e  $WORKDIR/destination ]  && echo "/root" > $WORKDIR/destination # set initial

export EXAMPLE='<window>
<vbox width-request="390">
  <frame Destination Folder>
 
              <hbox>
                   <entry accept="directory"  tooltip-text="Choose Directory to save your data">
                   <input>cat $WORKDIR/destination</input>                   
                   <variable>SAVEFOLDER</variable>                   
                   </entry>
                                                     
                   <button tooltip-text="Choose Directory to save your data">
                   <input file stock="gtk-directory"></input>
                   <action type="fileselect">SAVEFOLDER</action>                                                       
                  </button>
              </hbox>
              <hbox>
                   <button use-stock="true" label="gtk-save">
                   <action>gxmessage My save folder is now  $SAVEFOLDER</action>                 
                   <action>echo  "$SAVEFOLDER" >  $WORKDIR/destination</action>                                                       
                  </button>
               </hbox>
                 
                     
    </frame>
</vbox>
</window>'
gtkdialog -c --program=EXAMPLE
Back to top
View user's profile Send_private_message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 705
Location: Japan

PostPosted: Wed 17 Dec 2014, 00:42    Post_subject:  

Variation of above example: When the user clicks the Save button, the choice is saved in the script itself. No need to write to /root/.config
Code:
#!/bin/sh

DESTINATION=/root
export SCRIPTPATH="$0"

function  save_folder { sed -i "s|^DESTINATION=.*$|DESTINATION=\"$SAVEFOLDER\"|" "$SCRIPTPATH";}
export -f save_folder

 export EXAMPLE='<window>
 <vbox width-request="390">
   <frame Destination Folder>
   
               <hbox>
                    <entry accept="directory"  tooltip-text="Choose Directory to save your data">
                    <default>'$DESTINATION'</default>                   
                    <variable>SAVEFOLDER</variable>                   
                    </entry>
                                                       
                    <button tooltip-text="Choose Directory to save your data">
                    <input file stock="gtk-directory"></input>
                    <action type="fileselect">SAVEFOLDER</action>                                                       
                   </button>
               </hbox>
               <hbox>
                    <button use-stock="true" label="gtk-save">
                    <action>gxmessage My save folder is now  $SAVEFOLDER</action>                 
                    <action>save_folder</action>                                                       
                   </button>
                </hbox>
     </frame>
 </vbox>
 </window>'
 gtkdialog -c --program=EXAMPLE
Back to top
View user's profile Send_private_message 
don570


Joined: 10 Mar 2010
Posts: 3778
Location: Ontario

PostPosted: Wed 17 Dec 2014, 20:51    Post_subject:  

I think there is a situation that I didn't perceive when writing my script.
i.e. if the file 'destination' exists but somehow the folder has disappeared
I should have a default folder to open when first launching.

Code:

[ ! -d  $WORKDIR/destination ]  && echo "/root" > $WORKDIR/destination
Back to top
View user's profile Send_private_message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 705
Location: Japan

PostPosted: Wed 17 Dec 2014, 21:44    Post_subject:  

don570 wrote:
I think there is a situation that I didn't perceive when writing my script.
i.e. if the file 'destination' exists but somehow the folder has disappeared
??? The way you wrote your script the folder and the file is created at each start of the script. How could the folder "disappear" and the file it contains still exist? And how does your new code fit into the original file? The test [ ! -d $WORKDIR/destination ] is always true since a folder $WORKDIR/destination is never created and therefore never exists.
Quote:
I should have a default folder to open when first launching.
What was wrong with your script? You had that already. It would be even better if the script uses a default path hard coded in the script and creates $WORKDIR/destination only if this default path was actually changed by the user. This way the system keeps clean as long as possible. If the user shortly tests the script and decides not to keep it, no zombie config files are left.
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 64 of 68 Posts_count   Goto page: Previous 1, 2, 3, ..., 62, 63, 64, 65, 66, 67, 68 Next
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1574s ][ Queries: 12 (0.0167s) ][ GZIP on ]