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
63 maxsz=self.config.getMaxSize()
65 # Create new entries in x
67 for x in xrange(maxsz[0]-sz[0]):
68 for y in xrange(sz[1]):
70 ico=Icon(self.isconfig, self.config)
75 for x in xrange(sz[0]-maxsz[0]):
76 for y in xrange(sz[1]):
81 # Create new entries in y
83 for y in xrange(maxsz[1]-sz[1]):
84 for x in xrange(sz[0]):
86 ico=Icon(self.isconfig, self.config)
91 for y in xrange(sz[1]-maxsz[1]):
92 for x in xrange(sz[0]):
100 def register_signals(cls):
103 gobject.signal_new(s, cls, gobject.SIGNAL_RUN_FIRST,
104 gobject.TYPE_NONE, (Icon,))
107 return(IconIter(self.icons))
109 def connect_one(self, which):
111 'longpress': which.connect('long-press', self.signalLongpress),
112 'click': which.connect('click', self.signalClick),
113 'tripple': which.connect('tripple-click',
114 self.signalTrippleClick)
117 def disconnect_one(self, which):
118 for i in self.h[which]:
119 which.disconnect(self.h[which][i])
121 # which.disconnect(self.h[which]_longpress)
122 # which.disconnect(self.h_click)
123 # which.disconnect(self.h_tripple)
125 def setSize(self, sz):
126 # print "sz:", sz, self.size
134 for x in xrange(sz[0]):
135 for y in xrange(sz[1]):
140 # old.pop(k) # Re-used
142 # self.connect_one(ico)
146 # self.disconnect_one(old[i])
153 def setWindow(self, win):
154 """ Set the window for all icons """
160 def signalLongpress(self, icon):
161 #print "signalLongpress()", icon
162 self.emit('long-press', icon)
164 def signalClick(self, icon):
165 #print "signalClick()", icon
166 self.emit('click', icon)
168 def signalTrippleClick(self, icon):
169 #print "signalTrippleClick()", icon
170 self.emit('tripple-click', icon)
174 if self.icons.has_key(k):
184 # fn=["maegirls", "wifieye", 'battery-eye', 'image-viewer',
185 # 'tecnoballz', 'ncalc', 'rtcom-call-ui', 'rtcom-messaging-ui',
186 # 'extcalllog', 'browser', 'modest', 'osso-addressbook']
188 wapps=self.config.getApps()
189 #sz=self.config.getSize()
199 app=apps.readOne(appname)
201 app['icon2']=getIcon(app['icon'], self.config.getIconSize())
202 self.get(x,y).setApp(app)
207 # Reload icons to make sure backgrounds, etc are valid
208 for x in xrange(sz[0]):
209 for y in xrange(sz[1]):
216 # dt['icon2']=getIcon(dt['icon'])
218 # self.get(x,y).setApp(dt)
220 # if x>=config.getSize(getSize()):
223 ## self.icons.append(p)
225 gobject.type_register(Icons)
226 Icons.register_signals()
228 # vim: set ts=8 sts=4 sw=4 noet formatoptions=r ai nocindent: