Skip to content

Commit

Permalink
refactor: replace toasts_winrt with winrt-Namespace packages
Browse files Browse the repository at this point in the history
Better maintained by third party and resolves the concern that made me create the first party package to begin with. Closes #106
  • Loading branch information
DatGuy1 committed Jan 7, 2024
1 parent 689c6bd commit eae10a2
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

autodoc_mock_imports = ["toasts_winrt"]
autodoc_mock_imports = ["winrt"]
autodoc_default_options = {"members": True, "member-order": "bysource", "undoc-members": True}

# -- Options for HTML output -------------------------------------------------
Expand Down
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

packages = ["windows_toasts", "scripts"]

requires = ["toasts-winrt==1.0.0"]
requires = [
"winrt-Windows.Data.Xml.Dom==2.0.0b2",
"winrt-Windows.Foundation==2.0.0b2",
"winrt-Windows.Foundation.Collections==2.0.0b2",
"winrt-Windows.UI.Notifications==2.0.0b2",
]

with open("README.md", "r", encoding="utf-8") as f:
readme = f.read()
Expand Down
6 changes: 3 additions & 3 deletions src/windows_toasts/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
from dataclasses import dataclass
from typing import Dict, Optional

from toasts_winrt import system
from toasts_winrt.windows.foundation import IPropertyValue
from toasts_winrt.windows.ui.notifications import ( # noqa: F401
from winrt import system
from winrt.windows.foundation import IPropertyValue
from winrt.windows.ui.notifications import ( # noqa: F401
ToastActivatedEventArgs as WinRtToastActivatedEventArgs,
ToastDismissalReason,
ToastDismissedEventArgs,
Expand Down
2 changes: 1 addition & 1 deletion src/windows_toasts/toast.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from collections.abc import Iterable
from typing import Callable, Literal, Optional, TypeVar, Union

from toasts_winrt.windows.ui.notifications import ToastDismissedEventArgs, ToastFailedEventArgs
from winrt.windows.ui.notifications import ToastDismissedEventArgs, ToastFailedEventArgs

from .events import ToastActivatedEventArgs
from .toast_audio import ToastAudio
Expand Down
2 changes: 1 addition & 1 deletion src/windows_toasts/toast_document.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import datetime
from typing import Optional, TypeVar, Union

from toasts_winrt.windows.data.xml.dom import IXmlNode, XmlDocument, XmlElement
from winrt.windows.data.xml.dom import IXmlNode, XmlDocument, XmlElement

from .toast import Toast
from .toast_audio import ToastAudio
Expand Down
2 changes: 1 addition & 1 deletion src/windows_toasts/toasters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from datetime import datetime
from typing import Optional, TypeVar

from toasts_winrt.windows.ui.notifications import (
from winrt.windows.ui.notifications import (
NotificationData,
NotificationUpdateResult,
ScheduledToastNotification,
Expand Down
6 changes: 3 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ def real_run_fixture(pytestconfig) -> Iterator[None]:
if pytestconfig.getoption("real_run"):
yield
else:
with patch("toasts_winrt.windows.ui.notifications.ToastNotificationManager.create_toast_notifier"), patch(
"toasts_winrt.windows.ui.notifications.ToastNotifier.show"
), patch("toasts_winrt.windows.ui.notifications.ToastNotificationHistory.clear"):
with patch("winrt.windows.ui.notifications.ToastNotificationManager.create_toast_notifier"), patch(
"winrt.windows.ui.notifications.ToastNotifier.show"
), patch("winrt.windows.ui.notifications.ToastNotificationHistory.clear"):
yield


Expand Down
2 changes: 1 addition & 1 deletion tests/test_toasts.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def test_custom_duration_toast():


def test_attribution_text_toast():
from toasts_winrt.windows.ui.notifications import ToastNotification
from winrt.windows.ui.notifications import ToastNotification

newToast = Toast()
newToast.text_fields = ["Hello, World!", "Foobar"]
Expand Down

0 comments on commit eae10a2

Please sign in to comment.