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 Tue 02 Sep 2014, 18:04
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
xcowsay talking lobster? new x message display with icon
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 3 of 6 [85 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6 Next
Author Message
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Sun 27 Jun 2010, 12:30    Post subject:  

technosaurus
Quote:
--dream is broken - it uses pwd as / (so it only works if you cd to /)


if that part is broken and you fixed it please make a patch against the original source code
the author would like to see that * and I would too and would add it to xcowsay
it will be very difficult to follow updated versions by changing official command line options
and using code snippets from the official website

doing something like this in the sources just to rename everything to xpupsay doesnt improve the code unless of course that part was broken
Code:
grep -rl xcowsay /root/xcowsay-1.2/xcowsay-1.2/ | xargs sed -i 's/xcowsay/xpupsay/g'



life could get more complicated quickly with something like this
Code:

#! /bin/pup-bash
pup-ls -1
.pup-config --pup-prefix=/pup-usr

pup-make
pup-makeinstall

pup-uname -r

pup-gcc -lpthread -o puptheworld puptheworld.c


if you have a need to repackage xcowsay with new features added thats fine
but at least we should maintain the official command line options
since they are working correctly as is

Joe

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Sun 27 Jun 2010, 15:23    Post subject:  

vovchik
Quote:
xcowsay can also make use of a .xcowsayrc file in the users $HOME directory. Mine now contains the following:




much easier to have some way to preset a config file



Lobster
Quote:

. . . and I have a strange feeling that the alligator in Jemimahs pond
may start talking in Fluppy



I dont know who the alligator may be in that story
but I used to live in Florida and fished in many remote places where alligators were present and very large but they keep away from people

the risks you take to go fishing you have to a fanatic Very Happy

P.S Jemimah is friendly and easy to talk to so I tried out the latest Fluppy
which was the only puppy iso I had tried out since the release of puppy 4.12
as for me I have a lot of work to do building my next iso
what is most important to me is understanding how to build a distro
the simple way with packages even if it takes me along another road to set it all up
I am enjoying the walk and dont let other things distract my plan


Joe

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though

Last edited by big_bass on Sun 27 Jun 2010, 17:48; edited 1 time in total
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Sun 27 Jun 2010, 16:53    Post subject:  

Dear all xcowsayers,

Here is the relevant bit from the man regarding config files:

Quote:

CONFIGURATION FILE

xcowsay reads a configuration file on startup. The configuration file can be stored in the XDG compliant location $XDG_CONFIG_HOME/xcowsayrc (which will default to $HOME/.config/xcowsayrc) or in your home directory at $HOME/.xcowsayrc. If the --config=FILE command line option is passed FILE will be processed after your personal configuration file.
The configuration file consists of 'option = value' pairs, one per line. The valid keys are given in the next section. For example, the following line sets display time to 10 seconds:
display_time = 10000
The character '#' begins a comment which lasts until the end of the line.


In theory, one could have, say, five different config files for different situations: warning, error, confirmation, info, WTF#@!, and call them up with appropriate text as the second argument, or one script with a case statement that would load the appropriate one. The images could be different and appropriate for each situation.

Just an idea....

With kind regards,
vovchik
Back to top
View user's profile Send private message 
JustGreg

Joined: 24 May 2005
Posts: 668
Location: Connecticut USA

PostPosted: Sun 27 Jun 2010, 17:00    Post subject:
Subject description: xpupsay can use configuration file
 

I read about xcowsayrc configuration file. So, I created the following configuration file .xpupsayrc in root and found it worked nicely.
Code:
display_time=4
#alt_image=/usr/share/xpupsay/pup_small.png
at_y=200
at_x=600

I found the alt_image entry always resulted in the pup_small.png being used and the command line entry for image being overridden. I commented it out to allow the image I want to be display. Thanks, vovchik for the information on configuration files from the man page.

_________________
Enjoy life, Just Greg
Live Well, Laugh Often, Love Much

Last edited by JustGreg on Mon 28 Jun 2010, 10:30; edited 1 time in total
Back to top
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Mon 28 Jun 2010, 09:15    Post subject:  

there is active recent development with xcowsay
so if you wanted new features or would like to suggest a patch
it would be done by the author and maintaining documented progress of the program
such as the correct way using GIT
this is the only way linux will progress in an organized way

leave a comment on the main xcowsay page I did Very Happy


main page
http://www.doof.me.uk/xcowsay/


GIT
http://git.nickg.me.uk/?p=xcowsay.git;a=summary


how about a funny error message

add time 20 seconds
add an exact location on the screen(right 200 and down 100 ) or x=200 and y=100

Code:

#!/bin/sh

TEXT_MESG="looks like you messed up big time"
IMG=donkey
exec xcowsay --time=20 --at=200,100 --cow=$IMG   $TEXT_MESG "$@"
error-msg.png
 Description   
 Filesize   63.07 KB
 Viewed   1333 Time(s)

error-msg.png


_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Mon 28 Jun 2010, 13:55    Post subject:  

Dear Puppians,

Using printf has advantages - you can display an exclamation mark, for instance, and use a newline escape sequence. Here is a little example:

Code:
#!/bin/bash

# *****************************************************
# PROGRAM:   xcowtest
# PURPOSE:   test of xcowsay
# AUTHOR:      vovchik (Puppy Linux forum)      
# DEPENDS:   bash,
# PLATFORM:   Puppy Linux (actually, any *nix)
# DATE:      28-06-2010
# *****************************************************

# cfg overrides img argument!!!
# sec overrides rc display_time=xx!!!

# *********************
# FUNCTIONS
# *********************

# --------------------
function init_vars()
# --------------------
{
   cfg="$HOME/.xcowfelix1rc"
   txt="HELP\n ME!"
   img="/usr/share/xcowsay/felix.png"
   sec=10
   fnt="DejaVu Sans Bold 15"
   snd="/root/my-documents/audio/pop.wav"
}

# --------------------
function display_message()
# --------------------
{
   play "$snd" 2> /dev/null&
   printf %b "$txt" | xcowsay --image="$img" --time=$sec --font="$fnt"
}

# *********************
# END FUNCTIONS
# *********************

# *********************
# MAIN
# *********************

init_vars
display_message

# *********************
# END MAIN
# *********************


I am having fun.

With kind regards,
vovchik
Back to top
View user's profile Send private message 
Lobster
Official Crustacean


Joined: 04 May 2005
Posts: 15117
Location: Paradox Realm

PostPosted: Mon 28 Jun 2010, 17:21    Post subject:  

Quote:
I am having fun.

I am having prawns.
Smile

took your code
modified for xpupsay
and flite
to produce this

Code:
#! /bin/bash

txt1="Welcome to Puppy.\n
A computers best friend.\n
An operating system that works!"
   
txt2="Made with Puppy magic and the best Ubuntu bits.\n
Puppy heart, recognition and scripting!"   

txt3="What is new for 5.1 of Puppy Lucid?\n
Upgraded scripts and programs.\n
New quickpet. More working packages.\n
Latest Browsers: FireFox, Chrome, and Opera." 

   sec=10
   fnt="DejaVu Sans Bold 15"

# --------------------
function display_message()
# --------------------
{
#   play "$snd" 2> /dev/null&

cd /
xpupsay --pup=puppy --time=2 --dream=/usr/share/doc/community48.jpg "$@"
aplay /usr/share/audio/2barks.au "$@" &

   printf %b "$txt1" | xpupsay --time=$sec --font="$fnt" "$@" | flitet "Welcome to Puppy. A computers best friend. An operating system that works!" | aplay &
 sleep $sec
   printf %b "$txt2" | xpupsay --time=$sec --font="$fnt" "$@" | flitet "Made with Puppy magic, and the best Ubuntu bits. Puppy heart, recognition and scripting!" | aplay &
 sleep $sec
   printf %b "$txt3" | xpupsay --time=12 --font="$fnt" "$@" | flitet "What is new for 5.1 of Puppy Lucid? Upgraded scripts and programs. New quick pet. More working packages. Latest Browsers: FireFox, KerRome, and Opera." | aplay &
 sleep 14

cd /
xpupsay --pup=puppy --time=2 --dream=/usr/share/doc/community48.jpg "$@" &
aplay /usr/share/audio/2barks.au "$@" &
}

# *********************
# END FUNCTIONS
# *********************

# *********************
# MAIN
# *********************

init_vars
display_message

# *********************
# END MAIN
# *************


Incidentally whilst we are having fun
Barry is preparing a spup
that can run Windows programs
at native speed
check his blog
http://bkhome.org/blog/?viewDetailed=01680

Puppy Linux
We have Fun

_________________
Puppy WIKI
Back to top
View user's profile Send private message Visit poster's website 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Tue 29 Jun 2010, 06:23    Post subject:  

Dear Puppians,

Xcowsay does UTF-8 nicely. Here is proof of the pudding (in Japanese, Chinese and Russian). I like it. Smile

With kind regards,
vovchik

PS. Thanks for the Longene info, Lobster. Now, that will be fun! Smile
xcow-jpn-chn.jpg
 Description   
 Filesize   6.97 KB
 Viewed   1235 Time(s)

xcow-jpn-chn.jpg

xcow-cyr.jpg
 Description   
 Filesize   23.65 KB
 Viewed   1212 Time(s)

xcow-cyr.jpg

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

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Tue 29 Jun 2010, 12:47    Post subject:  

before things get crazy with two different coding languages

heres a repair tool

a drag N drop tool to convert back to the standard code so we could share code snippets

drag your code file onto the script


Code:

#! /bin/bash

# drag N drop file on this script to repair it
# call this dnd-cowsay-repair


# rename code back to a standard official code

#renames xpupsay back to xcowsay
#renames --pup back to --cow

# E-I-E-I-O :D

sed -i 's/xpupsay/xcowsay/g' "$@"
sed -i 's/--pup/--cow/g' "$@"
sed -i 's/xpupdream/xcowdream/g' "$@"
sed -i 's/xpupfortune/xcowfortune/g' "$@"
sed -i 's/xpupthink/xcowthink/g' "$@"



using Lobster's nice code snippet just as an example how it will get converted to this
BTW Lobster the coding is looking good and many great things there I just want to give it a try too

Code:


#! /bin/bash

txt1="Welcome to Puppy.\n
A computers best friend.\n
An operating system that works!"
   
txt2="Made with Puppy magic and the best Ubuntu bits.\n
Puppy heart, recognition and scripting!"   

txt3="What is new for 5.1 of Puppy Lucid?\n
Upgraded scripts and programs.\n
New quickpet. More working packages.\n
Latest Browsers: FireFox, Chrome, and Opera."

   sec=10
   fnt="DejaVu Sans Bold 15"

# --------------------
function display_message()
# --------------------
{
#   play "$snd" 2> /dev/null&

cd /
xcowsay --cow=puppy --time=2 --dream=/usr/share/doc/community48.jpg "$@"
aplay /usr/share/audio/2barks.au "$@" &

   printf %b "$txt1" | xcowsay --time=$sec --font="$fnt" "$@" | flitet "Welcome to Puppy. A computers best friend. An operating system that works!" | aplay &
 sleep $sec
   printf %b "$txt2" | xcowsay --time=$sec --font="$fnt" "$@" | flitet "Made with Puppy magic, and the best Ubuntu bits. Puppy heart, recognition and scripting!" | aplay &
 sleep $sec
   printf %b "$txt3" | xcowsay --time=12 --font="$fnt" "$@" | flitet "What is new for 5.1 of Puppy Lucid? Upgraded scripts and programs. New quick pet. More working packages. Latest Browsers: FireFox, KerRome, and Opera." | aplay &
 sleep 14

cd /
xcowsay --cow=puppy --time=2 --dream=/usr/share/doc/community48.jpg "$@" &
aplay /usr/share/audio/2barks.au "$@" &
}

# *********************
# END FUNCTIONS
# *********************

# *********************
# MAIN
# *********************

init_vars
display_message

# *********************
# END MAIN
# *************











Joe

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though

Last edited by big_bass on Wed 30 Jun 2010, 09:23; edited 1 time in total
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Tue 29 Jun 2010, 17:22    Post subject:  

Dear Joe,

I can't seem to get enough of a good thing. I modified your very nice but laconic xcow-repair script to use xcowsay, so that the user knows that he is doing. If there is no file dropped but just a mouse click, there is an appropriate message. This is fun Smile

With kind regards,
vovchik

Code:
#!/bin/bash

# ********************************************************
# PROGRAM:   xcow-repair
# PURPOSE:   drag-n-drop file on this script to repair
#          it - i.e. make xpupsay standard xcowsay.
# AUTHOR:      big_bass (Joe - Puppy Linux forum)
# MODDED:      vovchik (to use xcowsay fir notification :)
# DEPENDS:   bash, aplay, xcowsay, sed
# PLATFORM:   Puppy Linux (actually, any *nix)
# DATE:      30-06-2010
# ********************************************************

# *********************
# FUNCTIONS
# *********************

# --------------------
function init_vars()
# --------------------
{
   org_file="$@"
   alt_txt="No file to process!\nDrag an xpupsay file\nonto this script\nto restore it as\nstandard xcowsay!"
   txt="Fixing $org_file\nfor standard xcowsay!"
   sec=4
   fnt="DejaVu Sans Bold 15"
   snd="/usr/share/audio/2barks.au"
}


# --------------------
function fix_file()
# --------------------
{
      sed -i 's/xpupthink/xcowthink/g' "$@"
      sed -i 's/xpupsay/xcowsay/g' "$@"
      sed -i 's/--pup/--cow/g' "$@"
      sed -i 's/xpupdream/xcowdream/g' "$@"
      sed -i 's/xpupfortune/xcowfortune/g' "$@"
      sed -i 's/xpupthink/xcowthink/g' "$@"
}

# --------------------
function display_message()
# --------------------
{
   aplay "$snd" 2> /dev/null&
   if [ -e "$org_file" ] ; then
      printf %b "$txt" | xcowsay --time=$sec --font="$fnt" &
        fix_file "$org_file"
   else
      printf %b "$alt_txt" | xcowsay --time=$sec --font="$fnt" &
      exit 1
   fi
}


# *********************
# END FUNCTIONS
# *********************

# *********************
# MAIN
# *********************

init_vars "$@"
display_message &
exit 0

# *********************
# END MAIN
# *********************
Back to top
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Tue 29 Jun 2010, 22:36    Post subject:  

Hey vovchik
Quote:
I modified your very nice but laconic xcow-repair script



yes ! thank you

I am very blunt most of the time but I never say more than I mean or less
any attempt of trying to be eloquent for me is with much forced effort
I do agree with you 100% in my very short and to to the point way of writing
if it be code or a simple post I already feel I used too many words Laughing

thanks for the structured well written re write of the code snippet

P.S the pop up messages are too cool Cool

Joe

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Wed 30 Jun 2010, 05:52    Post subject:  

Dear Puppians,

Now, this is COOL!!!! You can use text attributes just as gtkdialog does with markup. The syntax is described here: http://library.gnome.org/devel/pango/stable/PangoMarkupFormat.html. It is a great little discovery. I also discovered, thanks to Lobster, that if you change the dir to /, you can use your own base image and your own dream image. This is my silly example of pretty text:
Code:
printf %s '<span foreground="blue" size="x-large">Blue text</span> is <i>cool</i>!' | xcowsay


To select your own image and dream image, simply precede your xcowsay invocation with "cd /" and then use something like this:

Code:
xcowsay --image="/usr/share/xcowsay/felix3.png" --time=10 --dream="/usr/share/xcowsay/felix.png"


With kind regards,
vovchik
xcow-dream.jpg
 Description   
 Filesize   14.04 KB
 Viewed   1112 Time(s)

xcow-dream.jpg

xcow-txt-attr.jpg
 Description   
 Filesize   9.54 KB
 Viewed   1124 Time(s)

xcow-txt-attr.jpg

Back to top
View user's profile Send private message 
Lobster
Official Crustacean


Joined: 04 May 2005
Posts: 15117
Location: Paradox Realm

PostPosted: Wed 30 Jun 2010, 07:41    Post subject:  

Good work Vovchik
Joe I followed up your suggestion to contact the developer
. . . coming soon new feature . . .

Quote:
Lobster to Nick Gasson:
I am the lobster from another dimension that found and suggested your program for Puppy (it has now morphed into xpupsay) I would recommend left and right sides for the image - so a Q and A type situation can be developed. Many thanks Smile

Quote:
Nick Gasson to Lobster:
Thanks for your suggestion. It would be fairly simple to add so I'll try to include it in the next release.


Any other features we need that may be simple to implement . . .
contact the developer here in the comments
http://www.doof.me.uk/xcowsay/

_________________
Puppy WIKI
Back to top
View user's profile Send private message Visit poster's website 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Wed 30 Jun 2010, 08:43    Post subject:  

Dear Puppians,

I have a demo here of xcowsay speaking nicely, and showing markup. You need either festival or espeak to hear sounds. flitet sounds much worse on my machine than festival. Lobster might be interested in the routine that strips off the markup language, which I have added, so that the same text variable can be used for both sound and display. The png files and script are in the archive, as is a readme.

With kind regards,
vovchik

PS. Lobster and Joe: I have left a nice note for Nick on his site. You might want to mention to him that antialiasing of the "comment" graphics would be a nice touch, as would be 32 bbp and the full alpha channel for image display. There is quite a bit of calculation for "clouds" and rounded boxes in the source, so this might not be so easy as the suggestion regarding positioning.
xcow-red-text.jpg
 Description   
 Filesize   16.96 KB
 Viewed   1120 Time(s)

xcow-red-text.jpg

felix-demo.tar.gz
Description 
gz

 Download 
Filename  felix-demo.tar.gz 
Filesize  37.05 KB 
Downloaded  479 Time(s) 
Back to top
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Wed 30 Jun 2010, 12:21    Post subject:  

Hey vovchik

I see in my minds eye a few good things comming

1.) By the not using the standard code of xcowsy using "xpupsay"
which I admit to be very annoying but it turned out to give me a good Idea about
code conversions being able to translate code from one language to another
so in a way in the end I am thankful technosaurus changed the code or I wouldnt of had a need to change it back and then code conversion I would had missed out on
so all is well that ends well

2. the pango mark format I can see that I wrote a lot of code to make html indexes generated from bash drag n drop indexers I needed while building a website

I was working on this today editing one of my scripts to generate html code
it would be possible to make a GUI to to enter the values such as
Code:
<span foreground="blue" size="x-large">Blue text</span>


and ask forr background color , size ,text etc...

then have it generate the code using bash
pretty easily since only the GUI needs to be made I have the code to convert it
already only sight modifications were needed

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 3 of 6 [85 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
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.1513s ][ Queries: 13 (0.0279s) ][ GZIP on ]