Skip to content

Commit

Permalink
fix: use config file to define note column name in every widget and e…
Browse files Browse the repository at this point in the history
…xcel table
  • Loading branch information
Michele-Alberti committed Mar 17, 2024
1 parent 16c0753 commit 33e45a1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions dlunch/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,14 +346,14 @@ def reload_menu(
)
# Add order (for selecting items) and note columns
df["order"] = False
df["note"] = ""
df[config.panel.gui.note_column_name] = ""
gi.dataframe.value = df
gi.dataframe.formatters = {"order": {"type": "tickCross"}}
gi.dataframe.editors = {
"id": None,
"item": None,
"order": CheckboxEditor(),
"note": "input",
config.panel.gui.note_column_name: "input",
}
gi.dataframe.header_align = OmegaConf.to_container(
config.panel.gui.menu_column_align, resolve=True
Expand Down Expand Up @@ -693,7 +693,9 @@ def send_order(
user=username_key_press,
lunch_time=person.lunch_time,
menu_item_id=row.Index,
note=row.note.lower(),
note=getattr(
row, config.panel.gui.note_column_name
).lower(),
)
session.add(new_order)
session.commit()
Expand Down
2 changes: 1 addition & 1 deletion dlunch/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def reload_on_guest_override_callback(
# Create dataframe instance
self.dataframe = pnw.Tabulator(
name="Order",
widths={"note": 180},
widths={config.panel.gui.note_column_name: 180},
selectable=False,
stylesheets=[config.panel.gui.css_files.custom_tabulator_path],
)
Expand Down

0 comments on commit 33e45a1

Please sign in to comment.