From 9ae0182928105d0fe79e38f4f5f46de0610824d8 Mon Sep 17 00:00:00 2001 From: itdominator <1itdominator@gmail.com> Date: Sat, 28 Jan 2023 23:54:23 -0600 Subject: [PATCH] Import cleanup --- src/shellfm/windows/controller.py | 6 +----- src/shellfm/windows/tabs/icons/icon.py | 3 ++- .../windows/tabs/icons/mixins/desktopiconmixin.py | 10 +++++++--- .../windows/tabs/icons/mixins/meshsiconmixin.py | 4 +++- .../windows/tabs/icons/mixins/videoiconmixin.py | 4 +++- src/shellfm/windows/tabs/path.py | 2 ++ src/shellfm/windows/tabs/tab.py | 13 +++++++------ src/shellfm/windows/tabs/utils/filehandler.py | 3 ++- src/shellfm/windows/tabs/utils/launcher.py | 11 ++++------- src/shellfm/windows/tabs/utils/settings.py | 4 ++-- src/shellfm/windows/window.py | 4 ++-- 11 files changed, 35 insertions(+), 29 deletions(-) diff --git a/src/shellfm/windows/controller.py b/src/shellfm/windows/controller.py index b4aa623..6cabb71 100644 --- a/src/shellfm/windows/controller.py +++ b/src/shellfm/windows/controller.py @@ -1,5 +1,5 @@ # Python imports -import threading, json +import json from os import path # Lib imports @@ -8,10 +8,6 @@ from os import path from .window import Window -def threaded(fn): - def wrapper(*args, **kwargs): - threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=True).start() - return wrapper class WindowController: diff --git a/src/shellfm/windows/tabs/icons/icon.py b/src/shellfm/windows/tabs/icons/icon.py index 62416e1..6e95aa5 100644 --- a/src/shellfm/windows/tabs/icons/icon.py +++ b/src/shellfm/windows/tabs/icons/icon.py @@ -1,4 +1,4 @@ -# Python Imports +# Python imports import hashlib from os.path import isfile @@ -21,6 +21,7 @@ from .mixins.desktopiconmixin import DesktopIconMixin + class Icon(DesktopIconMixin, VideoIconMixin, MeshsIconMixin): def create_icon(self, dir, file): full_path = f"{dir}/{file}" diff --git a/src/shellfm/windows/tabs/icons/mixins/desktopiconmixin.py b/src/shellfm/windows/tabs/icons/mixins/desktopiconmixin.py index 93105fb..0959a2e 100644 --- a/src/shellfm/windows/tabs/icons/mixins/desktopiconmixin.py +++ b/src/shellfm/windows/tabs/icons/mixins/desktopiconmixin.py @@ -1,8 +1,10 @@ -# Python Imports -import os, subprocess, hashlib +# Python imports +import os from os.path import isfile +import subprocess +import hashlib -# Gtk imports +# Lib imports import gi gi.require_version('Gtk', '3.0') @@ -13,6 +15,8 @@ from gi.repository import Gio from .xdg.DesktopEntry import DesktopEntry + + class DesktopIconMixin: def parse_desktop_files(self, full_path): try: diff --git a/src/shellfm/windows/tabs/icons/mixins/meshsiconmixin.py b/src/shellfm/windows/tabs/icons/mixins/meshsiconmixin.py index 07bc757..0d62636 100644 --- a/src/shellfm/windows/tabs/icons/mixins/meshsiconmixin.py +++ b/src/shellfm/windows/tabs/icons/mixins/meshsiconmixin.py @@ -1,4 +1,4 @@ -# Python Imports +# Python imports import subprocess # Lib imports @@ -6,6 +6,8 @@ import subprocess # Application imports + + class MeshsIconMixin: def generate_blender_thumbnail(self, full_path, hash_img_path): try: diff --git a/src/shellfm/windows/tabs/icons/mixins/videoiconmixin.py b/src/shellfm/windows/tabs/icons/mixins/videoiconmixin.py index f1e3492..60fd16b 100644 --- a/src/shellfm/windows/tabs/icons/mixins/videoiconmixin.py +++ b/src/shellfm/windows/tabs/icons/mixins/videoiconmixin.py @@ -1,4 +1,4 @@ -# Python Imports +# Python imports import subprocess # Lib imports @@ -6,6 +6,8 @@ import subprocess # Application imports + + class VideoIconMixin: def generate_video_thumbnail(self, full_path, hash_img_path, scrub_percent = "65%"): try: diff --git a/src/shellfm/windows/tabs/path.py b/src/shellfm/windows/tabs/path.py index 6b3c415..0322db5 100644 --- a/src/shellfm/windows/tabs/path.py +++ b/src/shellfm/windows/tabs/path.py @@ -6,6 +6,8 @@ import os # Application imports + + class Path: def get_home(self) -> str: return os.path.expanduser("~") + self.subpath diff --git a/src/shellfm/windows/tabs/tab.py b/src/shellfm/windows/tabs/tab.py index de483ae..fc592a5 100644 --- a/src/shellfm/windows/tabs/tab.py +++ b/src/shellfm/windows/tabs/tab.py @@ -1,23 +1,24 @@ # Python imports -import hashlib, re +import hashlib +import re from os import listdir -from os.path import isdir, isfile, join - +from os.path import isdir +from os.path import isfile +from os.path import join from random import randint - # Lib imports - # Application imports from .utils.settings import Settings from .utils.launcher import Launcher from .utils.filehandler import FileHandler - from .icons.icon import Icon from .path import Path + + class Tab(Settings, FileHandler, Launcher, Icon, Path): def __init__(self): self.logger = None diff --git a/src/shellfm/windows/tabs/utils/filehandler.py b/src/shellfm/windows/tabs/utils/filehandler.py index 105782a..3855e24 100644 --- a/src/shellfm/windows/tabs/utils/filehandler.py +++ b/src/shellfm/windows/tabs/utils/filehandler.py @@ -1,5 +1,6 @@ # Python imports -import os, shutil +import os +import shutil # Lib imports diff --git a/src/shellfm/windows/tabs/utils/launcher.py b/src/shellfm/windows/tabs/utils/launcher.py index 7ad1d23..8d985f4 100644 --- a/src/shellfm/windows/tabs/utils/launcher.py +++ b/src/shellfm/windows/tabs/utils/launcher.py @@ -1,16 +1,13 @@ -# System import -import os, threading, subprocess, shlex +# Python imports +import os, +import subprocess +import shlex # Lib imports - # Apoplication imports -def threaded(fn): - def wrapper(*args, **kwargs): - threading.Thread(target=fn, args=args, kwargs=kwargs).start() - return wrapper class Launcher: diff --git a/src/shellfm/windows/tabs/utils/settings.py b/src/shellfm/windows/tabs/utils/settings.py index 78c90df..8b1615e 100644 --- a/src/shellfm/windows/tabs/utils/settings.py +++ b/src/shellfm/windows/tabs/utils/settings.py @@ -1,15 +1,15 @@ -# System import +# Python imports import json import os from os import path # Lib imports - # Apoplication imports + class Settings: logger = None diff --git a/src/shellfm/windows/window.py b/src/shellfm/windows/window.py index 8105091..fd131d9 100644 --- a/src/shellfm/windows/window.py +++ b/src/shellfm/windows/window.py @@ -1,14 +1,14 @@ # Python imports from random import randint - # Lib imports - # Application imports from .tabs.tab import Tab + + class Window: def __init__(self): self._id_length: int = 10