Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 22 Nov 2018, 07:02
All times are UTC - 4
 Forum index » House Training » Bugs ( Submit bugs )
/usr/lib/gtkdialog/box_splash and animated gif icons?
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 4 of 4 [54 Posts]   Goto page: Previous 1, 2, 3, 4
Author Message
MochiMoppel


Joined: 26 Jan 2011
Posts: 1683
Location: Japan

PostPosted: Fri 19 Oct 2018, 03:41    Post subject:  

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

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:
NR_CHARS="$(echo -e "$text" | awk '{ print length }' | sort -n | tail -1)"

the wc command can return the length of the longest line:
Code:
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

Quote:
I wonder if it would not be interesting to disable automatic wraping
Just do it! Set -wrap to "false" and see what happens Laughing Can have surprising and not always pleasant effects.
Back to top
View user's profile Send private message 
Argolance


Joined: 06 Jan 2008
Posts: 3465
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Fri 19 Oct 2018, 07:07    Post subject:  

Bonjour,
MochiMoppel wrote:
You mean vertically?

Yes I do! Confused
Quote:
That's intentional, I guess. A spacer is added below the icon to keep it in the upper left corner

Intentional, but still ugly. Smile
Quote:
Just do it! Set -wrap to "false" and see what happens Laughing 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.
181019_124247_400x68_easyshot.jpg
 Description   
 Filesize   7.33 KB
 Viewed   398 Time(s)

181019_124247_400x68_easyshot.jpg

181019_125138_373x68_easyshot.jpg
 Description   
 Filesize   7.34 KB
 Viewed   398 Time(s)

181019_125138_373x68_easyshot.jpg


_________________

Back to top
View user's profile Send private message Visit poster's website 
fredx181


Joined: 11 Dec 2013
Posts: 3549
Location: holland

PostPosted: Fri 19 Oct 2018, 07:29    Post subject:  

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.php?p=1007581#1007581
- Center the icon vertically

@MochiMoppel
Code:
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:
<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:
 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
box_splash_fixed_mod.tar.gz
Description  Modified box_splash_fixed
gz

 Download 
Filename  box_splash_fixed_mod.tar.gz 
Filesize  4.59 KB 
Downloaded  64 Time(s) 

_________________
Dog Linux website

Last edited by fredx181 on Fri 19 Oct 2018, 11:04; edited 1 time in total
Back to top
View user's profile Send private message 
Argolance


Joined: 06 Jan 2008
Posts: 3465
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Fri 19 Oct 2018, 08:01    Post subject:  

Thanks fredx181, works fine for me. Very Happy
Ultimately text attributes should be simply configurable in the same way as the font size and color...
181019_135906_260x202_easyshot.jpg
 Description   gtk-splash
 Filesize   5.97 KB
 Viewed   378 Time(s)

181019_135906_260x202_easyshot.jpg


_________________

Back to top
View user's profile Send private message Visit poster's website 
ITSMERSH


Joined: 02 May 2018
Posts: 471

PostPosted: Thu 25 Oct 2018, 15:25    Post subject:  

That seems to be funny, though, I think it doesn't make any sense to have angled text in a SPLASH info box. Wink
_________________
RSH
Back to top
View user's profile Send private message 
Argolance


Joined: 06 Jan 2008
Posts: 3465
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Fri 26 Oct 2018, 08:01    Post subject:  

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! Rolling Eyes
As popular wisdom tells us: who can do the most can also do the least! Wink

Cordialement.

_________________

Back to top
View user's profile Send private message Visit poster's website 
fredx181


Joined: 11 Dec 2013
Posts: 3549
Location: holland

PostPosted: Mon 29 Oct 2018, 07:15    Post subject:  

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:
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
box_splash_fixed_mod.tar.gz
Description  Small change to get the icon centered in all cases
gz

 Download 
Filename  box_splash_fixed_mod.tar.gz 
Filesize  4.66 KB 
Downloaded  49 Time(s) 

_________________
Dog Linux website
Back to top
View user's profile Send private message 
Argolance


Joined: 06 Jan 2008
Posts: 3465
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Mon 29 Oct 2018, 13:14    Post subject:  

Thanks!
_________________

Back to top
View user's profile Send private message Visit poster's website 
fredx181


Joined: 11 Dec 2013
Posts: 3549
Location: holland

PostPosted: Fri 09 Nov 2018, 11:07    Post subject:  

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.php?p=1009548#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
box_splash_fixed_mod-2018-11-10.tar.gz
Description  2018-11-10 new box_splash_fixed_mod
gz

 Download 
Filename  box_splash_fixed_mod-2018-11-10.tar.gz 
Filesize  5.01 KB 
Downloaded  12 Time(s) 
2018-11-09-154914_428x278_scrot.png
 Description   Mmmm... something's wrong... :)
 Filesize   138.72 KB
 Viewed   109 Time(s)

2018-11-09-154914_428x278_scrot.png

2018-11-09-155012_424x273_scrot.png
 Description   Multiple lines and icon correctly displayed
 Filesize   116.57 KB
 Viewed   109 Time(s)

2018-11-09-155012_424x273_scrot.png


_________________
Dog Linux website
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 4 of 4 [54 Posts]   Goto page: Previous 1, 2, 3, 4
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Bugs ( Submit bugs )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0847s ][ Queries: 13 (0.0366s) ][ GZIP on ]