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 $"
28 from icon import getIcon, Icon
33 def __init__(self, items):
34 self.iter=items.__iter__()
37 ret=self.iter.__iter__()
44 class Icons(gobject.GObject):
45 def __init__(self, isconfig, config):
46 self.__gobject_init__()
50 self.isconfig=isconfig
57 maxsz=self.config.getMaxSize()
58 for x in xrange(maxsz[0]):
59 for y in xrange(maxsz[1]):
61 ico=Icon(self.isconfig, self.config)
66 def register_signals(cls):
69 gobject.signal_new(s, cls, gobject.SIGNAL_RUN_FIRST,
70 gobject.TYPE_NONE, (Icon,))
73 return(IconIter(self.icons))
75 def connect_one(self, which):
77 'longpress': which.connect('long-press', self.signalLongpress),
78 'click': which.connect('click', self.signalClick),
79 'tripple': which.connect('tripple-click',
80 self.signalTrippleClick)
83 def disconnect_one(self, which):
84 for i in self.h[which]:
85 which.disconnect(self.h[which][i])
87 # which.disconnect(self.h[which]_longpress)
88 # which.disconnect(self.h_click)
89 # which.disconnect(self.h_tripple)
91 def setSize(self, sz):
92 # print "sz:", sz, self.size
100 for x in xrange(sz[0]):
101 for y in xrange(sz[1]):
106 # old.pop(k) # Re-used
108 # self.connect_one(ico)
112 # self.disconnect_one(old[i])
119 def setWindow(self, win):
120 """ Set the window for all icons """
126 def signalLongpress(self, icon):
127 #print "signalLongpress()", icon
128 self.emit('long-press', icon)
130 def signalClick(self, icon):
131 #print "signalClick()", icon
132 self.emit('click', icon)
134 def signalTrippleClick(self, icon):
135 #print "signalTrippleClick()", icon
136 self.emit('tripple-click', icon)
140 if self.icons.has_key(k):
150 # fn=["maegirls", "wifieye", 'battery-eye', 'image-viewer',
151 # 'tecnoballz', 'ncalc', 'rtcom-call-ui', 'rtcom-messaging-ui',
152 # 'extcalllog', 'browser', 'modest', 'osso-addressbook']
154 wapps=self.config.getApps()
155 sz=self.config.getSize()
164 app=apps.readOne(appname)
166 app['icon2']=getIcon(app['icon'], self.config.getIconSize())
167 self.get(x,y).setApp(app)
169 self.get(x,y).setApp(None)
173 # dt['icon2']=getIcon(dt['icon'])
175 # self.get(x,y).setApp(dt)
177 # if x>=config.getSize(getSize()):
180 ## self.icons.append(p)
182 gobject.type_register(Icons)
183 Icons.register_signals()
185 # vim: set ts=8 sts=4 sw=4 noet formatoptions=r ai nocindent: