Compare commits
5 Commits
v0.1.0-alp
...
main
Author | SHA1 | Date |
---|---|---|
|
b1b81a777f | |
|
afc2ea8cf1 | |
|
fcd014bad3 | |
|
f06a6077f9 | |
|
d95a916907 |
|
@ -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.
|
|
@ -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
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue