znote 1.0.0__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.
- znote/__init__.py +1 -0
- znote/app/display.py +93 -0
- znote/app/input.py +46 -0
- znote/client.py +568 -0
- znote/core/auth.py +71 -0
- znote/core/client/connect.py +52 -0
- znote/core/client/settings.py +142 -0
- znote/core/client/token.py +17 -0
- znote/core/config.py +73 -0
- znote/core/editor.py +132 -0
- znote/core/gen.py +21 -0
- znote/core/pack.py +72 -0
- znote/core/server/note.py +20 -0
- znote/core/server/settings.py +148 -0
- znote/core/workspace.py +67 -0
- znote/main.py +2 -0
- znote/model/models.py +25 -0
- znote/server.py +734 -0
- znote-1.0.0.dist-info/METADATA +143 -0
- znote-1.0.0.dist-info/RECORD +24 -0
- znote-1.0.0.dist-info/WHEEL +5 -0
- znote-1.0.0.dist-info/entry_points.txt +3 -0
- znote-1.0.0.dist-info/licenses/LICENSE +21 -0
- znote-1.0.0.dist-info/top_level.txt +1 -0
znote/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .main import *
|
znote/app/display.py
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import impmagic
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
color_config = {'cyan': 'cyan', 'green': 'green', 'dark_gray': 'dark_gray', 'light_gray': 'light_gray', 'yellow': 'yellow', 'red': 'red', 'light_red': 'light_red', 'orange_1': 'orange_1', 'magenta': 'magenta'}
|
|
5
|
+
#SETTINGS TRUECOLOR
|
|
6
|
+
#color_config = {'cyan': '26,128,162', 'green': 'green', 'dark_gray': 'dark_gray', 'light_gray': 'light_gray', 'yellow': 'light_goldenrod_2b', 'red': 'red', 'light_red': 'light_red', 'orange_1': 'red', 'magenta': 'magenta'}
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@impmagic.loader(
|
|
10
|
+
{'module': 'zpp_color', 'submodule': ['fg', 'attr']}
|
|
11
|
+
)
|
|
12
|
+
def print_nxs(message, color=None, nojump=False):
|
|
13
|
+
if color==None:
|
|
14
|
+
color = color_config['cyan']
|
|
15
|
+
|
|
16
|
+
if nojump:
|
|
17
|
+
print(f"{fg(color)}{message}{attr(0)}", end="")
|
|
18
|
+
else:
|
|
19
|
+
print(f"{fg(color)}{message}{attr(0)}")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@impmagic.loader(
|
|
23
|
+
{'module': '__main__'},
|
|
24
|
+
{'module': 'zpp_color', 'submodule': ['fg', 'attr']},
|
|
25
|
+
{'module': 'datetime', 'submodule': ['datetime']}
|
|
26
|
+
)
|
|
27
|
+
def logs(message, lvl='info', component="core", nodate=False):
|
|
28
|
+
if __main__.settings.verbose:
|
|
29
|
+
if lvl=='logs':
|
|
30
|
+
color = color_config['light_gray']
|
|
31
|
+
elif lvl=='info':
|
|
32
|
+
color = color_config['cyan']
|
|
33
|
+
elif lvl=='warning':
|
|
34
|
+
color = color_config['yellow']
|
|
35
|
+
elif lvl=='error':
|
|
36
|
+
color = color_config['red']
|
|
37
|
+
elif lvl=='critical':
|
|
38
|
+
color = color_config['light_red']
|
|
39
|
+
elif lvl=='success':
|
|
40
|
+
color = color_config['green']
|
|
41
|
+
|
|
42
|
+
print_date = ""
|
|
43
|
+
if not nodate:
|
|
44
|
+
date = datetime.now().strftime("%Y/%m/%d - %H:%M:%S.%f")
|
|
45
|
+
print_date = f"{fg(color_config['dark_gray'])}[{attr(0)}{fg(color_config['magenta'])}{date}{attr(0)}{fg(color_config['dark_gray'])}] - {attr(0)}"
|
|
46
|
+
|
|
47
|
+
print_component = f"{fg(color_config['dark_gray'])}[{attr(0)}{fg(color_config['yellow'])}{component.upper()}{attr(0)}{fg(color_config['dark_gray'])}] - {attr(0)}"
|
|
48
|
+
|
|
49
|
+
print(f"{print_date}{print_component}{fg(color)}{message}{attr(0)}")
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@impmagic.loader(
|
|
53
|
+
{'module': 'zpp_color', 'submodule': ['fg', 'attr']},
|
|
54
|
+
{'module': 'datetime', 'submodule': ['datetime']}
|
|
55
|
+
)
|
|
56
|
+
def notify(message, lvl='info'):
|
|
57
|
+
if lvl=='logs':
|
|
58
|
+
color = color_config['light_gray']
|
|
59
|
+
elif lvl=='info':
|
|
60
|
+
color = color_config['cyan']
|
|
61
|
+
elif lvl=='warning':
|
|
62
|
+
color = color_config['yellow']
|
|
63
|
+
elif lvl=='error':
|
|
64
|
+
color = color_config['red']
|
|
65
|
+
elif lvl=='critical':
|
|
66
|
+
color = color_config['light_red']
|
|
67
|
+
elif lvl=='success':
|
|
68
|
+
color = color_config['green']
|
|
69
|
+
|
|
70
|
+
print(f"{fg(color)}{message}{attr(0)}")
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def SaveCursor():
|
|
74
|
+
sys.stdout.write("\033[s")
|
|
75
|
+
sys.stdout.flush()
|
|
76
|
+
|
|
77
|
+
def RestoreCursor():
|
|
78
|
+
sys.stdout.write("\033[u")
|
|
79
|
+
sys.stdout.flush()
|
|
80
|
+
|
|
81
|
+
def SaveScreen():
|
|
82
|
+
SaveCursor()
|
|
83
|
+
sys.stdout.write("\033[?47h")
|
|
84
|
+
sys.stdout.flush()
|
|
85
|
+
|
|
86
|
+
def RestoreScreen():
|
|
87
|
+
sys.stdout.write("\033[?47l")
|
|
88
|
+
sys.stdout.flush()
|
|
89
|
+
RestoreCursor()
|
|
90
|
+
|
|
91
|
+
def CleanScreen():
|
|
92
|
+
sys.stdout.write("\033[2J") # Effacer l'écran
|
|
93
|
+
sys.stdout.flush()
|
znote/app/input.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
if sys.platform == 'win32':
|
|
3
|
+
from msvcrt import getch
|
|
4
|
+
|
|
5
|
+
else: # macOS and Linux
|
|
6
|
+
import tty, termios
|
|
7
|
+
def getch():
|
|
8
|
+
fd = sys.stdin.fileno()
|
|
9
|
+
old_settings = termios.tcgetattr(fd)
|
|
10
|
+
try:
|
|
11
|
+
tty.setraw(sys.stdin.fileno())
|
|
12
|
+
ch = sys.stdin.read(1)
|
|
13
|
+
finally:
|
|
14
|
+
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
|
|
15
|
+
return ch
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def getpass(prompt='Password: ', mask='*'):
|
|
19
|
+
if not isinstance(prompt, str):
|
|
20
|
+
raise TypeError('prompt argument must be a str, not %s' % (type(prompt).__name__))
|
|
21
|
+
if not isinstance(mask, str):
|
|
22
|
+
raise TypeError('mask argument must be a zero- or one-character str, not %s' % (type(prompt).__name__))
|
|
23
|
+
if len(mask) > 1:
|
|
24
|
+
raise ValueError('mask argument must be a zero- or one-character str')
|
|
25
|
+
|
|
26
|
+
enteredPassword = []
|
|
27
|
+
sys.stdout.write(prompt)
|
|
28
|
+
sys.stdout.flush()
|
|
29
|
+
while True:
|
|
30
|
+
key = ord(getch())
|
|
31
|
+
if key == 13: # Enter key pressed.
|
|
32
|
+
sys.stdout.write('\n')
|
|
33
|
+
return ''.join(enteredPassword)
|
|
34
|
+
elif key in (8, 127): # Backspace/Del key erases previous output.
|
|
35
|
+
if len(enteredPassword) > 0:
|
|
36
|
+
sys.stdout.write('\b \b')
|
|
37
|
+
sys.stdout.flush()
|
|
38
|
+
enteredPassword = enteredPassword[:-1]
|
|
39
|
+
elif 0 <= key <= 31:
|
|
40
|
+
#For non printable character
|
|
41
|
+
pass
|
|
42
|
+
else:
|
|
43
|
+
char = chr(key)
|
|
44
|
+
sys.stdout.write(mask)
|
|
45
|
+
sys.stdout.flush()
|
|
46
|
+
enteredPassword.append(char)
|