def ask_to_save(self, field): """Pergunta ao usuario sobre a edicao de campos""" #Criando um novo if self.editing_new : question =str('Deseja salvar %s ?') for field in self.fields: if field.searchable: registro = quote(str(field.entry.get_text())) #Editando else: question =str('Deseja salvar alterações em %s ?') registro = quote(str(getattr(self.item, field.field_name))) response = yesno((question) % (registro,), parent=None, default=gtk.RESPONSE_OK, buttons=((gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL), (gtk.STOCK_SAVE, gtk.RESPONSE_OK))) return response == gtk.RESPONSE_OK
def default_remove(self, item): """Asks the user confirmation for removal of an item. @param item: a description of the item that will be removed @returns: True if the user confirm the removal, False otherwise """ response = yesno(_('Do you want to remove %s ?') % (quote(str(item)),), parent=None, default=gtk.RESPONSE_OK, buttons=((gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL), (gtk.STOCK_REMOVE, gtk.RESPONSE_OK))) return response == gtk.RESPONSE_OK
def default_remove(self, item): """Asks the user confirmation for removal of an item. @param item: a description of the item that will be removed @returns: True if the user confirm the removal, False otherwise """ response = yesno(_('Do you want to remove %s ?') % (quote(str(item)), ), parent=None, default=gtk.RESPONSE_OK, buttons=((gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL), (gtk.STOCK_REMOVE, gtk.RESPONSE_OK))) return response == gtk.RESPONSE_OK
def on_get_size(self, widget, cell_area): text = quote(self.label) if self._details_callback: details = self._details_callback(self.data) mark_up = '%s\n<span foreground="%s">%s</span>' color = gdk_color_to_string(widget.style.fg[gtk.STATE_NORMAL]) text = mark_up % (self.label, color, details) self._label_layout.set_markup(text) width, height = self._label_layout.get_pixel_size() return 0, 0, width, height + 2