Page 39 of 42

Posted: Wed 03 Apr 2013, 05:23
by zigbert
Thunor
I tested the new column-resizable <tree> option, but could not get it to work.
I wonder, does this option require gtk3?

Image

Code: Select all

gtkdialog -v > /tmp/gtkdialog_input

echo '
<vbox>
 <tree column-resizable="false|false|false">
  <label>"First column|Second column|Third column"</label>
  <input file>/tmp/gtkdialog_input</input>
  <width>600</width>
 </tree>
</vbox>' | gtkdialog -s

Sigmund

Posted: Wed 03 Apr 2013, 09:18
by thunor
Hi Sigmund

Try column-resizeable. I've checked that it works in both gtk2/3 and it does.

Let me know how you get on because I can tweak things to a degree.

Regards,
Thunor

Posted: Wed 03 Apr 2013, 10:55
by zigbert
Okeeey, I see
...It works how you intended, but not the way I expected.... :)
The column is now not resizable, but it still auto-widen the column to fit content. As I understand it, gtk-tree-view-columns-autosize should handle this, - not the resizing done by the user.

This example should explain the difference between <tree> and <table>

Code: Select all

gtkdialog -v > /tmp/gtkdialog_input

echo '
<vbox>
 <tree column-resizeable="false|false|false">
  <label>"INPUT defines width of column|Second|Third"</label>
  <input file>/tmp/gtkdialog_input</input>
  <width>600</width>
 </tree>
 <table>
  <label>"HEADER defines width of column|Second|Third"</label>
  <input file>/tmp/gtkdialog_input</input>
 </table>
</vbox>' | gtkdialog -s

Sigmund

Posted: Wed 03 Apr 2013, 13:01
by thunor
@Sigmund

These are the column properties but you can't set them, I have to create custom tag attributes for them:
https://developer.gnome.org/gtk2/2.24/GtkTreeViewColumn.html#GtkTreeViewColumn.properties

I'll have a play with them and see if I can set the width by column header label rather than the contents of the row, or simulate it somehow.

Cheers

Posted: Thu 04 Apr 2013, 17:03
by zigbert
Thunor
I am hoping for the best.
This might sound like a minor issue, but the fact is that this behavior makes pMusic still choose <table> over <tree>. And keep in mind that using the <tree> widget would give icons, doubleclick and a right-click menu.

It must be mentioned that a secondary solution would be to update column width when the <tree> widget is updated. - So that the column width decreases if content has become narrower.


Thank you for your effort!
Sigmund

Posted: Sat 06 Apr 2013, 16:17
by zigbert
svn510
column-width works great :D
Thanks a lot


pMusic 4 - here we go
Sigmund

Posted: Sat 06 Apr 2013, 16:18
by thunor
@Sigmund

In revision 512:

column-sizing="mode|mode|mode|...".

This is a combination of the sizing and width properties:
  • If mode is 0 or "" then column grows as default (GTK_TREE_VIEW_COLUMN_GROW_ONLY)
  • If mode is 1 then column autosizes i.e. grows and shrinks (GTK_TREE_VIEW_COLUMN_AUTOSIZE)
  • If mode is >= 2 then column width is fixed to the value in mode (GTK_TREE_VIEW_COLUMN_FIXED)
Cheers,
Thunor

[EDIT] You posted just before I pressed Submit. I've tweaked it in r511. Anyway, I'm glad it works :)

Also, "Please note that GTK_TREE_VIEW_COLUMN_AUTOSIZE is inefficient for large views, and can make columns appear choppy".

I haven't documented it yet, wiki/reference update to follow.

[EDIT2] I've renamed it to column-sizing in r512 because it makes more sense naming it that way around.

Posted: Sat 06 Apr 2013, 17:42
by zigbert
Thunor
Great stuff, just a 'minor' issue...
Using single-click runs <action> when resizing column width.
Example should explain:

Code: Select all

gtkdialog -v > /tmp/gtkdialog_input

echo '
<vbox>
 <text><label>Using signal="button-release-event", action is executed when resizing column width</label></text>
 <tree column-sizing="50|1|1">
  <label>"First|Second|Third"</label>
  <input file>/tmp/gtkdialog_input</input>
  <action signal="button-release-event">gxmessage "hello" &</action>
 </tree>
</vbox>' | gtkdialog -s

Sigmund

Posted: Sat 06 Apr 2013, 21:56
by zigbert
Credits to thunor

Image

Posted: Sat 06 Apr 2013, 22:39
by thunor
zigbert wrote:...
Using single-click runs <action> when resizing column width.
...
Nice screenshot :) I just listened to Tor with the Hammer and I like that.

Are using the button-release-event for a menu? I guess you've gone to bed now but let me know what it is you are trying to achieve with this signal and then we might be able to work something out. You know you can't resize the columns with any other mouse button than 1?

