diff --git a/README.md b/README.md index bb1b1ce..d95b54d 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,6 @@ sudo apt-get install python3.8 wget python3-setproctitle python3-gi ffmpegthumbn # TODO # Images diff --git a/bin/solarfm-0-0-1-x64.deb b/bin/solarfm-0-0-1-x64.deb new file mode 100644 index 0000000..744a9c4 Binary files /dev/null and b/bin/solarfm-0-0-1-x64.deb differ diff --git a/src/debs/clear_pycache_dirs.sh b/src/debs/clear_pycache_dirs.sh old mode 100755 new mode 100644 diff --git a/src/debs/solarfm-0-0-1-x64/bin/solarfm b/src/debs/solarfm-0-0-1-x64/bin/solarfm old mode 100755 new mode 100644 diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/__builtins__.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/__builtins__.py index 19540d8..3ac749f 100644 --- a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/__builtins__.py +++ b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/__builtins__.py @@ -4,12 +4,12 @@ import builtins # Lib imports # Application imports -from signal_classes.DBusControllerMixin import DBusControllerMixin +from signal_classes import IPCServerMixin -class Builtins(DBusControllerMixin): +class Builtins(IPCServerMixin): """Docstring for __builtins__ extender""" def __init__(self): @@ -18,6 +18,11 @@ class Builtins(DBusControllerMixin): self._gui_events = [] self._fm_events = [] self.is_ipc_alive = False + self.ipc_authkey = b'solarfm-ipc' + self.ipc_address = '127.0.0.1' + self.ipc_port = 4848 + self.ipc_timeout = 15.0 + # Makeshift fake "events" type system FIFO def _pop_gui_event(self): @@ -61,6 +66,8 @@ class Builtins(DBusControllerMixin): # NOTE: Just reminding myself we can add to builtins two different ways... # __builtins__.update({"event_system": Builtins()}) +builtins.app_name = "SolarFM" builtins.event_system = Builtins() -builtins.event_sleep_time = 0.5 +builtins.event_sleep_time = 0.2 builtins.debug = False +builtins.trace_debug = False diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/__init__.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/__init__.py index ddaa127..a3de649 100644 --- a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/__init__.py +++ b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/__init__.py @@ -13,24 +13,27 @@ from __builtins__ import Builtins class Main(Builtins): def __init__(self, args, unknownargs): - event_system.create_ipc_server() - time.sleep(0.5) - if not event_system.is_ipc_alive: - if unknownargs: - for arg in unknownargs: - if os.path.isdir(arg): - message = f"FILE|{arg}" - event_system.send_ipc_message(message) + if not debug: + event_system.create_ipc_server() - if args.new_tab and os.path.isdir(args.new_tab): - message = f"FILE|{args.new_tab}" - event_system.send_ipc_message(message) + time.sleep(0.2) + if not trace_debug: + if not event_system.is_ipc_alive: + if unknownargs: + for arg in unknownargs: + if os.path.isdir(arg): + message = f"FILE|{arg}" + event_system.send_ipc_message(message) - raise Exception("IPC Server Exists: Will send path(s) to it and close...") + if args.new_tab and os.path.isdir(args.new_tab): + message = f"FILE|{args.new_tab}" + event_system.send_ipc_message(message) + + raise Exception("IPC Server Exists: Will send path(s) to it and close...") settings = Settings() - settings.createWindow() + settings.create_window() controller = Controller(args, unknownargs, settings) if not controller: diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/__main__.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/__main__.py index 3105637..66870d2 100644 --- a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/__main__.py +++ b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/__main__.py @@ -23,7 +23,7 @@ if __name__ == "__main__": # import web_pdb # web_pdb.set_trace() - setproctitle('solarfm') + setproctitle('SolarFM') faulthandler.enable() # For better debug info parser = argparse.ArgumentParser() # Add long and short arguments diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/shellfm/windows/WindowController.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/shellfm/windows/WindowController.py index e8f75ad..7f068e7 100644 --- a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/shellfm/windows/WindowController.py +++ b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/shellfm/windows/WindowController.py @@ -24,7 +24,9 @@ class WindowController: self.active_window_id = "" self.active_tab_id = "" self.windows = [] - self.fm_event_observer() + + if not trace_debug: + self.fm_event_observer() @threaded def fm_event_observer(self): diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/shellfm/windows/view/Path.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/shellfm/windows/view/Path.py index 7c4cdc2..ecce282 100644 --- a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/shellfm/windows/view/Path.py +++ b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/shellfm/windows/view/Path.py @@ -11,7 +11,7 @@ class Path: return os.path.expanduser("~") + self.subpath def get_path(self): - return "/" + "/".join(self.path) + return f"/{'/'.join(self.path)}" if self.path else f"/{''.join(self.path)}" def get_path_list(self): return self.path @@ -21,7 +21,7 @@ class Path: self.load_directory() def pop_from_path(self): - if len(self.path) > 1: + try: self.path.pop() if not self.go_past_home: @@ -29,6 +29,8 @@ class Path: self.set_to_home() self.load_directory() + except Exception as e: + pass def set_path(self, path): if path == self.get_path(): diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/shellfm/windows/view/View.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/shellfm/windows/view/View.py index 9a0485b..594dee1 100644 --- a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/shellfm/windows/view/View.py +++ b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/shellfm/windows/view/View.py @@ -199,7 +199,7 @@ class View(Settings, FileHandler, Launcher, Icon, Path): def get_current_sub_path(self): path = self.get_path() - home = self.get_home() + "/" + home = f"{self.get_home()}/" return path.replace(home, "") def get_end_of_path(self): diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/shellfm/windows/view/icons/Icon.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/shellfm/windows/view/icons/Icon.py index f551ee6..3c14d2f 100644 --- a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/shellfm/windows/view/icons/Icon.py +++ b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/shellfm/windows/view/icons/Icon.py @@ -17,7 +17,7 @@ def threaded(fn): class Icon(DesktopIconMixin, VideoIconMixin): def create_icon(self, dir, file): - full_path = dir + "/" + file + full_path = f"{dir}/{file}" return self.get_icon_image(dir, file, full_path) def get_icon_image(self, dir, file, full_path): @@ -36,29 +36,32 @@ class Icon(DesktopIconMixin, VideoIconMixin): return None def create_thumbnail(self, dir, file): - full_path = dir + "/" + file + full_path = f"{dir}/{file}" try: file_hash = hashlib.sha256(str.encode(full_path)).hexdigest() - hash_img_pth = self.ABS_THUMBS_PTH + "/" + file_hash + ".jpg" + hash_img_pth = f"{self.ABS_THUMBS_PTH}/{file_hash}.jpg" if isfile(hash_img_pth) == False: self.generate_video_thumbnail(full_path, hash_img_pth) thumbnl = self.create_scaled_image(hash_img_pth, self.VIDEO_ICON_WH) if thumbnl == None: # If no icon whatsoever, return internal default - thumbnl = GdkPixbuf.Pixbuf.new_from_file(self.DEFAULT_ICONS + "/video.png") + thumbnl = GdkPixbuf.Pixbuf.new_from_file(f"{self.DEFAULT_ICONS}/video.png") return thumbnl except Exception as e: print("Thumbnail generation issue:") print( repr(e) ) - return GdkPixbuf.Pixbuf.new_from_file(self.DEFAULT_ICONS + "/video.png") + return GdkPixbuf.Pixbuf.new_from_file(f"{self.DEFAULT_ICONS}/video.png") def create_scaled_image(self, path, wxh): try: - pixbuf = GdkPixbuf.Pixbuf.new_from_file(path) - scaled_pixbuf = pixbuf.scale_simple(wxh[0], wxh[1], 2) # 2 = BILINEAR and is best by default - return scaled_pixbuf + if path.lower().endswith(".gif"): + return GdkPixbuf.PixbufAnimation.new_from_file(path) \ + .get_static_image() \ + .scale_simple(wxh[0], wxh[1], GdkPixbuf.InterpType.BILINEAR) + else: + return GdkPixbuf.Pixbuf.new_from_file_at_scale(path, wxh[0], wxh[1], True) except Exception as e: print("Image Scaling Issue:") print( repr(e) ) diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/shellfm/windows/view/utils/Settings.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/shellfm/windows/view/utils/Settings.py index d1229c2..e4d9323 100644 --- a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/shellfm/windows/view/utils/Settings.py +++ b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/shellfm/windows/view/utils/Settings.py @@ -59,7 +59,7 @@ class Settings: subpath = settings["base_of_home"] HIDE_HIDDEN_FILES = True if settings["hide_hidden_files"] == "true" else False FFMPG_THUMBNLR = FFMPG_THUMBNLR if settings["thumbnailer_path"] == "" else settings["thumbnailer_path"] - go_past_home = True if settings["go_past_home"] == "true" else False + go_past_home = True if settings["go_past_home"] == "" else settings["go_past_home"] lock_folder = True if settings["lock_folder"] == "true" else False locked_folders = settings["locked_folders"].split("::::") mplayer_options = settings["mplayer_options"].split() diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/Controller.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/Controller.py index 5354c5e..5673203 100644 --- a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/Controller.py +++ b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/Controller.py @@ -1,5 +1,5 @@ # Python imports -import sys, traceback, threading, signal, inspect, os, time +import sys, traceback, threading, inspect, os, time # Lib imports import gi @@ -7,8 +7,9 @@ gi.require_version('Gtk', '3.0') from gi.repository import Gtk, GLib # Application imports -from .mixins import * -from . import ShowHideMixin, KeyboardSignalsMixin, Controller_Data +from .mixins.ui import * +from .mixins import ShowHideMixin, KeyboardSignalsMixin +from . import Controller_Data def threaded(fn): @@ -23,25 +24,23 @@ class Controller(WidgetFileActionMixin, PaneMixin, WindowMixin, ShowHideMixin, \ KeyboardSignalsMixin, Controller_Data): def __init__(self, args, unknownargs, _settings): # sys.excepthook = self.custom_except_hook - self.settings = _settings - self.setup_controller_data() - + self.setup_controller_data(_settings) self.window.show() self.generate_windows(self.state) + self.plugins.launch_plugins() - self.window.connect("delete-event", self.tear_down) - GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT, self.tear_down) - self.gui_event_observer() + if not trace_debug: + self.gui_event_observer() - if unknownargs: - for arg in unknownargs: - if os.path.isdir(arg): - message = f"FILE|{arg}" - event_system.send_ipc_message(message) + if unknownargs: + for arg in unknownargs: + if os.path.isdir(arg): + message = f"FILE|{arg}" + event_system.send_ipc_message(message) - if args.new_tab and os.path.isdir(args.new_tab): - message = f"FILE|{args.new_tab}" - event_system.send_ipc_message(message) + if args.new_tab and os.path.isdir(args.new_tab): + message = f"FILE|{args.new_tab}" + event_system.send_ipc_message(message) def tear_down(self, widget=None, eve=None): diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/Controller_Data.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/Controller_Data.py index ccace6d..95d8008 100644 --- a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/Controller_Data.py +++ b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/Controller_Data.py @@ -1,4 +1,5 @@ # Python imports +import signal # Lib imports from gi.repository import GLib @@ -6,6 +7,7 @@ from gi.repository import GLib # Application imports from shellfm import WindowController from trasher.xdgtrash import XDGTrash +from . import Plugins @@ -14,16 +16,18 @@ class Controller_Data: def has_method(self, o, name): return callable(getattr(o, name, None)) - def setup_controller_data(self): - self.window_controller = WindowController() + def setup_controller_data(self, _settings): self.trashman = XDGTrash() + self.window_controller = WindowController() + self.plugins = Plugins(_settings) + self.state = self.window_controller.load_state() self.trashman.regenerate() - self.state = self.window_controller.load_state() - self.builder = self.settings.builder - self.logger = self.settings.logger + self.settings = _settings + self.builder = self.settings.get_builder() + self.logger = self.settings.get_logger() - self.window = self.settings.getMainWindow() + self.window = self.settings.get_main_window() self.window1 = self.builder.get_object("window_1") self.window2 = self.builder.get_object("window_2") self.window3 = self.builder.get_object("window_3") @@ -85,10 +89,10 @@ class Controller_Data: self.is_pane3_hidden = False self.is_pane4_hidden = False - self.is_searching = False - self.search_iconview = None - self.search_view = None - + self.override_drop_dest = None + self.is_searching = False + self.search_iconview = None + self.search_view = None self.skip_edit = False self.cancel_edit = False @@ -99,3 +103,7 @@ class Controller_Data: self.success = "#88cc27" self.warning = "#ffa800" self.error = "#ff0000" + + + self.window.connect("delete-event", self.tear_down) + GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT, self.tear_down) diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/DBusControllerMixin.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/IPCServerMixin.py similarity index 85% rename from src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/DBusControllerMixin.py rename to src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/IPCServerMixin.py index c8f622f..be92ace 100644 --- a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/DBusControllerMixin.py +++ b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/IPCServerMixin.py @@ -15,11 +15,11 @@ def threaded(fn): -class DBusControllerMixin: +class IPCServerMixin: @threaded def create_ipc_server(self): - listener = Listener(('127.0.0.1', 4848), authkey=b'solarfm-ipc') + listener = Listener((self.ipc_address, self.ipc_port), authkey=self.ipc_authkey) self.is_ipc_alive = True while True: conn = listener.accept() @@ -49,7 +49,7 @@ class DBusControllerMixin: # NOTE: Not perfect but insures we don't lockup the connection for too long. end_time = time.time() - if (end - start) > 15.0: + if (end - start) > self.ipc_timeout: conn.close() listener.close() @@ -57,7 +57,7 @@ class DBusControllerMixin: def send_ipc_message(self, message="Empty Data..."): try: - conn = Client(('127.0.0.1', 4848), authkey=b'solarfm-ipc') + conn = Client((self.ipc_address, self.ipc_port), authkey=self.ipc_authkey) conn.send(message) conn.send('close connection') except Exception as e: diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/Plugins.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/Plugins.py new file mode 100644 index 0000000..8715aac --- /dev/null +++ b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/Plugins.py @@ -0,0 +1,41 @@ +# Python imports +import importlib + +# Lib imports +import gi +gi.require_version('Gtk', '3.0') +from gi.repository import Gtk, Gio + +# Application imports + + + + +class Plugins: + """docstring for Plugins""" + def __init__(self, settings): + self._settings = settings + self._plugins_path = self._settings.get_plugins_path() + self._plugins_dir_watcher = None + self._socket = Gtk.Socket().new() + + def launch_plugins(self): + self._set_plugins_watcher() + self.load_plugins() + + def _set_plugins_watcher(self): + self._plugins_dir_watcher = Gio.File.new_for_path(self._plugins_path) \ + .monitor_directory(Gio.FileMonitorFlags.WATCH_MOVES, Gio.Cancellable()) + self._plugins_dir_watcher.connect("changed", self._on_plugins_changed, ()) + + def _on_plugins_changed(self, file_monitor, file, other_file=None, eve_type=None, data=None): + if eve_type in [Gio.FileMonitorEvent.CREATED, Gio.FileMonitorEvent.DELETED, + Gio.FileMonitorEvent.RENAMED, Gio.FileMonitorEvent.MOVED_IN, + Gio.FileMonitorEvent.MOVED_OUT]: + self.load_plugins(file) + + def load_plugins(self, file=None): + print(f"(Re)loading plugins...") + print(locals()) + + # importlib.reload(stl_utils) diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/__init__.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/__init__.py index f34b90c..314f976 100644 --- a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/__init__.py +++ b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/__init__.py @@ -2,8 +2,7 @@ Gtk Bound Signal Module """ from .mixins import * -from .DBusControllerMixin import DBusControllerMixin -from .KeyboardSignalsMixin import KeyboardSignalsMixin -from .ShowHideMixin import ShowHideMixin +from .IPCServerMixin import IPCServerMixin +from .Plugins import Plugins from .Controller_Data import Controller_Data from .Controller import Controller diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/KeyboardSignalsMixin.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/KeyboardSignalsMixin.py similarity index 100% rename from src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/KeyboardSignalsMixin.py rename to src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/KeyboardSignalsMixin.py diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/ShowHideMixin.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/ShowHideMixin.py similarity index 100% rename from src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/ShowHideMixin.py rename to src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/ShowHideMixin.py diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/__init__.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/__init__.py index cd23f8d..e457cb5 100644 --- a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/__init__.py +++ b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/__init__.py @@ -1,5 +1,2 @@ -from .PaneMixin import PaneMixin -from .WidgetMixin import WidgetMixin -from .TabMixin import TabMixin -from .WindowMixin import WindowMixin -from .WidgetFileActionMixin import WidgetFileActionMixin +from .KeyboardSignalsMixin import KeyboardSignalsMixin +from .ShowHideMixin import ShowHideMixin diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/PaneMixin.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/ui/PaneMixin.py similarity index 100% rename from src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/PaneMixin.py rename to src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/ui/PaneMixin.py diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/TabMixin.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/ui/TabMixin.py similarity index 100% rename from src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/TabMixin.py rename to src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/ui/TabMixin.py diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/WidgetFileActionMixin.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/ui/WidgetFileActionMixin.py similarity index 99% rename from src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/WidgetFileActionMixin.py rename to src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/ui/WidgetFileActionMixin.py index 96f503d..06ba422 100644 --- a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/WidgetFileActionMixin.py +++ b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/ui/WidgetFileActionMixin.py @@ -107,7 +107,7 @@ class WidgetFileActionMixin: def open_with_files(self, appchooser_widget): wid, tid, view, iconview, store = self.get_current_state() app_info = appchooser_widget.get_app_info() - uris = self.format_to_uris(store, wid, tid, self.selected_files, True) + uris = self.format_to_uris(store, wid, tid, self.selected_files) view.app_chooser_exec(app_info, uris) diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WidgetMixin.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/ui/WidgetMixin.py similarity index 89% rename from src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WidgetMixin.py rename to src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/ui/WidgetMixin.py index 52b9a0d..349cba7 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WidgetMixin.py +++ b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/ui/WidgetMixin.py @@ -1,5 +1,5 @@ # Python imports -import os, threading, subprocess +import os, threading, subprocess, time # Lib imports import gi @@ -20,15 +20,13 @@ def threaded(fn): class WidgetMixin: - def load_store(self, view, store, save_state=False): store.clear() dir = view.get_current_directory() files = view.get_files() - icon = GdkPixbuf.Pixbuf.new_from_file(view.DEFAULT_ICON) for i, file in enumerate(files): - store.append([icon, file[0]]) + store.append([None, file[0]]) self.create_icon(i, view, store, dir, file[0]) # NOTE: Not likely called often from here but it could be useful @@ -50,10 +48,14 @@ class WidgetMixin: try: itr = store.get_iter(i) except Exception as e: - print(":Invalid Itr detected: (Potential race condition...)") - print(f"Index Requested: {i}") - print(f"Store Size: {len(store)}") - return + try: + time.sleep(0.2) + itr = store.get_iter(i) + except Exception as e: + print(":Invalid Itr detected: (Potential race condition...)") + print(f"Index Requested: {i}") + print(f"Store Size: {len(store)}") + return if not icon: icon = self.get_system_thumbnail(fpath, view.SYS_ICON_WH[0]) @@ -113,7 +115,7 @@ class WidgetMixin: def create_grid_iconview_widget(self, view, wid): scroll = Gtk.ScrolledWindow() grid = Gtk.IconView() - store = Gtk.ListStore(GdkPixbuf.Pixbuf, str) + store = Gtk.ListStore(GdkPixbuf.Pixbuf or GdkPixbuf.PixbufAnimation or None, str) grid.set_model(store) grid.set_pixbuf_column(0) @@ -131,11 +133,14 @@ class WidgetMixin: grid.connect("button_release_event", self.grid_icon_single_click) grid.connect("item-activated", self.grid_icon_double_click) + # grid.connect("toggle-cursor-item", self.grid_cursor_toggled) + # grid.connect("notify", self.grid_cursor_toggled) grid.connect("selection-changed", self.grid_set_selected_items) grid.connect("drag-data-get", self.grid_on_drag_set) grid.connect("drag-data-received", self.grid_on_drag_data_received) grid.connect("drag-motion", self.grid_on_drag_motion) + URI_TARGET_TYPE = 80 uri_target = Gtk.TargetEntry.new('text/uri-list', Gtk.TargetFlags(0), URI_TARGET_TYPE) targets = [ uri_target ] @@ -154,8 +159,8 @@ class WidgetMixin: def create_grid_treeview_widget(self, view, wid): scroll = Gtk.ScrolledWindow() grid = Gtk.TreeView() - store = Gtk.ListStore(GdkPixbuf.Pixbuf, str) - # store = Gtk.TreeStore(GdkPixbuf.Pixbuf, str) + store = Gtk.ListStore(GdkPixbuf.Pixbuf or GdkPixbuf.PixbufAnimation or None, str) + # store = Gtk.TreeStore(GdkPixbuf.Pixbuf or None, str) column = Gtk.TreeViewColumn("Icons") icon = Gtk.CellRendererPixbuf() name = Gtk.CellRendererText() diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WindowMixin.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/ui/WindowMixin.py similarity index 86% rename from src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WindowMixin.py rename to src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/ui/WindowMixin.py index aa8687f..17e4be3 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WindowMixin.py +++ b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/ui/WindowMixin.py @@ -82,7 +82,7 @@ class WindowMixin(TabMixin): _wid, _tid, _view, iconview, store = self.get_current_state() selected_files = iconview.get_selected_items() current_directory = view.get_current_directory() - path_file = Gio.File.new_for_path( current_directory) + path_file = Gio.File.new_for_path(current_directory) mount_file = path_file.query_filesystem_info(attributes="filesystem::*", cancellable=None) formatted_mount_free = self.sizeof_fmt( int(mount_file.get_attribute_as_string("filesystem::free")) ) formatted_mount_size = self.sizeof_fmt( int(mount_file.get_attribute_as_string("filesystem::size")) ) @@ -101,11 +101,16 @@ class WindowMixin(TabMixin): uris = self.format_to_uris(store, _wid, _tid, selected_files, True) combined_size = 0 for uri in uris: - file_info = Gio.File.new_for_path(uri).query_info(attributes="standard::size", - flags=Gio.FileQueryInfoFlags.NONE, - cancellable=None) - file_size = file_info.get_size() - combined_size += file_size + try: + file_info = Gio.File.new_for_path(uri).query_info(attributes="standard::size", + flags=Gio.FileQueryInfoFlags.NONE, + cancellable=None) + file_size = file_info.get_size() + combined_size += file_size + except Exception as e: + if debug: + print(repr(e)) + formatted_size = self.sizeof_fmt(combined_size) if view.hide_hidden: @@ -152,6 +157,9 @@ class WindowMixin(TabMixin): def grid_set_selected_items(self, iconview): self.selected_files = iconview.get_selected_items() + def grid_cursor_toggled(self, iconview): + print("wat...") + def grid_icon_single_click(self, iconview, eve): try: self.path_menu.popdown() @@ -213,8 +221,19 @@ class WindowMixin(TabMixin): data.set_text(uris_text, -1) def grid_on_drag_motion(self, iconview, drag_context, x, y, data): - wid, tid = iconview.get_name().split("|") - self.window_controller.set_active_data(wid, tid) + current = '|'.join(self.window_controller.get_active_data()) + target = iconview.get_name() + wid, tid = target.split("|") + store = iconview.get_model() + treePath = iconview.get_drag_dest_item().path + + if treePath: + uri = self.format_to_uris(store, wid, tid, treePath)[0].replace("file://", "") + self.override_drop_dest = uri if isdir(uri) else None + + if target not in current: + self.window_controller.set_active_data(wid, tid) + def grid_on_drag_data_received(self, widget, drag_context, x, y, data, info, time): if info == 80: @@ -224,12 +243,14 @@ class WindowMixin(TabMixin): view = self.get_fm_window(wid).get_view_by_id(tid) uris = data.get_uris() - dest = f"{view.get_current_directory()}" - if len(uris) > 0: - self.move_files(uris, dest) - else: + dest = f"{view.get_current_directory()}" if not self.override_drop_dest else self.override_drop_dest + if len(uris) == 0: uris = data.get_text().split("\n") + + from_uri = '/'.join(uris[0].replace("file://", "").split("/")[:-1]) + if from_uri != dest: self.move_files(uris, dest) + def create_new_view_notebook(self, widget=None, wid=None, path=None): self.create_tab(wid, path) diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/ui/__init__.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/ui/__init__.py new file mode 100644 index 0000000..cd23f8d --- /dev/null +++ b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/ui/__init__.py @@ -0,0 +1,5 @@ +from .PaneMixin import PaneMixin +from .WidgetMixin import WidgetMixin +from .TabMixin import TabMixin +from .WindowMixin import WindowMixin +from .WidgetFileActionMixin import WidgetFileActionMixin diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/trasher/__init__.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/trasher/__init__.py old mode 100755 new mode 100644 diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/trasher/trash.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/trasher/trash.py old mode 100755 new mode 100644 diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/trasher/xdgtrash.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/trasher/xdgtrash.py old mode 100755 new mode 100644 diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/utils/Logger.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/utils/Logger.py index c7f294e..06eed47 100644 --- a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/utils/Logger.py +++ b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/utils/Logger.py @@ -5,8 +5,8 @@ import os, logging class Logger: - def __init__(self): - pass + def __init__(self, config_path): + self._CONFIG_PATH = config_path def get_logger(self, loggerName = "NO_LOGGER_NAME_PASSED", createFile = True): """ @@ -42,8 +42,8 @@ class Logger: log.addHandler(ch) if createFile: - folder = "logs" - file = folder + "/application.log" + folder = self._CONFIG_PATH + file = f"{folder}/application.log" if not os.path.exists(folder): os.mkdir(folder) diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/utils/Settings.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/utils/Settings.py index 3dc368f..380210a 100644 --- a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/utils/Settings.py +++ b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/utils/Settings.py @@ -17,39 +17,45 @@ from . import Logger class Settings: def __init__(self): - self.logger = Logger().get_logger() self.builder = gtk.Builder() self.SCRIPT_PTH = os.path.dirname(os.path.realpath(__file__)) self.USER_HOME = path.expanduser('~') - self.CONFIG_PATH = f"{self.USER_HOME}/.config/solarfm" - self.USR_SOLARFM = "/usr/share/solarfm" + self.CONFIG_PATH = f"{self.USER_HOME}/.config/{app_name.lower()}" + self.PLUGINS_PATH = f"{self.CONFIG_PATH}/plugins" + self.USR_SOLARFM = f"/usr/share/{app_name.lower()}" self.cssFile = f"{self.CONFIG_PATH}/stylesheet.css" self.windows_glade = f"{self.CONFIG_PATH}/Main_Window.glade" self.DEFAULT_ICONS = f"{self.CONFIG_PATH}/icons" - self.window_icon = f"{self.DEFAULT_ICONS}/solarfm.png" + self.window_icon = f"{self.DEFAULT_ICONS}/{app_name.lower()}.png" self.main_window = None + if not os.path.exists(self.CONFIG_PATH): + os.mkdir(self.CONFIG_PATH) + if not os.path.exists(self.PLUGINS_PATH): + os.mkdir(self.PLUGINS_PATH) + if not os.path.exists(self.windows_glade): self.windows_glade = f"{self.USR_SOLARFM}/Main_Window.glade" if not os.path.exists(self.cssFile): self.cssFile = f"{self.USR_SOLARFM}/stylesheet.css" if not os.path.exists(self.window_icon): - self.window_icon = f"{self.USR_SOLARFM}/icons/solarfm.png" + self.window_icon = f"{self.USR_SOLARFM}/icons/{app_name.lower()}.png" if not os.path.exists(self.DEFAULT_ICONS): self.DEFAULT_ICONS = f"{self.USR_SOLARFM}/icons" + self.logger = Logger(self.CONFIG_PATH).get_logger() self.builder.add_from_file(self.windows_glade) - def createWindow(self): + def create_window(self): # Get window and connect signals self.main_window = self.builder.get_object("Main_Window") - self.setWindowData() + self._set_window_data() - def setWindowData(self): + def _set_window_data(self): self.main_window.set_icon_from_file(self.window_icon) screen = self.main_window.get_screen() visual = screen.get_rgba_visual() @@ -57,7 +63,7 @@ class Settings: if visual != None and screen.is_composited(): self.main_window.set_visual(visual) self.main_window.set_app_paintable(True) - self.main_window.connect("draw", self.area_draw) + self.main_window.connect("draw", self._area_draw) # bind css file cssProvider = gtk.CssProvider() @@ -66,16 +72,13 @@ class Settings: styleContext = gtk.StyleContext() styleContext.add_provider_for_screen(screen, cssProvider, gtk.STYLE_PROVIDER_PRIORITY_USER) - def area_draw(self, widget, cr): + def _area_draw(self, widget, cr): cr.set_source_rgba(0, 0, 0, 0.54) cr.set_operator(cairo.OPERATOR_SOURCE) cr.paint() cr.set_operator(cairo.OPERATOR_OVER) - def getMainWindow(self): return self.main_window - - - def getMonitorData(self): + def get_monitor_data(self): screen = self.builder.get_object("Main_Window").get_screen() monitors = [] for m in range(screen.get_n_monitors()): @@ -85,3 +88,8 @@ class Settings: print("{}x{}+{}+{}".format(monitor.width, monitor.height, monitor.x, monitor.y)) return monitors + + def get_builder(self): return self.builder + def get_logger(self): return self.logger + def get_main_window(self): return self.main_window + def get_plugins_path(self): return self.PLUGINS_PATH diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/__builtins__.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/__builtins__.py index 19540d8..3ac749f 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/__builtins__.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/__builtins__.py @@ -4,12 +4,12 @@ import builtins # Lib imports # Application imports -from signal_classes.DBusControllerMixin import DBusControllerMixin +from signal_classes import IPCServerMixin -class Builtins(DBusControllerMixin): +class Builtins(IPCServerMixin): """Docstring for __builtins__ extender""" def __init__(self): @@ -18,6 +18,11 @@ class Builtins(DBusControllerMixin): self._gui_events = [] self._fm_events = [] self.is_ipc_alive = False + self.ipc_authkey = b'solarfm-ipc' + self.ipc_address = '127.0.0.1' + self.ipc_port = 4848 + self.ipc_timeout = 15.0 + # Makeshift fake "events" type system FIFO def _pop_gui_event(self): @@ -61,6 +66,8 @@ class Builtins(DBusControllerMixin): # NOTE: Just reminding myself we can add to builtins two different ways... # __builtins__.update({"event_system": Builtins()}) +builtins.app_name = "SolarFM" builtins.event_system = Builtins() -builtins.event_sleep_time = 0.5 +builtins.event_sleep_time = 0.2 builtins.debug = False +builtins.trace_debug = False diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/__init__.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/__init__.py index ddaa127..a3de649 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/__init__.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/__init__.py @@ -13,24 +13,27 @@ from __builtins__ import Builtins class Main(Builtins): def __init__(self, args, unknownargs): - event_system.create_ipc_server() - time.sleep(0.5) - if not event_system.is_ipc_alive: - if unknownargs: - for arg in unknownargs: - if os.path.isdir(arg): - message = f"FILE|{arg}" - event_system.send_ipc_message(message) + if not debug: + event_system.create_ipc_server() - if args.new_tab and os.path.isdir(args.new_tab): - message = f"FILE|{args.new_tab}" - event_system.send_ipc_message(message) + time.sleep(0.2) + if not trace_debug: + if not event_system.is_ipc_alive: + if unknownargs: + for arg in unknownargs: + if os.path.isdir(arg): + message = f"FILE|{arg}" + event_system.send_ipc_message(message) - raise Exception("IPC Server Exists: Will send path(s) to it and close...") + if args.new_tab and os.path.isdir(args.new_tab): + message = f"FILE|{args.new_tab}" + event_system.send_ipc_message(message) + + raise Exception("IPC Server Exists: Will send path(s) to it and close...") settings = Settings() - settings.createWindow() + settings.create_window() controller = Controller(args, unknownargs, settings) if not controller: diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/__main__.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/__main__.py index 3105637..66870d2 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/__main__.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/__main__.py @@ -23,7 +23,7 @@ if __name__ == "__main__": # import web_pdb # web_pdb.set_trace() - setproctitle('solarfm') + setproctitle('SolarFM') faulthandler.enable() # For better debug info parser = argparse.ArgumentParser() # Add long and short arguments diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/WindowController.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/WindowController.py index e8f75ad..7f068e7 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/WindowController.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/WindowController.py @@ -24,7 +24,9 @@ class WindowController: self.active_window_id = "" self.active_tab_id = "" self.windows = [] - self.fm_event_observer() + + if not trace_debug: + self.fm_event_observer() @threaded def fm_event_observer(self): diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/view/Path.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/view/Path.py index 7c4cdc2..ecce282 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/view/Path.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/view/Path.py @@ -11,7 +11,7 @@ class Path: return os.path.expanduser("~") + self.subpath def get_path(self): - return "/" + "/".join(self.path) + return f"/{'/'.join(self.path)}" if self.path else f"/{''.join(self.path)}" def get_path_list(self): return self.path @@ -21,7 +21,7 @@ class Path: self.load_directory() def pop_from_path(self): - if len(self.path) > 1: + try: self.path.pop() if not self.go_past_home: @@ -29,6 +29,8 @@ class Path: self.set_to_home() self.load_directory() + except Exception as e: + pass def set_path(self, path): if path == self.get_path(): diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/view/View.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/view/View.py index 9a0485b..594dee1 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/view/View.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/view/View.py @@ -199,7 +199,7 @@ class View(Settings, FileHandler, Launcher, Icon, Path): def get_current_sub_path(self): path = self.get_path() - home = self.get_home() + "/" + home = f"{self.get_home()}/" return path.replace(home, "") def get_end_of_path(self): diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/view/icons/Icon.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/view/icons/Icon.py index f551ee6..3c14d2f 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/view/icons/Icon.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/view/icons/Icon.py @@ -17,7 +17,7 @@ def threaded(fn): class Icon(DesktopIconMixin, VideoIconMixin): def create_icon(self, dir, file): - full_path = dir + "/" + file + full_path = f"{dir}/{file}" return self.get_icon_image(dir, file, full_path) def get_icon_image(self, dir, file, full_path): @@ -36,29 +36,32 @@ class Icon(DesktopIconMixin, VideoIconMixin): return None def create_thumbnail(self, dir, file): - full_path = dir + "/" + file + full_path = f"{dir}/{file}" try: file_hash = hashlib.sha256(str.encode(full_path)).hexdigest() - hash_img_pth = self.ABS_THUMBS_PTH + "/" + file_hash + ".jpg" + hash_img_pth = f"{self.ABS_THUMBS_PTH}/{file_hash}.jpg" if isfile(hash_img_pth) == False: self.generate_video_thumbnail(full_path, hash_img_pth) thumbnl = self.create_scaled_image(hash_img_pth, self.VIDEO_ICON_WH) if thumbnl == None: # If no icon whatsoever, return internal default - thumbnl = GdkPixbuf.Pixbuf.new_from_file(self.DEFAULT_ICONS + "/video.png") + thumbnl = GdkPixbuf.Pixbuf.new_from_file(f"{self.DEFAULT_ICONS}/video.png") return thumbnl except Exception as e: print("Thumbnail generation issue:") print( repr(e) ) - return GdkPixbuf.Pixbuf.new_from_file(self.DEFAULT_ICONS + "/video.png") + return GdkPixbuf.Pixbuf.new_from_file(f"{self.DEFAULT_ICONS}/video.png") def create_scaled_image(self, path, wxh): try: - pixbuf = GdkPixbuf.Pixbuf.new_from_file(path) - scaled_pixbuf = pixbuf.scale_simple(wxh[0], wxh[1], 2) # 2 = BILINEAR and is best by default - return scaled_pixbuf + if path.lower().endswith(".gif"): + return GdkPixbuf.PixbufAnimation.new_from_file(path) \ + .get_static_image() \ + .scale_simple(wxh[0], wxh[1], GdkPixbuf.InterpType.BILINEAR) + else: + return GdkPixbuf.Pixbuf.new_from_file_at_scale(path, wxh[0], wxh[1], True) except Exception as e: print("Image Scaling Issue:") print( repr(e) ) diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/view/utils/Settings.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/view/utils/Settings.py index d1229c2..e4d9323 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/view/utils/Settings.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/view/utils/Settings.py @@ -59,7 +59,7 @@ class Settings: subpath = settings["base_of_home"] HIDE_HIDDEN_FILES = True if settings["hide_hidden_files"] == "true" else False FFMPG_THUMBNLR = FFMPG_THUMBNLR if settings["thumbnailer_path"] == "" else settings["thumbnailer_path"] - go_past_home = True if settings["go_past_home"] == "true" else False + go_past_home = True if settings["go_past_home"] == "" else settings["go_past_home"] lock_folder = True if settings["lock_folder"] == "true" else False locked_folders = settings["locked_folders"].split("::::") mplayer_options = settings["mplayer_options"].split() diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/Controller.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/Controller.py index 5354c5e..5673203 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/Controller.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/Controller.py @@ -1,5 +1,5 @@ # Python imports -import sys, traceback, threading, signal, inspect, os, time +import sys, traceback, threading, inspect, os, time # Lib imports import gi @@ -7,8 +7,9 @@ gi.require_version('Gtk', '3.0') from gi.repository import Gtk, GLib # Application imports -from .mixins import * -from . import ShowHideMixin, KeyboardSignalsMixin, Controller_Data +from .mixins.ui import * +from .mixins import ShowHideMixin, KeyboardSignalsMixin +from . import Controller_Data def threaded(fn): @@ -23,25 +24,23 @@ class Controller(WidgetFileActionMixin, PaneMixin, WindowMixin, ShowHideMixin, \ KeyboardSignalsMixin, Controller_Data): def __init__(self, args, unknownargs, _settings): # sys.excepthook = self.custom_except_hook - self.settings = _settings - self.setup_controller_data() - + self.setup_controller_data(_settings) self.window.show() self.generate_windows(self.state) + self.plugins.launch_plugins() - self.window.connect("delete-event", self.tear_down) - GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT, self.tear_down) - self.gui_event_observer() + if not trace_debug: + self.gui_event_observer() - if unknownargs: - for arg in unknownargs: - if os.path.isdir(arg): - message = f"FILE|{arg}" - event_system.send_ipc_message(message) + if unknownargs: + for arg in unknownargs: + if os.path.isdir(arg): + message = f"FILE|{arg}" + event_system.send_ipc_message(message) - if args.new_tab and os.path.isdir(args.new_tab): - message = f"FILE|{args.new_tab}" - event_system.send_ipc_message(message) + if args.new_tab and os.path.isdir(args.new_tab): + message = f"FILE|{args.new_tab}" + event_system.send_ipc_message(message) def tear_down(self, widget=None, eve=None): diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/Controller_Data.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/Controller_Data.py index ccace6d..95d8008 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/Controller_Data.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/Controller_Data.py @@ -1,4 +1,5 @@ # Python imports +import signal # Lib imports from gi.repository import GLib @@ -6,6 +7,7 @@ from gi.repository import GLib # Application imports from shellfm import WindowController from trasher.xdgtrash import XDGTrash +from . import Plugins @@ -14,16 +16,18 @@ class Controller_Data: def has_method(self, o, name): return callable(getattr(o, name, None)) - def setup_controller_data(self): - self.window_controller = WindowController() + def setup_controller_data(self, _settings): self.trashman = XDGTrash() + self.window_controller = WindowController() + self.plugins = Plugins(_settings) + self.state = self.window_controller.load_state() self.trashman.regenerate() - self.state = self.window_controller.load_state() - self.builder = self.settings.builder - self.logger = self.settings.logger + self.settings = _settings + self.builder = self.settings.get_builder() + self.logger = self.settings.get_logger() - self.window = self.settings.getMainWindow() + self.window = self.settings.get_main_window() self.window1 = self.builder.get_object("window_1") self.window2 = self.builder.get_object("window_2") self.window3 = self.builder.get_object("window_3") @@ -85,10 +89,10 @@ class Controller_Data: self.is_pane3_hidden = False self.is_pane4_hidden = False - self.is_searching = False - self.search_iconview = None - self.search_view = None - + self.override_drop_dest = None + self.is_searching = False + self.search_iconview = None + self.search_view = None self.skip_edit = False self.cancel_edit = False @@ -99,3 +103,7 @@ class Controller_Data: self.success = "#88cc27" self.warning = "#ffa800" self.error = "#ff0000" + + + self.window.connect("delete-event", self.tear_down) + GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT, self.tear_down) diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/DBusControllerMixin.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/IPCServerMixin.py similarity index 85% rename from src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/DBusControllerMixin.py rename to src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/IPCServerMixin.py index c8f622f..be92ace 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/DBusControllerMixin.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/IPCServerMixin.py @@ -15,11 +15,11 @@ def threaded(fn): -class DBusControllerMixin: +class IPCServerMixin: @threaded def create_ipc_server(self): - listener = Listener(('127.0.0.1', 4848), authkey=b'solarfm-ipc') + listener = Listener((self.ipc_address, self.ipc_port), authkey=self.ipc_authkey) self.is_ipc_alive = True while True: conn = listener.accept() @@ -49,7 +49,7 @@ class DBusControllerMixin: # NOTE: Not perfect but insures we don't lockup the connection for too long. end_time = time.time() - if (end - start) > 15.0: + if (end - start) > self.ipc_timeout: conn.close() listener.close() @@ -57,7 +57,7 @@ class DBusControllerMixin: def send_ipc_message(self, message="Empty Data..."): try: - conn = Client(('127.0.0.1', 4848), authkey=b'solarfm-ipc') + conn = Client((self.ipc_address, self.ipc_port), authkey=self.ipc_authkey) conn.send(message) conn.send('close connection') except Exception as e: diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/Plugins.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/Plugins.py new file mode 100644 index 0000000..8715aac --- /dev/null +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/Plugins.py @@ -0,0 +1,41 @@ +# Python imports +import importlib + +# Lib imports +import gi +gi.require_version('Gtk', '3.0') +from gi.repository import Gtk, Gio + +# Application imports + + + + +class Plugins: + """docstring for Plugins""" + def __init__(self, settings): + self._settings = settings + self._plugins_path = self._settings.get_plugins_path() + self._plugins_dir_watcher = None + self._socket = Gtk.Socket().new() + + def launch_plugins(self): + self._set_plugins_watcher() + self.load_plugins() + + def _set_plugins_watcher(self): + self._plugins_dir_watcher = Gio.File.new_for_path(self._plugins_path) \ + .monitor_directory(Gio.FileMonitorFlags.WATCH_MOVES, Gio.Cancellable()) + self._plugins_dir_watcher.connect("changed", self._on_plugins_changed, ()) + + def _on_plugins_changed(self, file_monitor, file, other_file=None, eve_type=None, data=None): + if eve_type in [Gio.FileMonitorEvent.CREATED, Gio.FileMonitorEvent.DELETED, + Gio.FileMonitorEvent.RENAMED, Gio.FileMonitorEvent.MOVED_IN, + Gio.FileMonitorEvent.MOVED_OUT]: + self.load_plugins(file) + + def load_plugins(self, file=None): + print(f"(Re)loading plugins...") + print(locals()) + + # importlib.reload(stl_utils) diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/__init__.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/__init__.py index f34b90c..314f976 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/__init__.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/__init__.py @@ -2,8 +2,7 @@ Gtk Bound Signal Module """ from .mixins import * -from .DBusControllerMixin import DBusControllerMixin -from .KeyboardSignalsMixin import KeyboardSignalsMixin -from .ShowHideMixin import ShowHideMixin +from .IPCServerMixin import IPCServerMixin +from .Plugins import Plugins from .Controller_Data import Controller_Data from .Controller import Controller diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/KeyboardSignalsMixin.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/KeyboardSignalsMixin.py similarity index 100% rename from src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/KeyboardSignalsMixin.py rename to src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/KeyboardSignalsMixin.py diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/ShowHideMixin.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ShowHideMixin.py similarity index 100% rename from src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/ShowHideMixin.py rename to src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ShowHideMixin.py diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/__init__.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/__init__.py index cd23f8d..e457cb5 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/__init__.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/__init__.py @@ -1,5 +1,2 @@ -from .PaneMixin import PaneMixin -from .WidgetMixin import WidgetMixin -from .TabMixin import TabMixin -from .WindowMixin import WindowMixin -from .WidgetFileActionMixin import WidgetFileActionMixin +from .KeyboardSignalsMixin import KeyboardSignalsMixin +from .ShowHideMixin import ShowHideMixin diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/PaneMixin.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ui/PaneMixin.py similarity index 100% rename from src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/PaneMixin.py rename to src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ui/PaneMixin.py diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/TabMixin.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ui/TabMixin.py similarity index 100% rename from src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/TabMixin.py rename to src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ui/TabMixin.py diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WidgetFileActionMixin.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ui/WidgetFileActionMixin.py similarity index 99% rename from src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WidgetFileActionMixin.py rename to src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ui/WidgetFileActionMixin.py index 96f503d..06ba422 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WidgetFileActionMixin.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ui/WidgetFileActionMixin.py @@ -107,7 +107,7 @@ class WidgetFileActionMixin: def open_with_files(self, appchooser_widget): wid, tid, view, iconview, store = self.get_current_state() app_info = appchooser_widget.get_app_info() - uris = self.format_to_uris(store, wid, tid, self.selected_files, True) + uris = self.format_to_uris(store, wid, tid, self.selected_files) view.app_chooser_exec(app_info, uris) diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/WidgetMixin.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ui/WidgetMixin.py similarity index 89% rename from src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/WidgetMixin.py rename to src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ui/WidgetMixin.py index 52b9a0d..349cba7 100644 --- a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/WidgetMixin.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ui/WidgetMixin.py @@ -1,5 +1,5 @@ # Python imports -import os, threading, subprocess +import os, threading, subprocess, time # Lib imports import gi @@ -20,15 +20,13 @@ def threaded(fn): class WidgetMixin: - def load_store(self, view, store, save_state=False): store.clear() dir = view.get_current_directory() files = view.get_files() - icon = GdkPixbuf.Pixbuf.new_from_file(view.DEFAULT_ICON) for i, file in enumerate(files): - store.append([icon, file[0]]) + store.append([None, file[0]]) self.create_icon(i, view, store, dir, file[0]) # NOTE: Not likely called often from here but it could be useful @@ -50,10 +48,14 @@ class WidgetMixin: try: itr = store.get_iter(i) except Exception as e: - print(":Invalid Itr detected: (Potential race condition...)") - print(f"Index Requested: {i}") - print(f"Store Size: {len(store)}") - return + try: + time.sleep(0.2) + itr = store.get_iter(i) + except Exception as e: + print(":Invalid Itr detected: (Potential race condition...)") + print(f"Index Requested: {i}") + print(f"Store Size: {len(store)}") + return if not icon: icon = self.get_system_thumbnail(fpath, view.SYS_ICON_WH[0]) @@ -113,7 +115,7 @@ class WidgetMixin: def create_grid_iconview_widget(self, view, wid): scroll = Gtk.ScrolledWindow() grid = Gtk.IconView() - store = Gtk.ListStore(GdkPixbuf.Pixbuf, str) + store = Gtk.ListStore(GdkPixbuf.Pixbuf or GdkPixbuf.PixbufAnimation or None, str) grid.set_model(store) grid.set_pixbuf_column(0) @@ -131,11 +133,14 @@ class WidgetMixin: grid.connect("button_release_event", self.grid_icon_single_click) grid.connect("item-activated", self.grid_icon_double_click) + # grid.connect("toggle-cursor-item", self.grid_cursor_toggled) + # grid.connect("notify", self.grid_cursor_toggled) grid.connect("selection-changed", self.grid_set_selected_items) grid.connect("drag-data-get", self.grid_on_drag_set) grid.connect("drag-data-received", self.grid_on_drag_data_received) grid.connect("drag-motion", self.grid_on_drag_motion) + URI_TARGET_TYPE = 80 uri_target = Gtk.TargetEntry.new('text/uri-list', Gtk.TargetFlags(0), URI_TARGET_TYPE) targets = [ uri_target ] @@ -154,8 +159,8 @@ class WidgetMixin: def create_grid_treeview_widget(self, view, wid): scroll = Gtk.ScrolledWindow() grid = Gtk.TreeView() - store = Gtk.ListStore(GdkPixbuf.Pixbuf, str) - # store = Gtk.TreeStore(GdkPixbuf.Pixbuf, str) + store = Gtk.ListStore(GdkPixbuf.Pixbuf or GdkPixbuf.PixbufAnimation or None, str) + # store = Gtk.TreeStore(GdkPixbuf.Pixbuf or None, str) column = Gtk.TreeViewColumn("Icons") icon = Gtk.CellRendererPixbuf() name = Gtk.CellRendererText() diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/WindowMixin.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ui/WindowMixin.py similarity index 86% rename from src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/WindowMixin.py rename to src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ui/WindowMixin.py index aa8687f..17e4be3 100644 --- a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/WindowMixin.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ui/WindowMixin.py @@ -82,7 +82,7 @@ class WindowMixin(TabMixin): _wid, _tid, _view, iconview, store = self.get_current_state() selected_files = iconview.get_selected_items() current_directory = view.get_current_directory() - path_file = Gio.File.new_for_path( current_directory) + path_file = Gio.File.new_for_path(current_directory) mount_file = path_file.query_filesystem_info(attributes="filesystem::*", cancellable=None) formatted_mount_free = self.sizeof_fmt( int(mount_file.get_attribute_as_string("filesystem::free")) ) formatted_mount_size = self.sizeof_fmt( int(mount_file.get_attribute_as_string("filesystem::size")) ) @@ -101,11 +101,16 @@ class WindowMixin(TabMixin): uris = self.format_to_uris(store, _wid, _tid, selected_files, True) combined_size = 0 for uri in uris: - file_info = Gio.File.new_for_path(uri).query_info(attributes="standard::size", - flags=Gio.FileQueryInfoFlags.NONE, - cancellable=None) - file_size = file_info.get_size() - combined_size += file_size + try: + file_info = Gio.File.new_for_path(uri).query_info(attributes="standard::size", + flags=Gio.FileQueryInfoFlags.NONE, + cancellable=None) + file_size = file_info.get_size() + combined_size += file_size + except Exception as e: + if debug: + print(repr(e)) + formatted_size = self.sizeof_fmt(combined_size) if view.hide_hidden: @@ -152,6 +157,9 @@ class WindowMixin(TabMixin): def grid_set_selected_items(self, iconview): self.selected_files = iconview.get_selected_items() + def grid_cursor_toggled(self, iconview): + print("wat...") + def grid_icon_single_click(self, iconview, eve): try: self.path_menu.popdown() @@ -213,8 +221,19 @@ class WindowMixin(TabMixin): data.set_text(uris_text, -1) def grid_on_drag_motion(self, iconview, drag_context, x, y, data): - wid, tid = iconview.get_name().split("|") - self.window_controller.set_active_data(wid, tid) + current = '|'.join(self.window_controller.get_active_data()) + target = iconview.get_name() + wid, tid = target.split("|") + store = iconview.get_model() + treePath = iconview.get_drag_dest_item().path + + if treePath: + uri = self.format_to_uris(store, wid, tid, treePath)[0].replace("file://", "") + self.override_drop_dest = uri if isdir(uri) else None + + if target not in current: + self.window_controller.set_active_data(wid, tid) + def grid_on_drag_data_received(self, widget, drag_context, x, y, data, info, time): if info == 80: @@ -224,12 +243,14 @@ class WindowMixin(TabMixin): view = self.get_fm_window(wid).get_view_by_id(tid) uris = data.get_uris() - dest = f"{view.get_current_directory()}" - if len(uris) > 0: - self.move_files(uris, dest) - else: + dest = f"{view.get_current_directory()}" if not self.override_drop_dest else self.override_drop_dest + if len(uris) == 0: uris = data.get_text().split("\n") + + from_uri = '/'.join(uris[0].replace("file://", "").split("/")[:-1]) + if from_uri != dest: self.move_files(uris, dest) + def create_new_view_notebook(self, widget=None, wid=None, path=None): self.create_tab(wid, path) diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ui/__init__.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ui/__init__.py new file mode 100644 index 0000000..cd23f8d --- /dev/null +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ui/__init__.py @@ -0,0 +1,5 @@ +from .PaneMixin import PaneMixin +from .WidgetMixin import WidgetMixin +from .TabMixin import TabMixin +from .WindowMixin import WindowMixin +from .WidgetFileActionMixin import WidgetFileActionMixin diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/utils/Logger.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/utils/Logger.py index c7f294e..06eed47 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/utils/Logger.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/utils/Logger.py @@ -5,8 +5,8 @@ import os, logging class Logger: - def __init__(self): - pass + def __init__(self, config_path): + self._CONFIG_PATH = config_path def get_logger(self, loggerName = "NO_LOGGER_NAME_PASSED", createFile = True): """ @@ -42,8 +42,8 @@ class Logger: log.addHandler(ch) if createFile: - folder = "logs" - file = folder + "/application.log" + folder = self._CONFIG_PATH + file = f"{folder}/application.log" if not os.path.exists(folder): os.mkdir(folder) diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/utils/Settings.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/utils/Settings.py index 3dc368f..380210a 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/utils/Settings.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/utils/Settings.py @@ -17,39 +17,45 @@ from . import Logger class Settings: def __init__(self): - self.logger = Logger().get_logger() self.builder = gtk.Builder() self.SCRIPT_PTH = os.path.dirname(os.path.realpath(__file__)) self.USER_HOME = path.expanduser('~') - self.CONFIG_PATH = f"{self.USER_HOME}/.config/solarfm" - self.USR_SOLARFM = "/usr/share/solarfm" + self.CONFIG_PATH = f"{self.USER_HOME}/.config/{app_name.lower()}" + self.PLUGINS_PATH = f"{self.CONFIG_PATH}/plugins" + self.USR_SOLARFM = f"/usr/share/{app_name.lower()}" self.cssFile = f"{self.CONFIG_PATH}/stylesheet.css" self.windows_glade = f"{self.CONFIG_PATH}/Main_Window.glade" self.DEFAULT_ICONS = f"{self.CONFIG_PATH}/icons" - self.window_icon = f"{self.DEFAULT_ICONS}/solarfm.png" + self.window_icon = f"{self.DEFAULT_ICONS}/{app_name.lower()}.png" self.main_window = None + if not os.path.exists(self.CONFIG_PATH): + os.mkdir(self.CONFIG_PATH) + if not os.path.exists(self.PLUGINS_PATH): + os.mkdir(self.PLUGINS_PATH) + if not os.path.exists(self.windows_glade): self.windows_glade = f"{self.USR_SOLARFM}/Main_Window.glade" if not os.path.exists(self.cssFile): self.cssFile = f"{self.USR_SOLARFM}/stylesheet.css" if not os.path.exists(self.window_icon): - self.window_icon = f"{self.USR_SOLARFM}/icons/solarfm.png" + self.window_icon = f"{self.USR_SOLARFM}/icons/{app_name.lower()}.png" if not os.path.exists(self.DEFAULT_ICONS): self.DEFAULT_ICONS = f"{self.USR_SOLARFM}/icons" + self.logger = Logger(self.CONFIG_PATH).get_logger() self.builder.add_from_file(self.windows_glade) - def createWindow(self): + def create_window(self): # Get window and connect signals self.main_window = self.builder.get_object("Main_Window") - self.setWindowData() + self._set_window_data() - def setWindowData(self): + def _set_window_data(self): self.main_window.set_icon_from_file(self.window_icon) screen = self.main_window.get_screen() visual = screen.get_rgba_visual() @@ -57,7 +63,7 @@ class Settings: if visual != None and screen.is_composited(): self.main_window.set_visual(visual) self.main_window.set_app_paintable(True) - self.main_window.connect("draw", self.area_draw) + self.main_window.connect("draw", self._area_draw) # bind css file cssProvider = gtk.CssProvider() @@ -66,16 +72,13 @@ class Settings: styleContext = gtk.StyleContext() styleContext.add_provider_for_screen(screen, cssProvider, gtk.STYLE_PROVIDER_PRIORITY_USER) - def area_draw(self, widget, cr): + def _area_draw(self, widget, cr): cr.set_source_rgba(0, 0, 0, 0.54) cr.set_operator(cairo.OPERATOR_SOURCE) cr.paint() cr.set_operator(cairo.OPERATOR_OVER) - def getMainWindow(self): return self.main_window - - - def getMonitorData(self): + def get_monitor_data(self): screen = self.builder.get_object("Main_Window").get_screen() monitors = [] for m in range(screen.get_n_monitors()): @@ -85,3 +88,8 @@ class Settings: print("{}x{}+{}+{}".format(monitor.width, monitor.height, monitor.x, monitor.y)) return monitors + + def get_builder(self): return self.builder + def get_logger(self): return self.logger + def get_main_window(self): return self.main_window + def get_plugins_path(self): return self.PLUGINS_PATH diff --git a/user_config/usr/share/solarfm/Main_Window.glade b/user_config/usr/share/solarfm/Main_Window.glade index 9878a5a..367ed9a 100644 --- a/user_config/usr/share/solarfm/Main_Window.glade +++ b/user_config/usr/share/solarfm/Main_Window.glade @@ -1307,19 +1307,25 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe gtk-new + create True False + New File/Folder... True True + gtk-open + open True False + Open... True True + @@ -2068,25 +2074,6 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe True False vertical - - - gtk-delete - delete - True - True - True - Delete... - 20 - True - True - - - - False - True - 11 - - gtk-open @@ -2226,25 +2213,6 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe 7 - - - Go To Trash - go_to_trash - True - True - True - Go To Trash... - trash_img2 - True - - - - False - True - end - 8 - - Archive @@ -2257,12 +2225,65 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe True + + False + True + 8 + + + + + gtk-delete + delete + True + True + True + Delete... + 20 + True + True + + False True 9 + + + Restore From Trash + restore_from_trash + True + True + True + Restore From Trash... + 20 + + + + False + True + 10 + + + + + Empty Trash + empty_trash + True + True + True + Empty Trash... + 20 + + + + False + True + 11 + + Trash @@ -2278,8 +2299,25 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe False True - end - 11 + 12 + + + + + Go To Trash + go_to_trash + True + True + True + Go To Trash... + trash_img2 + True + + + + False + True + 13