diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/__builtins__.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/__builtins__.py index 6e674cb..3ac749f 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/__builtins__.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/__builtins__.py @@ -66,6 +66,7 @@ class Builtins(IPCServerMixin): # NOTE: Just reminding myself we can add to builtins two different ways... # __builtins__.update({"event_system": Builtins()}) +builtins.app_name = "SolarFM" builtins.event_system = Builtins() builtins.event_sleep_time = 0.2 builtins.debug = False diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/__main__.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/__main__.py index 3105637..66870d2 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/__main__.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/__main__.py @@ -23,7 +23,7 @@ if __name__ == "__main__": # import web_pdb # web_pdb.set_trace() - setproctitle('solarfm') + setproctitle('SolarFM') faulthandler.enable() # For better debug info parser = argparse.ArgumentParser() # Add long and short arguments diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/Controller.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/Controller.py index 09ae50f..fe9ca6b 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/Controller.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/Controller.py @@ -7,7 +7,8 @@ gi.require_version('Gtk', '3.0') from gi.repository import Gtk, GLib # Application imports -from .mixins import * +from .mixins.ui import * +from .mixins import PluginMixin from . import ShowHideMixin, KeyboardSignalsMixin, Controller_Data @@ -20,12 +21,13 @@ def threaded(fn): class Controller(WidgetFileActionMixin, PaneMixin, WindowMixin, ShowHideMixin, \ - KeyboardSignalsMixin, Controller_Data): + KeyboardSignalsMixin, PluginMixin, Controller_Data): def __init__(self, args, unknownargs, _settings): # sys.excepthook = self.custom_except_hook self.setup_controller_data(_settings) self.window.show() self.generate_windows(self.state) + self.load_plugins() if not trace_debug: self.gui_event_observer() diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/PluginMixin.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/PluginMixin.py new file mode 100644 index 0000000..35a7400 --- /dev/null +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/PluginMixin.py @@ -0,0 +1,17 @@ +# Python imports + +# Lib imports +import gi +gi.require_version('Gtk', '3.0') +from gi.repository import Gtk + +# Application imports + + + + +class PluginMixin: + """docstring for TabMixin""" + + def load_plugins(self): + pass diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/__init__.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/__init__.py index cd23f8d..2b42bbb 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/__init__.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/__init__.py @@ -1,5 +1 @@ -from .PaneMixin import PaneMixin -from .WidgetMixin import WidgetMixin -from .TabMixin import TabMixin -from .WindowMixin import WindowMixin -from .WidgetFileActionMixin import WidgetFileActionMixin +from .PluginMixin import PluginMixin diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/PaneMixin.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ui/PaneMixin.py similarity index 100% rename from src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/PaneMixin.py rename to src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ui/PaneMixin.py diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/TabMixin.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ui/TabMixin.py similarity index 100% rename from src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/TabMixin.py rename to src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ui/TabMixin.py diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WidgetFileActionMixin.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ui/WidgetFileActionMixin.py similarity index 100% rename from src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WidgetFileActionMixin.py rename to src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ui/WidgetFileActionMixin.py diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WidgetMixin.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ui/WidgetMixin.py similarity index 100% rename from src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WidgetMixin.py rename to src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ui/WidgetMixin.py diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WindowMixin.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ui/WindowMixin.py similarity index 100% rename from src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WindowMixin.py rename to src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ui/WindowMixin.py diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ui/__init__.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ui/__init__.py new file mode 100644 index 0000000..cd23f8d --- /dev/null +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/ui/__init__.py @@ -0,0 +1,5 @@ +from .PaneMixin import PaneMixin +from .WidgetMixin import WidgetMixin +from .TabMixin import TabMixin +from .WindowMixin import WindowMixin +from .WidgetFileActionMixin import WidgetFileActionMixin diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/utils/Logger.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/utils/Logger.py index c7f294e..06eed47 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/utils/Logger.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/utils/Logger.py @@ -5,8 +5,8 @@ import os, logging class Logger: - def __init__(self): - pass + def __init__(self, config_path): + self._CONFIG_PATH = config_path def get_logger(self, loggerName = "NO_LOGGER_NAME_PASSED", createFile = True): """ @@ -42,8 +42,8 @@ class Logger: log.addHandler(ch) if createFile: - folder = "logs" - file = folder + "/application.log" + folder = self._CONFIG_PATH + file = f"{folder}/application.log" if not os.path.exists(folder): os.mkdir(folder) diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/utils/Settings.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/utils/Settings.py index 205b919..d312773 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/utils/Settings.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/utils/Settings.py @@ -17,29 +17,35 @@ from . import Logger class Settings: def __init__(self): - self.logger = Logger().get_logger() self.builder = gtk.Builder() self.SCRIPT_PTH = os.path.dirname(os.path.realpath(__file__)) self.USER_HOME = path.expanduser('~') - self.CONFIG_PATH = f"{self.USER_HOME}/.config/solarfm" - self.USR_SOLARFM = "/usr/share/solarfm" + self.CONFIG_PATH = f"{self.USER_HOME}/.config/{app_name.lower()}" + self.PLUGINS_PATH = f"{self.CONFIG_PATH}/plugins" + self.USR_SOLARFM = f"/usr/share/{app_name.lower()}" self.cssFile = f"{self.CONFIG_PATH}/stylesheet.css" self.windows_glade = f"{self.CONFIG_PATH}/Main_Window.glade" self.DEFAULT_ICONS = f"{self.CONFIG_PATH}/icons" - self.window_icon = f"{self.DEFAULT_ICONS}/solarfm.png" + self.window_icon = f"{self.DEFAULT_ICONS}/{app_name.lower()}.png" self.main_window = None + if not os.path.exists(self.CONFIG_PATH): + os.mkdir(self.CONFIG_PATH) + if not os.path.exists(self.PLUGINS_PATH): + os.mkdir(self.PLUGINS_PATH) + if not os.path.exists(self.windows_glade): self.windows_glade = f"{self.USR_SOLARFM}/Main_Window.glade" if not os.path.exists(self.cssFile): self.cssFile = f"{self.USR_SOLARFM}/stylesheet.css" if not os.path.exists(self.window_icon): - self.window_icon = f"{self.USR_SOLARFM}/icons/solarfm.png" + self.window_icon = f"{self.USR_SOLARFM}/icons/{app_name.lower()}.png" if not os.path.exists(self.DEFAULT_ICONS): self.DEFAULT_ICONS = f"{self.USR_SOLARFM}/icons" + self.logger = Logger(self.CONFIG_PATH).get_logger() self.builder.add_from_file(self.windows_glade)