listpick 0.1.15.6__py3-none-any.whl → 0.1.15.7__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
@@ -881,15 +881,69 @@ class Picker:
881
881
  # Highlight sort column
882
882
  try:
883
883
  if self.selected_column != None and self.selected_column not in self.hidden_columns:
884
- if len(self.header) > 1 and (len(up_to_selected_col)-self.leftmost_char) < self.rows_w:
885
- number = f"{self.selected_column}. " if self.number_columns else ""
886
- # number = f"{intStringToExponentString(self.selected_column)}. " if self.number_columns else ""
887
- # self.startx + len(up_to_selected_col) - self.leftmost_char
888
- highlighed_col_startx = max(self.startx, self.startx + len(up_to_selected_col) - self.leftmost_char)
889
- highlighted_col_str = (number+f"{self.header[self.selected_column]:^{self.column_widths[self.selected_column]-len(number)}}") + self.separator
890
- end_of_highlighted_col_str = self.rows_w-(highlighed_col_startx+len(highlighted_col_str)) if (highlighed_col_startx+len(highlighted_col_str)) > self.rows_w else len(highlighted_col_str)
891
- start_of_highlighted_col_str = max(self.leftmost_char - len(up_to_selected_col), 0)
892
- self.stdscr.addstr(header_ypos, highlighed_col_startx , highlighted_col_str[start_of_highlighted_col_str:end_of_highlighted_col_str][:self.column_widths[self.selected_column]+len(self.separator)], curses.color_pair(self.colours_start+19) | curses.A_BOLD)
884
+ # start of string is on screen
885
+ col_width = self.column_widths[self.selected_column]
886
+ number = f"{self.selected_column}. " if self.number_columns else ""
887
+ col_str = self.header[self.selected_column][:self.column_widths[self.selected_column]-len(number)]
888
+ highlighted_col_str = (number+f"{col_str:^{self.column_widths[self.selected_column]-len(number)}}") + self.separator
889
+
890
+ # Start of selected column is on the screen
891
+ if self.leftmost_char <= len(up_to_selected_col) and self.leftmost_char+self.rows_w-self.startx > len(up_to_selected_col):
892
+ x_pos = len(up_to_selected_col) - self.leftmost_char + self.startx
893
+
894
+ # Whole cell of the selected column is on the screen
895
+ if len(up_to_selected_col)+col_width - self.leftmost_char < self.rows_w-self.startx:
896
+ disp_str = highlighted_col_str
897
+
898
+ # Start of the cell is on the screen, but the end of the cell is not
899
+ else:
900
+ overflow = (len(up_to_selected_col)+len(highlighted_col_str)) - (self.leftmost_char+self.rows_w - self.startx)
901
+ disp_str = highlighted_col_str[:-overflow]
902
+
903
+ self.stdscr.addstr(header_ypos, x_pos , disp_str, curses.color_pair(self.colours_start+19) | curses.A_BOLD)
904
+ # Start of the cell is to the right of the screen
905
+ elif self.leftmost_char+self.rows_w <= len(up_to_selected_col):
906
+ pass
907
+ # The end of the cell is on the screen, the start of the cell is not
908
+ elif 0 <= len(up_to_selected_col)+col_width - self.leftmost_char <= self.rows_w :
909
+ x_pos = self.startx
910
+ beg = self.leftmost_char - len(up_to_selected_col)
911
+ disp_str = highlighted_col_str[beg:]
912
+ self.stdscr.addstr(header_ypos, x_pos , disp_str, curses.color_pair(self.colours_start+19) | curses.A_BOLD)
913
+ # The middle of the cell is on the screen, the start and end of the cell are not
914
+ elif self.leftmost_char <= len(up_to_selected_col) + col_width//2 <= self.leftmost_char+self.rows_w:
915
+ beg = self.leftmost_char - len(up_to_selected_col)
916
+ overflow = (len(up_to_selected_col)+len(highlighted_col_str)) - (self.leftmost_char+self.rows_w)
917
+ disp_str = highlighted_col_str[beg:-overflow]
918
+
919
+ x_pos = self.startx
920
+ self.stdscr.addstr(header_ypos, x_pos , disp_str, curses.color_pair(self.colours_start+19) | curses.A_BOLD)
921
+ # The cell is to the left of the screen
922
+ else:
923
+ pass
924
+
925
+ # elif self.leftmost_char:
926
+ # os.system(f"notify-send 'cell is to the right of the screen'")
927
+
928
+ #
929
+ #
930
+ # if len(self.header) > 1 and (len(up_to_selected_col)-self.leftmost_char) < self.rows_w:
931
+ # number = f"{self.selected_column}. " if self.number_columns else ""
932
+ # # number = f"{intStringToExponentString(self.selected_column)}. " if self.number_columns else ""
933
+ # # self.startx + len(up_to_selected_col) - self.leftmost_char
934
+ # highlighed_col_startx = max(self.startx, self.startx + len(up_to_selected_col) - self.leftmost_char)
935
+ #
936
+ #
937
+ # col_str = self.header[self.selected_column][:self.column_widths[self.selected_column]-len(number)]
938
+ # highlighted_col_str = (number+f"{col_str:^{self.column_widths[self.selected_column]}}") + self.separator
939
+ # end_of_highlighted_col_str = self.rows_w-(highlighed_col_startx+len(highlighted_col_str)) if (highlighed_col_startx+len(highlighted_col_str)) > self.rows_w else len(highlighted_col_str)
940
+ # if (highlighed_col_startx+len(highlighted_col_str)) > self.rows_w:
941
+ # end_of_highlighted_col_str = self.rows_w-(highlighed_col_startx+len(highlighted_col_str))
942
+ # else:
943
+ # end_of_highlighted_col_str = len(highlighted_col_str)
944
+ #
945
+ # start_of_highlighted_col_str = max(self.leftmost_char - len(up_to_selected_col), 0)
946
+ # self.stdscr.addstr(header_ypos, highlighed_col_startx , highlighted_col_str[start_of_highlighted_col_str:end_of_highlighted_col_str][:self.column_widths[self.selected_column]+len(self.separator)], curses.color_pair(self.colours_start+19) | curses.A_BOLD)
893
947
  except:
