quickmacapp 2025.4.4__tar.gz → 2025.4.15__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quickmacapp
3
- Version: 2025.4.4
3
+ Version: 2025.4.15
4
4
  Summary: Make it easier to write Mac apps in Python
5
5
  Description-Content-Type: text/x-rst
6
6
  License-File: LICENSE
@@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta"
9
9
  name = "quickmacapp"
10
10
  description = "Make it easier to write Mac apps in Python"
11
11
  readme = "README.rst"
12
- version = "2025.04.04"
12
+ version = "2025.04.15"
13
13
  dependencies = [
14
14
  "pyobjc-framework-Cocoa",
15
15
  "pyobjc-framework-ExceptionHandling",
@@ -1,36 +1,43 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  from dataclasses import dataclass
4
- from zoneinfo import ZoneInfo
5
4
  from types import TracebackType
6
5
  from typing import Any, Awaitable, Callable, Protocol, TypeAlias
6
+ from zoneinfo import ZoneInfo
7
7
 
8
8
  from datetype import DateTime
9
-
10
- from Foundation import NSError, NSLog, NSObject, NSDateComponents
9
+ from Foundation import (
10
+ NSTimeZone,
11
+ NSDateComponents,
12
+ NSError,
13
+ NSLog,
14
+ NSObject,
15
+ NSCalendar,
16
+ NSCalendarIdentifierGregorian,
17
+ )
11
18
  from objc import object_property
12
19
  from twisted.internet.defer import Deferred
13
20
  from UserNotifications import (
14
- UNNotificationCategoryOptions,
15
21
  UNAuthorizationOptionNone,
22
+ UNCalendarNotificationTrigger,
16
23
  UNMutableNotificationContent,
17
24
  UNNotification,
18
25
  UNNotificationAction,
19
- UNNotificationActionOptions,
20
26
  UNNotificationActionOptionAuthenticationRequired,
21
27
  UNNotificationActionOptionDestructive,
22
28
  UNNotificationActionOptionForeground,
29
+ UNNotificationActionOptions,
23
30
  UNNotificationCategory,
24
31
  UNNotificationCategoryOptionAllowInCarPlay,
25
32
  UNNotificationCategoryOptionHiddenPreviewsShowSubtitle,
26
33
  UNNotificationCategoryOptionHiddenPreviewsShowTitle,
34
+ UNNotificationCategoryOptions,
27
35
  UNNotificationPresentationOptionBanner,
28
36
  UNNotificationPresentationOptions,
29
37
  UNNotificationRequest,
30
38
  UNNotificationResponse,
31
39
  UNNotificationSettings,
32
40
  UNNotificationTrigger,
33
- UNCalendarNotificationTrigger,
34
41
  UNTextInputNotificationAction,
35
42
  UNUserNotificationCenter,
36
43
  )
@@ -178,7 +185,7 @@ class NotificationTranslator[T](Protocol):
178
185
  The application has requested to send a notification to the operating
179
186
  system, serialize the Python object represneting this category of
180
187
  notification into a 2-tuple of C{notificatcionID}, C{userData} that can
181
- be encapsulated in a L{UNNotificationRequest}.
188
+ be encapsulated in a C{UNNotificationRequest}.
182
189
  """
183
190
 
184
191
 
@@ -208,7 +215,19 @@ class Notifier[NotifT]:
208
215
  async def notifyAt(
209
216
  self, when: DateTime[ZoneInfo], notification: NotifT, title: str, body: str
210
217
  ) -> None:
218
+
211
219
  components: NSDateComponents = NSDateComponents.alloc().init()
220
+ components.setCalendar_(
221
+ NSCalendar.calendarWithIdentifier_(NSCalendarIdentifierGregorian)
222
+ )
223
+ components.setTimeZone_(NSTimeZone.timeZoneWithName_(when.tzinfo.key))
224
+ components.setYear_(when.year)
225
+ components.setMonth_(when.month)
226
+ components.setDay_(when.day)
227
+ components.setHour_(when.hour)
228
+ components.setMinute_(when.minute)
229
+ components.setSecond_(when.second)
230
+
212
231
  repeats: bool = False
213
232
  trigger: UNNotificationTrigger = (
214
233
  UNCalendarNotificationTrigger.triggerWithDateMatchingComponents_repeats_(
@@ -177,7 +177,7 @@ class QuickApplication(NSApplication):
177
177
  """
178
178
  QuickMacApp's main application class.
179
179
 
180
- @ivar keyEquivalentHandler: Set this attribute to a custom L{NSResponder}
180
+ @ivar keyEquivalentHandler: Set this attribute to a custom C{NSResponder}
181
181
  if you want to handle key equivalents outside the responder chain. (I
182
182
  believe this is necessary in some apps because the responder chain can
183
183
  be more complicated in LSUIElement apps, but there might be a better
@@ -12,18 +12,18 @@ from zoneinfo import ZoneInfo
12
12
  from datetype import DateTime
13
13
  from UserNotifications import (
14
14
  UNNotificationCategoryOptionCustomDismissAction as _UNNotificationCategoryOptionCustomDismissAction,
15
- UNUserNotificationCenter as _UNUserNotificationCenter,
16
15
  UNNotificationDefaultActionIdentifier as _UNNotificationDefaultActionIdentifier,
17
16
  UNNotificationDismissActionIdentifier as _UNNotificationDismissActionIdentifier,
18
17
  )
18
+ from UserNotifications import UNUserNotificationCenter as _UNUserNotificationCenter
19
19
 
20
20
  from quickmacapp._notifications import (
21
21
  NotificationTranslator,
22
+ _AppNotificationsCtxBuilder,
22
23
  _BuiltinActionInfo,
23
24
  _PlainNotificationActionInfo,
24
25
  _setActionInfo,
25
26
  _TextNotificationActionInfo,
26
- _AppNotificationsCtxBuilder,
27
27
  )
28
28
 
29
29
  __all__ = [
@@ -139,6 +139,9 @@ class Notifier[NotifT](Protocol):
139
139
 
140
140
 
141
141
  class NotificationConfig(Protocol):
142
+ """
143
+ The application-wide configuration for a notification.
144
+ """
142
145
 
143
146
  def add[NotifT](
144
147
  self,
@@ -147,7 +150,35 @@ class NotificationConfig(Protocol):
147
150
  allowInCarPlay: bool = False,
148
151
  hiddenPreviewsShowTitle: bool = False,
149
152
  hiddenPreviewsShowSubtitle: bool = False,
150
- ) -> Notifier[NotifT]: ...
153
+ ) -> Notifier[NotifT]:
154
+ """
155
+ Add a new category (represented by a plain Python class, which may have
156
+ some methods that were decorated with L{response}C{(...)},
157
+ L{response.text}C{(...)}).
158
+
159
+ @param category: A Python type that contains the internal state for the
160
+ notifications that will be emitted, that will be relayed back to
161
+ its responses (e.g. the response methods on the category).
162
+
163
+ @param translator: a translator that can serialize and deserialize
164
+ python objects to C{UNUserNotificationCenter} values.
165
+
166
+ @param allowInCarPlay: Should the notification be allowed to show in
167
+ CarPlay?
168
+
169
+ @param hiddenPreviewsShowTitle: Should lock-screen previews for this
170
+ notification show the unredacted title?
171
+
172
+ @param hiddenPreviewsShowSubtitle: Should lock-screen previews for this
173
+ notification show the unredacted subtitle?
174
+
175
+ @return: A L{Notifier} that can deliver notifications to macOS.
176
+
177
+ @note: This method can I{only} be called within the C{with} statement
178
+ for the context manager beneath C{configureNotifications}, and can
179
+ only do this once per process. Otherwise it will raise an
180
+ exception.
181
+ """
151
182
 
152
183
 
153
184
  def configureNotifications() -> _AbstractAsyncContextManager[NotificationConfig]:
@@ -208,7 +239,7 @@ def configureNotifications() -> _AbstractAsyncContextManager[NotificationConfig]
208
239
  uselessness, and in this oversimplified case, it is! However, if you are
209
240
  sending notifications to a user, you really need to be able to I{respond}
210
241
  to notifications from a user, and that's where your notification data class
211
- as well as L{responder} comes in. To respond to a notification when the
242
+ as well as L{response} comes in. To respond to a notification when the
212
243
  user clicks on it, you can add a method like so::
213
244
 
214
245
  class MyNotificationData:
@@ -226,7 +257,7 @@ def configureNotifications() -> _AbstractAsyncContextManager[NotificationConfig]
226
257
  be serialized and deserialized with C{MyNotificationLoader.toNotification}
227
258
  (converting your Python class into a macOS notification, to send along to
228
259
  the OS) and C{MyNotificationLoader.fromNotification} (converting the data
229
- sent along with the user's response back into a L{MyNotificationData}).
260
+ sent along with the user's response back into a C{MyNotificationData}).
230
261
 
231
262
  @note: If your app schedules a notification, then quits, when the user
232
263
  responds (clicks on it, uses a button, dismisses it, etc) then the OS
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quickmacapp
3
- Version: 2025.4.4
3
+ Version: 2025.4.15
4
4
  Summary: Make it easier to write Mac apps in Python
5
5
  Description-Content-Type: text/x-rst
6
6
  License-File: LICENSE
File without changes