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