Skip to content

Commit

Permalink
Merge branch 'main' into ankith26-mac-build
Browse files Browse the repository at this point in the history
  • Loading branch information
MyreMylar authored Oct 27, 2023
2 parents f880811 + f75c45d commit 3ad1a97
Show file tree
Hide file tree
Showing 32 changed files with 709 additions and 107 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-debian-multiarch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
arch: [s390x, ppc64le]

steps:
- uses: actions/[email protected].0
- uses: actions/[email protected].1

- name: Build sources and run tests
uses: uraimo/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-emsdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
WHEELHOUSE_CYTHON: /tmp/wheelhouse/cython

steps:
- uses: actions/[email protected].0
- uses: actions/[email protected].1

- name: Cache Cython
id: cache-cython
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
macarch: [arm64, x86_64]

steps:
- uses: actions/[email protected].0
- uses: actions/[email protected].1

- name: Test for Mac Deps cache hit
id: macdep-cache
Expand Down Expand Up @@ -160,7 +160,7 @@ jobs:
CIBW_BUILD_VERBOSITY: 2

steps:
- uses: actions/[email protected].0
- uses: actions/[email protected].1

- name: pip cache
uses: actions/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-manylinux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
CIBW_BUILD_VERBOSITY: 2

steps:
- uses: actions/[email protected].0
- uses: actions/[email protected].1

- name: Log in to the Container registry
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-ubuntu-sdist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
os: [ubuntu-20.04, ubuntu-22.04]

steps:
- uses: actions/[email protected].0
- uses: actions/[email protected].1

- name: Install deps
# install numpy from pip and not apt because the one from pip is newer,
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ jobs:
CIBW_BUILD_VERBOSITY: 2

steps:
- uses: actions/[email protected].0
- uses: actions/[email protected].1

- uses: TheMrMilchmann/setup-msvc-dev@v3 # this lets us use the developer command prompt on windows
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cppcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-20.04

steps:
- uses: actions/[email protected].0
- uses: actions/[email protected].1

- name: Install deps
# https://github.com/actions/runner-images/issues/7192
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/format-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
runs-on: ubuntu-22.04

steps:
- uses: actions/[email protected].0
- uses: actions/[email protected].1

- name: Install deps
run: python3 -m pip install pylint black clang-format sphinx"<7.2.0"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-gh-draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
needs: [manylinux-aarch64, manylinux, macos, windows, sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected].0
- uses: actions/[email protected].1

- name: Download all artifacts
uses: actions/download-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/[email protected].0
- uses: actions/[email protected].1

- name: Pull all release assets
uses: robinraju/[email protected]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@ cd $FSYNTH
mkdir build
cd build

if [[ "$OSTYPE" == "darwin"* ]]; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
export FLUIDSYNTH_EXTRA_PLAT_FLAGS="-Denable-alsa=NO -Denable-systemd=NO"
elif [[ "$OSTYPE" == "darwin"* ]]; then
# We don't need fluidsynth framework on mac builds
export FLUIDSYNTH_EXTRA_MAC_FLAGS="-Denable-framework=NO"
export FLUIDSYNTH_EXTRA_PLAT_FLAGS="-Denable-framework=NO"
fi

cmake .. $PG_BASE_CMAKE_FLAGS -Denable-readline=OFF $FLUIDSYNTH_EXTRA_MAC_FLAGS
cmake .. $PG_BASE_CMAKE_FLAGS -Denable-readline=OFF $FLUIDSYNTH_EXTRA_PLAT_FLAGS \
-Denable-pulseaudio=NO \
-Denable-pipewire=NO

make
make install
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ bzip2 -d ${MPG123}.tar.bz2
tar xf ${MPG123}.tar
cd $MPG123

./configure $PG_BASE_CONFIGURE_FLAGS --enable-int-quality --disable-debug
./configure $PG_BASE_CONFIGURE_FLAGS --enable-int-quality --disable-debug \
--disable-components --enable-libmpg123 --enable-libsyn123

