From 32e71006a348fe589948fd1018efceaba6fdc97b Mon Sep 17 00:00:00 2001 From: Igor Cerovsky Date: Tue, 13 Feb 2024 11:40:18 +0100 Subject: [PATCH 01/10] invalid files input --- elisa_report.py | 149 ++++++++++++++++++++++++++++++++++++++----- elisarep/mkinout.py | 42 +++++++++--- elisarep/worklist.py | 7 +- 3 files changed, 169 insertions(+), 29 deletions(-) diff --git a/elisa_report.py b/elisa_report.py index a993f87..ce37db7 100644 --- a/elisa_report.py +++ b/elisa_report.py @@ -9,13 +9,13 @@ from zlib import crc32 -from tkinter import StringVar, Button, Entry, DISABLED, Tk -from tkinter import filedialog +from tkinter import StringVar, Button, Entry, NORMAL, DISABLED, Tk +from tkinter import filedialog, messagebox from scipy.optimize import OptimizeWarning from elisarep.readdata import read_params -from elisarep.mkinout import make_input_paths +from elisarep.mkinout import make_mdil_path, make_params_path, make_worklist_path from elisarep.worklist import predil_worklist from elisarep.sample import make_concentration from elisarep.readdata import read_layouts @@ -38,6 +38,8 @@ def main_report(analysis_dir: PathLike, config_dir: PathLike, + params_file_path: PathLike, worklist_file_path: PathLike, + mdil_file_path: PathLike, docxa: bool = True, docxr: bool = False, pdf: bool = True) -> None: """ Generate main report """ @@ -46,12 +48,8 @@ def main_report(analysis_dir: PathLike, config_dir: PathLike, init_config(analysis_dir, config_dir) - input_files = make_input_paths(analysis_dir) - worklist_file_path = input_files['worklist'] - params_file_path = input_files['params'] - report_params = { - 'worklist': predil_worklist(worklist_file_path), + 'worklist': predil_worklist(worklist_file_path, mdil_file_path), 'params': read_params(params_file_path), 'layouts': read_layouts(path.join(config_dir, cfg['plate_layout_id']), path.join(config_dir, cfg['plate_layout_num']), @@ -83,14 +81,23 @@ def main_report(analysis_dir: PathLike, config_dir: PathLike, print('Done.') +def svar2path(svar: StringVar) -> PathLikeOrNone: + """ Convert entry to path + """ + if svar.get() == 'None' or not svar: + return None + return svar.get() + + class Gui: """ GUI class """ - def __init__(self, window, config_dir: PathLikeOrNone, init_folder: PathLikeOrNone) -> None: + def __init__(self, window, config_dir: PathLikeOrNone, + init_folder: PathLikeOrNone) -> None: self.window = window self.window.title('HAMILTON Analysis') - self.window.geometry("800x80") + self.window.geometry("840x220") self.init_folder = init_folder self.analysis_folder = StringVar() @@ -100,6 +107,9 @@ def __init__(self, window, config_dir: PathLikeOrNone, init_folder: PathLikeOrNo self.config_folder.set(config_dir) else: self.config_folder.set(path.join(getcwd(), 'data')) + self.params_file = StringVar(value='') + self.worklist_file = StringVar(value='') + self.mdil_file = StringVar(value='') def analysis_fn(): self.browse_analysis() @@ -117,10 +127,78 @@ def browse_fn(): button_config = Button(self.window, text="Browse Config Folder", command=browse_fn) button_config.grid(column=0, row=1) - entry_config = Entry(textvariable=self.config_folder, - state=DISABLED, width=110) - entry_config.grid(row=1, column=1, - padx=10, pady=10) + self.entry_config = Entry(textvariable=self.config_folder, + state=DISABLED, width=110) + self.entry_config.grid(row=1, column=1, + padx=10, pady=10) + + def params_fn(): + self.browse_params() + self.button_params = Button(self.window, text="Browse Parameters File", + command=params_fn, state=DISABLED) + self.button_params.grid(column=0, row=2) + self.entry_params = Entry(textvariable=self.params_file, + state=DISABLED, width=110) + self.entry_params.grid(row=2, column=1, + padx=10, pady=10) + + def worklist_fn(): + self.browse_worklist() + self.button_worklist = Button(self.window, text="Browse Worklist File", + command=worklist_fn, state=DISABLED) + self.button_worklist.grid(column=0, row=3) + self.entry_worklist = Entry(textvariable=self.worklist_file, + state=DISABLED, width=110) + self.entry_worklist.grid(row=3, column=1, + padx=10, pady=10) + + def mdil_fn(): + self.browse_mdil() + self.button_mdil = Button(self.window, text="Browse Manual Dilution File", + command=mdil_fn, state=DISABLED) + self.button_mdil.grid(column=0, row=4) + self.entry_mdil = Entry(textvariable=self.mdil_file, + state=DISABLED, width=110) + self.entry_mdil.grid(row=4, column=1, + padx=10, pady=10) + + def browse_mdil(self) -> None: + """Browse manual dilution filename""" + filename = filedialog.askopenfilename(initialdir=self.analysis_folder.get(), + title="Select Manual Dilution File", + filetypes=[('XLS Files', '*.xlsx')]) + if filename: + self.mdil_file.set(filename) + self.entry_mdil.update() + self.check_requirements( + svar2path(self.params_file), + svar2path(self.worklist_file), filename) + + def browse_worklist(self) -> None: + """Browse params filename""" + filename = filedialog.askopenfilename(initialdir=self.analysis_folder.get(), + title="Select Worklist File", + filetypes=[('XLS Files', '*.xls')]) + if filename: + self.worklist_file.set(filename) + self.entry_worklist.update() + self.check_requirements( + svar2path(self.worklist_file), + filename, + svar2path(self.mdil_file)) + + def browse_params(self) -> None: + """Brows params filename""" + filename = filedialog.askopenfilename(initialdir=self.analysis_folder.get(), + title="Select Parameters File", + filetypes=[('CSV Files', '*.csv')]) + if filename: + self.params_file.set(filename) + self.entry_params.update() + self.check_requirements( + filename, + svar2path(self.worklist_file), + svar2path(self.mdil_file)) def browse_analysis(self) -> None: """ Browse analysis folder @@ -133,7 +211,40 @@ def browse_analysis(self) -> None: if dirname: self.analysis_folder.set(dirname) self.entry_analysis.update() + params_path = make_params_path(dirname) + worklist_path = make_worklist_path(dirname) + mdil_path = make_mdil_path(dirname) + self.check_requirements(params_path, worklist_path, mdil_path) + + def check_requirements(self, params_path, worklist_path, mdil_path) -> None: + close_win = True + if not params_path: + messagebox.showwarning("Invalid file", + "Defalult parameters file is missing or file name is invalid.") + close_win = False + self.button_params['state'] = NORMAL + self.params_file.set(params_path) + self.entry_params.update() + + if not worklist_path: + messagebox.showwarning("Invalid file", + "Defalult worklist file is missing or file name is invalid.") + close_win = False + self.button_worklist['state'] = NORMAL + self.worklist_file.set(worklist_path) + self.entry_worklist.update() + + if not mdil_path: + messagebox.showwarning("Invalid file", + "Manual worklist file is missing or file name is invalid.") + close_win = False + self.button_mdil['state'] = NORMAL + self.mdil_file.set(mdil_path) + self.entry_mdil.update() + + if close_win: self.window.destroy() + return None def browse_config(self) -> None: """ Browse config folder @@ -143,11 +254,13 @@ def browse_config(self) -> None: if dirname: self.config_folder.set(dirname) + self.entry_config.update(dirname) def res(self) -> None: """ Result """ - return self.analysis_folder.get(), self.config_folder.get() + return (self.analysis_folder.get(), self.config_folder.get(), + self.params_file.get(), self.worklist_file.get(), self.mdil_file.get()) def gui_fn(config_dir: PathLikeOrNone, init_folder: PathLikeOrNone) -> PathLikeOrNone: @@ -177,13 +290,15 @@ def main() -> None: init_folder = args.ifld if not analysis_dir: - analysis_dir, config_dir = gui_fn(config_dir, init_folder) + analysis_dir, config_dir, params_file, worklist_file, mdil_file = gui_fn( + config_dir, init_folder) if not analysis_dir: print('Canceled.') return try: - main_report(analysis_dir, config_dir) + main_report(analysis_dir, config_dir, + params_file, worklist_file, mdil_file) except (KeyError, ValueError, FileNotFoundError, ) as e: print(e) print('Failed!') diff --git a/elisarep/mkinout.py b/elisarep/mkinout.py index 14c8ca9..0932a4f 100644 --- a/elisarep/mkinout.py +++ b/elisarep/mkinout.py @@ -8,7 +8,7 @@ from datetime import datetime import re -from .typing import PathLike +from .typing import PathLike, PathLikeOrNone def find_analysis(work_dir: PathLike, match_pattern: str) -> list: @@ -121,6 +121,35 @@ def basename_from_inputdir(input_dir: PathLike) -> str: return make_base_name(p['date'], p['gn']) +def make_worklist_path(input_dir: PathLikeOrNone) -> PathLikeOrNone: + """Make worklist file path""" + base_name = basename_from_inputdir(input_dir) + worklist = path.join(input_dir, base_name + 'worklist-ELISA.xls') + if not path.isfile(worklist): + return None + return worklist + + +def make_mdil_path(input_dir: PathLikeOrNone) -> PathLikeOrNone: + """Make manual dilution file path""" + base_name = basename_from_inputdir(input_dir) + mdil = path.join(input_dir, base_name + 'worklist-ELISA_ManualDil.xlsx') + if not path.isfile(mdil): + return None + return mdil + + +def make_params_path(input_dir: PathLikeOrNone) -> PathLikeOrNone: + """Make params file path""" + p = parse_dir_name(input_dir) + base_name = basename_from_inputdir(input_dir) + params = path.join(input_dir, base_name + + p['protocol'] + '_Parameters.csv') + if not path.isfile(params): + return None + return params + + def make_input_paths(input_dir: PathLike) -> dict: """Make worklist and parameters path names @@ -136,15 +165,12 @@ def make_input_paths(input_dir: PathLike) -> dict: dictionary Paths to `worklist` and `params` files """ - p = parse_dir_name(input_dir) - base_name = basename_from_inputdir(input_dir) - worklist = path.join(input_dir, base_name + 'worklist-ELISA.xls') - if not path.isfile(worklist): + worklist = make_worklist_path(input_dir) + if not worklist: raise FileNotFoundError(f"Worklist file path is invlaid: {worklist}") - params = path.join(input_dir, base_name + - p['protocol'] + '_Parameters.csv') - if not path.isfile(params): + params = make_params_path(input_dir) + if not worklist: raise FileNotFoundError("Parameters file path is invlaid: {params}") return {'worklist': worklist, 'params': params} diff --git a/elisarep/worklist.py b/elisarep/worklist.py index aff9b3e..72b07f0 100644 --- a/elisarep/worklist.py +++ b/elisarep/worklist.py @@ -5,6 +5,8 @@ import pandas as pd +from .typing import PathLike + def check_worklist(wl: pd.DataFrame) -> list: """ Find number of valid plates in worklist @@ -50,14 +52,11 @@ def worklist_sample(wl: pd.DataFrame, plate_id: int) -> tuple: return wl[cols], cols_dict -def predil_worklist(worklist_file: str) -> pd.DataFrame: +def predil_worklist(worklist_file: PathLike, worklist_predil_path: PathLike) -> pd.DataFrame: """ Create pre-dilution from worklist """ - manual_dil_name = '_ManualDil' wl = read_worklist(worklist_file) - worklist_predil_path = path.splitext( - worklist_file)[0] + manual_dil_name + '.xlsx' if path.isfile(worklist_predil_path): print(f'Reading pre-dilution from {worklist_predil_path}') wl_pdil = read_worklist(worklist_predil_path) From 69474e214e46aae19dea5683f6494b392a286a87 Mon Sep 17 00:00:00 2001 From: Igor Cerovsky Date: Wed, 14 Feb 2024 09:03:32 +0100 Subject: [PATCH 02/10] test fixes --- elisa_report.py | 47 +++++++++++++++++++++++++++----------------- elisarep/worklist.py | 6 +++--- test/test_e2e.py | 5 +++-- 3 files changed, 35 insertions(+), 23 deletions(-) diff --git a/elisa_report.py b/elisa_report.py index ce37db7..b789415 100644 --- a/elisa_report.py +++ b/elisa_report.py @@ -3,6 +3,7 @@ Generates ELISA report from photometer output; analysis performed on Hamilton robot. """ +from dataclasses import dataclass from os import path, getcwd import argparse import warnings @@ -37,31 +38,41 @@ warnings.filterwarnings('ignore', category=UserWarning, module='openpyxl') -def main_report(analysis_dir: PathLike, config_dir: PathLike, - params_file_path: PathLike, worklist_file_path: PathLike, - mdil_file_path: PathLike, +@dataclass +class InputFiles: + """ Input files + """ + sanalysis_dir: PathLike + config_dir: PathLike + params_file_path: PathLike + worklist_file_path: PathLike + mdil_file_path: PathLikeOrNone + + +def main_report(fl: InputFiles, docxa: bool = True, docxr: bool = False, pdf: bool = True) -> None: """ Generate main report """ - print(f'Analysis diretory {analysis_dir}') - print(f'Configuration directory {config_dir}') + print(f'Analysis diretory {fl.analysis_dir}') + print(f'Configuration directory {fl.config_dir}') - init_config(analysis_dir, config_dir) + init_config(fl.analysis_dir, fl.config_dir) report_params = { - 'worklist': predil_worklist(worklist_file_path, mdil_file_path), - 'params': read_params(params_file_path), - 'layouts': read_layouts(path.join(config_dir, cfg['plate_layout_id']), - path.join(config_dir, cfg['plate_layout_num']), - path.join(config_dir, cfg['plate_layout_dil_id'])), + 'worklist': predil_worklist(fl.worklist_file_path, fl.mdil_file_path), + 'params': read_params(fl.params_file_path), + 'layouts': read_layouts(path.join(fl.config_dir, cfg['plate_layout_id']), + path.join(fl.config_dir, + cfg['plate_layout_num']), + path.join(fl.config_dir, cfg['plate_layout_dil_id'])), 'refconc': make_concentration( cfg[REFVAL_NAME], cfg[DIL_NAME]) } - reports = rg.gen_report_raw(report_params, analysis_dir) + reports = rg.gen_report_raw(report_params, fl.analysis_dir) if docxa: - export_main_report(reports, analysis_dir, cfg['pandoc_bin'], - path.join(config_dir, cfg['reference_docx'])) + export_main_report(reports, fl.analysis_dir, cfg['pandoc_bin'], + path.join(fl.config_dir, cfg['reference_docx'])) for report in reports: print(f"Report for plate {report['plate']} saved as {report['path']}") @@ -217,6 +228,7 @@ def browse_analysis(self) -> None: self.check_requirements(params_path, worklist_path, mdil_path) def check_requirements(self, params_path, worklist_path, mdil_path) -> None: + """Check if all requirements are met""" close_win = True if not params_path: messagebox.showwarning("Invalid file", @@ -244,7 +256,6 @@ def check_requirements(self, params_path, worklist_path, mdil_path) -> None: if close_win: self.window.destroy() - return None def browse_config(self) -> None: """ Browse config folder @@ -254,7 +265,7 @@ def browse_config(self) -> None: if dirname: self.config_folder.set(dirname) - self.entry_config.update(dirname) + self.entry_config.update() def res(self) -> None: """ Result @@ -297,8 +308,8 @@ def main() -> None: return try: - main_report(analysis_dir, config_dir, - params_file, worklist_file, mdil_file) + main_report(InputFiles(analysis_dir, config_dir, + params_file, worklist_file, mdil_file)) except (KeyError, ValueError, FileNotFoundError, ) as e: print(e) print('Failed!') diff --git a/elisarep/worklist.py b/elisarep/worklist.py index 72b07f0..ddd9ce6 100644 --- a/elisarep/worklist.py +++ b/elisarep/worklist.py @@ -5,7 +5,7 @@ import pandas as pd -from .typing import PathLike +from .typing import PathLike, PathLikeOrNone def check_worklist(wl: pd.DataFrame) -> list: @@ -52,12 +52,12 @@ def worklist_sample(wl: pd.DataFrame, plate_id: int) -> tuple: return wl[cols], cols_dict -def predil_worklist(worklist_file: PathLike, worklist_predil_path: PathLike) -> pd.DataFrame: +def predil_worklist(worklist_file: PathLike, worklist_predil_path: PathLikeOrNone) -> pd.DataFrame: """ Create pre-dilution from worklist """ wl = read_worklist(worklist_file) - if path.isfile(worklist_predil_path): + if worklist_predil_path and path.isfile(worklist_predil_path): print(f'Reading pre-dilution from {worklist_predil_path}') wl_pdil = read_worklist(worklist_predil_path) diff --git a/test/test_e2e.py b/test/test_e2e.py index 07400b1..d64e641 100644 --- a/test/test_e2e.py +++ b/test/test_e2e.py @@ -10,7 +10,7 @@ from scipy.optimize import OptimizeWarning from elisarep.readdata import read_params -from elisarep.mkinout import make_input_paths, parse_dir_name +from elisarep.mkinout import make_input_paths, parse_dir_name, make_mdil_path from elisarep.worklist import predil_worklist from elisarep.sample import make_concentration from elisarep.readdata import read_layouts @@ -75,11 +75,12 @@ def generic_test(analysis_dir: PathLike, report_plates_crc: list, input_files = make_input_paths(analysis_dir) worklist_file_path = input_files['worklist'] params_file_path = input_files['params'] + predil_file_path = make_mdil_path(analysis_dir) init_config(analysis_dir, CONFIG_DIR) report_params = { - 'worklist': predil_worklist(worklist_file_path), + 'worklist': predil_worklist(worklist_file_path, predil_file_path), 'params': read_params(params_file_path), 'layouts': read_layouts(path.join(CONFIG_DIR, cfg['plate_layout_id']), path.join(CONFIG_DIR, cfg['plate_layout_num']), From 9f24f67c09b2b2cc6d657b3813f51a83efa9054f Mon Sep 17 00:00:00 2001 From: Igor Cerovsky Date: Wed, 14 Feb 2024 09:37:30 +0100 Subject: [PATCH 03/10] variables grouping --- elisa_report.py | 82 ++++++++++++++++++++++++++----------------------- 1 file changed, 44 insertions(+), 38 deletions(-) diff --git a/elisa_report.py b/elisa_report.py index b789415..6415302 100644 --- a/elisa_report.py +++ b/elisa_report.py @@ -42,7 +42,7 @@ class InputFiles: """ Input files """ - sanalysis_dir: PathLike + analysis_dir: PathLike config_dir: PathLike params_file_path: PathLike worklist_file_path: PathLike @@ -93,7 +93,7 @@ def main_report(fl: InputFiles, def svar2path(svar: StringVar) -> PathLikeOrNone: - """ Convert entry to path + """ Convert StringVar to path """ if svar.get() == 'None' or not svar: return None @@ -103,24 +103,30 @@ def svar2path(svar: StringVar) -> PathLikeOrNone: class Gui: """ GUI class """ + @dataclass + class GuiPaths: + """ GUI paths + """ + init_folder: PathLikeOrNone + analysis_folder: StringVar + config_folder: StringVar + params_file: StringVar + worklist_file: StringVar + mdil_file: StringVar def __init__(self, window, config_dir: PathLikeOrNone, init_folder: PathLikeOrNone) -> None: self.window = window self.window.title('HAMILTON Analysis') self.window.geometry("840x220") - self.init_folder = init_folder + self.gp = self.GuiPaths(init_folder, StringVar(), StringVar(), + StringVar(), StringVar(), StringVar()) - self.analysis_folder = StringVar() - self.analysis_folder.set('') - self.config_folder = StringVar() + self.gp.analysis_folder.set('') if config_dir: - self.config_folder.set(config_dir) + self.gp.config_folder.set(config_dir) else: - self.config_folder.set(path.join(getcwd(), 'data')) - self.params_file = StringVar(value='') - self.worklist_file = StringVar(value='') - self.mdil_file = StringVar(value='') + self.gp.config_folder.set(path.join(getcwd(), 'data')) def analysis_fn(): self.browse_analysis() @@ -128,7 +134,7 @@ def analysis_fn(): command=analysis_fn) button_analysis.grid(column=0, row=0) - self.entry_analysis = Entry(textvariable=self.analysis_folder, + self.entry_analysis = Entry(textvariable=self.gp.analysis_folder, state=DISABLED, width=110) self.entry_analysis.grid(row=0, column=1, padx=10, pady=10) @@ -138,7 +144,7 @@ def browse_fn(): button_config = Button(self.window, text="Browse Config Folder", command=browse_fn) button_config.grid(column=0, row=1) - self.entry_config = Entry(textvariable=self.config_folder, + self.entry_config = Entry(textvariable=self.gp.config_folder, state=DISABLED, width=110) self.entry_config.grid(row=1, column=1, padx=10, pady=10) @@ -148,7 +154,7 @@ def params_fn(): self.button_params = Button(self.window, text="Browse Parameters File", command=params_fn, state=DISABLED) self.button_params.grid(column=0, row=2) - self.entry_params = Entry(textvariable=self.params_file, + self.entry_params = Entry(textvariable=self.gp.params_file, state=DISABLED, width=110) self.entry_params.grid(row=2, column=1, padx=10, pady=10) @@ -158,7 +164,7 @@ def worklist_fn(): self.button_worklist = Button(self.window, text="Browse Worklist File", command=worklist_fn, state=DISABLED) self.button_worklist.grid(column=0, row=3) - self.entry_worklist = Entry(textvariable=self.worklist_file, + self.entry_worklist = Entry(textvariable=self.gp.worklist_file, state=DISABLED, width=110) self.entry_worklist.grid(row=3, column=1, padx=10, pady=10) @@ -168,59 +174,59 @@ def mdil_fn(): self.button_mdil = Button(self.window, text="Browse Manual Dilution File", command=mdil_fn, state=DISABLED) self.button_mdil.grid(column=0, row=4) - self.entry_mdil = Entry(textvariable=self.mdil_file, + self.entry_mdil = Entry(textvariable=self.gp.mdil_file, state=DISABLED, width=110) self.entry_mdil.grid(row=4, column=1, padx=10, pady=10) def browse_mdil(self) -> None: """Browse manual dilution filename""" - filename = filedialog.askopenfilename(initialdir=self.analysis_folder.get(), + filename = filedialog.askopenfilename(initialdir=self.gp.analysis_folder.get(), title="Select Manual Dilution File", filetypes=[('XLS Files', '*.xlsx')]) if filename: - self.mdil_file.set(filename) + self.gp.mdil_file.set(filename) self.entry_mdil.update() self.check_requirements( - svar2path(self.params_file), - svar2path(self.worklist_file), filename) + svar2path(self.gp.params_file), + svar2path(self.gp.worklist_file), filename) def browse_worklist(self) -> None: """Browse params filename""" - filename = filedialog.askopenfilename(initialdir=self.analysis_folder.get(), + filename = filedialog.askopenfilename(initialdir=self.gp.analysis_folder.get(), title="Select Worklist File", filetypes=[('XLS Files', '*.xls')]) if filename: - self.worklist_file.set(filename) + self.gp.worklist_file.set(filename) self.entry_worklist.update() self.check_requirements( - svar2path(self.worklist_file), + svar2path(self.gp.worklist_file), filename, - svar2path(self.mdil_file)) + svar2path(self.gp.mdil_file)) def browse_params(self) -> None: """Brows params filename""" - filename = filedialog.askopenfilename(initialdir=self.analysis_folder.get(), + filename = filedialog.askopenfilename(initialdir=self.gp.analysis_folder.get(), title="Select Parameters File", filetypes=[('CSV Files', '*.csv')]) if filename: - self.params_file.set(filename) + self.gp.params_file.set(filename) self.entry_params.update() self.check_requirements( filename, - svar2path(self.worklist_file), - svar2path(self.mdil_file)) + svar2path(self.gp.worklist_file), + svar2path(self.gp.mdil_file)) def browse_analysis(self) -> None: """ Browse analysis folder """ initialdir = getcwd() - if self.init_folder: - initialdir = self.init_folder + if self.gp.init_folder: + initialdir = self.gp.init_folder dirname = filedialog.askdirectory(initialdir=initialdir, title="Select a Hamilton Analysis Folder") if dirname: - self.analysis_folder.set(dirname) + self.gp.analysis_folder.set(dirname) self.entry_analysis.update() params_path = make_params_path(dirname) worklist_path = make_worklist_path(dirname) @@ -235,7 +241,7 @@ def check_requirements(self, params_path, worklist_path, mdil_path) -> None: "Defalult parameters file is missing or file name is invalid.") close_win = False self.button_params['state'] = NORMAL - self.params_file.set(params_path) + self.gp.params_file.set(params_path) self.entry_params.update() if not worklist_path: @@ -243,7 +249,7 @@ def check_requirements(self, params_path, worklist_path, mdil_path) -> None: "Defalult worklist file is missing or file name is invalid.") close_win = False self.button_worklist['state'] = NORMAL - self.worklist_file.set(worklist_path) + self.gp.worklist_file.set(worklist_path) self.entry_worklist.update() if not mdil_path: @@ -251,7 +257,7 @@ def check_requirements(self, params_path, worklist_path, mdil_path) -> None: "Manual worklist file is missing or file name is invalid.") close_win = False self.button_mdil['state'] = NORMAL - self.mdil_file.set(mdil_path) + self.gp.mdil_file.set(mdil_path) self.entry_mdil.update() if close_win: @@ -260,18 +266,18 @@ def check_requirements(self, params_path, worklist_path, mdil_path) -> None: def browse_config(self) -> None: """ Browse config folder """ - dirname = filedialog.askdirectory(initialdir=self.config_folder.get(), + dirname = filedialog.askdirectory(initialdir=self.gp.config_folder.get(), title="Select a Config Folder") if dirname: - self.config_folder.set(dirname) + self.gp.config_folder.set(dirname) self.entry_config.update() def res(self) -> None: """ Result """ - return (self.analysis_folder.get(), self.config_folder.get(), - self.params_file.get(), self.worklist_file.get(), self.mdil_file.get()) + return (self.gp.analysis_folder.get(), self.gp.config_folder.get(), + self.gp.params_file.get(), self.gp.worklist_file.get(), self.gp.mdil_file.get()) def gui_fn(config_dir: PathLikeOrNone, init_folder: PathLikeOrNone) -> PathLikeOrNone: From 6ad5b39658bf2d83083af23edb893334692164ab Mon Sep 17 00:00:00 2001 From: Igor Cerovsky Date: Wed, 14 Feb 2024 12:42:15 +0100 Subject: [PATCH 04/10] GUI class refactoring_1 --- elisa_report.py | 159 ++++++++++++++++++++---------------------------- 1 file changed, 66 insertions(+), 93 deletions(-) diff --git a/elisa_report.py b/elisa_report.py index 6415302..a3da297 100644 --- a/elisa_report.py +++ b/elisa_report.py @@ -103,131 +103,101 @@ def svar2path(svar: StringVar) -> PathLikeOrNone: class Gui: """ GUI class """ - @dataclass - class GuiPaths: - """ GUI paths + class BrowsePath: + """ Browse path """ - init_folder: PathLikeOrNone - analysis_folder: StringVar - config_folder: StringVar - params_file: StringVar - worklist_file: StringVar - mdil_file: StringVar + + def __init__(self, wnd, text: str, command, col, row, var: str = None) -> None: + self.button = Button(wnd, text=text, command=command) + self.var = StringVar() + self.var.set(var) + self.entry = Entry(textvariable=self.var, + state=DISABLED, width=110) + self.button.grid(column=col, row=row) + self.entry.grid(row=row, column=col+1, + padx=10, pady=10) def __init__(self, window, config_dir: PathLikeOrNone, init_folder: PathLikeOrNone) -> None: self.window = window self.window.title('HAMILTON Analysis') self.window.geometry("840x220") - self.gp = self.GuiPaths(init_folder, StringVar(), StringVar(), - StringVar(), StringVar(), StringVar()) - - self.gp.analysis_folder.set('') - if config_dir: - self.gp.config_folder.set(config_dir) - else: - self.gp.config_folder.set(path.join(getcwd(), 'data')) + self.init_folder = init_folder def analysis_fn(): self.browse_analysis() - button_analysis = Button(self.window, text="Browse Analysis Folder", - command=analysis_fn) - button_analysis.grid(column=0, row=0) + self.analysis = self.BrowsePath(self.window, text="Browse Analysis Folder", + command=analysis_fn, row=0, col=0) - self.entry_analysis = Entry(textvariable=self.gp.analysis_folder, - state=DISABLED, width=110) - self.entry_analysis.grid(row=0, column=1, - padx=10, pady=10) + cfg_folder = config_dir if config_dir else path.join(getcwd(), 'data') def browse_fn(): self.browse_config() - button_config = Button(self.window, text="Browse Config Folder", - command=browse_fn) - button_config.grid(column=0, row=1) - self.entry_config = Entry(textvariable=self.gp.config_folder, - state=DISABLED, width=110) - self.entry_config.grid(row=1, column=1, - padx=10, pady=10) + self.config = self.BrowsePath(self.window, text="Browse Config Folder", + command=browse_fn, row=1, col=0, var=cfg_folder) def params_fn(): self.browse_params() - self.button_params = Button(self.window, text="Browse Parameters File", - command=params_fn, state=DISABLED) - self.button_params.grid(column=0, row=2) - self.entry_params = Entry(textvariable=self.gp.params_file, - state=DISABLED, width=110) - self.entry_params.grid(row=2, column=1, - padx=10, pady=10) + self.params = self.BrowsePath(self.window, text="Browse Parameters File", + command=params_fn, row=2, col=0) def worklist_fn(): self.browse_worklist() - self.button_worklist = Button(self.window, text="Browse Worklist File", - command=worklist_fn, state=DISABLED) - self.button_worklist.grid(column=0, row=3) - self.entry_worklist = Entry(textvariable=self.gp.worklist_file, - state=DISABLED, width=110) - self.entry_worklist.grid(row=3, column=1, - padx=10, pady=10) + self.worklist = self.BrowsePath(self.window, text="Browse Worklist File", + command=worklist_fn, row=3, col=0) def mdil_fn(): self.browse_mdil() - self.button_mdil = Button(self.window, text="Browse Manual Dilution File", - command=mdil_fn, state=DISABLED) - self.button_mdil.grid(column=0, row=4) - self.entry_mdil = Entry(textvariable=self.gp.mdil_file, - state=DISABLED, width=110) - self.entry_mdil.grid(row=4, column=1, - padx=10, pady=10) + self.mdil = self.BrowsePath(self.window, text="Browse Manual Dilution File", + command=mdil_fn, row=4, col=0) def browse_mdil(self) -> None: """Browse manual dilution filename""" - filename = filedialog.askopenfilename(initialdir=self.gp.analysis_folder.get(), + filename = filedialog.askopenfilename(initialdir=self.analysis.var.get(), title="Select Manual Dilution File", filetypes=[('XLS Files', '*.xlsx')]) if filename: - self.gp.mdil_file.set(filename) - self.entry_mdil.update() - self.check_requirements( - svar2path(self.gp.params_file), - svar2path(self.gp.worklist_file), filename) + self.mdil.var.set(filename) + self.mdil.entry.update() + self.check_requirements(svar2path(self.params.var), + svar2path(self.worklist. var), + filename) def browse_worklist(self) -> None: """Browse params filename""" - filename = filedialog.askopenfilename(initialdir=self.gp.analysis_folder.get(), + filename = filedialog.askopenfilename(initialdir=self.analysis.var.get(), title="Select Worklist File", filetypes=[('XLS Files', '*.xls')]) if filename: - self.gp.worklist_file.set(filename) - self.entry_worklist.update() - self.check_requirements( - svar2path(self.gp.worklist_file), - filename, - svar2path(self.gp.mdil_file)) + self.worklist. var.set(filename) + self.worklist.entry.update() + self.check_requirements(svar2path(self.worklist. var), + filename, + svar2path(self.mdil.var)) def browse_params(self) -> None: """Brows params filename""" - filename = filedialog.askopenfilename(initialdir=self.gp.analysis_folder.get(), + filename = filedialog.askopenfilename(initialdir=self.analysis.var.get(), title="Select Parameters File", filetypes=[('CSV Files', '*.csv')]) if filename: - self.gp.params_file.set(filename) - self.entry_params.update() - self.check_requirements( - filename, - svar2path(self.gp.worklist_file), - svar2path(self.gp.mdil_file)) + self.params.var.set(filename) + self.params.entry.update() + self.check_requirements(filename, + svar2path(self.worklist.var), + svar2path(self.mdil.var)) def browse_analysis(self) -> None: """ Browse analysis folder """ initialdir = getcwd() - if self.gp.init_folder: - initialdir = self.gp.init_folder + if self.init_folder: + initialdir = self.init_folder dirname = filedialog.askdirectory(initialdir=initialdir, title="Select a Hamilton Analysis Folder") if dirname: - self.gp.analysis_folder.set(dirname) - self.entry_analysis.update() + self.analysis.var.set(dirname) + self.analysis.entry.update() params_path = make_params_path(dirname) worklist_path = make_worklist_path(dirname) mdil_path = make_mdil_path(dirname) @@ -238,27 +208,30 @@ def check_requirements(self, params_path, worklist_path, mdil_path) -> None: close_win = True if not params_path: messagebox.showwarning("Invalid file", - "Defalult parameters file is missing or file name is invalid.") + "Defalult parameters file is missing \nor file name is invalid.", + parent=self.window) close_win = False - self.button_params['state'] = NORMAL - self.gp.params_file.set(params_path) - self.entry_params.update() + self.params.button['state'] = NORMAL + self.params.var.set(params_path) + self.params.entry.update() if not worklist_path: messagebox.showwarning("Invalid file", - "Defalult worklist file is missing or file name is invalid.") + "Defalult worklist file is missing or \nfile name is invalid.", + parent=self.window) close_win = False - self.button_worklist['state'] = NORMAL - self.gp.worklist_file.set(worklist_path) - self.entry_worklist.update() + self.worklist.button['state'] = NORMAL + self.worklist.var.set(worklist_path) + self.worklist.entry.update() if not mdil_path: messagebox.showwarning("Invalid file", - "Manual worklist file is missing or file name is invalid.") + "Manual dilution worklist file is missing \nor file name is invalid.", + parent=self.window) close_win = False - self.button_mdil['state'] = NORMAL - self.gp.mdil_file.set(mdil_path) - self.entry_mdil.update() + self.mdil.button['state'] = NORMAL + self.mdil.var.set(mdil_path) + self.mdil.entry.update() if close_win: self.window.destroy() @@ -266,18 +239,18 @@ def check_requirements(self, params_path, worklist_path, mdil_path) -> None: def browse_config(self) -> None: """ Browse config folder """ - dirname = filedialog.askdirectory(initialdir=self.gp.config_folder.get(), + dirname = filedialog.askdirectory(initialdir=self.config.var.get(), title="Select a Config Folder") if dirname: - self.gp.config_folder.set(dirname) - self.entry_config.update() + self.config.var.set(dirname) + self.config.entry.update() def res(self) -> None: """ Result """ - return (self.gp.analysis_folder.get(), self.gp.config_folder.get(), - self.gp.params_file.get(), self.gp.worklist_file.get(), self.gp.mdil_file.get()) + return (self.analysis.var.get(), self.config.var.get(), + self.params.var.get(), self.worklist.var.get(), self.mdil.var.get()) def gui_fn(config_dir: PathLikeOrNone, init_folder: PathLikeOrNone) -> PathLikeOrNone: From 8c99df4cca54016adefc75b861d8092010715c5d Mon Sep 17 00:00:00 2001 From: Igor Cerovsky Date: Wed, 14 Feb 2024 13:17:41 +0100 Subject: [PATCH 05/10] gui refactoring_2 --- elisa_report.py | 82 +++++++++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 37 deletions(-) diff --git a/elisa_report.py b/elisa_report.py index a3da297..85f4847 100644 --- a/elisa_report.py +++ b/elisa_report.py @@ -92,12 +92,12 @@ def main_report(fl: InputFiles, print('Done.') -def svar2path(svar: StringVar) -> PathLikeOrNone: - """ Convert StringVar to path +def add_msg(msg, add: str) -> None: + """ Add message """ - if svar.get() == 'None' or not svar: - return None - return svar.get() + if msg: + return msg + '\n' + add + return add class Gui: @@ -117,6 +117,19 @@ def __init__(self, wnd, text: str, command, col, row, var: str = None) -> None: self.entry.grid(row=row, column=col+1, padx=10, pady=10) + def val(self) -> str: + """ Value + """ + if self.var.get() == 'None': + return None + return self.var.get() + + def set(self, val: str) -> None: + """ Set value + """ + self.var.set(val) + self.entry.update() + def __init__(self, window, config_dir: PathLikeOrNone, init_folder: PathLikeOrNone) -> None: self.window = window @@ -153,39 +166,39 @@ def mdil_fn(): def browse_mdil(self) -> None: """Browse manual dilution filename""" - filename = filedialog.askopenfilename(initialdir=self.analysis.var.get(), + filename = filedialog.askopenfilename(initialdir=self.analysis.val(), title="Select Manual Dilution File", filetypes=[('XLS Files', '*.xlsx')]) if filename: self.mdil.var.set(filename) self.mdil.entry.update() - self.check_requirements(svar2path(self.params.var), - svar2path(self.worklist. var), + self.check_requirements(self.params.val(), + self.worklist.val(), filename) def browse_worklist(self) -> None: """Browse params filename""" - filename = filedialog.askopenfilename(initialdir=self.analysis.var.get(), + filename = filedialog.askopenfilename(initialdir=self.analysis.val(), title="Select Worklist File", filetypes=[('XLS Files', '*.xls')]) if filename: self.worklist. var.set(filename) self.worklist.entry.update() - self.check_requirements(svar2path(self.worklist. var), + self.check_requirements(self.worklist.val(), filename, - svar2path(self.mdil.var)) + self.mdil.val()) def browse_params(self) -> None: """Brows params filename""" - filename = filedialog.askopenfilename(initialdir=self.analysis.var.get(), + filename = filedialog.askopenfilename(initialdir=self.analysis.val(), title="Select Parameters File", filetypes=[('CSV Files', '*.csv')]) if filename: self.params.var.set(filename) self.params.entry.update() self.check_requirements(filename, - svar2path(self.worklist.var), - svar2path(self.mdil.var)) + self.worklist.val(), + self.mdil.val()) def browse_analysis(self) -> None: """ Browse analysis folder @@ -205,41 +218,36 @@ def browse_analysis(self) -> None: def check_requirements(self, params_path, worklist_path, mdil_path) -> None: """Check if all requirements are met""" - close_win = True + msg = None if not params_path: - messagebox.showwarning("Invalid file", - "Defalult parameters file is missing \nor file name is invalid.", - parent=self.window) - close_win = False + msg = add_msg( + msg, "Defalult parameters file is missing \nor file name is invalid.\n") self.params.button['state'] = NORMAL - self.params.var.set(params_path) - self.params.entry.update() + self.params.set(params_path) if not worklist_path: - messagebox.showwarning("Invalid file", - "Defalult worklist file is missing or \nfile name is invalid.", - parent=self.window) - close_win = False + msg = add_msg( + msg, "Defalult worklist file is missing or \nfile name is invalid.\n") self.worklist.button['state'] = NORMAL - self.worklist.var.set(worklist_path) - self.worklist.entry.update() + self.worklist.set(worklist_path) if not mdil_path: - messagebox.showwarning("Invalid file", - "Manual dilution worklist file is missing \nor file name is invalid.", - parent=self.window) - close_win = False + msg = add_msg( + msg, "Defalult manual dilution worklist file is missing \nor file name is invalid.") self.mdil.button['state'] = NORMAL - self.mdil.var.set(mdil_path) - self.mdil.entry.update() + self.mdil.set(mdil_path) - if close_win: + if msg: + messagebox.showwarning("Invalid file", + msg, + parent=self.window) + else: self.window.destroy() def browse_config(self) -> None: """ Browse config folder """ - dirname = filedialog.askdirectory(initialdir=self.config.var.get(), + dirname = filedialog.askdirectory(initialdir=self.config.val(), title="Select a Config Folder") if dirname: @@ -249,8 +257,8 @@ def browse_config(self) -> None: def res(self) -> None: """ Result """ - return (self.analysis.var.get(), self.config.var.get(), - self.params.var.get(), self.worklist.var.get(), self.mdil.var.get()) + return (self.analysis.val(), self.config.val(), + self.params.val(), self.worklist.val(), self.mdil.val()) def gui_fn(config_dir: PathLikeOrNone, init_folder: PathLikeOrNone) -> PathLikeOrNone: From efe32ad66d8cef54e80ce12b3565afa650c97eeb Mon Sep 17 00:00:00 2001 From: Igor Cerovsky Date: Wed, 14 Feb 2024 13:33:42 +0100 Subject: [PATCH 06/10] gui refactoring_3 --- elisa_report.py | 76 +++++++++++++++++++++++-------------------------- 1 file changed, 35 insertions(+), 41 deletions(-) diff --git a/elisa_report.py b/elisa_report.py index 85f4847..5504d96 100644 --- a/elisa_report.py +++ b/elisa_report.py @@ -107,14 +107,14 @@ class BrowsePath: """ Browse path """ - def __init__(self, wnd, text: str, command, col, row, var: str = None) -> None: - self.button = Button(wnd, text=text, command=command) + def __init__(self, wnd, text: str, command, col, row, var: str = None, bstate=NORMAL) -> None: + self.button = Button(wnd, text=text, command=command, state=bstate) self.var = StringVar() self.var.set(var) self.entry = Entry(textvariable=self.var, state=DISABLED, width=110) self.button.grid(column=col, row=row) - self.entry.grid(row=row, column=col+1, + self.entry.grid(row=row, column=col + 1, padx=10, pady=10) def val(self) -> str: @@ -129,6 +129,7 @@ def set(self, val: str) -> None: """ self.var.set(val) self.entry.update() + self.button['state'] = NORMAL def __init__(self, window, config_dir: PathLikeOrNone, init_folder: PathLikeOrNone) -> None: @@ -136,69 +137,67 @@ def __init__(self, window, config_dir: PathLikeOrNone, self.window.title('HAMILTON Analysis') self.window.geometry("840x220") self.init_folder = init_folder + self.group = {} def analysis_fn(): self.browse_analysis() - self.analysis = self.BrowsePath(self.window, text="Browse Analysis Folder", - command=analysis_fn, row=0, col=0) + self.group["analysis"] = self.BrowsePath(self.window, text="Browse Analysis Folder", + command=analysis_fn, row=0, col=0) cfg_folder = config_dir if config_dir else path.join(getcwd(), 'data') def browse_fn(): self.browse_config() - self.config = self.BrowsePath(self.window, text="Browse Config Folder", - command=browse_fn, row=1, col=0, var=cfg_folder) + self.group["config"] = self.BrowsePath(self.window, text="Browse Config Folder", + command=browse_fn, row=1, col=0, var=cfg_folder) def params_fn(): self.browse_params() - self.params = self.BrowsePath(self.window, text="Browse Parameters File", - command=params_fn, row=2, col=0) + self.group["params"] = self.BrowsePath(self.window, text="Browse Parameters File", + command=params_fn, row=2, col=0, bstate=DISABLED) def worklist_fn(): self.browse_worklist() - self.worklist = self.BrowsePath(self.window, text="Browse Worklist File", - command=worklist_fn, row=3, col=0) + self.group["worklist"] = self.BrowsePath(self.window, text="Browse Worklist File", + command=worklist_fn, row=3, col=0, bstate=DISABLED) def mdil_fn(): self.browse_mdil() - self.mdil = self.BrowsePath(self.window, text="Browse Manual Dilution File", - command=mdil_fn, row=4, col=0) + self.group["mdil"] = self.BrowsePath(self.window, text="Browse Manual Dilution File", + command=mdil_fn, row=4, col=0, bstate=DISABLED) def browse_mdil(self) -> None: """Browse manual dilution filename""" - filename = filedialog.askopenfilename(initialdir=self.analysis.val(), + filename = filedialog.askopenfilename(initialdir=self.group["analysis"].val(), title="Select Manual Dilution File", filetypes=[('XLS Files', '*.xlsx')]) if filename: - self.mdil.var.set(filename) - self.mdil.entry.update() - self.check_requirements(self.params.val(), - self.worklist.val(), + self.group["mdil"].set(filename) + self.check_requirements(self.group["params"].val(), + self.group["worklist"].val(), filename) def browse_worklist(self) -> None: """Browse params filename""" - filename = filedialog.askopenfilename(initialdir=self.analysis.val(), + filename = filedialog.askopenfilename(initialdir=self.group["analysis"].val(), title="Select Worklist File", filetypes=[('XLS Files', '*.xls')]) if filename: - self.worklist. var.set(filename) - self.worklist.entry.update() - self.check_requirements(self.worklist.val(), + self.group["worklist"].set(filename) + self.check_requirements(self.group["worklist"].val(), filename, - self.mdil.val()) + self.group["mdil"].val()) def browse_params(self) -> None: """Brows params filename""" - filename = filedialog.askopenfilename(initialdir=self.analysis.val(), + filename = filedialog.askopenfilename(initialdir=self.group["analysis"].val(), title="Select Parameters File", filetypes=[('CSV Files', '*.csv')]) if filename: - self.params.var.set(filename) - self.params.entry.update() + self.group["params"].set(filename) self.check_requirements(filename, - self.worklist.val(), - self.mdil.val()) + self.group["worklist"].val(), + self.group["mdil"].val()) def browse_analysis(self) -> None: """ Browse analysis folder @@ -209,8 +208,7 @@ def browse_analysis(self) -> None: dirname = filedialog.askdirectory(initialdir=initialdir, title="Select a Hamilton Analysis Folder") if dirname: - self.analysis.var.set(dirname) - self.analysis.entry.update() + self.group["analysis"].set(dirname) params_path = make_params_path(dirname) worklist_path = make_worklist_path(dirname) mdil_path = make_mdil_path(dirname) @@ -222,20 +220,17 @@ def check_requirements(self, params_path, worklist_path, mdil_path) -> None: if not params_path: msg = add_msg( msg, "Defalult parameters file is missing \nor file name is invalid.\n") - self.params.button['state'] = NORMAL - self.params.set(params_path) + self.group["params"].set(params_path) if not worklist_path: msg = add_msg( msg, "Defalult worklist file is missing or \nfile name is invalid.\n") - self.worklist.button['state'] = NORMAL - self.worklist.set(worklist_path) + self.group["worklist"].set(worklist_path) if not mdil_path: msg = add_msg( msg, "Defalult manual dilution worklist file is missing \nor file name is invalid.") - self.mdil.button['state'] = NORMAL - self.mdil.set(mdil_path) + self.group["mdil"].set(mdil_path) if msg: messagebox.showwarning("Invalid file", @@ -247,18 +242,17 @@ def check_requirements(self, params_path, worklist_path, mdil_path) -> None: def browse_config(self) -> None: """ Browse config folder """ - dirname = filedialog.askdirectory(initialdir=self.config.val(), + dirname = filedialog.askdirectory(initialdir=self.group["config"].val(), title="Select a Config Folder") if dirname: - self.config.var.set(dirname) - self.config.entry.update() + self.group["config"].set(dirname) def res(self) -> None: """ Result """ - return (self.analysis.val(), self.config.val(), - self.params.val(), self.worklist.val(), self.mdil.val()) + return (self.group["analysis"].val(), self.group["config"].val(), + self.group["params"].val(), self.group["worklist"].val(), self.group["mdil"].val()) def gui_fn(config_dir: PathLikeOrNone, init_folder: PathLikeOrNone) -> PathLikeOrNone: From cc6e4fb1ecf294a056dfa68912d862c0adb2d893 Mon Sep 17 00:00:00 2001 From: Igor Cerovsky Date: Wed, 14 Feb 2024 13:37:21 +0100 Subject: [PATCH 07/10] lint --- elisa_report.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/elisa_report.py b/elisa_report.py index 5504d96..0a63b93 100644 --- a/elisa_report.py +++ b/elisa_report.py @@ -107,7 +107,10 @@ class BrowsePath: """ Browse path """ - def __init__(self, wnd, text: str, command, col, row, var: str = None, bstate=NORMAL) -> None: + def __init__(self, wnd, text: str, command, + col, row, + var: str = None, + bstate=NORMAL) -> None: # pylint: disable=too-many-arguments self.button = Button(wnd, text=text, command=command, state=bstate) self.var = StringVar() self.var.set(var) From ead2909b927fc9df016daa1c4657f9ba266d93dc Mon Sep 17 00:00:00 2001 From: Igor Cerovsky Date: Wed, 14 Feb 2024 13:39:47 +0100 Subject: [PATCH 08/10] lints test --- elisa_report.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elisa_report.py b/elisa_report.py index 0a63b93..8551884 100644 --- a/elisa_report.py +++ b/elisa_report.py @@ -107,10 +107,10 @@ class BrowsePath: """ Browse path """ - def __init__(self, wnd, text: str, command, + def __init__(self, wnd, text: str, command, # pylint: disable=too-many-arguments col, row, var: str = None, - bstate=NORMAL) -> None: # pylint: disable=too-many-arguments + bstate=NORMAL) -> None: self.button = Button(wnd, text=text, command=command, state=bstate) self.var = StringVar() self.var.set(var) From a39468f176e63cce66e20633e7d5a683a71e35f6 Mon Sep 17 00:00:00 2001 From: Igor Cerovsky Date: Wed, 14 Feb 2024 13:51:23 +0100 Subject: [PATCH 09/10] tasks update --- elisa_report.py | 2 +- tasks.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/elisa_report.py b/elisa_report.py index 8551884..beea37a 100644 --- a/elisa_report.py +++ b/elisa_report.py @@ -137,7 +137,7 @@ def set(self, val: str) -> None: def __init__(self, window, config_dir: PathLikeOrNone, init_folder: PathLikeOrNone) -> None: self.window = window - self.window.title('HAMILTON Analysis') + self.window.title('HAMILTON ELISA Analysis') self.window.geometry("840x220") self.init_folder = init_folder self.group = {} diff --git a/tasks.md b/tasks.md index 2881984..ea81a9d 100644 --- a/tasks.md +++ b/tasks.md @@ -20,6 +20,10 @@ ## Done +## KW08-19.02.2024 + +- GUI: browse worklist, parameter, manual dilution files if not automatically found + ## KW06-05.02.2024 - asdd footer to docx with "Generated with elisarep v#.#.# on DateTime" From a4fa572652d24a76fe841312a4da63e740d2519f Mon Sep 17 00:00:00 2001 From: Igor Cerovsky Date: Wed, 21 Feb 2024 13:04:31 +0100 Subject: [PATCH 10/10] version 0.1.7 --- CHANGELOG.md | 6 ++++++ elisarep/config.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f6c5e6..a745ea9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Hamiltom report changelog +## v0.1.8 + +21.0.2.2024 + +- UI to browse prameters, worklist, manual dilution files + ## v0.1.6 - unit tests diff --git a/elisarep/config.py b/elisarep/config.py index 9085a81..fd09916 100644 --- a/elisarep/config.py +++ b/elisarep/config.py @@ -9,7 +9,7 @@ from .typing import PathLike -VERSION = '0.1.6' +VERSION = '0.1.7' DESCRIPTION = 'Hamilton report generation for ELISA' LONG_DESCRIPTION = 'Genrate report from Hamilton photometer output for ELISA.' NAME = 'elisarep'