listpick 0.1.15.2__py3-none-any.whl → 0.1.15.4__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.

Potentially problematic release.


This version of listpick might be problematic. Click here for more details.

listpick/listpick_app.py CHANGED
@@ -2037,7 +2037,11 @@ class Picker:
2037
2037
  self.selected_cells_by_row = get_selected_cells_by_row(self.cell_selections)
2038
2038
 
2039
2039
  if len(self.indexed_items) > 0 and len(self.indexed_items) >= self.cursor_pos and len(self.indexed_items[0][1]) >= self.id_column:
2040
- self.cursor_pos_id = self.indexed_items[self.cursor_pos][1][self.id_column]
2040
+ try:
2041
+ self.cursor_pos_id = self.indexed_items[self.cursor_pos][1][self.id_column]
2042
+ except:
2043
+ self.logger.warning(f"fetch_data() len(indexed_items)={len(self.indexed_items)}, cusor_pos={self.cursor_pos}")
2044
+ self.cursor_pos_id = -1
2041
2045
  self.cursor_pos_prev = self.cursor_pos
2042
2046
  with self.data_lock:
2043
2047
  self.items, self.header = tmp_items, tmp_header
@@ -3191,14 +3195,21 @@ class Picker:
3191
3195
  if 'filter' in self.modes[prev_mode_index]:
3192
3196
  self.filter_query = self.filter_query.replace(self.modes[prev_mode_index]['filter'], '')
3193
3197
  self.filter_query = f"{self.filter_query.strip()} {val.strip()}".strip()
3194
- prev_index = self.indexed_items[self.cursor_pos][0] if len(self.indexed_items)>0 else 0
3198
+
3199
+ if len(self.indexed_items) == 0:
3200
+ prev_index = -1
3201
+ else:
3202
+ prev_index = self.indexed_items[self.cursor_pos][0] if len(self.indexed_items)>0 else 0
3195
3203
 
3196
3204
  self.indexed_items = filter_items(self.items, self.indexed_items, self.filter_query)
3197
- if prev_index in [x[0] for x in self.indexed_items]: new_index = [x[0] for x in self.indexed_items].index(prev_index)
3198
- else: new_index = 0
3205
+ if prev_index >= 0 and prev_index in [x[0] for x in self.indexed_items]:
3206
+ new_index = [x[0] for x in self.indexed_items].index(prev_index)
3207
+ else:
3208
+ new_index = 0
3199
3209
  self.cursor_pos = new_index
3200
3210
  # Re-sort self.items after applying filter
3201
- sort_items(self.indexed_items, sort_method=self.columns_sort_method[self.sort_column], sort_column=self.sort_column, sort_reverse=self.sort_reverse[self.sort_column]) # Re-sort self.items based on new column
3211
+ if len(self.items) and self.items != [[]]:
3212
+ sort_items(self.indexed_items, sort_method=self.columns_sort_method[self.sort_column], sort_column=self.sort_column, sort_reverse=self.sort_reverse[self.sort_column]) # Re-sort self.items based on new column
3202
3213
  elif self.check_key("mode_prev", key, self.keys_dict): # shift+tab key
3203
3214
  self.logger.info(f"key_function mode_prev")
3204
3215
  if len(self.modes):
@@ -3211,6 +3222,8 @@ class Picker:
3211
3222
  self.filter_query = self.filter_query.replace(self.modes[prev_mode_index]['filter'], '')
3212
3223
  self.filter_query = f"{self.filter_query.strip()} {val.strip()}".strip()
3213
3224
  prev_index = self.indexed_items[self.cursor_pos][0] if len(self.indexed_items)>0 else 0
3225
+
3226
+ # if len(self.items) and self.items != [[]]:
3214
3227
  self.indexed_items = filter_items(self.items, self.indexed_items, self.filter_query)
3215
3228
  if prev_index in [x[0] for x in self.indexed_items]: new_index = [x[0] for x in self.indexed_items].index(prev_index)
3216
3229
  else: new_index = 0
@@ -3707,21 +3720,21 @@ def main() -> None:
3707
3720
  pass
3708
3721
 
3709
3722
  # function_data["colour_theme_number"] = 3
3710
- # function_data["modes"] = [
3711
- # {
3712
- # 'filter': '',
3713
- # 'sort': 0,
3714
- # 'name': 'All',
3715
- # },
3716
- # {
3717
- # 'filter': '--2 miss',
3718
- # 'name': 'miss',
3719
- # },
3720
- # {
3721
- # 'filter': '--2 mp4',
3722
- # 'name': 'mp4',
3723
- # },
3724
- # ]
3723
+ function_data["modes"] = [
3724
+ {
3725
+ 'filter': '',
3726
+ 'sort': 0,
3727
+ 'name': 'All',
3728
+ },
3729
+ {
3730
+ 'filter': '--2 miss',
3731
+ 'name': 'miss',
3732
+ },
3733
+ {
3734
+ 'filter': '--2 mp4',
3735
+ 'name': 'mp4',
3736
+ },
3737
+ ]
3725
3738
  highlights = [
3726
3739
  {
3727
3740
  "field": 1,
@@ -34,6 +34,7 @@ def filter_items(items: list[list[str]], indexed_items: list[Tuple[int, list[str
34
34
  Returns indexed_items, which is a list of tuples; each tuple consists of the index and the data of the matching row in the original items list.
35
35
  """
36
36
  logger.info("function: filter_items (filtering.py)")
37
+ if items in [[], [[]]]: return []
37
38
 
38
39
 
39
40
  invert_filter = False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: listpick
3
- Version: 0.1.15.2
3
+ Version: 0.1.15.4
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=1K0sSVK-39eBIAZobHMrsFunE4Knp9nLKoExjlPlEjg,193238
3
+ listpick/listpick_app.py,sha256=5TgVHIyR1ssENY9F8hD2AUbzsMICDaIgc5-n7ct2igY,193813
4
4
  listpick/pane/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  listpick/pane/get_data.py,sha256=21PTDXt9HP-4vZV4QUM8sidTqDEaKnKCDshl3-cSRCo,2255
6
6
  listpick/pane/pane_functions.py,sha256=7xynpd3HjZnt6s9W0ZsJlrmYvGCMstAI5OJ7EuQSzdg,3092
@@ -16,7 +16,7 @@ listpick/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  listpick/utils/clipboard_operations.py,sha256=ORdNm2kgGbfs51xJSvgJPERgoSmBgT11axuMkvSoP9A,3133
17
17
  listpick/utils/config.py,sha256=MEnAZg2Rhfl38XofEIN0uoVAOY7I0ftc79Evk3fOiVw,1654
18
18
  listpick/utils/dump.py,sha256=60YVIMNtBoYvWhmzfTJOsNGcetOvcCB3_T7yv-bYTPQ,3838
19
- listpick/utils/filtering.py,sha256=uS9sW0inmFvq0cIrwRC1BfuP8kjAD5IWWtls4jGB-70,1199
19
+ listpick/utils/filtering.py,sha256=59_YIEYRV0ovnjF4iyuShq276FMAx5gBD9m3mE9IqJg,1237
20
20
  listpick/utils/generate_data.py,sha256=7sv6JRhk0-Gcj4kOlkzx4qPNBJZ-GFWg9vM77GktzpI,3073
21
21
  listpick/utils/graphing.py,sha256=ugjAH8js_iH7hulg4SySxb_W_f8B6GhTaceN5i7DID4,6954
22
22
  listpick/utils/keycodes.py,sha256=ZGkw1-4szxPnP81wj80r92L6_neIOlBBjQltEieCwnk,2696
@@ -29,9 +29,9 @@ listpick/utils/sorting.py,sha256=WZZiVlVA3Zkcpwji3U5SNFlQ14zVEk3cZJtQirBkecQ,532
29
29
  listpick/utils/table_to_list_of_lists.py,sha256=XBj7eGBDF15BRME-swnoXyOfZWxXCxrXp0pzsBfcJ5g,12224
30
30
  listpick/utils/user_input.py,sha256=oyJZPAwA7UGAclPhdPL44tKnPIVNHWhX-tZEnCdBKC0,4318
31
31
  listpick/utils/utils.py,sha256=McOl9uT3jh7l4TIWeSd8ZGjK_e7r0YZF0Gl20yI6fl0,13873
32
- listpick-0.1.15.2.dist-info/licenses/LICENSE.txt,sha256=2mP-MRHJptADDNE9VInMNg1tE-C6Qv93Z4CCQKrpg9w,1061
33
- listpick-0.1.15.2.dist-info/METADATA,sha256=aCD8uXrdXo0fdcqVWYB7_H6ozBBXjxSqp3qpcuEGGKQ,8131
34
- listpick-0.1.15.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
35
- listpick-0.1.15.2.dist-info/entry_points.txt,sha256=-QCf_BKIkUz35Y9nkYpjZWs2Qg0KfRna2PAs5DnF6BE,43
36
- listpick-0.1.15.2.dist-info/top_level.txt,sha256=5mtsGEz86rz3qQDe0D463gGjAfSp6A3EWg4J4AGYr-Q,9
37
- listpick-0.1.15.2.dist-info/RECORD,,
32
+ listpick-0.1.15.4.dist-info/licenses/LICENSE.txt,sha256=2mP-MRHJptADDNE9VInMNg1tE-C6Qv93Z4CCQKrpg9w,1061
33
+ listpick-0.1.15.4.dist-info/METADATA,sha256=k72_XlnzWvZSrL-6V68XRy8WbkhxdJfy7NQQ8DaRIcU,8131
34
+ listpick-0.1.15.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
35
+ listpick-0.1.15.4.dist-info/entry_points.txt,sha256=-QCf_BKIkUz35Y9nkYpjZWs2Qg0KfRna2PAs5DnF6BE,43
36
+ listpick-0.1.15.4.dist-info/top_level.txt,sha256=5mtsGEz86rz3qQDe0D463gGjAfSp6A3EWg4J4AGYr-Q,9
37
+ listpick-0.1.15.4.dist-info/RECORD,,