Update Bupropion dosage in UIManager to reflect 150/300 mg
This commit is contained in:
@@ -40,9 +40,7 @@ class UIManager:
|
|||||||
icon_image = icon_image.resize(
|
icon_image = icon_image.resize(
|
||||||
size=(32, 32), resample=Image.Resampling.NEAREST
|
size=(32, 32), resample=Image.Resampling.NEAREST
|
||||||
)
|
)
|
||||||
icon_photo: ImageTk.PhotoImage = ImageTk.PhotoImage(
|
icon_photo: ImageTk.PhotoImage = ImageTk.PhotoImage(image=icon_image)
|
||||||
image=icon_image
|
|
||||||
)
|
|
||||||
self.root.iconphoto(True, icon_photo)
|
self.root.iconphoto(True, icon_photo)
|
||||||
self.root.wm_iconphoto(True, icon_photo)
|
self.root.wm_iconphoto(True, icon_photo)
|
||||||
return True
|
return True
|
||||||
@@ -55,9 +53,7 @@ class UIManager:
|
|||||||
|
|
||||||
def create_input_frame(self, parent_frame: ttk.Frame) -> Dict[str, Any]:
|
def create_input_frame(self, parent_frame: ttk.Frame) -> Dict[str, Any]:
|
||||||
"""Create and configure the input frame with all widgets."""
|
"""Create and configure the input frame with all widgets."""
|
||||||
input_frame: ttk.LabelFrame = ttk.LabelFrame(
|
input_frame: ttk.LabelFrame = ttk.LabelFrame(parent_frame, text="New Entry")
|
||||||
parent_frame, text="New Entry"
|
|
||||||
)
|
|
||||||
input_frame.grid(row=1, column=0, padx=10, pady=10, sticky="nsew")
|
input_frame.grid(row=1, column=0, padx=10, pady=10, sticky="nsew")
|
||||||
input_frame.grid_columnconfigure(1, weight=1)
|
input_frame.grid_columnconfigure(1, weight=1)
|
||||||
|
|
||||||
@@ -97,7 +93,7 @@ class UIManager:
|
|||||||
medicine_frame.grid(row=4, column=1, padx=0, pady=10, sticky="nsew")
|
medicine_frame.grid(row=4, column=1, padx=0, pady=10, sticky="nsew")
|
||||||
|
|
||||||
medicine_vars: Dict[str, Tuple[tk.IntVar, str]] = {
|
medicine_vars: Dict[str, Tuple[tk.IntVar, str]] = {
|
||||||
"bupropion": (tk.IntVar(value=0), "Bupropion 150mg"),
|
"bupropion": (tk.IntVar(value=0), "Bupropion 150/300 mg"),
|
||||||
"hydroxyzine": (tk.IntVar(value=0), "Hydroxyzine 25mg"),
|
"hydroxyzine": (tk.IntVar(value=0), "Hydroxyzine 25mg"),
|
||||||
"gabapentin": (tk.IntVar(value=0), "Gabapentin 100mg"),
|
"gabapentin": (tk.IntVar(value=0), "Gabapentin 100mg"),
|
||||||
"propranolol": (tk.IntVar(value=0), "Propranolol 10mg"),
|
"propranolol": (tk.IntVar(value=0), "Propranolol 10mg"),
|
||||||
@@ -159,9 +155,7 @@ class UIManager:
|
|||||||
"Note",
|
"Note",
|
||||||
]
|
]
|
||||||
|
|
||||||
tree: ttk.Treeview = ttk.Treeview(
|
tree: ttk.Treeview = ttk.Treeview(table_frame, columns=columns, show="headings")
|
||||||
table_frame, columns=columns, show="headings"
|
|
||||||
)
|
|
||||||
|
|
||||||
col_labels: List[str] = [
|
col_labels: List[str] = [
|
||||||
"Date",
|
"Date",
|
||||||
@@ -169,7 +163,7 @@ class UIManager:
|
|||||||
"Anxiety",
|
"Anxiety",
|
||||||
"Sleep",
|
"Sleep",
|
||||||
"Appetite",
|
"Appetite",
|
||||||
"Bupropion 150mg",
|
"Bupropion 150/300 mg",
|
||||||
"Hydroxyzine 25mg",
|
"Hydroxyzine 25mg",
|
||||||
"Gabapentin 100mg",
|
"Gabapentin 100mg",
|
||||||
"Propranolol 10mg",
|
"Propranolol 10mg",
|
||||||
@@ -198,9 +192,7 @@ class UIManager:
|
|||||||
tree.pack(side="left", fill="both", expand=True)
|
tree.pack(side="left", fill="both", expand=True)
|
||||||
|
|
||||||
# Add scrollbar
|
# Add scrollbar
|
||||||
scrollbar = ttk.Scrollbar(
|
scrollbar = ttk.Scrollbar(table_frame, orient="vertical", command=tree.yview)
|
||||||
table_frame, orient="vertical", command=tree.yview
|
|
||||||
)
|
|
||||||
tree.configure(yscrollcommand=scrollbar.set)
|
tree.configure(yscrollcommand=scrollbar.set)
|
||||||
scrollbar.pack(side="right", fill="y")
|
scrollbar.pack(side="right", fill="y")
|
||||||
|
|
||||||
@@ -208,12 +200,8 @@ class UIManager:
|
|||||||
|
|
||||||
def create_graph_frame(self, parent_frame: ttk.Frame) -> ttk.LabelFrame:
|
def create_graph_frame(self, parent_frame: ttk.Frame) -> ttk.LabelFrame:
|
||||||
"""Create and configure the graph frame."""
|
"""Create and configure the graph frame."""
|
||||||
graph_frame: ttk.LabelFrame = ttk.LabelFrame(
|
graph_frame: ttk.LabelFrame = ttk.LabelFrame(parent_frame, text="Evolution")
|
||||||
parent_frame, text="Evolution"
|
graph_frame.grid(row=0, column=0, columnspan=2, padx=10, pady=10, sticky="nsew")
|
||||||
)
|
|
||||||
graph_frame.grid(
|
|
||||||
row=0, column=0, columnspan=2, padx=10, pady=10, sticky="nsew"
|
|
||||||
)
|
|
||||||
return graph_frame
|
return graph_frame
|
||||||
|
|
||||||
def add_buttons(
|
def add_buttons(
|
||||||
@@ -253,9 +241,7 @@ class UIManager:
|
|||||||
date, dep, anx, slp, app, bup, hydro, gaba, prop, note = values
|
date, dep, anx, slp, app, bup, hydro, gaba, prop, note = values
|
||||||
|
|
||||||
# Create variables and fields
|
# Create variables and fields
|
||||||
vars_dict = self._create_edit_fields(
|
vars_dict = self._create_edit_fields(edit_win, date, dep, anx, slp, app)
|
||||||
edit_win, date, dep, anx, slp, app
|
|
||||||
)
|
|
||||||
|
|
||||||
# Medicine checkboxes
|
# Medicine checkboxes
|
||||||
current_row = 6 # After the 5 fields (date, dep, anx, slp, app)
|
current_row = 6 # After the 5 fields (date, dep, anx, slp, app)
|
||||||
@@ -276,9 +262,7 @@ class UIManager:
|
|||||||
|
|
||||||
# Buttons
|
# Buttons
|
||||||
current_row += 1
|
current_row += 1
|
||||||
self._add_edit_window_buttons(
|
self._add_edit_window_buttons(edit_win, current_row, vars_dict, callbacks)
|
||||||
edit_win, current_row, vars_dict, callbacks
|
|
||||||
)
|
|
||||||
|
|
||||||
# Make window modal
|
# Make window modal
|
||||||
edit_win.update_idletasks()
|
edit_win.update_idletasks()
|
||||||
@@ -303,9 +287,7 @@ class UIManager:
|
|||||||
try:
|
try:
|
||||||
app = int(app) if app != "" else 0
|
app = int(app) if app != "" else 0
|
||||||
except (ValueError, TypeError):
|
except (ValueError, TypeError):
|
||||||
self.logger.warning(
|
self.logger.warning(f"Invalid appetite value: {app}, defaulting to 0")
|
||||||
f"Invalid appetite value: {app}, defaulting to 0"
|
|
||||||
)
|
|
||||||
app = 0
|
app = 0
|
||||||
|
|
||||||
value_map = {
|
value_map = {
|
||||||
@@ -349,9 +331,7 @@ class UIManager:
|
|||||||
)
|
)
|
||||||
|
|
||||||
if var_type == tk.IntVar:
|
if var_type == tk.IntVar:
|
||||||
self._create_scale_with_label(
|
self._create_scale_with_label(parent, idx + 1, vars_dict[key], value)
|
||||||
parent, idx + 1, vars_dict[key], value
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
ttk.Entry(parent, textvariable=vars_dict[key]).grid(
|
ttk.Entry(parent, textvariable=vars_dict[key]).grid(
|
||||||
row=idx + 1, column=1, sticky="ew"
|
row=idx + 1, column=1, sticky="ew"
|
||||||
@@ -398,13 +378,11 @@ class UIManager:
|
|||||||
ttk.Label(parent, text="Treatment:").grid(
|
ttk.Label(parent, text="Treatment:").grid(
|
||||||
row=row, column=0, sticky="w", padx=5, pady=2
|
row=row, column=0, sticky="w", padx=5, pady=2
|
||||||
)
|
)
|
||||||
medicine_frame: ttk.LabelFrame = ttk.LabelFrame(
|
medicine_frame: ttk.LabelFrame = ttk.LabelFrame(parent, text="Medicine")
|
||||||
parent, text="Medicine"
|
|
||||||
)
|
|
||||||
medicine_frame.grid(row=row, column=1, padx=0, pady=10, sticky="nsew")
|
medicine_frame.grid(row=row, column=1, padx=0, pady=10, sticky="nsew")
|
||||||
|
|
||||||
medicine_vars: Dict[str, Tuple[int, str]] = {
|
medicine_vars: Dict[str, Tuple[int, str]] = {
|
||||||
"bupropion": (bup, "Bupropion 150mg"),
|
"bupropion": (bup, "Bupropion 150/300 mg"),
|
||||||
"hydroxyzine": (hydro, "Hydroxyzine 25mg"),
|
"hydroxyzine": (hydro, "Hydroxyzine 25mg"),
|
||||||
"gabapentin": (gaba, "Gabapentin 100mg"),
|
"gabapentin": (gaba, "Gabapentin 100mg"),
|
||||||
"propranolol": (prop, "Propranolol 10mg"),
|
"propranolol": (prop, "Propranolol 10mg"),
|
||||||
@@ -413,9 +391,9 @@ class UIManager:
|
|||||||
vars_dict: Dict[str, tk.IntVar] = {}
|
vars_dict: Dict[str, tk.IntVar] = {}
|
||||||
for idx, (key, (value, label)) in enumerate(medicine_vars.items()):
|
for idx, (key, (value, label)) in enumerate(medicine_vars.items()):
|
||||||
vars_dict[key] = tk.IntVar(value=int(value))
|
vars_dict[key] = tk.IntVar(value=int(value))
|
||||||
ttk.Checkbutton(
|
ttk.Checkbutton(medicine_frame, text=label, variable=vars_dict[key]).grid(
|
||||||
medicine_frame, text=label, variable=vars_dict[key]
|
row=idx, column=0, sticky="w", padx=5, pady=2
|
||||||
).grid(row=idx, column=0, sticky="w", padx=5, pady=2)
|
)
|
||||||
|
|
||||||
return vars_dict
|
return vars_dict
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user