omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    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.


    Undocumented functions and classes

    Pythonista
    4
    6
    3797
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ccc
      ccc last edited by

      pythonista_undocumented.py compares introspection against http://omz-software.com/pythonista/docs/ios

      Did I get it right?

      keychain.get_services()
      motion.MotionUpdates()
      notification.set_badge()
      scene.Button()
      scene.Number()
      scene.TextLayer()
      scene.curve_ease_back_in()
      scene.curve_ease_back_in_out()
      scene.curve_ease_back_out()
      scene.dedent()
      scene.iskeyword()
      scene.recordtype()
      scene.size()
      scene.sqrt()
      sound.Player()
      speech.get_languages()
      speech.is_speaking()
      ui.ActivityIndicator()
      ui.ListDataSourceList()
      ui.add_observer()
      ui.begin_image_context()
      ui.close_all()
      ui.end_editing()
      ui.end_image_context()
      ui.get_keyboard_frame()
      ui.remove_all_observers()
      ui.remove_observer()
      ui.set_alpha()
      
      1 Reply Last reply Reply Quote 0
      • JonB
        JonB last edited by

        ActivityIndicator is in the docs, buried a bit. It is a class.

        1 Reply Last reply Reply Quote 0
        • omz
          omz last edited by

          Thanks, I'll definitely get back to this list when I work on the documentation...

          A couple of brief comments for now:

          • ui.set_alpha() -- Sets the alpha (transparency) value when drawing in an ImageContext or view
          • ui.remove_all_observers(), ui.remove_observer() -- will probably be removed or replaced with something that actually works (intentionally undocumented because of being unfinished)
          • ui.get_keyboard_frame() -- should return the current frame of the on-screen keyboard in screen coordinates, not fully reliable.
          • ui.begin_image_context(), ui.end_image_context() -- used internally by the ImageContext context manager, there isn't really any reason to use these directly.
          • ui.ListDataSourceList() -- used internally by ListDataSource, probably not very useful outside of it.
          • ui.ActivityIndicator() -- A "spinner" view class, the most important methods are start() and stop() which start/stop the animation. Can be used for loading indicators and the like. Should be mostly functional.
          • speech.is_speaking(), speech.get_languages() -- These should be documented in the current beta.
          • sound.Player() -- An object-oriented music/sound player interface... Basically, you create one by passing an absolute path to the constructor. It has play, pause and stop methods, which should be self-explanatory, and a current_time attribute which can be used for scrubbing etc.
          • scene.dedent(), scene.iskeyword(), scene.recordtype(), scene.size(), scene.sqrt(), scene.Number() -- Stuff that the scene module imports from elsewhere.
          • scene.TextLayer(), scene.Button -- Very simple layer subclasses written in Python (so you could look at the code via inspect.getsource).
          • notification.set_badge() -- Sets the badge number of the app icon (only works when you've given the app permission to send notifications via one of the other notification methods)
          • motion.MotionUpdates() -- Simple context manager for executing a block of code with motion updates enabled.
          • keychain.get_services() -- Returns a list of service/username tuples that have been stored via keychain.set_password().
          1 Reply Last reply Reply Quote 0
          • dgelessus
            dgelessus last edited by

            @omz re. _scene_types.recordtype - why not use collections.namedtuple from the stdlib? ;)

            1 Reply Last reply Reply Quote 0
            • omz
              omz last edited by

              @degelessus If I remember correctly, because I wanted them to be mutable.

              1 Reply Last reply Reply Quote 0
              • dgelessus
                dgelessus last edited by

                Now I'm wondering why there's no collections.namedlist in the stdlib.

                @ccc, the scene easing functions you listed are documented at the end of the scene module docs.

                And here are a few more undocumented attributes and what I've found out about them so far:

                # Get the device's screen size. Works exactly like ui.get_screen_size(), but returns ints instead of floats.
                width, height = console._get_screen_size()
                
                # Does... something, mainly crashing the app.
                console._save_raw_image_data(data, str2, width, height, str5)
                
                # Class that provides motion data.
                obj = _motion.MotionManager()
                
                # Start and stop updates for this MotionManager.
                MotionManager.start()
                MotionManager.stop()
                
                # Various motion data. Unlike all others, rotation_rate has no high-level getter in the motion module.
                MotionManager.attitude
                MotionManager.gravity
                MotionManager.magnetic_field
                MotionManager.rotation_rate
                MotionManager.user_acceleration
                
                # Instance of MotionManager used by the top-level motion functions.
                motion.shared_manager
                
                # Write text to console in stdout/stderr style. Colors can be changed using the console module.
                _outputcapture.CaptureStdout(text)
                _outputcapture.CaputreStderr(text)
                
                # Read text from console input field.
                text = _outputcapture.ReadStdin(some_int_that_has_no_effect)
                
                # Display an exception.
                _outputcapture.HandleException(line, type_str, value_str, traceback_str)
                
                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Powered by NodeBB Forums | Contributors