def __init__(self, title, mimetype, evaluation='', can_check=True): gtk.HBox.__init__(self) if can_check: self._checkbutton = gtk.CheckButton() self._checkbutton.connect('toggled', self._toggled) label = gtk.Label("<b>%s</b>" % (title)) label.set_use_markup(True) icon = Icon(pixel_size=52) icon.props.icon_name = mime.get_mime_icon(mimetype) icon.props.xo_color = profile.get_color() evaluation = gtk.Label(evaluation) button = gtk.ToolButton() button.connect('clicked', lambda w: self.emit('show-info')) icon_info = Icon(pixel_size=24) icon_info.props.icon_name = 'info-small' button.set_icon_widget(icon_info) if can_check: self.pack_start(self._checkbutton, False, True, 5) self.pack_start(icon, False, True, 5) self.pack_start(label, False, True, 5) self.pack_end(button, False, True, 5) self.pack_end(evaluation, False, True, 5) self.title = title self.mimetype = mimetype self.show_all()
def __init__(self, title, comment, evaluation, student, mimetype): super(InfoDialogHW, self).__init__("info", 'Informacion del documento') hbox = gtk.HBox() self.content_vbox.pack_start(hbox, True) previewbox = gtk.VBox() preview = Icon(pixel_size=300) preview.props.icon_name = mime.get_mime_icon(mimetype) preview.props.xo_color = profile.get_color() previewbox.pack_start(preview, False) hbox.pack_start(previewbox, False, padding=5) vbox = gtk.VBox() hbox.pack_end(vbox, True, padding=20) title_label = gtk.Label( '<span font_desc="15"><b>%s</b></span>' % title) title_label.set_use_markup(True) vbox.pack_start(title_label, False) commet_box = gtk.VBox() commet_label = gtk.Label('<i>%s</i>' % comment) commet_label.set_use_markup(True) commet_label.set_line_wrap(True) commet_box.pack_start(commet_label, False, padding=30) vbox.pack_start(commet_box, True) box = gtk.HBox() student_label = gtk.Label('%s' % student) box.pack_end(student_label, False) evaluation = evaluation.split('|') evaluation = '<b>%s</b>\n%s' % (evaluation[0], evaluation[1]) evaluation_t = gtk.Label('%s' % evaluation) evaluation_t.set_use_markup(True) evaluation_t.set_line_wrap_mode(gtk.WRAP_WORD) evaluation_t.set_line_wrap(True) box.pack_start(evaluation_t, False) bbox = gtk.HBox() self.content_vbox.pack_end(bbox, False) self.content_vbox.pack_end(box, False) self.show_all()
def __init__(self, title, desc, teacher, subject, mimetype): super(InfoDialog, self).__init__("info", 'Informacion del documento') hbox = gtk.HBox() self.content_vbox.pack_start(hbox, True) previewbox = gtk.VBox() preview = Icon(pixel_size=300) preview.props.icon_name = mime.get_mime_icon(mimetype) preview.props.xo_color = profile.get_color() previewbox.pack_start(preview, False) hbox.pack_start(previewbox, False, padding=5) vbox = gtk.VBox() hbox.pack_end(vbox, True, padding=20) title_label = gtk.Label( '<span font_desc="15"><b>%s</b></span>' % title) title_label.set_use_markup(True) vbox.pack_start(title_label, False) desc_box = gtk.VBox() desc_label = gtk.Label('<i>%s</i>' % desc) desc_label.set_use_markup(True) desc_label.set_line_wrap(True) desc_box.pack_start(desc_label, False, padding=30) vbox.pack_start(desc_box, True) box = gtk.HBox() teacher_label = gtk.Label('%s - %s' % (teacher, subject)) box.pack_start(teacher_label, False) bbox = gtk.HBox() self.content_vbox.pack_end(bbox, False) self.content_vbox.pack_end(box, False) btn_save = gtk.Button(stock=gtk.STOCK_SAVE) btn_save.connect('clicked', lambda w: self.emit('save-document')) bbox.pack_end(btn_save, False) self.show_all()