listpick 0.1.13.24__py3-none-any.whl → 0.1.13.25__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
@@ -891,7 +891,7 @@ class Picker:
891
891
 
892
892
  # Higlight cursor cell and selected cells
893
893
  if self.cell_cursor:
894
- self.selected_cells_by_row = get_selected_cells_by_row(self.cell_selections)
894
+ # self.selected_cells_by_row = get_selected_cells_by_row(self.cell_selections)
895
895
  if item[0] in self.selected_cells_by_row:
896
896
  for j in self.selected_cells_by_row[item[0]]:
897
897
  highlight_cell(idx, j, visible_column_widths, colour_pair_number=25)
@@ -987,6 +987,7 @@ class Picker:
987
987
 
988
988
  ## Display infobox
989
989
  if self.display_infobox:
990
+ # self.stdscr.refresh()
990
991
  self.infobox(self.stdscr, message=self.infobox_items, title=self.infobox_title)
991
992
 
992
993
  # if not self.display_only:
@@ -1488,6 +1489,10 @@ class Picker:
1488
1489
  self.selections[self.indexed_items[i][0]] = True
1489
1490
  for i in self.cell_selections.keys():
1490
1491
  self.cell_selections[i] = True
1492
+ for row in range(len(self.indexed_items)):
1493
+ self.selected_cells_by_row[row] = list(range(len(self.indexed_items[row][1])))
1494
+
1495
+
1491
1496
 
1492
1497
  self.draw_screen(self.indexed_items, self.highlights)
1493
1498
 
@@ -1498,6 +1503,7 @@ class Picker:
1498
1503
  self.selections[i] = False
1499
1504
  for i in self.cell_selections.keys():
1500
1505
  self.cell_selections[i] = False
1506
+ self.selected_cells_by_row = {}
1501
1507
  self.draw_screen(self.indexed_items, self.highlights)
1502
1508
 
1503
1509
  def handle_visual_selection(self, selecting:bool = True) -> None:
@@ -1526,9 +1532,18 @@ class Picker:
1526
1532
  xend = max(self.start_selection_col, self.selected_column)
1527
1533
  for i in range(ystart, yend + 1):
1528
1534
  if self.indexed_items[i][0] not in self.unselectable_indices:
1529
- for j in range(xstart, xend+1):
1530
- cell_index = (self.indexed_items[i][0], j)
1535
+ row = self.indexed_items[i][0]
1536
+ if row not in self.selected_cells_by_row:
1537
+ self.selected_cells_by_row[row] = []
1538
+
1539
+ for col in range(xstart, xend+1):
1540
+ cell_index = (row, col)
1531
1541
  self.cell_selections[cell_index] = True
1542
+
1543
+ self.selected_cells_by_row[row].append(col)
1544
+ # Remove duplicates
1545
+ self.selected_cells_by_row[row] = list(set(self.selected_cells_by_row[row]))
1546
+
1532
1547
  self.start_selection = -1
1533
1548
  self.end_selection = -1
1534
1549
  self.is_selecting = False
@@ -1550,10 +1565,19 @@ class Picker:
1550
1565
  xstart = min(self.start_selection_col, self.selected_column)
1551
1566
  xend = max(self.start_selection_col, self.selected_column)
1552
1567
  for i in range(ystart, yend + 1):
1568
+ row = self.indexed_items[i][0]
1553
1569
  if self.indexed_items[i][0] not in self.unselectable_indices:
1554
- for j in range(xstart, xend+1):
1555
- cell_index = (self.indexed_items[i][0], j)
1556
- self.cell_selections[cell_index] = False
1570
+ if row in self.selected_cells_by_row:
1571
+ for col in range(xstart, xend+1):
1572
+ try:
1573
+ self.selected_cells_by_row[row].remove(col)
1574
+ except:
1575
+ pass
1576
+ cell_index = (row, col)
1577
+ self.cell_selections[cell_index] = False
1578
+ if self.selected_cells_by_row[row] == []:
1579
+ del self.selected_cells_by_row[row]
1580
+
1557
1581
  self.start_selection = -1
1558
1582
  self.end_selection = -1
1559
1583
  self.is_deselecting = False
@@ -2136,11 +2160,31 @@ class Picker:
2136
2160
  if len(self.indexed_items) > 0:
2137
2161
  item_index = self.indexed_items[self.cursor_pos][0]
2138
2162
  cell_index = (self.indexed_items[self.cursor_pos][0], self.selected_column)
2163
+ row, col = cell_index
2139
2164
  selected_count = sum(self.selections.values())
