Gtkdialog Development
doublecheck - Slacko 5.3.2.10
version 375 - OK (well, <input file> didn't work )
version 388 - Segmentation fault
version 375 - OK (well, <input file> didn't work )
version 388 - Segmentation fault
Code: Select all
# ./table
./table: line 23: 3174 Segmentation fault gtkdialog --program=MAIN_DIALOG
- thunor
- Posts: 350
- Joined: Thu 14 Oct 2010, 15:24
- Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
- Contact:
Thanks for testing guys
I've just commited r390 and I've:
I won't interfere with its current behaviour. Refreshing currently adds items to the list and if you want to clear it beforehand then you can use the clear action. I won't interfere with the selected item on refresh either. I think it would be useful to have a tag attribute that enables the auto-selection of a particular row on refresh which will fire a select-row signal and you can disable that using block-function-signals. This way the current behaviour remains unaffected but you've got the option to modify it.
Using Sigmund's example code you can also try the "exported-column" and "selection-mode" tag attributes and add some buttons at the bottom for the clear and removeselected actions.
I'll code multiple selection mode later tonight.
Cheers.
I've just commited r390 and I've:
- Fixed the table widget's signal and action handling issues.
- Added "exported-column" support to the table widget.
- Added initial "selection-mode" support to the table widget but not yet multiple selection mode.
I won't interfere with its current behaviour. Refreshing currently adds items to the list and if you want to clear it beforehand then you can use the clear action. I won't interfere with the selected item on refresh either. I think it would be useful to have a tag attribute that enables the auto-selection of a particular row on refresh which will fire a select-row signal and you can disable that using block-function-signals. This way the current behaviour remains unaffected but you've got the option to modify it.
Using Sigmund's example code you can also try the "exported-column" and "selection-mode" tag attributes and add some buttons at the bottom for the clear and removeselected actions.
I'll code multiple selection mode later tonight.
Cheers.
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?
<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
/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
/mnt/home/mp3_streamripper/Radio3 Norge/Morten Harket - Lightning.mp3| Morten Harket - Lightning.mp3| 5
/mnt/home/mp3_streamripper/RadioLive.no_top40_Norway_192/Rihanna - Roc Me Out.mp3| Rihanna - Roc Me Out.mp3| 4
/mnt/sdb1/musikk/mp3/Rihanna - Rehab.mp3| Rihanna - Rehab.mp3| 4
/mnt/sdb1/musikk/mp3/Ræva Rockers - Lille Lenin (LP).mp3| Ræva Rockers - Lille Lenin (LP).mp3| 4
/mnt/sdb1/musikk/mp3/Morten Harket - Just believe it.mp3| Morten Harket - Just believe it.mp3| 4
/mnt/sdb1/musikk/mp3/Twisted sister - Love is for suckers.mp3| Twisted sister - Love is for suckers.mp3| 3
/mnt/home/mp3_streamripper/RadioLive.no_top40_Norway_192/Rihanna - Where You Been.mp3| Rihanna - Where You Been.mp3| 3
/mnt/sdb1/musikk/mp3/Judas priest - Parental guidance (LP).mp3| Judas priest - Parental guidance (LP).mp3| 3
/mnt/sdb1/musikk/mp3/Nightwish - Bye bye beautiful.mp3| Nightwish - Bye bye beautiful.mp3| 3
/mnt/sdb1/musikk/mp3/TNT - Everyone's a star.mp3| TNT - Everyone's a star.mp3| 3
/mnt/sdb1/musikk/mp3/TNT - Knights of the thunder.mp3| TNT - Knights of the thunder.mp3| 3
/mnt/sdb1/musikk/flac/Candlemass - Samarithan.flac| Candlemass - Samarithan.flac| 3
/mnt/home/mp3_streamripper/100HitRadio_top40_USA_128/Cher Lloyd - Want U Back.mp3| Cher Lloyd - Want U Back.mp3| 3
/mnt/sdb1/musikk/mp3/Morten Harket - Out of my hands.mp3| Morten Harket - Out of my hands.mp3| 3
/mnt/sdb1/musikk/mp3/Twisted sister - Destroyer.mp3| Twisted sister - Destroyer.mp3| 2
/mnt/sdb1/musikk/mp3/Nightwish - For the heart I once had.mp3| Nightwish - For the heart I once had.mp3| 2
/mnt/sdb1/musikk/mp3/Savatage - Dead winter dead.mp3| Savatage - Dead winter dead.mp3| 2
/mnt/sdb1/musikk/mp3/Bertine Zetlitz - Adore me.mp3| Bertine Zetlitz - Adore me.mp3| 2
/mnt/sdb1/musikk/mp3/TNT - Tell no tales.mp3| TNT - Tell no tales.mp3| 2
/mnt/home/mp3_streamripper/RadioLive.no_top40_Norway_192/Jenny Langlo - Million Dollar Signs.mp3| Jenny Langlo - Million Dollar Signs.mp3| 2
" > /tmp/input_table
export MAIN_DIALOG='
<vbox>
<table>
<width>500</width><height>200</height>
<variable>TABLE</variable>
<label>"Column 1|Column 2|Column 3|column 4 |column 5 "</label>
<input file>/tmp/input_table</input>
<action>echo $TABLE</action>
</table>
<hbox>
<button ok></button>
<button>
<label>refresh</label>
<action>clear:TABLE</action>
<action>refresh:TABLE</action>
</button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG
- thunor
- Posts: 350
- Joined: Thu 14 Oct 2010, 15:24
- Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
- Contact:
r393:
Forgot to mention: the signal handling works properly now, so you can play around with all the signals listed in examples/miscellaneous/signals.
Thanks.
- 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.
Forgot to mention: the signal handling works properly now, so you can play around with all the signals listed in examples/miscellaneous/signals.
Thanks.
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
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.
Sigmund
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
- thunor
- Posts: 350
- Joined: Thu 14 Oct 2010, 15:24
- Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
- Contact:
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
Regards,
Thunor
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
Regards,
Thunor
- thunor
- Posts: 350
- Joined: Thu 14 Oct 2010, 15:24
- Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
- Contact:
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).zigbert wrote:...I can fulfill the dream of a mouse-right-menu
...
Things are really getting good with the latest fixes.
<table> works like a charm. <tree> is much faster.
This is really great work.
The downside is that I get heaps to do.....
Sigmund
<table> works like a charm. <tree> is much faster.
Now I see that mouse-click-position is available - that is really handy!!!Have a look at examples/miscellaneous/press_and_release_events
Haven't seen much code using this, and as you say, it is easy to solve using savefile or grabbing input file.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
This is really great work.
The downside is that I get heaps to do.....
Sigmund
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:
Thank you
Sigmund
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
- thunor
- Posts: 350
- Joined: Thu 14 Oct 2010, 15:24
- Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
- Contact:
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):
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
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.
*/
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.
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
- thunor
- Posts: 350
- Joined: Thu 14 Oct 2010, 15:24
- Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
- Contact:
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.technosaurus wrote:I played around with making a basic file/archive manager with gtkdialog, but stopped primarily because of sort - great news!
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
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.thunor wrote: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.technosaurus wrote: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].
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.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.
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
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:
Is it possible to get
Sigmund
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
Code: Select all
1
01
2
02
3
03
..
11
12
13
..
21
22
23
Sigmund