Skip to content

Commit

Permalink
On second thought, nah
Browse files Browse the repository at this point in the history
  • Loading branch information
ElSaico committed May 27, 2024
1 parent 881840c commit ea451f7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 40 deletions.
9 changes: 0 additions & 9 deletions EDMarketConnector.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,6 @@
'--killswitches-file',
help='Specify a custom killswitches file',
)

parser.add_argument(
'--ttk-catalog',
help='Replace plugins with a catalog of Ttk widgets',
action='store_true',
)
###########################################################################

args: argparse.Namespace = parser.parse_args()
Expand Down Expand Up @@ -226,9 +220,6 @@
if args.eddn_tracking_ui:
config.set_eddn_tracking_ui()

if args.ttk_catalog:
config.set_ttk_catalog()

if args.force_edmc_protocol:
if sys.platform == 'win32':
config.set_auth_force_edmc_protocol()
Expand Down
14 changes: 0 additions & 14 deletions config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ class AbstractConfig(abc.ABC):
__auth_force_edmc_protocol = False # Should we force edmc:// protocol ?
__eddn_url = None # Non-default EDDN URL
__eddn_tracking_ui = False # Show EDDN tracking UI ?
__ttk_catalog = False # Load Ttk catalog plugin ?

def __init__(self) -> None:
self.home_path = pathlib.Path.home()
Expand Down Expand Up @@ -246,19 +245,6 @@ def auth_force_edmc_protocol(self) -> bool:
"""
return self.__auth_force_edmc_protocol

def set_ttk_catalog(self):
"""Set flag to load the Ttk widget catalog plugin."""
self.__ttk_catalog = True

@property
def ttk_catalog(self) -> bool:
"""
Determine if the Ttk widget catalog plugin is loaded.
:return: bool - Should the Ttk catalog plugin be loaded?
"""
return self.__ttk_catalog

def set_eddn_url(self, eddn_url: str):
"""Set the specified eddn URL."""
self.__eddn_url = eddn_url
Expand Down
10 changes: 7 additions & 3 deletions plugins/_ttk_catalog.py → docs/examples/ttk_catalog/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@
Based on https://github.com/rdbende/Azure-ttk-theme/blob/main/example.py
"""
import logging
import os
import tkinter as tk
from tkinter import ttk

from EDMCLogging import get_main_logger
from constants import appname

logger = get_main_logger()
plugin_name = os.path.basename(os.path.dirname(__file__))

logger = logging.getLogger(f"{appname}.{plugin_name}")


class Catalog(ttk.Frame):
Expand Down Expand Up @@ -291,7 +295,7 @@ def setup_widgets(self):


def plugin_start3(path: str) -> str:
return 'TtkCatalog'
return plugin_name


plugin_app = Catalog
16 changes: 2 additions & 14 deletions plug.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,8 @@ def load_plugins(master: tk.Tk) -> None:
# Add plugin folder to load path so packages can be loaded from plugin folder
sys.path.append(config.plugin_dir)

if config.ttk_catalog:
PLUGINS.append(_load_ttk_catalog_plugin())
else:
found = _load_found_plugins()
PLUGINS.extend(sorted(found, key=lambda p: operator.attrgetter('name')(p).lower()))
found = _load_found_plugins()
PLUGINS.extend(sorted(found, key=lambda p: operator.attrgetter('name')(p).lower()))


def _load_internal_plugins():
Expand All @@ -182,15 +179,6 @@ def _load_internal_plugins():
return internal


def _load_ttk_catalog_plugin():
try:
plugin = Plugin('ttk_catalog', os.path.join(config.internal_plugin_dir_path, '_ttk_catalog.py'), logger)
plugin.folder = None
return plugin
except Exception:
logger.exception(f'Failure loading internal Plugin "ttk_catalog"')


def _load_found_plugins():
found = []
# Load any plugins that are also packages first, but note it's *still*
Expand Down

0 comments on commit ea451f7

Please sign in to comment.