Compare commits
	
		
			26 Commits
		
	
	
		
			convert-to
			...
			52aa14dcb4
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 52aa14dcb4 | |||
| 7534bf141e | |||
| ca855712b1 | |||
| 95c6f79627 | |||
| a863dbc586 | |||
| 628740fd31 | |||
| ed2a27ed9a | |||
| 3bedd83793 | |||
| ad70e8c819 | |||
| ecfb586f53 | |||
| b0991cb776 | |||
| 3d719ad6f6 | |||
| 63c41d5e2a | |||
| 2a0fe9eb15 | |||
| a380c01573 | |||
| a1c27792ee | |||
| 353ee2a966 | |||
| 8a0057f78e | |||
| f2314500b7 | |||
| 2c258d470b | |||
| 59d67874ad | |||
| bee66ee001 | |||
| 5bf6d04fdd | |||
| 216cc9d34c | |||
| 5a9fa8253b | |||
| 9b578859e0 | 
| @@ -14,7 +14,6 @@ sudo apt-get install python3.8 wget python3-setproctitle python3-gi ffmpegthumbn | ||||
| # TODO | ||||
| <ul> | ||||
| <li>Add simpleish plugin system to run bash/python scripts.</li> | ||||
| <li>Add DnD context awareness for over folder drop.</li> | ||||
| </ul> | ||||
|  | ||||
| # Images | ||||
|   | ||||
							
								
								
									
										
											BIN
										
									
								
								bin/solarfm-0-0-1-x64.deb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								bin/solarfm-0-0-1-x64.deb
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										2
									
								
								plugins/README.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								plugins/README.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| ### Note | ||||
| Copy the example and rename it to your desired name. The Main class and passed in arguments are required. You don't necessarily need to use the passed in socket_id or event_system. | ||||
							
								
								
									
										52
									
								
								plugins/example/__main__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								plugins/example/__main__.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,52 @@ | ||||
| # Python imports | ||||
| import sys, threading, subprocess, time | ||||
|  | ||||
| # Gtk imports | ||||
| import gi | ||||
| gi.require_version('Gtk', '3.0') | ||||
| from gi.repository import Gtk | ||||
|  | ||||
| # Application imports | ||||
|  | ||||
|  | ||||
| def threaded(fn): | ||||
|     def wrapper(*args, **kwargs): | ||||
|         threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=False).start() | ||||
|     return wrapper | ||||
|  | ||||
|  | ||||
| class Main: | ||||
|     def __init__(self, socket_id, event_system): | ||||
|         self._plugin_name  = "Example Plugin" | ||||
|         self._event_system = event_system | ||||
|         self._socket_id    = socket_id | ||||
|         self._gtk_plug     = Gtk.Plug.new(self._socket_id) | ||||
|         button             = Gtk.Button(label="Click Me!") | ||||
|         self._message      = None | ||||
|         self._time_out     = 5 | ||||
|  | ||||
|         button.connect("button-release-event", self._do_action) | ||||
|         self._gtk_plug.add(button) | ||||
|         self._gtk_plug.show_all() | ||||
|  | ||||
|  | ||||
|     @threaded | ||||
|     def _do_action(self, widget=None, eve=None): | ||||
|         message = "Hello, World!" | ||||
|         self._event_system.push_gui_event(["some_type", "display_message", ("warning", message, None)]) | ||||
|  | ||||
|  | ||||
|     def set_message(self, data): | ||||
|         self._message = data | ||||
|  | ||||
|     def get_plugin_name(self): | ||||
|         return self._plugin_name | ||||
|  | ||||
|     def get_socket_id(self): | ||||
|         return self._socket_id | ||||
|  | ||||
|     def _run_timeout(self): | ||||
|         timeout = 0 | ||||
|         while not self._message and timeout < self._time_out: | ||||
|             time.sleep(1) | ||||
|             timeout += 1 | ||||
							
								
								
									
										0
									
								
								src/debs/clear_pycache_dirs.sh
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								src/debs/clear_pycache_dirs.sh
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										0
									
								
								src/debs/solarfm-0-0-1-x64/bin/solarfm
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								src/debs/solarfm-0-0-1-x64/bin/solarfm
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							| @@ -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 | ||||
|   | ||||
| @@ -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: | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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): | ||||
|   | ||||
| @@ -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(): | ||||
|   | ||||
| @@ -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): | ||||
|   | ||||
| @@ -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) ) | ||||
|   | ||||
| @@ -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() | ||||
|   | ||||
| @@ -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): | ||||
|   | ||||
| @@ -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) | ||||
|   | ||||
| @@ -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: | ||||
| @@ -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) | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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) | ||||
| 
 | ||||
| @@ -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() | ||||
| @@ -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) | ||||
							
								
								
									
										0
									
								
								src/debs/solarfm-0-0-1-x64/opt/SolarFM/trasher/__init__.py
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								src/debs/solarfm-0-0-1-x64/opt/SolarFM/trasher/__init__.py
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										0
									
								
								src/debs/solarfm-0-0-1-x64/opt/SolarFM/trasher/trash.py
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								src/debs/solarfm-0-0-1-x64/opt/SolarFM/trasher/trash.py
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										0
									
								
								src/debs/solarfm-0-0-1-x64/opt/SolarFM/trasher/xdgtrash.py
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								src/debs/solarfm-0-0-1-x64/opt/SolarFM/trasher/xdgtrash.py
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							| @@ -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) | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -4,20 +4,28 @@ import builtins | ||||
| # Lib imports | ||||
|  | ||||
| # Application imports | ||||
| from signal_classes.DBusControllerMixin import DBusControllerMixin | ||||
| from controller import IPCServerMixin | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| class Builtins(DBusControllerMixin): | ||||
|     """Docstring for __builtins__ extender""" | ||||
| class Builtins(IPCServerMixin): | ||||
|     """ Inheret IPCServerMixin. Create an pub/sub systems. """ | ||||
|  | ||||
|     def __init__(self): | ||||
|         # NOTE: The format used is list of [type, target, data] | ||||
|         # NOTE: The format used is list of [type, target, (data,)] Where: | ||||
|         #             type is useful context for control flow, | ||||
|         #             target is the method to call, | ||||
|         #             data is the method parameters to give | ||||
|         #       Where data may be any kind of data | ||||
|         self._gui_events    = [] | ||||
|         self._fm_events     = [] | ||||
|         self._module_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): | ||||
| @@ -25,9 +33,9 @@ class Builtins(DBusControllerMixin): | ||||
|             return self._gui_events.pop(0) | ||||
|         return None | ||||
|  | ||||
|     def _pop_fm_event(self): | ||||
|         if len(self._fm_events) > 0: | ||||
|             return self._fm_events.pop(0) | ||||
|     def _pop_module_event(self): | ||||
|         if len(self._module_events) > 0: | ||||
|             return self._module_events.pop(0) | ||||
|         return None | ||||
|  | ||||
|  | ||||
| @@ -36,31 +44,33 @@ class Builtins(DBusControllerMixin): | ||||
|             self._gui_events.append(event) | ||||
|             return None | ||||
|  | ||||
|         raise Exception("Invald event format! Please do:  [type, target, data]") | ||||
|         raise Exception("Invald event format! Please do:  [type, target, (data,)]") | ||||
|  | ||||
|     def push_fm_event(self, event): | ||||
|     def push_module_event(self, event): | ||||
|         if len(event) == 3: | ||||
|             self._fm_events.append(event) | ||||
|             self._module_events.append(event) | ||||
|             return None | ||||
|  | ||||
|         raise Exception("Invald event format! Please do:  [type, target, data]") | ||||
|         raise Exception("Invald event format! Please do:  [type, target, (data,)]") | ||||
|  | ||||
|     def read_gui_event(self): | ||||
|         return self._gui_events[0] | ||||
|  | ||||
|     def read_fm_event(self): | ||||
|         return self._fm_events[0] | ||||
|     def read_module_event(self): | ||||
|         return self._module_events[0] | ||||
|  | ||||
|     def consume_gui_event(self): | ||||
|         return self._pop_gui_event() | ||||
|  | ||||
|     def consume_fm_event(self): | ||||
|         return self._pop_fm_event() | ||||
|     def consume_module_event(self): | ||||
|         return self._pop_module_event() | ||||
|  | ||||
|  | ||||
|  | ||||
| # 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 | ||||
|   | ||||
| @@ -5,32 +5,37 @@ import os, inspect, time | ||||
|  | ||||
| # Application imports | ||||
| from utils import Settings | ||||
| from signal_classes import Controller | ||||
| from controller import Controller | ||||
| from __builtins__ import Builtins | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| class Main(Builtins): | ||||
|     ''' Create Settings and Controller classes. Bind signal to Builder. Inherit from Builtins to bind global methods and classes.''' | ||||
|  | ||||
|     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: | ||||
|   | ||||
| @@ -19,11 +19,13 @@ from __init__ import Main | ||||
|  | ||||
|  | ||||
| if __name__ == "__main__": | ||||
|     ''' Set process title, get arguments, and create GTK main thread. ''' | ||||
|  | ||||
|     try: | ||||
|         # 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 | ||||
|   | ||||
| @@ -0,0 +1,146 @@ | ||||
| # Python imports | ||||
| import traceback, threading, inspect, os, time | ||||
|  | ||||
| # Lib imports | ||||
| import gi | ||||
| gi.require_version('Gtk', '3.0') | ||||
| from gi.repository import Gtk, GLib | ||||
|  | ||||
| # Application imports | ||||
| from .mixins import ExceptionHookMixin, UIMixin | ||||
| from .signals import IPCSignalsMixin, KeyboardSignalsMixin | ||||
| from . import Controller_Data | ||||
|  | ||||
|  | ||||
| def threaded(fn): | ||||
|     def wrapper(*args, **kwargs): | ||||
|         threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=True).start() | ||||
|     return wrapper | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| class Controller(UIMixin, KeyboardSignalsMixin, IPCSignalsMixin, ExceptionHookMixin, Controller_Data): | ||||
|     ''' Controller coordinates the mixins and is somewhat the root hub of it all. ''' | ||||
|     def __init__(self, args, unknownargs, _settings): | ||||
|         self.setup_controller_data(_settings) | ||||
|         self.window.show() | ||||
|         self.generate_windows(self.state) | ||||
|         self.plugins.launch_plugins() | ||||
|  | ||||
|         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 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): | ||||
|         event_system.send_ipc_message("close server") | ||||
|         self.window_controller.save_state() | ||||
|         time.sleep(event_sleep_time) | ||||
|         Gtk.main_quit() | ||||
|  | ||||
|  | ||||
|     @threaded | ||||
|     def gui_event_observer(self): | ||||
|         while True: | ||||
|             time.sleep(event_sleep_time) | ||||
|             event = event_system.consume_gui_event() | ||||
|             if event: | ||||
|                 try: | ||||
|                     type, target, data = event | ||||
|                     if type: | ||||
|                         method = getattr(self.__class__, "handle_gui_event_and_set_message") | ||||
|                         GLib.idle_add(method, *(self, type, target, data)) | ||||
|                     else: | ||||
|                         method = getattr(self.__class__, target) | ||||
|                         GLib.idle_add(method, *(self, *data,)) | ||||
|                 except Exception as e: | ||||
|                     print(repr(e)) | ||||
|  | ||||
|     def handle_gui_event_and_set_message(self, type, target, parameters): | ||||
|         method = getattr(self.__class__, f"{target}") | ||||
|         data   = method(*(self, *parameters)) | ||||
|         self.plugins.set_message_on_plugin(type, data) | ||||
|  | ||||
|  | ||||
|     def save_load_session(self, action="save_session"): | ||||
|         wid, tid          = self.window_controller.get_active_data() | ||||
|         view              = self.get_fm_window(wid).get_view_by_id(tid) | ||||
|         save_load_dialog  = self.builder.get_object("save_load_dialog") | ||||
|         save_load_dialog.set_current_folder(view.get_current_directory()) | ||||
|         save_load_dialog.set_current_name("session.json") | ||||
|  | ||||
|         if action == "save_session": | ||||
|             save_load_dialog.set_action(Gtk.FileChooserAction.SAVE) | ||||
|         elif action == "load_session": | ||||
|             save_load_dialog.set_action(Gtk.FileChooserAction.OPEN) | ||||
|  | ||||
|  | ||||
|         response = save_load_dialog.run() | ||||
|         if response == Gtk.ResponseType.OK: | ||||
|             path = f"{save_load_dialog.get_current_folder()}/{save_load_dialog.get_current_name()}" | ||||
|  | ||||
|             if action == "save_session": | ||||
|                 self.window_controller.save_state(path) | ||||
|             elif action == "load_session": | ||||
|                 session_json = self.window_controller.load_state(path) | ||||
|                 print(session_json) | ||||
|         if (response == Gtk.ResponseType.CANCEL) or (response == Gtk.ResponseType.DELETE_EVENT): | ||||
|             pass | ||||
|  | ||||
|         save_load_dialog.hide() | ||||
|  | ||||
|  | ||||
|     def do_action_from_menu_controls(self, widget, eventbutton): | ||||
|         action        = widget.get_name() | ||||
|         self.ctrlDown = True | ||||
|         self.hide_context_menu() | ||||
|         self.hide_new_file_menu() | ||||
|         self.hide_edit_file_menu() | ||||
|  | ||||
|         if action == "open": | ||||
|             self.open_files() | ||||
|         if action == "open_with": | ||||
|             self.show_appchooser_menu() | ||||
|         if action == "execute": | ||||
|             self.execute_files() | ||||
|         if action == "execute_in_terminal": | ||||
|             self.execute_files(in_terminal=True) | ||||
|         if action == "rename": | ||||
|             self.rename_files() | ||||
|         if action == "cut": | ||||
|             self.to_copy_files.clear() | ||||
|             self.cut_files() | ||||
|         if action == "copy": | ||||
|             self.to_cut_files.clear() | ||||
|             self.copy_files() | ||||
|         if action == "paste": | ||||
|             self.paste_files() | ||||
|         if action == "archive": | ||||
|             self.show_archiver_dialogue() | ||||
|         if action == "delete": | ||||
|             self.delete_files() | ||||
|         if action == "trash": | ||||
|             self.trash_files() | ||||
|         if action == "go_to_trash": | ||||
|             self.path_entry.set_text(self.trash_files_path) | ||||
|         if action == "restore_from_trash": | ||||
|             self.restore_trash_files() | ||||
|         if action == "empty_trash": | ||||
|             self.empty_trash() | ||||
|  | ||||
|         if action == "create": | ||||
|             self.create_files() | ||||
|         if action in ["save_session", "load_session"]: | ||||
|             self.save_load_session(action) | ||||
|  | ||||
|         self.ctrlDown = False | ||||
| @@ -1,29 +1,32 @@ | ||||
| # Python imports | ||||
| import sys, os, signal | ||||
| 
 | ||||
| # Lib imports | ||||
| from gi.repository import GLib | ||||
| 
 | ||||
| # Application imports | ||||
| from shellfm import WindowController | ||||
| from trasher.xdgtrash import XDGTrash | ||||
| from shellfm import WindowController | ||||
| from plugins import Plugins | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| class Controller_Data: | ||||
|     def has_method(self, o, name): | ||||
|         return callable(getattr(o, name, None)) | ||||
|     ''' Controller_Data contains most of the state of the app at ay given time. It also has some support methods. ''' | ||||
| 
 | ||||
|     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") | ||||
| @@ -33,13 +36,14 @@ class Controller_Data: | ||||
|         self.message_buffer     = self.builder.get_object("message_buffer") | ||||
|         self.arc_command_buffer = self.builder.get_object("arc_command_buffer") | ||||
| 
 | ||||
|         self.exists_file_rename_bttn = self.builder.get_object("exists_file_rename_bttn") | ||||
|         self.warning_alert      = self.builder.get_object("warning_alert") | ||||
|         self.edit_file_menu     = self.builder.get_object("edit_file_menu") | ||||
|         self.file_exists_dialog = self.builder.get_object("file_exists_dialog") | ||||
|         self.exists_file_label  = self.builder.get_object("exists_file_label") | ||||
|         self.exists_file_field  = self.builder.get_object("exists_file_field") | ||||
|         self.path_menu          = self.builder.get_object("path_menu") | ||||
|         self.exists_file_rename_bttn = self.builder.get_object("exists_file_rename_bttn") | ||||
|         self.path_entry         = self.builder.get_object("path_entry") | ||||
| 
 | ||||
|         self.bottom_size_label       = self.builder.get_object("bottom_size_label") | ||||
|         self.bottom_file_count_label = self.builder.get_object("bottom_file_count_label") | ||||
| @@ -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,54 @@ class Controller_Data: | ||||
|         self.success           = "#88cc27" | ||||
|         self.warning           = "#ffa800" | ||||
|         self.error             = "#ff0000" | ||||
| 
 | ||||
|         sys.excepthook = self.custom_except_hook | ||||
|         self.window.connect("delete-event", self.tear_down) | ||||
|         GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT, self.tear_down) | ||||
| 
 | ||||
|     def get_current_state(self): | ||||
|         ''' | ||||
|         Returns the state info most useful for any given context and action intent. | ||||
| 
 | ||||
|                 Parameters: | ||||
|                         a (obj): self | ||||
| 
 | ||||
|                 Returns: | ||||
|                         wid, tid, view, iconview, store | ||||
|         ''' | ||||
|         wid, tid     = self.window_controller.get_active_data() | ||||
|         view         = self.get_fm_window(wid).get_view_by_id(tid) | ||||
|         iconview     = self.builder.get_object(f"{wid}|{tid}|iconview") | ||||
|         store        = iconview.get_model() | ||||
|         return wid, tid, view, iconview, store | ||||
| 
 | ||||
| 
 | ||||
|     def clear_console(self): | ||||
|         ''' Clears the terminal screen. ''' | ||||
|         os.system('cls' if os.name == 'nt' else 'clear') | ||||
| 
 | ||||
|     def call_method(self, _method_name, data = None): | ||||
|         ''' | ||||
|         Calls a method from scope of class. | ||||
| 
 | ||||
|                 Parameters: | ||||
|                         a (obj): self | ||||
|                         b (str): method name to be called | ||||
|                         c (*): Data (if any) to be passed to the method. | ||||
|                                 Note: It must be structured according to the given methods requirements. | ||||
| 
 | ||||
|                 Returns: | ||||
|                         Return data is that which the calling method gives. | ||||
|         ''' | ||||
|         method_name = str(_method_name) | ||||
|         method      = getattr(self, method_name, lambda data: f"No valid key passed...\nkey={method_name}\nargs={data}") | ||||
|         return method(data) if data else method() | ||||
| 
 | ||||
|     def has_method(self, obj, name): | ||||
|         ''' Checks if a given method exists. ''' | ||||
|         return callable(getattr(obj, name, None)) | ||||
| 
 | ||||
|     def clear_children(self, widget): | ||||
|         ''' Clear children of a gtk widget. ''' | ||||
|         for child in widget.get_children(): | ||||
|             widget.remove(child) | ||||
| @@ -15,11 +15,12 @@ def threaded(fn): | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| class DBusControllerMixin: | ||||
| class IPCServerMixin: | ||||
|     ''' Create a listener so that other SolarFM instances send requests back to existing instance. ''' | ||||
| 
 | ||||
|     @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() | ||||
| @@ -34,7 +35,7 @@ class DBusControllerMixin: | ||||
|                 if "FILE|" in msg: | ||||
|                     file = msg.split("FILE|")[1].strip() | ||||
|                     if file: | ||||
|                         event_system.push_gui_event(["create_tab_from_ipc", None, file]) | ||||
|                         event_system.push_gui_event([None, "handle_file_from_ipc", (file,)]) | ||||
| 
 | ||||
