![]() |
Re: Shaped widgets? (transparent background)
Yep i use cairo drawing but on label ... my try to display a gtk.treeview is unsuccessfull at this time ... :)
|
Re: Shaped widgets? (transparent background)
khertan:
If you feel even more daring, perhaps sometime you can attempt an applet that draws a graphic (say, a sphere or rectangle, using Cairo), then adds a PyGTK button...? |
Re: Shaped widgets? (transparent background)
Hmm.. someone needs to make an example applet with cairo and mouse click handling so that we can start simulating button behavior by using pixmaps/vectors.
|
Re: Shaped widgets? (transparent background)
Quote:
In the meanwhile, can someone tell me how I can get a gtk.Label inside an EventBox to be upon a transparent surface? I can only seem to get it either invisible or with black background. Worked around it design wise, though, but would be nice to know how to do it. |
Re: Shaped widgets? (transparent background)
4 Attachment(s)
Ok I wrote an example widget with images for buttons.
I attatched the images if you want to test it out. simply save this code to a .py file, and copy the image files either to /home/user/buttons/ or wherever you want, but change the imagedir variable in the code to point at the right place. Code:
# hildon home widget, png button example Those of you who actually know pygtk, please point out the redundant or erroreous bits. Perhaps after a while it's good enough to be put in the wiki. Oh an btw, this widget also illustrates the label issue I mentioned. If someone can show me how to make the label background be the same 50% opacity as the button part, then I'd be a happy camper |
Re: Shaped widgets? (transparent background)
Hello.
I was trying to add more that one layout to the widget. I was trying to accomplish something like: < 1 IMAGE + 2 images (top/bottom) + 2 labels (top+bottom) > by addind a HBOX (for 1 IMAGE) and 2 VBOX (one for the 2 images and another for the 2 labels) but it seems to be impossible to add more that one. /usr/lib/hildon-desktop/helloworld.py:115: GtkWarning: Attempting to add a widget with type GtkVBox to a helloworld+HelloHomePlugin, but as a GtkBin subclass a helloworld+HelloHomePlugin can only contain one widget at a time; it already contains a widget of type GtkHBox Any suggestions? Thanks |
Re: Shaped widgets? (transparent background)
The homeplugin is only a GtkContainer and can not take more than one
widget. If you want to put more widgets, use another hbox or vbox widget and put your other boxes into this. For a more complex layout you may have to use several nesting boxes. Or maybe another layout container like GtkTable. |
Re: Shaped widgets? (transparent background)
that's exactly what i was trying to do.
so it is possible to have a main hbox with several child h/vboxes ??? I confess that while testing (as i couldn't see any result) i have moved the show_all() of each box outside the main box container. I will try again... thanks |
Re: Shaped widgets? (transparent background)
just put it to work. Now the next problem. In te above example the draw() function is called on the widget context or trough an event in the ui. How would I call this function on a backend function (answering to a dbus signal for instance). My probelm and (I'm learing on the go) is that I don't know how to pass the ui context ( button press for instance ) of the widget
if I just call widget.draw(self.e_next, '1') outside those event handler I have an error specifying that widget is not a know object( or similar). |
Re: Shaped widgets? (transparent background)
when I call draw(self.e_fstatus,"1") from an dbus-signal call, it gives-me this error
File "/usr/lib/hildon-desktop/helloworld.py", line 185, in draw cr_e = target.window.cairo_create() AttributeError: 'NoneType' object has no attribute 'cairo_create' in the draw() function I've added print "DEBUG: button clicked!!!" + widget.get_name() DEBUG: drawing 0 against what shoul be. DEBUG: drawing fmtx |
Re: Shaped widgets? (transparent background)
What is self.e_fstatus ? Are you sure it is
already initialized when you call the draw function? Nicolai |
Re: Shaped widgets? (transparent background)
regardless of all the hard work you're doing, this once happened to me by accident, bug? maybe? It happened in PR1.2 when I first installed preenv and NFS UC. I added its shortcut on a homescreen then my phone rebooted suddenly. After this, all shortcuts I added showed their icon solely with no box surrounding them. This was gone when I updated to PR1.3, I wish I took a screenshot.
|
Re: Shaped widgets? (transparent background)
self.e_fstatus is an gtkeventbox..
just fixed it :) recoded the draw function just for that "button".. Nothing like preserverance to overcome the barriers.. NEXT ISSUE... try to understand mediaplayer dbus signals... |
All times are GMT. The time now is 18:51. |
vBulletin® Version 3.8.8