Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorflavio <fdanesse@gmail.com>2013-08-13 21:14:41 (GMT)
committer flavio <fdanesse@gmail.com>2013-08-13 21:14:41 (GMT)
commit29016e5148d2f7f1f9895c5e32665c886f1ee406 (patch)
tree9b49150d4330a13a9f4111ccdc88f30677076f68
parent889a4ee69481fd7a38bf701953e4c18221fc9016 (diff)
Correcciones
-rw-r--r--PollSession.py8
-rw-r--r--Widgets.py35
-rw-r--r--poll.py9
3 files changed, 26 insertions, 26 deletions
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('<big><b>%s</b></big>' % _('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: