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 Sat 23 Aug 2014, 13:36
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
gfonsel stdout problem! [SOLVED]
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [9 Posts]  
Author Message
Argolance


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

PostPosted: Fri 22 Nov 2013, 11:27    Post subject:  gfonsel stdout problem! [SOLVED]  

Bonjour,
I am trying to build a script which lets user define a font of his choice with something like this:
Code:
# FONT="`gfontsel stdout`"
# echo $FONT
Sans 10
#

The script can then use the value of the variable FONT.
This runs quite well if user really choose a font then click on the gfontsel application button "Close". But if user clicks on the quit button of the window title bar, gfontsel is closed but the process itself not!
Code:
# FONT="`gfontsel stdout`"
????

The script hangs waiting for some operation to be ended. Sad

How can this be solved?

Thanks for your attention.

Cordialement.

_________________


Last edited by Argolance on Fri 22 Nov 2013, 13:59; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website 
L18L

Joined: 19 Jun 2010
Posts: 2505
Location: Burghaslach, Germany somewhere also known as "Hosla"

PostPosted: Fri 22 Nov 2013, 12:46    Post subject: Re: Application stdout problem!  

Argolance wrote:
How can this be solved?

Don't use gfontsel, use
Code:
yad --font
Back to top
View user's profile Send private message 
Argolance


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

PostPosted: Fri 22 Nov 2013, 13:58    Post subject:  

Bonsoir L18L,
Quote:
Don't use gfontsel, use
Code:
yad --font


... Awesome!
Thanks a lot.

Cordialement.

_________________

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


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

PostPosted: Fri 06 Dec 2013, 11:26    Post subject: --fontname=FONTNAME command line  

Bonjour,
Code:
yad --font

The yad font selector is configured by default to point on and show the "Sans" font in the font list.
I saw this on the Arrow man yad howto page:
Quote:
Font selection options

Code:
--fontname=FONTNAME

Set the initial font. FONTNAME is a string with font representation in the form [FAMILY-LIST] [STYLE-OPTIONS] [SIZE].
Code:
--preview

Set the preview text.

For example, this works fine:
Code:
yad --font --preview abcdefghijklmno...


But I tried many combinations using the --fontname command and didn't succeed in making this work Embarassed !
For example:
Code:
yad --font --fontname DejaVu Sans 12

Code:
yad --font --fontname=DejaVu Sans 12

Code:
...


Does anybody knows how to do?


Cordialement.

_________________

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


Joined: 03 Jan 2007
Posts: 1468
Location: UK

PostPosted: Fri 06 Dec 2013, 11:50    Post subject:  

Hello Argolance

Try this:
Code:
yad --font --fontname="DejaVu Sans 12"


CatDude
.

_________________

Back to top
View user's profile Send private message 
Argolance


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

PostPosted: Fri 06 Dec 2013, 12:15    Post subject:  

Hello mate,
... blasted double quote!!! Evil or Very Mad
This works perfectly! Very Happy

Thank you a lot for this very quick answer!

Cordialement.

_________________

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


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

PostPosted: Fri 06 Dec 2013, 14:22    Post subject: Ouch!  

Hello catdude,
Not so simple! Confused
This is my original code lines which work well:
Code:
function xft_select (){
   XFT="`yad --font stdout`"
   if [ "$XFT" != "" ]; then
      XFT_S="${XFT: -2}"
      echo "$XFT_S" > $CONF_DIR/XFT_S.tmp
      XFT_N=`echo "${XFT// ${XFT_S}}"`
      echo "$XFT_N" > $CONF_DIR/XFT_N.tmp
   fi
   } # End of function

This is the function modified to make yad pointing on the current font:
Code:
function xft_select (){
. $CONF_DIR/current_config #get xft and xft_size current values
   XFT=`yad --font --fontname=\""$xft $xft_size"\" stdout`
   if [ "$XFT" != "" ]; then
      XFT_S="${XFT: -2}"
      echo "$XFT_S" > $CONF_DIR/XFT_S.tmp
      XFT_N=`echo "${XFT// ${XFT_S}}"`
      echo "$XFT_N" > $CONF_DIR/XFT_N.tmp
   fi
   } # End of function
export -f xft_select

Making test in terminal:
Code:
# xft="DejaVu Sans"
# xft_size="12"
# XFT=`echo yad --font --fontname="\"$xft $xft_size\"" stdout`
# echo $XFT
yad --font --fontname="DejaVu Sans 12" stdout
# $XFT #click "Cancel"
Sans 10
#

This works fine:
Code:
# yad --font --fontname="DejaVu Sans 12" stdout
DejaVu Sans 12 #click "OK" no new font selected
#


What's wrong?

Cordialement.

_________________

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


Joined: 26 Oct 2011
Posts: 1054

PostPosted: Fri 06 Dec 2013, 14:54    Post subject:  

Hey Argolance, try:
Code:
XFT=`yad --font --fontname="$xft $xft_size"`

BTW, stdout is redundant in that case (does YAD have such an option at all?), but for example in Xdialog it's necessary indeed:
Code:
XFT=`Xdialog --stdout --fontsel "DejaVu Sans 12" 0 0`

HTH
Greetings!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send private message 
Argolance


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

PostPosted: Sat 07 Dec 2013, 13:08    Post subject:  

Works fine! Very Happy
Thanks!

Cordialement.

_________________

Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 1 of 1 [9 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
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.0700s ][ Queries: 11 (0.0041s) ][ GZIP on ]