894
948
  pass
895
949
 
@@ -902,11 +956,14 @@ class Picker:
902
956
  else:
903
957
  self.stdscr.addstr(y, 0, f" {self.indexed_items[idx][0]} ", curses.color_pair(self.colours_start+4) | curses.A_BOLD)
904
958
 
905
- def highlight_cell(row: int, col:int, visible_column_widths, colour_pair_number: int = 5):
959
+
960
+ def highlight_cell(row: int, col:int, visible_column_widths, colour_pair_number: int = 5, y:int = 0):
961
+
906
962
  cell_pos = sum(visible_column_widths[:col])+col*len(self.separator)-self.leftmost_char + self.startx
907
963
  # cell_width = self.column_widths[self.selected_column]
908
964
  cell_width = visible_column_widths[col] + len(self.separator)
909
965
  cell_max_width = self.rows_w-cell_pos
966
+
910
967
  try:
911
968
  # Start of cell is on screen
912
969
  if self.startx <= cell_pos <= self.rows_w:
@@ -916,17 +973,23 @@ class Picker:
916
973
  else:
917
974
  cell_value = self.indexed_items[row][1][col] + self.separator
918
975
  # cell_value = cell_value[:min(cell_width, cell_max_width)-len(self.separator)]
919
- cell_value = truncate_to_display_width(cell_value, min(cell_width, cell_max_width)-len(self.separator), self.centre_in_cols, self.unicode_char_width)
920
- cell_value = cell_value + self.separator
976
+ cell_value = truncate_to_display_width(cell_value, min(cell_width, cell_max_width), self.centre_in_cols, self.unicode_char_width)
977
+ # cell_value = cell_value + self.separator
921
978
  # cell_value = cell_value
922
979
  cell_value = truncate_to_display_width(cell_value, min(cell_width, cell_max_width), self.centre_in_cols, self.unicode_char_width)
