From 243ff4b9f63fde970481a308526c6a3af46fd434 Mon Sep 17 00:00:00 2001 From: Emilia Allison Date: Tue, 25 Mar 2025 11:49:50 -0400 Subject: [PATCH] Bug fixes on Windows --- src/connection_strings.py | 6 ++---- src/instance.py | 4 ++-- src/py-auto-cel-switch.py | 7 ++----- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/connection_strings.py b/src/connection_strings.py index f09945d..97dc86b 100644 --- a/src/connection_strings.py +++ b/src/connection_strings.py @@ -1,5 +1,3 @@ -from instance import Instance - from typing import Optional @@ -7,7 +5,7 @@ CONN_STRING_PATH = r"SOFTWARE\HRE\Cellario" JSON_DEFAULT_PATH = r"C:\Program Files\HighRes Biosolutions\Cellario\appsettings.Production.json" -def generate_postgres_conn_string(instance: Instance) -> Optional[str]: +def generate_postgres_conn_string(instance: 'Instance') -> Optional[str]: if instance.db_type != "postgres": # Why?? return None @@ -17,7 +15,7 @@ def generate_postgres_conn_string(instance: Instance) -> Optional[str]: "Port=5432;SearchPath=cellario;Application Name=CellarioPostgres" -def generate_oracle_conn_string(instance: Instance) -> Optional[str]: +def generate_oracle_conn_string(instance: 'Instance') -> Optional[str]: if instance.db_type != "oracle": # Again, why?? return None diff --git a/src/instance.py b/src/instance.py index 3743a74..023f58d 100644 --- a/src/instance.py +++ b/src/instance.py @@ -40,9 +40,9 @@ class Instance: def version_is_43_or_higher(self) -> bool: version_numbers = self.version.split('.') - if version_numbers[0] < 4: + if int(version_numbers[0]) < 4: return False - if version_numbers[1] >= 3: + if int(version_numbers[1]) >= 3: return True return False diff --git a/src/py-auto-cel-switch.py b/src/py-auto-cel-switch.py index 9396d51..a242b83 100644 --- a/src/py-auto-cel-switch.py +++ b/src/py-auto-cel-switch.py @@ -11,10 +11,7 @@ from settings import MainSettings def resolve_config_path() -> str: - if '__file__' in globals(): - script_path = os.path.dirname(os.path.realpath(__file__)) - else: - script_path = os.getcwd() + script_path = os.getcwd() return script_path + "/Cellario_Switcher_DB_List.toml" @@ -50,4 +47,4 @@ def read_config_file() -> Tuple[List[Instance], Optional[MainSettings]]: if __name__ == "__main__": write_default_config_file() - start_ui(**read_config_file()) + start_ui(*read_config_file())