|                     conn.close() | ||||
|                     break | ||||
| @@ -49,7 +50,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 +58,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: | ||||
| @@ -0,0 +1,7 @@ | ||||
| """ | ||||
|     Gtk Bound Signal Module | ||||
| """ | ||||
| from .mixins import * | ||||
| from .IPCServerMixin import IPCServerMixin | ||||
| from .Controller_Data import Controller_Data | ||||
| from .Controller import Controller | ||||
| @@ -0,0 +1,62 @@ | ||||
| # Python imports | ||||
| import traceback, threading, time | ||||
|  | ||||
| # Lib imports | ||||
| import gi | ||||
| gi.require_version('Gtk', '3.0') | ||||
| from gi.repository import Gtk, GLib | ||||
|  | ||||
| # Application imports | ||||
|  | ||||
|  | ||||
| def threaded(fn): | ||||
|     def wrapper(*args, **kwargs): | ||||
|         threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=True).start() | ||||
|     return wrapper | ||||
|  | ||||
|  | ||||
| class ExceptionHookMixin: | ||||
|     ''' ExceptionHookMixin custom exception hook to reroute to a Gtk text area. ''' | ||||
|  | ||||
|     def custom_except_hook(self, exctype, value, _traceback): | ||||
|         trace     = ''.join(traceback.format_tb(_traceback)) | ||||
|         data      = f"Exectype:  {exctype}  <-->  Value:  {value}\n\n{trace}\n\n\n\n" | ||||
|         start_itr = self.message_buffer.get_start_iter() | ||||
|         self.message_buffer.place_cursor(start_itr) | ||||
|         self.display_message(self.error, data) | ||||
|  | ||||
|     def display_message(self, type, text, seconds=None): | ||||
|         self.message_buffer.insert_at_cursor(text) | ||||
|         self.message_widget.popup() | ||||
|         if seconds: | ||||
|             self.hide_message_timeout(seconds) | ||||
|  | ||||
|     @threaded | ||||
|     def hide_message_timeout(self, seconds=3): | ||||
|         time.sleep(seconds) | ||||
|         GLib.idle_add(self.message_widget.popdown) | ||||
|  | ||||
|     def save_debug_alerts(self, widget=None, eve=None): | ||||
|         start_itr, end_itr   = self.message_buffer.get_bounds() | ||||
|         save_location_prompt = Gtk.FileChooserDialog("Choose Save Folder", self.window, \ | ||||
|                                                         action  = Gtk.FileChooserAction.SAVE, \ | ||||
|                                                         buttons = (Gtk.STOCK_CANCEL, \ | ||||
|                                                                     Gtk.ResponseType.CANCEL, \ | ||||
|                                                                     Gtk.STOCK_SAVE, \ | ||||
|                                                                     Gtk.ResponseType.OK)) | ||||
|  | ||||
|         text = self.message_buffer.get_text(start_itr, end_itr, False) | ||||
|         resp = save_location_prompt.run() | ||||
|         if (resp == Gtk.ResponseType.CANCEL) or (resp == Gtk.ResponseType.DELETE_EVENT): | ||||
|             pass | ||||
|         elif resp == Gtk.ResponseType.OK: | ||||
|             target = save_location_prompt.get_filename(); | ||||
|             with open(target, "w") as f: | ||||
|                 f.write(text) | ||||
|  | ||||
|         save_location_prompt.destroy() | ||||
|  | ||||
|  | ||||
|     def set_arc_buffer_text(self, widget=None, eve=None): | ||||
|         id = widget.get_active_id() | ||||
|         self.arc_command_buffer.set_text(self.arc_commands[int(id)]) | ||||
| @@ -16,7 +16,6 @@ class ShowHideMixin: | ||||
|     def stop_file_searching(self, widget=None, eve=None): | ||||
|         self.is_searching = False | ||||
| 
 | ||||
| 
 | ||||
|     def show_exists_page(self, widget=None, eve=None): | ||||
|         response = self.file_exists_dialog.run() | ||||
|         self.file_exists_dialog.hide() | ||||
| @@ -81,12 +80,14 @@ class ShowHideMixin: | ||||
|         appchooser_widget = self.builder.get_object("appchooser_widget") | ||||
|         response          = appchooser_menu.run() | ||||
| 
 | ||||
|         if response == Gtk.ResponseType.CANCEL: | ||||
|             self.hide_appchooser_menu() | ||||
|         if response == Gtk.ResponseType.OK: | ||||
|             self.open_with_files(appchooser_widget) | ||||
|             self.hide_appchooser_menu() | ||||
| 
 | ||||
|         if response == Gtk.ResponseType.CANCEL: | ||||
|             self.hide_appchooser_menu() | ||||
| 
 | ||||
| 
 | ||||
|     def hide_appchooser_menu(self, widget=None, eve=None): | ||||
|         self.builder.get_object("appchooser_menu").hide() | ||||
| 
 | ||||
| @@ -95,6 +96,12 @@ class ShowHideMixin: | ||||
|         dialog.response(Gtk.ResponseType.OK) | ||||
| 
 | ||||
| 
 | ||||
|     def show_plugins_popup(self, widget=None, eve=None): | ||||
|         self.builder.get_object("plugin_list").popup() | ||||
| 
 | ||||
|     def hide_plugins_popup(self, widget=None, eve=None): | ||||
|         self.builder.get_object("plugin_list").hide() | ||||
| 
 | ||||
|     def show_context_menu(self, widget=None, eve=None): | ||||
|         self.builder.get_object("context_menu").run() | ||||
| 
 | ||||
| @@ -103,12 +110,18 @@ class ShowHideMixin: | ||||
| 
 | ||||
| 
 | ||||
|     def show_new_file_menu(self, widget=None, eve=None): | ||||
|         self.builder.get_object("new_file_menu").run() | ||||
|         self.builder.get_object("context_menu_fname").set_text("") | ||||
| 
 | ||||
|         new_file_menu = self.builder.get_object("new_file_menu") | ||||
|         response      = new_file_menu.run() | ||||
|         if response == Gtk.ResponseType.APPLY: | ||||
|             self.create_files() | ||||
|         if response == Gtk.ResponseType.CANCEL: | ||||
|             self.hide_new_file_menu() | ||||
| 
 | ||||
|     def hide_new_file_menu(self, widget=None, eve=None): | ||||
|         self.builder.get_object("new_file_menu").hide() | ||||
| 
 | ||||
| 
 | ||||
|     def show_edit_file_menu(self, widget=None, eve=None): | ||||
|         if widget: | ||||
|             widget.grab_focus() | ||||
| @@ -0,0 +1,11 @@ | ||||
| # Python imports | ||||
|  | ||||
| # Gtk imports | ||||
|  | ||||
| # Application imports | ||||
| from . import ShowHideMixin | ||||
| from .ui import * | ||||
|  | ||||
|  | ||||
| class UIMixin(WidgetFileActionMixin, PaneMixin, WindowMixin, ShowHideMixin): | ||||
|     pass | ||||
| @@ -0,0 +1,3 @@ | ||||
| from .ShowHideMixin import ShowHideMixin | ||||
| from .ExceptionHookMixin import ExceptionHookMixin | ||||
| from .UIMixin import UIMixin | ||||
| @@ -16,24 +16,6 @@ from . import WidgetMixin | ||||
| class TabMixin(WidgetMixin): | ||||
|     """docstring for TabMixin""" | ||||
| 
 | ||||
|     def create_tab_from_ipc(data): | ||||
|         self, path = data | ||||
|         wid, tid   = self.window_controller.get_active_data() | ||||
|         notebook   = self.builder.get_object(f"window_{wid}") | ||||
|         if notebook.is_visible(): | ||||
|             self.create_tab(wid, path) | ||||
|             return | ||||
| 
 | ||||
|         if not self.is_pane4_hidden: | ||||
|             self.create_tab(4, path) | ||||
|         elif not self.is_pane3_hidden: | ||||
|             self.create_tab(3, path) | ||||
|         elif not self.is_pane2_hidden: | ||||
|             self.create_tab(2, path) | ||||
|         elif not self.is_pane1_hidden: | ||||
|             self.create_tab(1, path) | ||||
| 
 | ||||
| 
 | ||||
|     def create_tab(self, wid, path=None): | ||||
|         notebook    = self.builder.get_object(f"window_{wid}") | ||||
|         path_entry  = self.builder.get_object(f"path_entry") | ||||
| @@ -4,7 +4,7 @@ import os | ||||
| # Lib imports | ||||
| import gi | ||||
| gi.require_version('Gtk', '3.0') | ||||
| from gi.repository import Gtk, GObject, Gio | ||||
| from gi.repository import Gtk, GObject, GLib, Gio | ||||
| 
 | ||||
| # Application imports | ||||
| 
 | ||||
| @@ -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) | ||||
| 
 | ||||
| @@ -239,12 +239,12 @@ class WidgetFileActionMixin: | ||||
|             else:                # Create Folder | ||||
|                 self.handle_files([path], "create_dir") | ||||
| 
 | ||||
|         fname_field.set_text("") | ||||
|         self.hide_new_file_menu() | ||||
| 
 | ||||
|     def move_files(self, files, target): | ||||
|         self.handle_files(files, "move", target) | ||||
| 
 | ||||
|     # NOTE: Gtk recommends using fail flow than pre check existence which is more | ||||
|     # NOTE: Gtk recommends using fail flow than pre check which is more | ||||
|     #       race condition proof. They're right; but, they can't even delete | ||||
|     #       directories properly. So... f**k them. I'll do it my way. | ||||
|     def handle_files(self, paths, action, _target_path=None): | ||||
| @@ -273,8 +273,7 @@ class WidgetFileActionMixin: | ||||
| 
 | ||||
|                 if _file.query_exists(): | ||||
|                     if not overwrite_all and not rename_auto_all: | ||||
|                         self.exists_file_label.set_label(_file.get_basename()) | ||||
|                         self.exists_file_field.set_text(_file.get_basename()) | ||||
|                         self.setup_exists_data(file, _file) | ||||
|                         response = self.show_exists_page() | ||||
| 
 | ||||
|                     if response == "overwrite_all": | ||||
| @@ -344,6 +343,45 @@ class WidgetFileActionMixin: | ||||
|         self.exists_file_rename_bttn.set_sensitive(False) | ||||
| 
 | ||||
| 
 | ||||
