Skip to content

Commit

Permalink
Switch to pyo3 master for now, update enums
Browse files Browse the repository at this point in the history
  • Loading branch information
DataTriny committed Aug 16, 2023
1 parent 6833c8e commit 93e0251
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 63 deletions.
85 changes: 49 additions & 36 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bindings/python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ extension-module = ["pyo3/extension-module"]

[dependencies]
accesskit = { version = "0.11.2", path = "../../common", features = ["pyo3"] }
pyo3 = { version = "0.19", features = ["abi3-py37", "multiple-pymethods"] }
pyo3 = { git = "https://github.com/PyO3/pyo3.git", features = ["abi3-py37", "multiple-pymethods"] }

[target.'cfg(target_os = "windows")'.dependencies]
accesskit_windows = { version = "0.14.3", path = "../../platforms/windows" }
Expand Down
16 changes: 8 additions & 8 deletions bindings/python/examples/pygame/hello_world.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@


def build_button(id, name, classes):
builder = accesskit.NodeBuilder(accesskit.Role.Button)
builder = accesskit.NodeBuilder(accesskit.Role.BUTTON)
builder.set_bounds(BUTTON_1_RECT if id == BUTTON_1_ID else BUTTON_2_RECT)
builder.set_name(name)
builder.add_action(accesskit.Action.Focus)
builder.set_default_action_verb(accesskit.DefaultActionVerb.Click)
builder.add_action(accesskit.Action.FOCUS)
builder.set_default_action_verb(accesskit.DefaultActionVerb.CLICK)
return builder.build(classes)


def build_announcement(text, classes):
builder = accesskit.NodeBuilder(accesskit.Role.StaticText)
builder = accesskit.NodeBuilder(accesskit.Role.STATIC_TEXT)
builder.set_name(text)
builder.set_live(accesskit.Live.Polite)
builder.set_live(accesskit.Live.POLITE)
return builder.build(classes)


Expand Down Expand Up @@ -85,7 +85,7 @@ def focus(self):
return self._focus if self.is_window_focused else None

def build_root(self):
builder = accesskit.NodeBuilder(accesskit.Role.Window)
builder = accesskit.NodeBuilder(accesskit.Role.WINDOW)
builder.set_children([BUTTON_1_ID, BUTTON_2_ID])
if not self.announcement is None:
builder.push_child(ANNOUNCEMENT_ID)
Expand Down Expand Up @@ -136,10 +136,10 @@ def build_tree_update_for_focus_update(self):


def do_action(request):
if request.action in [accesskit.Action.Default, accesskit.Action.Focus]:
if request.action in [accesskit.Action.DEFAULT, accesskit.Action.FOCUS]:
args = {
"event": SET_FOCUS_MSG
if request.action == accesskit.Action.Focus
if request.action == accesskit.Action.FOCUS
else DO_DEFAULT_ACTION_MSG,
"target": request.target,
}
Expand Down
2 changes: 1 addition & 1 deletion common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ features = ["schemars", "serde"]

[dependencies]
enumn = { version = "0.1.6", optional = true }
pyo3 = { version = "0.19", optional = true }
pyo3 = { git = "https://github.com/PyO3/pyo3.git", optional = true }
schemars = { version = "0.8.7", optional = true }
serde = { version = "1.0", features = ["derive"], optional = true }

Expand Down
Loading

0 comments on commit 93e0251

Please sign in to comment.