Skip to content

A proper implementation of clear_toast is desired #65

Description

@sharl

python : Python 3.12.10
win11toast : 0.36.3

PS C:\Users\sharl> cd $env:TEMP
PS C:\Users\sharl\AppData\Local\Temp> mkdir toast
PS C:\Users\sharl\AppData\Local\Temp> cd toast
PS C:\Users\sharl\AppData\Local\Temp\toast> python3.12.exe -m venv .venv
PS C:\Users\sharl\AppData\Local\Temp\toast> .\.venv\Scripts\activate
(.venv) PS C:\Users\sharl\AppData\Local\Temp\toast> python -m pip install -U pip win11toast

(...snip)

(.venv) PS C:\Users\sharl\AppData\Local\Temp\toast> pip list
Package                              Version
------------------------------------ -------
pip                                  26.1.2
typing_extensions                    4.15.0
win11toast                           0.36.3
winrt-runtime                        3.2.1
winrt-Windows.Data.Xml.Dom           3.2.1
winrt-Windows.Foundation             3.2.1
winrt-Windows.Foundation.Collections 3.2.1
winrt-Windows.Globalization          3.2.1
winrt-Windows.Graphics.Imaging       3.2.1
winrt-Windows.Media.Core             3.2.1
winrt-Windows.Media.Ocr              3.2.1
winrt-Windows.Media.Playback         3.2.1
winrt-Windows.Media.SpeechSynthesis  3.2.1
winrt-Windows.Storage                3.2.1
winrt-Windows.Storage.Streams        3.2.1
winrt-Windows.UI.Notifications       3.2.1

then,

>>> from win11toast import clear_toast
>>> app_id = 'some app name'
>>> group = 'group'
>>> tag = 'tag'
>>> clear_toast()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\sharl\AppData\Local\Temp\toast\.venv\Lib\site-packages\win11toast.py", line 446, in clear_toast
    history.clear(app_id)
TypeError: Invalid parameter count
>>>

another one:

>>> from winrt.windows.ui.notifications import ToastNotificationManager
>>> history = ToastNotificationManager.history
>>> dir(history)
['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_assign_array_', '_from', '_iids_', '_runtime_class_name_', 'as_', 'clear', 'clear_with_id', 'get_history', 'get_history_with_id', 'remove', 'remove_group', 'remove_group_with_id', 'remove_grouped_tag', 'remove_grouped_tag_with_id']
>>> history.clear()
>>> history.clear_with_id(app_id)
>>> history.remove()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Invalid parameter count
>>> history.remove(app_id)
>>> history.remove_group(group)
>>> history.remove_group_with_id(group, app_id)
>>> history.remove_grouped_tag(tag, group)
>>> history.remove_grouped_tag_with_id(tag, group, app_id)
>>>

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions