Skip to content

Commit

Permalink
Merge branch 'beeware:main' into window_states
Browse files Browse the repository at this point in the history
  • Loading branch information
proneon267 authored Jun 1, 2024
2 parents 9aefd30 + d68e9a8 commit 13d2ff3
Show file tree
Hide file tree
Showing 122 changed files with 434 additions and 179 deletions.
61 changes: 37 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ on:
branches:
- main
workflow_call:
inputs:
attest-package:
description: "Create GitHub provenance attestation for the package."
default: "false"
type: string
outputs:
artifact-name:
description: "Name of the uploaded artifact; use for artifact retrieval."
value: ${{ jobs.package.outputs.artifact-name }}
artifact-basename:
description: "Base name of the uploaded artifacts; use for artifact retrieval."
value: ${{ jobs.package.outputs.artifact-basename }}

env:
min_python_version: "3.8"
Expand Down Expand Up @@ -38,12 +43,11 @@ jobs:
tox-source: "./core[dev]"

package:
name: Python package
uses: beeware/.github/.github/workflows/python-package-create.yml@main
with:
tox-source: "./core[dev]"
build-subdirectory: ${{ matrix.subdir }}
distribution-path: "*/dist/*"
name: Package Toga
permissions:
id-token: write
contents: read
attestations: write
strategy:
matrix:
subdir:
Expand All @@ -58,6 +62,10 @@ jobs:
- "textual"
- "web"
- "winforms"
uses: beeware/.github/.github/workflows/python-package-create.yml@main
with:
build-subdirectory: ${{ matrix.subdir }}
attest: ${{ inputs.attest-package }}

core:
name: Test core
Expand Down Expand Up @@ -93,30 +101,34 @@ jobs:
python-version: "3.13-dev"
steps:
- name: Checkout
uses: actions/checkout@v4.1.4
uses: actions/checkout@v4.1.6
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5.1.0
with:
python-version: ${{ matrix.python-version }}

- name: Install dev Dependencies
run: |
# We don't actually want to install toga-core;
# we just want the dev extras so we have a known version of tox and coverage
python -m pip install ./core[dev]
- name: Install Tox
uses: beeware/.github/.github/actions/install-requirement@main
with:
requirements: tox
extra: dev
project-root: core

- name: Get Packages
uses: actions/download-artifact@v4.1.7
with:
pattern: ${{ needs.package.outputs.artifact-name }}-*
pattern: ${{ format('{0}-*', needs.package.outputs.artifact-basename) }}
merge-multiple: true
path: dist

- name: Test
run: |
# The $(ls ...) shell expansion is done in the Github environment;
# the value of TOGA_INSTALL_COMMAND will be a literal string without any shell expansions to perform
TOGA_INSTALL_COMMAND="python -m pip install ../$(ls core/dist/toga_core-*.whl)[dev] ../$(ls dummy/dist/toga_dummy-*.whl)" \
TOGA_INSTALL_COMMAND="python -m pip install ../$(ls dist/toga_core-*.whl)[dev] ../$(ls dist/toga_dummy-*.whl)" \
tox -e py-cov
tox -qe coverage$(tr -dc "0-9" <<< "${{ matrix.python-version }}")
mv core/.coverage core/.coverage.${{ matrix.platform }}.${{ matrix.python-version }}
Expand All @@ -134,7 +146,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.1.4
uses: actions/checkout@v4.1.6
with:
fetch-depth: 0

Expand All @@ -145,11 +157,12 @@ jobs:
# https://github.com/nedbat/coveragepy/issues/1572#issuecomment-1522546425
python-version: ${{ env.min_python_version }}

- name: Install dev dependencies
run: |
# We don't actually want to install toga-core;
# we just want the dev extras so we have a known version of coverage
python -m pip install ./core[dev]
- name: Install Tox
uses: beeware/.github/.github/actions/install-requirement@main
with:
requirements: tox
extra: dev
project-root: core

- name: Retrieve Coverage Data
uses: actions/download-artifact@v4.1.7
Expand Down Expand Up @@ -260,7 +273,7 @@ jobs:
sudo udevadm trigger --name-match=kvm
steps:
- name: Checkout
uses: actions/checkout@v4.1.4
uses: actions/checkout@v4.1.6
with:
fetch-depth: 0

Expand Down
24 changes: 14 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
jobs:
ci:
uses: ./.github/workflows/ci.yml
with:
attest-package: "true"

docs:
name: Verify Docs Build
Expand All @@ -24,28 +26,29 @@ jobs:
permissions:
contents: write
steps:
- name: Set build variables
- name: Set Build Variables
run: |
echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
echo "VERSION=${GITHUB_REF_NAME#v}" | tee -a $GITHUB_ENV
- name: Get packages
- name: Get Packages
uses: actions/download-artifact@v4.1.7
with:
pattern: ${{ needs.ci.outputs.artifact-name }}-*
pattern: ${{ format('{0}-*', needs.ci.outputs.artifact-basename) }}
merge-multiple: true
path: dist

