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 23:42:58 (GMT)
committer flavio <fdanesse@gmail.com>2013-08-13 23:42:58 (GMT)
commit24ea0133e2d96abf9bf9539f0edab9655ccfdbfa (patch)
tree2c83fbdc057fc551923c97d8198a70611bea5664
parentb71d2ee797aabda94a81dfb304e66d48f367a0df (diff)
La encuesta guarda correctamente los votos y muestra el resultado final.
-rw-r--r--PollSession.py8
-rw-r--r--Widgets.py57
-rw-r--r--poll.py4
3 files changed, 36 insertions, 33 deletions
diff --git a/PollSession.py b/PollSession.py
index 2d22fc0..33d9e24 100644
--- a/PollSession.py
+++ b/PollSession.py
@@ -158,10 +158,10 @@ class Poll():
# XXX 27/10/07 Morgan: Allowing multiple votes per XO
# per Shannon's request.
## if voter already voted, change their vote:
- if votersha in self.votes:
- self._logger.debug('%s already voted, decrementing their '
- 'old choice %d' % (votersha, self.votes[votersha]))
- self.data[self.votes[votersha]] -= 1
+ #if votersha in self.votes:
+ # self._logger.debug('%s already voted, decrementing their '
+ # 'old choice %d' % (votersha, self.votes[votersha]))
+ # self.data[self.votes[votersha]] -= 1
self.votes[votersha] = choice
self.data[choice] += 1
diff --git a/Widgets.py b/Widgets.py
index e959655..7315aaa 100644
--- a/Widgets.py
+++ b/Widgets.py
@@ -669,37 +669,42 @@ class PollCanvas(Gtk.Box):
row = 0
for choice in range(poll.number_of_options):
+ button = Gtk.RadioButton.new_with_label_from_widget(
+ group, poll.options[choice])
+
+ button.connect('toggled', poll.activity.vote_choice_radio_button, choice)
+
if poll.active:
- button = Gtk.RadioButton.new_with_label_from_widget(
- group, poll.options[choice])
-
- button.connect('toggled', poll.activity.vote_choice_radio_button, choice)
+ button.set_sensitive(True)
- tabla.attach(button, 0, 1, row, row+1)
+ else:
+ button.set_sensitive(False)
- if choice == current_vote:
- button.set_active(True)
+ tabla.attach(button, 0, 1, row, row+1)
+
+ if choice == current_vote:
+ button.set_active(True)
- if not poll.images[int(choice)] == '':
- image = Gtk.Image()
- image.set_from_pixbuf(poll.images[choice])
- tabla.attach(image, 1,2, row, row+1)
+ if not poll.images[int(choice)] == '':
+ image = Gtk.Image()
+ image.set_from_pixbuf(poll.images[choice])
+ tabla.attach(image, 1,2, row, row+1)
- if view_answer or not poll.active:
- if poll.vote_count > 0:
-
- ### Total de votos
- label = Gtk.Label(poll.data[choice])
- label.set_size_request(100, -1)
- tabla.attach(label, 3,4, row, row+1)
-
- eventbox = Gtk.EventBox()
- eventbox.set_size_request(300, -1)
- tabla.attach(eventbox, 4,5, row, row+1)
-
- eventbox.connect("draw",
- self.__draw_bar, poll.data[choice],
- poll.vote_count)
+ if view_answer or not poll.active:
+ if poll.vote_count > 0:
+
+ ### Total de votos
+ label = Gtk.Label(poll.data[choice])
+ label.set_size_request(100, -1)
+ tabla.attach(label, 3,4, row, row+1)
+
+ eventbox = Gtk.EventBox()
+ eventbox.set_size_request(300, -1)
+ tabla.attach(eventbox, 4,5, row, row+1)
+
+ eventbox.connect("draw",
+ self.__draw_bar, poll.data[choice],
+ poll.vote_count)
row += 1
diff --git a/poll.py b/poll.py
index 1a581e0..6b70361 100644
--- a/poll.py
+++ b/poll.py
@@ -311,13 +311,11 @@ class PollBuilder(activity.Activity):
if self._poll.sha == sha:
self._logger.debug('delete_poll: removing current poll')
- self._poll = Poll(activity=self)
- self.current_vote = None
for poll in self._polls:
if poll.sha == sha:
self._polls.remove(poll)
-
+
self.set_canvas(SelectCanvas(self))
def vote_choice_radio_button(self, widget, data):