listpick 0.1.16.8__py3-none-any.whl → 0.1.16.17__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 +1028 -506
- listpick/pane/left_pane_functions.py +198 -0
- listpick/pane/pane_functions_1.py +175 -0
- listpick/ui/build_help.py +33 -8
- listpick/ui/input_field.py +0 -1
- listpick/ui/keys.py +14 -8
- listpick/ui/picker_colours.py +55 -0
- listpick/utils/generate_data_multiprocessing.py +10 -0
- listpick/utils/generate_data_multithreaded.py +36 -12
- listpick/utils/generate_data_utils.py +43 -0
- listpick/utils/utils.py +15 -12
- {listpick-0.1.16.8.dist-info → listpick-0.1.16.17.dist-info}/METADATA +29 -40
- {listpick-0.1.16.8.dist-info → listpick-0.1.16.17.dist-info}/RECORD +17 -13
- {listpick-0.1.16.8.dist-info → listpick-0.1.16.17.dist-info}/WHEEL +0 -0
- {listpick-0.1.16.8.dist-info → listpick-0.1.16.17.dist-info}/entry_points.txt +0 -0
- {listpick-0.1.16.8.dist-info → listpick-0.1.16.17.dist-info}/licenses/LICENSE.txt +0 -0
- {listpick-0.1.16.8.dist-info → listpick-0.1.16.17.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
#!/bin/python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""
|
|
4
|
+
pane_functions.py
|
|
5
|
+
Functions which are run by a listpick Picker to display data in a pane.
|
|
6
|
+
|
|
7
|
+
Author: GrimAndGreedy
|
|
8
|
+
License: MIT
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
import curses
|
|
12
|
+
import os
|
|
13
|
+
from listpick.pane.pane_utils import get_file_attributes, get_graph_string, escape_ansi
|
|
14
|
+
from listpick.pane.get_data import update_file_attributes
|
|
15
|
+
|
|
16
|
+
def left_start_pane(stdscr, x, y, w, h, state, row, cell, data: list = [], test: bool = False):
|
|
17
|
+
"""
|
|
18
|
+
Display file attributes in right pane.
|
|
19
|
+
"""
|
|
20
|
+
if test: return True
|
|
21
|
+
|
|
22
|
+
# Title
|
|
23
|
+
for i in range(h):
|
|
24
|
+
s = '*'*w
|
|
25
|
+
stdscr.addstr(y+i, x, s)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
stdscr.addstr(y, x, "+")
|
|
29
|
+
stdscr.addstr(y+h-1, x, "+")
|
|
30
|
+
stdscr.addstr(y, x+w-1, "+")
|
|
31
|
+
stdscr.addstr(y+h-1, x+w-1, "+")
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
stdscr.addstr(y+1, x, f"{w},{h}")
|
|
35
|
+
|
|
36
|
+
return []
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def left_split_file_attributes(stdscr, x, y, w, h, state, row, cell, data: list = [], test: bool = False):
|
|
40
|
+
"""
|
|
41
|
+
Display file attributes in right pane.
|
|
42
|
+
"""
|
|
43
|
+
if test: return True
|
|
44
|
+
|
|
45
|
+
# Title
|
|
46
|
+
title = "File attributes"
|
|
47
|
+
if len(title) < w: title = f"{title:^{w}}"
|
|
48
|
+
stdscr.addstr(y, x,title[:w], curses.color_pair(state["colours_start"]+4) | curses.A_BOLD)
|
|
49
|
+
|
|
50
|
+
# Separator
|
|
51
|
+
for j in range(h):
|
|
52
|
+
stdscr.addstr(j+y, x+w-1, ' ', curses.color_pair(state["colours_start"]+16))
|
|
53
|
+
|
|
54
|
+
# Display pane count
|
|
55
|
+
pane_count = len(state["right_panes"])
|
|
56
|
+
pane_index = state["right_pane_index"]
|
|
57
|
+
if pane_count > 1:
|
|
58
|
+
s = f" {pane_index+1}/{pane_count} "
|
|
59
|
+
stdscr.addstr(y+h-1, x, s, curses.color_pair(state["colours_start"]+20))
|
|
60
|
+
|
|
61
|
+
# Filename/cursor cell value
|
|
62
|
+
stdscr.addstr(y+2, x+2, cell[:w-3])
|
|
63
|
+
|
|
64
|
+
attributes = get_file_attributes(cell)
|
|
65
|
+
for i, attr in enumerate(attributes):
|
|
66
|
+
stdscr.addstr(y+3+i, x+4, attr[:w-5])
|
|
67
|
+
|
|
68
|
+
return []
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def left_split_file_attributes_dynamic(stdscr, x, y, w, h, state, row, cell, data: list = [], test: bool = False):
|
|
72
|
+
"""
|
|
73
|
+
Display file attributes in right pane.
|
|
74
|
+
"""
|
|
75
|
+
if test: return True
|
|
76
|
+
|
|
77
|
+
# Title
|
|
78
|
+
title = "File attributes"
|
|
79
|
+
if len(title) < w: title = f"{title:^{w}}"
|
|
80
|
+
stdscr.addstr(y, x,title[:w], curses.color_pair(state["colours_start"]+4) | curses.A_BOLD)
|
|
81
|
+
|
|
82
|
+
# Separator
|
|
83
|
+
for j in range(h):
|
|
84
|
+
stdscr.addstr(j+y, x+w-1, ' ', curses.color_pair(state["colours_start"]+16))
|
|
85
|
+
|
|
86
|
+
# Display pane count
|
|
87
|
+
pane_count = len(state["right_panes"])
|
|
88
|
+
pane_index = state["right_pane_index"]
|
|
89
|
+
if pane_count > 1:
|
|
90
|
+
s = f" {pane_index+1}/{pane_count} "
|
|
91
|
+
stdscr.addstr(y+h-1, x, s, curses.color_pair(state["colours_start"]+20))
|
|
92
|
+
|
|
93
|
+
if len(state["indexed_items"]) == 0:
|
|
94
|
+
return []
|
|
95
|
+
|
|
96
|
+
# Filename/cursor cell value
|
|
97
|
+
stdscr.addstr(y+2, x+2, cell[:w-3])
|
|
98
|
+
|
|
99
|
+
# If the cursor-hovered file is different then reload the data
|
|
100
|
+
if data[1] != cell:
|
|
101
|
+
data[:] = update_file_attributes(data, state)
|
|
102
|
+
|
|
103
|
+
# attributes = get_file_attributes(cell)
|
|
104
|
+
if len(data) == 0: return []
|
|
105
|
+
attributes = data[0]
|
|
106
|
+
for i, attr in enumerate(attributes):
|
|
107
|
+
stdscr.addstr(y+3+i, x+4, attr[:w-5])
|
|
108
|
+
|
|
109
|
+
return []
|
|
110
|
+
|
|
111
|
+
def left_split_graph(stdscr, x, y, w, h, state, row, cell, data: list = [], test: bool = False):
|
|
112
|
+
"""
|
|
113
|
+
Display a graph of the data in right pane.
|
|
114
|
+
|
|
115
|
+
data[0] = x_vals
|
|
116
|
+
data[1] = y_vals
|
|
117
|
+
data[2] = id
|
|
118
|
+
"""
|
|
119
|
+
if test: return True
|
|
120
|
+
|
|
121
|
+
# Title
|
|
122
|
+
title = "Graph"
|
|
123
|
+
if len(title) < w: title = f"{title:^{w}}"
|
|
124
|
+
stdscr.addstr(y, x,title[:w], curses.color_pair(state["colours_start"]+4) | curses.A_BOLD)
|
|
125
|
+
|
|
126
|
+
# Separator
|
|
127
|
+
for j in range(h):
|
|
128
|
+
stdscr.addstr(j+y, x+w-1, ' ', curses.color_pair(state["colours_start"]+16))
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
# Display pane count
|
|
132
|
+
pane_count = len(state["right_panes"])
|
|
133
|
+
pane_index = state["right_pane_index"]
|
|
134
|
+
if pane_count > 1:
|
|
135
|
+
s = f" {pane_index+1}/{pane_count} "
|
|
136
|
+
stdscr.addstr(y+h-1, x, s, curses.color_pair(state["colours_start"]+20))
|
|
137
|
+
|
|
138
|
+
try:
|
|
139
|
+
import plotille as plt
|
|
140
|
+
except:
|
|
141
|
+
s = f"No module named 'plotille'"
|
|
142
|
+
stdscr.addstr(y+2, x+1, s[:w-2])
|
|
143
|
+
return None
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
# x_vals, y_vals = list(range(100)), [x**2 for x in range(100)]
|
|
148
|
+
if data in [[], {}, None]:
|
|
149
|
+
return None
|
|
150
|
+
x_vals, y_vals = data[0], data[1]
|
|
151
|
+
graph_str = get_graph_string(x_vals, y_vals, width=w-3-10, height=h-3)
|
|
152
|
+
for i, s in enumerate(graph_str.split("\n")):
|
|
153
|
+
s = escape_ansi(s)
|
|
154
|
+
stdscr.addstr(y+2+i, x+1, s[:w-2])
|
|
155
|
+
|
|
156
|
+
return []
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def left_split_display_list(stdscr, x, y, w, h, state, row, cell, data: list = [], test: bool = False):
|
|
162
|
+
"""
|
|
163
|
+
data[0]:str = title
|
|
164
|
+
data[1]:list[str] = list of strings to display
|
|
165
|
+
"""
|
|
166
|
+
if test: return True
|
|
167
|
+
|
|
168
|
+
# Title
|
|
169
|
+
title = data[0]
|
|
170
|
+
if len(title) < w: title = f"{title:^{w}}"
|
|
171
|
+
stdscr.addstr(y, x,title[:w], curses.color_pair(state["colours_start"]+4) | curses.A_BOLD)
|
|
172
|
+
|
|
173
|
+
# Separator
|
|
174
|
+
for j in range(h):
|
|
175
|
+
stdscr.addstr(j+y, x+w-1, ' ', curses.color_pair(state["colours_start"]+16))
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
# Display pane count
|
|
179
|
+
pane_count = len(state["right_panes"])
|
|
180
|
+
pane_index = state["right_pane_index"]
|
|
181
|
+
if pane_count > 1:
|
|
182
|
+
s = f" {pane_index+1}/{pane_count} "
|
|
183
|
+
stdscr.addstr(y+h-1, x, s, curses.color_pair(state["colours_start"]+20))
|
|
184
|
+
|
|
185
|
+
if data in [[], {}, None]:
|
|
186
|
+
return None
|
|
187
|
+
|
|
188
|
+
items = data[1]
|
|
189
|
+
number_to_display = min(len(items), h-3)
|
|
190
|
+
for i in range(number_to_display):
|
|
191
|
+
s = items[i]
|
|
192
|
+
stdscr.addstr(y+1+i, x+2, s[:w-2])
|
|
193
|
+
|
|
194
|
+
if number_to_display < len(items):
|
|
195
|
+
stdscr.addstr(y+1+number_to_display, x+2, f" ... {len(items)-number_to_display} more"[:w-2])
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
return []
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
#!/bin/python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""
|
|
4
|
+
pane_functions.py
|
|
5
|
+
Functions which are run by a listpick Picker to display data in a pane.
|
|
6
|
+
|
|
7
|
+
Author: GrimAndGreedy
|
|
8
|
+
License: MIT
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
import curses
|
|
12
|
+
import os
|
|
13
|
+
from listpick.pane.pane_utils import get_file_attributes, get_graph_string, escape_ansi
|
|
14
|
+
from listpick.pane.get_data import update_file_attributes
|
|
15
|
+
|
|
16
|
+
def right_split_file_attributes(stdscr, x, y, w, h, state, row, cell, data: list = [], test: bool = False):
|
|
17
|
+
"""
|
|
18
|
+
Display file attributes in right pane.
|
|
19
|
+
"""
|
|
20
|
+
if test: return True
|
|
21
|
+
|
|
22
|
+
# Title
|
|
23
|
+
title = "File attributes"
|
|
24
|
+
if len(title) < w: title = f"{title:^{w}}"
|
|
25
|
+
stdscr.addstr(y, x,title[:w], curses.color_pair(state["colours_start"]+4) | curses.A_BOLD)
|
|
26
|
+
|
|
27
|
+
# Separator
|
|
28
|
+
for j in range(h):
|
|
29
|
+
stdscr.addstr(j+y, x, ' ', curses.color_pair(state["colours_start"]+16))
|
|
30
|
+
|
|
31
|
+
# Display pane count
|
|
32
|
+
pane_count = len(state["right_panes"])
|
|
33
|
+
pane_index = state["right_pane_index"]
|
|
34
|
+
if pane_count > 1:
|
|
35
|
+
s = f" {pane_index+1}/{pane_count} "
|
|
36
|
+
stdscr.addstr(y+h-1, x+w-len(s)-1, s, curses.color_pair(state["colours_start"]+20))
|
|
37
|
+
|
|
38
|
+
# Filename/cursor cell value
|
|
39
|
+
stdscr.addstr(y+2, x+2, cell[:w-3])
|
|
40
|
+
|
|
41
|
+
attributes = get_file_attributes(cell)
|
|
42
|
+
for i, attr in enumerate(attributes):
|
|
43
|
+
stdscr.addstr(y+3+i, x+4, attr[:w-5])
|
|
44
|
+
|
|
45
|
+
return []
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def right_split_file_attributes_dynamic(stdscr, x, y, w, h, state, row, cell, data: list = [], test: bool = False):
|
|
49
|
+
"""
|
|
50
|
+
Display file attributes in right pane.
|
|
51
|
+
"""
|
|
52
|
+
if test: return True
|
|
53
|
+
|
|
54
|
+
# Title
|
|
55
|
+
title = "File attributes"
|
|
56
|
+
if len(title) < w: title = f"{title:^{w}}"
|
|
57
|
+
stdscr.addstr(y, x,title[:w], curses.color_pair(state["colours_start"]+4) | curses.A_BOLD)
|
|
58
|
+
|
|
59
|
+
# Separator
|
|
60
|
+
for j in range(h):
|
|
61
|
+
stdscr.addstr(j+y, x, ' ', curses.color_pair(state["colours_start"]+16))
|
|
62
|
+
|
|
63
|
+
# Display pane count
|
|
64
|
+
pane_count = len(state["right_panes"])
|
|
65
|
+
pane_index = state["right_pane_index"]
|
|
66
|
+
if pane_count > 1:
|
|
67
|
+
s = f" {pane_index+1}/{pane_count} "
|
|
68
|
+
stdscr.addstr(y+h-1, x+w-len(s)-1, s, curses.color_pair(state["colours_start"]+20))
|
|
69
|
+
|
|
70
|
+
if len(state["indexed_items"]) == 0:
|
|
71
|
+
return []
|
|
72
|
+
|
|
73
|
+
# Filename/cursor cell value
|
|
74
|
+
stdscr.addstr(y+2, x+2, cell[:w-3])
|
|
75
|
+
|
|
76
|
+
# If the cursor-hovered file is different then reload the data
|
|
77
|
+
if data[1] != cell:
|
|
78
|
+
data[:] = update_file_attributes(data, state)
|
|
79
|
+
|
|
80
|
+
# attributes = get_file_attributes(cell)
|
|
81
|
+
if len(data) == 0: return []
|
|
82
|
+
attributes = data[0]
|
|
83
|
+
for i, attr in enumerate(attributes):
|
|
84
|
+
stdscr.addstr(y+3+i, x+4, attr[:w-5])
|
|
85
|
+
|
|
86
|
+
return []
|
|
87
|
+
|
|
88
|
+
def right_split_graph(stdscr, x, y, w, h, state, row, cell, data: list = [], test: bool = False):
|
|
89
|
+
"""
|
|
90
|
+
Display a graph of the data in right pane.
|
|
91
|
+
|
|
92
|
+
data[0] = x_vals
|
|
93
|
+
data[1] = y_vals
|
|
94
|
+
data[2] = id
|
|
95
|
+
"""
|
|
96
|
+
if test: return True
|
|
97
|
+
|
|
98
|
+
# Title
|
|
99
|
+
title = "Graph"
|
|
100
|
+
if len(title) < w: title = f"{title:^{w}}"
|
|
101
|
+
stdscr.addstr(y, x,title[:w], curses.color_pair(state["colours_start"]+4) | curses.A_BOLD)
|
|
102
|
+
|
|
103
|
+
# Separator
|
|
104
|
+
for j in range(h):
|
|
105
|
+
stdscr.addstr(j+y, x, ' ', curses.color_pair(state["colours_start"]+16))
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
# Display pane count
|
|
109
|
+
pane_count = len(state["right_panes"])
|
|
110
|
+
pane_index = state["right_pane_index"]
|
|
111
|
+
if pane_count > 1:
|
|
112
|
+
s = f" {pane_index+1}/{pane_count} "
|
|
113
|
+
stdscr.addstr(y+h-1, x+w-len(s)-1, s, curses.color_pair(state["colours_start"]+20))
|
|
114
|
+
|
|
115
|
+
try:
|
|
116
|
+
import plotille as plt
|
|
117
|
+
except:
|
|
118
|
+
s = f"No module named 'plotille'"
|
|
119
|
+
stdscr.addstr(y+2, x+2, s[:w-2])
|
|
120
|
+
return None
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
# x_vals, y_vals = list(range(100)), [x**2 for x in range(100)]
|
|
125
|
+
if data in [[], {}, None]:
|
|
126
|
+
return None
|
|
127
|
+
x_vals, y_vals = data[0], data[1]
|
|
128
|
+
graph_str = get_graph_string(x_vals, y_vals, width=w-3-10, height=h-3)
|
|
129
|
+
for i, s in enumerate(graph_str.split("\n")):
|
|
130
|
+
s = escape_ansi(s)
|
|
131
|
+
stdscr.addstr(y+2+i, x+2, s[:w-2])
|
|
132
|
+
|
|
133
|
+
return []
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def right_split_display_list(stdscr, x, y, w, h, state, row, cell, data: list = [], test: bool = False):
|
|
139
|
+
"""
|
|
140
|
+
data[0]:str = title
|
|
141
|
+
data[1]:list[str] = list of strings to display
|
|
142
|
+
"""
|
|
143
|
+
if test: return True
|
|
144
|
+
|
|
145
|
+
# Title
|
|
146
|
+
title = data[0]
|
|
147
|
+
if len(title) < w: title = f"{title:^{w}}"
|
|
148
|
+
stdscr.addstr(y, x,title[:w], curses.color_pair(state["colours_start"]+4) | curses.A_BOLD)
|
|
149
|
+
|
|
150
|
+
# Separator
|
|
151
|
+
for j in range(h):
|
|
152
|
+
stdscr.addstr(j+y, x, ' ', curses.color_pair(state["colours_start"]+16))
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
# Display pane count
|
|
156
|
+
pane_count = len(state["right_panes"])
|
|
157
|
+
pane_index = state["right_pane_index"]
|
|
158
|
+
if pane_count > 1:
|
|
159
|
+
s = f" {pane_index+1}/{pane_count} "
|
|
160
|
+
stdscr.addstr(y+h-1, x+w-len(s)-1, s, curses.color_pair(state["colours_start"]+20))
|
|
161
|
+
|
|
162
|
+
if data in [[], {}, None]:
|
|
163
|
+
return None
|
|
164
|
+
|
|
165
|
+
items = data[1]
|
|
166
|
+
number_to_display = min(len(items), h-3)
|
|
167
|
+
for i in range(number_to_display):
|
|
168
|
+
s = items[i]
|
|
169
|
+
stdscr.addstr(y+1+i, x+2, s[:w-2])
|
|
170
|
+
|
|
171
|
+
if number_to_display < len(items):
|
|
172
|
+
stdscr.addstr(y+1+number_to_display, x+2, f" ... {len(items)-number_to_display} more"[:w-2])
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
return []
|
listpick/ui/build_help.py
CHANGED
|
@@ -14,7 +14,7 @@ from listpick.utils import keycodes
|
|
|
14
14
|
|
|
15
15
|
logger = logging.getLogger('picker_log')
|
|
16
16
|
|
|
17
|
-
def build_help_rows(keys_dict: dict, debug: bool = False) -> list[list[str]]:
|
|
17
|
+
def build_help_rows(keys_dict: dict, macros: list, debug: bool = False) -> list[list[str]]:
|
|
18
18
|
""" Build help rows based on the keys_dict. """
|
|
19
19
|
|
|
20
20
|
logger.info(f"function: build_help_rows() (build_help.py)")
|
|
@@ -117,8 +117,9 @@ def build_help_rows(keys_dict: dict, debug: bool = False) -> list[list[str]]:
|
|
|
117
117
|
"col_select_next": "Select next column.",
|
|
118
118
|
"col_select_prev": "Select previous column.",
|
|
119
119
|
"col_hide": "Hide column.",
|
|
120
|
-
"edit": "Edit cell.",
|
|
121
|
-
"
|
|
120
|
+
"edit": "Edit (editable) cell.",
|
|
121
|
+
"edit_nvim": "Edit (editable) cell(s) in nvim.",
|
|
122
|
+
"edit_picker": "Edit (editable) cell from options dialogue.",
|
|
122
123
|
"edit_ipython": "Drop to ipython shell with environment as `self`",
|
|
123
124
|
"copy": "Copy selections.",
|
|
124
125
|
"paste": "Paste into picker.",
|
|
@@ -131,8 +132,8 @@ def build_help_rows(keys_dict: dict, debug: bool = False) -> list[list[str]]:
|
|
|
131
132
|
"undo": "Undo.",
|
|
132
133
|
"scroll_right": "Scroll right (5 chars).",
|
|
133
134
|
"scroll_left": "Scroll left (5 chars).",
|
|
134
|
-
"scroll_right_25":
|
|
135
|
-
"scroll_left_25":
|
|
135
|
+
"scroll_right_25": "Scroll right (25 chars).",
|
|
136
|
+
"scroll_left_25": "Scroll left (25 chars).",
|
|
136
137
|
"scroll_far_right": "Scroll to the end of the column set.",
|
|
137
138
|
"scroll_far_left": "Scroll to the left home.",
|
|
138
139
|
"add_column_before": "Insert column before cursor.",
|
|
@@ -145,14 +146,16 @@ def build_help_rows(keys_dict: dict, debug: bool = False) -> list[list[str]]:
|
|
|
145
146
|
"sheet_next": "Go to the next sheet.",
|
|
146
147
|
"sheet_prev": "Go to the previous sheet.",
|
|
147
148
|
"toggle_right_pane": "Toggle the right pane",
|
|
148
|
-
"cycle_right_pane": "Cycle through right
|
|
149
|
+
"cycle_right_pane": "Cycle through right pane views",
|
|
150
|
+
"toggle_left_pane": "Toggle the left pane",
|
|
151
|
+
"cycle_left_pane": "Cycle through left pane views",
|
|
149
152
|
}
|
|
150
153
|
sections = {
|
|
151
154
|
"Navigation:": [ "cursor_down", "cursor_up", "half_page_up", "half_page_down", "page_up", "page_down", "cursor_bottom", "cursor_top", "five_up", "five_down", "scroll_right", "scroll_left", "scroll_right_25", "scroll_left_25", "scroll_far_right", "scroll_far_left" ],
|
|
152
155
|
"Selection:": [ "toggle_select", "select_all", "select_none", "visual_selection_toggle", "visual_deselection_toggle", "enter" ],
|
|
153
|
-
"UI:": [ "toggle_footer", "redraw_screen", "decrease_lines_per_page", "increase_lines_per_page", "increase_column_width", "decrease_column_width", "notification_toggle", "toggle_right_pane", "cycle_right_pane"],
|
|
156
|
+
"UI:": [ "toggle_footer", "redraw_screen", "decrease_lines_per_page", "increase_lines_per_page", "increase_column_width", "decrease_column_width", "notification_toggle", "toggle_right_pane", "cycle_right_pane", "toggle_left_pane", "cycle_left_pane"],
|
|
154
157
|
"Sort:": [ "cycle_sort_method", "cycle_sort_method_reverse", "cycle_sort_order", ] ,
|
|
155
|
-
"Data manipulation:": [ "delete", "delete_column", "edit", "edit_picker", "edit_ipython", "add_column_before", "add_column_after", "add_row_before", "add_row_after"],
|
|
158
|
+
"Data manipulation:": [ "delete", "delete_column", "edit", "edit_nvim", "edit_picker", "edit_ipython", "add_column_before", "add_column_after", "add_row_before", "add_row_after"],
|
|
156
159
|
"Filter and search:": [ "filter_input", "search_input", "continue_search_forward", "continue_search_backward", ] ,
|
|
157
160
|
"Settings:": [ "settings_input", "settings_options" ],
|
|
158
161
|
"Options and modes:": [ "opts_input", "opts_select", "mode_next", "mode_prev", "pipe_input", "reset_opts", "col_select", "col_select_next", "col_select_prev", "col_hide" ],
|
|
@@ -170,6 +173,8 @@ def build_help_rows(keys_dict: dict, debug: bool = False) -> list[list[str]]:
|
|
|
170
173
|
if not found:
|
|
171
174
|
sections["Misc:"].append(key)
|
|
172
175
|
|
|
176
|
+
|
|
177
|
+
|
|
173
178
|
items = []
|
|
174
179
|
for section_name, section_operations in sections.items():
|
|
175
180
|
section_rows = []
|
|
@@ -205,6 +210,26 @@ def build_help_rows(keys_dict: dict, debug: bool = False) -> list[list[str]]:
|
|
|
205
210
|
items += section_rows
|
|
206
211
|
items.append(["",""])
|
|
207
212
|
|
|
213
|
+
if macros:
|
|
214
|
+
items.append([f" Macros:", ""])
|
|
215
|
+
for macro in macros:
|
|
216
|
+
keys = []
|
|
217
|
+
for key in macro["keys"]:
|
|
218
|
+
if key in special_keys:
|
|
219
|
+
keys.append(special_keys[key])
|
|
220
|
+
else:
|
|
221
|
+
try:
|
|
222
|
+
keys.append(chr(int(key)))
|
|
223
|
+
except Exception as e:
|
|
224
|
+
keys.append(f"keycode={key}")
|
|
225
|
+
if debug: print(f"Error chr({key}): {e}")
|
|
226
|
+
|
|
227
|
+
row = [f" {str(keys)[1:-1]}", macro["description"]]
|
|
228
|
+
items.append(row)
|
|
229
|
+
items.append(["",""])
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
208
233
|
if debug:
|
|
209
234
|
for operation in keys_dict:
|
|
210
235
|
if operation not in help_descriptions:
|
listpick/ui/input_field.py
CHANGED
|
@@ -193,7 +193,6 @@ def input_field(
|
|
|
193
193
|
match_word, left_ptr, right_ptr = get_partially_complete_word(usrtxt, cursor, [" ", "/", "="])
|
|
194
194
|
|
|
195
195
|
if match_word in completions:
|
|
196
|
-
# os.system(f"notify-send '{completions[0]}'")
|
|
197
196
|
index = completions.index(match_word)
|
|
198
197
|
if index == len(completions) - 1: index = -1
|
|
199
198
|
completions_disp_str = str(completions[index:])[:max_field_length]
|
listpick/ui/keys.py
CHANGED
|
@@ -51,8 +51,8 @@ picker_keys = {
|
|
|
51
51
|
"continue_search_forward": [ord('n')],
|
|
52
52
|
"continue_search_backward": [ord('N')],
|
|
53
53
|
"cancel": [27], # Escape key
|
|
54
|
-
"opts_input": [
|
|
55
|
-
"opts_select": [ord('
|
|
54
|
+
"opts_input": [keycodes.META_o],
|
|
55
|
+
# "opts_select": [ord('+')],
|
|
56
56
|
"mode_next": [9], # Tab key
|
|
57
57
|
"mode_prev": [353], # Shift+Tab key
|
|
58
58
|
"pipe_input": [ord('|')],
|
|
@@ -62,13 +62,14 @@ picker_keys = {
|
|
|
62
62
|
"col_select_prev": [ord('<')],
|
|
63
63
|
"col_hide": [ord('!'), ord('@'), ord('#'), ord('$'), ord('%'), ord('^'), ord('&'), ord('*'), ord('('), ord(')')],
|
|
64
64
|
"edit": [ord('e')],
|
|
65
|
-
"edit_picker": [ord('E')],
|
|
65
|
+
# "edit_picker": [ord('E')],
|
|
66
|
+
"edit_nvim": [ord('E')],
|
|
66
67
|
"edit_ipython": [5], # Ctrl+e
|
|
67
68
|
"copy": [ord('y')],
|
|
68
69
|
"paste": [ord('p')],
|
|
69
70
|
"save": [19, ord('D')], # Ctrl+s
|
|
70
71
|
"load": [15], # Ctrl+o
|
|
71
|
-
"open": [ord('O')],
|
|
72
|
+
# "open": [ord('O')],
|
|
72
73
|
"toggle_footer": [ord('_')],
|
|
73
74
|
"notification_toggle": [ord('z')],
|
|
74
75
|
"redo": [ord('.')],
|
|
@@ -90,6 +91,8 @@ picker_keys = {
|
|
|
90
91
|
# "sheet_prev": [],
|
|
91
92
|
"toggle_right_pane": [ord("'")],
|
|
92
93
|
"cycle_right_pane": [ord('"')],
|
|
94
|
+
"toggle_left_pane": [ord(";")],
|
|
95
|
+
"cycle_left_pane": [ord(':')],
|
|
93
96
|
}
|
|
94
97
|
|
|
95
98
|
|
|
@@ -235,8 +238,8 @@ edit_menu_keys = {
|
|
|
235
238
|
"continue_search_forward": [ord('n'), ord('i')],
|
|
236
239
|
"continue_search_backward": [ord('N'), ord('I')],
|
|
237
240
|
"cancel": [27], # Escape key
|
|
238
|
-
"opts_input": [
|
|
239
|
-
"opts_select": [ord('
|
|
241
|
+
"opts_input": [keycodes.META_o],
|
|
242
|
+
# "opts_select": [ord('+')],
|
|
240
243
|
"mode_next": [9], # Tab key
|
|
241
244
|
"mode_prev": [353], # Shift+Tab key
|
|
242
245
|
"pipe_input": [ord('|')],
|
|
@@ -246,11 +249,14 @@ edit_menu_keys = {
|
|
|
246
249
|
"col_select_prev": [ord('<'), ord('h')],
|
|
247
250
|
"col_hide": [ord('!'), ord('@'), ord('#'), ord('$'), ord('%'), ord('^'), ord('&'), ord('*'), ord('('), ord(')')],
|
|
248
251
|
"edit": [ord('e')],
|
|
249
|
-
"
|
|
252
|
+
"edit_nvim": [ord('E')],
|
|
250
253
|
"edit_ipython": [5], # Ctrl+e
|
|
251
254
|
"copy": [ord('y')],
|
|
252
255
|
"save": [19, ord('D')], # Ctrl+s
|
|
253
256
|
"load": [ord('L'), 15], # Ctrl+o
|
|
254
|
-
"open": [ord('O')],
|
|
257
|
+
# "open": [ord('O')],
|
|
255
258
|
"toggle_footer": [ord('_')],
|
|
259
|
+
"visual_selection_toggle": [ord('v')],
|
|
260
|
+
"visual_deselection_toggle": [ord('V')],
|
|
261
|
+
"toggle_select": [ord(' ')],
|
|
256
262
|
}
|
listpick/ui/picker_colours.py
CHANGED
|
@@ -294,6 +294,61 @@ def get_colours(pick:int=0) -> Dict[str, int]:
|
|
|
294
294
|
'active_column_bg': curses.COLOR_BLACK,
|
|
295
295
|
'active_column_fg': curses.COLOR_WHITE,
|
|
296
296
|
},
|
|
297
|
+
### (6) Use default colors for bg
|
|
298
|
+
# {
|
|
299
|
+
# 'background': -1,
|
|
300
|
+
# 'normal_fg': -1,
|
|
301
|
+
# 'unselected_bg': -1,
|
|
302
|
+
# 'unselected_fg': -1,
|
|
303
|
+
# 'cursor_bg': 21,
|
|
304
|
+
# 'cursor_fg': -1,
|
|
305
|
+
# 'selected_bg': 54,
|
|
306
|
+
# 'selected_fg': -1,
|
|
307
|
+
# 'header_bg': 255,
|
|
308
|
+
# 'header_fg': 232,
|
|
309
|
+
# 'error_bg': 232,
|
|
310
|
+
# 'error_fg': curses.COLOR_RED,
|
|
311
|
+
# 'complete_bg': 232,
|
|
312
|
+
# 'complete_fg': 82,
|
|
313
|
+
# 'waiting_bg': 232,
|
|
314
|
+
# 'waiting_fg': curses.COLOR_YELLOW,
|
|
315
|
+
# 'active_bg': 232,
|
|
316
|
+
# 'active_fg': 33,
|
|
317
|
+
# 'paused_bg': -1,
|
|
318
|
+
# 'paused_fg': 244,
|
|
319
|
+
# 'search_bg': 162,
|
|
320
|
+
# 'search_fg': -1,
|
|
321
|
+
# 'active_input_bg': -1,
|
|
322
|
+
# 'active_input_fg': 232,
|
|
323
|
+
# 'modes_selected_bg': 232,
|
|
324
|
+
# 'modes_selected_fg': -1,
|
|
325
|
+
# 'modes_unselected_bg': 255,
|
|
326
|
+
# 'modes_unselected_fg': 232,
|
|
327
|
+
# 'title_bar': 232,
|
|
328
|
+
# 'title_bg': 232,
|
|
329
|
+
# 'title_fg': -1,
|
|
330
|
+
# 'scroll_bar_bg': 247,
|
|
331
|
+
# 'selected_header_column_bg': 232,
|
|
332
|
+
# 'selected_header_column_fg': -1,
|
|
333
|
+
# 'unselected_header_column_bg': -1,
|
|
334
|
+
# 'unselected_header_column_fg': -1,
|
|
335
|
+
# 'footer_bg': 232,
|
|
336
|
+
# 'footer_fg': -1,
|
|
337
|
+
# 'refreshing_bg': 232,
|
|
338
|
+
# 'refreshing_fg': -1,
|
|
339
|
+
# 'refreshing_inactive_bg': 232,
|
|
340
|
+
# 'refreshing_inactive_fg': 232,
|
|
341
|
+
# '40pc_bg': 232,
|
|
342
|
+
# '40pc_fg': 166,
|
|
343
|
+
# 'footer_string_bg': 232,
|
|
344
|
+
# 'footer_string_fg': -1,
|
|
345
|
+
# 'selected_cell_bg': 54,
|
|
346
|
+
# 'selected_cell_fg': -1,
|
|
347
|
+
# 'deselecting_cell_bg': 162,
|
|
348
|
+
# 'deselecting_cell_fg': -1,
|
|
349
|
+
# 'active_column_bg': 234,
|
|
350
|
+
# 'active_column_fg': -1,
|
|
351
|
+
# },
|
|
297
352
|
]
|
|
298
353
|
for colour in colours:
|
|
299
354
|
colour["20pc_bg"] = colour["background"]
|