Compare commits

...

5 Commits

Author SHA1 Message Date
Emilia Allison b1b81a777f
Import bugfix 2025-04-10 09:34:56 -04:00
Emilia Allison afc2ea8cf1
Add README.md 2025-04-09 11:26:40 -04:00
Emilia Allison fcd014bad3
Add scrollbar to interface 2025-04-09 11:09:02 -04:00
Emilia Allison f06a6077f9
Patch type for 4.3 functionality 2025-04-09 11:09:01 -04:00
Emilia Allison d95a916907
fix: Set CWD in .bat launcher 2025-03-25 14:24:22 -04:00
4 changed files with 75 additions and 5 deletions

52
README.md Normal file
View File

@ -0,0 +1,52 @@
# CellarioScheduler Database Switcher
## Usage
To run the switcher, execute the `.bat` file as an administrator.
To preserve compatability with older verisons of CellarioScheduler and their default install locations,
you must run with write access to `C:\Program Files\HighRes Biosolutions`.
When running the tool for the first time, a config file (extension `.toml`) will be generated.
Edit this file to add additional databases.
The format of this file is outlined below.
After you have added your databases to the config file, restart the tool and they should appear as buttons.
Clicking a button will:
1. Either alter the registry entry for the connection string (<=4.2) or alter `appsettings.Production.json` (>=4.3)
to reflect your database settings.
2. Create a symlink from the specified CellarioScheduler directory to `C:\Program Files\HighRes Biosolutions\Cellario`
- If a real install of CellarioScheduler already exists here, it is automatically renamed with a random suffix so it
will not be clobbered.
3. Launches CellarioScheduler
## Configuration
A database entry has the following sections:
### Entry Name
This is the part in the square brackets.
Whatever is entered here will appear in the UI.
Spaces are not permitted, underscores and hyphens are permitted.
### DatabaseUser
This is the user login for the database.
It should be verbatim what you would use to log in to your database.
### DatabasePassword
This is the password for the database.
It is likely either `postgres` or `oracle`.
### DatabaseType
Either `postgres` or `oracle`
### CellarioDirectory
This is the absolute path to your installation directory for CellarioScheduler.
This allows you to associate a particular database with a given installation of CS.
The backslash characters `\` must be escaped with another backslash character `\`;
see the example database if this is unclear.
### Version
This is the version of CellarioScheduler installed in `CellarioDirectory`.
You do not need to enter the full version, only the major and minor version numbers (i.e. `4.1` is sufficient).
This is only used to determine if the registry should be altered or if appsettings should be altered.

View File

@ -1,2 +1,4 @@
@echo on @echo on
cd %~dp0
python %~dp0\src\py-auto-cel-switch.py python %~dp0\src\py-auto-cel-switch.py

View File

@ -66,7 +66,7 @@ def set_conn_string_json(conn_string: str,
else: else:
proper_db_type = "Oracle" proper_db_type = "Oracle"
app_settings["ConnectionStrings"] = conn_string app_settings["ConnectionStrings"]["Cellario"] = conn_string
app_settings["DatabaseType"] = proper_db_type app_settings["DatabaseType"] = proper_db_type
with open(json_path, 'w') as f: with open(json_path, 'w') as f:

View File

@ -1,4 +1,4 @@
from tkinter import Tk from tkinter import Tk, Canvas, Scrollbar VERTICAL, LEFT, RIGHT, Y, BOTH
from tkinter import ttk from tkinter import ttk
from instance import Instance, gen_function_for_instance from instance import Instance, gen_function_for_instance
@ -7,14 +7,30 @@ from settings import MainSettings, SortType
def start_ui(instances: [Instance], settings): def start_ui(instances: [Instance], settings):
root = Tk() root = Tk()
frame = ttk.Frame(root, padding=50)
frame.grid()
ttk.Label(frame, text="Available Databases").grid(column=0, row=0)
# Alphanumeric sorting # Alphanumeric sorting
if MainSettings.Sort == SortType.ALPHA: if MainSettings.Sort == SortType.ALPHA:
instances = list(sorted(instances)) instances = list(sorted(instances))
canvas = Canvas(root)
scrollbar = Scrollbar(root, orient=VERTICAL, command=canvas.yview)
frame = ttk.Frame(canvas)
frame.bind(
"<Configure>",
lambda e: canvas.configure(
scrollregion=canvas.bbox("all")
)
)
canvas.create_window((0, 0), window=frame, anchor="nw")
canvas.configure(yscrollcommand=scrollbar.set)
canvas.pack(side=LEFT, fill=BOTH, expand=True)
scrollbar.pack(side=RIGHT, fill=Y)
ttk.Label(frame, text="Available Databases").grid(column=0, row=0)
for row, instance in enumerate(instances): for row, instance in enumerate(instances):
if instance.disable and not MainSettings.ShowAll: if instance.disable and not MainSettings.ShowAll:
continue continue