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 Sat 17 Nov 2018, 13:35
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 83 of 96 [1439 Posts]   Goto page: Previous 1, 2, 3, ..., 81, 82, 83, 84, 85, ..., 94, 95, 96 Next
Author Message
don570


Joined: 10 Mar 2010
Posts: 5171
Location: Ontario

PostPosted: Tue 19 Dec 2017, 19:54    Post subject:  

Quote:

It basically just needs to be a small window with buttons that I can run programs from.


People on the forum have already written this...

http://murga-linux.com/puppy/viewtopic.php?t=61962
http://murga-linux.com/puppy/viewtopic.php?t=76713

____________________________________________

To make a quick launcher yourself...

Put links to the desktop files in one folder,
then you can open this folder with the command
Code:
rox -d /path/to/folder

__________________________________________
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 5171
Location: Ontario

PostPosted: Wed 27 Dec 2017, 18:33    Post subject: Launch pmusic in a script  

Launch pmusic in a script
I have found that it is difficult to launch pmusic inside a script.

Here is method that works reliably even when pmusic has an option.
First of all , choose pmusic from other apps

Code:
for P in mpg123 mpg321  pmusic parole vlc  xine defaultaudioplayer ; do
  MUSIC_APP=$(which $P) && break
done


Now replace pmusic with 'pmusic -B' if you want background music.
Put the command in a file and make executable.

Code:
[ $MUSIC_APP = /usr/local/bin/pmusic ] && MUSIC_APP="pmusic -B"
echo "$MUSIC_APP" \""${snd}"\" > /tmp/pmusic_launch
chmod +x /tmp/pmusic_launch
/tmp/pmusic_launch 2>/dev/null &

_________________________________________________________

I used this method in PTM timer
http://murga-linux.com/puppy/viewtopic.php?t=112410
_________________________
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1678
Location: Japan

PostPosted: Wed 27 Dec 2017, 22:50    Post subject: Re: Launch pmusic in a script  

don570 wrote:
Here is method that works reliably even when pmusic has an option.
First of all , choose pmusic from other apps

Code:
for P in mpg123 mpg321  pmusic parole vlc  xine defaultaudioplayer ; do
  MUSIC_APP=$(which $P) && break
done


Now replace pmusic with 'pmusic -B' if you want background music.
Put the command in a file and make executable.

Code:
[ $MUSIC_APP = /usr/local/bin/pmusic ] && MUSIC_APP="pmusic -B"
echo "$MUSIC_APP" \""${snd}"\" > /tmp/pmusic_launch
chmod +x /tmp/pmusic_launch
/tmp/pmusic_launch 2>/dev/null &

Try
Code:
for MUSIC_APP in mpg123 mpg321  pmusic parole vlc  xine defaultaudioplayer ; do
   which $MUSIC_APP && break
done
[ $MUSIC_APP = pmusic ] && OPTION="-B"
exec $MUSIC_APP $OPTION "$snd"
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 5171
Location: Ontario

PostPosted: Fri 29 Dec 2017, 16:22    Post subject:  

Quote:
[ $MUSIC_APP = pmusic ] && OPTION="-B"
exec $MUSIC_APP $OPTION "$snd"


I hadn't thought of that. I was trying to do it all as one variable
MUSIC_APP="pmusic -B"
________________________________
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1678
Location: Japan

PostPosted: Fri 29 Dec 2017, 21:07    Post subject:  

don570 wrote:
I hadn't thought of that. I was trying to do it all as one variable
MUSIC_APP="pmusic -B"
...which would work perfectly - unless you have unintentionally changed your IFS assignment Wink
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 5171
Location: Ontario

PostPosted: Tue 02 Jan 2018, 16:59    Post subject:  

I noticed that someone has put up a good page with examples to
explain gtkdialog
http://xpt.sourceforge.net/techdocs/language/gtkdialog/gtkde02-GtkdialogExamples/
__________________________________________________
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 5171
Location: Ontario

PostPosted: Tue 09 Jan 2018, 21:16    Post subject: Example to show opening a second window  

Thunor has given us examples of gtkdialog in action.
http://murga-linux.com/puppy/viewtopic.php?t=82059
In the miscelaneous section there is an example showing the launch of
a second window. I wanted the second window to close at the same time
as the main window. Check this by clicking on 'Quit' button' in main window.

I find this is good for a system of help or a logging function which
uses the second window. As an example see my PTM timer
where the 'Log' button keeps track of previous events.

