quickmacapp 2023.4.24__tar.gz → 2025.1.21__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,9 +1,13 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: quickmacapp
3
- Version: 2023.4.24
3
+ Version: 2025.1.21
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
7
+ Requires-Dist: pyobjc-framework-Cocoa
8
+ Requires-Dist: pyobjc-framework-ExceptionHandling
9
+ Requires-Dist: pyobjc-framework-UserNotifications
10
+ Requires-Dist: twisted[macos_platform,tls]
7
11
 
8
12
  QuickMacApp
9
13
  ==============================
@@ -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 = "2023.04.24"
12
+ version = "2025.01.21"
13
13
  dependencies = [
14
14
  "pyobjc-framework-Cocoa",
15
15
  "pyobjc-framework-ExceptionHandling",
@@ -1,5 +1,5 @@
1
1
  from ._quickapp import Actionable, Status, mainpoint, menu, quit
2
- from ._interactions import ask, choose, answer
2
+ from ._interactions import ask, choose, answer, getpass
3
3
 
4
4
  __all__ = [
5
5
  "Actionable",
@@ -10,4 +10,5 @@ __all__ = [
10
10
  "ask",
11
11
  "choose",
12
12
  "answer",
13
+ "getpass",
13
14
  ]
@@ -6,10 +6,12 @@ from AppKit import (
6
6
  NSAlertThirdButtonReturn,
7
7
  NSAlert,
8
8
  NSApp,
9
+ NSTextField,
10
+ NSSecureTextField,
11
+ NSCenterTextAlignment,
9
12
  )
10
13
  from Foundation import (
11
14
  NSRunLoop,
12
- NSTextField,
13
15
  NSRect,
14
16
  )
15
17
  from twisted.internet.defer import Deferred
@@ -68,7 +70,25 @@ async def choose(values: Iterable[tuple[T, str]], question: str, description: st
68
70
  return potentialResults[await asyncModal(msg)]
69
71
 
70
72
 
71
- async def ask(question: str, description: str="", defaultValue: str="") -> str | None:
73
+ async def getpass(question: str, description: str="") -> str | None:
74
+ # set a sample value to get a reasonable visual width
75
+ txt = NSSecureTextField.textFieldWithString_("testing " * 4)
76
+ # clear it out because of course we don't want to use that value
77
+ txt.setStringValue_("")
78
+ txt.setAlignment_(NSCenterTextAlignment)
79
+ txt.setMaximumNumberOfLines_(5)
80
+ return await _ask(question, description, txt)
81
+
82
+
83
+ async def ask(question: str, description: str="", defaultValue: str=""):
84
+ # TODO: version of this with a NSSecureTextField for entering passwords
85
+ txt = NSTextField.alloc().initWithFrame_(NSRect((0, 0), (200, 100)))
86
+ txt.setMaximumNumberOfLines_(5)
87
+ txt.setStringValue_(defaultValue)
88
+ return await _ask(question, description, txt)
89
+
90
+
91
+ async def _ask(question: str, description: str, txt: NSTextField) -> str | None:
72
92
  """
73
93
  Prompt the user for a short string of text.
74
94
  """
@@ -78,9 +98,6 @@ async def ask(question: str, description: str="", defaultValue: str="") -> str |
78
98
  msg.setMessageText_(question)
79
99
  msg.setInformativeText_(description)
80
100
 
81
- txt = NSTextField.alloc().initWithFrame_(NSRect((0, 0), (200, 100)))
82
- txt.setMaximumNumberOfLines_(5)
83
- txt.setStringValue_(defaultValue)
84
101
  msg.setAccessoryView_(txt)
85
102
  msg.window().setInitialFirstResponder_(txt)
86
103
  msg.layout()
@@ -1,9 +1,13 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: quickmacapp
3
- Version: 2023.4.24
3
+ Version: 2025.1.21
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
7
+ Requires-Dist: pyobjc-framework-Cocoa
8
+ Requires-Dist: pyobjc-framework-ExceptionHandling
9
+ Requires-Dist: pyobjc-framework-UserNotifications
10
+ Requires-Dist: twisted[macos_platform,tls]
7
11
 
8
12
  QuickMacApp
9
13
  ==============================
File without changes