Technical discussions | Discussions techniques
Subscription date : 28 October 2009
Messages : 415
|
Hi,
my knowledge of programming is sporadic, but i'd like to play around with Cairo.
I'd like to focus on graphical elements like sub-docks and dialogues (appearance and behaviour).
How can i go about that?
Cheers,
Benjamin |
Subscription date : 26 October 2008
Messages : 1904
|
Have you tried the doncky applet? it could be a start. this is what you can do with it
information can be displayed in the dock as well.
But if you want proper hacking your will have to hack directly on the code. |
Subscription date : 28 October 2009
Messages : 415
|
OK well,
i was impatient and started from the python_demo applet. But it didn't work to start with. I copied the files from launchpad into the third-party folder. After rebooting Cairo, i can add the applet but has no behaviour.
From the python script i believe it should show a counter as well as it should open up some dialogues.
Also the script has various functions which show the "print" function, where is this suppose to print (isn't print working in an IDE or terminal only?)?
Thanks.
B. |
Subscription date : 28 October 2009
Messages : 415
|
I tried another third party applet (Transmission), which is functioning.
I copy-pasted its folder, renamed it and changed the icon.
Then i went on editing the python file, by cleaning it up and keeping the minimum.
I created a counter and an on-click dialogue, but it doesn't seem to work. Running from Terminal gives me no error. When clicking on the icon an error messages appear claiming i supplied too many arguments to "on_click(). My programming skills are rusty, so i may be really committing some obvious mistake
Code:
#!/usr/bin/python
# This is a part of the blablabla...
####################
### dependancies ###
####################
from CDApplet import CDApplet
####################
### Applet class ###
####################
class Applet(CDApplet):
def __init__(self):
# define internal variables
self.count = 1
# call high-level init
CDApplet.__init__(self)
##### private methods #####
def set_counter(self,count):
self.count = count
self.icon.SetQuickInfo(format(self.count))
##### callbacks #####
def on_click(self):
self.icon.ShowDialog("Cairo-Dock is great!",4)
############
### main ###
############
if __name__ == '__main__':
Applet().run()
The error returned is:
ERROR:dbus.connection:Exception in handler for D-Bus signal:
Traceback (most recent call last):
File "/usr/lib/pymodules/python2.6/dbus/connection.py", line 214, in maybe_handle_message
self._handler(*args, **kwargs)
TypeError: on_click() takes no arguments (2 given)
Please help me to start? |
fabounet, Wednesday 13 April 2011 à 16:27
|
|
Subscription date : 30 November 2007
Messages : 17118
|
def on_click(self, iState):
the state is for if you hold a key while clicking (which is not really useful I admit)
but I think the code from the demo should work (it is located in cairo-dock-plug-ins/Dbus/demo, is it the one you tried ?)
as for playing with the C code, the doc on the site should give you a starting point. |
Subscription date : 28 October 2009
Messages : 415
|
I downloaded the file from Bazaar Viewer, put them in a folder and in the /third-party folder.
There is no cairo-dock-plug-ins/Dbus/demo folder on my machine :s |
Technical discussions | Discussions techniques
|