Optimize `console` module for macOS app
@@ -288,6 +288,9 @@ def input(prompt=""):
prompt: Text printed before the user's input without a newline.
"""
+ if __platform__ is macOS:
+ return builtins.input(prompt)
+
if __host__ is widget:
return None
@@ -307,13 +310,14 @@ def input(prompt=""):
return str(userInput)
-if __platform__ is iOS:
- __PyOutputHelper__ = PyOutputHelper
-
def print(*objects, sep=None, end=None):
"""
Prints to the Pyto console, not to the stdout. Works as the builtin `print` function but does not support printing to a custom file. Pyto catches by default the stdout and the stderr, so use the builtin function instead. This function is mainly for internal use.
"""
+
+ if __platform__ is macOS:
+ return builtins.print(objects, sep=sep, end=end)
+
if sep is None:
sep = ' '
if end is None:
@@ -396,7 +400,7 @@ if __host__ is not widget:
if __platform__ is iOS:
self.pyAlert.addAction(title)
else:
- self.nsAlert.addButtonWithTitle(title)
+ self.nsAlert.addButtonWithTitle_(title)
self.__actions__.append(title)
def addDestructiveAction(self, title):
@@ -436,6 +440,13 @@ if __host__ is not widget:
if __platform__ is iOS:
return self.pyAlert._show()
elif __platform__ is macOS:
+
+ def order_front():
+ time.sleep(0.1)
+ self.nsAlert.window.orderFrontRegardless()
+
+ threading.Thread(target=order_front).start()
+
return self.__actions__[self.nsAlert.runModal()-1000]
else:
