From 29016e5148d2f7f1f9895c5e32665c886f1ee406 Mon Sep 17 00:00:00 2001 From: flavio Date: Tue, 13 Aug 2013 21:14:41 +0000 Subject: Correcciones --- diff --git a/PollSession.py b/PollSession.py index 9526f51..2d22fc0 100644 --- a/PollSession.py +++ b/PollSession.py @@ -25,11 +25,9 @@ import base64 from datetime import date -try: - from hashlib import sha1 -except ImportError: - # Python < 2.5 - from sha import new as sha1 +from gi.repository import GdkPixbuf + +from hashlib import sha1 from dbus.service import method, signal from dbus.gobject_service import ExportedGObject diff --git a/Widgets.py b/Widgets.py index 7816cc9..8e07df9 100644 --- a/Widgets.py +++ b/Widgets.py @@ -106,7 +106,7 @@ class NewPollCanvas(Gtk.Box): label.set_markup('%s' % _('Build a poll')) self.pack_start(label, False, False, 10) - item_poll = ItemNewPoll(_('poll Title:'), self._poll.title) + item_poll = ItemNewPoll(_('Poll Title:'), self._poll.title) item_poll.entry.connect('changed', self.__entry_activate_cb, 'title') self.pack_start(item_poll, False, False, 10) @@ -120,7 +120,7 @@ class NewPollCanvas(Gtk.Box): for choice in self._poll.options.keys(): hbox = Gtk.HBox() - item_poll = ItemNewPoll(_('Answer %d:'), self._poll.options[choice]) + item_poll = ItemNewPoll(_('Answer %s:') % choice, self._poll.options[choice]) item_poll.entry.connect('changed', self.__entry_activate_cb, str(choice)) self.pack_start(item_poll, False, False, 10) @@ -252,7 +252,7 @@ class NewPollCanvas(Gtk.Box): # Data OK self._poll.activity._previewing = False self._poll.active = True - self._poll.activity._polls.append(self._poll) + self._poll.activity._polls.add(self._poll) self._poll.broadcast_on_mesh() self._poll.activity.set_canvas(self._poll.activity._poll_canvas()) self._poll.activity.show_all() @@ -645,10 +645,10 @@ class PollCanvas(Gtk.Box): eventbox = Gtk.EventBox() eventbox.set_border_width(20) eventbox.modify_bg(0, Gdk.Color(65000, 65000, 65000)) - eventbox.add(tabla) + eventbox.add(frame) - frame.add(eventbox) - self.pack_start(frame, True, True, 10) + frame.add(tabla) + self.pack_start(eventbox, True, True, 10) group = Gtk.RadioButton() @@ -689,18 +689,21 @@ class PollCanvas(Gtk.Box): row += 1 - ### Barra para total - eventbox = Gtk.EventBox() - eventbox.modify_bg(0, Gdk.Color.parse('#FF0198')[1]) - tabla.attach(eventbox, 3,5, row, row+1) + if view_answer or not poll.active: + if poll.vote_count > 0: + ### Barra para total + eventbox = Gtk.EventBox() + eventbox.modify_bg(0, Gdk.Color.parse('#FF0198')[1]) + tabla.attach(eventbox, 3,5, row, row+1) row += 1 - label = Gtk.Label("%s %s %s %s" % (str(poll.vote_count), - _('votes'), _('(votes left to collect)'), - poll.maxvoters - poll.vote_count) ) - - tabla.attach(label, 3,5, row, row+1) + if view_answer or not poll.active: + if poll.vote_count > 0: + label = Gtk.Label("%s %s %s %s" % (str(poll.vote_count), + _('votes'), _('(votes left to collect)'), + poll.maxvoters - poll.vote_count) ) + tabla.attach(label, 3,5, row, row+1) row += 1 @@ -741,7 +744,7 @@ class PollCanvas(Gtk.Box): # Data OK self._poll.activity._previewing = False self._poll.active = True - self._poll.activity._polls.append(self._poll) + self._poll.activity._polls.add(self._poll) self._poll.broadcast_on_mesh() self._poll.activity.set_canvas(self._poll.activity._poll_canvas()) self._poll.activity.show_all() diff --git a/poll.py b/poll.py index 6b0ba72..1a581e0 100644 --- a/poll.py +++ b/poll.py @@ -88,7 +88,7 @@ class PollBuilder(activity.Activity): self._logger = logging.getLogger('poll-activity') self._logger.debug('Starting Poll activity') - self._polls = [] + self._polls = set() self.current_vote = None self._current_view = None self._previewing = False @@ -188,7 +188,7 @@ class PollBuilder(activity.Activity): self._logger.debug('Reading file from datastore via Journal: %s' % file_path) - self._polls = [] + self._polls = set() f = open(file_path, 'r') num_polls = cPickle.load(f) @@ -221,7 +221,7 @@ class PollBuilder(activity.Activity): maxvoters, question, number_of_options, options, data, votes, images, images_ds_object) - self._polls.append(poll) + self._polls.add(poll) f.close() @@ -377,8 +377,7 @@ class PollBuilder(activity.Activity): else: cabecera = _('Poll Preview') - - return + self.set_canvas(PollCanvas(cabecera, self._poll, self.current_vote, self._view_answer, self._previewing)) else: -- cgit v0.9.1