make
make install

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ tar xf ${SNDFILE}
cd $SNDNAME
# autoreconf -fvi

./configure $PG_BASE_CONFIGURE_FLAGS --disable-mpeg
# alsa is only needed for examples here
./configure $PG_BASE_CONFIGURE_FLAGS --disable-mpeg --disable-alsa
make
make install

9 changes: 7 additions & 2 deletions buildconfig/stubs/pygame/_window.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,20 @@ class Window:
def minimize(self) -> None: ...
def set_modal_for(self, parent: Window) -> None: ...
def set_icon(self, icon: Surface) -> None: ...

grab: bool

grab_mouse: bool
grab_keyboard: bool
title: str
resizable: bool
borderless: bool
always_on_top: bool
relative_mouse: bool
opacity: float

@property
def mouse_grabbed(self) -> bool: ...
@property
def keyboard_grabbed(self) -> bool: ...
@property
def id(self) -> int: ...
@property
Expand Down
13 changes: 12 additions & 1 deletion buildconfig/stubs/pygame/display.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from typing import Dict, List, Optional, Tuple, Union, overload
from typing import Dict, List, Optional, Tuple, Union, overload, Literal

from pygame.constants import FULLSCREEN
from pygame.surface import Surface

from pygame._sdl2 import Window

from ._common import (
ColorValue,
Coordinate,
Expand Down Expand Up @@ -87,3 +89,12 @@ def is_fullscreen() -> bool: ...
def is_vsync() -> bool: ...
def get_current_refresh_rate() -> int: ...
def get_desktop_refresh_rates() -> List[int]: ...
def message_box(
title: str,
message: Optional[str] = None,
message_type: Literal["info", "warn", "error"] = "info",
parent_window: Optional[Window] = None,
buttons: Sequence[str] = ("OK",),
return_button: int = 0,
escape_button: Optional[int] = None,
) -> int: ...
30 changes: 30 additions & 0 deletions docs/reST/ref/display.rst
Original file line number Diff line number Diff line change
Expand Up @@ -802,4 +802,34 @@ required).
.. versionadded:: 2.2.0
.. ## pygame.display.set_allow_screensaver ##
.. function:: message_box

| :sl:`Create a native GUI message box`
| :sg:`message_box(title, message=None, message_type='info', parent_window=None, buttons=('OK',), return_button=0, escape_button=None) -> int`
:param str title: A title string.
:param str message: A message string. If this parameter is set to ``None``, the message will be the title.
:param str message_type: Set the type of message_box, could be ``"info"``, ``"warn"`` or ``"error"``.
:param tuple buttons: An optional sequence of button name strings to show to the user.
:param int return_button: Button index to use if the return key is hit, ``0`` by default.
:param int escape_button: Button index to use if the escape key is hit, ``None`` for no button linked by default.
..
(Uncomment this after the window API is published)
:param Window parent_window: The parent window of the message_box
..
:return: The index of the button that was pushed.

This function should be called on the thread that ``set_mode()`` is called.
It will block execution of that thread until the user clicks a button or
closes the message_box.

This function may be called at any time, even before ``pygame.init()``.

Negative values of ``return_button`` and ``escape_button`` are allowed
just like standard Python list indexing.

.. versionadded:: 2.4.0


.. ## pygame.display ##
4 changes: 4 additions & 0 deletions docs/reST/ref/mixer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ change the default buffer by calling :func:`pygame.mixer.pre_init` before
playback. The buffer size must be a power of two (if not it is rounded up to
the next nearest power of 2).

The devicename parameter is the name of sound device to open for audio
playback. Allowed device names will vary based on the host system.
If left as ``None`` then a sensible default will be chosen for you.

Some platforms require the :mod:`pygame.mixer` module to be initialized
after the display modules have initialized. The top level ``pygame.init()``
takes care of this automatically, but cannot pass any arguments to the mixer
Expand Down
15 changes: 15 additions & 0 deletions docs/reST/ref/pygame.rst
Original file line number Diff line number Diff line change
Expand Up @@ -546,4 +546,19 @@ before calling :func:`pygame.init()` or :func:`pygame.joystick.init()`.
Useful for testing touch events on desktop platforms (e.g. with a trackpad)
where this is set to 0 by default.

|
::

"SDL_WINDOWS_DPI_AWARENESS"
Set to "permonitorv2" on windows 10 (and later) to declare the pygame
window DPI aware and ignore the desktop scaling, "permonitor" for
windows 8.1 and later DPI awareness and "system" for windows Vista
and later DPI awareness (not per monitor). Finally set it to "unaware",
to have the pygame window scale with the desktop scaling.

This hint only affects the windows platform, other platforms can control DPI awareness
via a Window creation keyword parameter called "allow_high_dpi".



96 changes: 48 additions & 48 deletions docs/reST/ref/scrap.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,54 @@ in a future release of pygame.
clipboard as the rest of the current API, but only strings are compatible with the
new API as of right now.

.. function:: put_text

| :sl:`Places text into the clipboard.`
| :sg:`put_text(text) -> None`
Places the input text into the clipboard. The data should be a string.
This is the same clipboard as the legacy scrap API when using ``SCRAP_TEXT``.

:param string text: String to be placed into the clipboard
:rtype: None

:raises pygame.error: if video mode has not been set_mode

.. note:: ``pygame.display.set_mode()`` should be called before using the ``scrap`` module

.. versionadded:: 2.2.0

.. ## pygame.scrap.put_text
.. function:: get_text

| :sl:`Gets text from the clipboard.`
| :sg:`get_text() -> str`
Gets text from the clipboard and returns it. If the clipboard is empty,
returns an empty string. This is the same clipboard as the legacy scrap
API when using ``SCRAP_TEXT``.

:rtype: str

.. versionadded:: 2.2.0

.. ## pygame.scrap.get_text
.. function:: has_text

| :sl:`Checks if text is in the clipboard.`
| :sg:`has_text() -> bool`
Returns ``True`` if the clipboard has a string, otherwise returns ``False``.
This is the same clipboard as the legacy scrap API when using ``SCRAP_TEXT``.

:rtype: bool

.. versionadded:: 2.2.0

.. ## pygame.scrap.has_text
**THE BELOW INFORMATION IS DEPRECATED IN PYGAME 2.2.0 AND WILL BE REMOVED IN THE FUTURE.**

The scrap module is for transferring data to/from the clipboard. This allows
Expand Down Expand Up @@ -263,52 +311,4 @@ For an example of how the scrap module works refer to the examples page
.. deprecated:: 2.2.0

.. ## pygame.scrap.set_mode ##
.. function:: put_text

| :sl:`Places text into the clipboard.`
| :sg:`put_text(text) -> None`
Places the input text into the clipboard. The data should be a string.
This is the same clipboard as the legacy scrap API when using ``SCRAP_TEXT``.

:param string text: String to be placed into the clipboard
:rtype: None

:raises pygame.error: if video mode has not been set_mode

.. note:: ``pygame.display.set_mode()`` should be called before using the ``scrap`` module

.. versionadded:: 2.2.0

.. ## pygame.scrap.put_text
.. function:: get_text

| :sl:`Gets text from the clipboard.`
| :sg:`get_text() -> str`
Gets text from the clipboard and returns it. If the clipboard is empty,
returns an empty string. This is the same clipboard as the legacy scrap
API when using ``SCRAP_TEXT``.

:rtype: str

.. versionadded:: 2.2.0

.. ## pygame.scrap.get_text
.. function:: has_text

| :sl:`Checks if text is in the clipboard.`
| :sg:`has_text() -> bool`
Returns ``True`` if the clipboard has a string, otherwise returns ``False``.
This is the same clipboard as the legacy scrap API when using ``SCRAP_TEXT``.

:rtype: bool

.. versionadded:: 2.2.0

.. ## pygame.scrap.has_text
.. ## pygame.scrap ##
Loading

0 comments on commit 3ad1a97

Please sign in to comment.