YAD - Tips

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
achim
Posts: 48
Joined: Thu 13 Apr 2017, 19:36
Location: Germany

Re: execute order

#301 Post by achim »

@ Geoffrey
My scripts are not running in the Puppy environment but under Ubuntu 16.04 LTS in the folder ~ / .local / share / nemo / scripts. I could install Puppy to test on a USB stick, but the scripts should all be running under Ubuntu.

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

#302 Post by fredx181 »

It could well be a language issue, the output from the shell 'command not found' in german is probably different, so you maybe just need to change this to german:

Code: Select all

if grep -c 'command not found' /tmp/run-command-error; then
EDIT: Or put this on top of script:

Code: Select all

export LANG=C
Fred

achim
Posts: 48
Joined: Thu 13 Apr 2017, 19:36
Location: Germany

#303 Post by achim »

@ Fredx181
With the first code it has already worked. An error message will appear as desired.

@Alles
Thanks for the kind support.

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

#304 Post by fredx181 »

Hi All,

Here's is an experiment of mine (a bit weird, I admit:) ):
Using yad with additional options, e.g. foregound and background color, gradient background and font setting.
Originally meant to be similar as gtkdialog-splash (part of the code taken from it), to be used for simple colored messages, but the good thing is that all yad options can be used also.
Using pango markup can override these extra options (see example 2 and 3 below).
Type ./yad-splash or ./yad-splash --help for the options.
Having installed "gtk2-engines-murrine" is recommended (for e.g. better looking buttons)
(in fact a custom theme file /tmp/gtkrc.yadsplash will be created and used)
You may want to set the icon theme on top of the script, by default it's set to Faenza
ICON_THEME="icon_theme_name"

Example 1, see screenshot 1:

Code: Select all

./yad-splash --height=80 --width=200 --center --text "  \tYellow Text\n  \n  On Gradient Background  " --undecorated --button="gtk-close:1" --fg yellow --bg blue --bg_gradient true --bg_gradient_height 150 --font_name 'Sans Bold 9'
Example 2, see screenshot 2:

Code: Select all

./yad-splash --height=100 --width=200 --center --text="<span size='large' foreground='red'><b>\tYad-Splash </b></span> \n \n\tBrown Text\n  \n  On Gradient Background  "  --undecorated --no-buttons --fg "#4B200A" --bg "#F4E48F" --bg_gradient true --font_name 'Sans Bold 10' --bg_gradient_height 80
Example 3, (example from earlier in this thread, with added color options) see screenshot 3:

Code: Select all

./yad-splash --title="Golf Club" --height=200 --width=400 --text="<span foreground='blue'><b><big><big>Please enter your details:</big></big></b></span>" \
--form \
--field="<b><big><big>Golflink Number</big></big></b>" \
--field="<b><big><big>Score</big></big></b>" --fg white --bg grey --bg_gradient true --bg_gradient_height 120 --font_name 'Sans Bold 9'
Fred
Attachments
yad-splash.tar.gz
yad-splash, extract and run ./yad-splash [OPTIONS]
(2.44 KiB) Downloaded 294 times
1.png
Example 1
(8.9 KiB) Downloaded 1753 times
2.png
Example 2
(15.48 KiB) Downloaded 1746 times
3.png
Example 3
(22.31 KiB) Downloaded 1764 times

achim
Posts: 48
Joined: Thu 13 Apr 2017, 19:36
Location: Germany

youtube-dl

#305 Post by achim »

Hello everybody,
With the command

Youtube-dl -f 'bestvideo [ext = mp4] + bestaudio [ext = m4a] / bestvideo + bestaudio' - merge output format mp4 "https://www.youtube.com/watch?v=4x0aYzcxmjk"
Downloade I from the Ubuntu Terminal the selected file in the best possible quality in the current directory. Has anyone an idea how I can make the whole thing with yad more comfortable, whereby the url address is of course variable.
Many Thanks

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