923
980
  self.stdscr.addstr(y, cell_pos, cell_value, curses.color_pair(self.colours_start+colour_pair_number) | curses.A_BOLD)
924
981
  # Part of the cell is on screen
925
- elif self.startx <= cell_pos+cell_width <= self.rows_w:
982
+ elif self.startx <= cell_pos+cell_width and cell_pos < (self.rows_w):
926
983
  cell_start = self.startx - cell_pos
927
- self.stdscr.addstr(y, self.startx, ' '*(cell_width-cell_start), curses.color_pair(self.colours_start+colour_pair_number))
928
- cell_value = self.indexed_items[row][1][col][cell_start:visible_column_widths[col]]
984
+ # self.stdscr.addstr(y, self.startx, ' '*(cell_width-cell_start), curses.color_pair(self.colours_start+colour_pair_number))
985
+ cell_value = self.indexed_items[row][1][col]
986
+ cell_value = f"{cell_value:^{self.column_widths[col]}}"
987
+
988
+ cell_value = cell_value[cell_start:visible_column_widths[col]][:self.rows_w-self.startx]
929
989
  self.stdscr.addstr(y, self.startx, cell_value, curses.color_pair(self.colours_start+colour_pair_number) | curses.A_BOLD)
990
+ else:
991
+ pass
992
+ # if colour_pair_number == 5:
930
993
  except:
931
994
  pass
932
995
 
@@ -1009,7 +1072,17 @@ class Picker:
1009
1072
  # row_str = truncate_to_display_width(row_str, min(w-self.startx, visible_columns_total_width))
1010
1073
  row_str_orig = format_row(item[1], self.hidden_columns, self.column_widths, self.separator, self.centre_in_cols, self.unicode_char_width)
1011
1074
  row_str_left_adj = clip_left(row_str_orig, self.leftmost_char)
1012
- row_str = truncate_to_display_width(row_str_left_adj, min(self.rows_w-self.startx, visible_columns_total_width), self.unicode_char_width)
1075
+ # rowstr off screen
1076
+ # if self.leftmost_char > len(row_str_orig):
1077
+ # trunc_width = 0
1078
+ if self.leftmost_char + (self.rows_w-self.startx) <= len(row_str_orig):
1079
+ trunc_width = self.rows_w-self.startx
1080
+ elif self.leftmost_char <= len(row_str_orig):
1081
+ trunc_width = len(row_str_orig) - self.leftmost_char
1082
+ else:
1083
+ trunc_width = 0
1084
+
1085
+ row_str = truncate_to_display_width(row_str_left_adj, trunc_width, self.unicode_char_width)
1013
1086
  # row_str = truncate_to_display_width(row_str, min(w-self.startx, visible_columns_total_width))[self.leftmost_char:]
1014
1087
 
1015
1088
  ## Display the standard row
@@ -1025,21 +1098,21 @@ class Picker:
1025
1098
  # self.selected_cells_by_row = get_selected_cells_by_row(self.cell_selections)
1026
1099
  if item[0] in self.selected_cells_by_row:
1027
1100
  for j in self.selected_cells_by_row[item[0]]:
1028
- highlight_cell(idx, j, visible_column_widths, colour_pair_number=25)
1101
+ highlight_cell(idx, j, visible_column_widths, colour_pair_number=25, y=y)
1029
1102
 
1030
1103
  # Visually selected
1031
1104
  if self.is_selecting:
1032
1105
  if self.start_selection <= idx <= self.cursor_pos or self.start_selection >= idx >= self.cursor_pos:
1033
1106
  x_interval = range(min(self.start_selection_col, self.selected_column), max(self.start_selection_col, self.selected_column)+1)
1034
1107
  for col in x_interval:
1035
- highlight_cell(idx, col, visible_column_widths, colour_pair_number=25)
1108
+ highlight_cell(idx, col, visible_column_widths, colour_pair_number=25, y=y)
1036
1109
 
1037
1110
  # Visually deslected
1038
1111
  if self.is_deselecting:
1039
1112
  if self.start_selection >= idx >= self.cursor_pos or self.start_selection <= idx <= self.cursor_pos:
