Merge Stable Changesto Master #9
@@ -6,7 +6,11 @@
 | 
				
			|||||||
        "support": "",
 | 
					        "support": "",
 | 
				
			||||||
        "requests": {
 | 
					        "requests": {
 | 
				
			||||||
            "ui_target": "context_menu",
 | 
					            "ui_target": "context_menu",
 | 
				
			||||||
            "pass_fm_events": "true"
 | 
					            "pass_fm_events": "true",
 | 
				
			||||||
 | 
					            "bind_keys": [
 | 
				
			||||||
 | 
					                            "Trasher||delete_files:Delete",
 | 
				
			||||||
 | 
					                            "Trasher||trash_files:<Control>d"
 | 
				
			||||||
 | 
					                        ]
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,10 +10,10 @@ from utils.settings import Settings
 | 
				
			|||||||
from core.controller import Controller
 | 
					from core.controller import Controller
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class App_Launch_Exception(Exception):
 | 
					class AppLaunchException(Exception):
 | 
				
			||||||
    ...
 | 
					    ...
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Controller_Start_Exceptio(Exception):
 | 
					class ControllerStartExceptio(Exception):
 | 
				
			||||||
    ...
 | 
					    ...
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -38,7 +38,7 @@ class Application(IPCServer):
 | 
				
			|||||||
                    message = f"FILE|{args.new_tab}"
 | 
					                    message = f"FILE|{args.new_tab}"
 | 
				
			||||||
                    self.send_ipc_message(message)
 | 
					                    self.send_ipc_message(message)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                raise App_Launch_Exception(f"IPC Server Exists: Will send path(s) to it and close...\nNote: If no fm exists, remove /tmp/{app_name}-ipc.sock")
 | 
					                raise AppLaunchException(f"IPC Server Exists: Will send path(s) to it and close...\nNote: If no fm exists, remove /tmp/{app_name}-ipc.sock")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        settings = Settings()
 | 
					        settings = Settings()
 | 
				
			||||||
@@ -46,7 +46,7 @@ class Application(IPCServer):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        controller = Controller(args, unknownargs, settings)
 | 
					        controller = Controller(args, unknownargs, settings)
 | 
				
			||||||
        if not controller:
 | 
					        if not controller:
 | 
				
			||||||
            raise Controller_Start_Exceptio("Controller exited and doesn't exist...")
 | 
					            raise ControllerStartExceptio("Controller exited and doesn't exist...")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Gets the methods from the classes and sets to handler.
 | 
					        # Gets the methods from the classes and sets to handler.
 | 
				
			||||||
        # Then, builder connects to any signals it needs.
 | 
					        # Then, builder connects to any signals it needs.
 | 
				
			||||||
@@ -57,7 +57,7 @@ class Application(IPCServer):
 | 
				
			|||||||
            try:
 | 
					            try:
 | 
				
			||||||
                methods = inspect.getmembers(c, predicate=inspect.ismethod)
 | 
					                methods = inspect.getmembers(c, predicate=inspect.ismethod)
 | 
				
			||||||
                handlers.update(methods)
 | 
					                handlers.update(methods)
 | 
				
			||||||
            except Exception as e:
 | 
					            except AppLaunchException as e:
 | 
				
			||||||
                print(repr(e))
 | 
					                print(repr(e))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        settings.get_builder().connect_signals(handlers)
 | 
					        settings.get_builder().connect_signals(handlers)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,6 +12,10 @@ from gi.repository import Gdk, Gio
 | 
				
			|||||||
from .tab_mixin import TabMixin
 | 
					from .tab_mixin import TabMixin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class WindowException(Exception):
 | 
				
			||||||
 | 
					    ...
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class WindowMixin(TabMixin):
 | 
					class WindowMixin(TabMixin):
 | 
				
			||||||
    """docstring for WindowMixin"""
 | 
					    """docstring for WindowMixin"""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -46,7 +50,7 @@ class WindowMixin(TabMixin):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                icon_grid.event(Gdk.Event().new(type=Gdk.EventType.BUTTON_RELEASE))
 | 
					                icon_grid.event(Gdk.Event().new(type=Gdk.EventType.BUTTON_RELEASE))
 | 
				
			||||||
                icon_grid.event(Gdk.Event().new(type=Gdk.EventType.BUTTON_RELEASE))
 | 
					                icon_grid.event(Gdk.Event().new(type=Gdk.EventType.BUTTON_RELEASE))
 | 
				
			||||||
            except Exception as e:
 | 
					            except WindowException as e:
 | 
				
			||||||
                print("\n:  The saved session might be missing window data!  :\nLocation: ~/.config/solarfm/session.json\nFix: Back it up and delete it to reset.\n")
 | 
					                print("\n:  The saved session might be missing window data!  :\nLocation: ~/.config/solarfm/session.json\nFix: Back it up and delete it to reset.\n")
 | 
				
			||||||
                print(repr(e))
 | 
					                print(repr(e))
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
@@ -107,7 +111,7 @@ class WindowMixin(TabMixin):
 | 
				
			|||||||
                                                        cancellable=None)
 | 
					                                                        cancellable=None)
 | 
				
			||||||
                    file_size = file_info.get_size()
 | 
					                    file_size = file_info.get_size()
 | 
				
			||||||
                    combined_size += file_size
 | 
					                    combined_size += file_size
 | 
				
			||||||
                except Exception as e:
 | 
					                except WindowException as e:
 | 
				
			||||||
                    if debug:
 | 
					                    if debug:
 | 
				
			||||||
                        print(repr(e))
 | 
					                        print(repr(e))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -168,14 +172,13 @@ class WindowMixin(TabMixin):
 | 
				
			|||||||
            self.set_path_text(wid, tid)
 | 
					            self.set_path_text(wid, tid)
 | 
				
			||||||
            self.set_window_title()
 | 
					            self.set_window_title()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
            if eve.type == Gdk.EventType.BUTTON_RELEASE and eve.button == 1:   # l-click
 | 
					            if eve.type == Gdk.EventType.BUTTON_RELEASE and eve.button == 1:   # l-click
 | 
				
			||||||
                if self.single_click_open: # FIXME: need to find a way to pass the model index
 | 
					                if self.single_click_open: # FIXME: need to find a way to pass the model index
 | 
				
			||||||
                    self.grid_icon_double_click(icons_grid)
 | 
					                    self.grid_icon_double_click(icons_grid)
 | 
				
			||||||
            elif eve.type == Gdk.EventType.BUTTON_RELEASE and eve.button == 3: # r-click
 | 
					            elif eve.type == Gdk.EventType.BUTTON_RELEASE and eve.button == 3: # r-click
 | 
				
			||||||
                self.show_context_menu()
 | 
					                self.show_context_menu()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        except Exception as e:
 | 
					        except WindowException as e:
 | 
				
			||||||
            print(repr(e))
 | 
					            print(repr(e))
 | 
				
			||||||
            self.display_message(self.error_color, f"{repr(e)}")
 | 
					            self.display_message(self.error_color, f"{repr(e)}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -204,7 +207,7 @@ class WindowMixin(TabMixin):
 | 
				
			|||||||
                self.update_tab(tab_label, state.tab, state.store, state.wid, state.tid)
 | 
					                self.update_tab(tab_label, state.tab, state.store, state.wid, state.tid)
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
                self.open_files()
 | 
					                self.open_files()
 | 
				
			||||||
        except Exception as e:
 | 
					        except WindowException as e:
 | 
				
			||||||
            traceback.print_exc()
 | 
					            traceback.print_exc()
 | 
				
			||||||
            self.display_message(self.error_color, f"{repr(e)}")
 | 
					            self.display_message(self.error_color, f"{repr(e)}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -52,8 +52,8 @@ class KeyboardSignalsMixin:
 | 
				
			|||||||
                return True
 | 
					                return True
 | 
				
			||||||
            except Exception:
 | 
					            except Exception:
 | 
				
			||||||
                # Must be plugins scope or we forgot to add method to file manager scope
 | 
					                # Must be plugins scope or we forgot to add method to file manager scope
 | 
				
			||||||
                sender, method_target = mapping.split("||")
 | 
					                sender, eve_type = mapping.split("||")
 | 
				
			||||||
                self.handle_plugin_key_event(sender, method_target)
 | 
					                self.handle_plugin_key_event(sender, eve_type)
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            if debug:
 | 
					            if debug:
 | 
				
			||||||
                print(f"on_global_key_release_controller > key > {keyname}")
 | 
					                print(f"on_global_key_release_controller > key > {keyname}")
 | 
				
			||||||
@@ -77,6 +77,9 @@ class KeyboardSignalsMixin:
 | 
				
			|||||||
                            return True
 | 
					                            return True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def handle_plugin_key_event(self, sender, eve_type):
 | 
				
			||||||
 | 
					        event_system.emit(eve_type)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def keyboard_close_tab(self):
 | 
					    def keyboard_close_tab(self):
 | 
				
			||||||
        wid, tid  = self.fm_controller.get_active_wid_and_tid()
 | 
					        wid, tid  = self.fm_controller.get_active_wid_and_tid()
 | 
				
			||||||
        notebook  = self.builder.get_object(f"window_{wid}")
 | 
					        notebook  = self.builder.get_object(f"window_{wid}")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,11 +42,14 @@ class Icon(DesktopIconMixin, VideoIconMixin):
 | 
				
			|||||||
                thumbnl = self.parse_desktop_files(full_path)
 | 
					                thumbnl = self.parse_desktop_files(full_path)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return thumbnl
 | 
					            return thumbnl
 | 
				
			||||||
        except Exception as e:
 | 
					        except Exception:
 | 
				
			||||||
            return None
 | 
					            ...
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def create_thumbnail(self, dir, file, scrub_percent = "65%"):
 | 
					    def create_thumbnail(self, dir, file, scrub_percent = "65%"):
 | 
				
			||||||
        full_path = f"{dir}/{file}"
 | 
					        full_path = f"{dir}/{file}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            file_hash    = hashlib.sha256(str.encode(full_path)).hexdigest()
 | 
					            file_hash    = hashlib.sha256(str.encode(full_path)).hexdigest()
 | 
				
			||||||
            hash_img_pth = f"{self.ABS_THUMBS_PTH}/{file_hash}.jpg"
 | 
					            hash_img_pth = f"{self.ABS_THUMBS_PTH}/{file_hash}.jpg"
 | 
				
			||||||
@@ -61,27 +64,29 @@ class Icon(DesktopIconMixin, VideoIconMixin):
 | 
				
			|||||||
        except Exception as e:
 | 
					        except Exception as e:
 | 
				
			||||||
            print("Thumbnail generation issue:")
 | 
					            print("Thumbnail generation issue:")
 | 
				
			||||||
            print( repr(e) )
 | 
					            print( repr(e) )
 | 
				
			||||||
            return GdkPixbuf.Pixbuf.new_from_file(f"{self.DEFAULT_ICONS}/video.png")
 | 
					
 | 
				
			||||||
 | 
					        return GdkPixbuf.Pixbuf.new_from_file(f"{self.DEFAULT_ICONS}/video.png")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def create_scaled_image(self, path, wxh = None):
 | 
					    def create_scaled_image(self, path, wxh = None):
 | 
				
			||||||
        if not wxh:
 | 
					        if not wxh:
 | 
				
			||||||
            wxh = self.video_icon_wh
 | 
					            wxh = self.video_icon_wh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try:
 | 
					        if path:
 | 
				
			||||||
            if path.lower().endswith(".gif"):
 | 
					            try:
 | 
				
			||||||
                return  GdkPixbuf.PixbufAnimation.new_from_file(path) \
 | 
					                if path.lower().endswith(".gif"):
 | 
				
			||||||
                                                    .get_static_image() \
 | 
					                    return  GdkPixbuf.PixbufAnimation.new_from_file(path) \
 | 
				
			||||||
                                                    .scale_simple(wxh[0], wxh[1], GdkPixbuf.InterpType.BILINEAR)
 | 
					                                                        .get_static_image() \
 | 
				
			||||||
            else:
 | 
					                                                        .scale_simple(wxh[0], wxh[1], GdkPixbuf.InterpType.BILINEAR)
 | 
				
			||||||
                if PImage and path.lower().endswith(".webp"):
 | 
					                elif path.lower().endswith(".webp") and PImage:
 | 
				
			||||||
                    return self.image2pixbuf(path, wxh)
 | 
					                    return self.image2pixbuf(path, wxh)
 | 
				
			||||||
                else:
 | 
					
 | 
				
			||||||
                    return GdkPixbuf.Pixbuf.new_from_file_at_scale(path, wxh[0], wxh[1], True)
 | 
					                return GdkPixbuf.Pixbuf.new_from_file_at_scale(path, wxh[0], wxh[1], True)
 | 
				
			||||||
        except Exception as e:
 | 
					            except Exception as e:
 | 
				
			||||||
            print("Image Scaling Issue:")
 | 
					                print("Image Scaling Issue:")
 | 
				
			||||||
            print( repr(e) )
 | 
					                print( repr(e) )
 | 
				
			||||||
            return None
 | 
					
 | 
				
			||||||
 | 
					        return None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def image2pixbuf(self, path, wxh):
 | 
					    def image2pixbuf(self, path, wxh):
 | 
				
			||||||
        """Convert Pillow image to GdkPixbuf"""
 | 
					        """Convert Pillow image to GdkPixbuf"""
 | 
				
			||||||
@@ -101,7 +106,8 @@ class Icon(DesktopIconMixin, VideoIconMixin):
 | 
				
			|||||||
        except Exception as e:
 | 
					        except Exception as e:
 | 
				
			||||||
            print("Image from file Issue:")
 | 
					            print("Image from file Issue:")
 | 
				
			||||||
            print( repr(e) )
 | 
					            print( repr(e) )
 | 
				
			||||||
            return None
 | 
					
 | 
				
			||||||
 | 
					        return None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def return_generic_icon(self):
 | 
					    def return_generic_icon(self):
 | 
				
			||||||
        return GdkPixbuf.Pixbuf.new_from_file(self.DEFAULT_ICON)
 | 
					        return GdkPixbuf.Pixbuf.new_from_file(self.DEFAULT_ICON)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,10 +6,7 @@
 | 
				
			|||||||
        "open_terminal"          : "F4",
 | 
					        "open_terminal"          : "F4",
 | 
				
			||||||
        "refresh_tab"            : ["F5",
 | 
					        "refresh_tab"            : ["F5",
 | 
				
			||||||
                                    "<Control>r"],
 | 
					                                    "<Control>r"],
 | 
				
			||||||
        "delete_files"           : ["Delete",
 | 
					 | 
				
			||||||
                                    "<Shift><Control>d"],
 | 
					 | 
				
			||||||
        "tggl_top_main_menubar"  : "<Alt>h",
 | 
					        "tggl_top_main_menubar"  : "<Alt>h",
 | 
				
			||||||
        "trash_files"            : "<Shift><Control>t",
 | 
					 | 
				
			||||||
        "tear_down"              : "<Control>q",
 | 
					        "tear_down"              : "<Control>q",
 | 
				
			||||||
        "go_up"                  : "<Control>Up",
 | 
					        "go_up"                  : "<Control>Up",
 | 
				
			||||||
        "go_home"                : "<Control>slash",
 | 
					        "go_home"                : "<Control>slash",
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user