Skip to content

Commit

Permalink
Merge branch 'main' into android-camera
Browse files Browse the repository at this point in the history
  • Loading branch information
freakboy3742 committed Jan 31, 2024
2 parents cba1e96 + e2b6e71 commit 61382e0
Show file tree
Hide file tree
Showing 33 changed files with 134 additions and 121 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
TOGA_INSTALL_COMMAND="python -m pip install ../$(ls core/dist/toga_core-*.whl)[dev] ../$(ls dummy/dist/toga_dummy-*.whl)" tox -e py
mv core/.coverage core/.coverage.${{ matrix.platform }}.${{ matrix.python-version }}
- name: Store coverage data
uses: actions/upload-artifact@v4.1.0
uses: actions/upload-artifact@v4.3.0
with:
name: core-coverage-data-${{ matrix.platform }}-${{ matrix.python-version }}
path: "core/.coverage.*"
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
python -m coverage html --skip-covered --skip-empty
python -m coverage report --rcfile ../pyproject.toml --fail-under=100
- name: Upload HTML report if check failed.
uses: actions/upload-artifact@v4.1.0
uses: actions/upload-artifact@v4.3.0
if: failure()
with:
name: html-coverage-report
Expand Down Expand Up @@ -232,7 +232,7 @@ jobs:
run: ${{ matrix.briefcase-run-prefix }} briefcase run ${{ matrix.backend }} --test ${{ matrix.briefcase-run-args }}

- name: Upload logs
uses: actions/upload-artifact@v4.1.0
uses: actions/upload-artifact@v4.3.0
if: failure()
with:
name: testbed-failure-logs-${{ matrix.backend }}
Expand All @@ -245,7 +245,7 @@ jobs:
cp -r "${{ matrix.app-user-data-path }}" testbed/app_data/testbed-app_data-${{ matrix.backend }}
- name: Upload app data
uses: actions/upload-artifact@v4.1.0
uses: actions/upload-artifact@v4.3.0
if: failure() && matrix.backend != 'android'
with:
name: testbed-failure-app-data-${{ matrix.backend }}
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
hooks:
- id: isort
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.12.1
rev: 24.1.1
hooks:
- id: black
language_version: python3
Expand Down
3 changes: 1 addition & 2 deletions android/src/toga_android/widgets/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ def __init__(self, interface):
self.interface.style.reapply()

@abstractmethod
def create(self):
...
def create(self): ...

def set_app(self, app):
pass
Expand Down
1 change: 1 addition & 0 deletions changes/2211.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`App.current_window` on Gtk now returns `None` when all windows are hidden.
1 change: 1 addition & 0 deletions changes/2355.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
On macOS, `toga.Image()` objects can now be created from raw data that didn't originate from a file.
1 change: 1 addition & 0 deletions changes/2357.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated actions/upload-artifact from 4.1.0 to 4.2.0.
1 change: 1 addition & 0 deletions changes/2358.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated tox from 4.12.0 to 4.12.1 in /core.
1 change: 1 addition & 0 deletions changes/2359.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated sphinx-tabs from 3.4.4 to 3.4.5 in /core.
1 change: 1 addition & 0 deletions changes/2367.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated actions/upload-artifact from 4.2.0 to 4.3.0.
1 change: 1 addition & 0 deletions changes/2368.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The ``pre-commit`` hook for ``black-pre-commit-mirror`` was updated to its latest version.
1 change: 1 addition & 0 deletions changes/2369.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated coverage[toml] from 7.4.0 to 7.4.1 in /core.
1 change: 1 addition & 0 deletions changes/2370.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated pytest-asyncio from 0.23.3 to 0.23.4 in /core.
1 change: 1 addition & 0 deletions changes/2371.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated sphinx-autodoc-typehints from 1.25.2 to 1.25.3 in /core.
13 changes: 7 additions & 6 deletions cocoa/src/toga_cocoa/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,14 @@ def get_height(self):
return self.native.size.height