#306 Post by fredx181 »

Hi achim, this should do it (with progressbar)
I took parts from here:
https://github.com/Misko-2083/scripts/b ... 10/youtube

Code: Select all

#!/bin/bash

# Partly taken from here (and simpified for just one video): https://github.com/Misko-2083/scripts/blob/7ef871dd121e1cb3dbdb2b21ab61ffeeb1d86110/youtube

# function download
download() {
  youtube-dl -f 'bestvideo [ext = mp4] + bestaudio [ext = m4a] / bestvideo + bestaudio' --merge-output-format mp4 --newline -i -o "%(title)s.%(ext)s" "$1" 2>&1 \
  | while read line; do
     if [[ "$(echo $line | grep '[0-9]*%')" ]];then
        percent=$(echo $line | awk '{print $2}')
        echo "${percent%.*}%"
     fi

     if [[ "$(echo $line | grep '\[download\]')" ]];then
        progress=$(echo $line | awk '{$1=""; print $0}')
        echo "#$progress"
     fi
   done

    RET_YT="${PIPESTATUS[0]}"
    if [[ "$RET_YT" = 0 ]]
      then
          echo "100%"
          echo "#Download completed."
          
    else
          echo "#Download error."
    fi
}

# Enter URL
URL=$(yad --title="YouTube Downloader" --height 100 --width 400 ---center --entry --text=" Please enter url below")

if [ -z "$URL" ]; then # vovchik, if empty, then exit
   exit 1
else
   # Download with progress bar
   download $URL | yad --window-icon="$ICON" \
      --progress \
      --image=browser-download \
      --title="YouTube Downloader" \
      --center --borders=6 \
        --text="  Downloading: $URL" \
        --button="gtk-cancel:1"
fi 
EDIT: Modified to check if $URL is empty, suggestion from vovchik, see below post

Fred
Last edited by fredx181 on Thu 27 Apr 2017, 21:28, edited 1 time in total.

achim
Posts: 48
Joined: Thu 13 Apr 2017, 19:36
Location: Germany

Re: youtube-dl

#307 Post by achim »

Hello fredx181
It works so! I thank you for your competent support.

Achim

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#308 Post by vovchik »

Dear Fred,

How about this at the end, to prevent an unnecessary "downloading" window when the URL is empty?

Code: Select all

if [ -z "$URL" ]; then
	exit 1
else
	# Download with progress bar
	download $URL | yad --window-icon="$ICON" \
		--progress \
		--image=browser-download \
		--title="YouTube Downloader" \
		--center --borders=6 \
        --text="  Downloading: $URL" \
        --button="gtk-cancel:1"
fi
With kind regards,
vovchik

achim
Posts: 48
Joined: Thu 13 Apr 2017, 19:36
Location: Germany

#309 Post by achim »

Hello vovchik

Good idea, then one can start without any problem possible errors.

achim

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

#310 Post by fredx181 »

vovchik wrote: How about this at the end, to prevent an unnecessary "downloading" window when the URL is empty?
Yes, thanks, much better, edited the script in my above post.

Fred

User avatar
misko_2083
Posts: 114
Joined: Tue 08 Nov 2016, 13:42

#311 Post by misko_2083 »

fredx181 wrote:Hi achim, this should do it (with progressbar)
I took parts from here:
https://github.com/Misko-2083/scripts/b ... 10/youtube
:D Glad to help.

Hey fredx181, how would you end the youtube-dl process in the folowing script? Without "killall youtube-dl" of course.

Code: Select all

#!/bin/bash

export ytdownload='@bash -c "download_video %1"'

export ytdpipe=$(mktemp -u --tmpdir pmrp.XXXXXXXX)
mkfifo "$ytdpipe" 

trap "rm -f $ytdpipe" EXIT

ytdkey=$(($RANDOM * $$))

