Compare commits

..

No commits in common. "main" and "v0.1.0-alpha" have entirely different histories.

4 changed files with 5 additions and 75 deletions

View File

@ -1,52 +0,0 @@
# 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,4 +1,2 @@
@echo on
cd %~dp0
python %~dp0\src\py-auto-cel-switch.py

View File

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

View File

@ -1,4 +1,4 @@
from tkinter import Tk, Canvas, Scrollbar VERTICAL, LEFT, RIGHT, Y, BOTH
from tkinter import Tk
from tkinter import ttk
from instance import Instance, gen_function_for_instance
@ -7,30 +7,14 @@ from settings import MainSettings, SortType
def start_ui(instances: [Instance], settings):
root = Tk()
frame = ttk.Frame(root, padding=50)
frame.grid()
ttk.Label(frame, text="Available Databases").grid(column=0, row=0)
# Alphanumeric sorting
if MainSettings.Sort == SortType.ALPHA:
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):
if instance.disable and not MainSettings.ShowAll:
continue