Skip to content

Commit

Permalink
Merge branch 'main' into pil-image-support to get updated project met…
Browse files Browse the repository at this point in the history
…adata from beeware#2229
  • Loading branch information
HalfWhitt committed Nov 25, 2023
2 parents 92ef73e + c6ea606 commit 51167ba
Show file tree
Hide file tree
Showing 170 changed files with 1,483 additions and 8,984 deletions.
37 changes: 20 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ jobs:

- backend: macOS
runs-on: macos-12
app-user-data-path: /Users/runner/Library/Application Support/org.beeware.toga.testbed
app-user-data-path: $HOME/Library/Application Support/org.beeware.toga.testbed

# We use a fixed Ubuntu version rather than `-latest` because at some point,
# `-latest` will be updated, but it will be a soft changeover, which would cause
Expand Down Expand Up @@ -180,22 +180,23 @@ jobs:
briefcase-run-prefix: 'DISPLAY=:99'
setup-python: false # Use the system Python packages.
app-user-data-path: /home/runner/.local/share/testbed
app-user-data-path: $HOME/.local/share/testbed

- backend: windows
runs-on: windows-latest
app-user-data-path: $HOME\AppData\Local\Tiberius Yak\Toga Testbed\Data

- backend: iOS
runs-on: macos-12
briefcase-run-args: ' -d "iPhone SE (3rd generation)"'
# app data path is determined at runtime, as the path contains the Simulator and app ID.
app-user-data-path: $(xcrun simctl get_app_container booted org.beeware.toga.testbed data)/Documents

- backend: android
runs-on: ubuntu-latest
briefcase-run-args: " -d '{\"avd\":\"beePhone\"}' --Xemulator=-no-window --Xemulator=-no-snapshot --Xemulator=-no-audio --Xemulator=-no-boot-anim --shutdown-on-exit"
pre-command: |
# check if virtualization is supported...
sudo apt install -y --no-install-recommends cpu-checker coreutils && echo "CPUs=$(nproc --all)" && kvm-ok
sudo apt install -qq --no-install-recommends cpu-checker coreutils && echo "CPUs=$(nproc --all)" && kvm-ok
# allow access to KVM to run the emulator
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
| sudo tee /etc/udev/rules.d/99-kvm4all.rules
Expand All @@ -205,46 +206,48 @@ jobs:
- uses: actions/checkout@v4.1.1
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4.7.1
if: ${{ matrix.setup-python }}
if: matrix.setup-python
with:
# We're not using Python 3.11 yet, because:
# * The testbed's ProxyEventLoop has some problems with it
# (https://github.com/beeware/toga/issues/1982).
# * It doesn't have an Android build of Pillow yet.
python-version: "3.10"

- name: Install dependencies
run: |
${{ matrix.pre-command }}
# Use the development version of Briefcase
python -m pip install -U pip
python -m pip install git+https://github.com/beeware/briefcase.git
- name: Test App
run: |
cd testbed
${{ matrix.briefcase-run-prefix }} briefcase run ${{ matrix.backend }} --test ${{ matrix.briefcase-run-args }}
working-directory: testbed
run: ${{ matrix.briefcase-run-prefix }} briefcase run ${{ matrix.backend }} --test ${{ matrix.briefcase-run-args }}

