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 20 Dec 2014, 00:28
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 41 of 65 [961 Posts]   Goto page: Previous 1, 2, 3, ..., 39, 40, 41, 42, 43, ..., 63, 64, 65 Next
Author Message
8-bit


Joined: 03 Apr 2007
Posts: 3398
Location: Oregon

PostPosted: Thu 08 Sep 2011, 20:33    Post subject:  

Sorry to say, but evidently when Puppy Licid 520 was made, that file went by the wayside. It just does not exist in Puppy Lucid 520.
It is interesting that it took this long for me to find out.
As a matter of fact, /usr/X11R7/lib does not exist or do any of the contents that would have been in that directory and any subdirectories in it.
Back to top
View user's profile Send private message 
puppyluvr


Joined: 06 Jan 2008
Posts: 3229
Location: Chickasha Oklahoma

PostPosted: Thu 08 Sep 2011, 22:59    Post subject:  

Very Happy Hello,
In 5 series Puppies, and prob `butu...
Try /usr/share/X11/rgb.txt

_________________
Close the Windows, and open your eyes, to a whole new world
http://puppylinuxstuff.meownplanet.net/puppyluvr/
Puppy Linux Users Group on Facebook

Puppy since 2.15CE...
Back to top
View user's profile Send private message Visit poster's website 
8-bit


Joined: 03 Apr 2007
Posts: 3398
Location: Oregon

PostPosted: Fri 09 Sep 2011, 00:08    Post subject:  

Thank you puppyluvr.
The file was just where you said it was.
But that brings me to a question.
Why did the directory structure change in Lucid?
I thought "out-of-the-box" Puppy versions would, or should I say should have the same directory structure as to file placement for the files that come with Puppy.
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6464
Location: Auckland, New Zealand

PostPosted: Fri 09 Sep 2011, 06:58    Post subject:  

But if they are built from another distro's packages they would need to use its filesystem layout, to be compatible with it.
_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Tue 13 Sep 2011, 00:55    Post subject: gtimer
Subject description: process indicator ( => 0.7.21 )
 

This animated process indicator graphic makes use of the gtkdialog timer feature. Usage:

myfunction() {
gtimer
code .....
kill -9 `ps | grep GTIMER | grep -v grep | awk '{print $1}'`
}
gtimer-2.0.pet
Description 
pet

 Download 
Filename  gtimer-2.0.pet 
Filesize  1.19 KB 
Downloaded  216 Time(s) 
gtimer.png
 Description   
 Filesize   5.56 KB
 Viewed   1182 Time(s)

gtimer.png


Last edited by jpeps on Wed 21 Aug 2013, 02:25; edited 1 time in total
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5813
Location: Valåmoen, Norway

PostPosted: Wed 21 Sep 2011, 03:42    Post subject:  

Make the gui scalable
>> Did you know that it is possible to make gtkdialog windows fully scalable? That means to be able to drag the window corner, and make the gui bigger.
As long as a <tree>, <table>, <list> or <edit> widget is enclosed ONLY by 1 <hbox> OR <vbox>, the widget will remain scalable both horizontally and vertically. Pfind, Pmusic and Pprocess uses various solutions of this.

>> We have of course a trick to scale more complex guis too...
A <hbox> or <vbox> supports the attribute; scrollable, which resets the hbox/vbox definition. You can enclose a widget by 1 <hbox/vbox> inside the scrollable box. The following example explains my words. Remove the scrollable attribute to see how it normally will act.
Code:
#!/bin/sh
export DIALOG='<window default_width="500" default_height="300">
<vbox>
 <text><label>How to scale a complex gui</label></text>
 <hbox scrollable="true">
  <edit></edit>
  <edit></edit>
 </hbox>
</vbox>
</window>'
gtkdialog -p DIALOG

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
2byte

Joined: 09 Oct 2006
Posts: 357

PostPosted: Sun 25 Sep 2011, 23:29    Post subject:  

Hi everyone,

I need some help please. I have tried to solve this for two days and I'm baffled. Using a tip from earlier in this thread this dialog was constructed with comments. Only in bash 4.1, I get this warning
“./Pupsave-backup: line 409: warning: here-document at line 305 delimited by end-of-file (wanted `EOV')”

Anyone have an idea how to eliminate that warning? BTW there is no line 409 in the script, 321 lines total.
Code:
 
