Desktop icon actions editor/translator (WIP)

So you have written that new, must have program. Let us see it here.
BruceSteers
Posts: 785
Joined: Thursday 23rd July 2020 5:20pm

Desktop icon actions editor/translator (WIP)

Post by BruceSteers » Sunday 23rd January 2022 3:06pm

Here i have a desktop actions editor with language support and translator (translate-shell)

It uses it's own copy of trans so no need to install it
NOTE: translator functions work okay till you get rate limited (you get about 100 translations per hour apparently then you get nothing for a while)

This was made to test 2 new classes i've made and submitted for merge into gambas.
It adds to DesktopFile.class a DesktopFile.DesktopActions property that is a complete manager for desktop actions with language support too.

The application contains a copy of gb.desktop with the added _DesktopFile_Actions.class and DesktopAction.class

The new classes have built in wiki help so it's easy to get to know what everything does.
DesktopActions addition is pretty fully featured, Actions can be accessed by their key name with
DesktopFile.DesktopActions[sKeyName]
or their index with
DesktopFile.DesktopActions.Actions[iIndex]

Each action has functions to get/set default or locale specific texts.
Check out the application code to see usage.

But aside from the cool new classes to manage the actions you may just like an application that can translate your icons into your own language.
.desktop files are not just n your desktop, your whole menu system is made of .desktop files in /usr/share/applications and $HOME/.local.share/applications this application can edit all of these files, (will need root access to edit /usr/share/applications though)

It's kinda WIP,
like i say it's been made as a tester for the DesktopActions.class so unlike most icon editors it starts on the action editing page, the main icon entry editing is an added bonus, but has enough functionality to be useful to people i think so here you are :)
Screenshot at 2022-01-23 14-54-42.png
Screenshot at 2022-01-23 14-55-55.png
Last edited by BruceSteers on Saturday 05th February 2022 10:18am, edited 5 times in total.

BruceSteers
Posts: 785
Joined: Thursday 23rd July 2020 5:20pm

Re: Desktop icon actions editor/translator (WIP)

Post by BruceSteers » Sunday 23rd January 2022 3:12pm

Sadly the app itself is only in English at present. I'll work on getting it translated.

User avatar
cogier
Site Admin
Posts: 882
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Desktop icon actions editor/translator (WIP)

Post by cogier » Monday 24th January 2022 4:10pm

Opps! I have broken it :cry:

I was just being a bloke and poking about in your program, and it broke! :?

BruceSteers
Posts: 785
Joined: Thursday 23rd July 2020 5:20pm

Re: Desktop icon actions editor/translator (WIP)

Post by BruceSteers » Monday 24th January 2022 4:27pm

cogier wrote:
Monday 24th January 2022 4:10pm
Opps! I have broken it :cry:

I was just being a bloke and poking about in your program, and it broke! :?
haha. Yep that's broke.
I'm pretty sure Collection has a symbol called Keys :-\
maybe you broke the Trans.GetLangs() function so the collection return is wrong?

BruceSteers
Posts: 785
Joined: Thursday 23rd July 2020 5:20pm

Re: Desktop icon actions editor/translator (WIP)

Post by BruceSteers » Wednesday 02nd February 2022 7:55pm

cogier wrote:
Monday 24th January 2022 4:10pm
Opps! I have broken it :cry:

I was just being a bloke and poking about in your program, and it broke! :?
did you fix it?

only thing that could break the trans.GetLangs function is if you do not have the trans script in the .public folder of the project.

User avatar
cogier
Site Admin
Posts: 882
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Desktop icon actions editor/translator (WIP)

Post by cogier » Thursday 03rd February 2022 1:51pm

did you fix it?
I am sorry, but no. I can't work out what the program is for, let alone fix it. I reread your posts, but I am still not sure. So I ran the program again, I could find no help, but managed to crash it in 2 different ways: -

Open program, select a desktop file, click on Add action and crash!

Image

