Compare commits
No commits in common. "af98c125df9d94f610fbc33d541883d671367873" and "f17dee09e87e8ce455dbe01485a0cbd7df9b6035" have entirely different histories.
af98c125df
...
f17dee09e8
25
Menu.py
25
Menu.py
@ -30,7 +30,6 @@ class Menu():
|
||||
if (self.options[self.cursor_pos] == None
|
||||
or self.options[self.cursor_pos] == ""):
|
||||
self._up()
|
||||
self.cursor_pos_x = 0;
|
||||
|
||||
def _down(self):
|
||||
if (self.circular == False):
|
||||
@ -42,15 +41,6 @@ class Menu():
|
||||
if (self.options[self.cursor_pos] == None
|
||||
or self.options[self.cursor_pos] == ""):
|
||||
self._down()
|
||||
self.cursor_pos_x = 0;
|
||||
|
||||
def _left(self):
|
||||
if (self.cursor_pos_x > 0):
|
||||
self.cursor_pos_x = self.cursor_pos_x - 1;
|
||||
|
||||
def _right(self):
|
||||
self.cursor_pos_x = self.cursor_pos_x + 1;
|
||||
|
||||
|
||||
def show(self):
|
||||
while (True):
|
||||
@ -60,10 +50,6 @@ class Menu():
|
||||
self._up()
|
||||
elif (key == "down"):
|
||||
self._down()
|
||||
if (key == "left"):
|
||||
self._left()
|
||||
elif (key == "right"):
|
||||
self._right()
|
||||
elif (key == "enter"):
|
||||
return (self.cursor_pos)
|
||||
|
||||
@ -85,16 +71,11 @@ class Menu():
|
||||
for i, option in enumerate(self.options[min_y:max_y]):
|
||||
element = option
|
||||
if (i == display_pos):
|
||||
min_x, max_x, display_pos_x = utils.render(self.cursor_pos_x,
|
||||
0,
|
||||
len(element),
|
||||
len(element) // 2,
|
||||
option)
|
||||
line = self.cursor + element[min_x:max_x]
|
||||
line = self.cursor + element
|
||||
else:
|
||||
line = " " * len(self.cursor) + element
|
||||
print(line)
|
||||
print(preview)
|
||||
self._preview()
|
||||
|
||||
def _preview(self):
|
||||
if (len(self.preview_args) < self.cursor_pos):
|
||||
@ -162,7 +143,7 @@ class Menu():
|
||||
return 'space'
|
||||
|
||||
def preview(lst):
|
||||
return ("je suis la")
|
||||
return ("\n".join(lst))
|
||||
|
||||
menu = Menu("fdddddddddddddddddddddddddddddddddddddddddddddddddddddddda", preview_body_function=preview);
|
||||
menu.show()
|
||||
|
Loading…
Reference in New Issue
Block a user