Import refactor, deb build update, docstring additions
This commit is contained in:
@@ -4,7 +4,7 @@ import builtins
|
||||
# Lib imports
|
||||
|
||||
# Application imports
|
||||
from controller import IPCServerMixin
|
||||
from context.ipc_server_mixin import IPCServerMixin
|
||||
|
||||
|
||||
|
||||
|
@@ -4,15 +4,15 @@ import os, inspect, time
|
||||
# Lib imports
|
||||
|
||||
# Application imports
|
||||
from utils import Settings
|
||||
from controller import Controller
|
||||
from utils.settings import Settings
|
||||
from context.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.'''
|
||||
""" Create Settings and Controller classes. Bind signal to Builder. Inherit from Builtins to bind global methods and classes. """
|
||||
|
||||
def __init__(self, args, unknownargs):
|
||||
if not debug:
|
||||
|
@@ -19,7 +19,7 @@ from __init__ import Main
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
''' Set process title, get arguments, and create GTK main thread. '''
|
||||
""" Set process title, get arguments, and create GTK main thread. """
|
||||
|
||||
try:
|
||||
# import web_pdb
|
||||
|
@@ -0,0 +1,3 @@
|
||||
"""
|
||||
Gtk Bound Signal Module
|
||||
"""
|
@@ -7,9 +7,11 @@ 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
|
||||
from .mixins.exception_hook_mixin import ExceptionHookMixin
|
||||
from .mixins.ui_mixin import UIMixin
|
||||
from .signals.ipc_signals_mixin import IPCSignalsMixin
|
||||
from .signals.keyboard_signals_mixin import KeyboardSignalsMixin
|
||||
from .controller_data import Controller_Data
|
||||
|
||||
|
||||
def threaded(fn):
|
||||
@@ -21,7 +23,7 @@ def threaded(fn):
|
||||
|
||||
|
||||
class Controller(UIMixin, KeyboardSignalsMixin, IPCSignalsMixin, ExceptionHookMixin, Controller_Data):
|
||||
''' Controller coordinates the mixins and is somewhat the root hub of it all. '''
|
||||
""" 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()
|
@@ -7,13 +7,13 @@ from gi.repository import GLib
|
||||
# Application imports
|
||||
from trasher.xdgtrash import XDGTrash
|
||||
from shellfm.windows.controller import WindowController
|
||||
from plugins import Plugins
|
||||
from plugins.plugins import Plugins
|
||||
|
||||
|
||||
|
||||
|
||||
class Controller_Data:
|
||||
''' Controller_Data contains most of the state of the app at ay given time. It also has some support methods. '''
|
||||
""" 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, _settings):
|
||||
self.trashman = XDGTrash()
|
@@ -16,7 +16,7 @@ def threaded(fn):
|
||||
|
||||
|
||||
class IPCServerMixin:
|
||||
''' Create a listener so that other SolarFM instances send requests back to existing instance. '''
|
||||
""" Create a listener so that other SolarFM instances send requests back to existing instance. """
|
||||
|
||||
@threaded
|
||||
def create_ipc_server(self):
|
@@ -16,7 +16,7 @@ def threaded(fn):
|
||||
|
||||
|
||||
class ExceptionHookMixin:
|
||||
''' ExceptionHookMixin custom exception hook to reroute to a Gtk text area. '''
|
||||
""" ExceptionHookMixin custom exception hook to reroute to a Gtk text area. """
|
||||
|
||||
def custom_except_hook(self, exec_type, value, _traceback):
|
||||
trace = ''.join(traceback.format_tb(_traceback))
|
@@ -7,7 +7,7 @@ gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk
|
||||
|
||||
# Application imports
|
||||
from . import WidgetMixin
|
||||
from .widget_mixin import WidgetMixin
|
||||
|
||||
|
||||
|
@@ -16,6 +16,8 @@ def threaded(fn):
|
||||
|
||||
|
||||
class WidgetFileActionMixin:
|
||||
"""docstring for WidgetFileActionMixin"""
|
||||
|
||||
def sizeof_fmt(self, num, suffix="B"):
|
||||
for unit in ["", "K", "M", "G", "T", "Pi", "Ei", "Zi"]:
|
||||
if abs(num) < 1024.0:
|
@@ -20,6 +20,8 @@ def threaded(fn):
|
||||
|
||||
|
||||
class WidgetMixin:
|
||||
"""docstring for WidgetMixin"""
|
||||
|
||||
def load_store(self, view, store, save_state=False):
|
||||
store.clear()
|
||||
dir = view.get_current_directory()
|
@@ -9,13 +9,15 @@ gi.require_version('Gdk', '3.0')
|
||||
from gi.repository import Gdk, Gio
|
||||
|
||||
# Application imports
|
||||
from . import TabMixin, WidgetMixin
|
||||
from .tab_mixin import TabMixin
|
||||
from .widget_mixin import WidgetMixin
|
||||
|
||||
|
||||
|
||||
|
||||
class WindowMixin(TabMixin):
|
||||
"""docstring for WindowMixin"""
|
||||
|
||||
def generate_windows(self, session_json = None):
|
||||
if session_json:
|
||||
for j, value in enumerate(session_json):
|
@@ -0,0 +1,14 @@
|
||||
# Python imports
|
||||
|
||||
# Gtk imports
|
||||
|
||||
# Application imports
|
||||
from .show_hide_mixin import ShowHideMixin
|
||||
from .ui.widget_file_action_mixin import WidgetFileActionMixin
|
||||
from .ui.pane_mixin import PaneMixin
|
||||
from .ui.window_mixin import WindowMixin
|
||||
from .show_hide_mixin import ShowHideMixin
|
||||
|
||||
|
||||
class UIMixin(WidgetFileActionMixin, PaneMixin, WindowMixin, ShowHideMixin):
|
||||
pass
|
@@ -6,6 +6,8 @@
|
||||
|
||||
|
||||
class IPCSignalsMixin:
|
||||
""" IPCSignalsMixin handle messages from another starting solarfm process. """
|
||||
|
||||
def print_to_console(self, message=None):
|
||||
print(self)
|
||||
print(message)
|
@@ -14,6 +14,8 @@ valid_keyvalue_pat = re.compile(r"[a-z0-9A-Z-_\[\]\(\)\| ]")
|
||||
|
||||
|
||||
class KeyboardSignalsMixin:
|
||||
""" KeyboardSignalsMixin keyboard hooks controller. """
|
||||
|
||||
def unset_keys_and_data(self, widget=None, eve=None):
|
||||
self.ctrlDown = False
|
||||
self.shiftDown = False
|
@@ -1,7 +0,0 @@
|
||||
"""
|
||||
Gtk Bound Signal Module
|
||||
"""
|
||||
from .mixins import *
|
||||
from .IPCServerMixin import IPCServerMixin
|
||||
from .Controller_Data import Controller_Data
|
||||
from .Controller import Controller
|
@@ -1,11 +0,0 @@
|
||||
# Python imports
|
||||
|
||||
# Gtk imports
|
||||
|
||||
# Application imports
|
||||
from . import ShowHideMixin
|
||||
from .ui import *
|
||||
|
||||
|
||||
class UIMixin(WidgetFileActionMixin, PaneMixin, WindowMixin, ShowHideMixin):
|
||||
pass
|
@@ -1,3 +0,0 @@
|
||||
from .ShowHideMixin import ShowHideMixin
|
||||
from .ExceptionHookMixin import ExceptionHookMixin
|
||||
from .UIMixin import UIMixin
|
@@ -1,5 +0,0 @@
|
||||
from .PaneMixin import PaneMixin
|
||||
from .WidgetMixin import WidgetMixin
|
||||
from .TabMixin import TabMixin
|
||||
from .WindowMixin import WindowMixin
|
||||
from .WidgetFileActionMixin import WidgetFileActionMixin
|
@@ -1,2 +0,0 @@
|
||||
from .KeyboardSignalsMixin import KeyboardSignalsMixin
|
||||
from .IPCSignalsMixin import IPCSignalsMixin
|
@@ -1,4 +1,3 @@
|
||||
"""
|
||||
Gtk Bound Plugins Module
|
||||
"""
|
||||
from .Plugins import Plugins
|
||||
|
@@ -19,7 +19,8 @@ class Plugin:
|
||||
|
||||
|
||||
class Plugins:
|
||||
"""docstring for Plugins"""
|
||||
"""Plugins controller"""
|
||||
|
||||
def __init__(self, settings):
|
||||
self._settings = settings
|
||||
self._plugin_list_widget = self._settings.get_builder().get_object("plugin_list")
|
@@ -1,6 +0,0 @@
|
||||
"""
|
||||
Utils module
|
||||
"""
|
||||
|
||||
from .Logger import Logger
|
||||
from .Settings import Settings
|
||||
|
@@ -12,7 +12,7 @@ from gi.repository import Gdk as gdk
|
||||
|
||||
|
||||
# Application imports
|
||||
from . import Logger
|
||||
from .logger import Logger
|
||||
|
||||
|
||||
class Settings:
|
Reference in New Issue
Block a user