-
lukaskollmer
(fyi, you should wrap the code block with ```, to get proper syntax highlighting. reading the code w/out that is really difficult)
-
lukaskollmer
@eddo888 what do you mean?
did you swizzleopenPythonistaURL:
instead of swizzling -[UIApplicationDelegate application:openURL:options:]
? -
lukaskollmer
Kinda. While there is no API to make a phone call, you can use the
webbrowser
module to open atel:PHONE_NUMBER
url. This will show a dialog, asking for confirmation to initiate the call. This should work for you since, when the call ends, you automatically return to Pythonista.For example, this code makes a call to Amazon Germany:
import webbrowser webbrowser.open('tel:+49-800-2629663')
-
lukaskollmer
Yes it is indeed possible to load a font from a
.otf
file at runtime (in fact, I implemented such a feature months ago using thectypes
module), but that's never as good as a proper first-party implementation. -
lukaskollmer
@scj643 it says that the type error is caused by the 3rd argument (which makes sense since 1 is
self
and 2 iscmd
).
And it can't say which type it wants because it doesn't know what to expect, it just knows that what it got was wrong -
lukaskollmer
@scj643 because it doesn't know. The objc runtime can only get the expected type encoding of an argument or a method's return value. The type encoding specifies which primitive type an argument should be (
float
/int
/char
/etc) or whether it is an object. But since ObjC classes are basically just glorifiedstruct
s, the runtime can't differentiate between different classes. (That's why objc has theid
type to represent "any objc-object") -
lukaskollmer
It'd be nice if Pythonista offered Apple's
SF-Mono
font in addition to the existing fonts.Another font that'd be very well suited for Pythonista is
FiraCode
, which is a monospaced font with programming ligatures.
SinceUITextView
already supports ligatures, FiraCode would work fine in Pythonista.Example of FiraCode:
cc @omz
-
lukaskollmer
@scj643 said:
Currently objc_utils throws very cryptic errors when a type issue happens with an objc function
What exactly do you mean? I never found the
objc_util
errors to be cryptic at all. -
lukaskollmer
Pythonista already includes a "draw image and save to camera roll" script in the examples folder. You might be able to learn from that how to save the contents of your view to an image.
You can find the example script at
Documents -> Examples -> User Interface
-
lukaskollmer
The built in
ui.TableView
supports only one action per row, but you can use theobjc_util
module to create a customUITableView
and implement the-[UITableViewDelegate tableView:editActionsForRowAtIndexPath:
method which returns an array of table view row actions.An other option for multiple actions per row would be to simply add an info accessory button to each row and show an alert w/ more options when the accessory button is pressed