py10x-universe 0.1.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.
- core_10x/__init__.py +42 -0
- core_10x/backbone/__init__.py +0 -0
- core_10x/backbone/backbone_store.py +59 -0
- core_10x/backbone/backbone_traitable.py +30 -0
- core_10x/backbone/backbone_user.py +66 -0
- core_10x/backbone/bound_data_domain.py +49 -0
- core_10x/backbone/namespace.py +101 -0
- core_10x/backbone/vault.py +38 -0
- core_10x/code_samples/__init__.py +0 -0
- core_10x/code_samples/_package_manifest.py +3 -0
- core_10x/code_samples/directories.py +181 -0
- core_10x/code_samples/person.py +76 -0
- core_10x/concrete_traits.py +356 -0
- core_10x/conftest.py +12 -0
- core_10x/curve.py +321 -0
- core_10x/data_domain.py +48 -0
- core_10x/data_domain_binder.py +45 -0
- core_10x/directory.py +250 -0
- core_10x/entity.py +8 -0
- core_10x/entity_filter.py +5 -0
- core_10x/environment_variables.py +147 -0
- core_10x/exec_control.py +84 -0
- core_10x/experimental/__init__.py +0 -0
- core_10x/experimental/data_protocol_ex.py +34 -0
- core_10x/global_cache.py +121 -0
- core_10x/manual_tests/__init__.py +0 -0
- core_10x/manual_tests/calendar_test.py +35 -0
- core_10x/manual_tests/ctor_update_bug.py +58 -0
- core_10x/manual_tests/debug_graph_on.py +17 -0
- core_10x/manual_tests/debug_graphoff_inside_graph_on.py +28 -0
- core_10x/manual_tests/enum_bits_test.py +17 -0
- core_10x/manual_tests/env_vars_trivial_test.py +12 -0
- core_10x/manual_tests/existing_traitable.py +33 -0
- core_10x/manual_tests/k10x_test1.py +13 -0
- core_10x/manual_tests/named_constant_test.py +121 -0
- core_10x/manual_tests/nucleus_trivial_test.py +42 -0
- core_10x/manual_tests/polars_test.py +14 -0
- core_10x/manual_tests/py_class_test.py +4 -0
- core_10x/manual_tests/rc_test.py +42 -0
- core_10x/manual_tests/rdate_test.py +12 -0
- core_10x/manual_tests/reference_serialization_bug.py +19 -0
- core_10x/manual_tests/resource_trivial_test.py +10 -0
- core_10x/manual_tests/store_uri_test.py +6 -0
- core_10x/manual_tests/trait_definition_test.py +19 -0
- core_10x/manual_tests/trait_filter_test.py +15 -0
- core_10x/manual_tests/trait_flag_modification_test.py +42 -0
- core_10x/manual_tests/trait_modification_bug.py +26 -0
- core_10x/manual_tests/traitable_as_of_test.py +82 -0
- core_10x/manual_tests/traitable_heir_test.py +39 -0
- core_10x/manual_tests/traitable_history_test.py +41 -0
- core_10x/manual_tests/traitable_serialization_test.py +54 -0
- core_10x/manual_tests/traitable_trivial_test.py +71 -0
- core_10x/manual_tests/trivial_graph_test.py +16 -0
- core_10x/manual_tests/ts_class_association_test.py +64 -0
- core_10x/manual_tests/ts_trivial_test.py +35 -0
- core_10x/named_constant.py +425 -0
- core_10x/nucleus.py +81 -0
- core_10x/package_manifest.py +85 -0
- core_10x/package_refactoring.py +153 -0
- core_10x/py_class.py +431 -0
- core_10x/rc.py +155 -0
- core_10x/rdate.py +339 -0
- core_10x/resource.py +189 -0
- core_10x/roman_number.py +67 -0
- core_10x/testlib/__init__.py +0 -0
- core_10x/testlib/test_store.py +240 -0
- core_10x/testlib/traitable_history_tests.py +787 -0
- core_10x/testlib/ts_tests.py +280 -0
- core_10x/trait.py +377 -0
- core_10x/trait_definition.py +176 -0
- core_10x/trait_filter.py +205 -0
- core_10x/trait_method_error.py +36 -0
- core_10x/traitable.py +1082 -0
- core_10x/traitable_cli.py +153 -0
- core_10x/traitable_heir.py +33 -0
- core_10x/traitable_id.py +31 -0
- core_10x/ts_store.py +172 -0
- core_10x/ts_store_type.py +26 -0
- core_10x/ts_union.py +147 -0
- core_10x/ui_hint.py +153 -0
- core_10x/unit_tests/test_concrete_traits.py +156 -0
- core_10x/unit_tests/test_converters.py +51 -0
- core_10x/unit_tests/test_curve.py +157 -0
- core_10x/unit_tests/test_directory.py +54 -0
- core_10x/unit_tests/test_documentation.py +172 -0
- core_10x/unit_tests/test_environment_variables.py +15 -0
- core_10x/unit_tests/test_filters.py +239 -0
- core_10x/unit_tests/test_graph.py +348 -0
- core_10x/unit_tests/test_named_constant.py +98 -0
- core_10x/unit_tests/test_rc.py +11 -0
- core_10x/unit_tests/test_rdate.py +484 -0
- core_10x/unit_tests/test_trait_method_error.py +80 -0
- core_10x/unit_tests/test_trait_modification.py +19 -0
- core_10x/unit_tests/test_traitable.py +959 -0
- core_10x/unit_tests/test_traitable_history.py +1 -0
- core_10x/unit_tests/test_ts_store.py +1 -0
- core_10x/unit_tests/test_ts_union.py +369 -0
- core_10x/unit_tests/test_ui_nodes.py +81 -0
- core_10x/unit_tests/test_xxcalendar.py +471 -0
- core_10x/vault/__init__.py +0 -0
- core_10x/vault/sec_keys.py +133 -0
- core_10x/vault/security_keys_old.py +168 -0
- core_10x/vault/vault.py +56 -0
- core_10x/vault/vault_traitable.py +56 -0
- core_10x/vault/vault_user.py +70 -0
- core_10x/xdate_time.py +136 -0
- core_10x/xnone.py +71 -0
- core_10x/xxcalendar.py +228 -0
- infra_10x/__init__.py +0 -0
- infra_10x/manual_tests/__init__.py +0 -0
- infra_10x/manual_tests/test_misc.py +16 -0
- infra_10x/manual_tests/test_prepare_filter_and_pipeline.py +25 -0
- infra_10x/mongodb_admin.py +111 -0
- infra_10x/mongodb_store.py +346 -0
- infra_10x/mongodb_utils.py +129 -0
- infra_10x/unit_tests/conftest.py +13 -0
- infra_10x/unit_tests/test_mongo_db.py +36 -0
- infra_10x/unit_tests/test_mongo_history.py +1 -0
- py10x_universe-0.1.3.dist-info/METADATA +406 -0
- py10x_universe-0.1.3.dist-info/RECORD +214 -0
- py10x_universe-0.1.3.dist-info/WHEEL +4 -0
- py10x_universe-0.1.3.dist-info/licenses/LICENSE +21 -0
- ui_10x/__init__.py +0 -0
- ui_10x/apps/__init__.py +0 -0
- ui_10x/apps/collection_editor_app.py +100 -0
- ui_10x/choice.py +212 -0
- ui_10x/collection_editor.py +135 -0
- ui_10x/concrete_trait_widgets.py +220 -0
- ui_10x/conftest.py +8 -0
- ui_10x/entity_stocker.py +173 -0
- ui_10x/examples/__init__.py +0 -0
- ui_10x/examples/_guess_word_data.py +14076 -0
- ui_10x/examples/collection_editor.py +17 -0
- ui_10x/examples/date_selector.py +14 -0
- ui_10x/examples/entity_stocker.py +18 -0
- ui_10x/examples/guess_word.py +392 -0
- ui_10x/examples/message_box.py +20 -0
- ui_10x/examples/multi_choice.py +17 -0
- ui_10x/examples/py_data_browser.py +66 -0
- ui_10x/examples/radiobox.py +29 -0
- ui_10x/examples/single_choice.py +31 -0
- ui_10x/examples/style_sheet.py +47 -0
- ui_10x/examples/trivial_entity_editor.py +18 -0
- ui_10x/platform.py +20 -0
- ui_10x/platform_interface.py +517 -0
- ui_10x/py_data_browser.py +249 -0
- ui_10x/qt6/__init__.py +0 -0
- ui_10x/qt6/conftest.py +8 -0
- ui_10x/qt6/manual_tests/__init__.py +0 -0
- ui_10x/qt6/manual_tests/basic_test.py +35 -0
- ui_10x/qt6/platform_implementation.py +275 -0
- ui_10x/qt6/utils.py +665 -0
- ui_10x/rio/__init__.py +0 -0
- ui_10x/rio/apps/examples/examples/__init__.py +22 -0
- ui_10x/rio/apps/examples/examples/components/__init__.py +3 -0
- ui_10x/rio/apps/examples/examples/components/collection_editor.py +15 -0
- ui_10x/rio/apps/examples/examples/pages/collection_editor.py +21 -0
- ui_10x/rio/apps/examples/examples/pages/login_page.py +88 -0
- ui_10x/rio/apps/examples/examples/pages/style_sheet.py +21 -0
- ui_10x/rio/apps/examples/rio.toml +14 -0
- ui_10x/rio/component_builder.py +497 -0
- ui_10x/rio/components/__init__.py +9 -0
- ui_10x/rio/components/group_box.py +31 -0
- ui_10x/rio/components/labeled_checkbox.py +18 -0
- ui_10x/rio/components/line_edit.py +37 -0
- ui_10x/rio/components/radio_button.py +32 -0
- ui_10x/rio/components/separator.py +24 -0
- ui_10x/rio/components/splitter.py +121 -0
- ui_10x/rio/components/tree_view.py +75 -0
- ui_10x/rio/conftest.py +35 -0
- ui_10x/rio/internals/__init__.py +0 -0
- ui_10x/rio/internals/app.py +192 -0
- ui_10x/rio/manual_tests/__init__.py +0 -0
- ui_10x/rio/manual_tests/basic_test.py +24 -0
- ui_10x/rio/manual_tests/splitter.py +27 -0
- ui_10x/rio/platform_implementation.py +91 -0
- ui_10x/rio/style_sheet.py +53 -0
- ui_10x/rio/unit_tests/test_collection_editor.py +68 -0
- ui_10x/rio/unit_tests/test_internals.py +630 -0
- ui_10x/rio/unit_tests/test_style_sheet.py +37 -0
- ui_10x/rio/widgets/__init__.py +46 -0
- ui_10x/rio/widgets/application.py +109 -0
- ui_10x/rio/widgets/button.py +48 -0
- ui_10x/rio/widgets/button_group.py +60 -0
- ui_10x/rio/widgets/calendar.py +23 -0
- ui_10x/rio/widgets/checkbox.py +24 -0
- ui_10x/rio/widgets/dialog.py +137 -0
- ui_10x/rio/widgets/group_box.py +27 -0
- ui_10x/rio/widgets/layout.py +34 -0
- ui_10x/rio/widgets/line_edit.py +37 -0
- ui_10x/rio/widgets/list.py +105 -0
- ui_10x/rio/widgets/message_box.py +70 -0
- ui_10x/rio/widgets/scroll_area.py +31 -0
- ui_10x/rio/widgets/spacer.py +6 -0
- ui_10x/rio/widgets/splitter.py +45 -0
- ui_10x/rio/widgets/text_edit.py +28 -0
- ui_10x/rio/widgets/tree.py +89 -0
- ui_10x/rio/widgets/unit_tests/test_button.py +101 -0
- ui_10x/rio/widgets/unit_tests/test_button_group.py +33 -0
- ui_10x/rio/widgets/unit_tests/test_calendar.py +114 -0
- ui_10x/rio/widgets/unit_tests/test_checkbox.py +109 -0
- ui_10x/rio/widgets/unit_tests/test_group_box.py +158 -0
- ui_10x/rio/widgets/unit_tests/test_label.py +43 -0
- ui_10x/rio/widgets/unit_tests/test_line_edit.py +140 -0
- ui_10x/rio/widgets/unit_tests/test_list.py +146 -0
- ui_10x/table_header_view.py +305 -0
- ui_10x/table_view.py +174 -0
- ui_10x/trait_editor.py +189 -0
- ui_10x/trait_widget.py +131 -0
- ui_10x/traitable_editor.py +200 -0
- ui_10x/traitable_view.py +131 -0
- ui_10x/unit_tests/conftest.py +8 -0
- ui_10x/unit_tests/test_platform.py +9 -0
- ui_10x/utils.py +661 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from core_10x.rc import RC
|
|
4
|
+
from core_10x.trait import Trait
|
|
5
|
+
from core_10x.traitable import Traitable
|
|
6
|
+
from matplotlib import colors
|
|
7
|
+
|
|
8
|
+
import rio
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class StyleSheet(Traitable):
|
|
12
|
+
sheet: dict
|
|
13
|
+
text_style: rio.TextStyle
|
|
14
|
+
|
|
15
|
+
def sheet_set(self, trait: Trait, value: dict) -> RC:
|
|
16
|
+
# {'color': 'lightgreen', 'background-color': 'white', 'font-family': 'Helvetica', 'font-style': 'normal', 'font-weight': 'normal', 'border-width': '2px', 'border-style': '', 'border-color': 'blue'}
|
|
17
|
+
style = dict(value)
|
|
18
|
+
kw = {}
|
|
19
|
+
if bg_color := style.pop('color', None):
|
|
20
|
+
kw['fill'] = rio.Color.from_hex(colors.to_hex(bg_color))
|
|
21
|
+
|
|
22
|
+
if font := style.pop('font-family', None):
|
|
23
|
+
kw['font'] = rio.Font.from_google_fonts(font)
|
|
24
|
+
|
|
25
|
+
if font_style := style.pop('font-style', None):
|
|
26
|
+
if font_style != 'normal':
|
|
27
|
+
kw[font_style] = True
|
|
28
|
+
|
|
29
|
+
if font_weight := style.pop('font-weight', None):
|
|
30
|
+
kw['font_weight'] = font_weight
|
|
31
|
+
|
|
32
|
+
if kw:
|
|
33
|
+
self.text_style = rio.TextStyle(**kw)
|
|
34
|
+
|
|
35
|
+
return self.rc(style)
|
|
36
|
+
|
|
37
|
+
def sheet_get(self):
|
|
38
|
+
style = {}
|
|
39
|
+
ts = self.text_style
|
|
40
|
+
if ts:
|
|
41
|
+
style['font-style'] = 'italic' if ts.italic else 'normal'
|
|
42
|
+
style['font-weight'] = ts.font_weight or 'normal'
|
|
43
|
+
if family := ts.font._google_fonts_name: # TODO: better?
|
|
44
|
+
style['font-family'] = family
|
|
45
|
+
style['color'] = f'#{ts.fill.hex}'
|
|
46
|
+
return style
|
|
47
|
+
|
|
48
|
+
@staticmethod
|
|
49
|
+
def rc(ss) -> RC:
|
|
50
|
+
rc = RC(True)
|
|
51
|
+
for style, value in ss.items():
|
|
52
|
+
rc.add_error(f'Unsupported style: {style}: {value}')
|
|
53
|
+
return rc
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
from datetime import date
|
|
3
|
+
|
|
4
|
+
import pytest
|
|
5
|
+
import rio.testing.browser_client
|
|
6
|
+
from core_10x.code_samples.person import Person
|
|
7
|
+
from core_10x.exec_control import CACHE_ONLY, INTERACTIVE
|
|
8
|
+
from ui_10x.collection_editor import Collection, CollectionEditor
|
|
9
|
+
from ui_10x.rio.component_builder import DynamicComponent
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@pytest.fixture(autouse=True)
|
|
13
|
+
def mock_db_ops(monkeypatch):
|
|
14
|
+
with CACHE_ONLY():
|
|
15
|
+
sasha = Person(first_name='Sasha', last_name='Davidovich', weight_lbs=150, _replace=True)
|
|
16
|
+
ilya = Person(first_name='Ilya', last_name='Pevzner', weight_lbs=200, dob=date(1971, 7, 3), _replace=True)
|
|
17
|
+
monkeypatch.setattr(Person, 'load_ids', lambda: [sasha.id(), ilya.id()])
|
|
18
|
+
monkeypatch.setattr(Person, 'load_data', lambda id: {sasha.id(): sasha, ilya.id(): ilya}[id])
|
|
19
|
+
yield
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@pytest.fixture(autouse=True)
|
|
23
|
+
def interactive_mode():
|
|
24
|
+
interactive = INTERACTIVE()
|
|
25
|
+
interactive.begin_using()
|
|
26
|
+
yield
|
|
27
|
+
interactive.end_using()
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
async def test_collection_editor() -> None:
|
|
31
|
+
coll = Collection(cls=Person)
|
|
32
|
+
ce = CollectionEditor(coll=coll)
|
|
33
|
+
widget = ce.main_widget()
|
|
34
|
+
|
|
35
|
+
async with rio.testing.BrowserClient(lambda: DynamicComponent(widget)) as test_client:
|
|
36
|
+
await asyncio.sleep(0.5)
|
|
37
|
+
|
|
38
|
+
assert await test_client.execute_js('document.querySelector(".rio-selectable-item").innerText') == 'Ilya|Pevzner'
|
|
39
|
+
await test_client.execute_js('document.querySelector(".rio-selectable-item").click()')
|
|
40
|
+
await asyncio.sleep(0.5)
|
|
41
|
+
|
|
42
|
+
assert await test_client.execute_js('document.querySelectorAll("input")[8].value') == 'LB'
|
|
43
|
+
assert await test_client.execute_js('document.querySelectorAll("input")[7].value') == '200.00'
|
|
44
|
+
|
|
45
|
+
button_id = next(b._id_ for b in test_client.get_components(rio.Button) if b.content == 'edit')
|
|
46
|
+
await test_client.execute_js(f'''document.querySelector('[dbg-id="{button_id}"]').querySelector('rio-pressable-element').click()''')
|
|
47
|
+
await asyncio.sleep(0.5)
|
|
48
|
+
|
|
49
|
+
assert await test_client.execute_js('document.querySelectorAll("input")[16].value') == 'LB'
|
|
50
|
+
assert await test_client.execute_js('document.querySelectorAll("input")[15].value') == '200.00'
|
|
51
|
+
|
|
52
|
+
button_id = next(b._id_ for b in reversed(tuple(test_client.get_components(rio.Button))) if b.icon == 'material/arrow_downward')
|
|
53
|
+
await test_client.execute_js(f'''document.querySelector('[dbg-id="{button_id}"]').querySelector('rio-pressable-element').click()''')
|
|
54
|
+
await asyncio.sleep(0.5)
|
|
55
|
+
|
|
56
|
+
print([li.text for li in test_client.get_components(rio.SimpleListItem)])
|
|
57
|
+
list_item_id = next(li._id_ for li in test_client.get_components(rio.SimpleListItem) if li.text == 'G')
|
|
58
|
+
await test_client.execute_js(f'''document.querySelector('[dbg-id="{list_item_id}"]').querySelector('.rio-selectable-item').click()''')
|
|
59
|
+
|
|
60
|
+
assert await test_client.execute_js('document.querySelectorAll("input")[16].value') == 'G'
|
|
61
|
+
assert await test_client.execute_js('document.querySelectorAll("input")[15].value') == '90,702.95'
|
|
62
|
+
|
|
63
|
+
button_id = next(b._id_ for b in test_client.get_components(rio.Button) if b.content == 'Ok')
|
|
64
|
+
await test_client.execute_js(f'''document.querySelector('[dbg-id="{button_id}"]').querySelector('rio-pressable-element').click()''')
|
|
65
|
+
await asyncio.sleep(0.5)
|
|
66
|
+
|
|
67
|
+
assert await test_client.execute_js('document.querySelectorAll("input")[8].value') == 'G'
|
|
68
|
+
assert await test_client.execute_js('document.querySelectorAll("input")[7].value') == '90,702.95'
|