def get_data(self):
return nsdata_to_bytes(
NSBitmapImageRep.representationOfImageRepsInArray(
self.native.representations,
usingType=NSBitmapImageFileType.PNG,
properties=None,
)
# A file created from a data source won't necessarily have a pre-existing PNG
# representation. Create a TIFF representation, then convert to PNG.
bitmap_rep = NSBitmapImageRep.imageRepWithData(self.native.TIFFRepresentation)
image_data = bitmap_rep.representationUsingType(
NSBitmapImageFileType.PNG,
properties=None,
)
return nsdata_to_bytes(image_data)

def save(self, path):
path = Path(path)
Expand Down
6 changes: 2 additions & 4 deletions cocoa/src/toga_cocoa/widgets/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ def __init__(self, interface):
self.interface.style.reapply()

@abstractmethod
def create(self):
...
def create(self): ...

def set_app(self, app):
pass
Expand Down Expand Up @@ -116,5 +115,4 @@ def refresh(self):
self.rehint()

@abstractmethod
def rehint(self):
...
def rehint(self): ...
10 changes: 5 additions & 5 deletions core/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ dependencies = [
# Extras used by developers *of* briefcase are pinned to specific versions to
# ensure environment consistency.
dev = [
"coverage[toml] == 7.4.0",
"coverage[toml] == 7.4.1",
"Pillow == 10.2.0",
# Pre-commit 3.6.0 deprecated support for Python 3.8
"pre-commit == 3.5.0 ; python_version < '3.9'",
"pre-commit == 3.6.0 ; python_version >= '3.9'",
"pytest == 7.4.4",
"pytest-asyncio == 0.23.3",
"pytest-asyncio == 0.23.4",
"pytest-freezer == 0.4.8",
"setuptools-scm == 8.0.4",
"tox == 4.12.0",
"tox == 4.12.1",
# typing-extensions needed for TypeAlias added in Py 3.10
"typing-extensions == 4.9.0 ; python_version < '3.10'"
]
Expand All @@ -85,9 +85,9 @@ docs = [
# Sphinx 7.2 deprecated support for Python 3.8
"sphinx == 7.1.2 ; python_version < '3.9'",
"sphinx == 7.2.6 ; python_version >= '3.9'",
"sphinx_tabs == 3.4.4",
"sphinx_tabs == 3.4.5",
"sphinx-autobuild == 2021.3.14",
"sphinx-autodoc-typehints == 1.25.2",
"sphinx-autodoc-typehints == 1.25.3",
"sphinx-csv-filter == 0.4.1",
"sphinx-copybutton == 0.5.2",
"sphinx-toolbox == 3.5.0",
Expand Down
3 changes: 1 addition & 2 deletions core/src/toga/widgets/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ def __repr__(self):
return f"{self.__class__.__name__}()"

@abstractmethod
def _draw(self, impl, **kwargs):
...
def _draw(self, impl, **kwargs): ...


class BeginPath(DrawingObject):
Expand Down
12 changes: 4 additions & 8 deletions core/src/toga/widgets/optioncontainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,7 @@ def index(self, value: str | int | OptionItem):
def append(
self,
text_or_item: OptionItem,
):
...
): ...

@overload
def append(
Expand All @@ -281,8 +280,7 @@ def append(
*,
icon: IconContent | None = None,
enabled: bool = True,
):
...
): ...

def append(
self,
Expand Down Expand Up @@ -311,8 +309,7 @@ def insert(
self,
index: int | str | OptionItem,
text_or_item: OptionItem,
):
...
): ...

@overload
def insert(
Expand All @@ -323,8 +320,7 @@ def insert(
*,
icon: IconContent | None = None,
enabled: bool = True,
):
...
): ...

def insert(
self,
Expand Down
39 changes: 13 additions & 26 deletions core/src/toga/widgets/slider.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,36 +318,28 @@ def range(self, range):

class SliderImpl(ABC):
@abstractmethod
def get_value(self):
...
def get_value(self): ...

@abstractmethod
def set_value(self, value):
...
def set_value(self, value): ...

@abstractmethod
def get_min(self):
...
def get_min(self): ...

@abstractmethod
def set_min(self, value):
...
def set_min(self, value): ...

@abstractmethod
def get_max(self):
...
def get_max(self): ...

@abstractmethod
def set_max(self, value):
...
def set_max(self, value): ...

@abstractmethod
def get_tick_count(self):
...
def get_tick_count(self): ...

@abstractmethod
def set_tick_count(self, tick_count):
...
def set_tick_count(self, tick_count): ...


class IntSliderImpl(SliderImpl):
Expand Down Expand Up @@ -407,21 +399,16 @@ def on_change(self):
self.interface.on_change()

@abstractmethod
def get_int_value(self):
...
def get_int_value(self): ...

@abstractmethod
def set_int_value(self, value):
...
def set_int_value(self, value): ...

@abstractmethod
def get_int_max(self):
...
def get_int_max(self): ...

@abstractmethod
def set_int_max(self, max):
...
def set_int_max(self, max): ...

@abstractmethod
def set_ticks_visible(self, visible):
...
def set_ticks_visible(self, visible): ...
27 changes: 9 additions & 18 deletions core/src/toga/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,7 @@ def stack_trace_dialog(
content: str,
retry: Literal[False] = False,
on_result: DialogResultHandler[None] | None = None,
) -> Dialog:
...
) -> Dialog: ...

@overload
def stack_trace_dialog(
Expand All @@ -527,8 +526,7 @@ def stack_trace_dialog(
content: str,
retry: Literal[True] = False,
on_result: DialogResultHandler[bool] | None = None,
) -> Dialog:
...
) -> Dialog: ...

@overload
def stack_trace_dialog(
Expand All @@ -538,8 +536,7 @@ def stack_trace_dialog(
content: str,
retry: bool = False,
on_result: DialogResultHandler[bool | None] | None = None,
) -> Dialog:
...
) -> Dialog: ...

def stack_trace_dialog(
self,
Expand Down Expand Up @@ -632,8 +629,7 @@ def open_file_dialog(
multiple_select: Literal[False] = False,
on_result: DialogResultHandler[Path | None] | None = None,
multiselect=None, # DEPRECATED
) -> Dialog:
...
) -> Dialog: ...

@overload
def open_file_dialog(
Expand All @@ -644,8 +640,7 @@ def open_file_dialog(
multiple_select: Literal[True] = True,
on_result: DialogResultHandler[list[Path] | None] | None = None,
multiselect=None, # DEPRECATED
) -> Dialog:
...
) -> Dialog: ...

@overload
def open_file_dialog(
Expand All @@ -656,8 +651,7 @@ def open_file_dialog(
multiple_select: bool = False,
on_result: DialogResultHandler[list[Path] | Path | None] | None = None,
multiselect=None, # DEPRECATED
) -> Dialog:
...
) -> Dialog: ...

def open_file_dialog(
self,
Expand Down Expand Up @@ -724,8 +718,7 @@ def select_folder_dialog(
multiple_select: Literal[False] = False,
on_result: DialogResultHandler[Path | None] | None = None,
multiselect=None, # DEPRECATED
) -> Dialog:
...
) -> Dialog: ...

@overload
def select_folder_dialog(
Expand All @@ -735,8 +728,7 @@ def select_folder_dialog(
multiple_select: Literal[True] = True,
on_result: DialogResultHandler[list[Path] | None] | None = None,
multiselect=None, # DEPRECATED
) -> Dialog:
...
) -> Dialog: ...

@overload
def select_folder_dialog(
Expand All @@ -746,8 +738,7 @@ def select_folder_dialog(
multiple_select: bool = False,
on_result: DialogResultHandler[list[Path] | Path | None] | None = None,
multiselect=None, # DEPRECATED
) -> Dialog:
...
) -> Dialog: ...

def select_folder_dialog(
self,
Expand Down
8 changes: 5 additions & 3 deletions core/tests/widgets/test_progressbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,11 @@ def test_set_max(progressbar, value, actual, determinate):
(
object(),
TypeError,
r"must be a string or a number"
if sys.version_info < (3, 10)
else r"must be a string or a real number",
(
r"must be a string or a number"
if sys.version_info < (3, 10)
else r"must be a string or a real number"
),
), # Non-coercible to float
(
-42,
Expand Down
6 changes: 3 additions & 3 deletions examples/optioncontainer/optioncontainer/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ def on_insert_option(self, button):
def on_enable_option(self, button):
index = int(self.select_option.value)
try:
self.optioncontainer.content[
index
].enabled = not self.optioncontainer.content[index].enabled
self.optioncontainer.content[index].enabled = (
not self.optioncontainer.content[index].enabled
)
except ValueError as e:
self.main_window.info_dialog("Oops", str(e))

Expand Down
1 change: 1 addition & 0 deletions examples/positron-django/src/webapp/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""

from django.contrib import admin
from django.urls import path

Expand Down
Loading

0 comments on commit 61382e0

Please sign in to comment.