Skip to content

Commit

Permalink
Designer support 2 (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-cork authored Oct 3, 2023
2 parents 2043078 + 9e0d74f commit 1deea44
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
13 changes: 0 additions & 13 deletions client_code/Tabulator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,19 +296,6 @@ def get_page(self):
def set_page(self, page):
"""set the current page"""

def _anvil_set_property_values_(self, updates):
re_init = False
for attr, value in updates.items():
if attr in self._options:
self._options[attr] = value
re_init = True
else:
setattr(self, attr, value)

if re_init and self._t:
self._t.destroy()
self._initialize()


for method in _methods:
delattr(Tabulator, method)
13 changes: 11 additions & 2 deletions client_code/Tabulator/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
import anvil.js
from anvil.js.window import Function, Promise, RegExp, String, document, window

try:
from anvil.designer import in_designer
except ImportError:
in_designer = False

from ._js_tabulator import TabulatorModule

_RE_SNAKE = RegExp("_[a-z]", "g")
Expand Down Expand Up @@ -61,9 +66,13 @@ def option_setter(self, value):
self._options[key] = value
if self._t is None:
return
elif setMethod is not None:
if setMethod is not None:
return self._t[setMethod](value)
elif _warnings.get("post_init") is not None:
if in_designer:
self._t.destroy()
self._initialize()
return
if _warnings.get("post_init") is not None:
return
_warnings["post_init"] = True
msg = f"Warning: changing the option {key!r} after the table has been built has no effect"
Expand Down

0 comments on commit 1deea44

Please sign in to comment.