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 Mon 23 Sep 2019, 12:24
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
YAD - Tips
Post new topic   Reply to topic View previous topic :: View next topic
Page 47 of 49 [734 Posts]   Goto page: Previous 1, 2, 3, ..., 45, 46, 47, 48, 49 Next
Author Message
stemsee

Joined: 27 Jun 2013
Posts: 2464
Location: In The Way

PostPosted: Thu 22 Aug 2019, 13:54    Post subject:  

Cool

in the trans script find google and change http: to https: problem solved.
Code:
function googleInit() {
HttpProtocol = "https://"
HttpHost = "translate.googleapis.com"
HttpPort = 80
}
function googleRequestUrl(text, sl, tl, hl,    qc) {
qc = Option["no-autocorrect"] ? "qc" : "qca";
return HttpPathPrefix "/translate_a/single?client=gtx"\
"&ie=UTF-8&oe=UTF-8"\
"&dt=bd&dt=ex&dt=ld&dt=md&dt=rw&dt=rm&dt=ss&dt=t&dt=at&dt=gt"\
"&dt=" qc "&sl=" sl "&tl=" tl "&hl=" hl\
"&q=" preprocessByDump(text)
}
function googleTTSUrl(text, tl) {
return HttpProtocol HttpHost "/translate_tts?ie=UTF-8&client=gtx"\
"&tl=" tl "&q=" preprocessByDump(text)
}
function googleWebTranslateUrl(uri, sl, tl, hl) {
return "https://translate.google.com/translate?"\
"hl=" hl "&sl=" sl "&tl=" tl "&u=" uri


yandex is much more complex because the site has a translation limit for each visitor. it also requires user input 'captcha' to open service, also urls in the trans script are old and incorrect. I am learning the api for yandex.

stemsee

EDIT harldy yad related anymore![/code]
Back to top
View user's profile Send private message MSN Messenger 
stemsee

Joined: 27 Jun 2013
Posts: 2464
Location: In The Way

PostPosted: Thu 22 Aug 2019, 17:46    Post subject:  

My retro version, still with yandex. with engine icons
trans_tray.sfs.gz
Description  fake.gz
gz

 Download 
Filename  trans_tray.sfs.gz 
Filesize  52 KB 
Downloaded  22 Time(s) 
Back to top
View user's profile Send private message MSN Messenger 
josejp2424


Joined: 01 Aug 2010
Posts: 492

PostPosted: Thu 22 Aug 2019, 21:01    Post subject: trans_tray  

stemsee wrote:
My retro version, still with yandex. with engine icons


I like your version.

Thank you.

_________________
Shiba Inu | Pupjibaro jessie | My Blog
Back to top
View user's profile Send private message Visit poster's website 
mfb

Joined: 22 Mar 2016
Posts: 82

PostPosted: Fri 23 Aug 2019, 00:59    Post subject:  

Hi stemsee,

Thank you very much for your all-that's-needed sfs @ two posts above this one.

The shot below shows the output from the German (in my clipboard):
Quote:
Also mein erstes Problem war schon, das ich das Deutsche Sprachpaket

having chosen output using Google, Bing and Yandex in Danish, Dutch, English and Esperanto.

-------------------------------------------------

I seem to recall you are fluent in 6 or 7 languages, Argolance, Fredx181 and Vovchik also have multi-language fluency and are also star app-makers who have already directed their minds to language translation issues.

My thoughts, tongue-in-cheek, are:

* would be good to auto-fast-remove the sfs on tray exit
* and (perhaps) to add a right-click Preferences section
for say unticking "exit confirmation"
Ticking full screen display
Choosing a male or female voice
* Additional selection of text to speech
* Translating a lengthy piece (e.g. a book) with progress indicator.
* Save and restore (with alternative options)

and the miracle of including any original pictures in the output.

As regards the "auto-fast-remove" Forum member seaside has already facilitated this and MochiMoppel has done it for pets (your sfs could be easily converted to a pet for any user who needs or prefers that).

This thread may not be the most appropriate place to implement any such thoughts - and Argolance and Vovchik have already provided alternative translation apps elsewhere (so perhaps they might add links and brief comments)

My special thanks to all with honourable mention above.
ex German.jpg
 Description   
 Filesize   93.42 KB
 Viewed   411 Time(s)

ex German.jpg

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

Joined: 27 Jun 2013
Posts: 2464
Location: In The Way

PostPosted: Fri 23 Aug 2019, 04:32    Post subject:  

mfb wrote:
Hi stemsee,

Thank you very much for your all-that's-needed sfs @ two posts above this one.
you're welcome
I
Quote:
seem to recall you are fluent in 6 or 7 languages, Argolance, Fredx181 and Vovchik also have multi-language fluency and are also star app-makers who have already directed their minds to language translation issues.
are you a stalker? Laughing
yes, 7 and counting. I have also learnt the Russian, Greek and Hebrew alphabets. I tried Sanskrit grammar but didn't get far, at least not as far as with welsh!!! My 6 year old son learnt to read and speak Welsh phonetics in 2 weeks (you'd think the school would notice an absolute genius and get him into a private school as by law there are places reserved for poor talented kids .... England is however even more corrupt and racist than USA, China and Russia put together! Truth is stranger than fiction). Now he is 10 and learning the drums by computer gaming method - speaks Spanish, Welsh, English and Chinese! Still no place in school though, 'coz we be cheeky!!

