def add(self, question):
"""add a button and set up callback function.
there should not be created more than one button with the same
(c locale) name.
return the button created.
"""
if 'newline' in question and question.newline:
self.newline()
b = Gtk.CheckButton()
if question.name.cval in self.m_button_dict:
print >> sys.stderr, "Warning: The lessonfile contain several questions with the same name:", question.name.cval
print >> sys.stderr, " Things will not work as normal after this."
self.m_button_dict[question.name.cval] = b
self.m_name_list.append(question.name.cval)
b.set_active(question.active)
b.connect('toggled', self.on_checkbutton_toggled)
b.m_cname = question.name.cval
b.add(lessonfilegui.new_labelobject(question.name))
b.show_all()
self.attach(b, self.m_x, self.m_x+1, self.m_y, self.m_y+1)
self.conditional_newline()
return b
评论列表
文章目录