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 $"
30 from hildon import StackableWindow
31 #from portrait import FremantleRotation
32 #from xdg.IconTheme import getIconPath
36 from icon import Icon, getIcon
37 from icongrid import IconGridWidget
39 class WinConfig(StackableWindow):
40 def __init__(self, *args):
41 StackableWindow.__init__(self)
46 self.igw=IconGridWidget(True)
47 # self.igw.setSize(config.getSize())
55 # Now go for the right side
56 al=gtk.Alignment(yscale=0)
63 vbox.add(gtk.Label('Grid size:'))
67 but=gtk.ToggleButton("%sx%s" % (i+1,i+1))
68 but.set_size_request(160, 90)
69 self.butsSize.append(but)
70 but.connect('toggled', self.slotButtonSize, i)
74 hbox2.add(self.butsSize[0])
75 hbox2.add(self.butsSize[1])
78 hbox2.add(self.butsSize[2])
79 hbox2.add(self.butsSize[3])
81 self.igw.connect('long-press', self.slotLongpress)
83 self.ignore_toggle=False
85 self.setSize(config.getSize())
87 def slotLongpress(self, sender, icon):
90 def slotButtonSize(self, sender, id):
93 def setSize(self, sz):
94 if self.ignore_toggle:
97 self.ignore_toggle=True
103 but.set_active(i==id)
105 self.ignore_toggle=False
109 self.igw.queue_draw()
112 def doConfig(self, icon):
115 lst=[aps[x]['name'] for x in aps]
118 dialog=gtk.Dialog('App select', None,
119 gtk.DIALOG_DESTROY_WITH_PARENT, buttons=())
121 selector=hildon.TouchSelectorEntry(text=True)
122 selector.set_column_selection_mode(
123 hildon.TOUCH_SELECTOR_SELECTION_MODE_SINGLE)
125 dialog.vbox.pack_start(selector, True, True, 0)
126 dialog.set_size_request(0,900)
127 dialog.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
128 dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
130 selector.append_text('None')
137 selector.append_text(app)
138 if icon.name!=None and aps[icon.name]['name']==app:
142 selector.set_active(0, idx)
150 if r==gtk.RESPONSE_OK:
151 cur=selector.get_current_text()
156 if aps[i]['name']==cur:
160 app['icon2']=getIcon(app['icon'])
172 for but in self.butsSize:
174 if but.get_active()==True:
181 ico=self.igw.get(x,y)
192 if __name__=="__main__":
194 win.connect('delete-event', gtk.main_quit)
201 # vim: set ts=8 sts=4 sw=4 noet formatoptions=r ai nocindent: