def _set_option(options, cfg_file_path, section, oname, value): # if the application doesn't set this value then it doesn't want global options if not cfg_file_path: raise OptionsNotConfigured() # Make sure the option has been defined assert section in DEFINITIONS and oname in DEFINITIONS[section] # NB: just because it's defined doesn't meant that GLOBAL_OPTIONS knows about it if not options.has_section(section): options.add_section(section) if isinstance(value, str) or isinstance(value, bytes): from aipoed import utils svalue = utils.make_utf8_compliant(value) elif isinstance(value, bool): svalue = "true" if value else "false" else: svalue = str(value) options.set(section, oname, svalue) with open(cfg_file_path, "w") as f_obj: options.write(f_obj)
def insert_with_tags_by_name(self, text_iter, text, *args): return Gtk.TextBuffer.insert_with_tags_by_name( self, text_iter, utils.make_utf8_compliant(text), *args)
def insert_interactive_at_cursor(self, text, default_editable): return Gtk.TextBuffer.insert_interactive_at_cursor( self, utils.make_utf8_compliant(text), default_editable)
def insert_at_cursor(self, text): return Gtk.TextBuffer.insert_at_cursor(self, utils.make_utf8_compliant(text))
def insert(self, text_iter, text): return Gtk.TextBuffer.insert(self, text_iter, utils.make_utf8_compliant(text))
def set_text(self, text, undoable=False): return Gtk.TextBuffer.set_text(self, utils.make_utf8_compliant(text))