Features
- A
justify_content
style attribute has been added, which aligns children along a box's main axis. (#1194) - Toga apps can now detect and set their window states including maximized, minimized, normal, full screen and presentation states. (#1857)
- A
gap
style attribute has been added, which adds space between adjacent children of a box. (#1943) - Windows can now respond to changes in focus and visibility. (#2009)
- The line height of multi-line text on a Canvas can now be configured. (#2144)
- Apps can now interrogate whether they are in dark mode on some platforms. (#2841)
- Toga GTK now supports location services via integration with GeoClue and the XDG Location Portal. (#2990)
- Android cameras now describe themselves in terms of the direction they are facing (if known). (#2996)
toga.Row
andtoga.Column
can now be used as a shorthand fortoga.Box(style=Pack(direction=...))
. (#3010)- Style properties can now be passed directly to a widget's constructor, or accessed as attributes, without explicitly using a
style
object. (#3011) - The
Pack.margin
property (and its deprecated alias,padding
) can now be accessed via bracket notation, as instyle["margin"]
. (Previously this worked for the "sub-properties" ofmargin_top
etc., but not formargin
/padding
itself.) (#3044) - The
WebView
widget now supports the retrieval of cookies. (#3068) - The Travertino library, providing the base classes for Toga's style and box model, is now managed as part of the Toga release process. (#3086)
- Initial experimental support for GTK4 has been added to Toga's GTK backend. This support can be enabled by setting
TOGA_GTK=4
in your environment. (#3087) - The
align_items
andjustify_content
properties now have the aliaseshorizontal_align_items
,vertical_align_items
,horizontal_align_content
andvertical_align_content
that explicitly describe layout behavior in the named direction. (#3111) - A Briefcase bootstrap for generating Positron apps (i.e., apps that are a web view in a native wrapper - Electron, but more positive, because it's Python) was added. (#3114)
- The Travertino library now has 100% test coverage. (#3129)
- The Travertino library now includes APIs to perform alpha blending operations and conversion of RGBA to HSLA color representations. (#3140)
- Travertino now has an
aliased_property
descriptor to support declaration of property name aliases in styles. (#3213) - The Pack style representation is now a dataclass. This should allow most IDEs to infer the names and types of properties and suggest them in creating a Pack instance. (#3215)
Bugfixes
- On WinForms, Box, Canvas, Label and ImageView widgets now have transparent backgrounds by default. (#767)
- On iOS, Box, Canvas, ImageView, Label, ProgressBar, ScrollContainer and Slider widgets now have transparent backgrounds by default. (#767)
- DPI scaling on Windows has been improved, fixing a number of resolution and scaling issues. (#2155)
- On WinForms, the background color of a widget now correctly honors the alpha channel of the selected color. (#2425)
- If a WebView widget completes navigation to a new URL while it is being destroyed, an error is no longer raised on macOS or iOS. (#2512)
- Widgets on the iOS backend no longer leak memory when destroyed. (#2849)
- On macOS, when a dialog is in focus,
App.current_window
now returns the host window, instead of raising anAttributeError
. (#2926) - An issue with creating dialogs on the Textual backend was resolved. (#2949)
- A newly added, visible widget will be hidden when added to a widget hierarchy where an ancestor is hidden. (#2950)
- Multi-letter keyboard navigation in Tables and DetailedLists with the WinForms backend is now functional. (#2956)
- The web backend now uses the Shoelace default font in all browsers. (#3035)
- The
hardware
example app now correctly demonstrates usage of the location services methodcurrent_location
. (#3045) - On GTK, when a window is hidden, the
window.state
getter now correctly reports the state when the window was last visible. (#3105) - On Android, setting a custom background color on widgets now preserves the native look and feel. (#3118)
- On Android, setting widget background color to
TRANSPARENT
now correctly sets it to transparent. (#3118) - The binary dependencies for the GTK backend have been updated to reflect changes in requirements of PyGObject. (#3143)
- On Android,
DetailedList
andTable
widgets now correctly unset the highlight color when a row is deselected. (#3156) - (#3163)
Backward Incompatible Changes
- "Full screen mode" on an app has been renamed "Presentation mode" to avoid the ambiguity with "full screen mode" on a window. The
toga.App.enter_full_screen
andtoga.App.exit_full_screen
APIs have been renamedtoga.App.enter_presentation_mode
andtoga.App.exit_presentation_mode
, respectively. (#1857) - The use of generators as event handlers has been deprecated. Any generator-based event handler can be converted into an asynchronous co-routine by converting the handler to
async def
, and usingawait asyncio.sleep(t)
in place ofyield t
(for some sleep intervalt
). (#2721) - Widgets now create and return their implementations via a
_create()
method. A user-created custom widget that inherits from an existing Toga widget and uses the same implementation will require no changes. Any user-created widgets that need to specify their own implementation should do so in_create()
and return that implementation. Existing user code inheriting fromWidget
that assigns its implementation before callingsuper().__init__()
will continue to function, but give aRuntimeWarning
; unfortunately, this change breaks any existing code that doesn't create its implementation until afterward. Such usage will now raise an exception. (#2942) - Pack's
padding
andalignment
properties have been renamed tomargin
andalign_items
, to match their CSS analogues.align_items
also now takes CSS-compatible values ofSTART
,CENTER
, andEND
, instead ofalignment
'sTOP
/RIGHT
/BOTTOM
/LEFT
/CENTER
. The old names are still present — andalignment
still takes its existing values — but these constants are deprecated. (#3033) - APIs marked as deprecated in Toga 0.4.0 and earlier have been removed. (#3059)
- The
show()
andhide()
APIs can no longer be used on a window while it is in aMINIMIZED
,FULLSCREEN
orPRESENTATION
state. (#3109) - If window size is unchanged as a result of a resize request, a layout of window content is no longer triggered. (#3131)
- If you're running on Ubuntu 22.04, Debian 11 or Debian 12, you'll need to manually add a pin for
PyGObject==3.50.0
to your project. This is because recent PyGObject releases specify a requirement ongirepository-2.0
, which is not available on older Debian-based distributions. A manual pin is required because there's no way to express a dependency on a system package as part of Python's requirements specifications. (#3143) - The signature of the
apply
method ofBaseStyle
(and thusPack
) has changed. Rather than taking a property name and value, it now takes only the name, and the style object checks its own current value for that property to know what to apply. This method is normally used internally, but any user code calling it manually will get aDeprecationWarning
if it supplies two arguments. (#3159) - Travertino's
BaseStyle.reapply()
(and thus Toga'sPack.reapply()
) has been deprecated; the correct usage is now to call.apply()
with no arguments. User code is unlikely to ever call this method, but Toga releases before (and including) 0.4.8 calls it extensively, so users who update Travertino but not Toga will receive aDeprecationWarning
. (#3160) - Travertino's
declaration
module has been split into two smaller modules,properties
andstyle
. Toga's imports have been updated to the new locations, but users with Toga <= 0.4.8 that update Travertino to 0.5.0 (and anyone who may be accessing these classes in user code) will get aDeprecationWarning
explaining the situation. (#3195)
Documentation
- Tutorial 3 was extended to explain limitations of the browser example, and suggest some extension activities. (#2998)
- A summary of Toga's API design principles has been added. (#3170)
- Widget screenshots have been added for the Web backend. (#3259)
Misc
- #2547, #2893, #2920, #2921, #2922, #2923, #2925, #2931, #2932, #2933, #2934, #2935, #2936, #2939, #2941, #2942, #2951, #2954, #2965, #2967, #2968, #2970, #2975, #2976, #2978, #2980, #2981, #2982, #2983, #2984, #2985, #2986, #2987, #2988, #2989, #2991, #2997, #3006, #3007, #3008, #3016, #3020, #3029, #3030, #3031, #3039, #3040, #3041, #3042, #3044, #3047, #3048, #3051, #3053, #3055, #3057, #3058, #3060, #3061, #3061, #3062, #3064, #3065, #3071, #3072, #3073, #3074, #3075, #3076, #3077, #3078, #3079, #3080, #3081, #3082, #3089, #3091, #3092, #3093, #3094, #3095, #3096, #3097, #3098, #3099, #3100, #3101, #3102, #3103, #3104, #3115, #3117, #3120, #3121, #3122, #3123, #3124, #3125, #3132, #3133, #3141, #3144, #3145, #3146, #3147, #3148, #3149, #3150, #3151, #3154, #3165, #3166, #3169, #3173, #3174, #3175, #3176, #3178, #3183, #3184, #3186, #3189, #3190, #3191, #3196, #3197, #3198, #3199, #3200, #3201, #3202, #3203, #3204, #3205, #3206, #3207, #3208, #3209, #3210, #3212, #3213, #3216, #3219, #3220, #3221, #3222, #3223, #3224, #3225, #3226, #3227, #3228, #3229, #3230, #3231, #3232, #3233, #3243, #3244, #3245, #3246, #3247, #3248, #3249, #3250, #3251, #3252, #3253, #3254, #3255, #3257, #3258