Skip to content

Commit c8713c3

Browse files
committed
Auto upload
1 parent 4848045 commit c8713c3

File tree

4 files changed

+36
-29
lines changed

4 files changed

+36
-29
lines changed

interactive.py interactive/__init__.py

+22-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@
88
# def print(*args, flush = False, **kw):
99
# print_3(*args, **kw)
1010
#===============================================================================
11-
__all__ = ['listen', 'strCommonStart']
11+
__all__ = ['listen', 'strCommonStart', 'AbortionError', 'cls', 'askForFile', 'askSaveWhere']
1212
from time import sleep
13+
from .console_explorer import *
14+
from .cls import cls
15+
1316
FPS = 30
1417

1518
try:
@@ -92,6 +95,21 @@ def strCommonStart(list_strs, known_len = 0):
9295
break
9396
return list_strs[0][:i + 1]
9497

95-
if __name__=='__main__':
96-
from console import console
97-
console(globals())
98+
def chooseFromEntries(matches):
99+
if len(matches)==1:
100+
return matches[0]
101+
elif matches==[]:
102+
print("No match. ")
103+
return None
104+
else:
105+
print("Multiple matches: ")
106+
no=0
107+
for i in matches:
108+
print(no,": ",i.name)
109+
no+=1
110+
print("Type entry ID to select. Enter to abort search. ")
111+
try:
112+
return matches[int(input("Entry ID: "))]
113+
except:
114+
print("Search aborted. ")
115+
return None

interactive/__main__.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from . import *
2+
import interactive
3+
from console import console
4+
print(interactive.__all__)
5+
console(globals())

interactive/cls.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import os
2+
import platform
3+
4+
def cls():
5+
if platform.system() == 'Windows':
6+
os.system('cls')
7+
else:
8+
os.system('clear')

console_explorer.py interactive/console_explorer.py

+1-25
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from os import path
55
import os
66
import platform
7+
from .cls import cls
78

89
class AbortionError:
910
pass
@@ -40,12 +41,6 @@ def up(self):
4041
def down(self):
4142
self.selected = (self.selected + 1) % len(self.list)
4243

43-
def cls():
44-
if platform.system() == 'Windows':
45-
os.system('cls')
46-
else:
47-
os.system('clear')
48-
4944
def askForFile(cd = None):
5045
if cd is None:
5146
if platform.system() == 'Linux':
@@ -169,25 +164,6 @@ def askSaveWhere(cd = None, initialfile = None):
169164
except:
170165
print('No such command. ')
171166

172-
def chooseFromEntries(matches):
173-
if len(matches)==1:
174-
return matches[0]
175-
elif matches==[]:
176-
print("No match. ")
177-
return None
178-
else:
179-
print("Multiple matches: ")
180-
no=0
181-
for i in matches:
182-
print(no,": ",i.name)
183-
no+=1
184-
print("Type entry ID to select. Enter to abort search. ")
185-
try:
186-
return matches[int(input("Entry ID: "))]
187-
except:
188-
print("Search aborted. ")
189-
return None
190-
191167
def printTrack(track):
192168
form = str(len(str(len(track.list))))
193169
for i, item in enumerate(track.list):

0 commit comments

Comments
 (0)