Gtkdialog Development

Under development: PCMCIA, wireless, etc.
Message
Author
User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#526 Post by thunor »

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.

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#527 Post by seaside »

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: Select all

#! /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 [/quote]

zigbert,

Perhaps the character set "ae"

Cheers,
s

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#528 Post by thunor »

It's segfaulting for me and I'm tracing it.

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#529 Post by thunor »

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...

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#530 Post by zigbert »

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 :)

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: Select all

#! /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

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#531 Post by thunor »

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 :P

Regards,
Thunor

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#532 Post by thunor »

zigbert wrote:...I can fulfill the dream of a mouse-right-menu :)
...
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).

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#533 Post by zigbert »

Things are really getting good with the latest fixes.
<table> works like a charm. <tree> is much faster.
Have a look at examples/miscellaneous/press_and_release_events
Now I see that mouse-click-position is available - that is really handy!!!
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

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#534 Post by zigbert »

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: Select all

1
14
167890
2
2367
3
31
350

Thank you
Sigmund

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#535 Post by thunor »

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: Select all

/* 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 Wed 05 Sep 2012, 00:43, edited 1 time in total.

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#536 Post by technosaurus »

I played around with making a basic file/archive manager with gtkdialog, but stopped primarily because of sort - great news!
:)
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#537 Post by thunor »

technosaurus wrote:I played around with making a basic file/archive manager with gtkdialog, but stopped primarily because of sort - great news!
:)
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 :) I think I'll have a look at the tree widget next and see if I can make that more useful/interesting.

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#538 Post by technosaurus »

thunor wrote:
technosaurus wrote:I played around with making a basic file/archive manager with gtkdialog, but stopped primarily because of sort - great news!
:)
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 :) 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.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#539 Post by zigbert »

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

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#540 Post by zigbert »

I have done some sorting i the <table> :)

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

testresult:

Code: Select all

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

Code: Select all

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

Sigmund

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#541 Post by thunor »

r407:
  • Fixed leading zero issue with strnatcmp.
  • Added the "freeze-thaw" tag attribute to the table widget to stop rendering when adding data and to resume rendering when finished.
  • Added save action function support to the tree widget.
Test data:

Code: Select all

<item>"0 |0|00| 0"</item>
<item>"1|01| 1|1 "</item>
<item>"02| 2|2 |2"</item>
<item>" 3|3 |3|03"</item>
<item>"4 |4|04| 4"</item>
<item>"10|010| 10|10 "</item>
Attachments
strnatcmp1.png
(2.96 KiB) Downloaded 768 times

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#542 Post by zigbert »

Fixed leading zero issue with strnatcmp.
Wonderful!

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#543 Post by 01micko »

Couple of Q's

@thunor

1) Approxamately, how far will you go in this dev cycle? (I guess until you are tired of it :wink: )

2) Do you think much, if any, backward compatibility will be broken? (apart from bad code)

@ziggy

Slackware14 is knocking on the door, next Slacko will be a month or so behind. What obstacles do you see in including the latest rev at the time in the next beta?

-

TIA guys
Puppy Linux Blog - contact me for access

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#544 Post by zigbert »

Mick
What obstacles do you see in including the latest rev at the time in the next beta?
No one. :twisted:

Thunor has removed the *_ALL variable at exit, which sure breaks backward compatibility. But I don't know any script using it, so go johnny, go go go.

I don't plan any new releases that depends on gtkdialog 0.8.1 in the nearest future. It would be great if Slacko had 0.8.1, so later updates of the pSeries would be smooth. I see slacko has ffmpeg 0.11 which supports tagging of albumart into the audiofile. Maybe pMusic 3 will take advantage of that. Let's see. pMusic 3 will not be ready in 1 month. - For sure.

Looking forward to a new Slacko !!!


Sigmund

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#545 Post by thunor »

01micko wrote:1) Approxamately, how far will you go in this dev cycle? (I guess until you are tired of it :wink: )

2) Do you think much, if any, backward compatibility will be broken? (apart from bad code)
1) When it turns into a chore is a good time to stop :P but I'm still having fun and there's not much left I want to add/fix at this time. I might've finished with it in a week so I'll make an 0.8.2 source package release and it would be nice if you could build that for inclusion into slacko.

2) The *_ALL envvars that were being exported were ruining widgets that contained lots of data so I've disabled that but it's not being used in any examples and I'm not sure anyone even knows about it. I haven't changed the default behaviour of anything or fixed something that could cause erroneously written apps to break so I can't see that there'll be a problem.

Cheers Mick.

Post Reply