bootstack 0.1.0a1__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.
- bootstack/__init__.py +249 -0
- bootstack/__main__.py +5 -0
- bootstack/api/__init__.py +127 -0
- bootstack/api/app.py +30 -0
- bootstack/api/constants.py +3 -0
- bootstack/api/data.py +23 -0
- bootstack/api/dialogs.py +44 -0
- bootstack/api/i18n.py +17 -0
- bootstack/api/localization.py +16 -0
- bootstack/api/menu.py +7 -0
- bootstack/api/style.py +23 -0
- bootstack/api/utils.py +24 -0
- bootstack/api/widgets.py +137 -0
- bootstack/assets/__init__.py +24 -0
- bootstack/assets/bootstack-transparent.png +0 -0
- bootstack/assets/bootstack.ico +0 -0
- bootstack/assets/bootstack.png +0 -0
- bootstack/assets/elements/__init__.py +0 -0
- bootstack/assets/elements/badge-pill.png +0 -0
- bootstack/assets/elements/badge-square.png +0 -0
- bootstack/assets/elements/border.png +0 -0
- bootstack/assets/elements/button-compact.png +0 -0
- bootstack/assets/elements/button-default.png +0 -0
- bootstack/assets/elements/button-group-horizontal-after-compact.png +0 -0
- bootstack/assets/elements/button-group-horizontal-after-default.png +0 -0
- bootstack/assets/elements/button-group-horizontal-before-compact.png +0 -0
- bootstack/assets/elements/button-group-horizontal-before-default.png +0 -0
- bootstack/assets/elements/button-group-horizontal-center-compact.png +0 -0
- bootstack/assets/elements/button-group-horizontal-center-default.png +0 -0
- bootstack/assets/elements/button-group-vertical-after-compact.png +0 -0
- bootstack/assets/elements/button-group-vertical-after-default.png +0 -0
- bootstack/assets/elements/button-group-vertical-before-compact.png +0 -0
- bootstack/assets/elements/button-group-vertical-before-default.png +0 -0
- bootstack/assets/elements/button-group-vertical-center-compact.png +0 -0
- bootstack/assets/elements/button-group-vertical-center-default.png +0 -0
- bootstack/assets/elements/checkbox-checked.png +0 -0
- bootstack/assets/elements/checkbox-indeterminate.png +0 -0
- bootstack/assets/elements/checkbox-unchecked.png +0 -0
- bootstack/assets/elements/field.png +0 -0
- bootstack/assets/elements/input-after-compact.png +0 -0
- bootstack/assets/elements/input-after-default.png +0 -0
- bootstack/assets/elements/input-before-compact.png +0 -0
- bootstack/assets/elements/input-before-default.png +0 -0
- bootstack/assets/elements/input-compact.png +0 -0
- bootstack/assets/elements/input-default.png +0 -0
- bootstack/assets/elements/list-item-separated.png +0 -0
- bootstack/assets/elements/list-item.png +0 -0
- bootstack/assets/elements/manifest.toml +480 -0
- bootstack/assets/elements/menu-item.png +0 -0
- bootstack/assets/elements/nav-button-compact.png +0 -0
- bootstack/assets/elements/nav-button-default.png +0 -0
- bootstack/assets/elements/nav-icon-button-compact.png +0 -0
- bootstack/assets/elements/nav-icon-button-default.png +0 -0
- bootstack/assets/elements/notebook-client-border.png +0 -0
- bootstack/assets/elements/notebook-tab-active.png +0 -0
- bootstack/assets/elements/notebook-tab-bar.png +0 -0
- bootstack/assets/elements/notebook-tab-normal.png +0 -0
- bootstack/assets/elements/notebook-tab-pill.png +0 -0
- bootstack/assets/elements/progress-bar-horizontal-striped.png +0 -0
- bootstack/assets/elements/progress-bar-solid.png +0 -0
- bootstack/assets/elements/progress-bar-thin.png +0 -0
- bootstack/assets/elements/progress-bar-vertical-striped.png +0 -0
- bootstack/assets/elements/radio-selected.png +0 -0
- bootstack/assets/elements/radio-unselected.png +0 -0
- bootstack/assets/elements/scrollbar-horizontal.png +0 -0
- bootstack/assets/elements/scrollbar-vertical.png +0 -0
- bootstack/assets/elements/slider-handle-focus.png +0 -0
- bootstack/assets/elements/slider-handle.png +0 -0
- bootstack/assets/elements/slider-track-horizontal.png +0 -0
- bootstack/assets/elements/slider-track-vertical.png +0 -0
- bootstack/assets/elements/switch-off.png +0 -0
- bootstack/assets/elements/switch-on.png +0 -0
- bootstack/assets/elements/tabs-bar-horizontal.png +0 -0
- bootstack/assets/elements/tabs-bar-vertical.png +0 -0
- bootstack/assets/elements/tabs-pill.png +0 -0
- bootstack/assets/locales/ar/LC_MESSAGES/bootstack.mo +0 -0
- bootstack/assets/locales/ar/LC_MESSAGES/bootstack.po +853 -0
- bootstack/assets/locales/bg/LC_MESSAGES/bootstack.po +875 -0
- bootstack/assets/locales/cs/LC_MESSAGES/bootstack.mo +0 -0
- bootstack/assets/locales/cs/LC_MESSAGES/bootstack.po +853 -0
- bootstack/assets/locales/da/LC_MESSAGES/bootstack.mo +0 -0
- bootstack/assets/locales/da/LC_MESSAGES/bootstack.po +853 -0
- bootstack/assets/locales/de/LC_MESSAGES/bootstack.mo +0 -0
- bootstack/assets/locales/de/LC_MESSAGES/bootstack.po +853 -0
- bootstack/assets/locales/en/LC_MESSAGES/bootstack.mo +0 -0
- bootstack/assets/locales/en/LC_MESSAGES/bootstack.po +875 -0
- bootstack/assets/locales/es/LC_MESSAGES/bootstack.mo +0 -0
- bootstack/assets/locales/es/LC_MESSAGES/bootstack.po +853 -0
- bootstack/assets/locales/fr/LC_MESSAGES/bootstack.mo +0 -0
- bootstack/assets/locales/fr/LC_MESSAGES/bootstack.po +853 -0
- bootstack/assets/locales/he/LC_MESSAGES/bootstack.mo +0 -0
- bootstack/assets/locales/he/LC_MESSAGES/bootstack.po +851 -0
- bootstack/assets/locales/hi/LC_MESSAGES/bootstack.mo +0 -0
- bootstack/assets/locales/hi/LC_MESSAGES/bootstack.po +842 -0
- bootstack/assets/locales/it/LC_MESSAGES/bootstack.mo +0 -0
- bootstack/assets/locales/it/LC_MESSAGES/bootstack.po +841 -0
- bootstack/assets/locales/ja/LC_MESSAGES/bootstack.mo +0 -0
- bootstack/assets/locales/ja/LC_MESSAGES/bootstack.po +914 -0
- bootstack/assets/locales/ko/LC_MESSAGES/bootstack.mo +0 -0
- bootstack/assets/locales/ko/LC_MESSAGES/bootstack.po +842 -0
- bootstack/assets/locales/nb/LC_MESSAGES/bootstack.mo +0 -0
- bootstack/assets/locales/nb/LC_MESSAGES/bootstack.po +841 -0
- bootstack/assets/locales/nl/LC_MESSAGES/bootstack.mo +0 -0
- bootstack/assets/locales/nl/LC_MESSAGES/bootstack.po +841 -0
- bootstack/assets/locales/pl/LC_MESSAGES/bootstack.mo +0 -0
- bootstack/assets/locales/pl/LC_MESSAGES/bootstack.po +842 -0
- bootstack/assets/locales/pt/LC_MESSAGES/bootstack.mo +0 -0
- bootstack/assets/locales/pt/LC_MESSAGES/bootstack.po +842 -0
- bootstack/assets/locales/pt_BR/LC_MESSAGES/bootstack.mo +0 -0
- bootstack/assets/locales/pt_BR/LC_MESSAGES/bootstack.po +842 -0
- bootstack/assets/locales/sl/LC_MESSAGES/bootstack.mo +0 -0
- bootstack/assets/locales/sl/LC_MESSAGES/bootstack.po +842 -0
- bootstack/assets/locales/sv/LC_MESSAGES/bootstack.mo +0 -0
- bootstack/assets/locales/sv/LC_MESSAGES/bootstack.po +842 -0
- bootstack/assets/locales/tr/LC_MESSAGES/bootstack.mo +0 -0
- bootstack/assets/locales/tr/LC_MESSAGES/bootstack.po +842 -0
- bootstack/assets/locales/zh_CN/LC_MESSAGES/bootstack.mo +0 -0
- bootstack/assets/locales/zh_CN/LC_MESSAGES/bootstack.po +842 -0
- bootstack/assets/locales/zh_TW/LC_MESSAGES/bootstack.mo +0 -0
- bootstack/assets/locales/zh_TW/LC_MESSAGES/bootstack.po +842 -0
- bootstack/assets/themes/__init__.py +0 -0
- bootstack/assets/themes/amber-dark.json +32 -0
- bootstack/assets/themes/amber-light.json +32 -0
- bootstack/assets/themes/aurora-dark.json +32 -0
- bootstack/assets/themes/aurora-light.json +32 -0
- bootstack/assets/themes/bootstrap-dark.json +32 -0
- bootstack/assets/themes/bootstrap-light.json +32 -0
- bootstack/assets/themes/classic-dark.json +32 -0
- bootstack/assets/themes/classic-light.json +32 -0
- bootstack/assets/themes/docs-dark.json +32 -0
- bootstack/assets/themes/docs-light.json +32 -0
- bootstack/assets/themes/forest-dark.json +32 -0
- bootstack/assets/themes/forest-light.json +32 -0
- bootstack/assets/themes/ocean-dark.json +32 -0
- bootstack/assets/themes/ocean-light.json +32 -0
- bootstack/assets/themes/rose-dark.json +32 -0
- bootstack/assets/themes/rose-light.json +32 -0
- bootstack/assets/widgets/__init__.py +0 -0
- bootstack/assets/widgets/badge-default.png +0 -0
- bootstack/assets/widgets/badge-pill.png +0 -0
- bootstack/assets/widgets/border.png +0 -0
- bootstack/assets/widgets/button-group-horizontal-after.png +0 -0
- bootstack/assets/widgets/button-group-horizontal-before.png +0 -0
- bootstack/assets/widgets/button-group-horizontal-center.png +0 -0
- bootstack/assets/widgets/button-group-vertical-after.png +0 -0
- bootstack/assets/widgets/button-group-vertical-before.png +0 -0
- bootstack/assets/widgets/button-group-vertical-center.png +0 -0
- bootstack/assets/widgets/button.png +0 -0
- bootstack/assets/widgets/checkbox-checked.png +0 -0
- bootstack/assets/widgets/checkbox-indeterminate.png +0 -0
- bootstack/assets/widgets/checkbox-unchecked.png +0 -0
- bootstack/assets/widgets/field.png +0 -0
- bootstack/assets/widgets/icon-button.png +0 -0
- bootstack/assets/widgets/input-inner.png +0 -0
- bootstack/assets/widgets/input-prefix.png +0 -0
- bootstack/assets/widgets/input-suffix.png +0 -0
- bootstack/assets/widgets/input.png +0 -0
- bootstack/assets/widgets/list-item-focus.png +0 -0
- bootstack/assets/widgets/list-item-separated.png +0 -0
- bootstack/assets/widgets/menu-item-separated.png +0 -0
- bootstack/assets/widgets/notebook-client-border.png +0 -0
- bootstack/assets/widgets/notebook-pill-active.png +0 -0
- bootstack/assets/widgets/notebook-pill-inactive.png +0 -0
- bootstack/assets/widgets/notebook-tab-active.png +0 -0
- bootstack/assets/widgets/notebook-tab-border.png +0 -0
- bootstack/assets/widgets/notebook-tab-normal.png +0 -0
- bootstack/assets/widgets/notebook-underline.png +0 -0
- bootstack/assets/widgets/progress-bar-horizontal-default.png +0 -0
- bootstack/assets/widgets/progress-bar-horizontal-striped.png +0 -0
- bootstack/assets/widgets/progress-bar-vertical-default.png +0 -0
- bootstack/assets/widgets/progress-bar-vertical-striped.png +0 -0
- bootstack/assets/widgets/progress-trough-horizontal.png +0 -0
- bootstack/assets/widgets/progress-trough-vertical.png +0 -0
- bootstack/assets/widgets/radio-selected.png +0 -0
- bootstack/assets/widgets/radio-unselected.png +0 -0
- bootstack/assets/widgets/scrollbar-horizontal-rounded.png +0 -0
- bootstack/assets/widgets/scrollbar-vertical-rounded.png +0 -0
- bootstack/assets/widgets/separator-horizontal.png +0 -0
- bootstack/assets/widgets/separator-vertical.png +0 -0
- bootstack/assets/widgets/slider-handle-focus.png +0 -0
- bootstack/assets/widgets/slider-handle.png +0 -0
- bootstack/assets/widgets/slider-track-horizontal.png +0 -0
- bootstack/assets/widgets/slider-track-vertical.png +0 -0
- bootstack/assets/widgets/switch-off.png +0 -0
- bootstack/assets/widgets/switch-on.png +0 -0
- bootstack/assets/widgets/tabs-bar-horizontal.png +0 -0
- bootstack/assets/widgets/tabs-bar-vertical.png +0 -0
- bootstack/assets/widgets/tabs-pill.png +0 -0
- bootstack/cli/__init__.py +124 -0
- bootstack/cli/__main__.py +6 -0
- bootstack/cli/add.py +439 -0
- bootstack/cli/build.py +115 -0
- bootstack/cli/config.py +287 -0
- bootstack/cli/demo.py +1267 -0
- bootstack/cli/doctor.py +195 -0
- bootstack/cli/list_cmd.py +71 -0
- bootstack/cli/promote.py +120 -0
- bootstack/cli/pyinstaller.py +246 -0
- bootstack/cli/run.py +99 -0
- bootstack/cli/start.py +105 -0
- bootstack/cli/templates/__init__.py +861 -0
- bootstack/constants.py +325 -0
- bootstack/core/__init__.py +34 -0
- bootstack/core/capabilities/__init__.py +45 -0
- bootstack/core/capabilities/after.py +103 -0
- bootstack/core/capabilities/bind.py +154 -0
- bootstack/core/capabilities/bindtags.py +112 -0
- bootstack/core/capabilities/busy.py +61 -0
- bootstack/core/capabilities/clipboard.py +88 -0
- bootstack/core/capabilities/focus.py +118 -0
- bootstack/core/capabilities/grab.py +65 -0
- bootstack/core/capabilities/grid.py +188 -0
- bootstack/core/capabilities/localization.py +231 -0
- bootstack/core/capabilities/pack.py +119 -0
- bootstack/core/capabilities/place.py +92 -0
- bootstack/core/capabilities/selection.py +136 -0
- bootstack/core/capabilities/signals.py +242 -0
- bootstack/core/capabilities/winfo.py +315 -0
- bootstack/core/colorutils.py +234 -0
- bootstack/core/exceptions.py +95 -0
- bootstack/core/images.py +283 -0
- bootstack/core/localization/README.md +90 -0
- bootstack/core/localization/__init__.py +13 -0
- bootstack/core/localization/intl_format.py +580 -0
- bootstack/core/localization/msgcat.py +425 -0
- bootstack/core/localization/specs.py +143 -0
- bootstack/core/mixins/__init__.py +1 -0
- bootstack/core/mixins/ttk_state.py +35 -0
- bootstack/core/mixins/widget.py +132 -0
- bootstack/core/publisher.py +147 -0
- bootstack/core/signals/README.md +112 -0
- bootstack/core/signals/__init__.py +8 -0
- bootstack/core/signals/integration.py +100 -0
- bootstack/core/signals/signal.py +317 -0
- bootstack/core/signals/types.py +4 -0
- bootstack/core/validation/__init__.py +5 -0
- bootstack/core/validation/types.py +13 -0
- bootstack/core/validation/validation_result.py +17 -0
- bootstack/core/validation/validation_rules.py +112 -0
- bootstack/core/variables.py +62 -0
- bootstack/datasource/README.md +607 -0
- bootstack/datasource/__init__.py +51 -0
- bootstack/datasource/base.py +474 -0
- bootstack/datasource/file_source.py +541 -0
- bootstack/datasource/memory_source.py +482 -0
- bootstack/datasource/sqlite_source.py +453 -0
- bootstack/datasource/types.py +259 -0
- bootstack/dialogs/__init__.py +56 -0
- bootstack/dialogs/colorchooser.py +674 -0
- bootstack/dialogs/colordropper.py +257 -0
- bootstack/dialogs/datedialog.py +404 -0
- bootstack/dialogs/dialog.py +514 -0
- bootstack/dialogs/filterdialog.py +358 -0
- bootstack/dialogs/fontdialog.py +339 -0
- bootstack/dialogs/formdialog.py +541 -0
- bootstack/dialogs/message.py +489 -0
- bootstack/dialogs/query.py +561 -0
- bootstack/py.typed +1 -0
- bootstack/runtime/__init__.py +3 -0
- bootstack/runtime/app.py +879 -0
- bootstack/runtime/base_window.py +786 -0
- bootstack/runtime/events.py +399 -0
- bootstack/runtime/menu.py +510 -0
- bootstack/runtime/shortcuts.py +423 -0
- bootstack/runtime/tk_patch.py +31 -0
- bootstack/runtime/toplevel.py +131 -0
- bootstack/runtime/utility.py +371 -0
- bootstack/runtime/visual_focus.py +228 -0
- bootstack/runtime/window_utilities.py +1043 -0
- bootstack/style/__init__.py +5498 -0
- bootstack/style/bootstyle.py +507 -0
- bootstack/style/bootstyle_builder_base.py +752 -0
- bootstack/style/bootstyle_builder_mixed.py +93 -0
- bootstack/style/bootstyle_builder_tk.py +109 -0
- bootstack/style/bootstyle_builder_ttk.py +354 -0
- bootstack/style/builders/__init__.py +51 -0
- bootstack/style/builders/badge.py +44 -0
- bootstack/style/builders/button.py +453 -0
- bootstack/style/builders/buttongroup.py +344 -0
- bootstack/style/builders/calendar.py +271 -0
- bootstack/style/builders/checkbutton.py +95 -0
- bootstack/style/builders/combobox.py +112 -0
- bootstack/style/builders/contextmenu.py +268 -0
- bootstack/style/builders/entry.py +83 -0
- bootstack/style/builders/expander.py +171 -0
- bootstack/style/builders/field.py +312 -0
- bootstack/style/builders/frame.py +27 -0
- bootstack/style/builders/label.py +28 -0
- bootstack/style/builders/labelframe.py +41 -0
- bootstack/style/builders/listview.py +267 -0
- bootstack/style/builders/menubar.py +74 -0
- bootstack/style/builders/menubutton.py +408 -0
- bootstack/style/builders/notebook.py +316 -0
- bootstack/style/builders/panedwindow.py +25 -0
- bootstack/style/builders/progressbar.py +71 -0
- bootstack/style/builders/radiobutton.py +68 -0
- bootstack/style/builders/scale.py +66 -0
- bootstack/style/builders/scrollbar.py +360 -0
- bootstack/style/builders/separator.py +45 -0
- bootstack/style/builders/sidenav.py +313 -0
- bootstack/style/builders/sizegrip.py +15 -0
- bootstack/style/builders/spinbox.py +119 -0
- bootstack/style/builders/switch.py +67 -0
- bootstack/style/builders/tabitem.py +205 -0
- bootstack/style/builders/toolbutton.py +260 -0
- bootstack/style/builders/tooltip.py +26 -0
- bootstack/style/builders/treeview.py +269 -0
- bootstack/style/builders/utils.py +404 -0
- bootstack/style/builders_tk/__init__.py +16 -0
- bootstack/style/builders_tk/defaults.py +229 -0
- bootstack/style/element.py +173 -0
- bootstack/style/style.py +499 -0
- bootstack/style/theme_provider.py +449 -0
- bootstack/style/tk_patch.py +5 -0
- bootstack/style/token_maps.py +42 -0
- bootstack/style/types.py +32 -0
- bootstack/style/typography.py +527 -0
- bootstack/style/utility.py +696 -0
- bootstack/themes/__init__.py +12 -0
- bootstack/themes/standard.py +415 -0
- bootstack/themes/user.py +45 -0
- bootstack/widgets/__init__.py +53 -0
- bootstack/widgets/composites/__init__.py +38 -0
- bootstack/widgets/composites/accordion.py +385 -0
- bootstack/widgets/composites/appshell.py +445 -0
- bootstack/widgets/composites/buttongroup.py +391 -0
- bootstack/widgets/composites/calendar.py +914 -0
- bootstack/widgets/composites/compositeframe.py +282 -0
- bootstack/widgets/composites/contextmenu.py +1754 -0
- bootstack/widgets/composites/dateentry.py +261 -0
- bootstack/widgets/composites/dropdownbutton.py +190 -0
- bootstack/widgets/composites/expander.py +508 -0
- bootstack/widgets/composites/field.py +448 -0
- bootstack/widgets/composites/floodgauge.py +434 -0
- bootstack/widgets/composites/form.py +983 -0
- bootstack/widgets/composites/labeledscale.py +209 -0
- bootstack/widgets/composites/list/__init__.py +15 -0
- bootstack/widgets/composites/list/listitem.py +733 -0
- bootstack/widgets/composites/list/listview.py +1507 -0
- bootstack/widgets/composites/menubar.py +303 -0
- bootstack/widgets/composites/meter.py +882 -0
- bootstack/widgets/composites/numericentry.py +183 -0
- bootstack/widgets/composites/pagestack.py +330 -0
- bootstack/widgets/composites/passwordentry.py +149 -0
- bootstack/widgets/composites/pathentry.py +223 -0
- bootstack/widgets/composites/radiogroup.py +466 -0
- bootstack/widgets/composites/scrolledtext.py +388 -0
- bootstack/widgets/composites/scrolledtext.pyi +186 -0
- bootstack/widgets/composites/scrollview.py +675 -0
- bootstack/widgets/composites/selectbox.py +544 -0
- bootstack/widgets/composites/sidenav/__init__.py +24 -0
- bootstack/widgets/composites/sidenav/group.py +485 -0
- bootstack/widgets/composites/sidenav/header.py +83 -0
- bootstack/widgets/composites/sidenav/item.py +413 -0
- bootstack/widgets/composites/sidenav/separator.py +51 -0
- bootstack/widgets/composites/sidenav/view.py +919 -0
- bootstack/widgets/composites/spinnerentry.py +232 -0
- bootstack/widgets/composites/tableview/__init__.py +5 -0
- bootstack/widgets/composites/tableview/tableview.py +2254 -0
- bootstack/widgets/composites/tableview/types.py +169 -0
- bootstack/widgets/composites/tabs/__init__.py +6 -0
- bootstack/widgets/composites/tabs/tabitem.py +372 -0
- bootstack/widgets/composites/tabs/tabs.py +478 -0
- bootstack/widgets/composites/tabs/tabview.py +352 -0
- bootstack/widgets/composites/textentry.py +90 -0
- bootstack/widgets/composites/timeentry.py +189 -0
- bootstack/widgets/composites/toast.py +364 -0
- bootstack/widgets/composites/togglegroup.py +382 -0
- bootstack/widgets/composites/toolbar.py +393 -0
- bootstack/widgets/composites/tooltip.py +404 -0
- bootstack/widgets/internal/__init__.py +0 -0
- bootstack/widgets/internal/wrapper_base.py +304 -0
- bootstack/widgets/mixins/__init__.py +25 -0
- bootstack/widgets/mixins/configure_mixin.py +186 -0
- bootstack/widgets/mixins/entry_mixin.py +70 -0
- bootstack/widgets/mixins/font_mixin.py +346 -0
- bootstack/widgets/mixins/icon_mixin.py +38 -0
- bootstack/widgets/mixins/localization_mixin.py +255 -0
- bootstack/widgets/mixins/signal_mixin.py +272 -0
- bootstack/widgets/mixins/validation_mixin.py +204 -0
- bootstack/widgets/parts/__init__.py +11 -0
- bootstack/widgets/parts/numberentry_part.py +345 -0
- bootstack/widgets/parts/spinnerentry_part.py +394 -0
- bootstack/widgets/parts/textentry_part.py +344 -0
- bootstack/widgets/primitives/__init__.py +55 -0
- bootstack/widgets/primitives/badge.py +44 -0
- bootstack/widgets/primitives/button.py +89 -0
- bootstack/widgets/primitives/card.py +66 -0
- bootstack/widgets/primitives/checkbutton.py +124 -0
- bootstack/widgets/primitives/checktoggle.py +53 -0
- bootstack/widgets/primitives/combobox.py +165 -0
- bootstack/widgets/primitives/entry.py +98 -0
- bootstack/widgets/primitives/frame.py +206 -0
- bootstack/widgets/primitives/gridframe.py +479 -0
- bootstack/widgets/primitives/label.py +95 -0
- bootstack/widgets/primitives/labelframe.py +63 -0
- bootstack/widgets/primitives/menubutton.py +118 -0
- bootstack/widgets/primitives/notebook.py +551 -0
- bootstack/widgets/primitives/optionmenu.py +248 -0
- bootstack/widgets/primitives/packframe.py +228 -0
- bootstack/widgets/primitives/panedwindow.py +58 -0
- bootstack/widgets/primitives/progressbar.py +95 -0
- bootstack/widgets/primitives/radiobutton.py +115 -0
- bootstack/widgets/primitives/radiotoggle.py +50 -0
- bootstack/widgets/primitives/scale.py +85 -0
- bootstack/widgets/primitives/scrollbar.py +56 -0
- bootstack/widgets/primitives/separator.py +56 -0
- bootstack/widgets/primitives/sizegrip.py +47 -0
- bootstack/widgets/primitives/spinbox.py +91 -0
- bootstack/widgets/primitives/switch.py +41 -0
- bootstack/widgets/primitives/treeview.py +77 -0
- bootstack/widgets/types.py +20 -0
- bootstack-0.1.0a1.dist-info/METADATA +196 -0
- bootstack-0.1.0a1.dist-info/RECORD +419 -0
- bootstack-0.1.0a1.dist-info/WHEEL +5 -0
- bootstack-0.1.0a1.dist-info/entry_points.txt +2 -0
- bootstack-0.1.0a1.dist-info/licenses/LICENSE +22 -0
- bootstack-0.1.0a1.dist-info/licenses/NOTICE +10 -0
- bootstack-0.1.0a1.dist-info/top_level.txt +1 -0
bootstack/constants.py
ADDED
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
"""Constants and type aliases for bootstack.
|
|
2
|
+
|
|
3
|
+
This module defines constants and type aliases used throughout bootstack,
|
|
4
|
+
including tkinter/ttk configuration values and bootstack-specific enums.
|
|
5
|
+
|
|
6
|
+
The module provides:
|
|
7
|
+
- Type aliases using Literal for better type checking
|
|
8
|
+
- Standard tkinter constants (anchor, fill, relief, etc.)
|
|
9
|
+
- TTkbootstrap-specific constants (bootstyle colors and types)
|
|
10
|
+
- Final-typed constants for IDE autocomplete
|
|
11
|
+
|
|
12
|
+
All constants are exported in __all__ for easy wildcard import:
|
|
13
|
+
```python
|
|
14
|
+
from bootstack.constants import *
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Type Aliases:
|
|
18
|
+
Anchor: Widget anchor positions (n, s, e, w, nw, ne, sw, se, center)
|
|
19
|
+
Fill: Fill modes for pack geometry manager (none, x, y, both)
|
|
20
|
+
Side: Widget placement side (left, top, right, bottom)
|
|
21
|
+
Relief: Border relief style (raised, sunken, flat, ridge, groove, solid)
|
|
22
|
+
Orient: Widget orientation (horizontal, vertical)
|
|
23
|
+
State: Widget state (normal, disabled, active, hidden, readonly)
|
|
24
|
+
BootColor: Bootstyle color names (primary, secondary, success, etc.)
|
|
25
|
+
BootType: Bootstyle type modifiers (outline, link, toggle, etc.)
|
|
26
|
+
|
|
27
|
+
Example:
|
|
28
|
+
```python
|
|
29
|
+
import bootstack as bs
|
|
30
|
+
from bootstack.constants import *
|
|
31
|
+
|
|
32
|
+
root = bs.Window()
|
|
33
|
+
|
|
34
|
+
# Use constants for cleaner code
|
|
35
|
+
btn = bs.Button(root, text="OK", bootstyle=SUCCESS)
|
|
36
|
+
btn.pack(side=LEFT, fill=X, padx=10)
|
|
37
|
+
|
|
38
|
+
root.mainloop()
|
|
39
|
+
```
|
|
40
|
+
"""
|
|
41
|
+
from __future__ import annotations
|
|
42
|
+
|
|
43
|
+
from typing import Final, Literal
|
|
44
|
+
|
|
45
|
+
# ---------------------------
|
|
46
|
+
# Type aliases (Literal unions)
|
|
47
|
+
# ---------------------------
|
|
48
|
+
|
|
49
|
+
Anchor = Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"]
|
|
50
|
+
|
|
51
|
+
# Tk uses the same value set for -fill and many APIs call this "sticky"
|
|
52
|
+
Sticky = Literal["none", "x", "y", "both"]
|
|
53
|
+
Fill = Sticky
|
|
54
|
+
|
|
55
|
+
Side = Literal["left", "top", "right", "bottom"]
|
|
56
|
+
|
|
57
|
+
Relief = Literal["raised", "sunken", "flat", "ridge", "groove", "solid"]
|
|
58
|
+
|
|
59
|
+
Orient = Literal["horizontal", "vertical"]
|
|
60
|
+
|
|
61
|
+
Tabs = Literal["numeric"]
|
|
62
|
+
|
|
63
|
+
Wrap = Literal["char", "word"]
|
|
64
|
+
|
|
65
|
+
Align = Literal["baseline"]
|
|
66
|
+
|
|
67
|
+
TkBoolean = Literal[0, 1, True, False]
|
|
68
|
+
|
|
69
|
+
BorderMode = Literal["inside", "outside"]
|
|
70
|
+
|
|
71
|
+
State = Literal["normal", "disabled", "active", "hidden", "readonly"]
|
|
72
|
+
|
|
73
|
+
MenuItemType = Literal["cascade", "checkbutton", "command", "radiobutton", "separator"]
|
|
74
|
+
|
|
75
|
+
SelectMode = Literal["single", "browse", "multiple", "extended"]
|
|
76
|
+
|
|
77
|
+
ActiveStyle = Literal["none", "dotbox", "underline"]
|
|
78
|
+
|
|
79
|
+
PieStyle = Literal["pieslice", "chord", "arc"]
|
|
80
|
+
|
|
81
|
+
LineCap = Literal["butt", "projecting", "round"]
|
|
82
|
+
|
|
83
|
+
LineJoin = Literal["bevel", "miter", "round"]
|
|
84
|
+
|
|
85
|
+
IndexPos = Literal["first", "last"]
|
|
86
|
+
|
|
87
|
+
ViewArg = Literal["moveto", "scroll", "units", "pages"]
|
|
88
|
+
|
|
89
|
+
TtkTheme = Literal["clam", "alt", "default"]
|
|
90
|
+
|
|
91
|
+
MeterMode = Literal["full", "semi"]
|
|
92
|
+
|
|
93
|
+
ProgressMode = Literal["determinate", "indeterminate"]
|
|
94
|
+
|
|
95
|
+
BootColor = Literal["primary", "secondary", "success", "danger", "warning", "info", "light", "dark"]
|
|
96
|
+
|
|
97
|
+
BootType = Literal["outline", "link", "toggle", "inverse", "striped", "toolbutton", "square"]
|
|
98
|
+
|
|
99
|
+
TreeviewDisplay = Literal["tree", "headings", "tree headings"]
|
|
100
|
+
|
|
101
|
+
# ---------------------------
|
|
102
|
+
# Booleans (legacy Tk style)
|
|
103
|
+
# ---------------------------
|
|
104
|
+
NO = FALSE = OFF = 0 # type: Final[TkBoolean]
|
|
105
|
+
YES = TRUE = ON = 1 # type: Final[TkBoolean]
|
|
106
|
+
|
|
107
|
+
# ---------------------------
|
|
108
|
+
# -anchor / -sticky
|
|
109
|
+
# ---------------------------
|
|
110
|
+
N: Final[Anchor] = "n"
|
|
111
|
+
S: Final[Anchor] = "s"
|
|
112
|
+
W: Final[Anchor] = "w"
|
|
113
|
+
E: Final[Anchor] = "e"
|
|
114
|
+
NW: Final[Anchor] = "nw"
|
|
115
|
+
SW: Final[Anchor] = "sw"
|
|
116
|
+
NE: Final[Anchor] = "ne"
|
|
117
|
+
SE: Final[Anchor] = "se"
|
|
118
|
+
NS: Final[Anchor] = "ns"
|
|
119
|
+
EW: Final[Anchor] = "ew"
|
|
120
|
+
NSEW: Final[Anchor] = "nsew"
|
|
121
|
+
CENTER: Final[Anchor] = "center"
|
|
122
|
+
|
|
123
|
+
# ---------------------------
|
|
124
|
+
# -fill
|
|
125
|
+
# ---------------------------
|
|
126
|
+
NONE: Final[Fill] = "none"
|
|
127
|
+
X: Final[Fill] = "x"
|
|
128
|
+
Y: Final[Fill] = "y"
|
|
129
|
+
BOTH: Final[Fill] = "both"
|
|
130
|
+
|
|
131
|
+
# ---------------------------
|
|
132
|
+
# -side
|
|
133
|
+
# ---------------------------
|
|
134
|
+
LEFT: Final[Side] = "left"
|
|
135
|
+
TOP: Final[Side] = "top"
|
|
136
|
+
RIGHT: Final[Side] = "right"
|
|
137
|
+
BOTTOM: Final[Side] = "bottom"
|
|
138
|
+
|
|
139
|
+
# ---------------------------
|
|
140
|
+
# -relief
|
|
141
|
+
# ---------------------------
|
|
142
|
+
RAISED: Final[Relief] = "raised"
|
|
143
|
+
SUNKEN: Final[Relief] = "sunken"
|
|
144
|
+
FLAT: Final[Relief] = "flat"
|
|
145
|
+
RIDGE: Final[Relief] = "ridge"
|
|
146
|
+
GROOVE: Final[Relief] = "groove"
|
|
147
|
+
SOLID: Final[Relief] = "solid"
|
|
148
|
+
|
|
149
|
+
# ---------------------------
|
|
150
|
+
# -orient
|
|
151
|
+
# ---------------------------
|
|
152
|
+
HORIZONTAL: Final[Orient] = "horizontal"
|
|
153
|
+
VERTICAL: Final[Orient] = "vertical"
|
|
154
|
+
|
|
155
|
+
# ---------------------------
|
|
156
|
+
# -tabs
|
|
157
|
+
# ---------------------------
|
|
158
|
+
NUMERIC: Final[Tabs] = "numeric"
|
|
159
|
+
|
|
160
|
+
# ---------------------------
|
|
161
|
+
# -wrap
|
|
162
|
+
# ---------------------------
|
|
163
|
+
CHAR: Final[Wrap] = "char"
|
|
164
|
+
WORD: Final[Wrap] = "word"
|
|
165
|
+
|
|
166
|
+
# ---------------------------
|
|
167
|
+
# -align
|
|
168
|
+
# ---------------------------
|
|
169
|
+
BASELINE: Final[Align] = "baseline"
|
|
170
|
+
|
|
171
|
+
# ---------------------------
|
|
172
|
+
# -bordermode
|
|
173
|
+
# ---------------------------
|
|
174
|
+
INSIDE: Final[BorderMode] = "inside"
|
|
175
|
+
OUTSIDE: Final[BorderMode] = "outside"
|
|
176
|
+
|
|
177
|
+
# ---------------------------
|
|
178
|
+
# Special tags / marks / positions
|
|
179
|
+
# ---------------------------
|
|
180
|
+
SEL: Final[str] = "sel"
|
|
181
|
+
SEL_FIRST: Final[str] = "sel.first"
|
|
182
|
+
SEL_LAST: Final[str] = "sel.last"
|
|
183
|
+
END: Final[str] = "end"
|
|
184
|
+
INSERT: Final[str] = "insert"
|
|
185
|
+
CURRENT: Final[str] = "current"
|
|
186
|
+
ANCHOR: Final[str] = "anchor"
|
|
187
|
+
ALL: Final[str] = "all" # e.g., Canvas.delete(ALL)
|
|
188
|
+
|
|
189
|
+
# ---------------------------
|
|
190
|
+
# States
|
|
191
|
+
# ---------------------------
|
|
192
|
+
NORMAL: Final[State] = "normal"
|
|
193
|
+
DISABLED: Final[State] = "disabled"
|
|
194
|
+
ACTIVE: Final[State] = "active"
|
|
195
|
+
HIDDEN: Final[State] = "hidden" # Canvas state
|
|
196
|
+
READONLY: Final[State] = "readonly" # ttk state
|
|
197
|
+
|
|
198
|
+
# ---------------------------
|
|
199
|
+
# Menu item types
|
|
200
|
+
# ---------------------------
|
|
201
|
+
CASCADE: Final[MenuItemType] = "cascade"
|
|
202
|
+
CHECKBUTTON: Final[MenuItemType] = "checkbutton"
|
|
203
|
+
COMMAND: Final[MenuItemType] = "command"
|
|
204
|
+
RADIOBUTTON: Final[MenuItemType] = "radiobutton"
|
|
205
|
+
SEPARATOR: Final[MenuItemType] = "separator"
|
|
206
|
+
|
|
207
|
+
# ---------------------------
|
|
208
|
+
# Listbox modes / styles
|
|
209
|
+
# ---------------------------
|
|
210
|
+
SINGLE: Final[SelectMode] = "single"
|
|
211
|
+
BROWSE: Final[SelectMode] = "browse"
|
|
212
|
+
MULTIPLE: Final[SelectMode] = "multiple"
|
|
213
|
+
EXTENDED: Final[SelectMode] = "extended"
|
|
214
|
+
|
|
215
|
+
DOTBOX: Final[ActiveStyle] = "dotbox"
|
|
216
|
+
UNDERLINE: Final[ActiveStyle] = "underline"
|
|
217
|
+
# (NONE from Fill is also a valid ActiveStyle value)
|
|
218
|
+
|
|
219
|
+
# ---------------------------
|
|
220
|
+
# Canvas styles
|
|
221
|
+
# ---------------------------
|
|
222
|
+
PIESLICE: Final[PieStyle] = "pieslice"
|
|
223
|
+
CHORD: Final[PieStyle] = "chord"
|
|
224
|
+
ARC: Final[PieStyle] = "arc"
|
|
225
|
+
|
|
226
|
+
FIRST: Final[IndexPos] = "first"
|
|
227
|
+
LAST: Final[IndexPos] = "last"
|
|
228
|
+
|
|
229
|
+
BUTT: Final[LineCap] = "butt"
|
|
230
|
+
PROJECTING: Final[LineCap] = "projecting"
|
|
231
|
+
ROUND: Final[LineCap] = "round"
|
|
232
|
+
|
|
233
|
+
BEVEL: Final[LineJoin] = "bevel"
|
|
234
|
+
MITER: Final[LineJoin] = "miter"
|
|
235
|
+
# ROUND already defined above for LineCap; same literal is valid for LineJoin too
|
|
236
|
+
|
|
237
|
+
# ---------------------------
|
|
238
|
+
# xview / yview args
|
|
239
|
+
# ---------------------------
|
|
240
|
+
MOVETO: Final[ViewArg] = "moveto"
|
|
241
|
+
SCROLL: Final[ViewArg] = "scroll"
|
|
242
|
+
UNITS: Final[ViewArg] = "units"
|
|
243
|
+
PAGES: Final[ViewArg] = "pages"
|
|
244
|
+
|
|
245
|
+
# ---------------------------
|
|
246
|
+
# Themes / ttk themes
|
|
247
|
+
# ---------------------------
|
|
248
|
+
DEFAULT: Final[str] = "default"
|
|
249
|
+
DEFAULT_THEME: Final[str] = "bootstrap-light"
|
|
250
|
+
# Shared minimum column width default for form layouts
|
|
251
|
+
DEFAULT_MIN_COL_WIDTH: Final[int] = 275
|
|
252
|
+
|
|
253
|
+
TTK_CLAM: Final[TtkTheme] = "clam"
|
|
254
|
+
TTK_ALT: Final[TtkTheme] = "alt"
|
|
255
|
+
TTK_DEFAULT: Final[TtkTheme] = "default"
|
|
256
|
+
|
|
257
|
+
# ---------------------------
|
|
258
|
+
# Meter / progressbar
|
|
259
|
+
# ---------------------------
|
|
260
|
+
FULL: Final[MeterMode] = "full"
|
|
261
|
+
SEMI: Final[MeterMode] = "semi"
|
|
262
|
+
DETERMINATE: Final[ProgressMode] = "determinate"
|
|
263
|
+
INDETERMINATE: Final[ProgressMode] = "indeterminate"
|
|
264
|
+
|
|
265
|
+
# ---------------------------
|
|
266
|
+
# Bootstyle colors / types
|
|
267
|
+
# ---------------------------
|
|
268
|
+
PRIMARY: Final[BootColor] = "primary"
|
|
269
|
+
SECONDARY: Final[BootColor] = "secondary"
|
|
270
|
+
SUCCESS: Final[BootColor] = "success"
|
|
271
|
+
DANGER: Final[BootColor] = "danger"
|
|
272
|
+
WARNING: Final[BootColor] = "warning"
|
|
273
|
+
INFO: Final[BootColor] = "info"
|
|
274
|
+
LIGHT: Final[BootColor] = "light"
|
|
275
|
+
DARK: Final[BootColor] = "dark"
|
|
276
|
+
|
|
277
|
+
OUTLINE: Final[BootType] = "outline"
|
|
278
|
+
LINK: Final[BootType] = "link"
|
|
279
|
+
TOGGLE: Final[BootType] = "toggle"
|
|
280
|
+
INVERSE: Final[BootType] = "inverse"
|
|
281
|
+
STRIPED: Final[BootType] = "striped"
|
|
282
|
+
TOOLBUTTON: Final[BootType] = "toolbutton"
|
|
283
|
+
SQUARE: Final[BootType] = "square"
|
|
284
|
+
|
|
285
|
+
# ---------------------------
|
|
286
|
+
# Treeview
|
|
287
|
+
# ---------------------------
|
|
288
|
+
TREE: Final[TreeviewDisplay] = "tree"
|
|
289
|
+
HEADINGS: Final[TreeviewDisplay] = "headings"
|
|
290
|
+
TREEHEADINGS: Final[TreeviewDisplay] = "tree headings"
|
|
291
|
+
|
|
292
|
+
# ---------------------------
|
|
293
|
+
# Public exports
|
|
294
|
+
# ---------------------------
|
|
295
|
+
__all__ = [
|
|
296
|
+
# literals (type aliases)
|
|
297
|
+
"Anchor", "Sticky", "Fill", "Side", "Relief", "Orient", "Tabs", "Wrap",
|
|
298
|
+
"Align", "BorderMode", "State", "MenuItemType", "SelectMode", "ActiveStyle",
|
|
299
|
+
"PieStyle", "LineCap", "LineJoin", "IndexPos", "ViewArg", "TtkTheme",
|
|
300
|
+
"MeterMode", "ProgressMode", "BootColor", "BootType", "TreeviewDisplay",
|
|
301
|
+
# constants
|
|
302
|
+
"NO", "FALSE", "OFF", "YES", "TRUE", "ON",
|
|
303
|
+
"N", "S", "W", "E", "NW", "SW", "NE", "SE", "NS", "EW", "NSEW", "CENTER",
|
|
304
|
+
"NONE", "X", "Y", "BOTH",
|
|
305
|
+
"LEFT", "TOP", "RIGHT", "BOTTOM",
|
|
306
|
+
"RAISED", "SUNKEN", "FLAT", "RIDGE", "GROOVE", "SOLID",
|
|
307
|
+
"HORIZONTAL", "VERTICAL",
|
|
308
|
+
"NUMERIC",
|
|
309
|
+
"CHAR", "WORD",
|
|
310
|
+
"BASELINE",
|
|
311
|
+
"INSIDE", "OUTSIDE",
|
|
312
|
+
"SEL", "SEL_FIRST", "SEL_LAST", "END", "INSERT", "CURRENT", "ANCHOR", "ALL",
|
|
313
|
+
"NORMAL", "DISABLED", "ACTIVE", "HIDDEN", "READONLY",
|
|
314
|
+
"CASCADE", "CHECKBUTTON", "COMMAND", "RADIOBUTTON", "SEPARATOR",
|
|
315
|
+
"SINGLE", "BROWSE", "MULTIPLE", "EXTENDED",
|
|
316
|
+
"DOTBOX", "UNDERLINE",
|
|
317
|
+
"PIESLICE", "CHORD", "ARC", "FIRST", "LAST",
|
|
318
|
+
"BUTT", "PROJECTING", "ROUND", "BEVEL", "MITER",
|
|
319
|
+
"MOVETO", "SCROLL", "UNITS", "PAGES",
|
|
320
|
+
"DEFAULT", "DEFAULT_THEME", "DEFAULT_MIN_COL_WIDTH", "TTK_CLAM", "TTK_ALT", "TTK_DEFAULT",
|
|
321
|
+
"FULL", "SEMI", "DETERMINATE", "INDETERMINATE",
|
|
322
|
+
"PRIMARY", "SECONDARY", "SUCCESS", "DANGER", "WARNING", "INFO", "LIGHT", "DARK",
|
|
323
|
+
"OUTLINE", "LINK", "TOGGLE", "INVERSE", "STRIPED", "TOOLBUTTON", "SQUARE",
|
|
324
|
+
"TREE", "HEADINGS", "TREEHEADINGS",
|
|
325
|
+
]
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""Core utilities and error types."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from . import colorutils, publisher, localization, validation, signals, capabilities
|
|
6
|
+
from bootstack.core.exceptions import (
|
|
7
|
+
TTKBootstrapError,
|
|
8
|
+
LayoutError,
|
|
9
|
+
ThemeError,
|
|
10
|
+
ConfigError,
|
|
11
|
+
StateError,
|
|
12
|
+
NavigationError,
|
|
13
|
+
BootstyleBuilderError,
|
|
14
|
+
BootstyleParsingError,
|
|
15
|
+
ConfigurationWarning,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
"colorutils",
|
|
20
|
+
"publisher",
|
|
21
|
+
"localization",
|
|
22
|
+
"validation",
|
|
23
|
+
"signals",
|
|
24
|
+
"capabilities",
|
|
25
|
+
"TTKBootstrapError",
|
|
26
|
+
"LayoutError",
|
|
27
|
+
"ThemeError",
|
|
28
|
+
"ConfigError",
|
|
29
|
+
"StateError",
|
|
30
|
+
"NavigationError",
|
|
31
|
+
"BootstyleBuilderError",
|
|
32
|
+
"BootstyleParsingError",
|
|
33
|
+
"ConfigurationWarning",
|
|
34
|
+
]
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""Core widget capabilities for bootstack.
|
|
2
|
+
|
|
3
|
+
This package provides framework services that can be used by widget mixins
|
|
4
|
+
and other parts of the library. Each capability module contains reusable
|
|
5
|
+
logic that mixins delegate to, keeping the mixins themselves as thin glue.
|
|
6
|
+
|
|
7
|
+
Capabilities:
|
|
8
|
+
signals: Signal/Variable binding and normalization
|
|
9
|
+
localization: Text translation and value formatting
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from bootstack.core.capabilities.signals import (
|
|
13
|
+
SignalBinding,
|
|
14
|
+
is_signal,
|
|
15
|
+
is_variable,
|
|
16
|
+
normalize_signal,
|
|
17
|
+
create_signal,
|
|
18
|
+
infer_default_value_for_widget,
|
|
19
|
+
query_binding,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
from bootstack.core.capabilities.localization import (
|
|
23
|
+
resolve_text,
|
|
24
|
+
resolve_variable_text,
|
|
25
|
+
apply_spec,
|
|
26
|
+
get_current_locale,
|
|
27
|
+
create_formatted_signal,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
__all__ = [
|
|
31
|
+
# Signals capability
|
|
32
|
+
"SignalBinding",
|
|
33
|
+
"is_signal",
|
|
34
|
+
"is_variable",
|
|
35
|
+
"normalize_signal",
|
|
36
|
+
"create_signal",
|
|
37
|
+
"infer_default_value_for_widget",
|
|
38
|
+
"query_binding",
|
|
39
|
+
# Localization capability
|
|
40
|
+
"resolve_text",
|
|
41
|
+
"resolve_variable_text",
|
|
42
|
+
"apply_spec",
|
|
43
|
+
"get_current_locale",
|
|
44
|
+
"create_formatted_signal",
|
|
45
|
+
]
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any, Callable
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AfterMixin:
|
|
7
|
+
"""Scheduling helpers (after).
|
|
8
|
+
|
|
9
|
+
Tk’s `after` family lets you schedule callbacks to run later on the Tk event loop.
|
|
10
|
+
|
|
11
|
+
Common uses:
|
|
12
|
+
- Debounce user input (schedule a callback and cancel previous ones).
|
|
13
|
+
- Run periodic UI updates (schedule, then reschedule from inside the callback).
|
|
14
|
+
- Defer work until the UI is idle (`after_idle`) so layout/paint can complete.
|
|
15
|
+
|
|
16
|
+
Notes:
|
|
17
|
+
- Callbacks run on the Tk thread/event loop. If you have long-running work,
|
|
18
|
+
run it off-thread/process and schedule UI updates back onto Tk using `after`.
|
|
19
|
+
- `after` returns an identifier that can be canceled with `after_cancel`.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
def after(self, ms: int, func: Callable[..., Any] | None = None, *args: Any) -> str:
|
|
23
|
+
"""Schedule a callback to run after a delay.
|
|
24
|
+
|
|
25
|
+
Args:
|
|
26
|
+
ms: Delay in milliseconds.
|
|
27
|
+
func: Callback to run. If omitted/None, Tk blocks for `ms` milliseconds
|
|
28
|
+
while still processing events (use sparingly).
|
|
29
|
+
*args: Arguments to pass to `func` when it is called.
|
|
30
|
+
|
|
31
|
+
Returns:
|
|
32
|
+
An identifier that can be used with `after_cancel`.
|
|
33
|
+
"""
|
|
34
|
+
return super().after(ms, func, *args) # type: ignore[misc]
|
|
35
|
+
|
|
36
|
+
def after_idle(self, func: Callable[..., Any], *args: Any) -> str:
|
|
37
|
+
"""Schedule a callback to run when the event loop is idle.
|
|
38
|
+
|
|
39
|
+
Idle callbacks run after Tk has finished processing the current batch of
|
|
40
|
+
events and pending UI work.
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
func: Callback to run.
|
|
44
|
+
*args: Arguments to pass to `func` when it is called.
|
|
45
|
+
|
|
46
|
+
Returns:
|
|
47
|
+
An identifier that can be used with `after_cancel`.
|
|
48
|
+
"""
|
|
49
|
+
return super().after_idle(func, *args) # type: ignore[misc]
|
|
50
|
+
|
|
51
|
+
def after_cancel(self, id: str) -> None:
|
|
52
|
+
"""Cancel a scheduled callback.
|
|
53
|
+
|
|
54
|
+
Args:
|
|
55
|
+
id: The identifier returned by `after` or `after_idle`.
|
|
56
|
+
"""
|
|
57
|
+
return super().after_cancel(id) # type: ignore[misc]
|
|
58
|
+
|
|
59
|
+
# -------------------------------------------------------------------------
|
|
60
|
+
# Convenience helpers (optional)
|
|
61
|
+
# -------------------------------------------------------------------------
|
|
62
|
+
|
|
63
|
+
def after_repeat(self, ms: int, func: Callable[..., Any], *args: Any) -> Callable[[], None]:
|
|
64
|
+
"""Call `func` repeatedly every `ms` milliseconds.
|
|
65
|
+
|
|
66
|
+
This helper schedules `func` and then automatically reschedules it after
|
|
67
|
+
each run. It returns a `cancel()` function you can call to stop repetition.
|
|
68
|
+
|
|
69
|
+
Args:
|
|
70
|
+
ms: Interval in milliseconds.
|
|
71
|
+
func: Callback to run each interval.
|
|
72
|
+
*args: Arguments to pass to `func`.
|
|
73
|
+
|
|
74
|
+
Returns:
|
|
75
|
+
A `cancel()` callable. Call it to stop the repeating schedule.
|
|
76
|
+
|
|
77
|
+
Examples:
|
|
78
|
+
>>> cancel = widget.after_repeat(250, tick)
|
|
79
|
+
>>> cancel()
|
|
80
|
+
"""
|
|
81
|
+
cancelled = False
|
|
82
|
+
token: str | None = None
|
|
83
|
+
|
|
84
|
+
def _run():
|
|
85
|
+
nonlocal token
|
|
86
|
+
if cancelled:
|
|
87
|
+
return
|
|
88
|
+
func(*args)
|
|
89
|
+
token = self.after(ms, _run)
|
|
90
|
+
|
|
91
|
+
token = self.after(ms, _run)
|
|
92
|
+
|
|
93
|
+
def cancel() -> None:
|
|
94
|
+
nonlocal cancelled, token
|
|
95
|
+
cancelled = True
|
|
96
|
+
if token is not None:
|
|
97
|
+
try:
|
|
98
|
+
self.after_cancel(token)
|
|
99
|
+
except Exception:
|
|
100
|
+
pass
|
|
101
|
+
token = None
|
|
102
|
+
|
|
103
|
+
return cancel
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"""Event binding capabilities mixin for bootstack widgets."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from typing import Any, Callable, Optional, Union
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class BindingsMixin:
|
|
8
|
+
"""Event binding and virtual event generation.
|
|
9
|
+
|
|
10
|
+
This mixin documents the *Tkinter-style* binding API (`bind`, `unbind`,
|
|
11
|
+
`bind_all`, etc.) while reflecting bootstack v2’s enhanced event system.
|
|
12
|
+
|
|
13
|
+
Differences from stock Tkinter:
|
|
14
|
+
- Virtual events generated via `event_generate("<<Name>>", data=...)` may
|
|
15
|
+
carry **arbitrary Python objects** as event payload.
|
|
16
|
+
- Event handlers receive an event object with a consistent `.data` attribute:
|
|
17
|
+
- `.data` is the Python object you passed for virtual events.
|
|
18
|
+
- `.data` is `None` for non-virtual events.
|
|
19
|
+
|
|
20
|
+
Notes:
|
|
21
|
+
- Prefer `bind` over `bind_all` unless you truly need a global binding.
|
|
22
|
+
- Return the string `"break"` from a handler to stop further processing.
|
|
23
|
+
- Virtual event data is intended for application-local messaging.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
# ---------------------------------------------------------------------
|
|
27
|
+
# Binding (widget, class, and application/global)
|
|
28
|
+
# ---------------------------------------------------------------------
|
|
29
|
+
|
|
30
|
+
def bind(
|
|
31
|
+
self,
|
|
32
|
+
sequence: Optional[str] = None,
|
|
33
|
+
func: Optional[Callable[..., Any]] = None,
|
|
34
|
+
add: Optional[Union[bool, str]] = None,
|
|
35
|
+
) -> Optional[str]:
|
|
36
|
+
"""Bind an event sequence to a handler.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
sequence: Event pattern string (e.g. "<Button-1>", "<KeyPress>", "<<MyEvent>>").
|
|
40
|
+
If None, returns a string describing all bindings on this widget.
|
|
41
|
+
func: Handler callable. The handler is called with a single argument:
|
|
42
|
+
the event object. For bootstack enhanced events, `event.data`
|
|
43
|
+
is always present (None for regular events, payload for virtual events).
|
|
44
|
+
add: If true/"+" then this binding is added in addition to existing bindings.
|
|
45
|
+
If false/None then any existing binding for this sequence is replaced.
|
|
46
|
+
|
|
47
|
+
Returns:
|
|
48
|
+
If `func` is provided, returns an internal Tk binding id that can be used
|
|
49
|
+
with `unbind(sequence, funcid)`. If `func` is None, returns a Tcl binding
|
|
50
|
+
script string (Tkinter behavior varies by version) or None.
|
|
51
|
+
|
|
52
|
+
Examples:
|
|
53
|
+
Bind a regular event:
|
|
54
|
+
|
|
55
|
+
widget.bind("<Button-1>", on_click)
|
|
56
|
+
|
|
57
|
+
Bind a virtual event that carries Python data:
|
|
58
|
+
|
|
59
|
+
widget.bind("<<Save>>", on_save)
|
|
60
|
+
widget.event_generate("<<Save>>", data={"path": "doc.txt"})
|
|
61
|
+
"""
|
|
62
|
+
return super().bind(sequence, func, add) # type: ignore[misc]
|
|
63
|
+
|
|
64
|
+
def unbind(self, sequence: str, funcid: str | None = None) -> None:
|
|
65
|
+
"""Remove a binding for an event sequence.
|
|
66
|
+
|
|
67
|
+
Args:
|
|
68
|
+
sequence: The event sequence that was previously bound.
|
|
69
|
+
funcid: The binding id returned from `bind`. If omitted, removes all
|
|
70
|
+
handlers for the given sequence on this widget.
|
|
71
|
+
"""
|
|
72
|
+
return super().unbind(sequence, funcid) # type: ignore[misc]
|
|
73
|
+
|
|
74
|
+
def bind_all(
|
|
75
|
+
self,
|
|
76
|
+
sequence: Optional[str] = None,
|
|
77
|
+
func: Optional[Callable[..., Any]] = None,
|
|
78
|
+
add: Optional[Union[bool, str]] = None,
|
|
79
|
+
) -> Optional[str]:
|
|
80
|
+
"""Bind an event sequence at the application level (all widgets).
|
|
81
|
+
|
|
82
|
+
Use sparingly. This affects *every* widget in the application.
|
|
83
|
+
|
|
84
|
+
Args:
|
|
85
|
+
sequence: Event pattern string.
|
|
86
|
+
func: Handler callable.
|
|
87
|
+
add: Whether to add alongside existing bindings.
|
|
88
|
+
|
|
89
|
+
Returns:
|
|
90
|
+
A binding id when setting a binding, otherwise a binding script string
|
|
91
|
+
(version-dependent) or None.
|
|
92
|
+
"""
|
|
93
|
+
return super().bind_all(sequence, func, add) # type: ignore[misc]
|
|
94
|
+
|
|
95
|
+
def unbind_all(self, sequence: str) -> None:
|
|
96
|
+
"""Remove an application-level binding for the given sequence.
|
|
97
|
+
|
|
98
|
+
Args:
|
|
99
|
+
sequence: The event sequence to unbind.
|
|
100
|
+
"""
|
|
101
|
+
return super().unbind_all(sequence) # type: ignore[misc]
|
|
102
|
+
|
|
103
|
+
def bind_class(
|
|
104
|
+
self,
|
|
105
|
+
className: str,
|
|
106
|
+
sequence: Optional[str] = None,
|
|
107
|
+
func: Optional[Callable[..., Any]] = None,
|
|
108
|
+
add: Optional[Union[bool, str]] = None,
|
|
109
|
+
) -> Optional[str]:
|
|
110
|
+
"""Bind an event sequence to a Tk widget class.
|
|
111
|
+
|
|
112
|
+
This attaches a handler to *all widgets of a given Tk class name*
|
|
113
|
+
(e.g. "TButton", "TEntry").
|
|
114
|
+
|
|
115
|
+
Args:
|
|
116
|
+
className: Tk class name.
|
|
117
|
+
sequence: Event pattern string.
|
|
118
|
+
func: Handler callable.
|
|
119
|
+
add: Whether to add alongside existing bindings.
|
|
120
|
+
|
|
121
|
+
Returns:
|
|
122
|
+
A binding id when setting a binding, otherwise a binding script string
|
|
123
|
+
(version-dependent) or None.
|
|
124
|
+
"""
|
|
125
|
+
return super().bind_class(className, sequence, func, add) # type: ignore[misc]
|
|
126
|
+
|
|
127
|
+
def unbind_class(self, className: str, sequence: str) -> None:
|
|
128
|
+
"""Remove a class-level binding.
|
|
129
|
+
|
|
130
|
+
Args:
|
|
131
|
+
className: Tk class name.
|
|
132
|
+
sequence: Event sequence to unbind for that class.
|
|
133
|
+
"""
|
|
134
|
+
return super().unbind_class(className, sequence) # type: ignore[misc]
|
|
135
|
+
|
|
136
|
+
# ---------------------------------------------------------------------
|
|
137
|
+
# Event generation (including virtual-event payloads)
|
|
138
|
+
# ---------------------------------------------------------------------
|
|
139
|
+
|
|
140
|
+
def event_generate(self, sequence: str, data: Any | None = None, **kw: Any) -> None:
|
|
141
|
+
"""Generate an event.
|
|
142
|
+
|
|
143
|
+
This can synthesize both physical events (like "<Button-1>") and virtual
|
|
144
|
+
events (like "<<MyEvent>>"). For virtual events, bootstack supports
|
|
145
|
+
attaching a Python payload via the `data` parameter.
|
|
146
|
+
|
|
147
|
+
Args:
|
|
148
|
+
sequence: Event sequence to generate (commonly "<<Name>>" for virtual events).
|
|
149
|
+
data: Optional Python object payload for **virtual events**. When provided,
|
|
150
|
+
handlers will receive an event object whose `.data` is this value.
|
|
151
|
+
For non-virtual events, `data` is ignored and `.data` will be None.
|
|
152
|
+
**kw: Additional Tk event fields (e.g. x=..., y=..., rootx=..., rooty=...).
|
|
153
|
+
"""
|
|
154
|
+
return super().event_generate(sequence, data=data, **kw) # type: ignore[misc]
|