- name: Create release
- name: Create Release
uses: ncipollo/release-action@v1.14.0
with:
name: ${{ env.VERSION }}
draft: true
artifacts: "*/dist/*"
artifacts: "dist/*"
artifactErrorsFailBuild: true

deploy-test:
name: Publish to TestPyPI
runs-on: ubuntu-latest
needs: [ci, release]
needs: [ ci, release ]
permissions:
# This permission is required for trusted publishing.
id-token: write
Expand All @@ -68,16 +71,17 @@ jobs:
- "toga_web"
- "toga_winforms"
steps:
- name: Get packages
- name: Get Packages
uses: actions/download-artifact@v4.1.7
with:
pattern: ${{ needs.ci.outputs.artifact-name }}-*
pattern: ${{ format('{0}-*', needs.ci.outputs.artifact-basename) }}
merge-multiple: true
path: staging_dist

- name: Extract ${{ matrix.package }}
run: |
mkdir dist
mv */dist/$(echo ${{ matrix.package }} | sed 's/_/?/')-[0-9]* dist
mv staging_dist/$(echo ${{ matrix.package }} | sed 's/_/?/')-[0-9]* dist
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ repos:
hooks:
- id: flake8
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
# remove toml extra once Python 3.10 is no longer supported
Expand Down
14 changes: 7 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@ A Python native, OS native GUI toolkit.
Minimum requirements
--------------------

* Toga requires **Python 3.8 or higher**. Python 2 is not supported.
* Toga requires **Python 3.8 or higher**.

* If you're on macOS, you need to be on 11 (Big Sur) or newer.

* If you're on Windows, you'll need Windows 10 or newer. If you are using
Windows 10 and want to use a WebView to display web content, you will also
need to install the `Edge WebView2 Evergreen
Runtime. <https://developer.microsoft.com/en-us/microsoft-edge/webview2/#download-section>`__
need to install the `Edge WebView2 Evergreen Runtime
<https://developer.microsoft.com/en-us/microsoft-edge/webview2/#download-section>`__.
Windows 11 has this runtime installed by default.

* If you're on Linux (or another Unix-based operating system), you need to have
GTK+ 3.10 or newer. This is the version that ships starting with Ubuntu 14.04
and Fedora 20. You also need to install the system packages listed
in `Tutorial 0 <docs/tutorial/tutorial-0.rst>`__.
GTK+ >= 3.24 and glib >= 2.64. These are available starting with Ubuntu 20.04 and
Fedora 32. You also need to install the system packages listed in `Linux platform
documentation <https://toga.readthedocs.io/en/latest/reference/platforms/linux.html#prerequisites>`__.

