diff options
author | flavio <fdanesse@gmail.com> | 2013-08-15 00:06:48 (GMT) |
---|---|---|
committer | flavio <fdanesse@gmail.com> | 2013-08-15 00:06:48 (GMT) |
commit | 4b532f0a942d04ed3252be0c8c7937d53aefcd44 (patch) | |
tree | 00b25f5481e7822eae1df423dea51ad386c190e3 | |
parent | 806b05fba6b83cad6b0ccb895a0cee09b0b9e2ce (diff) |
correcciones y mejoras en la colaboraciĆ³n
-rw-r--r-- | PollSession.py | 12 | ||||
-rw-r--r-- | Widgets.py | 24 | ||||
-rw-r--r-- | poll.py | 21 |
3 files changed, 24 insertions, 33 deletions
diff --git a/PollSession.py b/PollSession.py index 33d9e24..9feb117 100644 --- a/PollSession.py +++ b/PollSession.py @@ -197,10 +197,12 @@ class Poll(): def get_buffer(self, pixbuf): - data = [""] - pixbuf.save_to_callback(self._pixbuf_save_cb, "png", {}, data) + # FIXME: save_to_callback No Funciona. + #data = [""] + #pixbuf.save_to_callback(self._pixbuf_save_cb, "png", {}, data) - return str(data[0]) + #return str(data[0]) + return "" def broadcast_on_mesh(self): @@ -496,7 +498,7 @@ class PollSession(ExportedGObject): self.activity._polls.add(poll) - self.__get_alert(('New Poll'), + self.activity.get_alert(('New Poll'), _("%(author)s shared a poll " "'%(title)s' with you.") % {'author': author, 'title': title}) @@ -580,7 +582,7 @@ class PollSession(ExportedGObject): self.activity._polls.add(poll) - self.activity.__get_alert(_('New Poll'), + self.activity.get_alert(_('New Poll'), _("%(author)s shared a poll " "'%(title)s' with you.") % {'author': author, 'title': title}) @@ -33,7 +33,6 @@ from gi.repository import Abi from sugar3 import mime from sugar3 import profile from sugar3.graphics import style -from sugar3.graphics.alert import NotifyAlert from sugar3.graphics.objectchooser import ObjectChooser from sugar3.graphics.toolbarbox import ToolbarBox @@ -203,7 +202,7 @@ class NewPollCanvas(Gtk.Box): button.set_label(_('Change Image')) else: - self._poll.activity.__get_alert(_('Poll Activity'), + self._poll.activity.get_alert(_('Poll Activity'), _('Your selection is not an image')) finally: @@ -473,28 +472,9 @@ class OptionsCanvas(Gtk.Box): def __button_save_options_cb(self, button): - self.__get_alert(_('Poll Activity'), + self.poll_activity.get_alert(_('Poll Activity'), _('The settings have been saved')) - def __get_alert(self, title, text): - """ - Show an alert above the activity. - """ - - alert = NotifyAlert(timeout=5) - alert.props.title = title - alert.props.msg = text - self.get_toplevel().add_alert(alert) - alert.connect('response', self.__alert_cancel_cb) - alert.show() - - def __alert_cancel_cb(self, alert, response_id): - """ - Callback for alert events - """ - - self.poll_activity.remove_alert(alert) - class SelectCanvas(Gtk.Box): def __init__(self, poll_activity): @@ -253,7 +253,7 @@ class PollBuilder(activity.Activity): f.write(s) f.close() - def __get_alert(self, title, text): + def get_alert(self, title, text): """ Show an alert above the activity. """ @@ -379,7 +379,7 @@ class PollBuilder(activity.Activity): self.set_canvas(PollCanvas(cabecera, self._poll, self.current_vote, self._view_answer, self._previewing)) else: - self.__get_alert(_('Poll Activity'), + self.get_alert(_('Poll Activity'), _('To vote you have to select first one option')) def __button_select_clicked(self, button): @@ -477,7 +477,16 @@ class PollBuilder(activity.Activity): if poll.author == author and poll.title == title: try: poll.register_vote(choice, votersha) - self.__get_alert(_('Vote'), _('Somebody voted on %s') % title) + self.get_alert(_('Vote'), _('Somebody voted on %s') % title) + + if not self._previewing: + cabecera = _('VOTE!') + + else: + cabecera = _('Poll Preview') + + if self._poll == poll and self._current_view == 'poll': + self.set_canvas(PollCanvas(cabecera, self._poll, self.current_vote, self._view_answer, self._previewing)) except OverflowError: self._logger.debug('Ignored mesh vote %u from %s:' @@ -551,7 +560,7 @@ class PollBuilder(activity.Activity): return self._logger.debug('Joined an existing shared activity') - self.__get_alert(_('Joined'), "") + self.get_alert(_('Joined'), "") self.initiating = False self.__sharing_setup() @@ -586,12 +595,12 @@ class PollBuilder(activity.Activity): def __buddy_joined_cb(self, activity, buddy): - self.__get_alert(buddy.props.nick, _('Joined')) + self.get_alert(buddy.props.nick, _('Joined')) self._logger.debug('Buddy %s joined' % buddy.props.nick) def __buddy_left_cb(self, activity, buddy): - self.__get_alert(buddy.props.nick, _('Left')) + self.get_alert(buddy.props.nick, _('Left')) self._logger.debug('Buddy %s left' % buddy.props.nick) def __get_buddy(self, cs_handle): |