function download_video
{
  echo "2:@disable@"
  echo "#Preparing to download" >> "$ytdpipe"
  youtube-dl -f 'bestvideo [ext = mp4] + bestaudio [ext = m4a] / bestvideo + bestaudio' --merge-output-format mp4 --newline -i -o "%(title)s.%(ext)s" "$1" 2>&1 \
  | while read line; do
     if [[ "$(echo $line | grep '[0-9]*%')" ]];then
        percent=$(echo $line | awk '{print $2}')
        echo "${percent%.*}%" >> "$ytdpipe"
     fi

     if [[ "$(echo $line | grep '\[download\]')" ]];then
        progress=$(echo $line | awk '{$1=""; print $0}')
        echo "#$progress" >> "$ytdpipe"
     fi
   done

    RET_YT="${PIPESTATUS[0]}"
    if [[ "$RET_YT" = 0 ]]
      then
          echo "100%" >> "$ytdpipe"
          echo "#Download completed." >> "$ytdpipe"   
    else
          echo "#Download error." >> "$ytdpipe"
    fi

    echo "2:$ytdownload"
} 
export -f download_video

function ytdl_version () {
    echo "#Checking youtube-dl version" >> "$ytdpipe"
    wget --spider --user-agent="Mozilla/5.0 Gecko/20100101" --timeout=30 -q "https://rg3.github.io/youtube-dl/" -O /dev/null
    if [[ "$?" -ne "0" ]]; then
       echo "#Can't connect to youtube-dl server site" >> "$ytdpipe"
    fi
    ytdlcv=$(youtube-dl --version)
    ytdllv=$(wget -O- -q "https://rg3.github.io/youtube-dl/update/LATEST_VERSION")
    if [[ "$ytdlcv" == "$ytdllv" ]]; then
	echo "#youtube-dl is up-to-date"  >> "$ytdpipe"
    else
	echo "#youtube-dl update is available" >> "$ytdpipe"
    fi
}

exec 3<> $ytdpipe

yad --plug="$ytdkey" --tabnum=1 --form --field "Enter video url":CE "https://www.youtube.com/" \
    --image=browser-download --image-ontop --field="Download!gtk-download:fbtn" "$ytdownload" &

yad --plug="$ytdkey" --tabnum=2 --window-icon="$ICON" \
      --progress  --borders=6 <&3 &

  ytdl_version &

yad --paned --key="$ytdkey"  \
    --button="Stop":"killall youtube-dl"  --text="" --width=500 --height=200 \
    --title=$"YouTube Downloader" --image=browser-download --window-icon="$ICON" --center

exec 3>&-
Edit: Asked the developer how to kill all the processes on paned window close. :roll:
Last edited by misko_2083 on Sun 30 Apr 2017, 01:09, edited 1 time in total.

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

#312 Post by fredx181 »

misko_2083 wrote:Very Happy Glad to help.

Hey fredx181, how would you end the youtube-dl process in the folowing script? Without "killall youtube-dl" of course.
The below works for me (although probably can be better, more simple), but hey! I thought you were the expert :)
Nice script, btw :wink:

EDIT: Changed the "get_pid_and_kill" function to this:

Code: Select all

function get_pid_and_kill () { # fredx181 exec function Stop button (see below)
# export pidytdl="`ps -eo pid,cmd | grep "youtube-dl -f bestvideo \[ext = mp4\] + bestaudio \[ext = m4a\] / bestvideo + bestaudio --merge-output-format mp4 --newline -i" | grep -v grep | awk '{ print $1 }' 2> /dev/null`"
# This will give the unique pid, better than above
export pidytdl="`ps -eo pid,cmd | grep "youtube-dl" | grep "$1" | grep -v grep | awk '{ print $1 }' 2> /dev/null`"
kill $pidytdl
}
EDIT2: no, still not good, running the script twice with different URL clicking the Stop button kill both youtube-dl processes, so.... I don't know how to get the unique pid, anyone?

EDIT3: Couldn't let go :) Now it should be fine, actually it's the pid of function 'download_video' that gets killed when clicking the Stop button

Code: Select all

#!/bin/bash

# fredx181, create tempfile, the pid of the function 'download_video' will be written to it
export PIDYTDL=`tempfile 2>/dev/null`
  
export ytdownload='@bash -c "download_video %1"'

export ytdpipe=$(mktemp -u --tmpdir pmrp.XXXXXXXX)
mkfifo "$ytdpipe"

trap "rm -f $ytdpipe" EXIT

ytdkey=$(($RANDOM * $$))

function download_video
{
  echo "2:@disable@"
  echo "#Preparing to download" >> "$ytdpipe"
  youtube-dl -f 'bestvideo [ext = mp4] + bestaudio [ext = m4a] / bestvideo + bestaudio' --merge-output-format mp4 --newline -i -o "%(title)s.%(ext)s" "$1" 2>&1 \
  | while read line; do
     if [[ "$(echo $line | grep '[0-9]*%')" ]];then
        percent=$(echo $line | awk '{print $2}')
        echo "${percent%.*}%" >> "$ytdpipe"
     fi

     if [[ "$(echo $line | grep '\[download\]')" ]];then
        progress=$(echo $line | awk '{$1=""; print $0}')
        echo "#$progress" >> "$ytdpipe"
     fi
   done & echo $! > $PIDYTDL; wait $! # fredx181 write pid, possibly later used to kill

    RET_YT="${PIPESTATUS[0]}"
    if [[ "$RET_YT" = 0 ]]
      then
          echo "100%" >> "$ytdpipe"
          echo "#Download completed." >> "$ytdpipe"   
    else
          echo "#Download error." >> "$ytdpipe"
    fi

    echo "2:$ytdownload"
}
export -f download_video

function ytdl_version () {
    echo "#Checking youtube-dl version" >> "$ytdpipe"
    wget --spider --user-agent="Mozilla/5.0 Gecko/20100101" --timeout=30 -q "https://rg3.github.io/youtube-dl/" -O /dev/null
    if [[ "$?" -ne "0" ]]; then
       echo "#Can't connect to youtube-dl server site" >> "$ytdpipe"
    fi
    ytdlcv=$(youtube-dl --version)
    ytdllv=$(wget -O- -q "https://rg3.github.io/youtube-dl/update/LATEST_VERSION")
    if [[ "$ytdlcv" == "$ytdllv" ]]; then
   echo "#youtube-dl is up-to-date"  >> "$ytdpipe"
    else
   echo "#youtube-dl update is available" >> "$ytdpipe"
    fi
}
 
function get_pid_and_kill () { # fredx181 exec function Stop button (see below)
export pidytdl="$(cat $PIDYTDL)"
rm -f $PIDYTDL
kill $pidytdl
}
export -f get_pid_and_kill

exec 3<> $ytdpipe

yad --plug="$ytdkey" --tabnum=1 --form --field "Enter video url":CE "https://www.youtube.com/" \
    --image=browser-download --image-on-top --field="Download!gtk-download:fbtn" "$ytdownload" &

yad --plug="$ytdkey" --tabnum=2 --window-icon="$ICON" \
      --progress  --borders=6 <&3 &

  ytdl_version &

yad --paned --key="$ytdkey"  \
    --button="Stop":"bash -c get_pid_and_kill"  --text="" --width=500 --height=200 \
    --title=$"YouTube Downloader" --image=browser-download --window-icon="$ICON" --center

exec 3>&-
Fred

User avatar
misko_2083
Posts: 114
Joined: Tue 08 Nov 2016, 13:42

#313 Post by misko_2083 »

fredx181 wrote:
misko_2083 wrote:Very Happy Glad to help.

Hey fredx181, how would you end the youtube-dl process in the folowing script? Without "killall youtube-dl" of course.
The below works for me (although probably can be better, more simple), but hey! I thought you were the expert :)
Nice script, btw :wink:
Me? An expert? Good one Fred. :D
Changed some bits.

Code: Select all

#!/bin/bash

export ytdownload='@bash -c "download_video %1"'

# We need this to store the youtube PID
export ytdpid=$(mktemp -u --tmpdir ytpid.XXXXXXXX)

export ytdpipe=$(mktemp -u --tmpdir ytd.XXXXXXXX)
mkfifo "$ytdpipe"
export ytdpipetwo=$(mktemp -u --tmpdir ytd2.XXXXXXXX)
mkfifo "$ytdpipetwo"

trap "rm -f $ytdpipe $ytdpipetwo $ytdpid" EXIT

ytdkey=$(($RANDOM * $$))

function download_video
{
  echo "2:@disable@"
# Check if the URL is valid with the spider
if wget -q --spider "$1"; then
  echo "#Preparing to download" >> "$ytdpipe"

   >"$ytdpid"
   while read line; do
     if [[ "$(echo $line | grep '[0-9]*%')" ]];then
        percent=$(echo $line | awk '{print $2}')
        echo "${percent%.*}%" >> "$ytdpipe"
     fi

     if [[ "$(echo $line | grep '\[download\]')" ]];then
        progress=$(echo $line | awk '{$1=""; print $0}')
        echo "#$progress" >> "$ytdpipe"
     fi
   done < "$ytdpipetwo" &
   LOOP_PID="$!"

    youtube-dl -f 'bestvideo [ext = mp4] + bestaudio [ext = m4a] / bestvideo + bestaudio' --merge-output-format mp4 --newline -i -o "%(title)s.%(ext)s" "$1" 2>&1 >> $ytdpipetwo & echo $! > "$ytdpid"
    wait $!

    if [[ "$?" = 0 ]]
      then
         echo "100%" >> "$ytdpipe"
         echo "#Download completed." >> "$ytdpipe"
         kill "$LOOP_PID"
    elif [[ ! -s "$ytdpid" ]]; then
         echo "#Download canceled" >> "$ytdpipe"
         kill "$LOOP_PID"
    else
         echo "#Download error" >> "$ytdpipe"
         kill "$LOOP_PID"
    fi
else
    echo "#Invalid URL" >> "$ytdpipe"
fi

    echo "2:$ytdownload"
}
export -f download_video

function ytdl_version () {
    echo "#Checking youtube-dl version" >> "$ytdpipe"
    wget --spider --user-agent="Mozilla/5.0 Gecko/20100101" --timeout=30 -q "https://rg3.github.io/youtube-dl/" -O /dev/null
    if [[ "$?" -ne "0" ]]; then
       echo "#Can't connect to youtube-dl server site" >> "$ytdpipe"
    fi
    ytdlcv=$(youtube-dl --version)
    ytdllv=$(wget -O- -q "https://rg3.github.io/youtube-dl/update/LATEST_VERSION")
    if [[ "$ytdlcv" == "$ytdllv" ]]; then
       echo "#youtube-dl is up-to-date"  >> "$ytdpipe"
    else
       echo "#youtube-dl update is available" >> "$ytdpipe"
    fi
}

function get_pid_and_kill () {
if [[ -s "$ytdpid" ]]; then
  BCKUPID="$(<$ytdpid)"
  >"$ytdpid"
  kill $BCKUPID 2>/dev/null
fi
}
export -f get_pid_and_kill 

exec 3<> $ytdpipe
exec 4<> $ytdpipetwo

yad --plug="$ytdkey" --tabnum=1 --form --field "Enter video url":CE "https://www.youtube.com/" \
    --image=browser-download --field="Download!browser-download:fbtn" "$ytdownload" &

yad --plug="$ytdkey" --tabnum=2 --window-icon="$ICON" \
      --progress  --borders=6 <&3 &

  ytdl_version &

