4 # Copyright (C) 2010 Stefanos Harhalakis
6 # This file is part of wifieye.
8 # wifieye is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
13 # wifieye is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with wifieye. If not, see <http://www.gnu.org/licenses/>.
21 # $Id: 0.py 2265 2010-02-21 19:16:26Z v13 $
23 __version__ = "$Id: 0.py 2265 2010-02-21 19:16:26Z v13 $"
26 from hildondesktop import *
39 fn=["maegirls.png", "mc.png"]*3
41 #p=gtk.gdk.pixbuf_new_from_file(f)
42 p=gtk.gdk.pixbuf_new_from_file_at_size(f, self.iconsize,
47 print "end of Icons init"
49 def setMode(self, mode):
52 class MyQ(gtk.DrawingArea, Icons):
55 gtk.DrawingArea.__init__(self)
57 # self.set_size_request(-1, -1)
59 # self.connect('size-request', self.do_size_request)
60 # self.connect('size-allocate', self.do_size_allocate)
61 self.connect('expose-event', self.expose)
62 self.connect('button-press-event', self.butpress)
67 def butpress(self, widget, ev):
68 if ev.type==gdk.BUTTON_PRESS:
69 print "press", ev.type
77 def expose(self, widget, event):
83 print "mode:", self.mode
86 widget.window.draw_pixbuf(None, i, 0, 0, x*self.iconsize,
90 y2=(self.size-x-1)*self.iconsize
92 i2=i.rotate_simple(gdk.PIXBUF_ROTATE_COUNTERCLOCKWISE)
93 widget.window.draw_pixbuf(None, i2, 0, 0, x2, y2)
102 # def do_size_request(self, requisition, param):
104 # requisition.width = self.size*self.iconsize
105 # requisition.height = self.size*self.iconsize
107 # def do_size_allocate(self, allocation, param):
108 # print "szalloc", allocation.width, allocation.height
110 # if self.flags() & gtk.REALIZED:
111 # self.window.move_resize(*allocation)
113 class TestPlugin(HomePluginItem, Icons):
115 HomePluginItem.__init__(self)
120 self.set_size_request(self.size * self.iconsize,
121 self.size * self.iconsize)
131 cr.set_source_rgba(0.5, 0.5, 0.5, 0.5)
132 cr.set_operator(cairo.OPERATOR_SOURCE)
141 print "mode:", self.mode
151 y2=(self.size-x-1)*self.iconsize
153 i2=i.rotate_simple(gdk.PIXBUF_ROTATE_COUNTERCLOCKWISE)
156 cr.set_source_pixbuf(i2, x2, y2)
165 def do_expose_event(self, event):
168 cr=self.window.cairo_create()
170 cr.rectangle(event.area.x, event.area.y,
171 event.area.width, event.area.height)
177 # HomePluginItem.do_expose_event(self, event)
179 def do_realize(self):
180 screen=self.get_screen()
181 self.set_colormap(screen.get_rgba_colormap())
182 self.set_app_paintable(True)
184 HomePluginItem.do_realize(self)
186 def do_button_press_event(self, event):
188 if event.type==gdk.BUTTON_PRESS:
189 print "press", event.type
197 def butTest(self, arg):
200 hd_plugin_type = TestPlugin
204 # gobject.type_register(MyQ)
205 gobject.type_register(hd_plugin_type)
206 obj=gobject.new(hd_plugin_type, plugin_id="plugin_id")
212 win.connect('delete-event', gtk.main_quit)
222 if __name__=="__main__":
227 # vim: set ts=8 sts=4 sw=4 noet formatoptions=r ai nocindent: