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:
@@ -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)
|
||||
Reference in New Issue
Block a user