listpick 0.1.13.25__py3-none-any.whl → 0.1.13.27__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 +33 -34
- listpick/ui/footer.py +3 -5
- {listpick-0.1.13.25.dist-info → listpick-0.1.13.27.dist-info}/METADATA +1 -1
- {listpick-0.1.13.25.dist-info → listpick-0.1.13.27.dist-info}/RECORD +8 -8
- {listpick-0.1.13.25.dist-info → listpick-0.1.13.27.dist-info}/WHEEL +0 -0
- {listpick-0.1.13.25.dist-info → listpick-0.1.13.27.dist-info}/entry_points.txt +0 -0
- {listpick-0.1.13.25.dist-info → listpick-0.1.13.27.dist-info}/licenses/LICENSE.txt +0 -0
- {listpick-0.1.13.25.dist-info → listpick-0.1.13.27.dist-info}/top_level.txt +0 -0
listpick/listpick_app.py
CHANGED
|
@@ -318,12 +318,14 @@ 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
|
|
|
324
325
|
# self.footer = CompactFooter(self.stdscr, colours_start, self.get_function_data)
|
|
325
326
|
|
|
326
327
|
|
|
328
|
+
|
|
327
329
|
def calculate_section_sizes(self):
|
|
328
330
|
"""
|
|
329
331
|
Calculte the following for the Picker:
|
|
@@ -598,6 +600,8 @@ class Picker:
|
|
|
598
600
|
else:
|
|
599
601
|
self.cursor_pos = 0
|
|
600
602
|
|
|
603
|
+
if self.display_infobox:
|
|
604
|
+
self.infobox_picker = self.infobox(self.stdscr, self.infobox_items, self.infobox_title)
|
|
601
605
|
|
|
602
606
|
|
|
603
607
|
def move_column(self, direction: int) -> None:
|
|
@@ -988,15 +992,23 @@ class Picker:
|
|
|
988
992
|
## Display infobox
|
|
989
993
|
if self.display_infobox:
|
|
990
994
|
# self.stdscr.refresh()
|
|
991
|
-
self.infobox(self.stdscr, message=self.infobox_items, title=self.infobox_title)
|
|
995
|
+
# self.infobox(self.stdscr, message=self.infobox_items, title=self.infobox_title)
|
|
996
|
+
|
|
997
|
+
infobox_width, infobox_height = w//2, 3*h//5
|
|
998
|
+
infobox_x, infobox_y = w - (infobox_width + 4), 3
|
|
999
|
+
self.infobox_picker.stdscr.mvwin(infobox_y, infobox_x)
|
|
1000
|
+
self.infobox_picker.stdscr.resize(infobox_height, infobox_width)
|
|
1001
|
+
self.infobox_picker.run()
|
|
1002
|
+
self.infobox_picker.stdscr.noutrefresh()
|
|
1003
|
+
else:
|
|
1004
|
+
self.stdscr.noutrefresh()
|
|
992
1005
|
|
|
993
|
-
# if not self.display_only:
|
|
994
|
-
# self.stdscr.refresh()
|
|
995
|
-
# self.stdscr.timeout(2000) # timeout is set to 50 in order to get the infobox to be displayed so here we reset it to 2000
|
|
996
1006
|
|
|
1007
|
+
if not self.display_only:
|
|
1008
|
+
curses.doupdate()
|
|
997
1009
|
|
|
998
1010
|
|
|
999
|
-
def infobox(self, stdscr: curses.window, message:
|
|
1011
|
+
def infobox(self, stdscr: curses.window, message: list =[], title: str ="Infobox", colours_end: int = 0, duration: int = 4):
|
|
1000
1012
|
""" Display non-interactive infobox window. """
|
|
1001
1013
|
|
|
1002
1014
|
self.logger.info(f"function: infobox()")
|
|
@@ -1004,6 +1016,7 @@ class Picker:
|
|
|
1004
1016
|
notification_width, notification_height = w//2, 3*h//5
|
|
1005
1017
|
message_width = notification_width-5
|
|
1006
1018
|
|
|
1019
|
+
notification_x, notification_y = w-(notification_width+4), 3
|
|
1007
1020
|
if not message: message = "!!"
|
|
1008
1021
|
if isinstance(message, str):
|
|
1009
1022
|
submenu_items = [" "+message[i*message_width:(i+1)*message_width] for i in range(len(message)//message_width+1)]
|
|
@@ -1019,10 +1032,7 @@ class Picker:
|
|
|
1019
1032
|
# while True:
|
|
1020
1033
|
h, w = stdscr.getmaxyx()
|
|
1021
1034
|
|
|
1022
|
-
|
|
1023
|
-
submenu_win = self.stdscr.subpad(notification_height, notification_width, 3, w - (notification_width+4))
|
|
1024
|
-
submenu_win.erase()
|
|
1025
|
-
# submenu_win.untouchwin()
|
|
1035
|
+
submenu_win = self.stdscr.derwin(notification_height, notification_width, 3, w - (notification_width+4))
|
|
1026
1036
|
infobox_data = {
|
|
1027
1037
|
"items": submenu_items,
|
|
1028
1038
|
"colours": notification_colours,
|
|
@@ -1036,12 +1046,9 @@ class Picker:
|
|
|
1036
1046
|
"title": title,
|
|
1037
1047
|
"reset_colours": False,
|
|
1038
1048
|
}
|
|
1039
|
-
|
|
1040
|
-
# for i in range(3, 3+notification_height):
|
|
1041
|
-
# self.stdscr.addstr(i, w - (notification_width+4), ' '*notification_width, curses.color_pair(4))
|
|
1049
|
+
submenu_win.noutrefresh()
|
|
1042
1050
|
OptionPicker = Picker(submenu_win, **infobox_data)
|
|
1043
|
-
|
|
1044
|
-
submenu_win.refresh()
|
|
1051
|
+
return OptionPicker
|
|
1045
1052
|
|
|
1046
1053
|
|
|
1047
1054
|
def get_function_data(self) -> dict:
|
|
@@ -1182,7 +1189,6 @@ class Picker:
|
|
|
1182
1189
|
self.selections = {i:False for i in range(len(self.indexed_items))}
|
|
1183
1190
|
self.cursor_pos = min(self.cursor_pos, len(self.indexed_items)-1)
|
|
1184
1191
|
self.initialise_variables()
|
|
1185
|
-
self.draw_screen(self.indexed_items, self.highlights)
|
|
1186
1192
|
|
|
1187
1193
|
|
|
1188
1194
|
def choose_option(
|
|
@@ -1480,7 +1486,6 @@ class Picker:
|
|
|
1480
1486
|
""" Toggle selection of item at index. """
|
|
1481
1487
|
self.logger.info(f"function: toggle_item()")
|
|
1482
1488
|
self.selections[index] = not self.selections[index]
|
|
1483
|
-
self.draw_screen(self.indexed_items, self.highlights)
|
|
1484
1489
|
|
|
1485
1490
|
def select_all(self) -> None:
|
|
1486
1491
|
""" Select all in indexed_items. """
|
|
@@ -1492,10 +1497,6 @@ class Picker:
|
|
|
1492
1497
|
for row in range(len(self.indexed_items)):
|
|
1493
1498
|
self.selected_cells_by_row[row] = list(range(len(self.indexed_items[row][1])))
|
|
1494
1499
|
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
self.draw_screen(self.indexed_items, self.highlights)
|
|
1498
|
-
|
|
1499
1500
|
def deselect_all(self) -> None:
|
|
1500
1501
|
""" Deselect all items in indexed_items. """
|
|
1501
1502
|
self.logger.info(f"function: deselect_all()")
|
|
@@ -1504,7 +1505,6 @@ class Picker:
|
|
|
1504
1505
|
for i in self.cell_selections.keys():
|
|
1505
1506
|
self.cell_selections[i] = False
|
|
1506
1507
|
self.selected_cells_by_row = {}
|
|
1507
|
-
self.draw_screen(self.indexed_items, self.highlights)
|
|
1508
1508
|
|
|
1509
1509
|
def handle_visual_selection(self, selecting:bool = True) -> None:
|
|
1510
1510
|
""" Toggle visual selection or deselection. """
|
|
@@ -1548,8 +1548,6 @@ class Picker:
|
|
|
1548
1548
|
self.end_selection = -1
|
|
1549
1549
|
self.is_selecting = False
|
|
1550
1550
|
|
|
1551
|
-
self.draw_screen(self.indexed_items, self.highlights)
|
|
1552
|
-
|
|
1553
1551
|
elif self.is_deselecting:
|
|
1554
1552
|
self.end_selection = self.indexed_items[self.cursor_pos][0]
|
|
1555
1553
|
self.end_selection = self.cursor_pos
|
|
@@ -1581,7 +1579,6 @@ class Picker:
|
|
|
1581
1579
|
self.start_selection = -1
|
|
1582
1580
|
self.end_selection = -1
|
|
1583
1581
|
self.is_deselecting = False
|
|
1584
|
-
self.draw_screen(self.indexed_items, self.highlights)
|
|
1585
1582
|
|
|
1586
1583
|
def cursor_down(self, count=1) -> bool:
|
|
1587
1584
|
""" Move cursor down. """
|
|
@@ -1936,7 +1933,7 @@ class Picker:
|
|
|
1936
1933
|
# curses.curs_set(0)
|
|
1937
1934
|
# stdscr.nodelay(1) # Non-blocking input
|
|
1938
1935
|
# stdscr.timeout(2000) # Set a timeout for getch() to ensure it does not block indefinitely
|
|
1939
|
-
self.stdscr.timeout(max(min(2000, int(self.timer*1000)//2, int(self.footer_timer*1000))//2, 20)) # Set a timeout for getch() to ensure it does not block indefinitely
|
|
1936
|
+
# self.stdscr.timeout(max(min(2000, int(self.timer*1000)//2, int(self.footer_timer*1000))//2, 20)) # Set a timeout for getch() to ensure it does not block indefinitely
|
|
1940
1937
|
|
|
1941
1938
|
if self.clear_on_start:
|
|
1942
1939
|
self.stdscr.clear()
|
|
@@ -1953,8 +1950,6 @@ class Picker:
|
|
|
1953
1950
|
self.draw_screen(self.indexed_items, self.highlights)
|
|
1954
1951
|
|
|
1955
1952
|
if self.display_only:
|
|
1956
|
-
# self.stdscr.refresh()
|
|
1957
|
-
# function_data = self.get_function_data()
|
|
1958
1953
|
return [], "", {}
|
|
1959
1954
|
|
|
1960
1955
|
# Main loop
|
|
@@ -1975,15 +1970,18 @@ class Picker:
|
|
|
1975
1970
|
|
|
1976
1971
|
initial_time = time.time()
|
|
1977
1972
|
|
|
1978
|
-
|
|
1973
|
+
try:
|
|
1974
|
+
self.draw_screen(self.indexed_items, self.highlights, clear=False)
|
|
1975
|
+
except:
|
|
1976
|
+
pass
|
|
1979
1977
|
|
|
1980
1978
|
self.refreshing_data = False
|
|
1981
1979
|
self.data_ready = False
|
|
1982
1980
|
|
|
1983
1981
|
elif self.check_key("refresh", key, self.keys_dict) or self.remapped_key(key, curses.KEY_F5, self.key_remappings) or (self.auto_refresh and (time.time() - initial_time) >= self.timer):
|
|
1984
1982
|
self.logger.debug(f"Get new data (refresh).")
|
|
1985
|
-
self.stdscr.addstr(0,w-3," ", curses.color_pair(self.colours_start+21) | curses.A_BOLD)
|
|
1986
|
-
self.stdscr.refresh()
|
|
1983
|
+
# self.stdscr.addstr(0,w-3," ", curses.color_pair(self.colours_start+21) | curses.A_BOLD)
|
|
1984
|
+
# self.stdscr.refresh()
|
|
1987
1985
|
if self.get_new_data and self.refresh_function:
|
|
1988
1986
|
self.refreshing_data = True
|
|
1989
1987
|
|
|
@@ -2889,7 +2887,7 @@ class Picker:
|
|
|
2889
2887
|
self.stdscr.clear()
|
|
2890
2888
|
self.stdscr.refresh()
|
|
2891
2889
|
self.initialise_variables()
|
|
2892
|
-
self.draw_screen(self.indexed_items, self.highlights)
|
|
2890
|
+
# self.draw_screen(self.indexed_items, self.highlights)
|
|
2893
2891
|
|
|
2894
2892
|
|
|
2895
2893
|
|
|
@@ -3158,9 +3156,10 @@ def main() -> None:
|
|
|
3158
3156
|
function_data["centre_in_terminal_vertical"] = True
|
|
3159
3157
|
function_data["highlight_full_row"] = True
|
|
3160
3158
|
function_data["pin_cursor"] = True
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3159
|
+
function_data["display_infobox"] = True
|
|
3160
|
+
function_data["infobox_items"] = [["1"], ["2"], ["3"]]
|
|
3161
|
+
function_data["infobox_title"] = "Title"
|
|
3162
|
+
function_data["footer_string"] = "Title"
|
|
3164
3163
|
|
|
3165
3164
|
|
|
3166
3165
|
# 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,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=
|
|
3
|
+
listpick/listpick_app.py,sha256=oSbKJFzg8gea8EMXmJa7_7UAoAXBZ7--Kt-yBui_RLk,164021
|
|
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=
|
|
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.
|
|
27
|
-
listpick-0.1.13.
|
|
28
|
-
listpick-0.1.13.
|
|
29
|
-
listpick-0.1.13.
|
|
30
|
-
listpick-0.1.13.
|
|
31
|
-
listpick-0.1.13.
|
|
26
|
+
listpick-0.1.13.27.dist-info/licenses/LICENSE.txt,sha256=2mP-MRHJptADDNE9VInMNg1tE-C6Qv93Z4CCQKrpg9w,1061
|
|
27
|
+
listpick-0.1.13.27.dist-info/METADATA,sha256=n4VSEQvyg6jXBLT3Yp2ifBrUsEnMhKh_iW-WisQBuPg,7988
|
|
28
|
+
listpick-0.1.13.27.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
29
|
+
listpick-0.1.13.27.dist-info/entry_points.txt,sha256=-QCf_BKIkUz35Y9nkYpjZWs2Qg0KfRna2PAs5DnF6BE,43
|
|
30
|
+
listpick-0.1.13.27.dist-info/top_level.txt,sha256=5mtsGEz86rz3qQDe0D463gGjAfSp6A3EWg4J4AGYr-Q,9
|
|
31
|
+
listpick-0.1.13.27.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|