This works fine if this is what you need:

Code: Select all

<action signal="button-release-event">[ $PTR_BTN -eq 3 ] && gxmessage "hello" &</action>
But you know that anyway so I guess it's not what you want.

Cheers,
Thunor

Posted: Sun 07 Apr 2013, 22:38
by thunor
murga-linux is alive! https://webchat.freenode.net/?channels=puppylinux was fun though :)

Posted: Mon 08 Apr 2013, 15:32
by zigbert
Thunor
pMusic will resize column-width nicely, as I have settled on selection-mode="3" for mulitple selections. But, it would also take benefit of a signal="button-release-event" (left-click) if that was possible without interfere with resizing column-width.


Sigmund

Posted: Mon 08 Apr 2013, 16:22
by zigbert
zigbert wrote:But, it would also take benefit of a signal="button-release-event" (left-click) if that was possible without interfere with resizing column-width.
Probably not, since single-click is dedicated to selection.


Sigmund

Posted: Mon 08 Apr 2013, 21:39
by thunor
My problem is that that's the way the widget is made and there's nothing that I can adjust anywhere.

In gtkdialog, when a widget is created it results in a widget pointer which is stored in an array. Signals are then connected-up, some unique to the widget plus many common signals which are actually part of the base class GtkWidget. The button-release-event signal is simply coming from the tree (GtkTreeView) widget (it's connected to the tree widget's pointer) and I can't modify where it gets emitted from.

Let me know how you get on. Maybe you're already doing it differently now.

Regards,
Thunor

Posted: Tue 09 Apr 2013, 15:57
by zigbert
Thunor
Nothing to bother about. Everything is working properly.


Thank you a lot for your cooperation!
Sigmund

Posted: Wed 10 Apr 2013, 21:48
by zigbert
Here is a minor issue:
Tooltip containing & fails

Code: Select all

#!/bin/sh

echo -e "1|2|3 - tooltip with & fails\n1|2|3 - tooltip " > /tmp/test

echo '
<window>
 <vbox>
  <tree tooltip-column="5" hover-selection="true">
   <label>1|2|tooltip column</label>
   <input file>/tmp/test</input>
  </tree>
 </vbox>
</window>
' | gtkdialog -s

Posted: Thu 11 Apr 2013, 00:08
by vovchik
Dear Zigbert,

Pango markup doesn't like ampersands, greater than or less than chars. To overcome that situation, just use &amp, followed by a semicolon.

With kind regards,
Vovchik

Posted: Thu 11 Apr 2013, 20:52
by thunor
& works for me (like HTML) -- GTK was warning me in the terminal too.

I've not used that property before. I'm impressed that you worked out it was column 5 i.e. gtkdialog maintains 3 hidden columns on the left for pixmap management :)

I imagine you could make some good use for tooltips in pMusic within the Music Sources Overview.

Regards,
Thunor

Posted: Thu 11 Apr 2013, 23:00
by thunor
Whilst I'm here:

In SVN now I've added a command-line option:

Code: Select all

GTK+ 2 build:

--styles=filename               Load styles in the form of a resource file.

GTK+ 3 build:

--styles=filename               Load styles in the form of a style sheet.
which takes either a gtkrc or a gtk.css file respectively. The usual GTK2_RC_FILES=$TEMP_DIR/gtkrc:~/.gtkrc-2.0 still works for GTK+ 2 but now directly loading it works too, so take your pick.

I've created a new action function called "loadstyles" which you would use like:

Code: Select all

<action>loadstyles:/path/to/some/gtk.css</action>
which works for GTK+ 3 and it should be possible with GTK+ 2 but I haven't got it to work yet, so at least currently with GTK+ 3 you can change styles at runtime :)

The example examples/eventbox/eventbox in SVN demonstrates how to detect the gtk version and pass the correct styles file (css is a lot easier than the original syntax).

I'm currently still going through the examples and testing them with GTK+ 3. All the examples will now pickup GTKDIALOG from the environment which makes my life easier at least because you can use

Code: Select all

GTKDIALOG=gtkdialog ./hbox_scrollable

or

GTKDIALOG=gtk3dialog ./hbox_scrollable
for example or just export it and then you won't have to keep declaring it.

So, what's next, qt4dialog, sdldialog :P Only joking although sdldialog would be pretty cool.

Cheers,
Thunor

Posted: Thu 11 Apr 2013, 23:31
by 01micko
thunor wrote:Whilst I'm here:.. [snip]
So, what's next, qt4dialog, sdldialog :P Only joking although sdldialog would be pretty cool.
Ha.. nearly suggested that one (a few pages back) given you have a good SDL background. :P

EDIT: however, most pups don't ship with SDL as standard. I did it in slacko for a bit more functionality ootb, at not a huge cost in terms of bloat.