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 Thu 27 Nov 2014, 01:44
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
Gtkdialog Development
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 18 of 55 Posts_count   Goto page: Previous 1, 2, 3, ..., 16, 17, 18, 19, 20, ..., 53, 54, 55 Next
Author Message
8-bit


Joined: 03 Apr 2007
Posts: 3393
Location: Oregon

PostPosted: Tue 30 Aug 2011, 01:56    Post_subject:
Sub_title: My incomplete version of a masked file selection list
 

I did a bit to get this to work.
But It would need two functions to select the directory and the mask to use.

It may already have been done and no one has shown an example using the fileselect widget. When I get the functions competed, I may share it.

Code:

#! /bin/sh
#This is how far I got creating a masked file list.
# If one adds an entry box to select the directory and another to select the mask with variables, they can be
#passed to a function that writes a masked selection to /tmp/myfiles.txt
#This is only a start, and with a file mask widget, one would not have to jump through hoops to display
# a masked file list.




GTKDIALOG=gtkdialog
cd /root/examples #select the directory
ls t* >/tmp/myfiles.txt #pick mask to use with ls
window_width=300
icon_names=(echo $(</tmp/myfiles.txt))

lstCreate() {
      echo '<list>'
      for ((y = 0; y < 15; y++)); do
         i=$((x*15*2+y*2+1))
         echo '<item>"'${icon_names[$i]}'"</item>'
         
      done
      echo '</list>'
}

export lstCreate
export MAIN_DIALOG='
<window title="File MASK Test" width-request="'$window_width'"
   border-width="0" resizable="false">
   <hbox>
         '"$(lstCreate)"'
   </hbox>
</window>
'
gtkdialog3 -p MAIN_DIALOG
Back to top
View user's profile Send_private_message 
01micko


Joined: 11 Oct 2008
Posts: 7841
Location: qld

PostPosted: Tue 30 Aug 2011, 03:04    Post_subject:  

zigbert wrote:

Mick, uhhhmmmm......... Laughing
You missed something important. The labels in your screenshot are limited to the gtk-stock labels. ie. Pmusic uses its own definition of 'Undo' --> 'Go back in playlist history'.

All this is of course fixed in Pmusic 2.0.1 Smile


Sigmund


Doh! yes.. thickness disease.. Razz

i got it now though.. this is a case where -ltr is useful ..
got-it.png
 Description   
 Filesize   6.33 KB
 Viewed   647 Time(s)

got-it.png


_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send_private_message Visit_website 
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Tue 30 Aug 2011, 04:32    Post_subject:
Sub_title: My incomplete version of a masked file selection list
 

8-bit wrote:

It may already have been done and no one has shown an example using the fileselect widget. When I get the functions competed, I may share it.


http://murga-linux.com/puppy/viewtopic.php?t=69188&start=214
Back to top
View user's profile Send_private_message 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Tue 30 Aug 2011, 06:29    Post_subject:  

01micko wrote:
Doh! yes.. thickness disease.. Razz

i got it now though.. this is a case where -ltr is useful ..

Mick

Can you show me the code for those two menuitems please. I'm just interested to know what you are doing with "-ltr".

Regards,
Thunor
Back to top
View user's profile Send_private_message Visit_website 
01micko


Joined: 11 Oct 2008
Posts: 7841
Location: qld

PostPosted: Tue 30 Aug 2011, 06:37    Post_subject:  

Thunor.. you just caught me! (off to bed)

here is my hack: (due respect to Sigmund)
Code:
<menuitem icon="gtk-undo-ltr" accel-key="0x07a" accel-mods="4">
  <label>'$LOC118'</label>
  <action>. '$APPDIR'/func -undo</action>
  <action>refresh:PLAYLIST</action>
 </menuitem>
 <menuitem icon="gtk-redo-ltr" accel-key="0x079" accel-mods="4">
  <label>'$LOC119'</label>
  <action>. '$APPDIR'/func -redo</action>
  <action>refresh:PLAYLIST</action>
 </menuitem>'


Make sense?

Cheers.. Smile

_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send_private_message Visit_website 
8-bit


Joined: 03 Apr 2007
Posts: 3393
Location: Oregon

PostPosted: Tue 30 Aug 2011, 07:25    Post_subject:  

In my case, "Severe case of thickness disease" Embarassed
Or "My brain must have went on vacation." Embarassed

But after looking closely at the code in the Fileselect example,
the light showed through and I got my brain back! Smile
Back to top
View user's profile Send_private_message 
zigbert


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

PostPosted: Tue 30 Aug 2011, 09:56    Post_subject:  

The latest gtkdialog has changed the behavior of the fileselect function. Before I go through all my scripts, I will ensure that this is intended behavior or an issue for gtkdialog.

The following code used to work, but now it fails because of the line <action>refresh:SEARCHPATHS</action> which is not necessary, and leads to no action of the fileseletion.

