After a whole year, Toasted became more polished day after day, so unfortunately this resulted in many breaking changes but in the end, it also resulted with a bunch of cool features. Not every change is listed here, since some of them are internal changes that are not supposed to be used by developers.
Features
- Create images from Windows icon font (Segoe Fluent or Segoe MDL2), which then can be used as an icon in toast elements.
- A custom URI has also been added for convenience, for example if you set
icon://E706
as a source in image element, it will show a sun/brightness icon.
- A custom URI has also been added for convenience, for example if you set
- Specify a custom sound for toast that will be played when toast is shown. Both HTTP links and file paths are supported.
- To set a custom sound, use
sound
attribute. When a custom sound has provided, notification's own sound will be muted and "winsound" module (from stdlib) will be used to play sounds. You can also usemute_sound
parameter inshow()
method to silent the toast for once, which can be useful if you plan to send one-after-one toasts.
- To set a custom sound, use
- Instead of notifications appearing with the name "Python", make them appear with a special name and icon by adding the required keys with
Toast.register_app_id()
method to the Windows registry. To remove the registered app ID, useToast.unregister_app_id()
. Windows doesn't require a reboot for toast app registrations, however, you need to make sure that all notifications sent by this library are cleared from Action Center to make Windows to clear the icon/name cache.
Enhancements
Toast.update()
now returns a boolean and acceptsmissing_ok
parameter to not raise an exception if notification was not found.Toast.show()
now returns aToastResult
, so setting a callback is not the only option anymore. Setting a callback is still and will be supported, andshow()
method will return aToastResult
regardless of if you set a callback or not.- Added
Toast.is_registered_app_id
,Toast.can_send_from_app_id
,Toast.uses_custom_sound
,Toast.uses_windows_sound
,Toast.get_theme_info
. - Added support for
data:
URIs as a source to images. - Updated examples. They are now created with fully Python, instead of loading a toast elements JSON.
🚩 Breaking changes
Group
andSubgroup
elements are removed, simply use lists of lists instead when defining elements. Old JSON payloads won't work.- Elements are now stored in
Toast.elements
, rather thanToast.data
. Toast.to_xml
is superseded byToast.to_xml_string
.Toast.remote_images
has renamed toToast.remote_media
. The JSON key has also renamed to "remote_media".- Fixed typo in
Button.is_content
toButton.is_context
. ms-appdata
URIs now resolve to the%APPDATA%
.- If base path is None, current directory will be used instead for relative local file paths.
- Handlers now only gets
ToastResult
object that wraps all related information. - Removed
history_*
methods, instead usetoast.history
(instance, bound to toast) orHistory
(class, for any toast). - Renamed
source_app_id
toapp_id
. It is also now shared in all Toast instances. As app IDs are meant for per process, it was meaningless to keep different values for each Toast instance. Toast.show()
parameter signature has changed (positional).- Removed
Toast.use_button_style
. It is now determined automatically if toast has a button withstyle
. - For JSON import, component types are now defined with
_type
key instead of@type
key.
Internal changes
ToastMediaFileSystem
is now used for downloading media files to the temporary directory, thus externalfs
dependency has removed.- Better URI handler, now it can resolve paths more properly.
- It appears to be, notification groups are not a thing in Windows 11, so
group_id
won't be set for notifications (even if provided one) if running in Windows 11. ToastSound
is no longer an Enum.- Added
FEATURE_NOT_AVAILABLE
value toToastNotificationMode
for cases when notification mode can't be determined on specific versions of Windows. Toast._toast_handler
is nowToast._callback_result
.Toast._show_handler
is nowToast._callback_show
.Toast._manager
is nowToast._imp_manager
.Toast._toast
is nowToast._imp_toast
.ToastElement.to_xml
is superseded byToastElement.to_xml_data
, and returns aXMLData
object instead.- New internal methods for
Toast
.