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.


    ObjCClass('SUIViewController') does not work anymore in Pythonista beta but ...

    Pythonista
    2
    4
    152
    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.
    • cvp
      cvp last edited by cvp

      In Pythonista beta, the SUIViewController class does not exist anymore in objc_util but it has been replaced by SUIViewController_PY3.

      For instance, this little script works

      # UIReferenceLibraryViewController
      # 	display definition of a word from system dictionaries
      #		nb: system display is allowed but not to get the result...
      from objc_util import *
      import ui
      
      uiview = ui.View()
      uiview.frame = (0,0,300,300)
      uiview.present('sheet')
      
      objc_uiview = ObjCInstance(uiview)
      
      SUIViewController = ObjCClass('SUIViewController_PY3')
      vc = SUIViewController.viewControllerForView_(objc_uiview)	
      
      @on_main_thread
      def m():
      	UIReferenceLibraryViewController = ObjCClass('UIReferenceLibraryViewController').alloc().initWithTerm_('bonjour')
      	UIReferenceLibraryViewController.setModalPresentationStyle_(3) 
      	vc.presentViewController_animated_completion_(UIReferenceLibraryViewController, True, None)#handler_block)
      
      m()
      
      

      Note also that the m def code now needs to be run in main thread, what was not needed before.

      cvp 1 Reply Last reply Reply Quote 0
      • cvp
        cvp @cvp last edited by cvp

        @ihf in outline.py, replace

        SUIViewController = ObjCClass('SUIViewController')
        

        By

        SUIViewController = ObjCClass('SUIViewController_PY3')
        

        and the script will go a little bit further

        That will be in the future next version V01.37 when all will be ok, thus, sincerely, unknown target date

        JonB 1 Reply Last reply Reply Quote 0
        • JonB
          JonB @cvp last edited by

          @cvp FWIW, I think the PY3 versions were available in the last version. So that code should also be backwards compatible.

          cvp 1 Reply Last reply Reply Quote 0
          • cvp
            cvp @JonB last edited by

            @JonB said

            FWIW, I think the PY3 versions were available in the last version. So that code should also be backwards compatible.

            It is probable but the class name without _PY3 has disappeared only from the beta

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB Forums | Contributors