Enter -> next in the intro screen name page.

This commit is contained in:
Marco Pesenti Gritti 2007-07-30 12:59:50 +02:00
parent d4ea1f8101
commit 377fdbe9b6
2 changed files with 18 additions and 5 deletions

1
NEWS
View File

@ -1,3 +1,4 @@
* #2486 In the intro screen name page enter goes to next page. (marco)
* #2570 Accept correctly image drops from Record. * #2570 Accept correctly image drops from Record.
* Add Greek translation. (simosx) * Add Greek translation. (simosx)
* #2564 Use the activity service name as the base name for translation files. * #2564 Use the activity service name as the base name for translation files.

View File

@ -52,21 +52,30 @@ class _Page(hippo.CanvasBox):
return self.valid return self.valid
class _NamePage(_Page): class _NamePage(_Page):
def __init__(self): def __init__(self, intro):
_Page.__init__(self, xalign=hippo.ALIGNMENT_CENTER, _Page.__init__(self, xalign=hippo.ALIGNMENT_CENTER,
background_color=_BACKGROUND_COLOR.get_int(), background_color=_BACKGROUND_COLOR.get_int(),
spacing=style.DEFAULT_SPACING, spacing=style.DEFAULT_SPACING,
orientation=hippo.ORIENTATION_HORIZONTAL,) orientation=hippo.ORIENTATION_HORIZONTAL,)
self._intro = intro
label = hippo.CanvasText(text=_("Name:")) label = hippo.CanvasText(text=_("Name:"))
self.append(label) self.append(label)
self._entry = CanvasEntry(box_width=style.zoom(300)) self._entry = CanvasEntry(box_width=style.zoom(300))
self._entry.set_background(_BACKGROUND_COLOR.get_html()) self._entry.set_background(_BACKGROUND_COLOR.get_html())
self._entry.props.widget.set_max_length(45)
self._entry.connect('notify::text', self._text_changed_cb) self._entry.connect('notify::text', self._text_changed_cb)
widget = self._entry.props.widget
widget.set_max_length(45)
widget.connect('activate', self._entry_activate_cb)
self.append(self._entry) self.append(self._entry)
def _entry_activate_cb(self, entry):
self._intro.next()
def _text_changed_cb(self, entry, pspec): def _text_changed_cb(self, entry, pspec):
valid = len(entry.props.text.strip()) > 0 valid = len(entry.props.text.strip()) > 0
self.set_valid(valid) self.set_valid(valid)
@ -112,12 +121,16 @@ class _IntroBox(hippo.CanvasBox):
background_color=_BACKGROUND_COLOR.get_int()) background_color=_BACKGROUND_COLOR.get_int())
self._page = self.PAGE_NAME self._page = self.PAGE_NAME
self._name_page = _NamePage() self._name_page = _NamePage(self)
self._color_page = _ColorPage() self._color_page = _ColorPage()
self._current_page = None self._current_page = None
self._setup_page() self._setup_page()
def next(self):
self._page += 1
self._setup_page()
def _setup_page(self): def _setup_page(self):
self.remove_all() self.remove_all()
@ -165,8 +178,7 @@ class _IntroBox(hippo.CanvasBox):
self._setup_page() self._setup_page()
def _next_activated_cb(self, item): def _next_activated_cb(self, item):
self._page += 1 self.next()
self._setup_page()
def _done_activated_cb(self, item): def _done_activated_cb(self, item):
path = os.path.join(os.path.dirname(__file__), 'default-picture.png') path = os.path.join(os.path.dirname(__file__), 'default-picture.png')