listpick 0.1.13.26__py3-none-any.whl → 0.1.13.28__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
listpick/listpick_app.py CHANGED
@@ -318,6 +318,7 @@ class Picker:
318
318
 
319
319
 
320
320
  # Note: We have to set the footer after initialising the picker state so that the footer can use the get_function_data method
321
+ self.get_function_data()
321
322
  self.footer_options = [StandardFooter(self.stdscr, colours_start, self.get_function_data), CompactFooter(self.stdscr, colours_start, self.get_function_data), NoFooter(self.stdscr, colours_start, self.get_function_data)]
322
323
  self.footer = self.footer_options[self.footer_style]
323
324
 
@@ -661,6 +662,12 @@ class Picker:
661
662
  self.stdscr.refresh()
662
663
 
663
664
  def draw_screen(self, indexed_items: list[Tuple[int, list[str]]], highlights: list[dict] = [{}], clear: bool = True) -> None:
665
+ try:
666
+ self.draw_screen(self.indexed_items, self.highlights)
667
+ except:
668
+ self.logger.warning(f"draw_screen function error")
669
+ pass
670
+ def draw_screen2(self, indexed_items: list[Tuple[int, list[str]]], highlights: list[dict] = [{}], clear: bool = True) -> None:
664
671
  """ Draw Picker screen. """
665
672
  self.logger.debug("Draw screen.")
666
673
 
@@ -1188,7 +1195,6 @@ class Picker:
1188
1195
  self.selections = {i:False for i in range(len(self.indexed_items))}
1189
1196
  self.cursor_pos = min(self.cursor_pos, len(self.indexed_items)-1)
1190
1197
  self.initialise_variables()
1191
- self.draw_screen(self.indexed_items, self.highlights)
1192
1198
 
1193
1199
 
1194
1200
  def choose_option(
@@ -1486,7 +1492,6 @@ class Picker:
1486
1492
  """ Toggle selection of item at index. """
1487
1493
  self.logger.info(f"function: toggle_item()")
1488
1494
  self.selections[index] = not self.selections[index]
1489
- self.draw_screen(self.indexed_items, self.highlights)
1490
1495
 
1491
1496
  def select_all(self) -> None:
1492
1497
  """ Select all in indexed_items. """
@@ -1498,10 +1503,6 @@ class Picker:
1498
1503
  for row in range(len(self.indexed_items)):
1499
1504
  self.selected_cells_by_row[row] = list(range(len(self.indexed_items[row][1])))
1500
1505
 
1501
-
1502
-
1503
- self.draw_screen(self.indexed_items, self.highlights)
1504
-
1505
1506
  def deselect_all(self) -> None:
1506
1507
  """ Deselect all items in indexed_items. """
1507
1508
  self.logger.info(f"function: deselect_all()")
@@ -1510,7 +1511,6 @@ class Picker:
1510
1511
  for i in self.cell_selections.keys():
1511
1512
  self.cell_selections[i] = False
1512
1513
  self.selected_cells_by_row = {}
1513
- self.draw_screen(self.indexed_items, self.highlights)
1514
1514
 
1515
1515
  def handle_visual_selection(self, selecting:bool = True) -> None:
1516
1516
  """ Toggle visual selection or deselection. """
@@ -1554,8 +1554,6 @@ class Picker:
1554
1554
  self.end_selection = -1
1555
1555
  self.is_selecting = False
1556
1556
 
1557
- self.draw_screen(self.indexed_items, self.highlights)
1558
-
1559
1557
  elif self.is_deselecting:
1560
1558
  self.end_selection = self.indexed_items[self.cursor_pos][0]
1561
1559
  self.end_selection = self.cursor_pos
@@ -1587,7 +1585,6 @@ class Picker:
1587
1585
  self.start_selection = -1
1588
1586
  self.end_selection = -1
1589
1587
  self.is_deselecting = False
1590
- self.draw_screen(self.indexed_items, self.highlights)
1591
1588
 
1592
1589
  def cursor_down(self, count=1) -> bool:
1593
1590
  """ Move cursor down. """
@@ -1979,7 +1976,10 @@ class Picker:
1979
1976
 
1980
1977
  initial_time = time.time()
1981
1978
 
1982
- self.draw_screen(self.indexed_items, self.highlights, clear=False)
1979
+ try:
1980
+ self.draw_screen(self.indexed_items, self.highlights, clear=False)
1981
+ except:
1982
+ pass
1983
1983
 
1984
1984
  self.refreshing_data = False
1985
1985
  self.data_ready = False
@@ -2015,7 +2015,6 @@ class Picker:
2015
2015
  self.logger.debug(f"footer_string_auto_refresh")
2016
2016
  self.footer_string = self.footer_string_refresh_function()
2017
2017
  initial_time_footer = time.time()
2018
- self.draw_screen(self.indexed_items, self.highlights)
2019
2018
 
2020
2019
  if self.check_key("help", key, self.keys_dict):
2021
2020
  self.logger.info(f"key_function help")
@@ -2474,34 +2473,28 @@ class Picker:
2474
2473
  if self.max_column_width > 10:
2475
2474
  self.max_column_width -= 10
2476
2475
  # self.column_widths = get_column_widths(self.items, header=self.header, max_column_width=self.max_column_width, number_columns=self.number_columns, max_total_width=2)
2477
- self.draw_screen(self.indexed_items, self.highlights)
2478
2476
  elif self.check_key("increase_column_width", key, self.keys_dict):
2479
2477
  self.logger.info(f"key_function increase_column_width")
2480
2478
  if self.max_column_width < 1000:
2481
2479
  self.max_column_width += 10
2482
2480
  # self.column_widths = get_column_widths(self.items, header=self.header, max_column_width=self.max_column_width, number_columns=self.number_columns, max_total_width=w)
2483
- self.draw_screen(self.indexed_items, self.highlights)
2484
2481
  elif self.check_key("visual_selection_toggle", key, self.keys_dict):
2485
2482
  self.logger.info(f"key_function visual_selection_toggle")
2486
2483
  self.handle_visual_selection()
2487
- self.draw_screen(self.indexed_items, self.highlights)
2488
2484
 
2489
2485
  elif self.check_key("visual_deselection_toggle", key, self.keys_dict):
2490
2486
  self.logger.info(f"key_function visual_deselection_toggle")
2491
2487
  self.handle_visual_selection(selecting=False)
2492
- self.draw_screen(self.indexed_items, self.highlights)
2493
2488
 
2494
2489
  elif key == curses.KEY_RESIZE: # Terminal resize signal
2495
2490
 
2496
2491
  self.calculate_section_sizes()
2497
2492
  self.column_widths = get_column_widths(self.items, header=self.header, max_column_width=self.max_column_width, number_columns=self.number_columns, max_total_width=w)
2498
2493
 
2499
- self.draw_screen(self.indexed_items, self.highlights)
2500
2494
 
2501
2495
 
2502
2496
  elif self.check_key("filter_input", key, self.keys_dict):
2503
2497
  self.logger.info(f"key_function filter_input")
2504
- self.draw_screen(self.indexed_items, self.highlights)
2505
2498
  usrtxt = f"{self.filter_query} " if self.filter_query else ""
2506
2499
  field_end_f = lambda: self.stdscr.getmaxyx()[1]-38 if self.show_footer else lambda: self.stdscr.getmaxyx()[1]-3
2507
2500
  if self.show_footer and self.footer.height >= 2: field_end_f = lambda: self.stdscr.getmaxyx()[1]-38
@@ -2546,7 +2539,6 @@ class Picker:
2546
2539
 
2547
2540
  elif self.check_key("search_input", key, self.keys_dict):
2548
2541
  self.logger.info(f"key_function search_input")
2549
- self.draw_screen(self.indexed_items, self.highlights)
2550
2542
  usrtxt = f"{self.search_query} " if self.search_query else ""
2551
2543
  field_end_f = lambda: self.stdscr.getmaxyx()[1]-38 if self.show_footer else lambda: self.stdscr.getmaxyx()[1]-3
2552
2544
  if self.show_footer and self.footer.height >= 3: field_end_f = lambda: self.stdscr.getmaxyx()[1]-38
@@ -2654,7 +2646,6 @@ class Picker:
2654
2646
  # self.mode_index = 0
2655
2647
  # self.highlights = [highlight for highlight in self.highlights if "type" not in highlight or highlight["type"] != "search" ]
2656
2648
  # continue
2657
- self.draw_screen(self.indexed_items, self.highlights)
2658
2649
 
2659
2650
  elif self.check_key("opts_input", key, self.keys_dict):
2660
2651
  self.logger.info(f"key_function opts_input")
@@ -2893,7 +2884,7 @@ class Picker:
2893
2884
  self.stdscr.clear()
2894
2885
  self.stdscr.refresh()
2895
2886
  self.initialise_variables()
2896
- self.draw_screen(self.indexed_items, self.highlights)
2887
+ # self.draw_screen(self.indexed_items, self.highlights)
2897
2888
 
2898
2889
 
2899
2890
 
@@ -3165,6 +3156,7 @@ def main() -> None:
3165
3156
  function_data["display_infobox"] = True
3166
3157
  function_data["infobox_items"] = [["1"], ["2"], ["3"]]
3167
3158
  function_data["infobox_title"] = "Title"
3159
+ function_data["footer_string"] = "Title"
3168
3160
 
3169
3161
 
3170
3162
  # function_data["debug"] = True
listpick/ui/footer.py CHANGED
@@ -50,6 +50,9 @@ class StandardFooter(Footer):
50
50
  def draw(self, h, w):
51
51
  state = self.get_state()
52
52
  # Fill background
53
+ if "footer_string" in state and state["footer_string"]: self.height = 3
54
+ else: self.height = 2
55
+
53
56
  for i in range(self.height):
54
57
  self.stdscr.addstr(h-self.height+i, 0, ' '*(w-1), curses.color_pair(self.colours_start+20))
55
58
 
@@ -63,19 +66,14 @@ class StandardFooter(Footer):
63
66
 
64
67
  picker_info_y = h-3
65
68
  sort_info_y = h-2
66
- self.height = 3
67
-
68
69
  else:
69
70
  picker_info_y = h-2
70
71
  sort_info_y = h-1
71
- ""
72
72
  select_mode = "C"
73
73
  if state["is_selecting"]: select_mode = "VS"
74
74
  elif state["is_deselecting"]: select_mode = "VDS"
75
75
  if state["pin_cursor"]: select_mode = f"{select_mode} "
76
76
  self.stdscr.addstr(h - 1, w-35, f"{select_mode:>33} ", curses.color_pair(self.colours_start+20))
77
- self.height = 2
78
-
79
77
 
80
78
  if state["filter_query"]:
81
79
  self.stdscr.addstr(h - 2, 2, f" Filter: {state['filter_query']} "[:w-40], curses.color_pair(self.colours_start+20) | curses.A_BOLD)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: listpick
3
- Version: 0.1.13.26
3
+ Version: 0.1.13.28
4
4
  Summary: Listpick is a powerful TUI data tool for creating TUI apps or viewing/comparing tabulated data.
5
5
  Home-page: https://github.com/grimandgreedy/listpick
6
6
  Author: Grim
@@ -1,9 +1,9 @@
1
1
  listpick/__init__.py,sha256=ExXc97-bibodH--wlwpQivl0zCNR5D1hvpvrf7OBofU,154
2
2
  listpick/__main__.py,sha256=wkCjDdqw093W27yWwnlC3nG_sMRKaIad7hHHWy0RBgY,193
3
- listpick/listpick_app.py,sha256=iskUM-xlwzBbS3Z-DIu0T5Ug_LL51PkmsxATnEiOpK8,164227
3
+ listpick/listpick_app.py,sha256=cTAQkb6WUH0zq6msKhC58N_CrVTRJmpar9gjRI6GE7s,163689
4
4
  listpick/ui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  listpick/ui/build_help.py,sha256=_rVKKrX3HfFJtw-pyeNb2lQWbml4-AAw8sZIUYGn97Y,8731
6
- listpick/ui/footer.py,sha256=s1L68MNmhWwbWRy0mn0ChmnE_dMQBAzNlTv917pyHE0,10673
6
+ listpick/ui/footer.py,sha256=4PO7gS-NSk6zfc2DAwSFPU6Ch_HYfu0L_57u93zfyjk,10711
7
7
  listpick/ui/help_screen.py,sha256=zbfGIgb-IXtATpl4_Sx7nPbsnRXZ7eiMYlCKGS9EFmw,5608
8
8
  listpick/ui/input_field.py,sha256=eyoWHoApdZybjfXcp7Eth7xwb-C-856ZVnq5j_Q3Ojs,30412
9
9
  listpick/ui/keys.py,sha256=TzaadgBP_rC7jbp--RFJZDOkHd0EB4K1wToDTiVs6CI,13029
@@ -23,9 +23,9 @@ listpick/utils/searching.py,sha256=Xk5UIqamNHL2L90z3ACB_Giqdpi9iRKoAJ6pKaqaD7Q,3
23
23
  listpick/utils/sorting.py,sha256=WZZiVlVA3Zkcpwji3U5SNFlQ14zVEk3cZJtQirBkecQ,5329
24
24
  listpick/utils/table_to_list_of_lists.py,sha256=T-i-nV1p6g8UagdgUPKrhIGpKY_YXZDxf4xZzcPepNA,7635
25
25
  listpick/utils/utils.py,sha256=8nsjjTDQH13tHTU93YcKklLQ_uuMAz-rbDTmao83T4Q,12783
26
- listpick-0.1.13.26.dist-info/licenses/LICENSE.txt,sha256=2mP-MRHJptADDNE9VInMNg1tE-C6Qv93Z4CCQKrpg9w,1061
27
- listpick-0.1.13.26.dist-info/METADATA,sha256=L8tWg3cUCTyOklDM1hcrxlxX0rvwSdFjCmxF_fO4XBU,7988
28
- listpick-0.1.13.26.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
29
- listpick-0.1.13.26.dist-info/entry_points.txt,sha256=-QCf_BKIkUz35Y9nkYpjZWs2Qg0KfRna2PAs5DnF6BE,43
30
- listpick-0.1.13.26.dist-info/top_level.txt,sha256=5mtsGEz86rz3qQDe0D463gGjAfSp6A3EWg4J4AGYr-Q,9
31
- listpick-0.1.13.26.dist-info/RECORD,,
26
+ listpick-0.1.13.28.dist-info/licenses/LICENSE.txt,sha256=2mP-MRHJptADDNE9VInMNg1tE-C6Qv93Z4CCQKrpg9w,1061
27
+ listpick-0.1.13.28.dist-info/METADATA,sha256=7hwv7A6cAX6CDcTdG7tllUDkcJXjFxM2rTX8lpuzvaE,7988
28
+ listpick-0.1.13.28.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
29
+ listpick-0.1.13.28.dist-info/entry_points.txt,sha256=-QCf_BKIkUz35Y9nkYpjZWs2Qg0KfRna2PAs5DnF6BE,43
30
+ listpick-0.1.13.28.dist-info/top_level.txt,sha256=5mtsGEz86rz3qQDe0D463gGjAfSp6A3EWg4J4AGYr-Q,9
31
+ listpick-0.1.13.28.dist-info/RECORD,,