omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. omz

    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.


    • Profile
    • Following 0
    • Followers 85
    • Topics 40
    • Posts 2250
    • Best 446
    • Controversial 0
    • Groups 1

    omz

    @omz

    admin

    I make Pythonista and Editorial – @olemoritz on Twitter.

    780
    Reputation
    32708
    Profile views
    2250
    Posts
    85
    Followers
    0
    Following
    Joined Last Online
    Website omz-software.com Location Berlin

    omz Unfollow Follow
    admin

    Best posts made by omz

    • Python 3.x Progress Update

      Python 3.x support has been a topic of discussion here for years, and I finally have some news on that front. :)

      As I've teased a bit earlier on Twitter, I'm working on a version of Pythonista that is based on Python 3.5.1 instead of the current 2.7.5. I've made pretty good progress recently, and the app is already in a completely usable state with most custom and third-party modules working. The app's UI is essentially identical to Pythonista 2.0.

      Things that are working so far:

      • Python 3.5.1 with all new syntax features and most standard library modules (exceptions are basically the same as in 2.x, i.e. mostly Tkinter)
      • Numpy, matplotlib, Pillow, PyCrypto, and most other third-party modules that are currently included in Pythonista 2.0 (in some cases more recent versions than in 2.0)
      • Most custom modules (ui, scene, contacts, reminders, ...)

      Not working yet:

      • A few custom modules (currently only notification, editor, and canvas)
      • The app extension (invoking Pythonista from the share sheet)
      • The URL scheme
      • The documentation browser
      • The example scripts aren't completely ported yet
      • A couple of third-party modules that are included in Pythonista 2.0, but aren't (yet?) compatible with Python 3 (screenplain, midiutil, mechanize, xhtml2pdf)

      There are probably still a few bugs in the ported versions of my custom modules. Getting the string/unicode handling to work right has been tricky in some cases, and I haven't tested all modules very thoroughly yet.

      I expect that I'll have the first beta ready within the next week or so, hopefully without some of the limitations I've listed above. I'll post a new beta signup form here when I'm ready.

      Lastly, this will be a separate app, or "paid upgrade" if you will. This is, by the way, one of the reasons I did not charge for the 2.0 update. It'll co-exist with Pythonista 2.x for a while because there are still valid reasons to prefer Python 2.7, and I don't want to force people to upgrade to a version that is not backwards-compatible.

      As I've mentioned before, creating an app that supports both Python 2 and 3 would be very difficult, if not impossible. The only way this could theoretically work would require relaunching the app in order to switch versions, and I honestly think that having Python 3 in a separate app will result in a better user experience and less confusion. It will be possible to access files in Pythonista 2.x from 3.x though (and vice-versa).

      posted in Pythonista
      omz
      omz
    • Pythonista Slack Chat

      I'll put this here as a sticky post, so that it's easier to find, without digging through old threads...

      We now have a Slack chat for discussing all things Pythonista, and everyone who's interested can sign up here:

      → Join Pythonista Slack

      This is not intended to be a replacement for the forum. In a lot of cases, it is much more useful to post questions and feedback here because the forum content is indexed by search enginees, available publicly (without signing up for anything), and generally more long-lived. A lot of questions come up more than once, and it's useful to be able to link to forum topics later.

      Note: This topic is locked, but if you have any trouble with the Slack signup, please feel free to create a new thread.

      posted in Pythonista
      omz
      omz
    • Pythonista 2 Release

      Good news: Pythonista 2 has been approved by Apple, and will be out on Monday (tomorrow).

      I would recommend that all beta users do a backup before updating because I'm not completely sure if a clean update will be possible from the beta. Actually, you might also want to do this if you are not using the beta, just to be sure. There's always a possibility that something goes wrong with a major update like this.

      2.0 will be a free update for existing users, but I intend to increase the price for new purchases to $9.99 (version 1.5 is currently $6.99).

      posted in Pythonista
      omz
      omz
    • RE: Python 3.x Progress Update

      @ccc @OI

      The final version of Python 3.6 is still quite a long way off, so I'm not too concerned about that...

      The current beta is taking a bit longer because I'm in the process of making some pretty substantial changes. In short, I've found out that my assumptions about using Python 2 + 3 in the same app were incorrect, and that it is in fact possible to do this, even without having to restart the app when switching interpreters.

      As I really only want to have one version of Pythonista, to avoid confusion and backwards-compatibility woes, my current plan is to make Pythonista 3 support both Python 2.7 and 3.5. It's actually working quite well already, but there are just a lot of little details to consider, things to move around, refactor, etc.

      This doesn't change my plan to make this a paid upgrade btw.

      posted in Pythonista
      omz
      omz
    • Helper script for embedding pyui files in single-file scripts

      I've just built a little script to make it easier to share UI scripts. Sometimes, it's just more convenient to have everything in a single file for simple copy/paste – this basically generates code to load the UI from an embedded (compressed) string instead of from an external .pyui file.

      Here's the code:

      EmbedPyui.py (Gist)

      (some more details about how to use it in the docstring)

      And this is an example of what the generated code looks like (this is from the bundled ColorMixer example):

      data = '''\
      QlpoOTFBWSZTWXGZJlkAA4FfgBAAWGd/8D/HGYq/79/6UAOe4DODcAKGkSeRpNPSNlHoTQ
      AMgAAADSBoaKnsEk0AABoAAABElCmxEyah6T9SGgNqeKGjTQGTR6hzAATAAEwAAAAACpJC
      NTAp6NNINqADQAaeo00zUeLNIRevYhXCrDnMydv5ddssuKvtW15+Xbtq5Jb7tdp+9zbxAt
      0YFOEK1PYeGP1TvLaJaWQwRKSmwu10yMYD+I3AZhIpeImxVjxApqNRWMEpqlaWFSEBpDL/
      aufdj7d+bciZInpuffUawrbLDoAvAbnRnsGwjlCwY3AQoiMikcVFxjaN+bHfmJbntv5eF2
      +uFa81a57LMdue7TprLZNiPISIBIJIpCEjJJyQUTLnrPqyRNwBBIRSQ6G5UCEdREAQhnkc
      6VdTklBZifrGeSmnRkpxuY0EVsxA1pVB5Qsz4MiA4S8EXkSFKFsCzBrVMbE5AonjPMqxNC
      wkHGbGhkyVvKNgvhUrMzbhyRIMUtxbanSoYg+DVEpEagCDTofplQ3HJlBms7EigcLOq3RN
      EFnsFtYRbfKW4/Xg+4el7Z5BiEa4QvDTfExOSYnYNrB8bvRTDiUXComARAkIEKYi2uQM0N
      wquuSlujXUQINEaOD0so0QHiOEwuir0S0zm12Bd4dWkF5BtsG9FSbCDFaughLw0+P7WKlQ
      DzAdvV2jJ1bfW8DetJUYFS5Uu4fTq9o4DhGuO1X7cZkkZhiMA2oxWh2ilVcKF0RctN1Xou
      kwaxiLoYw7hbBokOM/0utJ81GN1q71DY/mocm3dN37tJFhz/3wTOL29qnhmhI3MriMuzv2
      ugX87PJph2cWzffrVjBZ02cdE6BvZLDeyOedIocsxTdhkSLRyblpDmvSXjP5aUqNoy4N14
      syUvKLVLTKNLr1xGhgilLNaVL6cqRkhh0DTObOaIqIqSZhaGcahUjYMBllDUyaHJr8EpNg
      7t+MqoZhg357F85kWcrJrJ0yLGcapzSM2mYR5gNDHyATsKOUTCXuuAaYcWnwTbJzAd/ApR
      Ucg6hwdb9dn84ZR9Rl4V+Zav+LuSKcKEg4zJMsgA==
      '''
      import ui
      import bz2
      from base64 import b64decode
      pyui = bz2.decompress(b64decode(data))
      v = ui.load_view_str(pyui.decode('utf-8'))
      

      Should work in Pythonista 2 and 3 (beta).

      posted in Pythonista
      omz
      omz
    • RE: [Feature Request] Pythonista built-in file picker

      I've started working on a file picker dialog that I might add to the dialogs module. You can find the code here:

      → File Picker.py (works in Pythonista 2 and 3)

      The API isn't exactly like you suggested, but similar, and quite extensible. As a demo, I've implemented an alternative "data source" that shows files and folders from an FTP server instead of the local file system. It would easily be possible to build a Zip file browser with this as well...

      The idea is basically that you can subclass TreeNode to represent whatever kind of tree structure you need. The TreeDialogController gets one TreeNode as its root and a couple of options (multiple selection etc.). The TreeNode is then responsible for loading its children (each of the children is also a TreeNode), and each node has a title/icon that is shown in the table view. For cases when a node might take a relatively long time to load its children, TreeDialogController has an async_mode option that causes it to automatically dispatch the loading to a background thread, and to show a spinner overlay while loading.

      Overall, the UI is very close to Pythonista's own directory picker, i.e. I'm using the same icons, table view animations, etc.

      Screenshot

      posted in Pythonista
      omz
      omz
    • Barcode / QR Code Camera Scanner Demo (objc_util)

      Someone asked me on Twitter if Pythonista had support for scanning barcodes, using the camera. While there's nothing like that built-in, I looked around a bit, and it turns out that there are APIs for this in Apple's AVFoundation framework, so I thought it might be interesting to build a wrapper around that.

      This demo shows a live camera preview, and it plays a sound when a barcode or QR code is found in the viewfinder. The scanned code (a number for EAN codes, URLs or text for QR codes...) is shown in an overlay label. When the view is closed, a list of all (unique) codes that were scanned is printed to the console.

      Here's the code: Barcode Scanner.py (Gist)

      And a screenshot:

      posted in Pythonista
      omz
      omz
    • RE: When will OMZ release an Xcode Template for Python3?

      Here's a first attempt at a Python 3-based Xcode template: https://www.dropbox.com/s/5l94m0xjbot5je0/Pythonista3AppTemplate.zip?dl=1

      This is roughly equivalent to the current App Store version (not the 3.3 beta), and not final, just something to play around with for people interested in the Xcode template. Let me know if anything's unclear.

      posted in Pythonista
      omz
      omz
    • RE: Python 3.6

      I'm making progress... There's still a lot left to do, but it's looking good so far.

      posted in Pythonista
      omz
      omz
    • RE: [Feature Request] Pythonista built-in file picker

      I think this could be a useful addition to the dialogs module.

      posted in Pythonista
      omz
      omz

    Latest posts made by omz

    • 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).

      posted in Pythonista
      omz
      omz
    • 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...

      posted in Pythonista
      omz
      omz
    • RE: notification.get_scheduled() not working

      @xgm Thanks, I'll look into it.

      posted in Pythonista
      omz
      omz
    • RE: What what what!! New version in TestFlight!!!

      @burnhamaustin @ftourand I've just opened a few more slots.

      posted in Pythonista
      omz
      omz
    • RE: PyKeys

      @ihf Is it possible that you changed/deleted the sample scripts somehow? Could you try "Restore Examples" (from the settings)?

      posted in Pythonista
      omz
      omz
    • RE: What what what!! New version in TestFlight!!!

      @ftourand I've just opened up a few more slots: https://testflight.apple.com/join/qDkBu2ur

      posted in Pythonista
      omz
      omz
    • RE: What what what!! New version in TestFlight!!!

      @Olaf I've just uploaded a new build to TestFlight, and it's currently processing. It should be available soon.

      posted in Pythonista
      omz
      omz
    • RE: Widget + Keyboard

      @lublak You can show a custom user interface in the qwerty area, try the "Emoji Paint" script, for example. This isn't really meant to implement keyboard layouts though, and implementing all the different touch gestures would be quite difficult.

      posted in Pythonista
      omz
      omz
    • RE: Widget + Keyboard

      @lublak said in Widget + Keyboard:

      There are two things that I still have as a question.

      widget. Is there in the new version also the possibility to create real widgets that you can place on the homescreen? That would be really cool. Currently only one widget can be used and that only in this side channel.

      The widget in Pythonista is of the old (iOS 8) type, and cannot be placed on the homescreen. I might make a new widget at some point, but the existing code is fundamentally not compatible with the new(-ish) widgets that were added in iOS 15.

      the keyboard is QWERTY. But I would like to have a German layout (Qwertz with äöüß). How can this be realized?
      I have seen so far only that you can create scripts.

      The keyboard only supports the QWERTY layout. It would be quite a lot of work to implement all the different international layouts, and it isn't meant to replace your main keyboard anyway, so it didn't seem worth the effort.

      posted in Pythonista
      omz
      omz
    • RE: Providing QuickLook with an Image from ui.Image

      @Austin-Ares You'd have to save your image to a temporary file to useconsole.quicklook(). Here's an example of a function that takes a PIL or ui image, saves it to a temporary file, shows the quicklook preview, and then deletes the file (no ObjC needed):

      import console
      import ui
      from PIL import Image
      import os
      
      def quicklook_img(img):
          tempfilename = '.ql_image.png'
          if isinstance(img, ui.Image):
              with open(tempfilename, 'wb') as f:
                  f.write(img.to_png())
          elif isinstance(img, Image.Image):
              img.save(tempfilename)
          else:
              raise TypeError('Expected an image')
          console.quicklook(tempfilename)
          os.remove(tempfilename)
      
      #Demo:
      quicklook_img(Image.open('test:Peppers'))
      
      posted in Pythonista
      omz
      omz