Page 40 of 42

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.

Posted: Fri 12 Apr 2013, 00:30
by thunor
01micko wrote: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.
I wrote an SDL engine a few years back but it became one of those projects that never gets finished for one reason or another (Tetravex works though as long as you stay away from the unfinished high score entry) and I've been thinking about recycling it :) Anyway, just an idea I've got whizzing around.

Yeah, I liked having the full SDL monty with Slacko 5.5 because normally what I do is download all the SDL source packages and dependencies and create my own pets but I was mostly spared that, which was nice. It was in fact the default presence of those libraries that got me thinking.

What other lightweight toolkits does Puppy include? I've got flsynclient so there must be fltk I guess. I don't really know much about it. I'm just thinking out loud.

Time to get some sleep anyway, cheers,
Thunor

Posted: Mon 15 Apr 2013, 15:51
by zigbert
vovchik wrote:Pango markup doesn't like ampersands, greater than or less than chars. To overcome that situation, just use &amp, followed by a semicolon.
Thank you for the knowledge.


Sigmund

Posted: Mon 15 Apr 2013, 15:52
by zigbert
thunor wrote:I imagine you could make some good use for tooltips in pMusic within the Music Sources Overview.
Already there :)


Sigmund

Posted: Thu 18 Apr 2013, 14:53
by Karl Godt
Just a short catchup :
Have compiled gtkdialog-0.7.20-21-r83 from bk sources and 0.8.2 from google code
on Puppy derivate having gtk-2.16.1 :
svg icons don't work for me , showing the icon for not available ( paper with X ) .

Path to the svg is there and inscapelite opens and shows shows the created svg .

ls /usr/lib/librsvg*
/usr/lib/librsvg-2.a /usr/lib/librsvg-2.la /usr/lib/librsvg-2.so /usr/lib/librsvg-2.so.2 /usr/lib/librsvg-2.so.2.22.3

:?:

Posted: Thu 18 Apr 2013, 20:48
by technosaurus
IIRC there was a problem displaying svg that ended up being related to glib - I think Jemimah finally tracked it down

[SOLVED] Svg not displayed in gtkdialog 3 and 4

Posted: Thu 18 Apr 2013, 23:51
by Karl Godt
hmmm, it works on Puppeee, though the build is slightly different. Can someone on 4.3.1 check? I think Ttuuxxx updated the gtk on Puppies, and forgot SVG support or something because I've had other problems with tray applets on Puppies in the past.
Fond the above : Goggles Music Manager
http://murga-linux.com/puppy/viewtopic. ... 260#409260

And it's true , runtt21 used a 432 devx by ttuuxxx for Macpup Foxy 3 . Opera 2 has gtk2-14.7 but i have put in the 16.1 from F3 so geany shows the delete icon-button in the find entry line . Will check things out !

Cheers !

EDIT:
Have compiled 0.8.2 with the 14.7 default gtk-2 libraries of Puppy-4.3.1 and svg works now for latest woof2 partview . technosaurus, thank you very much !
/EDIT

Posted: Sun 28 Apr 2013, 08:01
by simargl
.

Posted: Tue 30 Apr 2013, 19:00
by zigbert
Working with pMusic 4, I have met some issues with the latest gtkdialog. I wouldn't call them bugs as things may work as expected. On the other hand, I see no reason for not mention, and maybe one or two could easily be 'fixed'.

vbox / hbox
If scrollable="true". I am not able to get use of space-expand="true" space-fill="true" to expand width.
I have to use <window width-request="300">, but this a not the best solution if someone uses a longer NLS-string.

Improving my template for a right-click menu, I wanted to add a frame. But the <frame> widget is both not complete (always a gap for label), and takes a lot of place since I am not able to set spacing, I looked at the scrollable vbox. This one accepts both spacing and different shadow-types...

This is basically how the right-click menu looks like. Here is scrollable set to true, so window won't expand to show the complete label.

Code: Select all