1040
1113
  x_interval = range(min(self.start_selection_col, self.selected_column), max(self.start_selection_col, self.selected_column)+1)
1041
1114
  for col in x_interval:
1042
- highlight_cell(idx, col, visible_column_widths, colour_pair_number=26)
1115
+ highlight_cell(idx, col, visible_column_widths, colour_pair_number=26, y=y)
1043
1116
  # Higlight cursor row and selected rows
1044
1117
  elif self.highlight_full_row:
1045
1118
  if self.selections[item[0]]:
@@ -1072,7 +1145,7 @@ class Picker:
1072
1145
  # Draw cursor
1073
1146
  if idx == self.cursor_pos:
1074
1147
  if self.cell_cursor:
1075
- highlight_cell(idx, self.selected_column, visible_column_widths)
1148
+ highlight_cell(idx, self.selected_column, visible_column_widths, colour_pair_number=5, y=y)
1076
1149
  else:
1077
1150
  self.stdscr.addstr(y, self.startx, row_str[:min(self.rows_w-self.startx, visible_columns_total_width)], curses.color_pair(self.colours_start+5) | curses.A_BOLD)
1078
1151
 
@@ -1117,7 +1190,7 @@ class Picker:
1117
1190
  self.stdscr.addstr(self.term_h - 1, self.term_w-footer_string_width-1, f"{disp_string}", curses.color_pair(self.colours_start+24))
1118
1191
 
1119
1192
  if self.split_right and self.split_right_function(self.stdscr, 0,0,0,0,{},[],[],"",test=True):
