/usr/lib/gtkdialog/box_splash and animated gif icons?

Please post any bugs you have found
Message
Author
User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#46 Post by MochiMoppel »

fredx181 wrote:There's still one (small) thing that annoys me, it is that sometimes the dialog turns out much wider than intended.
One of the small things I meant when I wrote "more fixed and efficient code is needed".
I wanted to fix the same line, but for a different reason.
As you can still see from the comments in the script, this line is a modified and more efficient version of

Code: Select all

NR_CHARS="`echo "$text" | wc -c`"
Of course this is wrong as echo without the -n option will add a linefeed character and a text containing 6 characters will have a character count of 7. Not a big deal, but with an image-only splash box, this will create an ugly. empty space at the right edge for 1 useless linefeed character.

The modified version attempts to produce the same (wrong) result. A case of bug emulation :lol:

Like you I also wondered why all characters and not just those of the longest line were counted but I didn't dig deeper. It seems that you are right and that different counting gives better results. Your code could be made shorter though. Instead of

Code: Select all

NR_CHARS="$(echo -e "$text" | awk '{ print length }' | sort -n | tail -1)"
the wc command can return the length of the longest line:

Code: Select all

NR_CHARS="$(echo "$text"| wc -L )"
(I removed the -e option to make it backward compatible
Argolance wrote:I'll add another small annoying thing: the icon is not centered horizontally
You mean vertically? That's intentional, I guess. A spacer is added below the icon to keep it in the upper left corner
I wonder if it would not be interesting to disable automatic wraping
Just do it! Set -wrap to "false" and see what happens :lol: Can have surprising and not always pleasant effects.

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#47 Post by Argolance »

Bonjour,
MochiMoppel wrote:You mean vertically?
Yes I do! :?
That's intentional, I guess. A spacer is added below the icon to keep it in the upper left corner
Intentional, but still ugly. :)
Just do it! Set -wrap to "false" and see what happens :lol: Can have surprising and not always pleasant effects.
It is what I did with gtk-splash...
On the one hand, I only think that it can sometimes be useful to display a text on a single line and on the other hand, to put the line breaks exactly where you want them and no longer let the program put them a little randomly in the middle of a word or expression (please, see attached pictures).

Cordialement.
Attachments
181019_124247_400x68_easyshot.jpg
(7.33 KiB) Downloaded 533 times
181019_125138_373x68_easyshot.jpg
(7.34 KiB) Downloaded 533 times

User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#48 Post by fredx181 »

Hi, here's attached modified box_splash_fixed

Changes:
- Find the longest line (if given multiple lines of text), more info here:
http://murga-linux.com/puppy/viewtopic. ... 81#1007581
- Center the icon vertically

@MochiMoppel

Code: Select all

NR_CHARS="$(echo "$text"| wc -L )"
Ok, thanks, works fine also

@Argolance, yes, I like it also when the icon is vertically centered.
To try making the icon display vertically centered, I first removed this line in the main dialog:

Code: Select all

<text space-expand="true" space-fill="true"><label>""</label></text>
That worked ok for the centered icon, but not when using only text (no icon).
So moved it to this section and works fine for me (with or without icon):

Code: Select all

 if [ "$ICON" ]; then
....
....
# fredx181, in case only text, no icon. Moved from the main dialog below to here
else
	icon="<text space-expand=\"true\" space-fill=\"true\"><label>\"\"</label></text>"
fi
Added comments with my name for the changes, but I'm not very good with that.

Fred
Attachments
box_splash_fixed_mod.tar.gz
Modified box_splash_fixed
(4.59 KiB) Downloaded 253 times
Last edited by fredx181 on Fri 19 Oct 2018, 15:04, edited 1 time in total.

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#49 Post by Argolance »

Thanks fredx181, works fine for me. :D
Ultimately text attributes should be simply configurable in the same way as the font size and color...
Attachments
181019_135906_260x202_easyshot.jpg
gtk-splash
(5.97 KiB) Downloaded 514 times

ITSMERSH

#50 Post by ITSMERSH »

That seems to be funny, though, I think it doesn't make any sense to have angled text in a SPLASH info box. :wink:

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#51 Post by Argolance »

Bonjour,
ITSMERSH wrote:That seems to be funny, though, I think it doesn't make any sense to have angled text in a SPLASH info box.
... Totally agree with you, it was truly for fun, although it may be exceptionally useful! :roll:
As popular wisdom tells us: who can do the most can also do the least! :wink:

Cordialement.

User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#52 Post by fredx181 »

Hi, again about the icon centered vertically.
I found that if you give multiple lines of text, then the icon is still not centered.
(but depends on the size of the icon)
Fixed it by setting space-expand to true in the if [ "$ICON" ]; section:

Code: Select all

if [ "$ICON" ]; then
	icon="<pixmap width-request=\"$ICON_WIDTH\" space-expand=\"true\" space-fill=\"false\">
....
....
	*) icon="<pixmap width-request=\"$ICON_WIDTH\" space-expand=\"true\" space-fill=\"false\">
....
From what I tested it doesn't give unwanted side-effects.

Fred
Attachments
box_splash_fixed_mod.tar.gz
Small change to get the icon centered in all cases
(4.66 KiB) Downloaded 234 times

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#53 Post by Argolance »

Thanks!

User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#54 Post by fredx181 »

Hi all, after more testing and experimenting (mostly focused on using multiple lines and icon fitting in display) I made some more changes.
When using "-placement -center" all is okay, but when using any other, e.g. top, bottom, bottom-right or top-right, the dialog showed too small (multiple lines and icon not fitting)
See first pic.
The second pic is with new attached box_splash_fixed_mod.

I've used it now in my new redshift-portable app:
http://murga-linux.com/puppy/viewtopic. ... 48#1009548

EDIT: Forgot to mention: Also added options info for -placement 'bottom-right' and 'top-right' to the help text.
(these are supported, but seems to be forgotten to add to usage help).

EDIT2 : I found that I made mistake, removed box_splash_fixed_mod attachment, get back about it later.
EDIT 2018-11-10 fixed mistake and added more calculations for setting the height correctly.
Tested lots of option combinations, should be pretty flexible now, may be a little slower because of more complex code.

Fred
Attachments
box_splash_fixed_mod-2018-11-10.tar.gz
2018-11-10 new box_splash_fixed_mod
(5.01 KiB) Downloaded 195 times
2018-11-09-154914_428x278_scrot.png
Mmmm... something's wrong... :)
(138.72 KiB) Downloaded 241 times
2018-11-09-155012_424x273_scrot.png
Multiple lines and icon correctly displayed
(116.57 KiB) Downloaded 241 times

Post Reply