Due to excessive spam, I've decided to make the forum read-only for now, so that I can clean everything up, and then I would suggest to move the discussion elsewhere (GitHub probably), where I don't have to deal with spam accounts as much. I would preserve the forum's archive for future reference, but new discussions should be started elsewhere.
Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Posts made by omz
-
Forum is read-only for now
-
RE: Pythonista 3.4 is out!
@LankyDonkey I have a suspicion that the crashes might have to do with UIKit APIs not being called on the main (UI) thread somewhere in your code (or possibly in Pythonista's own code, I'm not sure). Using UIKit on a secondary thread has always been discouraged by Apple, but it's enforced more strictly when building with the iOS 16 SDK, so this could be why the new version's behavior is different.
This is just a guess, but you could try decorating your functions/methods that use ObjC APIs with
@objc_util.on_main_thread
, like this:@objc_util.on_main_thread def button_tapped(sender): # ...
-
RE: Help with dialog field
@ProfessorFlaw Here's a possible solution. The
kb_input_alert
function below allows you to get a short text input, using the on-screen (PyKeys) keyboard. It doesn't support cursor placement or text selection, so it's only really suitable for short input, but I hope it's still helpful.import keyboard import ui import dialogs class KeyboardTypingView(ui.View): def __init__(self, *args, **kwargs): self.label = ui.Label(frame=self.bounds, flex='wh') self.label.font = ('<System>', 20) self.placeholder = ui.Label(frame=self.bounds.inset(0, 8, 0, 8), flex='wh') self.placeholder.font = ('<System>', 20) self.add_subview(self.label) self.add_subview(self.placeholder) self.label.text = '' self.placeholder.alpha = 0.3 self.cursor = ui.View(bg_color='#63aaff') self.add_subview(self.cursor) self.update_cursor() self.entered_text = '' super().__init__(*args, **kwargs) def kb_should_insert(self, text): if text == '\n': # Return pressed self.entered_text = self.label.text keyboard.set_view(None) self.label.text += text self.update_cursor() return '' def update_cursor(self): self.placeholder.hidden = len(self.label.text) > 0 self.label.size_to_fit() self.cursor.frame = (self.label.frame.max_x, 0, 3, self.bounds.h) def kb_should_delete(self): self.label.text = self.label.text[0:-1] self.update_cursor() return False def kb_input_alert(title='Enter text'): if not keyboard.is_keyboard(): return dialogs.input_alert(title) v = KeyboardTypingView() v.placeholder.text = title keyboard.set_view(v) v.wait_modal() return v.entered_text def main(): name = kb_input_alert('Enter your name') dialogs.hud_alert(f'Hello, {name}!') if __name__ == '__main__': main()```
-
RE: Help with dialog field
@ProfessorFlaw
input_alert
and similar functions are not available in the custom keyboard because they would require showing the system keyboard, which isn't possible in custom keyboards. I realize that this is unfortunate, but right now, this simply isn't supported. -
RE: 'No route to host' error in beta 340009 when using multicast
@ttobias It looks like multicast networking requires an additional entitlement from Apple that I have to apply for, and explain why my app needs this... I think the previous version might still have worked because it was built with an older iOS SDK. I'll look into this, but it might take a little while.
-
RE: Black on Pythonista?
@upwart Release notes are available in in the documentation, and there's a link from empty tabs.
-
RE: Bug: scene.load_pil_image raises SystemError
@upwart Thank you, I'll look into it.
-
RE: 3.4: URL schemes not working in built-in browser
I made a last-minute change to use
WKWebView
instead ofUIWebView
for the in-App browser, and it looks like I forgot about some details.Here's sort of a workaround, similar to the one @cvp suggested, but opening in a tab, like the built-in one.
import ui import webbrowser from urllib.parse import urlparse class WebDelegate (object): def webview_should_start_load(self, webview, url, nav_type): if urlparse(url).scheme in ['http', 'https', 'file']: return True else: webbrowser.open(url) def open_browser(url): v = ui.WebView() v.name = 'Web Browser' v.delegate = WebDelegate() v.load_url(url) v.present('panel') import os url = 'file://' + os.path.abspath('test.html') open_browser(url)
-
RE: Pythonista 3.4 is out!
@ForceBru Thanks for the crash log. Unfortunately, it has become pretty difficult to test on iOS 12, and apparently no one in the beta was still using it, so it slipped through. Sorry about this! I'll look into it.
-
Pythonista 3.4 is out!
Title says it all, I've finally managed to get the new version through app review, so the new features (Python 3.10, Shortcuts, pandas...) are now available to everyone.
Here are the release notes for 3.4.
-
RE: I have a dumb editor question.
@Zoot You can skip the closing bracket by typing it.
-
RE: What what what!! New version in TestFlight!!!
@ccc Agreed, that would be nicer. I've already submitted this build to Apple for review, but since
black
is included as a module, it should be relatively easy build an improved version for yourself as an editor action.This is basically the entire code that runs when the "Black" option is selected in the "Reformat Code" dialog:
import black, editor src = editor.get_text() mode = black.mode.Mode() res = black.format_file_contents(src, fast=True, mode=mode) if res != src: editor.replace_text(0, len(src), res)
-
RE: What what what!! New version in TestFlight!!!
@dng88 I've sent you an invite as well.
-
RE: What what what!! New version in TestFlight!!!
@mestela I've sent an invite to the email address in your forum account.
-
RE: Update Markdown2?
@WyldKard You should be able to put an updated version of the
markdown2
module in the "Python Modules/site-packages" folder of the App Store version. -
RE: PyKeys
@ihf Okay, it looks like some of the keyboard examples are broken… In the "Text Effects" script, the
faker
import seems to be the problem (I'm guessing it's consuming too much memory). -
RE: What what what!! New version in TestFlight!!!
@ftourand The invite links remains the same, but it usually fills up pretty quickly, and then I have to go and manually delete people who accept the invite, but never install the app...
-
RE: What what what!! New version in TestFlight!!!
@burnhamaustin @ftourand I've just opened a few more slots.
-
RE: PyKeys
@ihf Is it possible that you changed/deleted the sample scripts somehow? Could you try "Restore Examples" (from the settings)?