listpick 0.1.16.7__py3-none-any.whl → 0.1.16.9__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 +298 -75
- listpick/pane/left_pane_functions.py +198 -0
- listpick/pane/pane_functions_1.py +175 -0
- listpick/ui/build_help.py +8 -6
- listpick/ui/keys.py +5 -3
- {listpick-0.1.16.7.dist-info → listpick-0.1.16.9.dist-info}/METADATA +17 -16
- {listpick-0.1.16.7.dist-info → listpick-0.1.16.9.dist-info}/RECORD +11 -9
- {listpick-0.1.16.7.dist-info → listpick-0.1.16.9.dist-info}/WHEEL +0 -0
- {listpick-0.1.16.7.dist-info → listpick-0.1.16.9.dist-info}/entry_points.txt +0 -0
- {listpick-0.1.16.7.dist-info → listpick-0.1.16.9.dist-info}/licenses/LICENSE.txt +0 -0
- {listpick-0.1.16.7.dist-info → listpick-0.1.16.9.dist-info}/top_level.txt +0 -0
listpick/listpick_app.py
CHANGED
|
@@ -20,8 +20,10 @@ import json
|
|
|
20
20
|
import threading
|
|
21
21
|
import string
|
|
22
22
|
import logging
|
|
23
|
+
from copy import copy
|
|
23
24
|
|
|
24
25
|
from listpick.pane.pane_utils import get_file_attributes
|
|
26
|
+
from listpick.pane.left_pane_functions import *
|
|
25
27
|
from listpick.ui.picker_colours import get_colours, get_help_colours, get_notification_colours, get_theme_count, get_fallback_colours
|
|
26
28
|
from listpick.utils.options_selectors import default_option_input, output_file_option_selector, default_option_selector
|
|
27
29
|
from listpick.utils.table_to_list_of_lists import *
|
|
@@ -189,9 +191,17 @@ class Picker:
|
|
|
189
191
|
right_panes: list = [],
|
|
190
192
|
right_pane_index: int = 0,
|
|
191
193
|
|
|
194
|
+
split_left: bool = False,
|
|
195
|
+
left_panes: list = [],
|
|
196
|
+
left_pane_index: int = 0,
|
|
197
|
+
|
|
198
|
+
screen_size_function = lambda stdscr: os.get_terminal_size()[::-1],
|
|
199
|
+
|
|
192
200
|
# getting_data: threading.Event = threading.Event(),
|
|
193
201
|
|
|
194
202
|
):
|
|
203
|
+
|
|
204
|
+
self.screen_size_function = screen_size_function
|
|
195
205
|
self.stdscr = stdscr
|
|
196
206
|
self.items = items
|
|
197
207
|
self.cursor_pos = cursor_pos
|
|
@@ -342,6 +352,11 @@ class Picker:
|
|
|
342
352
|
self.split_right = split_right
|
|
343
353
|
self.right_panes = right_panes
|
|
344
354
|
self.right_pane_index = right_pane_index
|
|
355
|
+
|
|
356
|
+
self.split_left = split_left
|
|
357
|
+
self.left_panes = left_panes
|
|
358
|
+
self.left_pane_index = left_pane_index
|
|
359
|
+
|
|
345
360
|
self.visible_rows_indices = []
|
|
346
361
|
|
|
347
362
|
|
|
@@ -408,7 +423,10 @@ class Picker:
|
|
|
408
423
|
return config
|
|
409
424
|
|
|
410
425
|
def update_term_size(self):
|
|
411
|
-
self.term_h, self.term_w = self.stdscr
|
|
426
|
+
self.term_h, self.term_w = self.screen_size_function(self.stdscr)
|
|
427
|
+
# self.term_h, self.term_w = self.stdscr.getmaxyx()
|
|
428
|
+
# self.term_w, self.term_h = os.get_terminal_size()
|
|
429
|
+
|
|
412
430
|
|
|
413
431
|
def get_term_size(self):
|
|
414
432
|
return self.stdscr.getmaxyx()
|
|
@@ -428,13 +446,35 @@ class Picker:
|
|
|
428
446
|
# self.bottom_space
|
|
429
447
|
self.bottom_space = self.footer.height if self.show_footer else 0
|
|
430
448
|
|
|
449
|
+
# self.left_gutter_width
|
|
450
|
+
self.left_gutter_width = 1 if self.highlight_full_row else 2
|
|
451
|
+
if self.show_row_header: self.left_gutter_width += len(str(len(self.items))) + 2
|
|
452
|
+
|
|
453
|
+
|
|
431
454
|
## self.top_space
|
|
432
455
|
self.update_term_size()
|
|
456
|
+
self.rows_w, self.rows_h = self.term_w, self.term_h
|
|
457
|
+
self.rows_box_x_i = 0
|
|
458
|
+
self.rows_box_x_f = self.term_w
|
|
459
|
+
self.left_pane_width = self.right_pane_width = 0
|
|
433
460
|
if self.split_right and len(self.right_panes):
|
|
434
461
|
proportion = self.right_panes[self.right_pane_index]["proportion"]
|
|
435
|
-
self.
|
|
436
|
-
|
|
437
|
-
self.
|
|
462
|
+
self.right_pane_width = int(self.term_w*proportion)
|
|
463
|
+
self.rows_w -= self.right_pane_width
|
|
464
|
+
self.rows_box_x_f -= self.right_pane_width
|
|
465
|
+
if self.split_left and len(self.left_panes):
|
|
466
|
+
proportion = self.left_panes[self.left_pane_index]["proportion"]
|
|
467
|
+
self.left_pane_width = int(self.term_w*proportion)
|
|
468
|
+
self.rows_w -= self.left_pane_width
|
|
469
|
+
self.rows_box_x_i += self.left_pane_width
|
|
470
|
+
if self.left_pane_width + self.right_pane_width >= self.term_w-3:
|
|
471
|
+
self.rows_w += 10
|
|
472
|
+
self.left_pane_width -= 5
|
|
473
|
+
self.right_pane_width -= 5
|
|
474
|
+
self.rows_box_x_i -= 5
|
|
475
|
+
self.rows_box_x_f += 5
|
|
476
|
+
|
|
477
|
+
|
|
438
478
|
|
|
439
479
|
self.top_space = self.top_gap
|
|
440
480
|
if self.title: self.top_space+=1
|
|
@@ -460,6 +500,14 @@ class Picker:
|
|
|
460
500
|
if self.show_row_header: self.startx += len(str(len(self.items))) + 2
|
|
461
501
|
if visible_columns_total_width < self.rows_w and self.centre_in_terminal:
|
|
462
502
|
self.startx += (self.rows_w - visible_columns_total_width) // 2
|
|
503
|
+
self.startx += self.left_pane_width
|
|
504
|
+
# if self.split_left and len(self.left_panes):
|
|
505
|
+
# proportion = self.left_panes[self.left_pane_index]["proportion"]
|
|
506
|
+
# self.startx += int(self.term_w*proportion)
|
|
507
|
+
|
|
508
|
+
self.endx = self.startx+self.rows_w
|
|
509
|
+
|
|
510
|
+
|
|
463
511
|
|
|
464
512
|
def get_visible_rows(self) -> list[list[str]]:
|
|
465
513
|
|
|
@@ -800,7 +848,8 @@ class Picker:
|
|
|
800
848
|
self.draw_screen_(clear)
|
|
801
849
|
except Exception as e:
|
|
802
850
|
self.logger.warning(f"self.draw_screen_() error. {e}")
|
|
803
|
-
|
|
851
|
+
finally:
|
|
852
|
+
self.stdscr.refresh()
|
|
804
853
|
|
|
805
854
|
def draw_screen_(self, clear: bool = True) -> None:
|
|
806
855
|
""" Draw Picker screen. """
|
|
@@ -811,11 +860,11 @@ class Picker:
|
|
|
811
860
|
self.stdscr.erase()
|
|
812
861
|
|
|
813
862
|
self.update_term_size()
|
|
814
|
-
if self.split_right and len(self.right_panes):
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
else:
|
|
818
|
-
|
|
863
|
+
# if self.split_right and len(self.right_panes):
|
|
864
|
+
# proportion = self.right_panes[self.right_pane_index]["proportion"]
|
|
865
|
+
# self.rows_w, self.rows_h = int(self.term_w*proportion), self.term_h
|
|
866
|
+
# else:
|
|
867
|
+
# self.rows_w, self.rows_h = self.term_w, self.term_h
|
|
819
868
|
|
|
820
869
|
# The height of the footer may need to be adjusted if the file changes.
|
|
821
870
|
self.footer.adjust_sizes(self.term_h,self.term_w)
|
|
@@ -898,11 +947,13 @@ class Picker:
|
|
|
898
947
|
|
|
899
948
|
header_str += f"{col_str:^{self.column_widths[i]-len(number)}}"
|
|
900
949
|
header_str += self.separator
|
|
950
|
+
header_str_w = min(self.rows_w-self.left_gutter_width, visible_columns_total_width+1, self.term_w-self.startx)
|
|
901
951
|
|
|
902
952
|
header_str = header_str[self.leftmost_char:]
|
|
953
|
+
header_str = header_str[:header_str_w]
|
|
903
954
|
header_ypos = self.top_gap + bool(self.title) + bool(self.display_modes and self.modes)
|
|
904
|
-
self.stdscr.addstr(header_ypos,
|
|
905
|
-
self.stdscr.addstr(header_ypos, self.startx, header_str
|
|
955
|
+
self.stdscr.addstr(header_ypos, self.rows_box_x_i, ' '*self.rows_w, curses.color_pair(self.colours_start+28) | curses.A_BOLD)
|
|
956
|
+
self.stdscr.addstr(header_ypos, self.startx, header_str, curses.color_pair(self.colours_start+4) | curses.A_BOLD)
|
|
906
957
|
|
|
907
958
|
# Highlight sort column
|
|
908
959
|
try:
|
|
@@ -918,17 +969,19 @@ class Picker:
|
|
|
918
969
|
else:
|
|
919
970
|
colour = curses.color_pair(self.colours_start+19) | curses.A_BOLD
|
|
920
971
|
# Start of selected column is on the screen
|
|
921
|
-
if self.leftmost_char <= len(up_to_selected_col) and self.leftmost_char+self.rows_w-self.
|
|
972
|
+
if self.leftmost_char <= len(up_to_selected_col) and self.leftmost_char+self.rows_w-self.left_gutter_width > len(up_to_selected_col):
|
|
922
973
|
x_pos = len(up_to_selected_col) - self.leftmost_char + self.startx
|
|
923
974
|
|
|
924
975
|
# Whole cell of the selected column is on the screen
|
|
925
|
-
if len(up_to_selected_col)+col_width - self.leftmost_char < self.rows_w-self.
|
|
976
|
+
if len(up_to_selected_col)+col_width - self.leftmost_char < self.rows_w-self.left_gutter_width:
|
|
926
977
|
disp_str = highlighted_col_str
|
|
927
978
|
|
|
928
979
|
# Start of the cell is on the screen, but the end of the cell is not
|
|
929
980
|
else:
|
|
930
|
-
overflow = (len(up_to_selected_col)+len(highlighted_col_str)) - (self.leftmost_char+self.rows_w - self.
|
|
981
|
+
overflow = (len(up_to_selected_col)+len(highlighted_col_str)) - (self.leftmost_char+self.rows_w - self.left_gutter_width)
|
|
931
982
|
disp_str = highlighted_col_str[:-overflow]
|
|
983
|
+
disp_str_w = min(len(disp_str), self.term_w-x_pos)
|
|
984
|
+
disp_str = truncate_to_display_width(disp_str, disp_str_w, self.centre_in_cols, self.unicode_char_width)
|
|
932
985
|
|
|
933
986
|
self.stdscr.addstr(header_ypos, x_pos , disp_str, colour)
|
|
934
987
|
# Start of the cell is to the right of the screen
|
|
@@ -939,14 +992,18 @@ class Picker:
|
|
|
939
992
|
x_pos = self.startx
|
|
940
993
|
beg = self.leftmost_char - len(up_to_selected_col)
|
|
941
994
|
disp_str = highlighted_col_str[beg:]
|
|
995
|
+
disp_str_w = min(len(disp_str), self.term_w-x_pos)
|
|
996
|
+
disp_str = truncate_to_display_width(disp_str, disp_str_w, self.centre_in_cols, self.unicode_char_width)
|
|
942
997
|
self.stdscr.addstr(header_ypos, x_pos , disp_str, colour)
|
|
943
998
|
# The middle of the cell is on the screen, the start and end of the cell are not
|
|
944
999
|
elif self.leftmost_char <= len(up_to_selected_col) + col_width//2 <= self.leftmost_char+self.rows_w:
|
|
945
1000
|
beg = self.leftmost_char - len(up_to_selected_col)
|
|
946
1001
|
overflow = (len(up_to_selected_col)+len(highlighted_col_str)) - (self.leftmost_char+self.rows_w)
|
|
1002
|
+
x_pos = self.startx
|
|
947
1003
|
disp_str = highlighted_col_str[beg:-overflow]
|
|
1004
|
+
disp_str_w = min(len(disp_str), self.term_w-x_pos)
|
|
1005
|
+
disp_str = truncate_to_display_width(disp_str, disp_str_w, self.centre_in_cols, self.unicode_char_width)
|
|
948
1006
|
|
|
949
|
-
x_pos = self.startx
|
|
950
1007
|
self.stdscr.addstr(header_ypos, x_pos , disp_str, colour)
|
|
951
1008
|
# The cell is to the left of the screen
|
|
952
1009
|
else:
|
|
@@ -982,17 +1039,18 @@ class Picker:
|
|
|
982
1039
|
for idx in range(start_index, end_index):
|
|
983
1040
|
y = idx - start_index + self.top_space
|
|
984
1041
|
if idx == self.cursor_pos:
|
|
985
|
-
self.stdscr.addstr(y,
|
|
1042
|
+
self.stdscr.addstr(y, self.startx-self.left_gutter_width, f" {self.indexed_items[idx][0]} ", curses.color_pair(self.colours_start+19) | curses.A_BOLD)
|
|
986
1043
|
else:
|
|
987
|
-
self.stdscr.addstr(y,
|
|
1044
|
+
self.stdscr.addstr(y, self.startx-self.left_gutter_width, f" {self.indexed_items[idx][0]} ", curses.color_pair(self.colours_start+4) | curses.A_BOLD)
|
|
988
1045
|
|
|
989
1046
|
|
|
990
1047
|
def highlight_cell(row: int, col:int, visible_column_widths, colour_pair_number: int = 5, bold: bool = False, y:int = 0):
|
|
991
1048
|
|
|
992
1049
|
cell_pos = sum(visible_column_widths[:col])+col*len(self.separator)-self.leftmost_char + self.startx
|
|
1050
|
+
cell_pos_relative = sum(visible_column_widths[:col])+col*len(self.separator)-self.leftmost_char + self.left_gutter_width
|
|
993
1051
|
# cell_width = self.column_widths[self.selected_column]
|
|
994
1052
|
cell_width = visible_column_widths[col] + len(self.separator)
|
|
995
|
-
cell_max_width = self.rows_w-cell_pos
|
|
1053
|
+
cell_max_width = min(self.rows_w-self.left_gutter_width, self.term_w-cell_pos)
|
|
996
1054
|
|
|
997
1055
|
if bold:
|
|
998
1056
|
colour = curses.color_pair(self.colours_start+colour_pair_number) | curses.A_BOLD
|
|
@@ -1000,7 +1058,8 @@ class Picker:
|
|
|
1000
1058
|
colour = curses.color_pair(self.colours_start+colour_pair_number)
|
|
1001
1059
|
try:
|
|
1002
1060
|
# Start of cell is on screen
|
|
1003
|
-
if self.startx <= cell_pos <= self.rows_w:
|
|
1061
|
+
if self.startx <= cell_pos <= self.rows_w+self.startx:
|
|
1062
|
+
s = "max" if cell_max_width <= cell_width else "norm"
|
|
1004
1063
|
self.stdscr.addstr(y, cell_pos, (' '*cell_width)[:cell_max_width], colour)
|
|
1005
1064
|
if self.centre_in_cols:
|
|
1006
1065
|
cell_value = f"{self.indexed_items[row][1][col]:^{cell_width-len(self.separator)}}" + self.separator
|
|
@@ -1011,15 +1070,22 @@ class Picker:
|
|
|
1011
1070
|
# cell_value = cell_value + self.separator
|
|
1012
1071
|
# cell_value = cell_value
|
|
1013
1072
|
cell_value = truncate_to_display_width(cell_value, min(cell_width, cell_max_width), self.centre_in_cols, self.unicode_char_width)
|
|
1073
|
+
if wcswidth(cell_value) + cell_pos > self.term_w:
|
|
1074
|
+
cell_value = truncate_to_display_width(cell_value, self.term_w-cell_pos-10, self.centre_in_cols, self.unicode_char_width)
|
|
1075
|
+
|
|
1014
1076
|
self.stdscr.addstr(y, cell_pos, cell_value, colour)
|
|
1015
1077
|
# Part of the cell is on screen
|
|
1016
|
-
elif self.startx <= cell_pos+cell_width and cell_pos
|
|
1078
|
+
elif self.startx <= cell_pos+cell_width and cell_pos <= (self.rows_w):
|
|
1079
|
+
s = "max" if cell_max_width <= cell_width else "norm"
|
|
1017
1080
|
cell_start = self.startx - cell_pos
|
|
1018
1081
|
# self.stdscr.addstr(y, self.startx, ' '*(cell_width-cell_start), curses.color_pair(self.colours_start+colour_pair_number))
|
|
1019
1082
|
cell_value = self.indexed_items[row][1][col]
|
|
1020
1083
|
cell_value = f"{cell_value:^{self.column_widths[col]}}"
|
|
1021
1084
|
|
|
1022
|
-
cell_value = cell_value[cell_start:visible_column_widths[col]][:self.rows_w-self.
|
|
1085
|
+
cell_value = cell_value[cell_start:visible_column_widths[col]][:self.rows_w-self.left_gutter_width]
|
|
1086
|
+
cell_value = truncate_to_display_width(cell_value, min(wcswidth(cell_value), cell_width, cell_max_width), self.centre_in_cols, self.unicode_char_width)
|
|
1087
|
+
cell_value += self.separator
|
|
1088
|
+
cell_value = truncate_to_display_width(cell_value, min(wcswidth(cell_value), cell_width, cell_max_width), self.centre_in_cols, self.unicode_char_width)
|
|
1023
1089
|
self.stdscr.addstr(y, self.startx, cell_value, colour)
|
|
1024
1090
|
else:
|
|
1025
1091
|
pass
|
|
@@ -1098,6 +1164,7 @@ class Picker:
|
|
|
1098
1164
|
l0_highlights, l1_highlights, l2_highlights = sort_highlights(self.highlights)
|
|
1099
1165
|
|
|
1100
1166
|
|
|
1167
|
+
row_width = sum(self.column_widths) + len(self.separator)*(len(self.column_widths)-1)
|
|
1101
1168
|
for idx in range(start_index, end_index):
|
|
1102
1169
|
item = self.indexed_items[idx]
|
|
1103
1170
|
y = idx - start_index + self.top_space
|
|
@@ -1109,18 +1176,21 @@ class Picker:
|
|
|
1109
1176
|
# rowstr off screen
|
|
1110
1177
|
# if self.leftmost_char > len(row_str_orig):
|
|
1111
1178
|
# trunc_width = 0
|
|
1112
|
-
if self.leftmost_char + (self.rows_w-self.
|
|
1113
|
-
|
|
1114
|
-
elif self.leftmost_char <= len(row_str_orig):
|
|
1115
|
-
|
|
1116
|
-
else:
|
|
1117
|
-
|
|
1179
|
+
# if self.leftmost_char + (self.rows_w-self.left_gutter_width) <= len(row_str_orig):
|
|
1180
|
+
# trunc_width = self.rows_w-self.startx
|
|
1181
|
+
# elif self.leftmost_char <= len(row_str_orig):
|
|
1182
|
+
# trunc_width = len(row_str_orig) - self.leftmost_char
|
|
1183
|
+
# else:
|
|
1184
|
+
# trunc_width = 0
|
|
1185
|
+
|
|
1186
|
+
|
|
1187
|
+
trunc_width = min(self.rows_w-self.left_gutter_width, row_width, self.term_w - self.startx)
|
|
1118
1188
|
|
|
1119
1189
|
row_str = truncate_to_display_width(row_str_left_adj, trunc_width, self.unicode_char_width)
|
|
1120
1190
|
# row_str = truncate_to_display_width(row_str, min(w-self.startx, visible_columns_total_width))[self.leftmost_char:]
|
|
1121
1191
|
|
|
1122
1192
|
## Display the standard row
|
|
1123
|
-
self.stdscr.addstr(y, self.startx, row_str
|
|
1193
|
+
self.stdscr.addstr(y, self.startx, row_str, curses.color_pair(self.colours_start+2))
|
|
1124
1194
|
|
|
1125
1195
|
|
|
1126
1196
|
## Highlight column
|
|
@@ -1157,7 +1227,7 @@ class Picker:
|
|
|
1157
1227
|
# Higlight cursor row and selected rows
|
|
1158
1228
|
elif self.highlight_full_row:
|
|
1159
1229
|
if self.selections[item[0]]:
|
|
1160
|
-
self.stdscr.addstr(y, self.startx, row_str[:min(self.rows_w-self.
|
|
1230
|
+
self.stdscr.addstr(y, self.startx, row_str[:min(self.rows_w-self.left_gutter_width, visible_columns_total_width)], curses.color_pair(self.colours_start+25) | curses.A_BOLD)
|
|
1161
1231
|
|
|
1162
1232
|
# Visually selected
|
|
1163
1233
|
if self.is_selecting:
|
|
@@ -1191,7 +1261,7 @@ class Picker:
|
|
|
1191
1261
|
if self.cell_cursor:
|
|
1192
1262
|
highlight_cell(idx, self.selected_column, visible_column_widths, colour_pair_number=5, bold=True, y=y)
|
|
1193
1263
|
else:
|
|
1194
|
-
self.stdscr.addstr(y, self.startx, row_str[:
|
|
1264
|
+
self.stdscr.addstr(y, self.startx, row_str[:self.rows_w-self.left_gutter_width], curses.color_pair(self.colours_start+5) | curses.A_BOLD)
|
|
1195
1265
|
|
|
1196
1266
|
if not self.highlights_hide:
|
|
1197
1267
|
draw_highlights(l2_highlights, idx, y, item)
|
|
@@ -1211,7 +1281,8 @@ class Picker:
|
|
|
1211
1281
|
scroll_bar_length = max(1, scroll_bar_length)
|
|
1212
1282
|
for i in range(scroll_bar_length):
|
|
1213
1283
|
v = max(self.top_space+int(bool(self.header)), scroll_bar_start-scroll_bar_length//2)
|
|
1214
|
-
self.stdscr.addstr(scroll_bar_start+i, self.rows_w-
|
|
1284
|
+
# self.stdscr.addstr(scroll_bar_start+i, self.startx+self.rows_w-self.left_gutter_width-2, ' ', curses.color_pair(self.colours_start+18))
|
|
1285
|
+
self.stdscr.addstr(scroll_bar_start+i, self.rows_box_x_f-1, ' ', curses.color_pair(self.colours_start+18))
|
|
1215
1286
|
|
|
1216
1287
|
# Display refresh symbol
|
|
1217
1288
|
if self.auto_refresh:
|
|
@@ -1240,20 +1311,46 @@ class Picker:
|
|
|
1240
1311
|
|
|
1241
1312
|
if self.split_right and len(self.right_panes):
|
|
1242
1313
|
# If we need to refresh the data then do so.
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1314
|
+
pane = self.right_panes[self.right_pane_index]
|
|
1315
|
+
if pane["auto_refresh"] and ((time.time() - self.initial_right_split_time) > pane["refresh_time"]):
|
|
1316
|
+
get_data = pane["get_data"]
|
|
1317
|
+
data = pane["data"]
|
|
1318
|
+
pane["data"] = get_data(data, self.get_function_data())
|
|
1319
|
+
self.initial_right_split_time = time.time()
|
|
1248
1320
|
|
|
1249
|
-
draw_pane =
|
|
1250
|
-
data =
|
|
1321
|
+
draw_pane = pane["display"]
|
|
1322
|
+
data = pane["data"]
|
|
1323
|
+
# pane_width = int(pane["proportion"]*self.term_w)
|
|
1251
1324
|
|
|
1252
1325
|
draw_pane(
|
|
1253
1326
|
self.stdscr,
|
|
1254
|
-
x = self.rows_w,
|
|
1327
|
+
x = self.rows_w + self.startx - self.left_gutter_width,
|
|
1255
1328
|
y = self.top_space - int(bool(self.show_header and self.header)),
|
|
1256
|
-
w = self.
|
|
1329
|
+
w = self.right_pane_width,
|
|
1330
|
+
h = self.items_per_page + int(bool(self.show_header and self.header)),
|
|
1331
|
+
state = self.get_function_data(),
|
|
1332
|
+
row = self.indexed_items[self.cursor_pos] if self.indexed_items else [],
|
|
1333
|
+
cell = self.indexed_items[self.cursor_pos][1][self.selected_column] if self.indexed_items else "",
|
|
1334
|
+
data=data,
|
|
1335
|
+
)
|
|
1336
|
+
if self.split_left and len(self.left_panes):
|
|
1337
|
+
# If we need to refresh the data then do so.
|
|
1338
|
+
pane = self.left_panes[self.left_pane_index]
|
|
1339
|
+
if pane["auto_refresh"] and ((time.time() - self.initial_left_split_time) > pane["refresh_time"]):
|
|
1340
|
+
get_data = pane["get_data"]
|
|
1341
|
+
data = pane["data"]
|
|
1342
|
+
pane["data"] = get_data(data, self.get_function_data())
|
|
1343
|
+
self.initial_left_split_time = time.time()
|
|
1344
|
+
|
|
1345
|
+
draw_pane = pane["display"]
|
|
1346
|
+
data = pane["data"]
|
|
1347
|
+
# pane_width = int(pane["proportion"]*self.term_w)
|
|
1348
|
+
|
|
1349
|
+
draw_pane(
|
|
1350
|
+
self.stdscr,
|
|
1351
|
+
x = 0,
|
|
1352
|
+
y = self.top_space - int(bool(self.show_header and self.header)),
|
|
1353
|
+
w = self.left_pane_width,
|
|
1257
1354
|
h = self.items_per_page + int(bool(self.show_header and self.header)),
|
|
1258
1355
|
state = self.get_function_data(),
|
|
1259
1356
|
row = self.indexed_items[self.cursor_pos] if self.indexed_items else [],
|
|
@@ -1261,7 +1358,6 @@ class Picker:
|
|
|
1261
1358
|
data=data,
|
|
1262
1359
|
)
|
|
1263
1360
|
|
|
1264
|
-
self.stdscr.refresh()
|
|
1265
1361
|
## Display infobox
|
|
1266
1362
|
if self.display_infobox:
|
|
1267
1363
|
self.infobox(self.stdscr, message=self.infobox_items, title=self.infobox_title)
|
|
@@ -1309,6 +1405,7 @@ class Picker:
|
|
|
1309
1405
|
"reset_colours": False,
|
|
1310
1406
|
"cell_cursor": False,
|
|
1311
1407
|
"split_right": False,
|
|
1408
|
+
"split_left": False,
|
|
1312
1409
|
"crosshair_cursor": False,
|
|
1313
1410
|
}
|
|
1314
1411
|
|
|
@@ -1427,6 +1524,9 @@ class Picker:
|
|
|
1427
1524
|
"split_right": self.split_right,
|
|
1428
1525
|
"right_panes": self.right_panes,
|
|
1429
1526
|
"right_pane_index": self.right_pane_index,
|
|
1527
|
+
"split_left": self.split_left,
|
|
1528
|
+
"left_panes": self.left_panes,
|
|
1529
|
+
"left_pane_index": self.left_pane_index,
|
|
1430
1530
|
"crosshair_cursor": self.crosshair_cursor,
|
|
1431
1531
|
|
|
1432
1532
|
}
|
|
@@ -1464,6 +1564,9 @@ class Picker:
|
|
|
1464
1564
|
"centre_in_cols",
|
|
1465
1565
|
"centre_in_terminal",
|
|
1466
1566
|
"split_right",
|
|
1567
|
+
"left_pane_index",
|
|
1568
|
+
"split_left",
|
|
1569
|
+
"left_pane_index",
|
|
1467
1570
|
]
|
|
1468
1571
|
|
|
1469
1572
|
for var in variables:
|
|
@@ -1557,6 +1660,7 @@ class Picker:
|
|
|
1557
1660
|
"number_columns": False,
|
|
1558
1661
|
"reset_colours": False,
|
|
1559
1662
|
"split_right": False,
|
|
1663
|
+
"split_left": False,
|
|
1560
1664
|
"cell_cursor": False,
|
|
1561
1665
|
"crosshair_cursor": False,
|
|
1562
1666
|
}
|
|
@@ -1569,6 +1673,7 @@ class Picker:
|
|
|
1569
1673
|
|
|
1570
1674
|
submenu_win = curses.newwin(window_height, window_width, (self.term_h-window_height)//2, (self.term_w-window_width)//2)
|
|
1571
1675
|
submenu_win.keypad(True)
|
|
1676
|
+
option_picker_data["screen_size_function"] = lambda stdscr: (window_height, window_width)
|
|
1572
1677
|
OptionPicker = Picker(submenu_win, **option_picker_data)
|
|
1573
1678
|
s, o, f = OptionPicker.run()
|
|
1574
1679
|
|
|
@@ -1585,7 +1690,7 @@ class Picker:
|
|
|
1585
1690
|
|
|
1586
1691
|
self.logger.info(f"function: notification()")
|
|
1587
1692
|
""" Notification box. """
|
|
1588
|
-
notification_width, notification_height = 50, 7
|
|
1693
|
+
notification_width, notification_height = min(self.term_w-4, 50), 7
|
|
1589
1694
|
message_width = notification_width-5
|
|
1590
1695
|
|
|
1591
1696
|
if not message: message = "!!"
|
|
@@ -1600,7 +1705,7 @@ class Picker:
|
|
|
1600
1705
|
while True:
|
|
1601
1706
|
self.update_term_size()
|
|
1602
1707
|
|
|
1603
|
-
submenu_win = curses.newwin(notification_height, notification_width, 3, self.term_w - (notification_width+
|
|
1708
|
+
submenu_win = curses.newwin(notification_height, notification_width, 3, self.term_w - (notification_width+2))
|
|
1604
1709
|
notification_data = {
|
|
1605
1710
|
"items": submenu_items,
|
|
1606
1711
|
"title": title,
|
|
@@ -1617,9 +1722,11 @@ class Picker:
|
|
|
1617
1722
|
"cancel_is_back": True,
|
|
1618
1723
|
"reset_colours": False,
|
|
1619
1724
|
"split_right": False,
|
|
1725
|
+
"split_left": False,
|
|
1620
1726
|
"cell_cursor": False,
|
|
1621
1727
|
"crosshair_cursor": False,
|
|
1622
1728
|
"show_header": False,
|
|
1729
|
+
"screen_size_function": lambda stdscr: (notification_height, notification_width),
|
|
1623
1730
|
|
|
1624
1731
|
}
|
|
1625
1732
|
OptionPicker = Picker(submenu_win, **notification_data)
|
|
@@ -1757,14 +1864,24 @@ class Picker:
|
|
|
1757
1864
|
self.footer_style = (self.footer_style+1)%len(self.footer_options)
|
|
1758
1865
|
self.footer = self.footer_options[self.footer_style]
|
|
1759
1866
|
self.initialise_variables()
|
|
1760
|
-
elif setting == "
|
|
1867
|
+
elif setting == "rpane":
|
|
1761
1868
|
self.toggle_right_pane()
|
|
1762
1869
|
|
|
1763
|
-
elif setting == "
|
|
1870
|
+
elif setting == "rpane_cycle":
|
|
1764
1871
|
self.cycle_right_pane()
|
|
1765
1872
|
|
|
1873
|
+
elif setting == "lpane":
|
|
1874
|
+
self.toggle_left_pane()
|
|
1875
|
+
|
|
1876
|
+
elif setting == "lpane_cycle":
|
|
1877
|
+
self.cycle_left_pane()
|
|
1878
|
+
|
|
1766
1879
|
elif setting.startswith("cwd="):
|
|
1767
1880
|
os.chdir(os.path.expandvars(os.path.expanduser(setting[len("cwd="):])))
|
|
1881
|
+
elif setting.startswith("lmc="):
|
|
1882
|
+
rem = setting[4:]
|
|
1883
|
+
if rem.isnumeric():
|
|
1884
|
+
self.leftmost_char = int(rem)
|
|
1768
1885
|
elif setting.startswith("hl"):
|
|
1769
1886
|
hl_list = setting.split(",")
|
|
1770
1887
|
if len(hl_list) > 1:
|
|
@@ -2389,11 +2506,22 @@ class Picker:
|
|
|
2389
2506
|
if self.right_panes[self.right_pane_index]["data"] in [[], None, {}]:
|
|
2390
2507
|
self.right_panes[self.right_pane_index]["data"] = self.right_panes[self.right_pane_index]["get_data"](self.right_panes[self.right_pane_index]["data"], self.get_function_data())
|
|
2391
2508
|
|
|
2509
|
+
def toggle_left_pane(self):
|
|
2510
|
+
if len(self.left_panes):
|
|
2511
|
+
self.split_left = not self.split_left
|
|
2512
|
+
if self.left_panes[self.left_pane_index]["data"] in [[], None, {}]:
|
|
2513
|
+
self.left_panes[self.left_pane_index]["data"] = self.left_panes[self.left_pane_index]["get_data"](self.left_panes[self.left_pane_index]["data"], self.get_function_data())
|
|
2514
|
+
|
|
2392
2515
|
|
|
2393
2516
|
def cycle_right_pane(self, increment=1):
|
|
2394
2517
|
if len(self.right_panes) > 1:
|
|
2395
2518
|
self.right_pane_index = (self.right_pane_index+1)%len(self.right_panes)
|
|
2396
|
-
self.
|
|
2519
|
+
self.initial_right_split_time -= self.right_panes[self.right_pane_index]["refresh_time"]
|
|
2520
|
+
|
|
2521
|
+
def cycle_left_pane(self, increment=1):
|
|
2522
|
+
if len(self.left_panes) > 1:
|
|
2523
|
+
self.left_pane_index = (self.left_pane_index+1)%len(self.left_panes)
|
|
2524
|
+
self.initial_left_split_time -= self.left_panes[self.left_pane_index]["refresh_time"]
|
|
2397
2525
|
|
|
2398
2526
|
def run(self) -> Tuple[list[int], str, dict]:
|
|
2399
2527
|
""" Run the picker. """
|
|
@@ -2411,7 +2539,8 @@ class Picker:
|
|
|
2411
2539
|
|
|
2412
2540
|
self.initial_time = time.time()
|
|
2413
2541
|
self.initial_time_footer = time.time()-self.footer_timer
|
|
2414
|
-
self.
|
|
2542
|
+
self.initial_right_split_time = time.time()-200
|
|
2543
|
+
self.initial_left_split_time = time.time()-200
|
|
2415
2544
|
|
|
2416
2545
|
if self.startup_notification:
|
|
2417
2546
|
self.notification(self.stdscr, message=self.startup_notification)
|
|
@@ -2446,11 +2575,7 @@ class Picker:
|
|
|
2446
2575
|
tty_fd, self.saved_terminal_state = open_tty()
|
|
2447
2576
|
|
|
2448
2577
|
self.update_term_size()
|
|
2449
|
-
|
|
2450
|
-
proportion = self.right_panes[self.right_pane_index]["proportion"]
|
|
2451
|
-
self.rows_w, self.rows_h = int(self.term_w*proportion), self.term_h
|
|
2452
|
-
else:
|
|
2453
|
-
self.rows_w, self.rows_h = self.term_w, self.term_h
|
|
2578
|
+
self.calculate_section_sizes()
|
|
2454
2579
|
|
|
2455
2580
|
def terminal_resized(old_w, old_h) -> bool:
|
|
2456
2581
|
w, h = os.get_terminal_size()
|
|
@@ -2486,14 +2611,6 @@ class Picker:
|
|
|
2486
2611
|
if self.term_resize_event:
|
|
2487
2612
|
key = curses.KEY_RESIZE
|
|
2488
2613
|
|
|
2489
|
-
self.update_term_size()
|
|
2490
|
-
|
|
2491
|
-
if self.split_right and len(self.right_panes):
|
|
2492
|
-
proportion = self.right_panes[self.right_pane_index]["proportion"]
|
|
2493
|
-
self.rows_w, self.rows_h = int(self.term_w*proportion), self.term_h
|
|
2494
|
-
else:
|
|
2495
|
-
self.rows_w, self.rows_h = self.term_w, self.term_h
|
|
2496
|
-
|
|
2497
2614
|
if key in self.disabled_keys: continue
|
|
2498
2615
|
clear_screen=True
|
|
2499
2616
|
|
|
@@ -2545,11 +2662,17 @@ class Picker:
|
|
|
2545
2662
|
self.initial_time_footer = time.time()
|
|
2546
2663
|
self.draw_screen()
|
|
2547
2664
|
|
|
2548
|
-
if self.split_right and len(self.right_panes) and self.right_panes[self.right_pane_index]["auto_refresh"] and ((time.time() - self.
|
|
2665
|
+
if self.split_right and len(self.right_panes) and self.right_panes[self.right_pane_index]["auto_refresh"] and ((time.time() - self.initial_right_split_time) > self.right_panes[self.right_pane_index]["refresh_time"]):
|
|
2549
2666
|
get_data = self.right_panes[self.right_pane_index]["get_data"]
|
|
2550
2667
|
data = self.right_panes[self.right_pane_index]["data"]
|
|
2551
2668
|
self.right_panes[self.right_pane_index]["data"] = get_data(data, self.get_function_data())
|
|
2552
|
-
self.
|
|
2669
|
+
self.initial_right_split_time = time.time()
|
|
2670
|
+
|
|
2671
|
+
if self.split_left and len(self.left_panes) and self.left_panes[self.left_pane_index]["auto_refresh"] and ((time.time() - self.initial_left_split_time) > self.left_panes[self.left_pane_index]["refresh_time"]):
|
|
2672
|
+
get_data = self.left_panes[self.left_pane_index]["get_data"]
|
|
2673
|
+
data = self.left_panes[self.left_pane_index]["data"]
|
|
2674
|
+
self.left_panes[self.right_pane_index]["data"] = get_data(data, self.get_function_data())
|
|
2675
|
+
self.initial_left_split_time = time.time()
|
|
2553
2676
|
|
|
2554
2677
|
if self.check_key("help", key, self.keys_dict):
|
|
2555
2678
|
self.logger.info(f"key_function help")
|
|
@@ -3006,7 +3129,7 @@ class Picker:
|
|
|
3006
3129
|
column_set_width = sum(visible_column_widths)+len(self.separator)*len(visible_column_widths)
|
|
3007
3130
|
start_of_cell = sum(visible_column_widths[:self.selected_column])+len(self.separator)*self.selected_column
|
|
3008
3131
|
end_of_cell = sum(visible_column_widths[:self.selected_column+1])+len(self.separator)*(self.selected_column+1)
|
|
3009
|
-
display_width = self.rows_w-self.
|
|
3132
|
+
display_width = self.rows_w-self.left_gutter_width
|
|
3010
3133
|
# If the full column is within the current display then don't do anything
|
|
3011
3134
|
if start_of_cell >= self.leftmost_char and end_of_cell <= self.leftmost_char + display_width:
|
|
3012
3135
|
pass
|
|
@@ -3033,7 +3156,7 @@ class Picker:
|
|
|
3033
3156
|
column_set_width = sum(visible_column_widths)+len(self.separator)*len(visible_column_widths)
|
|
3034
3157
|
start_of_cell = sum(visible_column_widths[:self.selected_column])+len(self.separator)*self.selected_column
|
|
3035
3158
|
end_of_cell = sum(visible_column_widths[:self.selected_column+1])+len(self.separator)*(self.selected_column+1)
|
|
3036
|
-
display_width = self.rows_w-self.
|
|
3159
|
+
display_width = self.rows_w-self.left_gutter_width
|
|
3037
3160
|
|
|
3038
3161
|
# If the entire column is within the current display then don't do anything
|
|
3039
3162
|
if start_of_cell >= self.leftmost_char and end_of_cell <= self.leftmost_char + display_width:
|
|
@@ -3048,9 +3171,9 @@ class Picker:
|
|
|
3048
3171
|
self.logger.info(f"key_function scroll_right")
|
|
3049
3172
|
if len(self.indexed_items):
|
|
3050
3173
|
row_width = sum(self.column_widths) + len(self.separator)*(len(self.column_widths)-1)
|
|
3051
|
-
if row_width-self.leftmost_char >= self.rows_w-
|
|
3174
|
+
if row_width-self.leftmost_char >= self.rows_w-5:
|
|
3052
3175
|
self.leftmost_char += 5
|
|
3053
|
-
self.leftmost_char = min(self.leftmost_char, row_width - (self.rows_w
|
|
3176
|
+
self.leftmost_char = min(self.leftmost_char, row_width - (self.rows_w) + self.left_gutter_width+5)
|
|
3054
3177
|
if sum(self.column_widths) + len(self.column_widths)*len(self.separator) < self.rows_w:
|
|
3055
3178
|
self.leftmost_char = 0
|
|
3056
3179
|
|
|
@@ -3058,9 +3181,9 @@ class Picker:
|
|
|
3058
3181
|
self.logger.info(f"key_function scroll_right")
|
|
3059
3182
|
if len(self.indexed_items):
|
|
3060
3183
|
row_width = sum(self.column_widths) + len(self.separator)*(len(self.column_widths)-1)
|
|
3061
|
-
if row_width-self.leftmost_char >= self.rows_w-
|
|
3184
|
+
if row_width-self.leftmost_char+5 >= self.rows_w-25:
|
|
3062
3185
|
self.leftmost_char += 25
|
|
3063
|
-
self.leftmost_char = min(self.leftmost_char, row_width - (self.rows_w
|
|
3186
|
+
self.leftmost_char = min(self.leftmost_char, row_width - (self.rows_w) + self.left_gutter_width+5)
|
|
3064
3187
|
if sum(self.column_widths) + len(self.column_widths)*len(self.separator) < self.rows_w:
|
|
3065
3188
|
self.leftmost_char = 0
|
|
3066
3189
|
|
|
@@ -3091,7 +3214,16 @@ class Picker:
|
|
|
3091
3214
|
# row_str = format_row(item[1], self.hidden_columns, self.column_widths, self.separator, self.centre_in_cols)
|
|
3092
3215
|
# if len(row_str) > longest_row_str_len: longest_row_str_len=len(row_str)
|
|
3093
3216
|
# self.notification(self.stdscr, f"{longest_row_str_len}")
|
|
3094
|
-
|
|
3217
|
+
if len(self.indexed_items):
|
|
3218
|
+
row_width = sum(self.column_widths) + len(self.separator)*(len(self.column_widths)-1)
|
|
3219
|
+
self.leftmost_char = row_width - (self.rows_w) + self.left_gutter_width+5
|
|
3220
|
+
self.leftmost_char = min(self.leftmost_char, row_width - (self.rows_w) + self.left_gutter_width+5)
|
|
3221
|
+
|
|
3222
|
+
longest_row_str_len = sum(self.column_widths) + (len(self.column_widths)-1)*len(self.separator)
|
|
3223
|
+
# self.leftmost_char = max(0, longest_row_str_len-self.rows_w+2+5)
|
|
3224
|
+
|
|
3225
|
+
|
|
3226
|
+
|
|
3095
3227
|
if len(self.items):
|
|
3096
3228
|
self.selected_column = len(self.items[0])-1
|
|
3097
3229
|
|
|
@@ -3186,6 +3318,13 @@ class Picker:
|
|
|
3186
3318
|
|
|
3187
3319
|
self.calculate_section_sizes()
|
|
3188
3320
|
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)
|
|
3321
|
+
|
|
3322
|
+
row_width = sum(self.column_widths) + len(self.separator)*(len(self.column_widths)-1)
|
|
3323
|
+
if row_width - self.leftmost_char < self.rows_w:
|
|
3324
|
+
if row_width <= self.rows_w - self.left_gutter_width:
|
|
3325
|
+
self.leftmost_char = 0
|
|
3326
|
+
else:
|
|
3327
|
+
self.leftmost_char = row_width - (self.rows_w - self.left_gutter_width) + 5
|
|
3189
3328
|
self.stdscr.clear()
|
|
3190
3329
|
self.stdscr.refresh()
|
|
3191
3330
|
self.draw_screen()
|
|
@@ -3442,6 +3581,12 @@ class Picker:
|
|
|
3442
3581
|
elif self.check_key("cycle_right_pane", key, self.keys_dict):
|
|
3443
3582
|
self.cycle_right_pane()
|
|
3444
3583
|
|
|
3584
|
+
elif self.check_key("toggle_left_pane", key, self.keys_dict):
|
|
3585
|
+
self.toggle_left_pane()
|
|
3586
|
+
|
|
3587
|
+
elif self.check_key("cycle_left_pane", key, self.keys_dict):
|
|
3588
|
+
self.cycle_left_pane()
|
|
3589
|
+
|
|
3445
3590
|
elif self.check_key("pipe_input", key, self.keys_dict):
|
|
3446
3591
|
self.logger.info(f"key_function pipe_input")
|
|
3447
3592
|
# usrtxt = "xargs -d '\n' -I{} "
|
|
@@ -4003,7 +4148,7 @@ def main() -> None:
|
|
|
4003
4148
|
# function_data["cell_cursor"] = True
|
|
4004
4149
|
# function_data["display_modes"] = True
|
|
4005
4150
|
# function_data["centre_in_cols"] = True
|
|
4006
|
-
|
|
4151
|
+
function_data["show_row_header"] = True
|
|
4007
4152
|
# function_data["keys_dict"] = picker_keys
|
|
4008
4153
|
# function_data["id_column"] = -1
|
|
4009
4154
|
# function_data["track_entries_upon_refresh"] = True
|
|
@@ -4019,10 +4164,23 @@ def main() -> None:
|
|
|
4019
4164
|
# function_data["debug"] = True
|
|
4020
4165
|
# function_data["debug_level"] = 1
|
|
4021
4166
|
|
|
4167
|
+
function_data["cell_cursor"] = False
|
|
4168
|
+
|
|
4022
4169
|
function_data["split_right"] = False
|
|
4170
|
+
function_data["split_left"] = False
|
|
4023
4171
|
function_data["right_pane_index"] = 2
|
|
4172
|
+
function_data["left_pane_index"] = 0
|
|
4024
4173
|
|
|
4025
4174
|
function_data["right_panes"] = [
|
|
4175
|
+
# Nopane
|
|
4176
|
+
{
|
|
4177
|
+
"proportion": 1/3,
|
|
4178
|
+
"auto_refresh": False,
|
|
4179
|
+
"get_data": lambda data, state: [],
|
|
4180
|
+
"display": left_start_pane,
|
|
4181
|
+
"data": ["Files", []],
|
|
4182
|
+
"refresh_time": 1,
|
|
4183
|
+
},
|
|
4026
4184
|
# Graph or random numbers generated each second
|
|
4027
4185
|
{
|
|
4028
4186
|
"proportion": 1/2,
|
|
@@ -4034,7 +4192,7 @@ def main() -> None:
|
|
|
4034
4192
|
},
|
|
4035
4193
|
# list of numbers
|
|
4036
4194
|
{
|
|
4037
|
-
"proportion":
|
|
4195
|
+
"proportion": 1/3,
|
|
4038
4196
|
"auto_refresh": False,
|
|
4039
4197
|
"get_data": data_refresh_randint_title,
|
|
4040
4198
|
"display": right_split_display_list,
|
|
@@ -4043,7 +4201,7 @@ def main() -> None:
|
|
|
4043
4201
|
},
|
|
4044
4202
|
# File attributes
|
|
4045
4203
|
{
|
|
4046
|
-
"proportion":
|
|
4204
|
+
"proportion": 1/3,
|
|
4047
4205
|
"auto_refresh": False,
|
|
4048
4206
|
"get_data": lambda data, state: [],
|
|
4049
4207
|
"display": right_split_file_attributes,
|
|
@@ -4052,7 +4210,7 @@ def main() -> None:
|
|
|
4052
4210
|
},
|
|
4053
4211
|
# File attributes dynamic
|
|
4054
4212
|
{
|
|
4055
|
-
"proportion":
|
|
4213
|
+
"proportion": 1/3,
|
|
4056
4214
|
"auto_refresh": True,
|
|
4057
4215
|
"get_data": update_file_attributes,
|
|
4058
4216
|
"display": right_split_file_attributes_dynamic,
|
|
@@ -4078,7 +4236,72 @@ def main() -> None:
|
|
|
4078
4236
|
"refresh_time": 1,
|
|
4079
4237
|
},
|
|
4080
4238
|
]
|
|
4081
|
-
function_data["
|
|
4239
|
+
function_data["left_panes"] = [
|
|
4240
|
+
# Nopane
|
|
4241
|
+
{
|
|
4242
|
+
"proportion": 1/3,
|
|
4243
|
+
"auto_refresh": False,
|
|
4244
|
+
"get_data": lambda data, state: [],
|
|
4245
|
+
"display": left_start_pane,
|
|
4246
|
+
"data": ["Files", []],
|
|
4247
|
+
"refresh_time": 1,
|
|
4248
|
+
},
|
|
4249
|
+
# Graph or random numbers generated each second
|
|
4250
|
+
{
|
|
4251
|
+
"proportion": 1/2,
|
|
4252
|
+
"auto_refresh": True,
|
|
4253
|
+
"get_data": data_refresh_randint,
|
|
4254
|
+
"display": left_split_graph,
|
|
4255
|
+
"data": [],
|
|
4256
|
+
"refresh_time": 1.0,
|
|
4257
|
+
},
|
|
4258
|
+
# list of numbers
|
|
4259
|
+
{
|
|
4260
|
+
"proportion": 1/3,
|
|
4261
|
+
"auto_refresh": False,
|
|
4262
|
+
"get_data": data_refresh_randint_title,
|
|
4263
|
+
"display": left_split_display_list,
|
|
4264
|
+
"data": ["Files", [str(x) for x in range(100)]],
|
|
4265
|
+
"refresh_time": 1.0,
|
|
4266
|
+
},
|
|
4267
|
+
# File attributes
|
|
4268
|
+
{
|
|
4269
|
+
"proportion": 1/3,
|
|
4270
|
+
"auto_refresh": False,
|
|
4271
|
+
"get_data": lambda data, state: [],
|
|
4272
|
+
"display": left_split_file_attributes,
|
|
4273
|
+
"data": [],
|
|
4274
|
+
"refresh_time": 1.0,
|
|
4275
|
+
},
|
|
4276
|
+
# File attributes dynamic
|
|
4277
|
+
{
|
|
4278
|
+
"proportion": 1/3,
|
|
4279
|
+
"auto_refresh": True,
|
|
4280
|
+
"get_data": update_file_attributes,
|
|
4281
|
+
"display": left_split_file_attributes_dynamic,
|
|
4282
|
+
"data": [],
|
|
4283
|
+
"refresh_time": 2.0,
|
|
4284
|
+
},
|
|
4285
|
+
# List of random numbers generated each second
|
|
4286
|
+
{
|
|
4287
|
+
"proportion": 1/2,
|
|
4288
|
+
"auto_refresh": True,
|
|
4289
|
+
"get_data": data_refresh_randint_title,
|
|
4290
|
+
"display": left_split_display_list,
|
|
4291
|
+
"data": ["Files", []],
|
|
4292
|
+
"refresh_time": 2,
|
|
4293
|
+
},
|
|
4294
|
+
# Nopane
|
|
4295
|
+
{
|
|
4296
|
+
"proportion": 1/3,
|
|
4297
|
+
"auto_refresh": False,
|
|
4298
|
+
"get_data": lambda data, state: [],
|
|
4299
|
+
"display": lambda scr, x, y, w, h, state, row, cell, data: [],
|
|
4300
|
+
"data": ["Files", []],
|
|
4301
|
+
"refresh_time": 1,
|
|
4302
|
+
},
|
|
4303
|
+
]
|
|
4304
|
+
# function_data["require_option"] = [True for _ in function_data["items"]]
|
|
4082
4305
|
|
|
4083
4306
|
stdscr = start_curses()
|
|
4084
4307
|
try:
|