generated from itdominator/Python-With-Gtk-Template
Fixing save/delete process
This commit is contained in:
parent
9730e3a75e
commit
b32eafcabe
|
@ -23,7 +23,6 @@ class Page(Gtk.ScrolledWindow):
|
||||||
self._name = None
|
self._name = None
|
||||||
self._date = None
|
self._date = None
|
||||||
|
|
||||||
self.mouse_held = False
|
|
||||||
self.was_dragging = False
|
self.was_dragging = False
|
||||||
|
|
||||||
self._setup_styling()
|
self._setup_styling()
|
||||||
|
@ -92,7 +91,6 @@ class Page(Gtk.ScrolledWindow):
|
||||||
settings.update_manifest(self._manifest_pth, self._name, self._date)
|
settings.update_manifest(self._manifest_pth, self._name, self._date)
|
||||||
|
|
||||||
def _release_event(self, widget = None, eve = None):
|
def _release_event(self, widget = None, eve = None):
|
||||||
self.mouse_held = False
|
|
||||||
if self.was_dragging:
|
if self.was_dragging:
|
||||||
self.was_dragging = False
|
self.was_dragging = False
|
||||||
return
|
return
|
||||||
|
|
|
@ -26,6 +26,7 @@ class DynamicHeaderWidget(Gtk.Box):
|
||||||
self._drag_start_y = 0
|
self._drag_start_y = 0
|
||||||
self._prior_time = 0
|
self._prior_time = 0
|
||||||
self._update_block = False
|
self._update_block = False
|
||||||
|
self.is_dragging = False
|
||||||
|
|
||||||
self._setup_styling()
|
self._setup_styling()
|
||||||
self._setup_signals()
|
self._setup_signals()
|
||||||
|
@ -47,15 +48,14 @@ class DynamicHeaderWidget(Gtk.Box):
|
||||||
...
|
...
|
||||||
|
|
||||||
def _load_widgets(self):
|
def _load_widgets(self):
|
||||||
self.is_dragging = False
|
|
||||||
drag_eve = Gtk.Button(label = "...")
|
drag_eve = Gtk.Button(label = "...")
|
||||||
hresize_eve = Gtk.Button(label = "< >")
|
hresize_eve = Gtk.Button(label = "< >")
|
||||||
|
|
||||||
drag_eve.set_hexpand(True)
|
|
||||||
hresize_eve.connect("button-press-event", self._press_event)
|
hresize_eve.connect("button-press-event", self._press_event)
|
||||||
hresize_eve.connect("motion-notify-event", self._resize_motion_event)
|
hresize_eve.connect("motion-notify-event", self._resize_motion_event)
|
||||||
hresize_eve.connect("button-release-event", self._release_event)
|
hresize_eve.connect("button-release-event", self._release_event)
|
||||||
|
|
||||||
|
drag_eve.set_hexpand(True)
|
||||||
drag_eve.connect("button-press-event", self._press_event)
|
drag_eve.connect("button-press-event", self._press_event)
|
||||||
drag_eve.connect("motion-notify-event", self._motion_event)
|
drag_eve.connect("motion-notify-event", self._motion_event)
|
||||||
drag_eve.connect("button-release-event", self._release_event)
|
drag_eve.connect("button-release-event", self._release_event)
|
||||||
|
|
|
@ -95,7 +95,7 @@ class DynamicWidget(Gtk.Box):
|
||||||
self._body_widget.load_saveable_data()
|
self._body_widget.load_saveable_data()
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
path = f"{settings.get_active_page()}{self.uuid}"
|
path = f"{settings.get_active_page().replace('MANIFEST', '')}{self.uuid}"
|
||||||
logger.debug(f"Deleteing: {path}")
|
logger.debug(f"Deleteing: {path}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -121,7 +121,8 @@ class DynamicWidget(Gtk.Box):
|
||||||
save_collection["x"] = self._header_widget._current_x
|
save_collection["x"] = self._header_widget._current_x
|
||||||
save_collection["y"] = self._header_widget._current_y
|
save_collection["y"] = self._header_widget._current_y
|
||||||
|
|
||||||
path = f"{settings.get_active_page()}{self.uuid}"
|
page = settings.get_active_page().replace('MANIFEST', '')
|
||||||
|
path = f"{page}{self.uuid}"
|
||||||
logger.debug(f"Saving: {path}")
|
logger.debug(f"Saving: {path}")
|
||||||
with open(path, "wb") as f:
|
with open(path, "wb") as f:
|
||||||
pickle.dump(save_collection, f, protocol = pickle.HIGHEST_PROTOCOL, fix_imports = True, buffer_callback = None)
|
pickle.dump(save_collection, f, protocol = pickle.HIGHEST_PROTOCOL, fix_imports = True, buffer_callback = None)
|
||||||
|
|
Loading…
Reference in New Issue