#snip
#Some escapement is necessary when this sed is used to allow comments in gui.
export PUPSAVE_HOT_BKP=$(cat <<EOV | sed -e 's/#.*//'    # allow comments in gui
<window title="Hot Backup for Frugal Pups" icon-name="gtk-convert" default_width="400">
   <vbox>
      <frame>
         #Pupsave input section
         <text editable="false" use-markup="true" xalign="0.001">
            <label>"<span color='blue'>Pupsave file to backup</span>"</label>
         </text>
         <hbox>
            <entry editable="false">
               <variable>PUPSAVE_PATH</variable>
               <input>validate_fs "\$PUPSAVE_PATH"</input>
            </entry>
            <button>
               <input file stock="gtk-file"></input>
               <action type="fileselect">PUPSAVE_PATH</action>
            </button>
         </hbox>
         #Backup location section
         <text editable="false" use-markup="true" xalign="0.001">
            <label>"<span color='blue'>Save backup to /mnt/??</span>"</label>
         </text>
         <hbox>
            <entry editable="false" accept="directory">
               <variable>BKP_PATH</variable>
               <input>validate_bkp_location "\$BKP_PATH"</input>
            </entry>
            <button>
               <input file stock="gtk-open"></input>
               <action type="fileselect">BKP_PATH</action>
            </button>
         </hbox>
      </frame>
      #Information panel section
      <frame>
         <text editable="false" use-markup="true" xalign="0.001">
            <label>"<span color='blue'>Information</span>"</label>
         </text>
         #Disk MB required
         <text height-request="20" xalign="0.001">
            <variable>TEXT1</variable>
            <input>MBrequired "\$PUPSAVE_PATH"</input>
         </text>
         #Disk MB available
         <text height-request="20" xalign="0.001">
            <variable>TEXT2</variable>
            <input>MBavailable "\$BKP_PATH" "\$PUPSAVE_PATH"</input>
         </text>
         #Backup file name
         <text height-request="40" wrap="false" xalign="0.001">
            <variable>BKPFILE</variable>
            <input>Bkpfilename "\$PUPSAVE_PATH"</input>
         </text>
         <text height-request="40" wrap="false">
            <variable>PROG_PNL</variable>
            <input>P=\`cat "\$TMPFILE4"\`; echo \$P</input>
         </text>
      </frame>
      #Command buttons
      <hbox>
         <button help>
            <action>launch:HOT_BKP_HELP</action>
         </button>
         <button>
            <variable>BTNBKP</variable>
            <input file icon="gtk-save"></input>
            <label>Backup</label>
            <action>disable:BTNQUIT</action>
            <action>Backup "\$PUPSAVE_PATH" "\$BKP_PATH" &</action>
         </button>
         <button use-stock="true" label="gtk-quit" has-focus="true">
            <variable>BTNQUIT</variable>
            <action>EXIT:Exit</action>
         </button>
      </hbox>
      #Event handlers (semi-hidden progress bars)
      <hbox>
         <progressbar height-request="1" width-request="1">
            <input>psbtimer</input>
            <action>refresh:BKP_PATH</action>
            <action>refresh:PUPSAVE_PATH</action>
            <action>refresh:TEXT1</action>
            <action>refresh:TEXT2</action>
            <action>refresh:BKPFILE</action>
            <action>refresh:PROG_PNL</action>
         </progressbar>
         <progressbar height-request="1" width-request="1">      
            <input>PRG=\`pidof Pupsave-backup\`; while [ "\$PRG" > 0 ] ; do sleep 0.2; PRG=\`pidof Pupsave-backup\`; P=\`cat "\$TMPFILE"\`; if [ -x "\$TMPFILE" ];then echo "\$P"; fi; done</input>
            <action>enable:BTNQUIT</action>
            <action>echo 99 > "\$TMPFILE"</action>
         </progressbar>
         <progressbar height-request="1" width-request="1">
            <input>PRH=\`pidof Pupsave-backup\`; while [ "\$PRH" > 0 ] ; do sleep 0.2; PRH=\`pidof Pupsave-backup\`; P=\`cat "\$TMPFILE2"\`; if [ -x "\$TMPFILE2" ];then echo "\$P"; fi; done</input>
            <action>enable:BTNBKP</action>
         </progressbar>
         <progressbar height-request="1" width-request="1">
            <input>PRI=\`pidof Pupsave-backup\`; while [ "\$PRI" > 0 ] ; do sleep 0.2; PRI=\`pidof Pupsave-backup\`; P=\`cat "\$TMPFILE3"\`; if [ -x "\$TMPFILE3" ];then echo "\$P"; fi; done</input>
            <action>disable:BTNBKP</action>
         </progressbar>
      </hbox>
   </vbox>
   <action signal="hide">closewindow:HOT_BKP_HELP</action>
   <action signal="hide">exit:Exit</action>
</window>
EOV)

wgd=`which gtkdialog4`
#snip
 


Regards
2byte

_________________

Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4424

PostPosted: Mon 26 Sep 2011, 01:57    Post subject:  

i notice you are using EOV instead of EOF ... is that because an EOF is in one of your variables?

cat normally outputs until EOF (octal \004 ... it can be forced with echo -e "\004")

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
potong

Joined: 06 Mar 2009
Posts: 88

PostPosted: Mon 26 Sep 2011, 09:09    Post subject:  

2byte: "Sometimes it's hard to see the wood for the trees..."

Simplify the code by removing all the flesh and then add it bit by bit back on to the skeleton.
Code:
# export PUPSAVE_HOT_BKP=$(cat <<EOV | sed -e 's/#.*//'    # allow comments in gui
EOV)
# echo "$PUPSAVE_HOT_BKP"

# export PUPSAVE_HOT_BKP=$(cat <<EOV | sed -e 's/#.*//'    # allow comments in gui
<window title="Hot Backup for Frugal Pups" icon-name="gtk-convert" default_width="400">
EOV)
# echo "$PUPSAVE_HOT_BKP"
<window title="Hot Backup for Frugal Pups" icon-name="gtk-convert" default_width="400">
# export PUPSAVE_HOT_BKP=$(cat <<EOV | sed -e 's/#.*//'    # allow comments in gui
<window title="Hot Backup for Frugal Pups" icon-name="gtk-convert" default_width="400">
   <vbox>
EOV)
# echo "$PUPSAVE_HOT_BKP"
<window title="Hot Backup for Frugal Pups" icon-name="gtk-convert" default_width="400">
   <vbox>
#...
Of course there may be a problem in bash4.1?
Does this ring any bells?

If not maybe this may throw some light on the problem.

HTH

Potong
Back to top
View user's profile Send private message 
2byte

Joined: 09 Oct 2006
Posts: 357

PostPosted: Mon 26 Sep 2011, 11:45    Post subject:  

Thanks guys

potong, your links led to the solution.
Quote:
A here-document is supposed to be
terminated by a line containing the delimiter followed by a newline


The solution?
Code:

</window>
EOV
)


Sometimes the simplest things ...

_________________

Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5813
Location: Valåmoen, Norway

PostPosted: Sat 01 Oct 2011, 04:13    Post subject:  

Thunor has enlightened us with a huge speed improvement for complex guis. I have updated first post - Speed issues
______________________________________________________________________

>> For an unknown reason, it is much faster to start your gtkdialog-xml-code from a file than from a variable.
gtkdialog --file=filename
gtkdialog --program=variable
The file alternative is highly recommended if your xml-code is getting complex.

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
8-bit


Joined: 03 Apr 2007
Posts: 3398
Location: Oregon

PostPosted: Sat 01 Oct 2011, 05:02    Post subject:  

I hope I have it right, but I have written a gtkdialog script that uses a progress bar in its actions. It was written to restore 2byte's backed up pupsave files, but you can use it to copy a file to another destination.
I ran into a problem after uploading it and found that I had not allowed sufficient time for the copy to start and so a check of the destination file size failed and caused errors in the execution of the script.
Anyway, if you want to try it and see how I got a progress bar to work, just get the file from "Additional Software - utilities". It is under the heading of "Restore Pupsave file....".

I did this as a challenge as I had not seen any actual applications that used a progress bar.
The examples to me do not count because they only increment numbers to make the bar advance with no provision as to how one would use it in an application.
If it bombs for you, open the script in a text editor such as geany and increase the sleep value on line 25.
Back to top
View user's profile Send private message 
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Sat 01 Oct 2011, 11:33    Post subject:  

8-bit wrote:


I did this as a challenge as I had not seen any actual applications that used a progress bar.

petcheck has one, also swapfilemanager (although not a bar...just an animated graphic).
Back to top
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 888

PostPosted: Sat 01 Oct 2011, 17:13    Post subject:  

zigbert wrote:
Thunor has enlightened us with a huge speed improvement for complex guis. I have updated first post - Speed issues
______________________________________________________________________

>> For an unknown reason, it is much faster to start your gtkdialog-xml-code from a file than from a variable.
gtkdialog --file=filename
gtkdialog --program=variable
The file alternative is highly recommended if your xml-code is getting complex.


Anyone have a theory on how this could happen? Something using file i/o being faster than memory?

Wait... perhaps it's because Gtkdialog reloads the entire program whenever called, whereas - if from a file it's displayed immediately?

Cheers,
s
Back to top
View user's profile Send private message 
8-bit


Joined: 03 Apr 2007
Posts: 3398
Location: Oregon

PostPosted: Sat 01 Oct 2011, 22:02    Post subject:  

UPDATE!
The Restore Pupsave utility I uploaded may not handle just copying a file since it was written to remove the date-time from a backed up pupsave file.
It uses sed to remove the last 19 characters in the filename after the source path is removed.
I wanted to pass that along to all that try to use it to copy files.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 41 of 65 [961 Posts]   Goto page: Previous 1, 2, 3, ..., 39, 40, 41, 42, 43, ..., 63, 64, 65 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.1558s ][ Queries: 12 (0.0240s) ][ GZIP on ]