yad --paned --key="$ytdkey"  \
    --button="Stop":'bash -c "get_pid_and_kill" 2>/dev/null'  --text="" --width=500 --height=200 \
    --title=$"YouTube Downloader" --window-icon="$ICON" --center

exec 3>&-
exec 4>&-
Added another named pipe. You can never make enough of those. :D
This way I can check the exit status of youtube-dl.
or in other words, if the user has canceled and if download has failed.
Also added a check if url is correct "wget -q --spider $URL" (nothing fancy) :)
Tested, it kills only the current process, leaves that one in another window alone.
Could't find a way to kill the download process in case I click on the window button [X]. Hey, you can't have it all. I whish that yad paned dialog could nuke everything on exit.

This was fun :)
Back to that internet radio Yad UI I was working on...http://i.imgur.com/oEHIhXP.png

EDIT: I had a huge headake last night. :roll:
Forgot to say this: Thank you Fred.
Oh, man, things with paned dialogs are complicated. :lol:

achim
Posts: 48
Joined: Thu 13 Apr 2017, 19:36
Location: Germany

Fax with YAD

#314 Post by achim »

Hello everybody,

I use the WF-3520 multifunction device from Epson among other things also to fax. There is a FAX driver to the device, which I call from the terminal under Ubuntu 16.04 with the command "epfax -P pc-fax -o fax-number = 0236112345678 testfax2.pdf" and send the document.
For some time I have been working enthusiastically with YAD and would like to run this action via a script. The name and fax number are to be queried via a window and then transferred to the command. A good thing would be a history, so I do not have to enter everything again next time. For example, to print a selected file, I use this script:

#! / Bin / bash

Lpoptions -d WF-3520-Series
For i in $ NEMO_SCRIPT_SELECTED_URIS
do
Soffice --invisible --norestore -p $ i
done

This is how I would like to use the FAX driver.

Has anyone from the experts here present a suggestion to the settlement with YAD?

I thank you in advance.

achim
Posts: 48
Joined: Thu 13 Apr 2017, 19:36
Location: Germany

Fax with YAD

#315 Post by achim »

Hello experts,

To my solution "fax with yad" I have put together the code listed below. It works as far as history. If you have any suggestions for improvement, I would be very happy.

Achim

Code: Select all

#! /bin/bash

XTERM="xterm"

# create history file
mkdir -p ${XDG_CACHE_HOME:-$HOME/.cache}/
HISTFILE=${XDG_CACHE_HOME:-$HOME/.cache}/ix1-run.history
touch $HISTFILE

# create and run dialog
TITLE="Faxprogramm vorbereiten..."
TEXT="\nFaxnummer eingeben und Enter drücken:\n"
fnr=$(yad --width=500 --center --window-icon="gtk-execute" --name="${0##/}" --title="$TITLE" --text="$TEXT" --image="gtk-execute" --editable --entry --rest $HISTFILE)

TITLE="Faxprogramm starten..."
TEXT="\nName eingeben und Enter drücken:\n"
nam=$(yad --width=500 --center --window-icon="gtk-execute" --name="${0##/}" --title="$TITLE" --text="$TEXT" --image="gtk-execute" --editable --entry --rest $HISTFILE)



# run command

dat="datei.pdf"

epfax -P pc-fax -o fax-number=$fnr $dat



sleep .1

if grep -c 'Befehl nicht gefunden' /tmp/run-command-error; then
yad --fixed --title="Falsche Eingabe!" --image "dialog-warning" --text="\n Die Fax-Nummer \n\n               $fnr\n\n ist nicht korrekt,\n bitte noch einmal versuchen!      \n" --timeout="10" --no-buttons
rm /tmp/run-command-error
basename "$0"
else
# add command to history
head $HISTFILE | grep -qF "$fnr" || echo -e "$fnr && $nam\n$(<$HISTFILE)" > $HISTFILE
fi
exit 0