Reran the program, selected a desktop file, clicked on Translate and answered Yes to the question Would you like to translate all Name fields and crash!

Image

Another small point, the lblLabel has Expand set to True and AutoResize set to False. I suggest you reverse these properties to stop the text from being truncated. I changed this in the first 2 pictures above.

Image

I am sure it's me being a bit slow with these things, but I suspect it will have confused a few others as well, especially us old ones. :(

BruceSteers
Posts: 785
Joined: Thursday 23rd July 2020 5:20pm

Re: Desktop icon actions editor/translator (WIP)

Post by BruceSteers » Thursday 03rd February 2022 4:37pm

What version gambas do you use?
Maybe Collection.Keys is new?

BruceSteers
Posts: 785
Joined: Thursday 23rd July 2020 5:20pm

Re: Desktop icon actions editor/translator (WIP)

Post by BruceSteers » Thursday 03rd February 2022 4:41pm

BruceSteers wrote:
Thursday 03rd February 2022 4:37pm
What version gambas do you use?
Maybe Collection.Keys is new?
Aaah it is...
http://gambaswiki.org/wiki/comp/gb/collection/keys

User avatar
cogier
Site Admin
Posts: 882
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Desktop icon actions editor/translator (WIP)

Post by cogier » Thursday 03rd February 2022 6:22pm

I use Gambas 3.16.3 from the stable ppa.

BruceSteers
Posts: 785
Joined: Thursday 23rd July 2020 5:20pm

Re: Desktop icon actions editor/translator (WIP)

Post by BruceSteers » Thursday 03rd February 2022 7:48pm

BruceSteers wrote:
Thursday 03rd February 2022 4:41pm
BruceSteers wrote:
Thursday 03rd February 2022 4:37pm
What version gambas do you use?
Maybe Collection.Keys is new?
Aaah it is...
http://gambaswiki.org/wiki/comp/gb/collection/keys
So it turns out Collection.Keys is new to 3.17 according to the wiki so i re-wrote the Collection routines to not use .Keys.
I also found an issue if gawk is not installed.
Should work okay on gambas stable now

What this does Charlie......

Consider this gambas.desktop file that comes with gambas...

Code: Select all

[Desktop Entry]
Name=Gambas 3
Exec=gambas3
GenericName=Gambas 3 IDE
GenericName[fr]=EDI Gambas 3
GenericName[ru]=Gambas 3 IDE(ИСР)
Comment=Gambas3 Integrated Development Environment
Comment[fr]=Environnement de développement intégré Gambas 3
Comment[ru]=Gambas 3 IDE(ИСР) - альтернатива для Visual Basic
Icon=gambas3
Terminal=false
Type=Application
Categories=Development;IDE;
StartupNotify=true
Actions=QT4;QT5;GTK3

[Desktop Action QT4]
Name=Run with QT 4
Name[fr]=Exécuter avec QT 4
Exec=env GB_GUI=gb.qt4 gambas3

[Desktop Action QT5]
Name=Run with QT 5
Name[fr]=Exécuter avec QT 5
Exec=env GB_GUI=gb.qt5 gambas3

[Desktop Action GTK3]
Name=Run with GTK+ 3
Name[fr]=Exécuter avec GTK+ 3
Exec=env GB_GUI=gb.gtk3 gambas3
See it has lines like this...
GenericName=Gambas 3 IDE
GenericName[fr]=EDI Gambas 3
GenericName[ru]=Gambas 3 IDE(ИСР)


and...
[Desktop Action QT5]
Name=Run with QT 5
Name[fr]=Exécuter avec QT 5
Exec=env GB_GUI=gb.qt5 gambas3

Because of that if i was using the French language on my system my desktop would automatically display the Name[fr] fields in that icon not the English.

This application will auto-generate or let you edit ALL the language specific texts for your icon like Name[fr] etc and also for the icons "Actions" (right click options)

you can select a text field/Action and auto-generate many translations at once (until you get rate-limited and then you have to wait)

Post Reply