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 Mon 24 Nov 2014, 20:38
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 36 of 55 [821 Posts]   Goto page: Previous 1, 2, 3, ..., 34, 35, 36, 37, 38, ..., 53, 54, 55 Next
Author Message
thunor


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

PostPosted: Fri 31 Aug 2012, 19:24    Post subject:  

r393:
  • Added the "selected-row" tag attribute to the table widget to enable selecting a default row on initialisation and refresh (the firing of signals can be prevented with "block-function-signals").
  • Added multiple selection mode to the table widget and updated the envvar export functions and removeselected action to cope with it.

Sigmund, I'll look into that issue. I'm pretty much done with the refactoring so you might want to try r393 as it'll be a while now before I commit the sorting code.

Forgot to mention: the signal handling works properly now, so you can play around with all the signals listed in examples/miscellaneous/signals.

Thanks.
Back to top
View user's profile Send private message Visit poster's website 
seaside

Joined: 11 Apr 2007
Posts: 887

PostPosted: Fri 31 Aug 2012, 20:14    Post subject:  

zigbert wrote:
Testing r390 and
<action>refresh:TABLE</action>
works great.

What I don't understand is why the following input file gives a 'Segmentation fault'?
Can anyone try it and see how it works on your system?

[code]#! /bin/bash

echo -e "

pmusic_rating|M O S T P L A Y E D (last month)
/mnt/sdb1/musikk/mp3/Ræva Rockers - Depp (LP).mp3| Ræva Rockers - Depp (LP).mp3| 11


zigbert,

Perhaps the character set "ae"

Cheers,
s
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: Fri 31 Aug 2012, 20:51    Post subject:  

It's segfaulting for me and I'm tracing it.
Back to top
View user's profile Send private message Visit poster's website 
thunor


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

PostPosted: Fri 31 Aug 2012, 22:03    Post subject:  

Fixed in r394.

A utility function needed fixing to cope with splitting a string into substantially fewer columns than the table widget was expecting. It's good that that was found.

Bedtime...
Back to top
View user's profile Send private message Visit poster's website 
zigbert


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

PostPosted: Sat 01 Sep 2012, 03:46    Post subject:  

I feel myself like a pain in the ass, but I really want the table widget to improve....

Made some tests with Selection-mode and <action signal="button-press-event">. Works very nice, and I can fulfill the dream of a mouse-right-menu Smile

Well, maybe not ... because speed (and cpu-usage) has became an issue. Here is an example script with 10000 rows in table. It shows up (fast), but when start clicking on items it feels like a freeze.... If I decrease it to 5000, it's like a turtle. 1000 rows works fine.
Code:
#! /bin/bash

echo -n > /tmp/input_table
for I in $(seq 1 1000); do
echo  "  /mnt/sdb1/musikk/mp3/Ræva Rockers - Depp (LP).mp3|    Ræva Rockers - Depp (LP).mp3| 11
  /mnt/sdb1/musikk/mp3/Black sabbath - Heaven and hell.mp3|    Black sabbath - Heaven and hell.mp3| 9
  /mnt/home/mp3_streamripper/RadioLive.no_top40_Norway_192/Alexis Jordan - Hush Hush.mp3|    Alexis Jordan - Hush Hush.mp3| 8
  /mnt/sdb1/musikk/mp3/Saint deamon - My heart.mp3|    Saint deamon - My heart.mp3| 7
  /mnt/sdb1/musikk/mp3/Dimmu borgir - Vredesbyrd.mp3|    Dimmu borgir - Vredesbyrd.mp3| 7
  /mnt/sdb1/musikk/flac/Candlemass - At the gallows end.flac|    Candlemass - At the gallows end.flac| 7
  /mnt/sdb1/musikk/mp3/Halvdan Sivertsen - Lonesome Traveller.mp3|    Halvdan Sivertsen - Lonesome Traveller.mp3| 7
  /mnt/sdb1/musikk/mp3/Dimmu borgir - Burn in hell.mp3|    Dimmu borgir - Burn in hell.mp3| 7
  /mnt/sdb1/musikk/mp3/Twisted sister - The beast.mp3|    Twisted sister - The beast.mp3| 5
  /mnt/sdb1/musikk/mp3/TNT - 10.000 lovers (in one).mp3|    TNT - 10.000 lovers (in one).mp3| 5" >> /tmp/input_table