|     def setup_exists_data(self, from_file, to_file): | ||||
|         from_info             = from_file.query_info("standard::*,time::modified", 0, cancellable=None) | ||||
|         to_info               = to_file.query_info("standard::*,time::modified", 0, cancellable=None) | ||||
|         exists_file_diff_from = self.builder.get_object("exists_file_diff_from") | ||||
|         exists_file_diff_to   = self.builder.get_object("exists_file_diff_to") | ||||
|         exists_file_from      = self.builder.get_object("exists_file_from") | ||||
|         exists_file_to        = self.builder.get_object("exists_file_to") | ||||
|         from_date             = from_info.get_modification_date_time() | ||||
|         to_date               = to_info.get_modification_date_time() | ||||
|         from_size             = from_info.get_size() | ||||
|         to_size               = to_info.get_size() | ||||
| 
 | ||||
|         exists_file_from.set_label(from_file.get_parent().get_path()) | ||||
|         exists_file_to.set_label(to_file.get_parent().get_path()) | ||||
|         self.exists_file_label.set_label(to_file.get_basename()) | ||||
|         self.exists_file_field.set_text(to_file.get_basename()) | ||||
| 
 | ||||
|         # Returns: -1, 0 or 1 if dt1 is less than, equal to or greater than dt2. | ||||
|         age       = GLib.DateTime.compare(from_date, to_date) | ||||
|         age_text  = "( same time )" | ||||
|         if age == -1: | ||||
|             age_text = "older" | ||||
|         if age == 1: | ||||
|             age_text = "newer" | ||||
| 
 | ||||
|         size_text = "( same size )" | ||||
|         if from_size < to_size: | ||||
|             size_text = "smaller" | ||||
|         if from_size > to_size: | ||||
|             size_text = "larger" | ||||
| 
 | ||||
|         from_label_text = f"{age_text} & {size_text}" | ||||
|         if age_text != "( same time )" or size_text != "( same size )": | ||||
|             from_label_text = f"{from_date.format('%F %R')}     {self.sizeof_fmt(from_size)}     ( {from_size} bytes )  ( {age_text} & {size_text} )" | ||||
|         to_label_text = f"{to_date.format('%F %R')}     {self.sizeof_fmt(to_size)}     ( {to_size} bytes )" | ||||
| 
 | ||||
|         exists_file_diff_from.set_text(from_label_text) | ||||
|         exists_file_diff_to.set_text(to_label_text) | ||||
| 
 | ||||
| 
 | ||||
