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 *
30 from portrait import FremantleRotation
41 fn=["maegirls.png", "mc.png"]*3
43 #p=gtk.gdk.pixbuf_new_from_file(f)
44 p=gtk.gdk.pixbuf_new_from_file_at_size(f, self.iconsize,
49 print "end of Icons init"
51 def setMode(self, mode):
54 class MyQ(gtk.DrawingArea, Icons):
57 gtk.DrawingArea.__init__(self)
59 # self.set_size_request(-1, -1)
61 # self.connect('size-request', self.do_size_request)
62 # self.connect('size-allocate', self.do_size_allocate)
63 self.connect('expose-event', self.expose)
64 self.connect('button-press-event', self.butpress)
69 def butpress(self, widget, ev):
70 if ev.type==gdk.BUTTON_PRESS:
71 print "press", ev.type
79 def expose(self, widget, event):
85 print "mode:", self.mode
88 widget.window.draw_pixbuf(None, i, 0, 0, x*self.iconsize,
92 y2=(self.size-x-1)*self.iconsize
94 i2=i.rotate_simple(gdk.PIXBUF_ROTATE_COUNTERCLOCKWISE)
95 widget.window.draw_pixbuf(None, i2, 0, 0, x2, y2)
104 # def do_size_request(self, requisition, param):
106 # requisition.width = self.size*self.iconsize
107 # requisition.height = self.size*self.iconsize
109 # def do_size_allocate(self, allocation, param):
110 # print "szalloc", allocation.width, allocation.height
112 # if self.flags() & gtk.REALIZED:
113 # self.window.move_resize(*allocation)
115 class TestPlugin(HomePluginItem, Icons, FremantleRotation):
117 HomePluginItem.__init__(self)
119 FremantleRotation.__init__(self, 'TestPlugin')
123 self.set_size_request(self.size * self.iconsize,
124 self.size * self.iconsize)
134 cr.set_source_rgba(0.5, 0.5, 0.5, 0.5)
135 cr.set_operator(cairo.OPERATOR_SOURCE)
144 print "mode:", self.mode
154 y2=(self.size-x-1)*self.iconsize
156 i2=i.rotate_simple(gdk.PIXBUF_ROTATE_COUNTERCLOCKWISE)
159 cr.set_source_pixbuf(i2, x2, y2)
168 def do_expose_event(self, event):
171 cr=self.window.cairo_create()
173 cr.rectangle(event.area.x, event.area.y,
174 event.area.width, event.area.height)
180 # HomePluginItem.do_expose_event(self, event)
182 def do_realize(self):
183 screen=self.get_screen()
184 self.set_colormap(screen.get_rgba_colormap())
185 self.set_app_paintable(True)
187 HomePluginItem.do_realize(self)
189 def do_button_press_event(self, event):
192 def do_button_press_event_old(self, event):
194 if event.type==gdk.BUTTON_PRESS:
195 print "press", event.type
203 def butTest(self, arg):
206 def on_orientation_changed(self, orientation):
207 print "orch:", orientation
212 hd_plugin_type = TestPlugin
216 # gobject.type_register(MyQ)
217 gobject.type_register(hd_plugin_type)
218 obj=gobject.new(hd_plugin_type, plugin_id="plugin_id")
224 win.connect('delete-event', gtk.main_quit)
234 if __name__=="__main__":
239 # vim: set ts=8 sts=4 sw=4 noet formatoptions=r ai nocindent: