unisi 0.3.32__py3-none-any.whl → 0.4.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.
unisi/containers.py CHANGED
@@ -53,7 +53,12 @@ class Block(Unit):
53
53
  def close(*_):
54
54
  user = self._user if self._user else Unishare.context_user()
55
55
  delete_unit(user.screen.blocks, self.name)
56
- self.close = close
56
+ self.close = close
57
+
58
+ def __setattr__(self, name, value):
59
+ super().__setattr__(name, value)
60
+ if name == 'value' and getattr(self, '_user', None):
61
+ self.set_reactivity(self._user)
57
62
 
58
63
  def set_reactivity(self, user, override = False):
59
64
  self._user = user
unisi/units.py CHANGED
@@ -89,9 +89,9 @@ class Unit:
89
89
  return not property or not property.startswith('_')
90
90
 
91
91
  def set_reactivity(self, user, override = False):
92
- changed_call = None
92
+ changed_call = self._mark_changed
93
93
 
94
- if not hasattr(self, 'id') and (override or not self._mark_changed):
94
+ if not hasattr(self, 'id') and (override or not changed_call):
95
95
  self.__dict__.update({property : ChangedProxy(value, self) for property, value in self.__dict__.items()
96
96
  if property[0] != '_' and not isinstance(value, atomics) and not callable(value)})
97
97
 
@@ -108,7 +108,7 @@ class Unit:
108
108
  #it is correct condition order
109
109
  if name[0] != "_" and self._mark_changed:
110
110
  self._mark_changed(name, value)
111
- super().__setattr__(name, value)
111
+ super().__setattr__(name, value)
112
112
 
113
113
  def mutate(self, obj):
114
114
  if self is not obj:
unisi/users.py CHANGED
@@ -41,6 +41,15 @@ class User:
41
41
  User.last_user = self
42
42
  self.monitor(session, share)
43
43
 
44
+ @property
45
+ def sorted_changed_units(self):
46
+ """sort changed units by type, 'block' types have priority"""
47
+ if len(self.changed_units) > 1:
48
+ not_block = lambda u: u.type != 'block'
49
+ if any(not not_block(x) for x in self.changed_units):
50
+ return sorted(self.changed_units, key=not_block)
51
+ return self.changed_units
52
+
44
53
  async def run_process(self, long_running_task, *args, progress_callback = None, **kwargs):
45
54
  if progress_callback and notify_monitor and progress_callback != self.progress: #progress notifies the monitor
46
55
  async def new_callback(value):
@@ -111,7 +120,7 @@ class User:
111
120
  self.log(f'User is disconnected, session: {self.session}', type = 'info')
112
121
 
113
122
  def set_clean(self):
114
- #remove user modules from sys
123
+ """remove user modules from sys """
115
124
  if os.path.exists(blocks_dir):
116
125
  for file in os.listdir(blocks_dir):
117
126
  if file.endswith(".py") and file != '__init__.py':
@@ -232,21 +241,21 @@ class User:
232
241
  match raw:
233
242
  case None:
234
243
  if self.changed_units:
235
- raw = Message(*self.changed_units, user = self)
244
+ raw = Message(*self.sorted_changed_units, user = self)
236
245
  if not raw.updates:
237
246
  raw = None
238
247
  case Message():
239
248
  if self.changed_units:
240
249
  message_units = [x['data'] for x in raw.updates]
241
250
  self.changed_units.update(message_units)
242
- raw.set_updates(self.changed_units)
251
+ raw.set_updates(self.sorted_changed_units)
243
252
  raw.fill_paths4(self)
244
253
  case Unit():
245
254
  self.changed_units.add(raw)
246
- raw = Message(*self.changed_units, user = self)
255
+ raw = Message(*self.sorted_changed_units, user = self)
247
256
  case list() | tuple(): #raw is *unit
248
257
  self.changed_units.update(raw)
249
- raw = Message(*self.changed_units, user = self)
258
+ raw = Message(*self.sorted_changed_units, user = self)
250
259
  case _: ...
251
260
 
252
261
  self.changed_units.clear()
@@ -292,7 +301,8 @@ class User:
292
301
  return await self.process_element(elem, message)
293
302
  error = f'Element {message.block}/{message.element} does not exist!'
294
303
  self.log(error)
295
- return Error(error)
304
+ return Error(error)
305
+
296
306
  async def process_element(self, elem, message):
297
307
  event = message.event
298
308
  handler = self.handlers.get((elem, event), None)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unisi
3
- Version: 0.3.32
3
+ Version: 0.4.0
4
4
  Summary: Unified System Interface, GUI and Remote API
5
5
  Author-Email: UNISI Tech <g.dernovoy@gmail.com>
6
6
  License: Apache-2.0
@@ -1,11 +1,11 @@
1
- unisi-0.3.32.dist-info/METADATA,sha256=daR-9MpLQ1G1BUjI6N13Ejm5MlxZ7SrNAi6nE4OrKto,27266
2
- unisi-0.3.32.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
3
- unisi-0.3.32.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
- unisi-0.3.32.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1
+ unisi-0.4.0.dist-info/METADATA,sha256=thJFLs8apFPeh7KUgqOaND6nFibDWKXmGq40Esm8wwE,27265
2
+ unisi-0.4.0.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
3
+ unisi-0.4.0.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
+ unisi-0.4.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
5
5
  unisi/__init__.py,sha256=prG4FwJzpNJRX1trto0x_4Bne3kkpEX1dUxcRnIxWVw,301
6
6
  unisi/autotest.py,sha256=rY44RnSMIxkwCexNwS1j5LmE7Gx76Pu_da5er_vNPL8,9002
7
7
  unisi/common.py,sha256=QHSS-pQDtLZxeZls0eDl8-EmYJZuaRmYO1M9izCly-Y,5791
8
- unisi/containers.py,sha256=dmRHogzjIVoc0qu713bOPOPBp2QrN-LEA4Wn3owF0Yg,7223
8
+ unisi/containers.py,sha256=yl5CZrTK3HmNJJxpO7SmzIIsBMehwfCb_otaWG7GriM,7416
9
9
  unisi/dbunits.py,sha256=g1h9pjoSwJrJ0Hmph-xv5jE1yfrxJeXGfuSnyVTg3j8,7438
10
10
  unisi/graphs.py,sha256=DTyLUPzi9ErKY6ADXVMXf9-uJskNISZY_xDvsnhMs1Q,6959
11
11
  unisi/jsoncomparison/__init__.py,sha256=lsWkYEuL6v3Qol-lwSUvB6y63tm6AKcCMUd4DZDx3Cg,350
@@ -20,8 +20,8 @@ unisi/proxy.py,sha256=QMHSSFJtmVZIexIMAsuFNlF5JpnYNG90rkTM3PYJhY4,7750
20
20
  unisi/reloader.py,sha256=t7z0NgaeJX52044ue_LxITa99WMuE5Jra9qkMEeGhTg,6941
21
21
  unisi/server.py,sha256=owUV_siimohV-PZwMkkIRTnynY0wxpia2la3Vjqy9g8,6658
22
22
  unisi/tables.py,sha256=1ZjR_eJ_vf0h26kdv2PjLV3t2cPMoqCV17MQjfilTX0,13810
23
- unisi/units.py,sha256=6Oo_09ppfw2Rre4NVGKFb5RS3SmBmtWATd1qWW_xMlY,11675
24
- unisi/users.py,sha256=ZKRTgsxATmnrGhTYk87XuLAWptgZbjfs9KAcoi3UxBQ,16456
23
+ unisi/units.py,sha256=AGpb1Oad2HrNBaJNLR1Kl1OwjgbswAY7tQN195O7dn0,11691
24
+ unisi/users.py,sha256=ec8SkpzJ877H2wJ0iiNGUYtZ6CowRoLWVfM2OcTwBlE,16894
25
25
  unisi/utils.py,sha256=I5UF97kH5Xsx3ZtU-7tJNhOAKtdf7TMO0KyhaH9I8gc,2657
26
26
  unisi/voicecom.py,sha256=QzS1gIrBeGLO5dEwiu7KIEdJIIVbPBZFGb5nY632Ws8,16707
27
27
  unisi/web/css/312.2bdc526c.css,sha256=E2kfiWrKmaXQaR79f3K7m4NHxEKhah_jn-fS7oDZ7Rk,3508
@@ -55,4 +55,4 @@ unisi/web/js/sigma.ce21336a.js,sha256=ngST-065XWOdnR_Xn7U6oGNHTL8fyiOEI9V8-BWRvl
55
55
  unisi/web/js/sigma.ce21336a.js.gz,sha256=zv6oToZZFCfmrZ4G4fw0sOncVe8-dyYNWh2v5QLKZp4,51965
56
56
  unisi/web/js/vendor.6a64dcc5.js,sha256=OSNK2nadU2DnSOEYQQcAmelybITOFZXMxnRyaDoT3yU,747104
57
57
  unisi/web/js/vendor.6a64dcc5.js.gz,sha256=nmtqRzQRWaToxgHxI9hfJd3UrUCg2-fd-0Fjc4H4wu8,245827
58
- unisi-0.3.32.dist-info/RECORD,,
58
+ unisi-0.4.0.dist-info/RECORD,,
File without changes