Thunor's script is rather complicated so I have simplified it.
Code:

#!/bin/sh
#example to show launching of second window

# Please note that the name of the exported shell variable matches the
# window widget's variable directive which is a requirement. Not doing
# this will result in the launching of duplicate windows none of which
# can be closed and a warning message being sent to the terminal.




winMain='
<window title="winMain" width-request="250">
   <vbox>
      <frame>      <button>
            <label>launch winLaunch1</label>
            <action function="launch">winLaunch1</action>
         </button>
         <button>
            <label>closewindow winLaunch1</label>
            <action function="closewindow">winLaunch1</action>
         </button>
      </frame>
      
      
      <hbox homogeneous="true">
         <button use-stock="true" label="gtk-quit"></button>
      </hbox>
   </vbox>
   <variable>winMain</variable>
</window>
'
export winMain

winLaunch1='
<window title="winLaunch1" width-request="250">
   <vbox>
      <text><label>text label</label></text>
      <hbox homogeneous="true">
      <button>
            <label>closewindow</label>
            <action function="closewindow">winLaunch1</action>
         </button>
      
         <button use-stock="true" label="gtk-quit"></button>
      </hbox>
   </vbox>
   <variable>winLaunch1</variable>
</window>
'
export winLaunch1
 I=$IFS; IFS=""
     for STATEMENTS in  $(gtkdialog -p winMain); do
       eval $STATEMENTS       
     done
#gtkdialog --program=winMain
xmessage  "I am here"

screenshot-multiple-windows.png
 Description   
 Filesize   29.19 KB
 Viewed   523 Time(s)

screenshot-multiple-windows.png

Back to top
View user's profile Send private message 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 8710
Location: Perth, Western Australia

PostPosted: Sun 21 Jan 2018, 19:59    Post subject:  

Oh joy, I have just discovered this, to show/hide a hbox or vbox:

Quote:
How to change the gui without restarting the app
>> Recent Gtkdialog allows to hide/show widgets, To hide many widgets at once, you can hide a <hbox> or <vbox>. This will hide all widgets inside the box.


Works real nice.

I have a question though, about this show and hide. I can click on a button, for example, to show/hide a hbox:

Code:
<hbox>
 ...widgets...
 <variable>BOX1</variable>
</hbox>

<button>
 <label>hide</label>
 <action function="hide">BOX1</action>
</button>


But, how can I have it so that BOX1 is hidden by default when the window starts up?

EDIT:
Ha ha, have answered my own question!
I just experimented, this works:

Code:
<hbox visible="false">
 ...widgets...
 <variable>BOX1</variable>
</hbox>

<button>
 <label>show</label>
 <action function="show">BOX1</action>
</button>


There is a problem with window resizing, after doing a "show" then a "hide" again (with a "hide" button) -- the window stays bigger, with a gap in it.

_________________
http://bkhome.org/news/
Back to top
View user's profile Send private message Visit poster's website 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1678
Location: Japan

PostPosted: Sun 21 Jan 2018, 22:21    Post subject:  

BarryK wrote:
There is a problem with window resizing, after doing a "show" then a "hide" again (with a "hide" button) -- the window stays bigger, with a gap in it.

May not be obvious, but works:
Code:
<window resizable="false"....


BTW: Another way to hide BOX1 is to add an action to the window widget (instead of adding visible="false" to the hbox):
Code:
<action signal="show">hide:BOX1</action>
This is the only method I know to hide/show a widget at start up conditionally. E.g. you may want to show BOX1 only when a certain application is installed or a flag is set.
Back to top
View user's profile Send private message 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 8710
Location: Perth, Western Australia

PostPosted: Mon 22 Jan 2018, 00:00    Post subject:  

MochiMoppel,
Thanks for the reply.

Setting resizable="false" does not fix it for me.

Thanks for the alternative way of setting default hiding.

I have another little problem with window wrapping around the widgets.

This is pretty simple code;

Code:
<window title="EasyShare" icon-name="gtk-network" resizable="false">
 <vbox>
  <text use-markup="true"><label>"<b>Share files and printers over a local network</b>"</label></text>
 
  <hbox>
   <text width-chars="25"><label>CUPS is enabled in the firewall, so a local printer can be accessed by other computers.</label></text>
   <text width-chars="25"><label>Firewall enabled for sharing local files and remote files.</label></text>
   <vbox>
    <pixmap>
     <width>56</width>
     <input file>/tmp/easyshare-1.svg</input>
    </pixmap>
    <button>
     <label>Firewall Setup</label>
     <action function="exit">firewall</action>
    </button>
   </vbox>
   <variable>BOX_FIREWALL</variable>
  </hbox>
 
  <hseparator></hseparator>
  <hbox>
   <button><label>Exit</label><action function="exit">quit</action></button>
  </hbox>
 </vbox>
