Пример #1
0
 def _update_lang_desc_from_buffer(self, w: Gtk.TextBuffer, lang_index):
     lang = self._string_provider.get_languages()[lang_index]
     self._string_provider.get_model(lang).strings[
         self._string_provider.get_index(StringType.MOVE_DESCRIPTIONS,
                                         self.move_id)] = w.get_text(
                                             w.get_start_iter(),
                                             w.get_end_iter(), False)
Пример #2
0
 def buffer_changed(self, buffer: Gtk.TextBuffer):
     self.show_spinner(True)
     text = buffer.get_text(buffer.get_start_iter(), buffer.get_end_iter(),
                            True)
     GObjectWorker.call(Exporter.export_html_preview, (
         self.temp_file.name,
         text,
     ), self.update_html)
 def on_test_text_view_buffer_changed(  # pylint: disable=no-self-use
         self, widget: Gtk.TextBuffer) -> None:
     '''
     Called when something in the test entry has changed
     '''
     LOGGER.info(
         'Test text view contains: “%s”',
         widget.get_text(widget.get_start_iter(), widget.get_end_iter(),
                         True))
Пример #4
0
 def on_tv_paste_import_buffer_paste_done(self, buff: Gtk.TextBuffer,
                                          *args):
     text = buff.get_text(buff.get_start_iter(), buff.get_end_iter(), False)
     buff.delete(buff.get_start_iter(), buff.get_end_iter())
     try:
         self.item_effects.import_armips_effect_code(
             self._get_current_effect(), text)
         self.module.mark_item_effects_as_modified()
         md = SkyTempleMessageDialog(MainController.window(),
                                     Gtk.DialogFlags.DESTROY_WITH_PARENT,
                                     Gtk.MessageType.INFO,
                                     Gtk.ButtonsType.OK,
                                     _("Patch successfully imported."),
                                     is_success=True)
         md.run()
         md.destroy()
     except Exception as err:
         display_error(sys.exc_info(), str(err),
                       _("Error importing ASM code."))
Пример #5
0
    def _editingCardBack(self, textbuffer_back: TextBuffer) -> None:
        """
        Keeps track of changes at the text_buffer_back.

        :param text_buffer_back: TextBuffer object.
        :return:
        """

        path: TreePath = self._selected_row.get_selected_rows()[1][0]
        start_iter_back: TextIter = textbuffer_back.get_start_iter()
        end_iter_back: TextIter = textbuffer_back.get_end_iter()
        self._subtitles_liststore_back[path][1] = textbuffer_back.get_text(
            start_iter_back, end_iter_back, True)

        self._dict_any_change_back[path.to_string()] = serializeIt(
            text_buffer=textbuffer_back)
Пример #6
0
def get_text(buffer: Gtk.TextBuffer):
    """Get the full content of a GtkTextBuffer"""
    return buffer.get_text(buffer.get_start_iter(), buffer.get_end_iter(),
                           True)
Пример #7
0
 def __pos(text_buffer: Gtk.TextBuffer) -> Gtk.TextIter:
     return text_buffer.get_end_iter()