echo '<window decorated="false" skip_taskbar_hint="true" resizable="false" height-request="40" modal="true">
 <vbox spacing="2" scrollable="true" hscrollbar-policy="2" vscrollbar-policy="2" space-expand="true" space-fill="true">

  <hbox spacing="0" space-expand="false" space-fill="true">
   <pixmap height-request="20" icon_size="1" space-expand="false" space-fill="false"><input file stock="gtk-add"></input></pixmap>
   <button height-request="20" xalign="0" can-focus="no" relief="2" space-expand="true" space-fill="true">
    <label>" This could have been a nice ADD menuitem, but menu is too narrow"</label>
    <action>EXIT:exit</action>
   </button>
  </hbox>

 </vbox>
 <action signal="focus-out-event">EXIT:exit</action>
</window>' | gtkdialog -s

Using a scrollable vbox is of course not necessary here, but a ordinary vbox won't let me set a frame. It seems to me that the option Shadow-type only works if scrollable="true".




tree
One of the major improvements in pMusic 4, is the switching from table to tree widget and the usage of multiple selection. This gives many new features when it comes to track/playlists/file managing. This has lead to a simpler workflow. and it is looking all good. What is a bit awkward, is that hover-selection can't be combined with a selection-mode

With multiple selection activated (selection-mode="3"), selecting a list-item is activated after the signal="button-press-event", and the right-click menu is shown by that signal. This is logic, because else the selection would be deactivated when right-click. BUT! this means that the user has to first click on an item, and then click another time to show the menu. If hover-selection was possible to combine with selection-mode this would work as other gtk-apps. This would also allow drag and drop internally in any gtkdialog app. ( Am I dreaming... :lol: ) Drag and drop works in the pMusic playlist, but only because multiple-selection isn't activated and hover-selection="true".

Switching from <table> to <tree> has been easy with the latest updates of gtkdialog. In fact most stuff works better with the tree widget. But I have met one tiny issue. To force the scrollbar to top I clear:tree before refresh:tree. This is a nice 'trick', but works only for the hscrollbar. Strangely the clear command does NOT reset vertical scrollbar.


Thanks for gtkdialog
Sigmund

Posted: Tue 30 Apr 2013, 22:11
by thunor
I'll have a look at these issues soon, a bit at a time because I've got other things to do at the moment.

I have noticed that the GtkLabel text in the <text> widget is being rendered differently in gtk3 but I'm testing the examples and then researching any issues/differences and I've haven't reached "t" yet.

[EDIT] @simargl: I think you're just assuming wrongly regarding the justify property: justify is relative to the other lines within the same widget; the xalign property is what you want -- the examples/text/text_advanced and examples/text/text_attributes demonstrate both of these.

I'll start on your issues Sigmund tomorrow evening.

Regards,
Thunor

Posted: Thu 02 May 2013, 00:17
by thunor
zigbert wrote:...
vbox / hbox
If scrollable="true". I am not able to get use of space-expand="true" space-fill="true" to expand width.
I have to use <window width-request="300">, but this a not the best solution if someone uses a longer NLS-string.

Improving my template for a right-click menu, I wanted to add a frame. But the <frame> widget is both not complete (always a gap for label), and takes a lot of place since I am not able to set spacing, I looked at the scrollable vbox. This one accepts both spacing and different shadow-types...
...
Using a scrollable vbox is of course not necessary here, but a ordinary vbox won't let me set a frame. It seems to me that the option Shadow-type only works if scrollable="true".
...
Making a vbox scrollable packs it inside a GtkViewport inside a GtkScrolledWindow and that's it. It does what you would expect it to such as expanding to accommodate its contents and adding scrollbars if it becomes bigger than the viewport that you're looking through. shadow-type does indeed only affect the GtkViewport.

The frame widget is flawed because all of the empty space within the tag becomes the label. I'm sure the original author thought it was a good idea at the time but it means that you can't set GtkFrame properties. Also it automatically has a vbox placed within it and of course you can't set its properties either. Anyway, even though without a label the border is unbroken, there's a top margin.

You could try h/vseparators :) I just tried it and if you set the spacing to 0 then they connect at the corners.

[EDIT] Actually forget the separator idea -- it'll drive you insane :lol: I was just playing with an eventbox with a border inside an eventbox with a dark background which is great but it's theme dependent. Also gtk3 requires the interior eventbox to have a background colour set which again is theme dependent.