User avatar
misko_2083
Posts: 114
Joined: Tue 08 Nov 2016, 13:42

yad internet radio player

#316 Post by misko_2083 »

Not so much stations in this little internet radio player, but at least got it working. Requres: mpv and yad

The radio stations are in a separate file, and should be in the same folder.
Otherwise, it can be this line in the script:

Code: Select all

export pmrp_stations="stations"
Attachments
pmrp.tar
(20 KiB) Downloaded 212 times
pmrp.png
(80.58 KiB) Downloaded 1171 times

drxspace
Posts: 3
Joined: Fri 28 Jul 2017, 10:37

#317 Post by drxspace »

Hello everyone,

as I've post here: https://groups.google.com/d/msg/yad-com ... owMLv_FwAJ, I'm facing the same issue. Take for example the next code:

Code: Select all

yad --form --width=320 --height=240 --borders=5 --fixed --center \
	    --window-icon="system-software-install" --title="About ArchLinux Packages Viewer" \
	    --image="system-software-install" --image-on-top \
	    --text="<span font_size='medium' font_weight='bold'>View Lists of Installed Packages</span>\n\
These are packages from all enabled \nrepositories except for base and base-devel \nones. Also, you\'ll find packages that \nare locally installed such as AUR packages." \
	    --buttons-layout="center" \
	    --button=$"Κλείσιμο!window-close!Κλείνει το πα

User avatar
smokey01
Posts: 2813
Joined: Sat 30 Dec 2006, 23:15
Location: South Australia :-(
Contact:

#318 Post by smokey01 »

[quote="drxspace"]Hello everyone,

as I've post here: https://groups.google.com/d/msg/yad-com ... owMLv_FwAJ, I'm facing the same issue. Take for example the next code:

Code: Select all

yad --form --width=320 --height=240 --borders=5 --fixed --center \
	    --window-icon="system-software-install" --title="About ArchLinux Packages Viewer" \
	    --image="system-software-install" --image-on-top \
	    --text="<span font_size='medium' font_weight='bold'>View Lists of Installed Packages</span>\n\
These are packages from all enabled \nrepositories except for base and base-devel \nones. Also, you\'ll find packages that \nare locally installed such as AUR packages." \
	    --buttons-layout="center" \
	    --button=$"Κλείσιμο!window-close!Κλείνει το πα
Attachments
example.png
(13.32 KiB) Downloaded 1103 times

drxspace
Posts: 3
Joined: Fri 28 Jul 2017, 10:37

#319 Post by drxspace »

Hello,
thank you for your response.
smokey01 wrote:What version of Yad are you using? yad --version
I'm running YAD 0.39.0 (GTK+ 3.22.18)

To be honest I've never thought that I could use string type values in these fields.

Anyway in order to address my problem I have to insist with with a different version of the same example.
In this version I removed some of the \n characters because I want my text, if possible, to be dynamically wrapped in the dialog window, also I removed the --fixed option...

Code: Select all

yad --form --width="350" --height="130" --borders=5 --center --window-icon="system-software-install" --title="About ArchLinux Packages Viewer" --image="system-software-install" --image-on-top --text="<span font_size='medium' font_weight='bold'>View Lists of Installed Packages</span>\nThese are packages from all enabled repositories except for base and base-devel ones. Also, you\'ll find packages that are locally installed such as AUR packages." --buttons-layout="center" --button='Κλείσιμο!window-close!Κλείνει το πα
Attachments
About ArchLinux Packages Viewer.png
(15.23 KiB) Downloaded 1059 times

User avatar
smokey01
Posts: 2813
Joined: Sat 30 Dec 2006, 23:15
Location: South Australia :-(
Contact:

#320 Post by smokey01 »

@drxspace I am currently using yad 0.36.3 (GTK+ 2.24.31)

It may have something to do with gtk+3 or ArchLinux (assuming you are running Arch) as it's working fine here.

Post Reply