Merge Stable Changesto Master #9
|
@ -6,7 +6,11 @@
|
|||
"support": "",
|
||||
"requests": {
|
||||
"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
|
||||
|
||||
|
||||
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}"
|
||||
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()
|
||||
|
@ -46,7 +46,7 @@ class Application(IPCServer):
|
|||
|
||||
controller = Controller(args, unknownargs, settings)
|
||||
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.
|
||||
# Then, builder connects to any signals it needs.
|
||||
|
@ -57,7 +57,7 @@ class Application(IPCServer):
|
|||
try:
|
||||
methods = inspect.getmembers(c, predicate=inspect.ismethod)
|
||||
handlers.update(methods)
|
||||
except Exception as e:
|
||||
except AppLaunchException as e:
|
||||
print(repr(e))
|
||||
|
||||
settings.get_builder().connect_signals(handlers)
|
||||
|
|
|
@ -12,6 +12,10 @@ from gi.repository import Gdk, Gio
|
|||
from .tab_mixin import TabMixin
|
||||
|
||||
|
||||
class WindowException(Exception):
|
||||
...
|
||||
|
||||
|
||||
class WindowMixin(TabMixin):
|
||||
"""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))
|
||||
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(repr(e))
|
||||
else:
|
||||
|
@ -107,7 +111,7 @@ class WindowMixin(TabMixin):
|
|||
cancellable=None)
|
||||
file_size = file_info.get_size()
|
||||
combined_size += file_size
|
||||
except Exception as e:
|
||||
except WindowException as e:
|
||||
if debug:
|
||||
print(repr(e))
|
||||
|
||||
|
@ -168,14 +172,13 @@ class WindowMixin(TabMixin):
|
|||
self.set_path_text(wid, tid)
|
||||
self.set_window_title()
|
||||
|
||||
|
||||
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
|
||||
self.grid_icon_double_click(icons_grid)
|
||||
elif eve.type == Gdk.EventType.BUTTON_RELEASE and eve.button == 3: # r-click
|
||||
self.show_context_menu()
|
||||
|
||||
except Exception as e:
|
||||
except WindowException as e:
|
||||
print(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)
|
||||
else:
|
||||
self.open_files()
|
||||
except Exception as e:
|
||||
except WindowException as e:
|
||||
traceback.print_exc()
|
||||
self.display_message(self.error_color, f"{repr(e)}")
|
||||
|
||||
|
|
|
@ -52,8 +52,8 @@ class KeyboardSignalsMixin:
|
|||
return True
|
||||
except Exception:
|
||||
# Must be plugins scope or we forgot to add method to file manager scope
|
||||
sender, method_target = mapping.split("||")
|
||||
self.handle_plugin_key_event(sender, method_target)
|
||||
sender, eve_type = mapping.split("||")
|
||||
self.handle_plugin_key_event(sender, eve_type)
|
||||
else:
|
||||
if debug:
|
||||
print(f"on_global_key_release_controller > key > {keyname}")
|
||||
|
@ -77,6 +77,9 @@ class KeyboardSignalsMixin:
|
|||
return True
|
||||
|
||||
|
||||
def handle_plugin_key_event(self, sender, eve_type):
|
||||
event_system.emit(eve_type)
|
||||
|
||||
def keyboard_close_tab(self):
|
||||
wid, tid = self.fm_controller.get_active_wid_and_tid()
|
||||
notebook = self.builder.get_object(f"window_{wid}")
|
||||
|
|
|
@ -42,11 +42,14 @@ class Icon(DesktopIconMixin, VideoIconMixin):
|
|||
thumbnl = self.parse_desktop_files(full_path)
|
||||
|
||||
return thumbnl
|
||||
except Exception as e:
|
||||
return None
|
||||
except Exception:
|
||||
...
|
||||
|
||||
return None
|
||||
|
||||
def create_thumbnail(self, dir, file, scrub_percent = "65%"):
|
||||
full_path = f"{dir}/{file}"
|
||||
|
||||
try:
|
||||
file_hash = hashlib.sha256(str.encode(full_path)).hexdigest()
|
||||
hash_img_pth = f"{self.ABS_THUMBS_PTH}/{file_hash}.jpg"
|
||||
|
@ -61,27 +64,29 @@ class Icon(DesktopIconMixin, VideoIconMixin):
|
|||
except Exception as e:
|
||||
print("Thumbnail generation issue:")
|
||||
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):
|
||||
if not wxh:
|
||||
wxh = self.video_icon_wh
|
||||
|
||||
try:
|
||||
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:
|
||||
if PImage and path.lower().endswith(".webp"):
|
||||
if path:
|
||||
try:
|
||||
if path.lower().endswith(".gif"):
|
||||
return GdkPixbuf.PixbufAnimation.new_from_file(path) \
|
||||
.get_static_image() \
|
||||
.scale_simple(wxh[0], wxh[1], GdkPixbuf.InterpType.BILINEAR)
|
||||
elif path.lower().endswith(".webp") and PImage:
|
||||
return self.image2pixbuf(path, wxh)
|
||||
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) )
|
||||
return None
|
||||
|
||||
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) )
|
||||
|
||||
return None
|
||||
|
||||
def image2pixbuf(self, path, wxh):
|
||||
"""Convert Pillow image to GdkPixbuf"""
|
||||
|
@ -101,7 +106,8 @@ class Icon(DesktopIconMixin, VideoIconMixin):
|
|||
except Exception as e:
|
||||
print("Image from file Issue:")
|
||||
print( repr(e) )
|
||||
return None
|
||||
|
||||
return None
|
||||
|
||||
def return_generic_icon(self):
|
||||
return GdkPixbuf.Pixbuf.new_from_file(self.DEFAULT_ICON)
|
||||
|
|
|
@ -6,10 +6,7 @@
|
|||
"open_terminal" : "F4",
|
||||
"refresh_tab" : ["F5",
|
||||
"<Control>r"],
|
||||
"delete_files" : ["Delete",
|
||||
"<Shift><Control>d"],
|
||||
"tggl_top_main_menubar" : "<Alt>h",
|
||||
"trash_files" : "<Shift><Control>t",
|
||||
"tear_down" : "<Control>q",
|
||||
"go_up" : "<Control>Up",
|
||||
"go_home" : "<Control>slash",
|
||||
|
|
Loading…
Reference in New Issue