This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Re: scipted plasmoids

Tags: None
(comma "," separated)
User avatar
giucam
KDE Developer
Posts
62
Karma
1
OS

scipted plasmoids

Fri Jan 30, 2009 3:50 pm
Hi al!
Is it possible to write a plasmoid for amarok in python, ruby or other scripted languages?
User avatar
markey
KDE Developer
Posts
2286
Karma
3
OS

Re: scipted plasmoids

Fri Jan 30, 2009 4:09 pm
Not yet. In the future it might be possible to write Amarok plasmoids with QtScript (JavaScript), by using our internal scripting system.

http://amarok.kde.org/wiki/Development/ ... _HowTo_2.0


--
Mark Kretschmann - Amarok Developer
User avatar
eean
KDE Developer
Posts
1016
Karma
0
OS

Re: scipted plasmoids

Fri Jan 30, 2009 4:57 pm
Seems like when we use the system libplasma (which we'll do in Amarok 2.1 likely) there shouldn't be any problem using scripted plasmoids, using the scripting apis already developed by the Plasma project.


Amarok Developer
User avatar
eean
KDE Developer
Posts
1016
Karma
0
OS

Re: scipted plasmoids

Fri Jan 30, 2009 7:02 pm
Actually was talking to our plasma dude (lfranchi) he said it might be possible already. No one has tried, so none of us really know what we're talking about. ;)


Amarok Developer
User avatar
giucam
KDE Developer
Posts
62
Karma
1
OS

Re: scipted plasmoids

Fri Jan 30, 2009 8:44 pm
i could try. is the tutorial on techbase useful for amarok too?
User avatar
eean
KDE Developer
Posts
1016
Karma
0
OS

Re: scipted plasmoids

Sat Jan 31, 2009 1:27 am
giucam wrote:i could try. is the tutorial on techbase useful for amarok too?

We don't know. Sounds like a good place to start.


Amarok Developer
User avatar
giucam
KDE Developer
Posts
62
Karma
1
OS

Re: scipted plasmoids

Sun Feb 01, 2009 3:10 pm
following http://techbase.kde.org/Development/Tutorials/Plasma/RubyApplet i started creating a dummy .desktop file like it is said there, modifing "Plasma/Applet" with "AmarokContext/Applet"
i called it  amarok-context-ruby-applet-web.desktop and i put it in `kde4-config --prefix`/share/kde4/services/ but amarok didn't seem to notice the it. it isn't shown in the list of amarok applets. i tried to rename it amarok-context-applet-web.desktop but nothing changed.
is there a thing like kbuildsyscoca4 (which i launched) i should call?
User avatar
giucam
KDE Developer
Posts
62
Karma
1
OS

Re: scipted plasmoids

Sun Feb 01, 2009 10:18 pm
Woohoo! I Won!! :D :D :D

Seriously, it wasn't so difficult:
I created a package for plasma desktop firstly using this tutorial: http://techbase.kde.org/Development/Tutorials/Plasma/Python/GettingStarted and I installed it.
Then I copied the metadata.desktop in /usr/share/kde4/services, I renamed it "amarok-context-python-applet-something.desktop" and I modified it a bit:
[Desktop Entry]                                                                   
Encoding=UTF-8                                                                   
Name=Battery Graph
ServiceTypes=AmarokContext/Applet
Type=Service
X-Plasma-API=python
X-Plasma-MainScript=code/main.py

X-KDE-PluginInfo-Author=John Doe
X-KDE-PluginInfo-Email=j.doe@example.com
X-KDE-PluginInfo-Name=hello-python
X-KDE-PluginInfo-Version=pre0.1
X-KDE-PluginInfo-Website=http://plasma.kde.org/
X-KDE-PluginInfo-Category=Examples
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true
X-KDE-ParentApp=amarok
X-KDE-PluginInfo-Category=Current


I ran kbuildsyscoca4, restarted amarok and in the little menu i found the Battery Graph entry. One click and I saw python greeting me!
lfranchi
KDE Developer
Posts
77
Karma
0

Re: scipted plasmoids

Sun Feb 01, 2009 10:22 pm
dude, awesome :)

i was hoping it would be that easy... seems like it'll be enough to tweak a few things and add a GHNS fetcher.

also, this may or may not break completely as we use the libplasma from kdelibs. but it shouldn't get any more complicated.

anyway, awesome work


Amarok developer.

lfranchi, proud to be a member of KDE forums since 2008-Oct.
User avatar
giucam
KDE Developer
Posts
62
Karma
1
OS

Re: scipted plasmoids

Mon Feb 02, 2009 10:13 pm
i'm able to get infos through the amarok dataengines, but how can i do something(e.g. set the rating) ?
i'd need to include in the script the amarok engine class, but is it possible?
User avatar
eean
KDE Developer
Posts
1016
Karma
0
OS

Re: scipted plasmoids

Wed Feb 04, 2009 7:02 am
giucam wrote:i'm able to get infos through the amarok dataengines, but how can i do something(e.g. set the rating) ?
i'd need to include in the script the amarok engine class, but is it possible?

Amarok plasmoids link to libamarok so they can cheat. Its possible that you can't.

So this is an actual justification to use DataEngines. :)


Amarok Developer
User avatar
giucam
KDE Developer
Posts
62
Karma
1
OS

Re: scipted plasmoids

Wed Feb 04, 2009 2:31 pm
Ian Monroe wrote:So this is an actual justification to use DataEngines. :)


yes, but with the dataengines i can only get information, i can't set anything. or am i wrong?
User avatar
giucam
KDE Developer
Posts
62
Karma
1
OS

Re: scipted plasmoids

Sun Feb 08, 2009 9:27 pm
I installed amarok from svn revision 922309, and after restarting it i couldn't find anymore the entry in the applets list. has something changed?
User avatar
giucam
KDE Developer
Posts
62
Karma
1
OS

Re: scipted plasmoids

Mon Feb 09, 2009 9:19 pm
i got it.
i had to set the ServiceTypes=Plasma/Applet.
i suppose this is caused by the linking to kdelibs' plasma, right?
lfranchi
KDE Developer
Posts
77
Karma
0

Re: scipted plasmoids

Mon Feb 09, 2009 9:40 pm
hey, so i looked into the whole scripted plasmoid thing at tokamak this weekend. sadly i can't get either the python or the ruby plasma scriptengines to work, so it has seriously hampered my ability to work on this :)

but anyway, i added a (commented out right now) "Install Applet" button in the Add Applets menu that prompts for a filename to a plasmoid. you tell it the path and it automagically installs it. then it shows up in the list like any other applet.

if you want to show it you can uncomment line 315-316 in src/context/widgets/ToolBoxMenu.cpp

i'll keep on looking into it as i have time and try to get a scripted engine to work for me. oh, and we now have a kde-apps feed for amarok scripted applets (so we can do a GHNS widget).

leo


Amarok developer.

lfranchi, proud to be a member of KDE forums since 2008-Oct.


Bookmarks



Who is online

Registered users: bancha, Bing [Bot], daret, Evergrowing, Google [Bot], lockheed, sandyvee, Sogou [Bot]