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 25 Oct 2014, 03:15
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 Posts_count  
Author Message
Argolance


Joined: 06 Jan 2008
Posts: 1839
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.

_________________


Edited_time_total
Back to top
View user's profile Send_private_message Visit_website 
L18L

Joined: 19 Jun 2010
Posts: 2530
Location: Moved from Hosla to www.eussenheim.de

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: 1839
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_website 
Argolance


Joined: 06 Jan 2008
Posts: 1839
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_website 
CatDude


Joined: 03 Jan 2007
Posts: 1485
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: 1839
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_website 
Argolance


Joined: 06 Jan 2008
Posts: 1839
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_website 
SFR


Joined: 26 Oct 2011
Posts: 1078

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: 1839
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_website 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0748s ][ Queries: 12 (0.0082s) ][ GZIP on ]