Refactor file loading to detect external modifications and add reload capability

- Extract _load_data() method from load_path() for reuse in reload()
- Add is_extters externally_modified() to track file state changes (mtime/size)
- Replace load_bytes() with load_contents() for better error handling
- Add reload() method to re-read file from disk
- Fix file_state_watcher by properly detecting external changes
This commit is contained in:
2026-03-22 00:35:51 -05:00
parent 0b231ac749
commit 7c4c9ecf88
4 changed files with 91 additions and 41 deletions

View File

@@ -13,8 +13,6 @@ from gi.repository import Gtk
def add_prettify_json(buffer, menu):
menu.append(separator)
def on_prettify_json(menuitem, buffer):
start_itr, \
end_itr = buffer.get_start_iter(), buffer.get_end_iter()
@@ -28,4 +26,4 @@ def add_prettify_json(buffer, menu):
item = Gtk.MenuItem(label = "Prettify JSON")
item.connect("activate", on_prettify_json, buffer)
menu.append(item)
menu.append(item)