1120
- self.right_pane_previous_data = self.split_right_function(
1193
+ self.split_right_function(
1121
1194
  self.stdscr,
1122
1195
  x = self.rows_w,
1123
1196
  y = self.top_space - int(bool(self.show_header and self.header)),
@@ -2870,8 +2943,8 @@ class Picker:
2870
2943
  self.logger.info(f"key_function scroll_right")
2871
2944
  if len(self.indexed_items):
2872
2945
  row_width = sum(self.column_widths) + len(self.separator)*(len(self.column_widths)-1)
2873
- if row_width-self.leftmost_char >= self.rows_w-self.startx:
2874
- self.leftmost_char = self.leftmost_char+5
2946
+ if row_width-self.leftmost_char >= self.rows_w-self.startx-5:
2947
+ self.leftmost_char += 5
2875
2948
 
2876
2949
  elif self.check_key("scroll_left", key, self.keys_dict):
2877
2950
  self.logger.info(f"key_function scroll_left")
@@ -2885,17 +2958,18 @@ class Picker:
2885
2958
  elif self.check_key("scroll_far_right", key, self.keys_dict):
2886
2959
  self.logger.info(f"key_function scroll_far_right")
2887
2960
  longest_row_str_len = 0
2888
- rows = self.get_visible_rows()
2889
- for i in range(len(rows)):
2890
- item = rows[i]
2891
- row_str = format_row(item, self.hidden_columns, self.column_widths, self.separator, self.centre_in_cols, self.unicode_char_width)
2892
- if len(row_str) > longest_row_str_len: longest_row_str_len=len(row_str)
2961
+ # rows = self.get_visible_rows()
2962
+ # for i in range(len(rows)):
2963
+ # item = rows[i]
2964
+ # row_str = format_row(item, self.hidden_columns, self.column_widths, self.separator, self.centre_in_cols, self.unicode_char_width)
2965
+ # if len(row_str) > longest_row_str_len: longest_row_str_len=len(row_str)
2966
+ longest_row_str_len = sum(self.column_widths) + (len(self.column_widths)-1)*len(self.separator)
2893
2967
  # for i in range(len(self.indexed_items)):
2894
2968
  # item = self.indexed_items[i]
2895
2969
  # row_str = format_row(item[1], self.hidden_columns, self.column_widths, self.separator, self.centre_in_cols)
2896
2970
  # if len(row_str) > longest_row_str_len: longest_row_str_len=len(row_str)
2897
2971
  # self.notification(self.stdscr, f"{longest_row_str_len}")
2898
- self.leftmost_char = max(0, longest_row_str_len-self.rows_w+2+self.startx)
2972
+ self.leftmost_char = max(0, longest_row_str_len-self.rows_w+2+self.startx+5)
2899
2973
  if len(self.items):
2900
2974
  self.selected_column = len(self.items[0])-1
2901
2975
 
@@ -2990,7 +3064,6 @@ class Picker:
2990
3064
 
2991
3065
  self.calculate_section_sizes()
2992
3066
  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=self.rows_w, unicode_char_width=self.unicode_char_width)
2993
-
2994
3067
  self.draw_screen(self.indexed_items, self.highlights)
2995
3068
 
2996
3069
 
listpick/utils/utils.py CHANGED
@@ -34,7 +34,7 @@ def clip_left(text, n):
34
34
  if width + char_width > n:
35
35
  return text[i:]
36
36
  width += char_width
37
- return text # If the total width is less than n, return the full string
37
+ return ""
38
38
 
39
39
  def truncate_to_display_width(text: str, max_column_width: int, centre=False, unicode_char_width: bool = True) -> str:
40
40
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: listpick
3
- Version: 0.1.15.6
3
+ Version: 0.1.15.7
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=AYZNXy4Gc-_F4kLXiPB1-321mkfl3WxP9IRkM3VcYfk,194065
3
+ listpick/listpick_app.py,sha256=LC8EZr0HgdFVh0L7Y3ApvOHJuKXUEWLVPYi1bbdhWCk,198520
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
@@ -28,10 +28,10 @@ listpick/utils/searching.py,sha256=Xk5UIqamNHL2L90z3ACB_Giqdpi9iRKoAJ6pKaqaD7Q,3
28
28
  listpick/utils/sorting.py,sha256=WZZiVlVA3Zkcpwji3U5SNFlQ14zVEk3cZJtQirBkecQ,5329
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
- listpick/utils/utils.py,sha256=McOl9uT3jh7l4TIWeSd8ZGjK_e7r0YZF0Gl20yI6fl0,13873
32
- listpick-0.1.15.6.dist-info/licenses/LICENSE.txt,sha256=2mP-MRHJptADDNE9VInMNg1tE-C6Qv93Z4CCQKrpg9w,1061
33
- listpick-0.1.15.6.dist-info/METADATA,sha256=NHtilLmI6XfhHiraJOWmAddA8c-3vvpgGUW496LE5CU,8131
34
- listpick-0.1.15.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
35
- listpick-0.1.15.6.dist-info/entry_points.txt,sha256=-QCf_BKIkUz35Y9nkYpjZWs2Qg0KfRna2PAs5DnF6BE,43
36
- listpick-0.1.15.6.dist-info/top_level.txt,sha256=5mtsGEz86rz3qQDe0D463gGjAfSp6A3EWg4J4AGYr-Q,9
37
- listpick-0.1.15.6.dist-info/RECORD,,
31
+ listpick/utils/utils.py,sha256=QptLnqT15Z3G7xoq-6Q8e4-aZRFClTdb3h0l42di11s,13810
32
+ listpick-0.1.15.7.dist-info/licenses/LICENSE.txt,sha256=2mP-MRHJptADDNE9VInMNg1tE-C6Qv93Z4CCQKrpg9w,1061
33
+ listpick-0.1.15.7.dist-info/METADATA,sha256=qsFH7tpHbxUKA4EGdHOn8MCJRNqYh8IcjaZRx-MfGMM,8131
34
+ listpick-0.1.15.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
35
+ listpick-0.1.15.7.dist-info/entry_points.txt,sha256=-QCf_BKIkUz35Y9nkYpjZWs2Qg0KfRna2PAs5DnF6BE,43
36
+ listpick-0.1.15.7.dist-info/top_level.txt,sha256=5mtsGEz86rz3qQDe0D463gGjAfSp6A3EWg4J4AGYr-Q,9
37
+ listpick-0.1.15.7.dist-info/RECORD,,