- name: Upload logs
uses: actions/upload-artifact@v3.1.3
if: failure()
with:
name: testbed-failure-logs-${{ matrix.backend }}
path: testbed/logs/*

- name: Copy app generated user data
if: failure()
if: failure() && matrix.backend != 'android'
run: |
mkdir testbed/app_data
if [ "${{ matrix.backend }}" = "iOS" ]; then
APP_DATA_PATH="$(xcrun simctl get_app_container booted org.beeware.toga.testbed data)/Documents"
else
APP_DATA_PATH="${{ matrix.app-user-data-path }}"
fi
cp -r "$APP_DATA_PATH" testbed/app_data/testbed-app_data-${{ matrix.backend }}
mkdir -p testbed/app_data
cp -r "${{ matrix.app-user-data-path }}" testbed/app_data/testbed-app_data-${{ matrix.backend }}
- name: Upload app data
uses: actions/upload-artifact@v3.1.3
if: failure()
if: failure() && matrix.backend != 'android'
with:
name: testbed-failure-app-data-${{ matrix.backend }}
path: testbed/app_data/*

# This step is only needed if you're trying to diagnose test failures that
# only occur in CI, and can't be reproduced locally. When it runs, it will
# open an SSH server (URL reported in the logs) so you can ssh into the CI
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ Toga is part of the `BeeWare suite`_. You can talk to the community through:
We foster a welcoming and respectful community as described in our
`BeeWare Community Code of Conduct`_.

.. _BeeWare suite: http://beeware.org
.. _BeeWare suite: https://beeware.org
.. _@beeware@fosstodon.org on Mastodon: https://fosstodon.org/@beeware
.. _Discord: https://beeware.org/bee/chat/
.. _Github Discussions forum: https://github.com/beeware/toga/discussions
.. _BeeWare Community Code of Conduct: http://beeware.org/community/behavior/
.. _BeeWare Community Code of Conduct: https://beeware.org/community/behavior/

Contributing
------------
Expand Down
5 changes: 0 additions & 5 deletions android/MANIFEST.in

This file was deleted.

62 changes: 61 additions & 1 deletion android/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,67 @@
[build-system]
requires = ["setuptools==66.1.1", "setuptools_scm[toml]==7.0.5"]
requires = [
"setuptools==69.0.0",
"setuptools_scm==8.0.4",
"setuptools_dynamic_dependencies @ git+https://github.com/beeware/setuptools_dynamic_dependencies",
]
build-backend = "setuptools.build_meta"

[project]
dynamic = ["version", "dependencies"]
name = "toga-android"
description = "An Android backend for the Toga widget toolkit."
readme = "README.rst"
requires-python = ">= 3.8"
license.text = "New BSD"
authors = [
{name="Russell Keith-Magee", email="russell@keith-magee.com"},
]
maintainers = [
{name="BeeWare Team", email="team@beeware.org"},
]
keywords = [
"gui",
"widget",
"cross-platform",
"toga",
"mobile",
"android",
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Software Development",
"Topic :: Software Development :: User Interfaces",
"Topic :: Software Development :: Widget Sets",
]

[project.urls]
Homepage = "https://beeware.org/project/projects/libraries/toga/"
Funding = "https://beeware.org/contributing/membership/"
Documentation = "https://toga.readthedocs.io/en/latest/"
Tracker = "https://github.com/beeware/toga/issues"
Source = "https://github.com/beeware/toga"

[project.entry-points."toga.backends"]
android = "toga_android"

[tool.setuptools_scm]
root = ".."

[tool.setuptools_dynamic_dependencies]
dependencies = [
"toga-core == {version}",
]

[tool.coverage.run]
parallel = true
branch = true
Expand Down
54 changes: 0 additions & 54 deletions android/setup.cfg

This file was deleted.

11 changes: 0 additions & 11 deletions android/setup.py

This file was deleted.

32 changes: 22 additions & 10 deletions android/src/toga_android/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from java import dynamic_proxy
from org.beeware.android import IPythonApp, MainActivity

from toga.command import GROUP_BREAK, SECTION_BREAK, Command, Group
from toga.command import Command, Group, Separator

from .libs import events
from .window import Window
Expand Down Expand Up @@ -96,25 +96,27 @@ def onPrepareOptionsMenu(self, menu):

# create option menu
for cmd in self._impl.interface.commands:
if cmd == SECTION_BREAK or cmd == GROUP_BREAK:
if isinstance(cmd, Separator):
groupid += 1
continue

# Toolbar commands are added below.
if cmd in self._impl.interface.main_window.toolbar:
continue

if cmd.group.key in menulist:
try:
# Find the menu representing the group for this command
menugroup = menulist[cmd.group.key]
else:
# create all missing submenus
except KeyError:
# Menu doesn't exist yet; create it.
parentmenu = menu
groupkey = ()
# Iterate over the full key, creating submenus as needed
for section, order, text in cmd.group.key:
groupkey += ((section, order, text),)
if groupkey in menulist:
try:
menugroup = menulist[groupkey]
else:
except KeyError:
if len(groupkey) == 1 and text == Group.COMMANDS.text:
# Add this group directly to the top-level menu
menulist[groupkey] = menu
Expand All @@ -127,20 +129,30 @@ def onPrepareOptionsMenu(self, menu):
menulist[groupkey] = menugroup
parentmenu = menugroup

# create menu item
# Create menu item
menuitem = menugroup.add(groupid, itemid, Menu.NONE, cmd.text)
menuitem.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_NEVER)
menuitem.setEnabled(cmd.enabled)
self.menuitem_mapping[itemid] = cmd
itemid += 1

# create toolbar actions
# Create toolbar actions
if self._impl.interface.main_window: # pragma: no branch
prev_group = None
for cmd in self._impl.interface.main_window.toolbar:
if cmd == SECTION_BREAK or cmd == GROUP_BREAK:
if isinstance(cmd, Separator):
groupid += 1
prev_group = None
continue

# A change in group requires adding a toolbar separator
if prev_group is not None and cmd.group != prev_group:
groupid += 1
prev_group = None
else:
prev_group = cmd.group

# Add a menu item for the toolbar command
menuitem = menu.add(groupid, itemid, Menu.NONE, cmd.text)
# SHOW_AS_ACTION_IF_ROOM is too conservative, showing only 2 items on
# a medium-size screen in portrait.
Expand Down
7 changes: 0 additions & 7 deletions attic/django/CONTRIBUTING.md

This file was deleted.

27 changes: 0 additions & 27 deletions attic/django/LICENSE

This file was deleted.

6 changes: 0 additions & 6 deletions attic/django/MANIFEST.in

This file was deleted.

Loading

0 comments on commit 51167ba

Please sign in to comment.