Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .commitlintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ["@commitlint/config-conventional"],
};
11 changes: 0 additions & 11 deletions .flake8

This file was deleted.

23 changes: 13 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
repos:
- repo: https://github.com/psf/black
rev: 24.3.0
hooks:
- id: black
entry: black --check

- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
rev: v2.3.0
hooks:
- id: codespell

- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.20.0
hooks:
- id: commitlint
stages: [commit-msg]
additional_dependencies: ["@commitlint/config-conventional"]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.13.0"
hooks:
- id: flake8
- id: ruff
args: ["--fix", "--show-fixes"]
- id: ruff-format
9 changes: 8 additions & 1 deletion examples/03_tauri_ws_menu_dialogs/cone.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,14 @@ def _build_ui(self):
)
vuetify.VTextarea(
v_model=("logs", ""),
style="position: absolute; z-index: 1; bottom: 10px; left: 10px; width: 50vw; background: #fff;",
style=(
"position: absolute;"
"z-index: 1;"
"bottom: 10px;"
"left: 10px;"
"width: 50vw;"
"background: #fff;"
),
)

with layout.toolbar:
Expand Down
6 changes: 5 additions & 1 deletion examples/04_http_ws_multi_windows/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ def build_ui_main(self):
appWindow.onMoved(async ({ payload }) => {
const size = await appWindow.outerSize();
hello_window = trame.utils.tauri.window.WebviewWindow.getByLabel('hello_world');
await hello_window.setPosition(new LogicalPosition((payload.x + size.width) / scaleFactor, payload.y / scaleFactor));
await hello_window.setPosition(
new LogicalPosition(
(payload.x + size.width) / scaleFactor, payload.y / scaleFactor
)
);
});

const hello_world = new trame.utils.tauri.window.WebviewWindow('hello_world', {
Expand Down
76 changes: 40 additions & 36 deletions examples/04_http_ws_multi_windows/server2.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,42 +111,46 @@ def build_ui_main(self):
html.Div("p({{ position }}) - s({{ size }}) - d({{ scale }})")
v3.VDivider(style="margin: 8px;")
with html.Div(v_if=("window_hello_world", False)):
with tauri.Window(
url="http://localhost:4444/index.html?ui=hello_world",
visible=("window_hello_world", False),
title=("child_title", "Hello"),
x=("pos_x", 100),
y=("pos_y", 100),
width=("size_w", 300),
height=("size_h", 300),
options=(
"child_options",
{
# "alwaysOnTop": True,
# "center": True,
# "closable": False,
# "decorations": False,
"focus": False, # Does not work
"minHeight": 200,
"minWidth": 200,
"maxHeight": 800,
"maxWidth": 800,
# "maximizable": False, # You need `"decoration": True` to see this (button will be disabled)
# "minimizable": False, # You need `"decoration": True` to see this (button will be disabled)
# "skipTaskbar": True, # Does not work
"theme": "light",
"fileDropEnabled": False,
},
),
prevent_close=True, # Will not work using Tauri v1: https://github.com/tauri-apps/tauri/issues/8435
moved="position = $event",
resized="size = $event",
scale_changed="scale = $event",
created="{ position, size, scaleFactor: scale } = $event",
closed="window_hello_world = false; window.console.log('evt closed')",
file_drop="window.console.log('file:', $event)",
theme_changed="window.console.log('theme:', $event)",
) as w:
with (
tauri.Window(
url="http://localhost:4444/index.html?ui=hello_world",
visible=("window_hello_world", False),
title=("child_title", "Hello"),
x=("pos_x", 100),
y=("pos_y", 100),
width=("size_w", 300),
height=("size_h", 300),
options=(
"child_options",
{
# "alwaysOnTop": True,
# "center": True,
# "closable": False,
# "decorations": False,
"focus": False, # Does not work
"minHeight": 200,
"minWidth": 200,
"maxHeight": 800,
"maxWidth": 800,
# You need `"decoration": True` to see this (button will be disabled)
# "maximizable": False,
# "minimizable": False,
# Does not work
# "skipTaskbar": True,
"theme": "light",
"fileDropEnabled": False,
},
),
prevent_close=True, # Will not work using Tauri v1: https://github.com/tauri-apps/tauri/issues/8435
moved="position = $event",
resized="size = $event",
scale_changed="scale = $event",
created="{ position, size, scaleFactor: scale } = $event",
closed="window_hello_world = false; window.console.log('evt closed')",
file_drop="window.console.log('file:', $event)",
theme_changed="window.console.log('theme:', $event)",
) as w
):
self.server.controller.trigger_name(w.request_user_attention)
with v3.Template(raw_attrs=['v-slot="data"']):
v3.VTextField(v_model="child_title")
Expand Down
81 changes: 81 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
[project]
name = "trame-tauri"
version = "1.0.1"
description = "Helper widget to provide simpler integration with Tauri"
authors = [
{name = "Kitware Inc."},
]
dependencies = [
"trame-client",
]
requires-python = ">=3.9"
readme = "README.rst"
license = {text = "Apache Software License"}
keywords = ["Python", "Interactive", "Web", "Application", "Framework"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"License :: OSI Approved :: Apache Software License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Software Development :: Libraries :: Application Frameworks",
"Topic :: Software Development :: Libraries :: Python Modules",
]

[project.optional-dependencies]
dev = [
"pre-commit",
"ruff",
"pytest",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build]
include = [
"src/trame_tauri/module/serve/**",
"src/**/*.py",
]

[tool.hatch.build.targets.wheel]
packages = [
"src/trame_tauri",
"src/trame",
]

[tool.semantic_release]
version_toml = ["pyproject.toml:project.version"]
version_variables = ["src/trame_tauri/__init__.py:__version__"]
build_command = "pip install uv && uv build"

[tool.ruff]
line-length = 88
indent-width = 4
target-version = "py39"

[tool.ruff.lint]
select = ["E", "W", "F"]
ignore = []
fixable = ["ALL"]
unfixable = []


[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
docstring-code-format = true

# This only has an effect when the `docstring-code-format` setting is
# enabled.
docstring-code-line-length = "dynamic"

[tool.ruff.lint.pycodestyle]
max-line-length = 120

[lint.pydocstyle]
convention = "google"
33 changes: 0 additions & 33 deletions setup.cfg

This file was deleted.

3 changes: 0 additions & 3 deletions setup.py

This file was deleted.

File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions src/trame/modules/tauri.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from trame_tauri.module import * # noqa: F403
File renamed without changes.
2 changes: 1 addition & 1 deletion trame/widgets/tauri.py → src/trame/widgets/tauri.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from trame_tauri.widgets.tauri import *
from trame_tauri.widgets.tauri import * # noqa: F403


def initialize(server):
Expand Down
1 change: 1 addition & 0 deletions src/trame_tauri/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "1.0.1"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion trame/modules/tauri.py

This file was deleted.

3 changes: 0 additions & 3 deletions trame_tauri/__init__.py

This file was deleted.

Loading
Loading