Quickstart
----------
Expand Down Expand Up @@ -97,7 +97,7 @@ contributors`_ will help you get started.
If you experience problems with Toga, `log them on GitHub`_. If you want to
contribute code, please `fork the code`_ and `submit a pull request`_.

.. _guide for first time contributors: https://toga.readthedocs.io/en/latest/how-to/contribute-code.html
.. _guide for first time contributors: https://toga.readthedocs.io/en/latest/how-to/contribute/index.html
.. _log them on Github: https://github.com/beeware/toga/issues
.. _fork the code: https://github.com/beeware/toga
.. _submit a pull request: https://github.com/beeware/toga/pulls
4 changes: 2 additions & 2 deletions android/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[build-system]
requires = [
"setuptools==69.5.1",
"setuptools_scm==8.0.4",
"setuptools==70.0.0",
"setuptools_scm==8.1.0",
"setuptools_dynamic_dependencies @ git+https://github.com/beeware/setuptools_dynamic_dependencies",
]
build-backend = "setuptools.build_meta"
Expand Down
29 changes: 22 additions & 7 deletions android/src/toga_android/widgets/detailedlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@
from android.graphics import Rect
from android.view import Gravity, View
from android.widget import ImageView, LinearLayout, RelativeLayout, ScrollView, TextView
from androidx.swiperefreshlayout.widget import SwipeRefreshLayout
from java import dynamic_proxy

try:
from androidx.swiperefreshlayout.widget import SwipeRefreshLayout
except ImportError: # pragma: no cover
# Import will fail if SwipeRefreshLayout is not listed in dependencies
# No cover due to not being able to test in CI
SwipeRefreshLayout = None


from .base import Widget


Expand Down Expand Up @@ -78,17 +85,25 @@ def onClick(self, dialog, which):
self.actions[which].handler(row=self.row)


class OnRefreshListener(dynamic_proxy(SwipeRefreshLayout.OnRefreshListener)):
def __init__(self, interface):
super().__init__()
self._interface = interface
if SwipeRefreshLayout is not None: # pragma: no cover

class OnRefreshListener(dynamic_proxy(SwipeRefreshLayout.OnRefreshListener)):
def __init__(self, interface):
super().__init__()
self._interface = interface

def onRefresh(self):
self._interface.on_refresh()
def onRefresh(self):
self._interface.on_refresh()


class DetailedList(Widget):
def create(self):
if SwipeRefreshLayout is None: # pragma: no cover
raise RuntimeError(
"Unable to import SwipeRefreshLayout. Ensure that the AndroidX Swipe Refresh Layout "
"widget package (androidx.swiperefreshlayout:swiperefreshlayout:1.1.0) "
"is listed in your app's dependencies."
)
# get the selection color from the current theme
attrs = [R.attr.colorBackground, R.attr.colorControlHighlight]
typed_array = self._native_activity.obtainStyledAttributes(attrs)
Expand Down
3 changes: 1 addition & 2 deletions android/src/toga_android/widgets/textinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ def is_valid(self):
return self.native.getError() is None

def _on_change(self):
self.interface.on_change()
self.interface._validate()
self.interface._value_changed()

def _on_confirm(self):
self.interface.on_confirm()
Expand Down
3 changes: 3 additions & 0 deletions android/tests_backend/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,6 @@ def assert_toolbar_item(self, index, label, tooltip, has_icon, enabled):

def press_toolbar_button(self, index):
self.native.onOptionsItemSelected(self._toolbar_items()[index])

def is_modal_dialog(self, dialog):
return True
1 change: 1 addition & 0 deletions changes/2301.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
APIs were added for replacing a widget in an existing layout, and for obtaining the index of a widget in a list of children.
1 change: 1 addition & 0 deletions changes/2307.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The content of a window can now be set when the window is constructed.
1 change: 1 addition & 0 deletions changes/2325.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Invocation order of TextInput on_change and validation is now correct.
1 change: 1 addition & 0 deletions changes/2446.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Dialog windows are now properly modal when using the Gtk+ backend.
1 change: 1 addition & 0 deletions changes/2454.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Android deployments no longer require the SwipeRefreshLayout component unless the app uses the Toga DetailedList widget.
1 change: 1 addition & 0 deletions changes/2565.doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The instructions for adding a changenote to a pull request have been clarified.
1 change: 1 addition & 0 deletions changes/2566.doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The minimum supported Linux release requirements were updated to Ubuntu 20.04 or Fedora 32.
1 change: 1 addition & 0 deletions changes/2567.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The pinned dependencies in pyproject.toml and tox.ini were updated to their latest versions.
1 change: 1 addition & 0 deletions changes/2568.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated furo from 2024.4.27 to 2024.5.6 in /core.
1 change: 1 addition & 0 deletions changes/2569.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated pre-commit from 3.7.0 to 3.7.1 in /core.
1 change: 1 addition & 0 deletions changes/2570.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated setuptools-scm from 8.0.4 to 8.1.0 in /core.
1 change: 1 addition & 0 deletions changes/2571.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated actions/checkout from 4.1.4 to 4.1.5.
1 change: 1 addition & 0 deletions changes/2576.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated pytest-asyncio from 0.23.6 to 0.23.7 in /core.
1 change: 1 addition & 0 deletions changes/2577.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated setuptools-scm from 8.0.4 to 8.1.0 in /core.
1 change: 1 addition & 0 deletions changes/2578.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated pytest from 8.2.0 to 8.2.1 in /core.
1 change: 1 addition & 0 deletions changes/2579.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated actions/checkout from 4.1.5 to 4.1.6.
1 change: 1 addition & 0 deletions changes/2580.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The pinned dependencies in pyproject.toml and tox.ini were updated to their latest versions.
1 change: 1 addition & 0 deletions changes/2583.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The Button testbed tests can accommodate minor rendering differences on Fedora 40.
1 change: 1 addition & 0 deletions changes/2588.doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The first-time contributor README link has been updated.
1 change: 1 addition & 0 deletions changes/2589.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
On macOS, apps will now raise a warning if camera permissions have been requested, but those permissions have not been declared as part of the application metadata.
1 change: 1 addition & 0 deletions changes/2593.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Tutorial instructions were clarified.
1 change: 1 addition & 0 deletions changes/2600.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated coverage[toml] from 7.5.1 to 7.5.2 in /core.
1 change: 1 addition & 0 deletions changes/2601.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The pinned dependencies in pyproject.toml and tox.ini were updated to their latest versions.
1 change: 1 addition & 0 deletions changes/2602.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The ``pre-commit`` hook for ``codespell`` was updated to its latest version.
1 change: 1 addition & 0 deletions changes/2604.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
``hynek/build-and-inspect-python-package`` is now used to create the Python package.
1 change: 1 addition & 0 deletions changes/2605.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
An error in an example argument was corrected.
4 changes: 2 additions & 2 deletions cocoa/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[build-system]
requires = [
"setuptools==69.5.1",
"setuptools_scm==8.0.4",
"setuptools==70.0.0",
"setuptools_scm==8.1.0",
"setuptools_dynamic_dependencies @ git+https://github.com/beeware/setuptools_dynamic_dependencies",
]
build-backend = "setuptools.build_meta"
Expand Down
Loading

0 comments on commit 13d2ff3

Please sign in to comment.