def display(self, record, field): super(Binary, self).display(record, field) if not field: if self.wid_text: self.wid_text.set_text('') self.wid_size.set_text('') self.but_save_as.hide() return False if hasattr(field, 'get_size'): size = field.get_size(record) else: size = len(field.get(record)) self.wid_size.set_text(common.humanize(size or 0)) reset_position(self.wid_size) if self.wid_text: self.wid_text.set_text(self.filename_field.get(record) or '') reset_position(self.wid_text) if size: stock, tooltip = 'tryton-open', _("Open...") else: stock, tooltip = None, '' pos = gtk.ENTRY_ICON_PRIMARY self.wid_text.set_icon_from_stock(pos, stock) self.wid_text.set_icon_tooltip_text(pos, tooltip) self.update_buttons(bool(size)) return True
def display(self): super(Binary, self).display() if not self.field: if self.wid_text: self.wid_text.set_text('') self.wid_size.set_text('') self.but_save_as.hide() return False if hasattr(self.field, 'get_size'): size = self.field.get_size(self.record) else: size = len(self.field.get(self.record)) self.wid_size.set_text(common.humanize(size or 0)) reset_position(self.wid_size) if self.wid_text: self.wid_text.set_text(self.filename_field.get(self.record) or '') reset_position(self.wid_text) if size: icon, tooltip = 'tryton-open', _("Open...") else: icon, tooltip = None, '' pos = Gtk.EntryIconPosition.PRIMARY if icon: pixbuf = common.IconFactory.get_pixbuf(icon, Gtk.IconSize.MENU) else: pixbuf = None self.wid_text.set_icon_from_pixbuf(pos, pixbuf) self.wid_text.set_icon_tooltip_text(pos, tooltip) self.update_buttons(bool(size)) return True
def display(self, record, field): super(Binary, self).display(record, field) if not field: if self.wid_text: self.wid_text.set_text('') self.wid_size.set_text('') if self.but_open: self.but_open.set_sensitive(False) self.but_save_as.set_sensitive(False) return False if self.wid_text: self.wid_text.set_text(self.filename_field.get(record) or '') self.wid_size.set_text(common.humanize(field.get_size(record) or 0)) if self.but_open: self.but_open.set_sensitive(bool(field.get_size(record))) self.but_save_as.set_sensitive(bool(field.get_size(record))) return True
def display(self, record, field): super(Binary, self).display(record, field) if not field: if self.wid_text: self.wid_text.set_text('') self.wid_size.set_text('') if self.but_open: self.but_open.set_sensitive(False) self.but_save_as.set_sensitive(False) return False if self.wid_text: self.wid_text.set_text(self.filename_field.get(record) or '') reset_position(self.wid_text) if hasattr(field, 'get_size'): size = field.get_size(record) else: size = len(field.get(record)) self.wid_size.set_text(common.humanize(size or 0)) reset_position(self.wid_size) if self.but_open: self.but_open.set_sensitive(bool(size)) self.but_save_as.set_sensitive(bool(size)) return True