unisi 0.3.2__py3-none-any.whl → 0.3.3__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.
- unisi/containers.py +6 -7
- unisi/server.py +2 -2
- unisi/users.py +1 -1
- unisi/voicecom.py +28 -30
- {unisi-0.3.2.dist-info → unisi-0.3.3.dist-info}/METADATA +1 -1
- {unisi-0.3.2.dist-info → unisi-0.3.3.dist-info}/RECORD +9 -9
- {unisi-0.3.2.dist-info → unisi-0.3.3.dist-info}/WHEEL +0 -0
- {unisi-0.3.2.dist-info → unisi-0.3.3.dist-info}/entry_points.txt +0 -0
- {unisi-0.3.2.dist-info → unisi-0.3.3.dist-info}/licenses/LICENSE +0 -0
unisi/containers.py
CHANGED
@@ -86,18 +86,15 @@ class Block(Unit):
|
|
86
86
|
return e
|
87
87
|
|
88
88
|
class ParamBlock(Block):
|
89
|
-
def __init__(self, name, *args, row = 3, **params):
|
90
|
-
""" does not need reactivity so Block init is not used"""
|
89
|
+
def __init__(self, name, *args, row = 3, **params):
|
91
90
|
self._mark_changed = None
|
92
91
|
if not args:
|
93
|
-
args = [[]]
|
94
|
-
self._mark_changed = None
|
92
|
+
args = [[]]
|
95
93
|
self.name = name
|
96
94
|
self.type = 'block'
|
97
95
|
self.value = list(args)
|
98
96
|
self.name2elem = {}
|
99
97
|
cnt = 0
|
100
|
-
|
101
98
|
for param, val in params.items():
|
102
99
|
pretty_name = pretty4(param)
|
103
100
|
match val:
|
@@ -120,13 +117,15 @@ class ParamBlock(Block):
|
|
120
117
|
case _:
|
121
118
|
raise ValueError(f'The {param} value {val} is not supported. Look at ParamBlock documentation!')
|
122
119
|
|
123
|
-
self.name2elem[param] = el
|
124
|
-
|
120
|
+
self.name2elem[param] = el
|
125
121
|
if cnt % row == 0:
|
126
122
|
block = []
|
127
123
|
self.value.append(block)
|
128
124
|
cnt += 1
|
129
125
|
block.append(el)
|
126
|
+
|
127
|
+
self.set_reactivity(Unishare.context_user())
|
128
|
+
|
130
129
|
@property
|
131
130
|
def params(self):
|
132
131
|
return {name: el.value for name, el in self.name2elem.items()}
|
unisi/server.py
CHANGED
@@ -56,9 +56,9 @@ def make_user(request):
|
|
56
56
|
return user, ok
|
57
57
|
|
58
58
|
def handle(unit, event):
|
59
|
+
handler_map = User.last_user.handlers
|
59
60
|
def h(fn):
|
60
|
-
key = unit, event
|
61
|
-
handler_map = User.last_user.handlers
|
61
|
+
key = unit, event
|
62
62
|
func = handler_map.get(key, None)
|
63
63
|
if func:
|
64
64
|
handler_map[key] = compose_handlers(func, fn)
|
unisi/users.py
CHANGED
unisi/voicecom.py
CHANGED
@@ -40,6 +40,7 @@ command_synonyms = dict( #-> words
|
|
40
40
|
)
|
41
41
|
|
42
42
|
root_commands = ['select', 'screen', 'stop', 'reset', 'ok']
|
43
|
+
ext_root_commands = root_commands[:]
|
43
44
|
|
44
45
|
modes = dict( #-> actions
|
45
46
|
text = ['text', 'left', 'right', 'up', 'down','backspace','delete', 'space', 'tab', 'enter', 'undo','clean'],
|
@@ -52,10 +53,13 @@ word2command = {}
|
|
52
53
|
for command, syns in command_synonyms.items():
|
53
54
|
for syn in syns:
|
54
55
|
word2command[syn] = command
|
56
|
+
if command in root_commands:
|
57
|
+
ext_root_commands.extend(syns)
|
55
58
|
|
56
59
|
word2command.update({command: command for command in root_commands})
|
57
60
|
for mode, commands in modes.items():
|
58
61
|
word2command.update({c:c for c in commands})
|
62
|
+
|
59
63
|
|
60
64
|
class VoiceCom:
|
61
65
|
standart_message = "Element or command?"
|
@@ -78,7 +82,7 @@ class VoiceCom:
|
|
78
82
|
self.input,
|
79
83
|
self.context_list,
|
80
84
|
self.command_list,
|
81
|
-
closable = True,
|
85
|
+
closable = True, icon = 'mic'
|
82
86
|
)
|
83
87
|
def set_screen(self, screen):
|
84
88
|
self.calc_interactive_units()
|
@@ -92,12 +96,8 @@ class VoiceCom:
|
|
92
96
|
return self.user.set_screen(value)
|
93
97
|
self.activate_unit(self.name2unit.get(value, None))
|
94
98
|
|
95
|
-
def select_command(self,
|
96
|
-
|
97
|
-
self.run_command(command)
|
98
|
-
self.input.value = value
|
99
|
-
self.message.value = command if command else ''
|
100
|
-
self.command_list.value = None
|
99
|
+
def select_command(self, _, value):
|
100
|
+
self.process_word(value)
|
101
101
|
|
102
102
|
@property
|
103
103
|
def context_options(self):
|
@@ -137,17 +137,19 @@ class VoiceCom:
|
|
137
137
|
self.unit_names = interactive_names
|
138
138
|
self.name2unit = name2unit
|
139
139
|
|
140
|
-
def
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
commands
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
140
|
+
def set_mode(self, mode):
|
141
|
+
self.context = None
|
142
|
+
self.mode = mode
|
143
|
+
self.buffer = []
|
144
|
+
if not (commands := self.cached_commands.get(mode, None)):
|
145
|
+
syn_commands = []
|
146
|
+
commands = modes.get(mode, []) + root_commands
|
147
|
+
for command in commands:
|
148
|
+
if command in command_synonyms:
|
149
|
+
syn_commands.extend(command_synonyms[command])
|
150
|
+
commands.extend(syn_commands)
|
151
|
+
commands.sort()
|
152
|
+
self.cached_commands[mode] = commands
|
151
153
|
self.commands = commands
|
152
154
|
|
153
155
|
def activate_unit(self, unit: Unit | None):
|
@@ -159,19 +161,18 @@ class VoiceCom:
|
|
159
161
|
if unit:
|
160
162
|
match unit.type:
|
161
163
|
case 'string':
|
162
|
-
|
164
|
+
mode = 'text'
|
163
165
|
case 'range':
|
164
|
-
|
166
|
+
mode = 'number'
|
165
167
|
case _:
|
166
|
-
|
168
|
+
mode = unit.type
|
167
169
|
unit.active = True
|
168
|
-
unit.focus = True
|
169
|
-
self.
|
170
|
-
self.commands4mode(self.mode)
|
170
|
+
unit.focus = True
|
171
|
+
self.set_mode(mode)
|
171
172
|
if unit.type == 'text' or unit.type == 'number':
|
172
173
|
self.previous_unit_value_x = unit.value, unit.x
|
173
174
|
else:
|
174
|
-
self.commands =
|
175
|
+
self.commands = ext_root_commands
|
175
176
|
|
176
177
|
def start(self):
|
177
178
|
if self.screen.blocks[-1] != self.block:
|
@@ -256,10 +257,7 @@ class VoiceCom:
|
|
256
257
|
case 'screen':
|
257
258
|
self.context_options = [getattr(s, 'name')for s in self.user.screens
|
258
259
|
if hasattr(s, 'name') and s.name != self.user.screen.name]
|
259
|
-
self.
|
260
|
-
self.context = None
|
261
|
-
self.mode = command
|
262
|
-
self.buffer = []
|
260
|
+
self.set_mode('screen')
|
263
261
|
self.message.value = 'Select a screen'
|
264
262
|
case 'reset':
|
265
263
|
self.reset()
|
@@ -280,7 +278,7 @@ class VoiceCom:
|
|
280
278
|
self.input.value = VoiceCom.standart_message
|
281
279
|
self.message.value = 'Select an element'
|
282
280
|
self.context_list.value = None
|
283
|
-
self.commands =
|
281
|
+
self.commands = ext_root_commands
|
284
282
|
self.context = None
|
285
283
|
self.context_options = self.unit_names
|
286
284
|
|
@@ -1,11 +1,11 @@
|
|
1
|
-
unisi-0.3.
|
2
|
-
unisi-0.3.
|
3
|
-
unisi-0.3.
|
4
|
-
unisi-0.3.
|
1
|
+
unisi-0.3.3.dist-info/METADATA,sha256=tir_jhPK-78JKakvC9caHB0HHXYZBhoYg1ANps10N4I,26062
|
2
|
+
unisi-0.3.3.dist-info/WHEEL,sha256=pM0IBB6ZwH3nkEPhtcp50KvKNX-07jYtnb1g1m6Z4Co,90
|
3
|
+
unisi-0.3.3.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
|
4
|
+
unisi-0.3.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
5
5
|
unisi/__init__.py,sha256=JVioDSebhtmoYTldT6ChEayuRTHOgYsAflcxcBYWBTY,279
|
6
6
|
unisi/autotest.py,sha256=qYKwSPEPUEio6koUSu1tc71pDkX-doCQJlyRppaXCtY,8709
|
7
7
|
unisi/common.py,sha256=gaMz7PpFqz-JpiQnc9sx3HgS4UWnVzv_Xf8XAKve8q8,5386
|
8
|
-
unisi/containers.py,sha256
|
8
|
+
unisi/containers.py,sha256=-cCWHoMulCk7MM1H-NSfo0jB1pp1E2MJMnY6rgR-Pt0,6415
|
9
9
|
unisi/dbunits.py,sha256=G__LLHS-WqdYB4KOOfIYGfcK_SgRWD6LbMj6wqVCyxw,7423
|
10
10
|
unisi/graphs.py,sha256=DTyLUPzi9ErKY6ADXVMXf9-uJskNISZY_xDvsnhMs1Q,6959
|
11
11
|
unisi/jsoncomparison/__init__.py,sha256=lsWkYEuL6v3Qol-lwSUvB6y63tm6AKcCMUd4DZDx3Cg,350
|
@@ -18,12 +18,12 @@ unisi/llmrag.py,sha256=Wh9pQ8kBMlersKxbEDlZ3XeY2grH0_Rfg8I3E2W87hI,3481
|
|
18
18
|
unisi/multimon.py,sha256=YKwCuvMsMfdgOGkJoqiqh_9wywXMeo9bUhHmbAIUeSE,4060
|
19
19
|
unisi/proxy.py,sha256=QMHSSFJtmVZIexIMAsuFNlF5JpnYNG90rkTM3PYJhY4,7750
|
20
20
|
unisi/reloader.py,sha256=5zWglaaU1zcXXNrSeyJMZW47fiHnjxbJ-CbDGREPyNk,6638
|
21
|
-
unisi/server.py,sha256=
|
21
|
+
unisi/server.py,sha256=kiXTMiny5Ta3Z4mVVJ9iV-P5q64fhc1SZAVo3qrw5t8,6144
|
22
22
|
unisi/tables.py,sha256=yF6Y2dczZoSD3fo7K14pyo3vP6A0U8dt-u4xY0SS8HU,13848
|
23
23
|
unisi/units.py,sha256=rhZJtbZhje5C0Kc4sS1juMehcg5orOmQYpEe8KOVpzY,11004
|
24
|
-
unisi/users.py,sha256=
|
24
|
+
unisi/users.py,sha256=g0JMR4dxQEQizQlzIXhf974L-MY965SnwkPYP_Dmzn0,16047
|
25
25
|
unisi/utils.py,sha256=NHoRMItaMleHg2UEp96_zzvrtGaZHcLNUZqmKkEwiHQ,2474
|
26
|
-
unisi/voicecom.py,sha256=
|
26
|
+
unisi/voicecom.py,sha256=mlGwk01VhkoRyZLhp_C1DAG2DyydqcSeX2IYB69sKwQ,13720
|
27
27
|
unisi/web/css/364.9c989936.css,sha256=nvhfMM7I0j4Xyec9QWuXjiwY_rw8IZzxC1M0bzBwEak,3264
|
28
28
|
unisi/web/css/app.31d6cfe0.css,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
29
29
|
unisi/web/css/vendor.f7e3cefe.css,sha256=0cbvPPBV-_jv7jBIC9glq8c1QgCowWt_TxoBalHGdAs,220668
|
@@ -46,4 +46,4 @@ unisi/web/js/609.35dc13d3.js,sha256=v3eqMeVE666_qkm_FGKzKkZWvg8WlVjRVYJCjTqTUFE,
|
|
46
46
|
unisi/web/js/935.cc0c012c.js,sha256=FzVIRBr4vyQgW38ROCoh929gtzuXqM73Cf77vejfDWk,6561
|
47
47
|
unisi/web/js/app.99853ae7.js,sha256=DUtNxnatRpjh2Utx8Y-d81mVQYQFOcLnX6M3GdQbg8o,6150
|
48
48
|
unisi/web/js/vendor.1bb14e9d.js,sha256=7q80jaZcms7UhWSqHAk2pXSx67cYQJGlsp-6DBXBZuU,1253597
|
49
|
-
unisi-0.3.
|
49
|
+
unisi-0.3.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|