2140
2165
  if self.max_selected == -1 or selected_count >= self.max_selected:
2141
2166
  self.toggle_item(item_index)
2142
2167
 
2143
2168
  self.cell_selections[cell_index] = not self.cell_selections[cell_index]
2169
+ # If any cells in the current row are selected
2170
+ if row in self.selected_cells_by_row:
2171
+ # If the current cell is selected then remove it
2172
+ if col in self.selected_cells_by_row[row]:
2173
+ # If the current cell is the only cell in the row that is selected then remove the row from the dict
2174
+ if len(self.selected_cells_by_row[row]) == 1:
2175
+
2176
+ del self.selected_cells_by_row[row]
2177
+ # else remove only the index of the current cell
2178
+ else:
2179
+ self.selected_cells_by_row[row].remove(col)
2180
+ # If there are cells in the row that are selected then append the current cell to the row
2181
+ else:
2182
+ self.selected_cells_by_row[row].append(col)
2183
+ # Add the a list containing only the current column
2184
+ else:
2185
+ self.selected_cells_by_row[row] = [col]
2186
+
2187
+
2144
2188
  self.cursor_down()
2145
2189
  elif self.check_key("select_all", key, self.keys_dict): # Select all (m or ctrl-a)
2146
2190
  self.select_all()
@@ -3114,9 +3158,9 @@ def main() -> None:
3114
3158
  function_data["centre_in_terminal_vertical"] = True
3115
3159
  function_data["highlight_full_row"] = True
3116
3160
  function_data["pin_cursor"] = True
3117
- function_data["display_infobox"] = True
3118
- function_data["infobox_items"] = [["1"], ["2"], ["3"]]
3119
- function_data["infobox_title"] = "Title"
3161
+ # function_data["display_infobox"] = True
3162
+ # function_data["infobox_items"] = [["1"], ["2"], ["3"]]
3163
+ # function_data["infobox_title"] = "Title"
3120
3164
 
3121
3165
 
3122
3166
  # function_data["debug"] = True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: listpick
3
- Version: 0.1.13.24
3
+ Version: 0.1.13.25
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,6 +1,6 @@
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=W_oB0KMAwLKrkQic1CGv6VEe1po2v1NIgaiJyBmYDjk,161923
3
+ listpick/listpick_app.py,sha256=WooRDRtXporfAaKzR_2M0xxLbbiodBCw0ToO8Jm_mRs,164195
4
4
  listpick/ui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  listpick/ui/build_help.py,sha256=_rVKKrX3HfFJtw-pyeNb2lQWbml4-AAw8sZIUYGn97Y,8731
6
6
  listpick/ui/footer.py,sha256=s1L68MNmhWwbWRy0mn0ChmnE_dMQBAzNlTv917pyHE0,10673
@@ -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.24.dist-info/licenses/LICENSE.txt,sha256=2mP-MRHJptADDNE9VInMNg1tE-C6Qv93Z4CCQKrpg9w,1061
27
- listpick-0.1.13.24.dist-info/METADATA,sha256=XEqRF4u-7qmgF54_GNZMIaY45A2WJiIbXMzc0Ymyx_Q,7988
28
- listpick-0.1.13.24.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
29
- listpick-0.1.13.24.dist-info/entry_points.txt,sha256=-QCf_BKIkUz35Y9nkYpjZWs2Qg0KfRna2PAs5DnF6BE,43
30
- listpick-0.1.13.24.dist-info/top_level.txt,sha256=5mtsGEz86rz3qQDe0D463gGjAfSp6A3EWg4J4AGYr-Q,9
31
- listpick-0.1.13.24.dist-info/RECORD,,
26
+ listpick-0.1.13.25.dist-info/licenses/LICENSE.txt,sha256=2mP-MRHJptADDNE9VInMNg1tE-C6Qv93Z4CCQKrpg9w,1061
27
+ listpick-0.1.13.25.dist-info/METADATA,sha256=nVxF7NSl9aZm9jyIpR9KcPlA_kvqFfEDoFMoZgm4fc8,7988
28
+ listpick-0.1.13.25.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
29
+ listpick-0.1.13.25.dist-info/entry_points.txt,sha256=-QCf_BKIkUz35Y9nkYpjZWs2Qg0KfRna2PAs5DnF6BE,43
30
+ listpick-0.1.13.25.dist-info/top_level.txt,sha256=5mtsGEz86rz3qQDe0D463gGjAfSp6A3EWg4J4AGYr-Q,9
31
+ listpick-0.1.13.25.dist-info/RECORD,,