Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfixes to stabilize latest application version #3

Merged
merged 15 commits into from
Apr 2, 2024
Merged
56 changes: 28 additions & 28 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/api/ExampleAPI/exampleapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(self, **kwargs):

def on_change(self, id: str):
if id not in self.ids:
log.error(f"{self.__class__.__name__}: Invalid setting ID: {id}")
log.error("%s: Invalid setting ID: %s", self.__class__.__name__, id)
# NOTE I'd recommend a more sophisticated way of determining which widget corresponds to which setting
# for the sake of simplicity, I'll use the ID and the type of the widget
if self.ids[id] is MDCheckbox:
Expand Down
6 changes: 3 additions & 3 deletions src/api/api_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ class ApiFactory:
def get_api(api_name: str):
try:
api_module = importlib.import_module(f"api.{api_name}.{api_name.lower()}")
log.debug(f"{__class__.__name__}: Imported API module: {api_module}")
log.debug("%s: Imported API module: %s", __class__.__name__, api_module)
api_class = getattr(api_module, api_name) # TODO Unused api_class
settings_class = getattr(api_module, f"{api_name}Settings") # TODO Unused settings_class
widget_class = getattr(api_module, f"{api_name}Widget")
load_widget(os.path.join(os.path.dirname(api_module.__file__), f"{api_name.lower()}.kv"))
return widget_class()
except (ModuleNotFoundError, AttributeError) as e:
log.error(f"{__class__.__name__}: Error loading API {api_name}: {e}")
log.debug(f"{__class__.__name__}: {traceback.format_exc()}")
log.error("%s: Error loading API {api_name}: {e}", __class__.__name__, api_name=api_name, e=e)
log.debug("%s: %s", __class__.__name__, traceback.format_exc())
return None

# Dynamic loading of APIs based on directory structure
Expand Down
4 changes: 3 additions & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
from settings.app_settings import GlobalSettings
from api.api_factory import load_apis

# FIXME This folder shall always be created in the location of the executable, but currently will always be created in the current working directory
# NOTE Need to differentiate launch environment (Release vs. Debug) - where one gets executed via python, the other via deployed executable
TMP_FOLDER = 'tmp'

class TrailingPressedIconButton(
Expand Down Expand Up @@ -81,7 +83,7 @@ def tap_expansion_chevron(
# panel.ids.content.height += child.height if not panel.is_open else -child.height
# panel.parent.height += child.height if not panel.is_open else -child.height
# panel.parent.parent.height += child.height if not panel.is_open else -child.height
os.makedirs(TMP_FOLDER, exist_ok=True)
os.makedirs(TMP_FOLDER, exist_ok=True)

if __name__ == '__main__':
if hasattr(sys, '_MEIPASS'):
Expand Down
4 changes: 2 additions & 2 deletions src/modules/dialog/loaddialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ def on_browser_select(self, selection):
if len(self.filechooser.selection) == 0:
return
selection = selection[0]
log.debug(f"Selection: {selection}")
log.debug("Selection: %s", selection)
self.label.text = selection

def on_fileload(self):
if len(self.filechooser.selection) == 0:
log.info("No file selected")
return
selection = self.filechooser.selection[0]
log.info(f"Selected file: {selection}")
log.info("Selected file: %s", selection)
self.dismiss()
self.callback(selection)
self.label.text = ""
2 changes: 1 addition & 1 deletion src/modules/dialog/savedialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self, callback, **kwargs):
def on_browser_select(self, selection):
if len(selection) == 0:
return
log.debug(f"File selected: {selection[0]}")
log.debug("File selected: %s", selection[0])
self.filename_input.text = os.path.basename(selection[0])

def on_filesave(self, path, filename):
Expand Down
Loading