done

func_button (){
   case $BUTTON in
   1) echo 'Mouse-button: Left' ;;
   2) echo 'Mouse-button: Middle' ;;
   3) echo 'Mouse-button: Right' ;;
   esac
}
export -f func_button

export MAIN_DIALOG='
 <vbox>
  <table selection-mode="3">
    <width>500</width><height>200</height>
    <variable>TABLE</variable>
    <label>"Column 1|Column 2                                               |Column 3"</label>
    <input file>/tmp/input_table</input>
    <action>echo $TABLE</action>
    <action signal="button-press-event">func_button</action>
  </table>
  <hbox>
   <button>
       <label>refresh</label>
       <action>clear:TABLE</action>
       <action>refresh:TABLE</action>
   </button>
  </hbox>
 </vbox>
'

gtkdialog --program=MAIN_DIALOG



Sigmund

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


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

PostPosted: Sat 01 Sep 2012, 06:37    Post subject:  

Fixed in r396.

That was a good problem solved because that would've been affecting other widgets such as the list, comboboxentry/text and tree.

gtkdialog has a system of exporting variables on a signal so you can do <action>echo $TABLE</action> and get the currently selected item(s). Also for the list, comboboxentry/text, table and tree it exports the entire contents of the widget in the *_ALL variable so for example <action>echo $TABLE_ALL</action>. Because I've collected together all the code fragments of the table widget and placed them together in their own file and connected them up, this performance issue has now been highlighted so I've disabled this *_ALL exporting feature. It may have been useful when gtkdialog was first created for making simple dialogs, but it's now time for it to die. I'll make sure those widgets have a save action function.

I haven't tried but I imagine this will greatly increase the performance of complex comboboxentry/text and tree widgets and possibly it may have been responsible for BarryK's comboboxentry speed issues a while back -- seems plausible.

[EDIT]
Of course if anybody is actually making use of the exported *_ALL variables then their applications will now break; they were printed to the terminal too on exit. I guess we'll just have to wait for somebody to lodge a complaint to find out Razz

Regards,
Thunor
Back to top
View user's profile Send private message Visit poster's website 
thunor


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

PostPosted: Sat 01 Sep 2012, 07:10    Post subject:  

zigbert wrote:
...I can fulfill the dream of a mouse-right-menu Smile
...

Have a look at examples/miscellaneous/press_and_release_events and change the <edit> widget at the top to a <table> and change its <default> directive to an <item>. You can get all sorts of information now, not just $BUTTON (equivalent to the new $PTR_BTN).
Back to top
View user's profile Send private message Visit poster's website 
zigbert


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

PostPosted: Sat 01 Sep 2012, 14:40    Post subject:  

Things are really getting good with the latest fixes.
<table> works like a charm. <tree> is much faster.

Quote:
Have a look at examples/miscellaneous/press_and_release_events
Now I see that mouse-click-position is available - that is really handy!!!

Quote:
Of course if anybody is actually making use of the exported *_ALL variables then their applications will now break; they were printed to the terminal too on exit. I guess we'll just have to wait for somebody to lodge a complaint to find out
Haven't seen much code using this, and as you say, it is easy to solve using savefile or grabbing input file.


This is really great work.
The downside is that I get heaps to do.....
Sigmund

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


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

PostPosted: Sat 01 Sep 2012, 14:56    Post subject:  

Thunor
If (hopefully when) you look at sorting in <table>, please consider to sort numbers not by char, but the whole number. Today the <tree> sorts column like this:
Code:
1
14
167890
2
2367
3
31
350



Thank you
Sigmund

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


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

PostPosted: Tue 04 Sep 2012, 12:59    Post subject:  

Updated the table widget

Gtk properties: GtkCList.properties
Widget reference: table widget
Example: examples/table/table

I'd say that my work updating the table widget is complete apart from dealing with the right mouse button which I'll come to in a moment.

Sorting works in the table widget and I've written a natural sort algorithm which can also be case insensitive. By default the data is unsorted but auto-sorting is possible on initialisation and when refreshing. I've modelled the column header clicking on the tree widget with a slight modification (see last two clicks of tree widget):

Code:

/* Table Widget Behaviour
 * ----------------------
 * Assuming that the default sort direction is ascending:
 *
 * Click column 0 and it'll sort ascending.
 * Click column 1 and it'll sort ascending.
 * Click column 1 and it'll sort descending having flipped.
 * Click column 0 and it'll sort descending.
 * Click column 1 and it'll sort descending.
 *
 * Tree Widget Behaviour
 * ---------------------
 * Assuming that the default sort direction is ascending:
 *
 * Click column 0 and it'll sort ascending.
 * Click column 1 and it'll sort ascending.
 * Click column 1 and it'll sort descending having flipped.
 * Click column 0 and it'll sort ascending.
 * Click column 1 and it'll sort ascending.
 */


Other useful features are locking of select column headers and hiding of select columns, therefore you can now hide data but still export it from that column e.g. show a filename, hide the fullpath.

Sigmund, there is a function gtk_clist_set_button_actions() that enables me to modify the behaviour of the right mouse button so do you want it to select an item in the same way as left-clicking? You can then read $PTR_BTN ($BUTTON) to check which button was used.

Regards,
Thunor

Last edited by thunor on Tue 04 Sep 2012, 20:43; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4378

PostPosted: Tue 04 Sep 2012, 13:35    Post subject:  

I played around with making a basic file/archive manager with gtkdialog, but stopped primarily because of sort - great news!
Smile

_________________
Web Programming - Pet Packaging 100 & 101
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 04 Sep 2012, 18:54    Post subject:  

technosaurus wrote:
I played around with making a basic file/archive manager with gtkdialog, but stopped primarily because of sort - great news!
Smile

Well, looking at XArchive I'd say that it would be possible to create an application of that complexity now. If you open XArchive, underneath the toolbar (buttons with relief="2" and some vseparators) you get a message about the wrappers in a scrolled window and if you open an archive you get a list so you could have a text widget in a scrollable box and a table and hide the widget you don't want Smile I think I'll have a look at the tree widget next and see if I can make that more useful/interesting.
Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4378

PostPosted: Tue 04 Sep 2012, 19:16    Post subject:  

thunor wrote:
technosaurus wrote:
I played around with making a basic file/archive manager with gtkdialog, but stopped primarily because of sort - great news!
Smile

Well, looking at XArchive I'd say that it would be possible to create an application of that complexity now. If you open XArchive, underneath the toolbar (buttons with relief="2" and some vseparators) you get a message about the wrappers in a scrolled window and if you open an archive you get a list so you could have a text widget in a scrollable box and a table and hide the widget you don't want Smile I think I'll have a look at the tree widget next and see if I can make that more useful/interesting.
yes, exactly ... A combo of xarchive and pprocess using techniques similar to rodent and gentoo file managers for file ops, although I don't recall if there was a way to get the content of rows on a multiple selection... Seems like maybe it only gave 1 row and only the 1st field.
_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
zigbert


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

PostPosted: Wed 05 Sep 2012, 02:39    Post subject:  

Thunor wrote:
Sigmund, there is a function gtk_clist_set_button_actions() that enables me to modify the behaviour of the right mouse button so do you want it to select an item in the same way as left-clicking? You can then read $PTR_BTN ($BUTTON) to check which button was used.
The way I think, it would be good if right clicks did NOT affect selection. I want right-click to show a menu, and now it also select the given item - that means it 'deselect' an existing multiple selection.

Else I must say the new table-stuff looks awesome. Before I start working in depth with it, I try to figure out a strategy how to actually set up the next version pMusic. Your improvements to gtkdialog opens up a new world of opportunities.


Thank you
Sigmund

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


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

PostPosted: Wed 05 Sep 2012, 03:12    Post subject:  

I have done some sorting i the <table> Smile

Sort-functions 1 and 2 (strnatcmp, strcasenatcmp) is better with numbers, but still there is an issue.

testresult:
Code:
1
2
3
..
01
02
03
..
11
12
13
..
21
22
23


Is it possible to get
Code:
1
01
2
02
3
03
..
11
12
13
..
21
22
23



Sigmund

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 36 of 55 [821 Posts]   Goto page: Previous 1, 2, 3, ..., 34, 35, 36, 37, 38, ..., 53, 54, 55 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
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.1168s ][ Queries: 12 (0.0164s) ][ GZIP on ]