</window>


As soon as I inserted that hbox section, the window rendered with a big gap on the left side. See picture.

Has anyone encountered this, and know how to fix it?
gtkdialog-test1.png
 Description   
 Filesize   12.86 KB
 Viewed   452 Time(s)

gtkdialog-test1.png


_________________
http://bkhome.org/news/
Back to top
View user's profile Send private message Visit poster's website 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1678
Location: Japan

PostPosted: Mon 22 Jan 2018, 00:47    Post subject:  

BarryK wrote:
Setting resizable="false" does not fix it for me.
Fixes it for me based on your code snippet. Needs a complete demo code to understand/fix your problem. Works also with your BOX_FIREWALL. Since you already added resizable="false" to your window widget, below buttons will hide/show BOX_FIREWALL., causing the window to adapt its size accordingly:
Code:
<hbox>
   <button label="Hide BOX_FIREWALL"><action>hide:BOX_FIREWALL</action></button>
   <button label="Show BOX_FIREWALL"><action>show:BOX_FIREWALL</action></button>
   <button><label>Exit</label><action function="exit">quit</action></button>
</hbox>



Quote:
As soon as I inserted that hbox section, the window rendered with a big gap on the left side. See picture.

I only see a "big gap" when I remove resizable="false". The not so big gap in the picture you can eliminate with
Code:
<text xalign="0" width-chars="25">
Back to top
View user's profile Send private message 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 8710
Location: Perth, Western Australia

PostPosted: Mon 22 Jan 2018, 03:46    Post subject:  

MochiMoppel wrote:
BarryK wrote:
Setting resizable="false" does not fix it for me.
Fixes it for me based on your code snippet. Needs a complete demo code to understand/fix your problem.


Yes, you are right!

I didn't try it properly. I have modified one of thunar's example scripts, attached. If you click "show" in the second row of show/hide buttons, then "hide', the window resizes to wrap around the widgets precisely.

Thanks for that.
button_action_functions2.gz
Description  Remove the false ".gz"
gz

 Download 
Filename  button_action_functions2.gz 
Filesize  2.78 KB 
Downloaded  97 Time(s) 

_________________
http://bkhome.org/news/
Back to top
View user's profile Send private message Visit poster's website 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 8710
Location: Perth, Western Australia

PostPosted: Tue 23 Jan 2018, 03:42    Post subject:  

Hey guys,
Does anyone know if it is possible to change the text in a label?
Programmatically that is, without restarting the GUI.

I suppose, one way to do it would be to have two different raster images, and use the <input file>image-name</input>

That is, replace the file "image-name" and refresh the button.

I suppose it could be done with SVG also.

In fact, that is such an obvious way of doing it, so I did a search, and yeah, don570 has posted about using SVG in his tutorial manual:

http://murga-linux.com/puppy/viewtopic.php?t=89045

So, question answered!

_________________
http://bkhome.org/news/
Back to top
View user's profile Send private message Visit poster's website 
Lobster
Official Crustacean


Joined: 04 May 2005
Posts: 15239
Location: Paradox Realm

PostPosted: Tue 23 Jan 2018, 07:37    Post subject: gtkdialog4 for raspberry pi 3  

I am trying to get GROWL my puppy security program, running on Raspbian for raspberry pi 3.

Is it available as a compiled deb? Anyone know where the source code is? Very Happy

_________________
YinYana AI Buddhism
Back to top
View user's profile Send private message Visit poster's website 
vovchik


Joined: 23 Oct 2006
Posts: 1469
Location: Ukraine

PostPosted: Tue 23 Jan 2018, 08:01    Post subject:  

Dear Lobster,

The linux version of growl (notification) program is here:


Quote:
https://github.com/mattn/growl-for-linux.


There is source there, so I will download it and see whether/how it compiles on my PI3 and post some results here.

With kind regards,
vovchik

Last edited by vovchik on Tue 23 Jan 2018, 08:30; edited 1 time in total
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 83 of 96 [1439 Posts]   Goto page: Previous 1, 2, 3, ..., 81, 82, 83, 84, 85, ..., 94, 95, 96 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.3614s ][ Queries: 14 (0.0661s) ][ GZIP on ]