Plugin cleanup and tweaks
This commit is contained in:
@@ -157,7 +157,7 @@ class TabMixin(GridMixin):
|
||||
|
||||
self.clear_children(path_menu_buttons)
|
||||
show_path_menu = False
|
||||
for file, hash in files:
|
||||
for file, hash, size in files:
|
||||
if os.path.isdir(f"{dir}{file}"):
|
||||
if query.lower() in file.lower():
|
||||
button = Gtk.Button(label=file)
|
||||
|
@@ -1,6 +1,7 @@
|
||||
# Python imports
|
||||
import os
|
||||
import time
|
||||
import inspect
|
||||
|
||||
# Lib imports
|
||||
|
||||
@@ -66,6 +67,19 @@ class PluginBase:
|
||||
"""
|
||||
raise PluginBaseException("Method hasn't been overriden...")
|
||||
|
||||
def _connect_builder_signals(self, caller_class, builder):
|
||||
classes = [caller_class]
|
||||
handlers = {}
|
||||
for c in classes:
|
||||
methods = None
|
||||
try:
|
||||
methods = inspect.getmembers(c, predicate=inspect.ismethod)
|
||||
handlers.update(methods)
|
||||
except Exception as e:
|
||||
print(repr(e))
|
||||
|
||||
builder.connect_signals(handlers)
|
||||
|
||||
def reload_package(self, plugin_path, module_dict_main=locals()):
|
||||
import importlib
|
||||
from pathlib import Path
|
||||
|
@@ -31,7 +31,10 @@ except Exception as e:
|
||||
return f"{num:.1f} Yi{suffix}"
|
||||
|
||||
def _get_file_size(file):
|
||||
return "4K" if isdir(file) else sizeof_fmt_def(os.path.getsize(file))
|
||||
try:
|
||||
return "4K" if isdir(file) else sizeof_fmt_def(os.path.getsize(file))
|
||||
except Exception as e:
|
||||
return "0K"
|
||||
|
||||
get_file_size = _get_file_size
|
||||
|
||||
|
@@ -13,6 +13,7 @@ from os import path
|
||||
class Settings:
|
||||
logger = None
|
||||
USR_SOLARFM = "/usr/share/solarfm"
|
||||
SHIM_PATH = "/dev/shm/solarfm"
|
||||
USER_HOME = path.expanduser('~')
|
||||
CONFIG_PATH = f"{USER_HOME}/.config/solarfm"
|
||||
CONFIG_FILE = f"{CONFIG_PATH}/settings.json"
|
||||
@@ -23,14 +24,19 @@ class Settings:
|
||||
DEFAULT_ICON = f"{DEFAULT_ICONS}/text.png"
|
||||
FFMPG_THUMBNLR = f"{CONFIG_PATH}/ffmpegthumbnailer" # Thumbnail generator binary
|
||||
BLENDER_THUMBNLR = f"{CONFIG_PATH}/blender-thumbnailer" # Blender thumbnail generator binary
|
||||
REMUX_FOLDER = f"{USER_HOME}/.remuxs" # Remuxed files folder
|
||||
# REMUX_FOLDER = f"{USER_HOME}/.remuxs" # Remuxed files folder
|
||||
REMUX_FOLDER = f"{SHIM_PATH}/.remuxs" # Remuxed files folder
|
||||
|
||||
ICON_DIRS = ["/usr/share/icons", f"{USER_HOME}/.icons" "/usr/share/pixmaps"]
|
||||
BASE_THUMBS_PTH = f"{USER_HOME}/.thumbnails" # Used for thumbnail generation
|
||||
ABS_THUMBS_PTH = f"{BASE_THUMBS_PTH}/normal" # Used for thumbnail generation
|
||||
# BASE_THUMBS_PTH = f"{USER_HOME}/.thumbnails" # Used for thumbnail generation
|
||||
BASE_THUMBS_PTH = f"{SHIM_PATH}/.thumbnails" # Used for thumbnail generation
|
||||
ABS_THUMBS_PTH = f"{BASE_THUMBS_PTH}/normal" # Used for thumbnail generation
|
||||
STEAM_ICONS_PTH = f"{BASE_THUMBS_PTH}/steam_icons"
|
||||
|
||||
# Dir structure check
|
||||
if not path.isdir(SHIM_PATH):
|
||||
os.mkdir(SHIM_PATH)
|
||||
|
||||
if not path.isdir(REMUX_FOLDER):
|
||||
os.mkdir(REMUX_FOLDER)
|
||||
|
||||
|
Reference in New Issue
Block a user