Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar
This commit is contained in:
commit
8b099b00ba
2
NEWS
2
NEWS
@ -1,3 +1,5 @@
|
||||
* #2164: Keybindings for buttons in intro sequence (erikos)
|
||||
|
||||
Snapshot 0ad6398cf1
|
||||
|
||||
* #3025: Make bundlebuilder work even if SUGAR_PREFIX is not set. (marco)
|
||||
|
@ -42,6 +42,9 @@ class Device:
|
||||
iface = string.split(line, ":",1)
|
||||
arr = string.split(iface[1])
|
||||
|
||||
if len(arr) < 10:
|
||||
continue
|
||||
|
||||
info = {'interface': iface[0].strip(), \
|
||||
'bytes_recv': arr[0],\
|
||||
'bytes_sent': arr[8],\
|
||||
|
@ -51,6 +51,9 @@ class _Page(hippo.CanvasBox):
|
||||
if pspec.name == 'valid':
|
||||
return self.valid
|
||||
|
||||
def activate(self):
|
||||
pass
|
||||
|
||||
class _NamePage(_Page):
|
||||
def __init__(self, intro):
|
||||
_Page.__init__(self, xalign=hippo.ALIGNMENT_CENTER,
|
||||
@ -69,13 +72,9 @@ class _NamePage(_Page):
|
||||
|
||||
widget = self._entry.props.widget
|
||||
widget.set_max_length(45)
|
||||
widget.connect('activate', self._entry_activate_cb)
|
||||
|
||||
self.append(self._entry)
|
||||
|
||||
def _entry_activate_cb(self, entry):
|
||||
self._intro.next()
|
||||
|
||||
def _text_changed_cb(self, entry, pspec):
|
||||
valid = len(entry.props.text.strip()) > 0
|
||||
self.set_valid(valid)
|
||||
@ -83,6 +82,9 @@ class _NamePage(_Page):
|
||||
def get_name(self):
|
||||
return self._entry.props.text
|
||||
|
||||
def activate(self):
|
||||
self._entry.props.widget.grab_focus()
|
||||
|
||||
class _ColorPage(_Page):
|
||||
def __init__(self, **kwargs):
|
||||
_Page.__init__(self, xalign=hippo.ALIGNMENT_CENTER,
|
||||
@ -127,10 +129,6 @@ class _IntroBox(hippo.CanvasBox):
|
||||
|
||||
self._setup_page()
|
||||
|
||||
def next(self):
|
||||
self._page += 1
|
||||
self._setup_page()
|
||||
|
||||
def _setup_page(self):
|
||||
self.remove_all()
|
||||
|
||||
@ -158,12 +156,13 @@ class _IntroBox(hippo.CanvasBox):
|
||||
self._next_button = CanvasButton(_('Next'), 'go-right')
|
||||
self._next_button.connect('activated', self._next_activated_cb)
|
||||
|
||||
self._current_page.activate()
|
||||
|
||||
self._update_next_button()
|
||||
button_box.append(self._next_button)
|
||||
|
||||
self._current_page.connect('notify::valid',
|
||||
self._page_valid_changed_cb)
|
||||
|
||||
self.append(button_box)
|
||||
|
||||
def _update_next_button(self):
|
||||
@ -174,20 +173,43 @@ class _IntroBox(hippo.CanvasBox):
|
||||
self._update_next_button()
|
||||
|
||||
def _back_activated_cb(self, item):
|
||||
self._page -= 1
|
||||
self._setup_page()
|
||||
self.back()
|
||||
|
||||
def back(self):
|
||||
if self._page != self.PAGE_FIRST:
|
||||
self._page -= 1
|
||||
self._setup_page()
|
||||
|
||||
def _next_activated_cb(self, item):
|
||||
self.next()
|
||||
|
||||
def next(self):
|
||||
if self._page == self.PAGE_LAST:
|
||||
self.done()
|
||||
if self._current_page.props.valid:
|
||||
self._page += 1
|
||||
self._setup_page()
|
||||
|
||||
def _done_activated_cb(self, item):
|
||||
self.done()
|
||||
|
||||
def done(self):
|
||||
path = os.path.join(os.path.dirname(__file__), 'default-picture.png')
|
||||
pixbuf = gtk.gdk.pixbuf_new_from_file(path)
|
||||
name = self._name_page.get_name()
|
||||
color = self._color_page.get_color()
|
||||
|
||||
|
||||
self.emit('done', pixbuf, name, color)
|
||||
|
||||
def _key_press_cb(self, widget, event):
|
||||
if gtk.gdk.keyval_name(event.keyval) == "Return":
|
||||
self.next()
|
||||
return True
|
||||
elif gtk.gdk.keyval_name(event.keyval) == "Escape":
|
||||
self.back()
|
||||
return True
|
||||
return False
|
||||
|
||||
class IntroWindow(gtk.Window):
|
||||
def __init__(self):
|
||||
gtk.Window.__init__(self)
|
||||
@ -199,6 +221,7 @@ class IntroWindow(gtk.Window):
|
||||
|
||||
self.add(self._canvas)
|
||||
self._canvas.show()
|
||||
self.connect('key-press-event', self._intro_box._key_press_cb)
|
||||
|
||||
def _done_cb(self, box, pixbuf, name, color):
|
||||
self.hide()
|
||||
|
Loading…
Reference in New Issue
Block a user