|
93 | 93 |
|
94 | 94 | logger = logging.getLogger(__name__)
|
95 | 95 |
|
| 96 | +# ------------------------------------------- |
| 97 | +# Set up options for pandas DataFrame display |
| 98 | +# ------------------------------------------- |
| 99 | +pd.set_option("display.max_rows", 15) # Show a maximum of 10 rows |
| 100 | +pd.set_option("display.max_columns", 10) # Show a maximum of 5 columns |
| 101 | +pd.set_option("display.width", 250) # Set the display width to 1000 characters |
| 102 | +pd.set_option( |
| 103 | + "display.max_colwidth", 25 |
| 104 | +) # Set the maximum column width to 20 characters |
| 105 | +pd.set_option("display.precision", 2) # Set the number of decimal places to 2 |
| 106 | + |
96 | 107 | # ---------------------------
|
97 | 108 | # Types for automatic mapping
|
98 | 109 | # ---------------------------
|
@@ -1374,6 +1385,11 @@ def set_by_pk(
|
1374 | 1385 | self.prompt_save(update_elements=False)
|
1375 | 1386 |
|
1376 | 1387 | # find current index of pk in resorted rows (not in-place)
|
| 1388 | + print(f"\nself.rows for {self.table}:\n", self.rows) |
| 1389 | + # for i, row in self.rows.iterrows(): |
| 1390 | + # if row[self.pk_column] == pk: |
| 1391 | + # self.current_index = i |
| 1392 | + # break |
1377 | 1393 | self.current_index = (
|
1378 | 1394 | self.rows.sort_index().index[self.rows[self.pk_column] == pk].tolist()[0]
|
1379 | 1395 | )
|
@@ -1691,7 +1707,7 @@ def save_record(
|
1691 | 1707 | self.frm.popup.ok(
|
1692 | 1708 | lang.dataset_save_fail_title,
|
1693 | 1709 | lang.dataset_save_fail.format_map(
|
1694 |
| - LangFormat(exception=result.exception) |
| 1710 | + LangFormat(exception=result.attrs["exception"]) |
1695 | 1711 | ),
|
1696 | 1712 | )
|
1697 | 1713 | self.driver.rollback()
|
@@ -1828,7 +1844,7 @@ def delete_record(
|
1828 | 1844 | return True
|
1829 | 1845 |
|
1830 | 1846 | if self.row_is_virtual():
|
1831 |
| - self.rows.purge_virtual() |
| 1847 | + self.purge_virtual() |
1832 | 1848 | self.frm.update_elements(self.key)
|
1833 | 1849 | # only need to reset the Insert button
|
1834 | 1850 | self.frm.update_elements(edit_protect_only=True)
|
|
0 commit comments