Attempted further memory leak prevention; fixed bugs from moving to python 12; misc.
This commit is contained in:
parent
35456f2bca
commit
3a2e8eeb08
|
@ -48,7 +48,7 @@ class GrepPreviewWidget(Gtk.Box):
|
|||
return bytes(f"\n<span foreground='{color}'>{target}</span>", "utf-8").decode("utf-8")
|
||||
|
||||
def make_utf8_line_highlight(self, buffer, itr, i, color, target, query):
|
||||
parts = re.split(r"(" + query + ")(?i)", target.replace("\n", ""))
|
||||
parts = re.split(r"(?i)(" + query + ")", target.replace("\n", ""))
|
||||
for part in parts:
|
||||
itr = buffer.get_end_iter()
|
||||
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
"root": "./src/versions/solarfm-0.0.1/solarfm"
|
||||
}
|
||||
],
|
||||
"venvPath": ".",
|
||||
"venv": ".venv"
|
||||
"venvPath": "/home/abaddon/Portable_Apps/py-venvs/pylsp-venv/",
|
||||
"venv": "venv"
|
||||
}
|
||||
|
|
|
@ -110,26 +110,30 @@ class HandlerMixin:
|
|||
tab.move_file(fPath, tPath)
|
||||
else:
|
||||
io_widget = IOWidget(action, file)
|
||||
io_list = self._builder.get_object("io_list")
|
||||
|
||||
io_list.add(io_widget)
|
||||
io_list.show_all()
|
||||
|
||||
if action == "copy":
|
||||
file.copy_async(destination=target,
|
||||
flags=Gio.FileCopyFlags.BACKUP,
|
||||
io_priority=98,
|
||||
io_priority=45,
|
||||
cancellable=io_widget.cancle_eve,
|
||||
progress_callback=io_widget.update_progress,
|
||||
callback=io_widget.finish_callback)
|
||||
|
||||
self._builder.get_object("io_list").add(io_widget)
|
||||
if action == "move" or action == "rename":
|
||||
file.move_async(destination=target,
|
||||
flags=Gio.FileCopyFlags.BACKUP,
|
||||
io_priority=98,
|
||||
io_priority=45,
|
||||
cancellable=io_widget.cancle_eve,
|
||||
progress_callback=None,
|
||||
# NOTE: progress_callback here causes seg fault when set
|
||||
progress_callback=None,
|
||||
callback=io_widget.finish_callback)
|
||||
|
||||
self._builder.get_object("io_list").add(io_widget)
|
||||
io_widget = None
|
||||
io_list = None
|
||||
|
||||
except GObject.GError as e:
|
||||
raise OSError(e)
|
||||
|
|
|
@ -56,8 +56,9 @@ class GridMixin:
|
|||
|
||||
def update_store(self, i, store, icon):
|
||||
itr = store.get_iter(i)
|
||||
GLib.idle_add(self.insert_store, store, itr, icon)
|
||||
GLib.idle_add(self.insert_store, store, itr, icon.copy())
|
||||
itr = None
|
||||
del icon
|
||||
|
||||
@daemon_threaded
|
||||
def make_and_load_icon(self, i, store, tab, dir, file):
|
||||
|
|
|
@ -264,15 +264,16 @@ class TabMixin(GridMixin):
|
|||
path_menu_buttons.add(button)
|
||||
show_path_menu = True
|
||||
|
||||
path_menu_buttons = None
|
||||
query = None
|
||||
files = None
|
||||
query = None
|
||||
files = None
|
||||
|
||||
if not show_path_menu:
|
||||
path_menu_buttons = None
|
||||
event_system.emit("hide_path_menu")
|
||||
else:
|
||||
event_system.emit("show_path_menu")
|
||||
buttons = path_menu_buttons.get_children()
|
||||
path_menu_buttons = None
|
||||
|
||||
if len(buttons) == 1:
|
||||
self.slowed_focus(buttons[0])
|
||||
|
|
|
@ -130,6 +130,10 @@ class WindowMixin(TabMixin):
|
|||
self.update_tab(tab_label, state.tab, state.icon_grid.get_store(), state.wid, state.tid)
|
||||
else:
|
||||
event_system.emit("open_files")
|
||||
|
||||
state = None
|
||||
notebook = None
|
||||
tab_label = None
|
||||
except WindowException as e:
|
||||
traceback.print_exc()
|
||||
self.display_message(settings.theming.error_color, f"{repr(e)}")
|
||||
|
|
|
@ -65,19 +65,20 @@ class IOWidget(Gtk.Box):
|
|||
logger.info(f"Canceling: [{self._action}] of {self._basename} ...")
|
||||
eve.cancel()
|
||||
|
||||
def update_progress(self, current, total, eve=None):
|
||||
def update_progress(self, current, total, eve = None):
|
||||
self.progress.set_fraction(current/total)
|
||||
|
||||
def finish_callback(self, file, task=None, eve=None):
|
||||
def finish_callback(self, file, task = None, eve = None):
|
||||
if task.had_error():
|
||||
logger.info(f"{self._action} of {self._basename} cancelled/failed...")
|
||||
return
|
||||
|
||||
if self._action == "move" or self._action == "rename":
|
||||
status = self._file.move_finish(task)
|
||||
if self._action == "copy":
|
||||
status = self._file.copy_finish(task)
|
||||
|
||||
if status:
|
||||
self.delete_self()
|
||||
else:
|
||||
logger.info(f"{self._action} of {self._basename} failed...")
|
||||
self.delete_self()
|
||||
|
||||
def delete_self(self, widget=None, eve=None):
|
||||
def delete_self(self, widget = None, eve = None):
|
||||
self.get_parent().remove(self)
|
|
@ -29,16 +29,16 @@ class PathMenuPopupWidget(Gtk.Popover):
|
|||
self.set_relative_to(path_entry)
|
||||
self.set_modal(False)
|
||||
self.set_position(Gtk.PositionType.BOTTOM)
|
||||
self.set_size_request(240, 420)
|
||||
self.set_size_request(480, 420)
|
||||
|
||||
def _setup_signals(self):
|
||||
event_system.subscribe("show_path_menu", self.show_path_menu)
|
||||
event_system.subscribe("hide_path_menu", self.hide_path_menu)
|
||||
|
||||
def _load_widgets(self):
|
||||
path_menu_buttons = Gtk.ButtonBox()
|
||||
scroll_window = Gtk.ScrolledWindow()
|
||||
view_port = Gtk.Viewport()
|
||||
scroll_window = Gtk.ScrolledWindow()
|
||||
view_port = Gtk.Viewport()
|
||||
path_menu_buttons = Gtk.Box()
|
||||
|
||||
scroll_window.set_vexpand(True)
|
||||
scroll_window.set_hexpand(True)
|
||||
|
@ -47,12 +47,13 @@ class PathMenuPopupWidget(Gtk.Popover):
|
|||
self.builder.expose_object(f"path_menu_buttons", path_menu_buttons)
|
||||
view_port.add(path_menu_buttons)
|
||||
scroll_window.add(view_port)
|
||||
scroll_window.show_all()
|
||||
self.add(scroll_window)
|
||||
|
||||
scroll_window.show_all()
|
||||
|
||||
def show_path_menu(self, widget=None, eve=None):
|
||||
|
||||
def show_path_menu(self, widget = None, eve = None):
|
||||
self.popup()
|
||||
|
||||
def hide_path_menu(self, widget=None, eve=None):
|
||||
def hide_path_menu(self, widget = None, eve = None):
|
||||
self.popdown()
|
|
@ -23,6 +23,7 @@ function main() {
|
|||
export G_SLICE=always-malloc
|
||||
export G_DEBUG=gc-friendly
|
||||
export GOBJECT_DEBUG=instance-count
|
||||
python /opt/solarfm.zip "${files[@]}"
|
||||
export GSK_RENDERER=cairo
|
||||
python /opt/solarfm.zip "$@"
|
||||
}
|
||||
main "$@";
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# . CONFIG.sh
|
||||
|
||||
# set -o xtrace ## To debug scripts
|
||||
# set -o errexit ## To exit on error
|
||||
# set -o errunset ## To exit if a variable is referenced but not set
|
||||
|
||||
|
||||
function main() {
|
||||
call_path=`pwd`
|
||||
cd "${call_path}"
|
||||
echo "Working Dir: " $(pwd)
|
||||
|
||||
python /opt/solarfm.zip "$@"
|
||||
}
|
||||
main "$@";
|
Loading…
Reference in New Issue