|     def rename_proc(self, gio_file): | ||||
|         full_path = gio_file.get_path() | ||||
| @@ -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) | ||||
| @@ -136,6 +138,7 @@ class WidgetMixin: | ||||
|         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 +157,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() | ||||
| @@ -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) | ||||
| @@ -0,0 +1,5 @@ | ||||
| from .PaneMixin    import PaneMixin | ||||
| from .WidgetMixin  import WidgetMixin | ||||
| from .TabMixin     import TabMixin | ||||
| from .WindowMixin import WindowMixin | ||||
| from .WidgetFileActionMixin import WidgetFileActionMixin | ||||
| @@ -0,0 +1,27 @@ | ||||
| # Python imports | ||||
|  | ||||
| # Lib imports | ||||
|  | ||||
| # Application imports | ||||
|  | ||||
|  | ||||
| class IPCSignalsMixin: | ||||
|     def print_to_console(self, message=None): | ||||
|         print(self) | ||||
|         print(message) | ||||
|  | ||||
|     def handle_file_from_ipc(self, path): | ||||
|         wid, tid   = self.window_controller.get_active_data() | ||||
|         notebook   = self.builder.get_object(f"window_{wid}") | ||||
|         if notebook.is_visible(): | ||||
|             self.create_tab(wid, path) | ||||
|             return | ||||
|  | ||||
|         if not self.is_pane4_hidden: | ||||
|             self.create_tab(4, path) | ||||
|         elif not self.is_pane3_hidden: | ||||
|             self.create_tab(3, path) | ||||
|         elif not self.is_pane2_hidden: | ||||
|             self.create_tab(2, path) | ||||
|         elif not self.is_pane1_hidden: | ||||
|             self.create_tab(1, path) | ||||
| @@ -0,0 +1,2 @@ | ||||
| from .KeyboardSignalsMixin import KeyboardSignalsMixin | ||||
| from .IPCSignalsMixin import IPCSignalsMixin | ||||
| @@ -0,0 +1,91 @@ | ||||
| # Python imports | ||||
| import os, importlib | ||||
| from os.path import join, isdir | ||||
|  | ||||
| # Lib imports | ||||
| import gi | ||||
| gi.require_version('Gtk', '3.0') | ||||
| from gi.repository import Gtk, Gio | ||||
|  | ||||
| # Application imports | ||||
|  | ||||
|  | ||||
| class Plugin: | ||||
|     name          = None | ||||
|     module        = None | ||||
|     gtk_socket_id = None | ||||
|     gtk_socket    = None | ||||
|     reference     = None | ||||
|  | ||||
|  | ||||
| class Plugins: | ||||
|     """docstring for Plugins""" | ||||
|     def __init__(self, settings): | ||||
|         self._settings            = settings | ||||
|         self._plugin_list_widget  = self._settings.get_builder().get_object("plugin_list") | ||||
|         self._plugin_list_socket  = self._settings.get_builder().get_object("plugin_socket") | ||||
|         self._plugins_path        = self._settings.get_plugins_path() | ||||
|         self._plugins_dir_watcher = None | ||||
|         self._plugin_collection   = [] | ||||
|  | ||||
|  | ||||
|     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.reload_plugins(file) | ||||
|  | ||||
|     # @threaded | ||||
|     def load_plugins(self, file=None): | ||||
|         print(f"Loading plugins...") | ||||
|         for file in os.listdir(self._plugins_path): | ||||
|             try: | ||||
|                 path = join(self._plugins_path, file) | ||||
|                 if isdir(path): | ||||
|                     gtk_socket    = Gtk.Socket().new() | ||||
|                     self._plugin_list_socket.add(gtk_socket) | ||||
|                     # NOTE: Must get ID after adding socket to window. Else issues.... | ||||
|                     gtk_socket_id = gtk_socket.get_id() | ||||
|  | ||||
|                     spec          = importlib.util.spec_from_file_location(file, join(path, "__main__.py")) | ||||
|                     module        = importlib.util.module_from_spec(spec) | ||||
|                     spec.loader.exec_module(module) | ||||
|  | ||||
|                     ref                  = module.Main(gtk_socket_id, event_system) | ||||
|                     plugin               = Plugin() | ||||
|                     plugin.name          = ref.get_plugin_name() | ||||
|                     plugin.module        = path | ||||
|                     plugin.gtk_socket_id = gtk_socket_id | ||||
|                     plugin.gtk_socket    = gtk_socket | ||||
|                     plugin.reference     = ref | ||||
|  | ||||
|                     self._plugin_collection.append(plugin) | ||||
|                     gtk_socket.show_all() | ||||
|             except Exception as e: | ||||
|                 print("Malformed plugin! Not loading!") | ||||
|                 print(repr(e)) | ||||
|  | ||||
|  | ||||
|     def reload_plugins(self, file=None): | ||||
|         print(f"Reloading plugins...") | ||||
|         # if self._plugin_collection: | ||||
|         #     to_unload = [] | ||||
|         #     for dir in self._plugin_collection: | ||||
|         #         if not os.path.isdir(os.path.join(self._plugins_path, dir)): | ||||
|         #             to_unload.append(dir) | ||||
|  | ||||
|     def set_message_on_plugin(self, type, data): | ||||
|         print("Trying to send message to plugin...") | ||||
|         for plugin in self._plugin_collection: | ||||
|             if type in plugin.name: | ||||
|                 print('Found plugin; posting message...') | ||||
|                 plugin.reference.set_message(data) | ||||
| @@ -0,0 +1,4 @@ | ||||
| """ | ||||
|     Gtk Bound Plugins Module | ||||
| """ | ||||
| from .Plugins import Plugins | ||||
| @@ -24,13 +24,15 @@ 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): | ||||
|         while True: | ||||
|             time.sleep(event_sleep_time) | ||||
|             event = event_system.consume_fm_event() | ||||
|             event = event_system.consume_module_event() | ||||
|             if event: | ||||
|                 print(event) | ||||
|  | ||||
| @@ -149,7 +151,10 @@ class WindowController: | ||||
|  | ||||
|  | ||||
|  | ||||
|     def save_state(self): | ||||
|     def save_state(self, session_file = None): | ||||
|         if not session_file: | ||||
|             session_file = self.session_file | ||||
|  | ||||
|         windows = [] | ||||
|         for window in self.windows: | ||||
|             views = [] | ||||
| @@ -170,10 +175,13 @@ class WindowController: | ||||
|                 ] | ||||
|             ) | ||||
|  | ||||
|         with open(self.session_file, 'w') as outfile: | ||||
|         with open(session_file, 'w') as outfile: | ||||
|             json.dump(windows, outfile, separators=(',', ':'), indent=4) | ||||
|  | ||||
|     def load_state(self): | ||||
|         if path.isfile(self.session_file): | ||||
|             with open(self.session_file) as infile: | ||||
|     def load_state(self, session_file = None): | ||||
|         if not session_file: | ||||
|             session_file = self.session_file | ||||
|  | ||||
|         if path.isfile(session_file): | ||||
|             with open(session_file) as infile: | ||||
|                 return json.load(infile) | ||||
|   | ||||
| @@ -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(): | ||||
|   | ||||
| @@ -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): | ||||
|   | ||||
| @@ -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) ) | ||||
|   | ||||
| @@ -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() | ||||
|   | ||||
| @@ -1,166 +0,0 @@ | ||||
| # Python imports | ||||
| import sys, traceback, threading, signal, inspect, os, time | ||||
|  | ||||
| # Lib imports | ||||
| import gi | ||||
| gi.require_version('Gtk', '3.0') | ||||
| from gi.repository import Gtk, GLib | ||||
|  | ||||
| # Application imports | ||||
| from .mixins import * | ||||
| from . import ShowHideMixin, KeyboardSignalsMixin, Controller_Data | ||||
|  | ||||
|  | ||||
| def threaded(fn): | ||||
|     def wrapper(*args, **kwargs): | ||||
|         threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=True).start() | ||||
|     return wrapper | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| 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.window.show() | ||||
|         self.generate_windows(self.state) | ||||
|  | ||||
|         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 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) | ||||
|  | ||||
|  | ||||
|     def tear_down(self, widget=None, eve=None): | ||||
|         event_system.send_ipc_message("close server") | ||||
|         self.window_controller.save_state() | ||||
|         time.sleep(event_sleep_time) | ||||
|         Gtk.main_quit() | ||||
|  | ||||
|  | ||||
|     @threaded | ||||
|     def gui_event_observer(self): | ||||
|         while True: | ||||
|             time.sleep(event_sleep_time) | ||||
|             event = event_system.consume_gui_event() | ||||
|             if event: | ||||
|                 try: | ||||
|                     type, target, data = event | ||||
|                     method = getattr(self.__class__, type) | ||||
|                     GLib.idle_add(method, (self, data,)) | ||||
|                 except Exception as e: | ||||
|                     print(repr(e)) | ||||
|  | ||||
|  | ||||
|     def custom_except_hook(self, exctype, value, _traceback): | ||||
|         trace     = ''.join(traceback.format_tb(_traceback)) | ||||
|         data      = f"Exectype:  {exctype}  <-->  Value:  {value}\n\n{trace}\n\n\n\n" | ||||
|         start_itr = self.message_buffer.get_start_iter() | ||||
|         self.message_buffer.place_cursor(start_itr) | ||||
|         self.display_message(self.error, data) | ||||
|  | ||||
|     def display_message(self, type, text, seconds=None): | ||||
|         self.message_buffer.insert_at_cursor(text) | ||||
|         self.message_widget.popup() | ||||
|         if seconds: | ||||
|             self.hide_message_timeout(seconds) | ||||
|  | ||||
|     @threaded | ||||
|     def hide_message_timeout(self, seconds=3): | ||||
|         time.sleep(seconds) | ||||
|         GLib.idle_add(self.message_widget.popdown) | ||||
|  | ||||
|     def save_debug_alerts(self, widget=None, eve=None): | ||||
|         start_itr, end_itr   = self.message_buffer.get_bounds() | ||||
|         save_location_prompt = Gtk.FileChooserDialog("Choose Save Folder", self.window, \ | ||||
|                                                         action  = Gtk.FileChooserAction.SAVE, \ | ||||
|                                                         buttons = (Gtk.STOCK_CANCEL, \ | ||||
|                                                                     Gtk.ResponseType.CANCEL, \ | ||||
|                                                                     Gtk.STOCK_SAVE, \ | ||||
|                                                                     Gtk.ResponseType.OK)) | ||||
|  | ||||
|         text = self.message_buffer.get_text(start_itr, end_itr, False) | ||||
|         resp = save_location_prompt.run() | ||||
|         if (resp == Gtk.ResponseType.CANCEL) or (resp == Gtk.ResponseType.DELETE_EVENT): | ||||
|             pass | ||||
|         elif resp == Gtk.ResponseType.OK: | ||||
|             target = save_location_prompt.get_filename(); | ||||
|             with open(target, "w") as f: | ||||
|                 f.write(text) | ||||
|  | ||||
|         save_location_prompt.destroy() | ||||
|  | ||||
|  | ||||
|     def set_arc_buffer_text(self, widget=None, eve=None): | ||||
|         id = widget.get_active_id() | ||||
|         self.arc_command_buffer.set_text(self.arc_commands[int(id)]) | ||||
|  | ||||
|  | ||||
|     def clear_children(self, widget): | ||||
|         for child in widget.get_children(): | ||||
|             widget.remove(child) | ||||
|  | ||||
|     def get_current_state(self): | ||||
|         wid, tid     = self.window_controller.get_active_data() | ||||
|         view         = self.get_fm_window(wid).get_view_by_id(tid) | ||||
|         iconview     = self.builder.get_object(f"{wid}|{tid}|iconview") | ||||
|         store        = iconview.get_model() | ||||
|         return wid, tid, view, iconview, store | ||||
|  | ||||
|     def do_action_from_menu_controls(self, widget, eventbutton): | ||||
|         action        = widget.get_name() | ||||
|         self.ctrlDown = True | ||||
|         self.hide_context_menu() | ||||
|         self.hide_new_file_menu() | ||||
|         self.hide_edit_file_menu() | ||||
|  | ||||
|         if action == "open": | ||||
|             self.open_files() | ||||
|         if action == "open_with": | ||||
|             self.show_appchooser_menu() | ||||
|         if action == "execute": | ||||
|             self.execute_files() | ||||
|         if action == "execute_in_terminal": | ||||
|             self.execute_files(in_terminal=True) | ||||
|         if action == "rename": | ||||
|             self.rename_files() | ||||
|         if action == "cut": | ||||
|             self.to_copy_files.clear() | ||||
|             self.cut_files() | ||||
|         if action == "copy": | ||||
|             self.to_cut_files.clear() | ||||
|             self.copy_files() | ||||
|         if action == "paste": | ||||
|             self.paste_files() | ||||
|         if action == "archive": | ||||
|             self.show_archiver_dialogue() | ||||
|         if action == "delete": | ||||
|             self.delete_files() | ||||
|         if action == "trash": | ||||
|             self.trash_files() | ||||
|         if action == "go_to_trash": | ||||
|             self.builder.get_object("path_entry").set_text(self.trash_files_path) | ||||
|         if action == "restore_from_trash": | ||||
|             self.restore_trash_files() | ||||
|         if action == "empty_trash": | ||||
|             self.empty_trash() | ||||
|  | ||||
|  | ||||
|         if action == "create": | ||||
|             self.create_files() | ||||
|             self.hide_new_file_menu() | ||||
|  | ||||
|         self.ctrlDown = False | ||||
| @@ -1,9 +0,0 @@ | ||||
| """ | ||||
|     Gtk Bound Signal Module | ||||
| """ | ||||
| from .mixins import * | ||||
| from .DBusControllerMixin import DBusControllerMixin | ||||
| from .KeyboardSignalsMixin import KeyboardSignalsMixin | ||||
| from .ShowHideMixin import ShowHideMixin | ||||
| from .Controller_Data import Controller_Data | ||||
| from .Controller import Controller | ||||
| @@ -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) | ||||
|   | ||||
| @@ -17,65 +17,68 @@ 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.CSS_FILE      = 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.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" | ||||
|         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.CSS_FILE): | ||||
|             self.CSS_FILE      = f"{self.USR_SOLARFM}/stylesheet.css" | ||||
|         if not os.path.exists(self.WINDOW_ICON): | ||||
|             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.builder.add_from_file(self.windows_glade) | ||||
|         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): | ||||
|         self.main_window.set_icon_from_file(self.window_icon) | ||||
|     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() | ||||
|  | ||||
|         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() | ||||
|         cssProvider.load_from_path(self.cssFile) | ||||
|         cssProvider.load_from_path(self.CSS_FILE) | ||||
|         screen       = gdk.Screen.get_default() | ||||
|         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 | ||||
|   | ||||
| @@ -644,10 +644,36 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe | ||||
|             <property name="can-focus">False</property> | ||||
|             <property name="layout-style">end</property> | ||||
|             <child> | ||||
|               <placeholder/> | ||||
|               <object class="GtkButton" id="button10"> | ||||
|                 <property name="label" translatable="yes">Create</property> | ||||
|                 <property name="name">create</property> | ||||
|                 <property name="visible">True</property> | ||||
|                 <property name="can-focus">True</property> | ||||
|                 <property name="receives-default">True</property> | ||||
|                 <property name="tooltip-text" translatable="yes">Create File/Folder...</property> | ||||
|                 <property name="image">createImage</property> | ||||
|                 <property name="always-show-image">True</property> | ||||
|               </object> | ||||
|               <packing> | ||||
|                 <property name="expand">False</property> | ||||
|                 <property name="fill">True</property> | ||||
|                 <property name="position">0</property> | ||||
|               </packing> | ||||
|             </child> | ||||
|             <child> | ||||
|               <placeholder/> | ||||
|               <object class="GtkButton" id="button9"> | ||||
|                 <property name="label">gtk-cancel</property> | ||||
|                 <property name="visible">True</property> | ||||
|                 <property name="can-focus">True</property> | ||||
|                 <property name="receives-default">True</property> | ||||
|                 <property name="use-stock">True</property> | ||||
|                 <property name="always-show-image">True</property> | ||||
|               </object> | ||||
|               <packing> | ||||
|                 <property name="expand">True</property> | ||||
|                 <property name="fill">True</property> | ||||
|                 <property name="position">1</property> | ||||
|               </packing> | ||||
|             </child> | ||||
|           </object> | ||||
|           <packing> | ||||
| @@ -723,7 +749,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe | ||||
|                   </object> | ||||
|                   <packing> | ||||
|                     <property name="expand">False</property> | ||||
|                     <property name="fill">True</property> | ||||
|                     <property name="fill">False</property> | ||||
|                     <property name="position">0</property> | ||||
|                   </packing> | ||||
|                 </child> | ||||
| @@ -740,40 +766,26 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe | ||||
|                     <property name="position">1</property> | ||||
|                   </packing> | ||||
|                 </child> | ||||
|                 <child> | ||||
|                   <object class="GtkButton"> | ||||
|                     <property name="label" translatable="yes">Create</property> | ||||
|                     <property name="name">create</property> | ||||
|                     <property name="visible">True</property> | ||||
|                     <property name="can-focus">True</property> | ||||
|                     <property name="receives-default">True</property> | ||||
|                     <property name="tooltip-text" translatable="yes">Create File/Folder...</property> | ||||
|                     <property name="image">createImage</property> | ||||
|                     <property name="always-show-image">True</property> | ||||
|                     <signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/> | ||||
|                   </object> | ||||
|                   <packing> | ||||
|                     <property name="expand">False</property> | ||||
|                     <property name="fill">True</property> | ||||
|                     <property name="position">2</property> | ||||
|                   </packing> | ||||
|                 </child> | ||||
|               </object> | ||||
|               <packing> | ||||
|                 <property name="expand">True</property> | ||||
|                 <property name="expand">False</property> | ||||
|                 <property name="fill">True</property> | ||||
|                 <property name="position">1</property> | ||||
|               </packing> | ||||
|             </child> | ||||
|           </object> | ||||
|           <packing> | ||||
|             <property name="expand">True</property> | ||||
|             <property name="expand">False</property> | ||||
|             <property name="fill">True</property> | ||||
|             <property name="position">1</property> | ||||
|           </packing> | ||||
|         </child> | ||||
|       </object> | ||||
|     </child> | ||||
|     <action-widgets> | ||||
|       <action-widget response="-10">button10</action-widget> | ||||
|       <action-widget response="-6">button9</action-widget> | ||||
|     </action-widgets> | ||||
|   </object> | ||||
|   <object class="GtkImage" id="exec_in_term_img"> | ||||
|     <property name="visible">True</property> | ||||
| @@ -891,6 +903,103 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe | ||||
|               <object class="GtkBox"> | ||||
|                 <property name="visible">True</property> | ||||
|                 <property name="can-focus">False</property> | ||||
|                 <property name="margin-top">15</property> | ||||
|                 <property name="margin-bottom">10</property> | ||||
|                 <child> | ||||
|                   <object class="GtkLabel"> | ||||
|                     <property name="visible">True</property> | ||||
|                     <property name="can-focus">False</property> | ||||
|                     <property name="label" translatable="yes">Moving From:</property> | ||||
|                   </object> | ||||
|                   <packing> | ||||
|                     <property name="expand">False</property> | ||||
|                     <property name="fill">True</property> | ||||
|                     <property name="position">0</property> | ||||
|                   </packing> | ||||
|                 </child> | ||||
|                 <child> | ||||
|                   <object class="GtkLabel" id="exists_file_from"> | ||||
|                     <property name="visible">True</property> | ||||
|                     <property name="can-focus">False</property> | ||||
|                   </object> | ||||
|                   <packing> | ||||
|                     <property name="expand">True</property> | ||||
|                     <property name="fill">True</property> | ||||
|                     <property name="position">1</property> | ||||
|                   </packing> | ||||
|                 </child> | ||||
|               </object> | ||||
|               <packing> | ||||
|                 <property name="expand">False</property> | ||||
|                 <property name="fill">True</property> | ||||
|                 <property name="position">1</property> | ||||
|               </packing> | ||||
|             </child> | ||||
|             <child> | ||||
|               <object class="GtkLabel" id="exists_file_diff_from"> | ||||
|                 <property name="visible">True</property> | ||||
|                 <property name="can-focus">False</property> | ||||
|                 <property name="xalign">0</property> | ||||
|               </object> | ||||
|               <packing> | ||||
|                 <property name="expand">True</property> | ||||
|                 <property name="fill">True</property> | ||||
|                 <property name="position">2</property> | ||||
|               </packing> | ||||
|             </child> | ||||
|             <child> | ||||
|               <object class="GtkBox"> | ||||
|                 <property name="visible">True</property> | ||||
|                 <property name="can-focus">False</property> | ||||
|                 <property name="margin-top">20</property> | ||||
|                 <property name="margin-bottom">10</property> | ||||
|                 <child> | ||||
|                   <object class="GtkLabel"> | ||||
|                     <property name="visible">True</property> | ||||
|                     <property name="can-focus">False</property> | ||||
|                     <property name="label" translatable="yes">Moving To:</property> | ||||
|                   </object> | ||||
|                   <packing> | ||||
|                     <property name="expand">False</property> | ||||
|                     <property name="fill">True</property> | ||||
|                     <property name="position">0</property> | ||||
|                   </packing> | ||||
|                 </child> | ||||
|                 <child> | ||||
|                   <object class="GtkLabel" id="exists_file_to"> | ||||
|                     <property name="visible">True</property> | ||||
|                     <property name="can-focus">False</property> | ||||
|                   </object> | ||||
|                   <packing> | ||||
|                     <property name="expand">True</property> | ||||
|                     <property name="fill">True</property> | ||||
|                     <property name="position">1</property> | ||||
|                   </packing> | ||||
|                 </child> | ||||
|               </object> | ||||
|               <packing> | ||||
|                 <property name="expand">False</property> | ||||
|                 <property name="fill">True</property> | ||||
|                 <property name="position">3</property> | ||||
|               </packing> | ||||
|             </child> | ||||
|             <child> | ||||
|               <object class="GtkLabel" id="exists_file_diff_to"> | ||||
|                 <property name="visible">True</property> | ||||
|                 <property name="can-focus">False</property> | ||||
|                 <property name="xalign">0</property> | ||||
|               </object> | ||||
|               <packing> | ||||
|                 <property name="expand">True</property> | ||||
|                 <property name="fill">True</property> | ||||
|                 <property name="position">4</property> | ||||
|               </packing> | ||||
|             </child> | ||||
|             <child> | ||||
|               <object class="GtkBox"> | ||||
|                 <property name="visible">True</property> | ||||
|                 <property name="can-focus">False</property> | ||||
|                 <property name="margin-top">20</property> | ||||
|                 <child> | ||||
|                   <object class="GtkLabel"> | ||||
|                     <property name="visible">True</property> | ||||
| @@ -918,12 +1027,9 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe | ||||
|               <packing> | ||||
|                 <property name="expand">False</property> | ||||
|                 <property name="fill">True</property> | ||||
|                 <property name="position">1</property> | ||||
|                 <property name="position">5</property> | ||||
|               </packing> | ||||
|             </child> | ||||
|             <child> | ||||
|               <placeholder/> | ||||
|             </child> | ||||
|             <child> | ||||
|               <object class="GtkEntry" id="exists_file_field"> | ||||
|                 <property name="visible">True</property> | ||||
| @@ -933,7 +1039,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe | ||||
|               <packing> | ||||
|                 <property name="expand">False</property> | ||||
|                 <property name="fill">True</property> | ||||
|                 <property name="position">3</property> | ||||
|                 <property name="position">6</property> | ||||
|               </packing> | ||||
|             </child> | ||||
|             <child> | ||||
| @@ -996,7 +1102,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe | ||||
|               <packing> | ||||
|                 <property name="expand">False</property> | ||||
|                 <property name="fill">True</property> | ||||
|                 <property name="position">4</property> | ||||
|                 <property name="position">7</property> | ||||
|               </packing> | ||||
|             </child> | ||||
|           </object> | ||||
| @@ -1019,65 +1125,21 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe | ||||
|     </style> | ||||
|   </object> | ||||
|   <object class="GtkImage" id="image1"> | ||||
|     <property name="visible">True</property> | ||||
|     <property name="can-focus">False</property> | ||||
|     <property name="stock">gtk-save-as</property> | ||||
|   </object> | ||||
|   <object class="GtkImage" id="image2"> | ||||
|     <property name="visible">True</property> | ||||
|     <property name="can-focus">False</property> | ||||
|     <property name="stock">gtk-file</property> | ||||
|   </object> | ||||
|   <object class="GtkImage" id="image3"> | ||||
|     <property name="visible">True</property> | ||||
|     <property name="can-focus">False</property> | ||||
|     <property name="stock">gtk-justify-center</property> | ||||
|   </object> | ||||
|   <object class="GtkTextBuffer" id="message_buffer"/> | ||||
|   <object class="GtkPopover" id="message_widget"> | ||||
|     <property name="width-request">320</property> | ||||
|     <property name="can-focus">False</property> | ||||
|     <property name="hexpand">True</property> | ||||
|     <property name="position">bottom</property> | ||||
|     <child> | ||||
|       <object class="GtkBox"> | ||||
|         <property name="visible">True</property> | ||||
|         <property name="can-focus">False</property> | ||||
|         <property name="orientation">vertical</property> | ||||
|         <child> | ||||
|           <object class="GtkButton"> | ||||
|             <property name="label">gtk-save-as</property> | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can-focus">True</property> | ||||
|             <property name="receives-default">True</property> | ||||
|             <property name="use-stock">True</property> | ||||
|             <signal name="button-release-event" handler="save_debug_alerts" swapped="no"/> | ||||
|           </object> | ||||
|           <packing> | ||||
|             <property name="expand">False</property> | ||||
|             <property name="fill">True</property> | ||||
|             <property name="position">0</property> | ||||
|           </packing> | ||||
|         </child> | ||||
|         <child> | ||||
|           <object class="GtkScrolledWindow"> | ||||
|             <property name="height-request">600</property> | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can-focus">True</property> | ||||
|             <property name="hexpand">True</property> | ||||
|             <property name="shadow-type">in</property> | ||||
|             <property name="overlay-scrolling">False</property> | ||||
|             <child> | ||||
|               <object class="GtkTextView" id="message_view"> | ||||
|                 <property name="name">message_view</property> | ||||
|                 <property name="visible">True</property> | ||||
|                 <property name="can-focus">True</property> | ||||
|                 <property name="hexpand">True</property> | ||||
|                 <property name="editable">False</property> | ||||
|                 <property name="cursor-visible">False</property> | ||||
|                 <property name="buffer">message_buffer</property> | ||||
|               </object> | ||||
|             </child> | ||||
|           </object> | ||||
|           <packing> | ||||
|             <property name="expand">False</property> | ||||
|             <property name="fill">True</property> | ||||
|             <property name="position">1</property> | ||||
|           </packing> | ||||
|         </child> | ||||
|       </object> | ||||
|     </child> | ||||
|   </object> | ||||
|   <object class="GtkImage" id="open_with_img"> | ||||
|     <property name="visible">True</property> | ||||
|     <property name="can-focus">False</property> | ||||
| @@ -1094,6 +1156,64 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe | ||||
|     <property name="can-focus">False</property> | ||||
|     <property name="stock">gtk-edit</property> | ||||
|   </object> | ||||
|   <object class="GtkFileChooserDialog" id="save_load_dialog"> | ||||
|     <property name="can-focus">False</property> | ||||
|     <property name="type-hint">dialog</property> | ||||
|     <property name="do-overwrite-confirmation">True</property> | ||||
|     <child internal-child="vbox"> | ||||
|       <object class="GtkBox"> | ||||
|         <property name="can-focus">False</property> | ||||
|         <property name="orientation">vertical</property> | ||||
|         <property name="spacing">2</property> | ||||
|         <child internal-child="action_area"> | ||||
|           <object class="GtkButtonBox"> | ||||
|             <property name="can-focus">False</property> | ||||
|             <property name="layout-style">end</property> | ||||
|             <child> | ||||
|               <object class="GtkButton" id="button11"> | ||||
|                 <property name="label">gtk-cancel</property> | ||||
|                 <property name="visible">True</property> | ||||
|                 <property name="can-focus">True</property> | ||||
|                 <property name="receives-default">True</property> | ||||
|                 <property name="use-stock">True</property> | ||||
|               </object> | ||||
|               <packing> | ||||
|                 <property name="expand">True</property> | ||||
|                 <property name="fill">True</property> | ||||
|                 <property name="position">0</property> | ||||
|               </packing> | ||||
|             </child> | ||||
|             <child> | ||||
|               <object class="GtkButton" id="button12"> | ||||
|                 <property name="label">gtk-ok</property> | ||||
|                 <property name="visible">True</property> | ||||
|                 <property name="can-focus">True</property> | ||||
|                 <property name="receives-default">True</property> | ||||
|                 <property name="use-stock">True</property> | ||||
|               </object> | ||||
|               <packing> | ||||
|                 <property name="expand">True</property> | ||||
|                 <property name="fill">True</property> | ||||
|                 <property name="position">1</property> | ||||
|               </packing> | ||||
|             </child> | ||||
|           </object> | ||||
|           <packing> | ||||
|             <property name="expand">False</property> | ||||
|             <property name="fill">False</property> | ||||
|             <property name="position">0</property> | ||||
|           </packing> | ||||
|         </child> | ||||
|         <child> | ||||
|           <placeholder/> | ||||
|         </child> | ||||
|       </object> | ||||
|     </child> | ||||
|     <action-widgets> | ||||
|       <action-widget response="-6">button11</action-widget> | ||||
|       <action-widget response="-5">button12</action-widget> | ||||
|     </action-widgets> | ||||
|   </object> | ||||
|   <object class="GtkImage" id="skip_img"> | ||||
|     <property name="visible">True</property> | ||||
|     <property name="can-focus">False</property> | ||||
| @@ -1291,7 +1411,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can-focus">False</property> | ||||
|             <child> | ||||
|               <object class="GtkMenuBar"> | ||||
|               <object class="GtkMenuBar" id="menubar1"> | ||||
|                 <property name="visible">True</property> | ||||
|                 <property name="can-focus">False</property> | ||||
|                 <child> | ||||
| @@ -1307,19 +1427,25 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe | ||||
|                         <child> | ||||
|                           <object class="GtkImageMenuItem"> | ||||
|                             <property name="label">gtk-new</property> | ||||
|                             <property name="name">create</property> | ||||
|                             <property name="visible">True</property> | ||||
|                             <property name="can-focus">False</property> | ||||
|                             <property name="tooltip-text" translatable="yes">New File/Folder...</property> | ||||
|                             <property name="use-underline">True</property> | ||||
|                             <property name="use-stock">True</property> | ||||
|                             <signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/> | ||||
|                           </object> | ||||
|                         </child> | ||||
|                         <child> | ||||
|                           <object class="GtkImageMenuItem"> | ||||
|                             <property name="label">gtk-open</property> | ||||
|                             <property name="name">open</property> | ||||
|                             <property name="visible">True</property> | ||||
|                             <property name="can-focus">False</property> | ||||
|                             <property name="tooltip-text" translatable="yes">Open...</property> | ||||
|                             <property name="use-underline">True</property> | ||||
|                             <property name="use-stock">True</property> | ||||
|                             <signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/> | ||||
|                           </object> | ||||
|                         </child> | ||||
|                         <child> | ||||
| @@ -1328,6 +1454,53 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe | ||||
|                             <property name="can-focus">False</property> | ||||
|                           </object> | ||||
|                         </child> | ||||
|                         <child> | ||||
|                           <object class="GtkImageMenuItem"> | ||||
|                             <property name="label">Save Session</property> | ||||
|                             <property name="name">save_session</property> | ||||
|                             <property name="visible">True</property> | ||||
|                             <property name="can-focus">False</property> | ||||
|                             <property name="tooltip-text" translatable="yes">New File/Folder...</property> | ||||
|                             <property name="image">image1</property> | ||||
|                             <property name="use-stock">False</property> | ||||
|                             <signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/> | ||||
|                           </object> | ||||
|                         </child> | ||||
|                         <child> | ||||
|                           <object class="GtkImageMenuItem"> | ||||
|                             <property name="label">Load Session</property> | ||||
|                             <property name="name">load_session</property> | ||||
|                             <property name="visible">True</property> | ||||
|                             <property name="can-focus">False</property> | ||||
|                             <property name="tooltip-text" translatable="yes">New File/Folder...</property> | ||||
|                             <property name="image">image2</property> | ||||
|                             <property name="use-stock">False</property> | ||||
|                             <signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/> | ||||
|                           </object> | ||||
|                         </child> | ||||
|                         <child> | ||||
|                           <object class="GtkMenuItem"> | ||||
|                             <property name="visible">True</property> | ||||
|                             <property name="can-focus">False</property> | ||||
|                             <property name="label" translatable="yes">Debug</property> | ||||
|                             <child type="submenu"> | ||||
|                               <object class="GtkMenu"> | ||||
|                                 <property name="visible">True</property> | ||||
|                                 <property name="can-focus">False</property> | ||||
|                                 <child> | ||||
|                                   <object class="GtkImageMenuItem"> | ||||
|                                     <property name="label">Show Errors</property> | ||||
|                                     <property name="visible">True</property> | ||||
|                                     <property name="can-focus">False</property> | ||||
|                                     <property name="image">image3</property> | ||||
|                                     <property name="use-stock">False</property> | ||||
|                                     <signal name="button-release-event" handler="show_messages_popup" swapped="no"/> | ||||
|                                   </object> | ||||
|                                 </child> | ||||
|                               </object> | ||||
|                             </child> | ||||
|                           </object> | ||||
|                         </child> | ||||
|                         <child> | ||||
|                           <object class="GtkImageMenuItem"> | ||||
|                             <property name="label">gtk-quit</property> | ||||
| @@ -1424,29 +1597,6 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe | ||||
|                     </child> | ||||
|                   </object> | ||||
|                 </child> | ||||
|                 <child> | ||||
|                   <object class="GtkMenuItem"> | ||||
|                     <property name="visible">True</property> | ||||
|                     <property name="can-focus">False</property> | ||||
|                     <property name="label" translatable="yes">Debug</property> | ||||
|                     <child type="submenu"> | ||||
|                       <object class="GtkMenu"> | ||||
|                         <property name="visible">True</property> | ||||
|                         <property name="can-focus">False</property> | ||||
|                         <child> | ||||
|                           <object class="GtkImageMenuItem"> | ||||
|                             <property name="label">Show Errors</property> | ||||
|                             <property name="visible">True</property> | ||||
|                             <property name="can-focus">False</property> | ||||
|                             <property name="image">image1</property> | ||||
|                             <property name="use-stock">False</property> | ||||
|                             <signal name="button-release-event" handler="show_messages_popup" swapped="no"/> | ||||
|                           </object> | ||||
|                         </child> | ||||
|                       </object> | ||||
|                     </child> | ||||
|                   </object> | ||||
|                 </child> | ||||
|               </object> | ||||
|               <packing> | ||||
|                 <property name="expand">True</property> | ||||
| @@ -1460,6 +1610,20 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe | ||||
|                 <property name="can-focus">False</property> | ||||
|                 <property name="spacing">5</property> | ||||
|                 <property name="layout-style">start</property> | ||||
|                 <child> | ||||
|                   <object class="GtkButton" id="plugins_buttoin"> | ||||
|                     <property name="label" translatable="yes">Plugins</property> | ||||
|                     <property name="visible">True</property> | ||||
|                     <property name="can-focus">True</property> | ||||
|                     <property name="receives-default">True</property> | ||||
|                     <signal name="released" handler="show_plugins_popup" swapped="no"/> | ||||
|                   </object> | ||||
|                   <packing> | ||||
|                     <property name="expand">True</property> | ||||
|                     <property name="fill">True</property> | ||||
|                     <property name="position">0</property> | ||||
|                   </packing> | ||||
|                 </child> | ||||
|                 <child> | ||||
|                   <object class="GtkToggleButton" id="tggl_notebook_1"> | ||||
|                     <property name="name">tggl_notebook_1</property> | ||||
| @@ -1473,7 +1637,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe | ||||
|                   <packing> | ||||
|                     <property name="expand">True</property> | ||||
|                     <property name="fill">True</property> | ||||
|                     <property name="position">0</property> | ||||
|                     <property name="position">1</property> | ||||
|                   </packing> | ||||
|                 </child> | ||||
|                 <child> | ||||
| @@ -1489,7 +1653,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe | ||||
|                   <packing> | ||||
|                     <property name="expand">True</property> | ||||
|                     <property name="fill">True</property> | ||||
|                     <property name="position">1</property> | ||||
|                     <property name="position">2</property> | ||||
|                   </packing> | ||||
|                 </child> | ||||
|                 <child> | ||||
| @@ -1505,7 +1669,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe | ||||
|                   <packing> | ||||
|                     <property name="expand">True</property> | ||||
|                     <property name="fill">True</property> | ||||
|                     <property name="position">2</property> | ||||
|                     <property name="position">3</property> | ||||
|                   </packing> | ||||
|                 </child> | ||||
|                 <child> | ||||
| @@ -1521,7 +1685,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe | ||||
|                   <packing> | ||||
|                     <property name="expand">True</property> | ||||
|                     <property name="fill">True</property> | ||||
|                     <property name="position">3</property> | ||||
|                     <property name="position">4</property> | ||||
|                   </packing> | ||||
|                 </child> | ||||
|               </object> | ||||
| @@ -1897,6 +2061,61 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe | ||||
|       </object> | ||||
|     </child> | ||||
|   </object> | ||||
|   <object class="GtkPopover" id="message_widget"> | ||||
|     <property name="width-request">320</property> | ||||
|     <property name="can-focus">False</property> | ||||
|     <property name="hexpand">True</property> | ||||
|     <property name="relative-to">top_main_menubar</property> | ||||
|     <property name="position">bottom</property> | ||||
|     <child> | ||||
|       <object class="GtkBox"> | ||||
|         <property name="visible">True</property> | ||||
|         <property name="can-focus">False</property> | ||||
|         <property name="orientation">vertical</property> | ||||
|         <child> | ||||
|           <object class="GtkButton"> | ||||
|             <property name="label">gtk-save-as</property> | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can-focus">True</property> | ||||
|             <property name="receives-default">True</property> | ||||
|             <property name="use-stock">True</property> | ||||
|             <signal name="button-release-event" handler="save_debug_alerts" swapped="no"/> | ||||
|           </object> | ||||
|           <packing> | ||||
|             <property name="expand">False</property> | ||||
|             <property name="fill">True</property> | ||||
|             <property name="position">0</property> | ||||
|           </packing> | ||||
|         </child> | ||||
|         <child> | ||||
|           <object class="GtkScrolledWindow"> | ||||
|             <property name="height-request">600</property> | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can-focus">True</property> | ||||
|             <property name="hexpand">True</property> | ||||
|             <property name="shadow-type">in</property> | ||||
|             <property name="overlay-scrolling">False</property> | ||||
|             <child> | ||||
|               <object class="GtkTextView" id="message_view"> | ||||
|                 <property name="name">message_view</property> | ||||
|                 <property name="visible">True</property> | ||||
|                 <property name="can-focus">True</property> | ||||
|                 <property name="hexpand">True</property> | ||||
|                 <property name="editable">False</property> | ||||
|                 <property name="cursor-visible">False</property> | ||||
|                 <property name="buffer">message_buffer</property> | ||||
|               </object> | ||||
|             </child> | ||||
|           </object> | ||||
|           <packing> | ||||
|             <property name="expand">False</property> | ||||
|             <property name="fill">True</property> | ||||
|             <property name="position">1</property> | ||||
|           </packing> | ||||
|         </child> | ||||
|       </object> | ||||
|     </child> | ||||
|   </object> | ||||
|   <object class="GtkPopover" id="path_menu"> | ||||
|     <property name="width-request">240</property> | ||||
|     <property name="height-request">420</property> | ||||
| @@ -1930,6 +2149,20 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe | ||||
|       </object> | ||||
|     </child> | ||||
|   </object> | ||||
|   <object class="GtkPopover" id="plugin_list"> | ||||
|     <property name="can-focus">False</property> | ||||
|     <property name="relative-to">plugins_buttoin</property> | ||||
|     <child> | ||||
|       <object class="GtkBox" id="plugin_socket"> | ||||
|         <property name="visible">True</property> | ||||
|         <property name="can-focus">False</property> | ||||
|         <property name="orientation">vertical</property> | ||||
|         <child> | ||||
|           <placeholder/> | ||||
|         </child> | ||||
|       </object> | ||||
|     </child> | ||||
|   </object> | ||||
|   <object class="GtkPopover" id="win1_search"> | ||||
|     <property name="can-focus">False</property> | ||||
|     <property name="margin-start">5</property> | ||||
| @@ -2068,25 +2301,6 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe | ||||
|                 <property name="visible">True</property> | ||||
|                 <property name="can-focus">False</property> | ||||
|                 <property name="orientation">vertical</property> | ||||
|                 <child type="center"> | ||||
|                   <object class="GtkButton"> | ||||
|                     <property name="label">gtk-delete</property> | ||||
|                     <property name="name">delete</property> | ||||
|                     <property name="visible">True</property> | ||||
|                     <property name="can-focus">True</property> | ||||
|                     <property name="receives-default">True</property> | ||||
|                     <property name="tooltip-text" translatable="yes">Delete...</property> | ||||
|                     <property name="margin-top">20</property> | ||||
|                     <property name="use-stock">True</property> | ||||
|                     <property name="always-show-image">True</property> | ||||
|                     <signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/> | ||||
|                   </object> | ||||
|                   <packing> | ||||
|                     <property name="expand">False</property> | ||||
|                     <property name="fill">True</property> | ||||
|                     <property name="position">11</property> | ||||
|                   </packing> | ||||
|                 </child> | ||||
|                 <child> | ||||
|                   <object class="GtkButton"> | ||||
|                     <property name="label">gtk-open</property> | ||||
| @@ -2226,25 +2440,6 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe | ||||
|                     <property name="position">7</property> | ||||
|                   </packing> | ||||
|                 </child> | ||||
|                 <child> | ||||
|                   <object class="GtkButton"> | ||||
|                     <property name="label" translatable="yes">Go To Trash</property> | ||||
|                     <property name="name">go_to_trash</property> | ||||
|                     <property name="visible">True</property> | ||||
|                     <property name="can-focus">True</property> | ||||
|                     <property name="receives-default">True</property> | ||||
|                     <property name="tooltip-text" translatable="yes">Go To Trash...</property> | ||||
|                     <property name="image">trash_img2</property> | ||||
|                     <property name="always-show-image">True</property> | ||||
|                     <signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/> | ||||
|                   </object> | ||||
|                   <packing> | ||||
|                     <property name="expand">False</property> | ||||
|                     <property name="fill">True</property> | ||||
|                     <property name="pack-type">end</property> | ||||
|                     <property name="position">8</property> | ||||
|                   </packing> | ||||
|                 </child> | ||||
|                 <child> | ||||
|                   <object class="GtkButton"> | ||||
|                     <property name="label" translatable="yes">Archive</property> | ||||
| @@ -2257,12 +2452,65 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe | ||||
|                     <property name="always-show-image">True</property> | ||||
|                     <signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/> | ||||
|                   </object> | ||||
|                   <packing> | ||||
|                     <property name="expand">False</property> | ||||
|                     <property name="fill">True</property> | ||||
|                     <property name="position">8</property> | ||||
|                   </packing> | ||||
|                 </child> | ||||
|                 <child> | ||||
|                   <object class="GtkButton"> | ||||
|                     <property name="label">gtk-delete</property> | ||||
|                     <property name="name">delete</property> | ||||
|                     <property name="visible">True</property> | ||||
|                     <property name="can-focus">True</property> | ||||
|                     <property name="receives-default">True</property> | ||||
|                     <property name="tooltip-text" translatable="yes">Delete...</property> | ||||
|                     <property name="margin-top">20</property> | ||||
|                     <property name="use-stock">True</property> | ||||
|                     <property name="always-show-image">True</property> | ||||
|                     <signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/> | ||||
|                   </object> | ||||
|                   <packing> | ||||
|                     <property name="expand">False</property> | ||||
|                     <property name="fill">True</property> | ||||
|                     <property name="position">9</property> | ||||
|                   </packing> | ||||
|                 </child> | ||||
|                 <child> | ||||
|                   <object class="GtkButton" id="restore_from_trash"> | ||||
|                     <property name="label" translatable="yes">Restore From Trash</property> | ||||
|                     <property name="name">restore_from_trash</property> | ||||
|                     <property name="visible">True</property> | ||||
|                     <property name="can-focus">True</property> | ||||
|                     <property name="receives-default">True</property> | ||||
|                     <property name="tooltip-text" translatable="yes">Restore From Trash...</property> | ||||
|                     <property name="margin-top">20</property> | ||||
|                     <signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/> | ||||
|                   </object> | ||||
|                   <packing> | ||||
|                     <property name="expand">False</property> | ||||
|                     <property name="fill">True</property> | ||||
|                     <property name="position">10</property> | ||||
|                   </packing> | ||||
|                 </child> | ||||
|                 <child> | ||||
|                   <object class="GtkButton" id="empty_trash"> | ||||
|                     <property name="label" translatable="yes">Empty Trash</property> | ||||
|                     <property name="name">empty_trash</property> | ||||
|                     <property name="visible">True</property> | ||||
|                     <property name="can-focus">True</property> | ||||
|                     <property name="receives-default">True</property> | ||||
|                     <property name="tooltip-text" translatable="yes">Empty Trash...</property> | ||||
|                     <property name="margin-bottom">20</property> | ||||
|                     <signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/> | ||||
|                   </object> | ||||
|                   <packing> | ||||
|                     <property name="expand">False</property> | ||||
|                     <property name="fill">True</property> | ||||
|                     <property name="position">11</property> | ||||
|                   </packing> | ||||
|                 </child> | ||||
|                 <child> | ||||
|                   <object class="GtkButton"> | ||||
|                     <property name="label" translatable="yes">Trash</property> | ||||
| @@ -2278,8 +2526,25 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe | ||||
|                   <packing> | ||||
|                     <property name="expand">False</property> | ||||
|                     <property name="fill">True</property> | ||||
|                     <property name="pack-type">end</property> | ||||
|                     <property name="position">11</property> | ||||
|                     <property name="position">12</property> | ||||
|                   </packing> | ||||
|                 </child> | ||||
|                 <child> | ||||
|                   <object class="GtkButton"> | ||||
|                     <property name="label" translatable="yes">Go To Trash</property> | ||||
|                     <property name="name">go_to_trash</property> | ||||
|                     <property name="visible">True</property> | ||||
|                     <property name="can-focus">True</property> | ||||
|                     <property name="receives-default">True</property> | ||||
|                     <property name="tooltip-text" translatable="yes">Go To Trash...</property> | ||||
|                     <property name="image">trash_img2</property> | ||||
|                     <property name="always-show-image">True</property> | ||||
|                     <signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/> | ||||
|                   </object> | ||||
|                   <packing> | ||||
|                     <property name="expand">False</property> | ||||
|                     <property name="fill">True</property> | ||||
|                     <property name="position">13</property> | ||||
|                   </packing> | ||||
|                 </child> | ||||
|               </object> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user