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 Sun 23 Nov 2014, 13:22
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
keeping the 'selected-row' when refreshing a <tree> list
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [5 Posts]  
Author Message
sc0ttman


Joined: 16 Sep 2009
Posts: 2386
Location: UK

PostPosted: Sat 01 Feb 2014, 21:42    Post subject:  keeping the 'selected-row' when refreshing a <tree> list
Subject description: ... I fail (pretty much) every time!
 

I am using code based on this popup right click menu: http://murga-linux.com/puppy/viewtopic.php?p=448176#448176

I have a GUI with a <tree> in it .. when i select an item in the tree, a popup menu (another gtkdialog menu) is called, and when it's done, i want the tree selection to remain the same in the 1st (main) GUI... currently the selection goes back to the top ...

I have got as far as recording the line number in a file, and when I quit the GUI and start it up again, it works ... but not when I double click a tree item, do stuff, and refresh it...

... essentially, i get the line number of the chosen tree item (in a dumb hacky way), then write it to a file, and hope the selected-row property will pick it up... which it does, but only after a full restart of the GUI ... I want it to work when the tree is refreshed.. I have it set to auto-refresh, so I though it should work...


snippet:
Code:
    <tree selected_row="'`cat /tmp/lineno`'" auto_refresh="true" has_focus="true" hover_selection="false" column-sort-function="0|0|1|1">
       <label>'$TREE_LABELS'</label>
       <height>'$HEIGHT_TREE'</height>
      <variable>CHOOSER</variable>
       <input icon_column="0">cat "'$WORKDIR'/ls"</input>
      ## the cursor-changed signal will refresh INFO using joypad navigation of rom list
      <action signal="button-release-event">enable: PLAYNOW</action>
      <action signal="cursor-changed">filecheck</action>
      <action signal="cursor-changed">refresh:INFO</action>
      <action signal="cursor-changed">refresh:BOXART</action>
      <action>export lineno=`cat "'$WORKDIR'/files" | grep -F -B2000 "${CHOOSER}" | wc -l`; echo $lineno > /tmp/lineno</action>
       <action>browser_change_dir</action> ## I M P O R T A N T
       <action>refresh:CHOOSER</action>
       <action>refresh:DIR</action>
    </tree>


.... Also, on a side note, why doesnt this ..

Code:
export lineno=`cat "'$WORKDIR'/files" | grep -F -B2000 "${CHOOSER}" | wc -l`; echo $lineno > /tmp/lineno


work the same as this..

Code:
export lineno=`grep -F -B2000 "${CHOOSER} "'$WORKDIR'/files" | wc -l`; echo $lineno > /tmp/lineno



..?? ... the first will successfully write the line number to a file, the second will not ...

_________________
Akita Linux, VLC-GTK, Pup Search, Pup File Search
Back to top
View user's profile Send private message 
some1

Joined: 17 Jan 2013
Posts: 34

PostPosted: Wed 05 Feb 2014, 12:14    Post subject:  

Hi
Quote:

?? ... the first will successfully write the line number to a file, the second will not ...

Looks like a quote got lost in translation..Rolling Eyes
CHOOSER ate it -or whatever.
Cheers
Back to top
View user's profile Send private message 
sc0ttman


Joined: 16 Sep 2009
Posts: 2386
Location: UK

PostPosted: Sun 09 Feb 2014, 12:10    Post subject:  

I've made a bit of progress, although I have not achieved the results I want...


I can do 1 of two things:


1. If I remove the <action>refresh:CHOOSER</action> then the current line remains selected after executing it... However, the auto update of infomation in the tree becomes disabled..

2. If I keep the <action>refresh:CHOOSER</action>, then the current line does NOT remain selected after executing it - the selection returns to whatever it as defined as when the GUI first loaded up... Although keeping the refresh:CHOOSER does re-enable the auto-refresh of each entry in the tree, when I update the details..


So... How can I keep the selected item AND keep auto-update the tree enabled??

Any gktdialog experts wanna point me in the right direction?

_________________
Akita Linux, VLC-GTK, Pup Search, Pup File Search
Back to top
View user's profile Send private message 
sc0ttman


Joined: 16 Sep 2009
Posts: 2386
Location: UK

PostPosted: Wed 12 Feb 2014, 05:01    Post subject:  

How can I keep the selected item and ALSO auto-update the tree when i execute one of its items in the list??

Any ideas people??? I really wanna get past this....


Or, Is this a limitation of gtkdialog?? Question

_________________
Akita Linux, VLC-GTK, Pup Search, Pup File Search
Back to top
View user's profile Send private message 
SFR


Joined: 26 Oct 2011
Posts: 1098

PostPosted: Wed 12 Feb 2014, 15:14    Post subject:  

From what I've experienced, only stuff within <input></input> and <input file></input> can be refreshed/changed on-the-fly, therefore all other parameters (like tag attributes, e.g. selected-row=...) remain static once window gets created.

Don't know if this suits your purposes, but perhaps take a look at Ziggy's Pmusic - he has resolved the problem with <tree> refreshing quite cleverly, using an icon to indicate currently selected item in the playlist.

Just launch Pmusic (v4.2.1 here), add some tracks to the playlist and examine /root/.pmusic/tmp/xml_pmusic (part of code that starts with <tree name="playlist") and /root/.pmusic/tmp/playlist.

HTH
Greetings!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [5 Posts]  
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.0710s ][ Queries: 12 (0.0158s) ][ GZIP on ]