Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2013-09-02 19:00:10 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2013-09-02 19:00:10 (GMT)
commit97dd74dd41d3619a2dfffa6243137bc2774279d8 (patch)
tree44c4d8bd06a8851273316dee1f41b3a2bf8b4f68
parent9f2b25c4b3567323dca0b04c6d8d89e65b818d49 (diff)
Pep8 fixes
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
-rw-r--r--PollSession.py55
-rw-r--r--Widgets.py110
-rw-r--r--poll.py67
3 files changed, 132 insertions, 100 deletions
diff --git a/PollSession.py b/PollSession.py
index f79e72d..36e60e1 100644
--- a/PollSession.py
+++ b/PollSession.py
@@ -38,15 +38,17 @@ SERVICE = "org.worldwideworkshop.olpc.PollBuilder"
IFACE = SERVICE
PATH = "/org/worldwideworkshop/olpc/PollBuilder"
+
class Poll():
"""
Represent the data of one poll.
"""
- def __init__(self, activity=None, title='', author='', active=False,
- createdate=date.today(), maxvoters=20, question='',
- number_of_options=5, options=None, data=None, votes=None,
- images=None, images_ds_objects=None):
+ def __init__(
+ self, activity=None, title='', author='', active=False,
+ createdate=date.today(), maxvoters=20, question='',
+ number_of_options=5, options=None, data=None, votes=None,
+ images=None, images_ds_objects=None):
### Create the Poll.
self.activity = activity
@@ -61,7 +63,7 @@ class Poll():
self.images = (images or {0: '', 1: '', 2: '', 3: '', 4: ''})
self.images_ds_objects = (images_ds_objects or {0: {}, 1: {}, 2: {},
- 3: {}, 4: {}})
+ 3: {}, 4: {}})
self.data = (data or {0: 0, 1: 0, 2: 0, 3: 0, 4: 0})
self.votes = (votes or {})
@@ -223,6 +225,7 @@ class Poll():
self.maxvoters, self.question, self.number_of_options,
self.options, self.data, self.votes, images_buf)
+
class PollSession(ExportedGObject):
"""
The bit that talks over the TUBES!!!
@@ -341,8 +344,8 @@ class PollSession(ExportedGObject):
@signal(dbus_interface=IFACE, signature='ssuuusua{us}a{uu}a{su}a{us}')
def UpdatedPoll(self, title, author, active, createdate, maxvoters,
- question, number_of_options, options, data, votes,
- images_buf):
+ question, number_of_options, options, data, votes,
+ images_buf):
"""
Broadcast a new poll to the mesh.
"""
@@ -363,7 +366,7 @@ class PollSession(ExportedGObject):
# Send my polls
for poll in self.activity.get_my_polls():
self._logger.debug('Telling %s about my %s' %
- (sender, poll.title))
+ (sender, poll.title))
#images_properties = poll.simplify_images_dictionary()
images_buf = {}
@@ -395,7 +398,7 @@ class PollSession(ExportedGObject):
"""
self._logger.debug('*** In helloback_cb: recipient: %s, sender: %s' %
- (recipient, sender))
+ (recipient, sender))
if sender == self.my_bus_name:
# Ignore my own signal
@@ -409,7 +412,7 @@ class PollSession(ExportedGObject):
for poll in self.activity.get_my_polls():
self._logger.debug('Telling %s about my %s' %
- (sender, poll.title))
+ (sender, poll.title))
images_buf = {}
@@ -438,8 +441,8 @@ class PollSession(ExportedGObject):
return pixbuf
def __updatedpoll_cb(self, title, author, active, createdate, maxvoters,
- question, number_of_options, options_d, data_d,
- votes_d, images_buf_d, sender):
+ question, number_of_options, options_d, data_d,
+ votes_d, images_buf_d, sender):
"""
Handle an UpdatedPoll signal by creating a new Poll.
"""
@@ -490,15 +493,15 @@ class PollSession(ExportedGObject):
images[int(key)] = ''
poll = Poll(self.activity, title, author, active,
- createdate, maxvoters, question, number_of_options,
- options, data, votes, images)
+ createdate, maxvoters, question, number_of_options,
+ options, data, votes, images)
self.activity._polls.add(poll)
self.activity.get_alert(('New Poll'),
- _("%(author)s shared a poll "
- "'%(title)s' with you.") % {'author': author,
- 'title': title})
+ _("%(author)s shared a poll "
+ "'%(title)s' with you.") %
+ {'author': author, 'title': title})
def __vote_cb(self, author, title, choice, votersha, sender=None):
"""
@@ -519,15 +522,15 @@ class PollSession(ExportedGObject):
self._logger.debug('In vote_cb. sender: %r' % sender)
self._logger.debug('%s voted %d on %s by %s' % (votersha, choice,
- title, author))
+ title, author))
self.activity.vote_on_poll(author, title, choice, votersha)
@method(dbus_interface=IFACE, in_signature='ssuuusua{us}a{uu}a{su}a{us}',
- out_signature='')
+ out_signature='')
def UpdatePoll(self, title, author, active, createdate, maxvoters,
- question, number_of_options, options_d, data_d, votes_d,
- images_buf_d):
+ question, number_of_options, options_d, data_d, votes_d,
+ images_buf_d):
"""
To be called on the incoming buddy by the other participants
to inform you of their polls and state.
@@ -574,15 +577,15 @@ class PollSession(ExportedGObject):
images[int(key)] = ''
poll = Poll(self.activity, title, author, active,
- createdate, maxvoters, question, number_of_options,
- options, data, votes, images)
+ createdate, maxvoters, question, number_of_options,
+ options, data, votes, images)
self.activity._polls.add(poll)
self.activity.get_alert(_('New Poll'),
- _("%(author)s shared a poll "
- "'%(title)s' with you.") % {'author': author,
- 'title': title})
+ _("%(author)s shared a poll "
+ "'%(title)s' with you.") %
+ {'author': author, 'title': title})
@method(dbus_interface=IFACE, in_signature='s', out_signature='')
def PollsWanted(self, sender):
diff --git a/Widgets.py b/Widgets.py
index 007adb9..092f7bd 100644
--- a/Widgets.py
+++ b/Widgets.py
@@ -42,6 +42,7 @@ from sugar3.activity.widgets import ActivityToolbarButton
basepath = os.path.dirname(__file__)
+
class Toolbar(ToolbarBox):
def __init__(self, activity):
@@ -82,6 +83,7 @@ class Toolbar(ToolbarBox):
self.show_all()
+
class NewPollCanvas(Gtk.Box):
"""
widgets to set up a new poll or editing existing poll.
@@ -96,7 +98,7 @@ class NewPollCanvas(Gtk.Box):
# FIXME: El parámetro highlight nunca se utilizó, la idea era
# resaltar el texto en las etiquetas para aquellas opciones no
# validadas en la encuesta.
- Gtk.Box.__init__(self, orientation = Gtk.Orientation.VERTICAL)
+ Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)
self._poll = poll
@@ -111,17 +113,22 @@ class NewPollCanvas(Gtk.Box):
self.pack_start(item_poll, False, False, 10)
item_poll = ItemNewPoll(_('Question:'), self._poll.question)
- item_poll.entry.connect('changed', self.__entry_activate_cb, 'question')
+ item_poll.entry.connect('changed', self.__entry_activate_cb,
+ 'question')
self.pack_start(item_poll, False, False, 10)
- item_poll = ItemNewPoll(_('Number of votes to collect:'), str(self._poll.maxvoters))
- item_poll.entry.connect('changed', self.__entry_activate_cb, 'maxvoters')
+ item_poll = ItemNewPoll(_('Number of votes to collect:'),
+ str(self._poll.maxvoters))
+ item_poll.entry.connect('changed', self.__entry_activate_cb,
+ 'maxvoters')
self.pack_start(item_poll, False, False, 10)
for choice in self._poll.options.keys():
hbox = Gtk.HBox()
- item_poll = ItemNewPoll(_('Answer %s:') % choice, self._poll.options[choice])
- item_poll.entry.connect('changed', self.__entry_activate_cb, str(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)
if self._poll.activity._use_image:
@@ -135,7 +142,7 @@ class NewPollCanvas(Gtk.Box):
hbox.pack_start(button, True, False, 10)
button.connect('clicked', self.__button_choose_image_cb,
- str(choice), hbox)
+ str(choice), hbox)
item_poll.pack_end(hbox, False, False, 0)
@@ -166,8 +173,7 @@ class NewPollCanvas(Gtk.Box):
if hasattr(mime, 'GENERIC_TYPE_IMAGE'):
chooser = ObjectChooser(parent=self,
- what_filter=mime.GENERIC_TYPE_IMAGE)
-
+ what_filter=mime.GENERIC_TYPE_IMAGE)
else:
chooser = ObjectChooser(parent=self)
@@ -175,8 +181,6 @@ class NewPollCanvas(Gtk.Box):
result = chooser.run()
if result == Gtk.ResponseType.ACCEPT:
- #logging.debug('ObjectChooser: %r' %
- # chooser.get_selected_object())
jobject = chooser.get_selected_object()
@@ -187,7 +191,8 @@ class NewPollCanvas(Gtk.Box):
jobject.metadata.get('mime_type') in images_mime_types:
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(
- jobject.file_path, self._poll.activity._image_size['height'],
+ jobject.file_path,
+ self._poll.activity._image_size['height'],
self._poll.activity._image_size['width'])
self._poll.images[int(data)] = pixbuf
@@ -202,7 +207,8 @@ 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:
@@ -244,7 +250,8 @@ class NewPollCanvas(Gtk.Box):
print "*** failed_items:", failed_items
# FIXME: El parámetro highlight nunca se utilizó, la idea era
# resaltar el texto en las etiquetas para aquellas opciones no
- # validadas en la encuesta. (Modificar para que suceda al perder el foco el entry)
+ # validadas en la encuesta.
+ # (Modificar para que suceda al perder el foco el entry)
#self.set_root(self._build_canvas(highlight=failed_items))
#self.show_all()
return
@@ -269,7 +276,8 @@ class NewPollCanvas(Gtk.Box):
print "*** failed_items:", failed_items
# FIXME: El parámetro highlight nunca se utilizó, la idea era
# resaltar el texto en las etiquetas para aquellas opciones no
- # validadas en la encuesta. (Modificar para que suceda al perder el foco el entry)
+ # validadas en la encuesta.
+ # (Modificar para que suceda al perder el foco el entry)
#self.set_root(self._build_canvas(highlight=failed_items))
#self.show_all()
return
@@ -335,16 +343,17 @@ class NewPollCanvas(Gtk.Box):
self._poll.maxvoters = int(text)
except ValueError:
- self._poll.maxvoters = 0 # invalid, will be trapped
+ self._poll.maxvoters = 0 # invalid, will be trapped
else:
self._poll.options[int(data)] = text
+
class ItemNewPoll(Gtk.Box):
def __init__(self, label_text, entry_text):
- Gtk.Box.__init__(self, orientation = Gtk.Orientation.HORIZONTAL)
+ Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)
self.entry = Gtk.Entry()
self.entry.set_text(entry_text)
@@ -354,6 +363,7 @@ class ItemNewPoll(Gtk.Box):
self.show_all()
+
class OptionsCanvas(Gtk.Box):
"""
Show the options canvas.
@@ -361,7 +371,7 @@ class OptionsCanvas(Gtk.Box):
def __init__(self, poll_activity):
- Gtk.Box.__init__(self, orientation = Gtk.Orientation.VERTICAL)
+ Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)
self.poll_activity = poll_activity
self.poll_activity._current_view = 'options'
@@ -393,7 +403,8 @@ class OptionsCanvas(Gtk.Box):
rememberVoteCB = Gtk.CheckButton(label=_('Remember last vote'))
rememberVoteCB.set_active(self.poll_activity._remember_last_vote)
- rememberVoteCB.connect('toggled', self.__remember_last_vote_checkbox_cb)
+ rememberVoteCB.connect('toggled',
+ self.__remember_last_vote_checkbox_cb)
options_details_box.pack_start(rememberVoteCB, True, True, 10)
playVoteSoundCB = Gtk.CheckButton(
@@ -426,7 +437,8 @@ class OptionsCanvas(Gtk.Box):
entrybox.set_text(str(self.poll_activity._image_size['width']))
entrybox.connect('changed', self.__entry_image_size_cb, 'width')
hbox2.pack_start(entrybox, True, True, 10)
- useImageCB.connect('toggled', self.__use_image_checkbox_cb, vbox, hbox2)
+ useImageCB.connect('toggled', self.__use_image_checkbox_cb, vbox,
+ hbox2)
if self.poll_activity._use_image:
vbox.pack_start(hbox2, True, True, 10)
@@ -456,7 +468,8 @@ class OptionsCanvas(Gtk.Box):
text = entrycontrol.get_text()
- if text: self.poll_activity._image_size[data] = int(text)
+ if text:
+ self.poll_activity._image_size[data] = int(text)
def __use_image_checkbox_cb(self, checkbox, parent, child):
@@ -472,14 +485,16 @@ class OptionsCanvas(Gtk.Box):
def __button_save_options_cb(self, button):
- self.poll_activity.get_alert(_('Poll Activity'),
+ self.poll_activity.get_alert(
+ _('Poll Activity'),
_('The settings have been saved'))
+
class SelectCanvas(Gtk.Box):
def __init__(self, poll_activity):
- Gtk.Box.__init__(self, orientation = Gtk.Orientation.VERTICAL)
+ Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)
poll_activity._current_view = 'select'
@@ -526,12 +541,14 @@ class SelectCanvas(Gtk.Box):
else:
button = Gtk.Button(_('SEE RESULTS'))
- button.connect('clicked', poll_activity._select_poll_button_cb, sha)
+ button.connect('clicked', poll_activity._select_poll_button_cb,
+ sha)
poll_row.pack_start(button, False, False, 10)
if poll.author == profile.get_nick_name():
button = Gtk.Button(_('DELETE'))
- button.connect('clicked', poll_activity._delete_poll_button_cb, sha)
+ button.connect('clicked',
+ poll_activity._delete_poll_button_cb, sha)
poll_row.pack_start(button, False, False, 10)
poll_row.pack_start(Gtk.Label(
@@ -539,11 +556,12 @@ class SelectCanvas(Gtk.Box):
self.show_all()
+
class LessonPlanCanvas(Gtk.Box):
def __init__(self, poll_activity):
- Gtk.Box.__init__(self, orientation = Gtk.Orientation.VERTICAL)
+ Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)
poll_activity._current_view = 'lessonplan'
@@ -554,6 +572,7 @@ class LessonPlanCanvas(Gtk.Box):
self.show_all()
+
class LessonPlanWidget(Gtk.Notebook):
"""
Create a Notebook widget for displaying lesson plans in tabs.
@@ -567,15 +586,14 @@ class LessonPlanWidget(Gtk.Notebook):
lessons = filter(
lambda x: os.path.isdir(os.path.join(basepath,
- 'lessons', x)),
+ 'lessons', x)),
os.listdir(os.path.join(basepath, 'lessons')))
lessons.sort()
for lesson in lessons:
self.__load_lesson(
- os.path.join(basepath,
- 'lessons', lesson),
+ os.path.join(basepath, 'lessons', lesson),
_(lesson))
self.show_all()
@@ -604,11 +622,12 @@ class LessonPlanWidget(Gtk.Notebook):
canvas.set_show_margin(False)
self.append_page(canvas, Gtk.Label(label=name))
+
class PollCanvas(Gtk.Box):
def __init__(self, cabecera, poll, current_vote, view_answer, previewing):
- Gtk.Box.__init__(self, orientation = Gtk.Orientation.VERTICAL)
+ Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)
self._poll = poll
@@ -653,11 +672,11 @@ class PollCanvas(Gtk.Box):
button = Gtk.RadioButton.new_with_label_from_widget(
group, poll.options[choice])
- button.connect('toggled', poll.activity.vote_choice_radio_button, choice)
+ button.connect('toggled', poll.activity.vote_choice_radio_button,
+ choice)
if poll.active:
button.set_sensitive(True)
-
else:
button.set_sensitive(False)
@@ -669,7 +688,7 @@ class PollCanvas(Gtk.Box):
if not poll.images[int(choice)] == '':
image = Gtk.Image()
image.set_from_pixbuf(poll.images[choice])
- tabla.attach(image, 1,2, row, row+1)
+ tabla.attach(image, 1, 2, row, row + 1)
if view_answer or not poll.active:
if poll.vote_count > 0:
@@ -677,15 +696,15 @@ class PollCanvas(Gtk.Box):
### Total de votos
label = Gtk.Label(poll.data[choice])
label.set_size_request(100, -1)
- tabla.attach(label, 3,4, row, row+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)
+ tabla.attach(eventbox, 4, 5, row, row + 1)
eventbox.connect("draw",
- self.__draw_bar, poll.data[choice],
- poll.vote_count)
+ self.__draw_bar, poll.data[choice],
+ poll.vote_count)
row += 1
@@ -694,16 +713,16 @@ class PollCanvas(Gtk.Box):
### Barra para total
eventbox = Gtk.EventBox()
eventbox.connect("draw", self.__draw_line)
- tabla.attach(eventbox, 3,5, row, row+1)
+ tabla.attach(eventbox, 3, 5, row, row + 1)
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)
+ _('votes'), _('(votes left to collect)'),
+ poll.maxvoters - poll.vote_count))
+ tabla.attach(label, 3, 5, row, row + 1)
row += 1
@@ -711,16 +730,16 @@ class PollCanvas(Gtk.Box):
if poll.active and not previewing:
button = Gtk.Button(_("Vote"))
button.connect('clicked', poll.activity.button_vote_cb)
- tabla.attach(button, 0,1, row, row+1)
+ tabla.attach(button, 0, 1, row, row + 1)
elif previewing:
button = Gtk.Button(_("Edit Poll"))
button.connect('clicked', poll.activity.button_edit_clicked)
- tabla.attach(button, 0,1, row, row+1)
+ tabla.attach(button, 0, 1, row, row + 1)
button = Gtk.Button(_("Save Poll"))
button.connect('clicked', self._button_save_cb)
- tabla.attach(button, 1,2, row, row+1)
+ tabla.attach(button, 1, 2, row, row + 1)
self.show_all()
@@ -736,7 +755,8 @@ class PollCanvas(Gtk.Box):
print "*** failed_items:", failed_items
# FIXME: El parámetro highlight nunca se utilizó, la idea era
# resaltar el texto en las etiquetas para aquellas opciones no
- # validadas en la encuesta. (Modificar para que suceda al perder el foco el entry)
+ # validadas en la encuesta.
+ # (Modificar para que suceda al perder el foco el entry)
#self.set_root(self._build_canvas(highlight=failed_items))
#self.show_all()
return
diff --git a/poll.py b/poll.py
index 6d0a0b6..8851176 100644
--- a/poll.py
+++ b/poll.py
@@ -55,10 +55,10 @@ from sugar3 import profile
from Widgets import Toolbar
### Interfaces
-from Widgets import NewPollCanvas #Creando una nueva encuesta.
-from Widgets import OptionsCanvas #Configurando opciones de encuesta.
-from Widgets import SelectCanvas #Seleccionando una de las encuestas disponibles.
-from Widgets import PollCanvas #Contestando una encuesta.
+from Widgets import NewPollCanvas # Create a new poll.
+from Widgets import OptionsCanvas # Configure optinons.
+from Widgets import SelectCanvas # Select one available poll.
+from Widgets import PollCanvas # Participate in a poll.
from Widgets import LessonPlanCanvas
from PollSession import PollSession
@@ -68,6 +68,7 @@ SERVICE = "org.worldwideworkshop.olpc.PollBuilder"
IFACE = SERVICE
PATH = "/org/worldwideworkshop/olpc/PollBuilder"
+
class PollBuilder(activity.Activity):
"""
Sugar activity for polls
@@ -127,7 +128,8 @@ class PollBuilder(activity.Activity):
toolbar = Toolbar(self)
toolbar.create_button.connect('clicked', self.__button_new_clicked)
toolbar.choose_button.connect('clicked', self.__button_select_clicked)
- toolbar.settings_button.connect('clicked', self.__button_options_clicked)
+ toolbar.settings_button.connect('clicked',
+ self.__button_options_clicked)
toolbar.help_button.connect('clicked', self.__button_lessonplan_cb)
self.set_toolbar_box(toolbar)
@@ -186,7 +188,7 @@ class PollBuilder(activity.Activity):
"""
self._logger.debug('Reading file from datastore via Journal: %s' %
- file_path)
+ file_path)
self._polls = set()
@@ -217,9 +219,9 @@ class PollBuilder(activity.Activity):
images_ds_objects_id)
poll = Poll(self, title, author, active,
- date.fromordinal(int(createdate_i)),
- maxvoters, question, number_of_options, options,
- data, votes, images, images_ds_object)
+ date.fromordinal(int(createdate_i)),
+ maxvoters, question, number_of_options, options,
+ data, votes, images, images_ds_object)
self._polls.add(poll)
@@ -286,7 +288,8 @@ class PollBuilder(activity.Activity):
else:
cabecera = _('Poll Preview')
- return PollCanvas(cabecera, self._poll, self.current_vote, self._view_answer, self._previewing)
+ return PollCanvas(cabecera, self._poll, self.current_vote,
+ self._view_answer, self._previewing)
def _select_poll_button_cb(self, button, sha=None):
"""
@@ -357,7 +360,7 @@ class PollBuilder(activity.Activity):
except OverflowError:
self._logger.debug('Local vote failed: '
- 'maximum votes already registered.')
+ 'maximum votes already registered.')
except ValueError:
self._logger.debug('Local vote failed: poll closed.')
@@ -376,10 +379,12 @@ class PollBuilder(activity.Activity):
else:
cabecera = _('Poll Preview')
- self.set_canvas(PollCanvas(cabecera, self._poll, self.current_vote, self._view_answer, self._previewing))
-
+ 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):
@@ -395,10 +400,8 @@ class PollBuilder(activity.Activity):
"""
# Reset vote data to 0
- self._poll = Poll(
- activity=self,
- author = profile.get_nick_name(),
- active = False)
+ self._poll = Poll(activity=self, author=profile.get_nick_name(),
+ active=False)
self.current_vote = None
@@ -477,7 +480,8 @@ 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!')
@@ -486,16 +490,20 @@ class PollBuilder(activity.Activity):
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))
+ 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:'
+ self._logger.debug(
+ 'Ignored mesh vote %u from %s:'
' poll reached maximum votes.',
choice, votersha)
except ValueError:
- self._logger.debug('Ignored mesh vote %u from %s:'
- ' poll closed.',
+ self._logger.debug(
+ 'Ignored mesh vote %u from %s: poll closed.',
choice, votersha)
def __button_lessonplan_cb(self, button):
@@ -575,9 +583,9 @@ class PollBuilder(activity.Activity):
Callback for when we have a Tube.
"""
- self._logger.debug('New tube: ID=%d initator=%d type=%d service=%s '
- 'params=%r state=%d', id, initiator, type, service,
- params, state)
+ self._logger.debug(
+ 'New tube: ID=%d initator=%d type=%d srv=%s params=%r state=%d',
+ id, initiator, type, service, params, state)
if (type == telepathy.TUBE_TYPE_DBUS and service == SERVICE):
if state == telepathy.TUBE_STATE_LOCAL_PENDING:
@@ -591,7 +599,7 @@ class PollBuilder(activity.Activity):
group_iface=self.text_chan[telepathy.CHANNEL_INTERFACE_GROUP])
self.poll_session = PollSession(tube_conn, self.initiating,
- self.__get_buddy, self)
+ self.__get_buddy, self)
def __buddy_joined_cb(self, activity, buddy):
@@ -612,13 +620,14 @@ class PollBuilder(activity.Activity):
group = self.text_chan[telepathy.CHANNEL_INTERFACE_GROUP]
my_csh = group.GetSelfHandle()
- SIGNAL_TELEPATHY = telepathy.CHANNEL_GROUP_FLAG_CHANNEL_SPECIFIC_HANDLES
+ SIGNAL_TELEPATHY = \
+ telepathy.CHANNEL_GROUP_FLAG_CHANNEL_SPECIFIC_HANDLES
self._logger.debug('My handle in that group is %u', my_csh)
if my_csh == cs_handle:
handle = self.conn.GetSelfHandle()
self._logger.debug('CS handle %u belongs to me, %u', cs_handle,
- handle)
+ handle)
elif group.GetGroupFlags() & SIGNAL_TELEPATHY:
handle = group.GetHandleOwners([cs_handle])[0]