Quote:
My thoughts, tongue-in-cheek, are:

* would be good to auto-fast-remove the sfs on tray exit
* and (perhaps) to add a right-click Preferences section
for say unticking "exit confirmation"
Ticking full screen display
Choosing a male or female voice
* Additional selection of text to speech
* Translating a lengthy piece (e.g. a book) with progress indicator.
* Save and restore (with alternative options)

and the miracle of including any original pictures in the output.

As regards the "auto-fast-remove" Forum member seaside has already facilitated this and MochiMoppel has done it for pets (your sfs could be easily converted to a pet for any user who needs or prefers that).
Only this?! Nothing else? Are you sure you're not GCMartin in disguise? Laughing

Sfs unload on exit .... easy
rightclick menu with more options - easy
Voice translation is more interesting for me, and embedded images - probably requires yad --html
Progress indicator - easy .... progress indicator with real progress indication ... FRED!!?
Lengthy translations - easy - simply reiterate after 3000 characters or alternate between different engines.
Save and Restore and with EDITs - easy
'Alternative options' what the hell does that mean???

Quote:

This thread may not be the most appropriate place to implement any such thoughts
no shiite!
Quote:
- and Argolance and Vovchik have already provided alternative translation apps elsewhere (so perhaps they might add links and brief comments)
please do...

Quote:
My special thanks to all with honourable mention above.
and me!

What's it worth to you? Rolling Eyes

stemsee
Back to top
View user's profile Send private message MSN Messenger 
fredx181


Joined: 11 Dec 2013
Posts: 4095
Location: holland

PostPosted: Fri 23 Aug 2019, 07:47    Post subject:  

Nice stemsee ! I like the tray icon change.

Attached my 'take', included the tray icon change, but difference is that .svg icons are used.
I like vovchiks's "self contained" approach, so converted the .png icons to .svg and added the .svg codes in the script (is rather large now because of that)
(used the java based program for converting to .svg from here: https://github.com/jankovicsandras/imagetracerjava)
Also removed Yandex and added some extra's to the Menu, "Help" and "Install/Upgrade trans"

Fred
2019-08-23-134304_659x712_scrot_559x604.jpg
 Description   
 Filesize   105.45 KB
 Viewed   351 Time(s)

2019-08-23-134304_659x712_scrot_559x604.jpg

trans_tray2.gz
Description  Remove fake .gz and make executable
gz

 Download 
Filename  trans_tray2.gz 
Filesize  109.68 KB 
Downloaded  17 Time(s) 

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


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

PostPosted: Fri 23 Aug 2019, 08:32    Post subject:  

Bonjour,

All this is very exciting! Very Happy

@josejp2424
I don't know why you said you were:
josejp2424 wrote:
amused by your comments

Be assured I don't take this the wrong way. I'm rather glad I entertained you but it is true and seems to have gone unnoticed:
argolance wrote:
By default, the middle mouse button closes the notification icon and therefore, the "exit" menu entry may not be necessary, unless the central button is disabled.

This may not have been clearly expressed: a click with the middle button of the mouse on the systray icon closes it. So there is one of the two possibilities to exit that is useless. It seems (to me) that the exit with the middle button should be disabled in the yad script... especially since it is easy to click it by accident!

Cordialement.

_________________

A second life for your PCs...
Back to top
View user's profile Send private message Visit poster's website 
stemsee

Joined: 27 Jun 2013
Posts: 2464
Location: In The Way

PostPosted: Fri 23 Aug 2019, 10:18    Post subject:  

fredx181 wrote:
Nice stemsee ! I like the tray icon change.

Attached my 'take', included the tray icon change, but difference is that .svg icons are used.
I wanted to do that, but after editing just the normal png files for ages, I couldn't be bothered. So thnx

Quote:
(used the java based program for converting to .svg from here: https://github.com/jankovicsandras/imagetracerjava)
Thanx again .... this will be useful.
Quote:
Also removed Yandex and added some extra's to the Menu, "Help" and "Install/Upgrade trans"

Fred
Good start on menu extras. Save/export translation as pdf or txt will be nice. It's looking good!

Argolance, I agree --disable-middle should be used if the exit in menu stays. I like the exit in menu, actually.

stemsee
Back to top
View user's profile Send private message MSN Messenger 
fredx181


Joined: 11 Dec 2013
Posts: 4095
Location: holland

PostPosted: Fri 23 Aug 2019, 13:17    Post subject: New topic for trans_tray  

Hi All, I'm having the feeling that this "trans_tray" development is not over yet Wink
That's why I opened new topic here:
http://murga-linux.com/puppy/viewtopic.php?t=116794

Also fine for me personally to continue here, btw, but I thought it's better to have its own thread for trans_tray, to not further "pollute" this thread, after all its purpose is for yad - tips.
So... see you there, or not... Smile

Fred

_________________
Dog Linux website
Tinylinux blog by wiak
Back to top
View user's profile Send private message 
stemsee

Joined: 27 Jun 2013
Posts: 2464
Location: In The Way

PostPosted: Fri 23 Aug 2019, 14:16    Post subject:  

Hi Misko

Can you help with this? I am trying to cat a file into a pipe. But it's not showing anything.
Code:
function savedtranstexts (){
   rm -f /tmp/TP
   stxtp=/tmp/TP
   mkfifo -m 755 $stxtp
   exec 4<> $stxtp
clr=`echo -e '\f' >/tmp/TP`
yad --plug=$$ --tabnum=1 --list --item-separator=" " --column="Saved Trans:CBE" `ls $HOME/Trans-Text*` --select-action='bash -c "$clr";cat $1 >$stxtp"'  &
yad --plug=$$ --tabnum=2 --editable --text-info <&4 &

WINDOWTITLE="Saved-Texts"
yad --window-icon=$pics/wireless.png --width=600 --height=440 --no-buttons --on-top --paned --splitter=160 --key=$$ --title="$WINDOWTITLE" --tab="Selector" --tab="Preview" --orient=hori

}; export -f savedtranstexts
Back to top
View user's profile Send private message MSN Messenger 
misko_2083


Joined: 08 Nov 2016
Posts: 84

PostPosted: Fri 23 Aug 2019, 18:15    Post subject:  

Have to add a newline character at the end because formfeed character has no effect if the file sent to text-info dialog doesn't end with the newline char.
echo -e '\n' >/tmp/TP
without it formfeed character is added at the end of the last string.

Code:
function savedtranstexts (){
   rm -f /tmp/TP
   stxtp=/tmp/TP
   mkfifo -m 755 $stxtp
   exec 4<> $stxtp
yad --plug=$$ --tabnum=1 --list --item-separator=" " --column="Saved Trans" \
    $(for f in $HOME/Trans-Text*; do [[ -f "${f}" ]] && echo "${f##*/}"; done) \
    --select-action="bash -c \"echo -e '\f' >/tmp/TP ; cd "$HOME" ; cat  "%s" >/tmp/TP ; echo -e '\n' >/tmp/TP \""  &
yad --plug=$$ --tabnum=2 --editable --text-info --listen <&4 &

WINDOWTITLE="Saved-Texts"
yad --window-icon=$pics/wireless.png --width=600 --height=440 --no-buttons --on-top --paned --splitter=160 --key=$$ --title="$WINDOWTITLE" --tab="Selector" --tab="Preview" --orient=horizontal

}; export -f savedtranstexts
Back to top
View user's profile Send private message 
stemsee

Joined: 27 Jun 2013
Posts: 2464
Location: In The Way

PostPosted: Sat 24 Aug 2019, 09:08    Post subject:  

Thanks Misko!

I could not have got even close to that!

Thank you so much! If you have the inclination to explain in detail what's going on in there I would be very grateful.

stemsee
Back to top
View user's profile Send private message MSN Messenger 
fredx181


Joined: 11 Dec 2013
Posts: 4095
Location: holland

PostPosted: Sun 25 Aug 2019, 08:52    Post subject:  

Can anyone shine a light on this ? (and possibly knows a solution/workaround ?)
Using for both examples same --geometry, the first example has shorter text than the second, for me with the first, the width can be adjusted as it should be, but not with the second one. I'm using yad version 0.38.2

Code:
GUI=$(yad --title=Test --button="gtk-quit:1" --button="gtk-ok:0" --text "This is a rather short text, width and height can be adjusted. " --geometry 700x400+70+120)


Code:
GUI=$(yad --title=Test --button="gtk-quit:1" --button="gtk-ok:0" --text "This is a rather long text, why the width cannot be adjusted ? Only height. " --geometry 700x400+70+120)


EDIT:
Actually I mean that width cannot be made smaller with the second example
EDIT2: Tried now also with yad version 0.41, same problem.
EDIT3: Btw, same problem without --geometry, just using --width and --height :
Code:
GUI=$(yad --title=Test --button="gtk-quit:1" --button="gtk-ok:0" --text "This is a rather long text, why the width cannot be adjusted ? Only height. " --center --width=700 --height=400)


Fred

_________________
Dog Linux website
Tinylinux blog by wiak
Back to top
View user's profile Send private message 
misko_2083


Joined: 08 Nov 2016
Posts: 84

PostPosted: Tue 27 Aug 2019, 10:35    Post subject:  

stemsee wrote:
Thanks Misko!

I could not have got even close to that!

Thank you so much! If you have the inclination to explain in detail what's going on in there I would be very grateful.

stemsee

Populate the list:
We skip ls, because ls is not meant for scripts.
It's designed to make a colorful, user friendly output.
We use built in
Code:
for f in $HOME/bla-bla*

If it's a file (not dir) echo file name (removes the path)
Code:
[[ -f "${f}" ]]  && echo "${f##*/}"

full
Code:
$(for f in $HOME/Trans-Text*; do [[ -f "${f}" ]] && echo "${f##*/}"; done)


Select action:
yad forks the process and can't use the variables (unless you export them)
Write to /tmp/TP directly
resets text info:
Code:
echo -e '\f' >/tmp/TP

cd to the dir containing files,

gets the value of the selected row item %s and write to /tmp/TP
Code:
 cat  "%s" >/tmp/TP


At the end we need new line
Code:
 echo -e '\n' >/tmp/TP

to be able to reset text-info on next selected row when echo -e '\f' >/tmp/TP is executed.
full cmd
Code:
--select-action="bash -c \"echo -e '\f' >/tmp/TP ; cd "$HOME" ; cat  "%s" >/tmp/TP ; echo -e '\n' >/tmp/TP \""
Back to top
View user's profile Send private message 
stemsee

Joined: 27 Jun 2013
Posts: 2464
Location: In The Way

PostPosted: Sat 31 Aug 2019, 08:18    Post subject:  

thanks misko


Smile
Back to top
View user's profile Send private message MSN Messenger 
Display posts from previous:   Sort by:   
Page 47 of 49 [734 Posts]   Goto page: Previous 1, 2, 3, ..., 45, 46, 47, 48, 49 Next
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.1237s ][ Queries: 12 (0.0280s) ][ GZIP on ]