Code:
     <hbox>
      <entry accept="directory">
       <variable>SEARCHPATHS</variable>
       <input>echo '$SEARCHPATHS'</input>
      </entry>
      <button>
       <input file stock="gtk-open"></input>
       <action type="fileselect">SEARCHPATHS</action>
       <action>refresh:SEARCHPATHS</action>
      </button>
     </hbox>
Could this be solved in gtkdialog to keep backwards compatibility, or should I update my scripts?


Regards
Sigmund

btw, what exactly does the -ltr mean?

_________________
Stardust resources
Back to top
View user's profile Send_private_message Visit_website 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Tue 30 Aug 2011, 11:25    Post_subject:  

zigbert wrote:
The latest gtkdialog has changed the behavior of the fileselect function.
...
btw, what exactly does the -ltr mean?

Investigating...

Internationalisation: left-to-right and right-to-left writing.

Mick's menuitems are wrong as you're probably aware. I'll break the bad news to him when he wakes up Wink

Regards,
Thunor
Back to top
View user's profile Send_private_message Visit_website 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Tue 30 Aug 2011, 12:02    Post_subject:  

Sigmund

Unfortuntely it's not a complete working example so I'll have to guess what you are doing.

I think that you are using the shell variable $SEARCHPATHS at XML construction time to initialise the entry widget with saved data from a previous session.

Then you press the button to select a file which will be auto-inserted into the entry widget and then you refresh the entry widget with whatever value was in the shell variable $SEARCHPATHS at XML construction time!

It does what is expected, but the unnecessary refresh is wiping out the filename from the fileselect function.

Regards,
Thunor
Back to top
View user's profile Send_private_message Visit_website 
8-bit


Joined: 03 Apr 2007
Posts: 3393
Location: Oregon

PostPosted: Tue 30 Aug 2011, 12:15    Post_subject:  

thunor,
run this from a terminal with the updated gtkdialog3.
enter a directory path and after clicking open and then click cancel twice. You will see that $SEARCHPATHS returns a null string.
Then try it with the original gtkdialog3 and you will see $SEARCHPATHS has a string.
Code:

#! /bin/bash
export MAIN_DIALOG='
     <hbox>
      <entry accept="directory">
       <variable>SEARCHPATHS</variable>
       <input>echo '$SEARCHPATHS'</input>
      </entry>
      <button>
       <input file stock="gtk-open"></input>
       <label>open</label>
       <action type="fileselect">SEARCHPATHS</action>
       <action>refresh:SEARCHPATHS</action>
      </button>
      <button cancel></button>
     </hbox>
'

gtkdialog3 --program=MAIN_DIALOG
Back to top
View user's profile Send_private_message 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Tue 30 Aug 2011, 12:25    Post_subject:  

Looking now...
Back to top
View user's profile Send_private_message Visit_website 
zigbert


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

PostPosted: Tue 30 Aug 2011, 12:31    Post_subject:  

Thunor
Sorry that I didn't gave you an executable example. I'll put that in mind.

But you got it right, and I understand your explanation, - it's just that (as 8-bit shows) it used to work, but not anymore......

I'll start updating my scripts......


Thank you
Sigmund

_________________
Stardust resources
Back to top
View user's profile Send_private_message Visit_website 
8-bit


Joined: 03 Apr 2007
Posts: 3393
Location: Oregon

PostPosted: Tue 30 Aug 2011, 12:51    Post_subject:  

zigbert,
I may not have got everything right trying to create an executable script from your example, but I tried.
Anyway, since I kept a copy of the old gtkdialog3 and renamed it "old_gtkdialog3" in /usr/sbin all I had to do was change the gtkdialog3 at the end of the script to old_gtkdialog3 to check with the old version.
Back to top
View user's profile Send_private_message 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Tue 30 Aug 2011, 13:04    Post_subject:  

I now know why that worked, but I fixed it back r219.

There are some fundamental functions that were bugged (they weren't reentrant) and this resulted in iterating through a list of actions being prematurely terminated. In your example using the old gtkdialog3 0.7.20 Patriot Edition, the refresh action wouldn't get executed because the fileselect function would terminate the action list.

Place "<action>echo This fails to execute</action>" below the fileselect action and you'll see that now it gets executed but before it wouldn't. Making the functions reentrant stopped the corruption of the action list.

Regards,
Thunor
Back to top
View user's profile Send_private_message Visit_website 
zigbert


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

PostPosted: Tue 30 Aug 2011, 13:24    Post_subject:  

I have updated my scripts, so this should now be an unexisting issue.
_________________
Stardust resources
Back to top
View user's profile Send_private_message Visit_website 
Display_posts:   Sort by:   
Page 18 of 55 Posts_count   Goto page: Previous 1, 2, 3, ..., 16, 17, 18, 19, 20, ..., 53, 54, 55 Next
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Advanced Topics » Cutting edge
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.1062s ][ Queries: 13 (0.0141s) ][ GZIP on ]