Regards,
Thunor

Posted: Thu 02 May 2013, 10:47
by simargl
.

Posted: Thu 02 May 2013, 15:33
by thunor
This is the eventbox inside another eventbox border trick using some of the code from Sigmund's menu prototype just to illustrate what you can do (it might be of interest to somebody, it might not):

Code: Select all

#!/bin/sh

[ -z $GTKDIALOG ] && GTKDIALOG=gtkdialog

## ---------------------------------------------------------------------
## Local Functions
## ---------------------------------------------------------------------

## Create a custom GTK+ 2 style for specific widgets.
funcgtkrcCreate() {
	echo '
style "styleExterior" {
	bg[NORMAL] = "#000000"
}
widget "*Exterior" style "styleExterior"
' > "$TMPDIR"/.gtkrc-2.0

	GTK2_RC_FILES="$TMPDIR"/.gtkrc-2.0:~/.gtkrc-2.0
	export GTK2_RC_FILES
}

## Create a custom GTK+ 3 style for specific widgets.
funcgtkcssCreate() {
	echo '
#Exterior {
	background-color: #000000
}
#Interior {
	background-color: #ffffff
}
' > "$TMPDIR"/gtk.css

	EXTRA_ARGS="$EXTRA_ARGS --styles $TMPDIR/gtk.css"
}

## ---------------------------------------------------------------------
## Main
## ---------------------------------------------------------------------

TMPDIR=/tmp/gtkdialog/examples/"`basename $0`"
mkdir -p "$TMPDIR"

EXTRA_ARGS=

case `$GTKDIALOG -v` in
	*"GTK+ 3"*) funcgtkcssCreate ;;
	*) funcgtkrcCreate ;;
esac

MAIN_DIALOG='
<window decorated="false" window-position="1">
	<eventbox name="Exterior">
		<eventbox name="Interior" border-width="5">
			<vbox spacing="2">
				<hbox spacing="0">
					<pixmap height-request="20" icon-size="1"
						space-expand="false" space-fill="false">
						<input file stock="gtk-add"></input>
					</pixmap>
					<button height-request="20" xalign="0" can-focus="no" relief="2">
						<label>" This could have been a nice ADD menuitem, but menu is too narrow"</label>
					</button>
				</hbox>
				<hbox spacing="0">
					<pixmap height-request="20" icon-size="1"
						space-expand="false" space-fill="false">
						<input file stock="gtk-add"></input>
					</pixmap>
					<button height-request="20" xalign="0" can-focus="no" relief="2">
						<label>" Another nice ADD menuitem"</label>
					</button>
				</hbox>
			</vbox>
		</eventbox>
	</eventbox>
</window>
'
export MAIN_DIALOG

case $1 in
	-d | --dump) echo "$MAIN_DIALOG" ;;
	*) $GTKDIALOG --space-expand=true --space-fill=true --program=MAIN_DIALOG $EXTRA_ARGS ;;
esac

Posted: Thu 02 May 2013, 15:41
by zigbert
Nifty :D

Posted: Thu 02 May 2013, 16:36
by thunor
zigbert wrote:Nifty :D
Instead of painting the background to a specific colour, you could tile it with a black square 50% opaque so for the most part this would give the impression of a border regardless of theme.

The gtkrc and gtk.css code for bitmaps is:

Code: Select all

GTK+ 2:

pixmap_path "/image/folder"

style "styleBgPixmap" {
	bg_pixmap[NORMAL] = "myblacksquare.png"
}
widget "*BgPixmap" style "styleBgPixmap"

GTK+ 3:

#BgPixmap {
	background-image: url("/image/folder/myblacksquare.png")
}
Anyway, since the eventbox interior in gtk2 appears to be solid by default and in gtk3 transparent by default you might have to override the user's theme.

I'm just throwing stuff in.

Using variables in dialogue

Posted: Sun 19 May 2013, 10:32
by guraknugen
I am not sure if this is the right place to ask this, but I didn't find anywhere else to go…

Let's say that I create a window with a few items on it. One of them is a text field (I think it's called