|
@@ -1,6 +1,6 @@
|
|
|
#!/usr/bin/python3
|
|
|
#
|
|
|
-# Copyright (c) Daniel Sheffield 2021
|
|
|
+# Copyright (c) Daniel Sheffield 2021 - 2022
|
|
|
#
|
|
|
# All rights reserved
|
|
|
#
|
|
@@ -79,14 +79,6 @@ cols = [
|
|
|
)
|
|
|
]
|
|
|
|
|
|
-def _apply_choice_callback(
|
|
|
- activity_manager: ActivityManager,
|
|
|
- base: str, name: str, value: str
|
|
|
-):
|
|
|
- base = activity_manager.get(base)
|
|
|
- base.apply_choice(name, value)
|
|
|
- activity_manager.show(base.update())
|
|
|
-
|
|
|
def _insert_new_product_callback(activity_manager, query_manager, product, category, group):
|
|
|
activity_manager.app.log.write(
|
|
|
'{};\n'.format(get_insert_product_statement(product, category, group)))
|
|
@@ -102,13 +94,13 @@ def _new_product_callback(
|
|
|
txn : TransactionEditor = activity_manager.get('transaction')
|
|
|
activity_manager.show(
|
|
|
activity_manager.create(NewProduct, 'new_product',
|
|
|
- query_manager, cur, name, txn.data,
|
|
|
+ activity_manager, query_manager,
|
|
|
+ cur, name, txn.data,
|
|
|
lambda w, t, data: _autocomplete_callback(activity_manager, query_manager, w, t, data),
|
|
|
txn.apply_changes,
|
|
|
lambda product, category, group: _insert_new_product_callback(
|
|
|
activity_manager, query_manager, product, category, group),
|
|
|
lambda: activity_manager.show(cur.update()),
|
|
|
- lambda name, value: _apply_choice_callback(activity_manager, 'new_product', name, value)
|
|
|
)
|
|
|
)
|
|
|
|
|
@@ -206,10 +198,10 @@ activity_manager = ActivityManager()
|
|
|
query_manager = QueryManager(cur, display_mapper)
|
|
|
|
|
|
activity_manager.create(TransactionEditor, 'transaction',
|
|
|
- query_manager, cols, grid_layout, side_pane, bottom_pane,
|
|
|
+ activity_manager, query_manager,
|
|
|
+ cols, grid_layout, side_pane, bottom_pane,
|
|
|
lambda: _save_and_clear_callback(activity_manager),
|
|
|
lambda widget, name, data: _autocomplete_callback(activity_manager, query_manager, widget, name, data),
|
|
|
- lambda name, value: _apply_choice_callback(activity_manager, 'transaction', name, value),
|
|
|
)
|
|
|
|
|
|
app = None
|