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.


    Reverse engineering challenge to cvp

    Pythonista
    4
    33
    14165
    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.
    • JonB
      JonB last edited by

      I wonder if pydoc.ModuleScanner.run would do the trick, rather than requiring a way of registering docs. Just use built in docstrings.
      Or a modified version that searches only non-built in modules. ModuleScanner seems to search all modules for docstring matching the keyword. Then could generate pydoc htmldoc on the fly, maybe.

      1 Reply Last reply Reply Quote 2
      • JonB
        JonB @mikael last edited by

        @mikael uncomment the first print url line, then select a normal help item.

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

          I'm truly impressed by what you've been able to accomplish in such a short amount of time! It might even make sense to provide a built-in hook for this kind of thing, not quite sure yet about the implications.

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

            @mikael Did you find the right path?

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

              @omz It could be sufficient that you allow the concaténation of a user (zipped) doc file to the standard one.

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

                @cvp I don't know, I would guess that augmenting the search results with online sources could potentially be more useful, not sure though.

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

                  @omz I agree but a big advantage of your (marvelous, did I already say it 😀?) application is that the entire doc is local and thus available off-line.

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

                    @cvp That's certainly true (and thanks for the kind words!), and I can definitely see both use cases, but running a script hook would allow you to do that as well, I guess.

                    1 Reply Last reply Reply Quote 1
                    • JonB
                      JonB last edited by

                      @omz Are you using your own pregenerated keyword index in your search?
                      Or are you actually indexing on the fly?

                      Also, not sure if you have ever seen jedi-vim-- since jedi already (sort of) knows what module a highlighted term belongs to, one option might be to use something akin to jedi-vim for showing the pydoc/docstring associated with an object. There are some other jedi-vim features which would be cool , (showing function prototypes wlin the autocomplete) though I'm not sure what that would really look like in iOS without getting really cluttered.

                      It would totally be useful to just search docstrings in user modules that are not already included in the built in docs, and just show that, even if not fancy HTML formatted -- hooking user generated .zips would be cool, but only useful for docs specifically written to be indexed by pythonista. Going with generic pydoc would allow any module to hook into the quickhelp. My quick tests with pydoc.ModuleSearcher seem like it is pretty quick ( and also provides callback and quit capability, so ought to be pretty performance)

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

                        @JonB Yes, I'm using a pregenerated keyword index, though I guess using jedi to extract docstrings could be an interesting option as well, might be more accessible than a script hook.

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

                          @mikael said:

                          Could you please remind me how to find the right path, as it is different from the Document files?

                          open doc tab (via ? button), then swipe to right and run this script

                          # open doc tab (via ? button), then swipe to right and run this script
                          import console
                          import editor
                          from   objc_util import *
                          import ui
                          
                          @on_main_thread
                          def searchDocPath():
                          	win = ObjCClass('UIApplication').sharedApplication().keyWindow()
                          	main_view = win.rootViewController().view() 
                          	ret = '' 
                          	def analyze(v,indent):
                          		ret = None
                          		for sv in v.subviews():
                          			#print(indent,sv._get_objc_classname())
                          			if 'UIWebBrowserView' in str(sv._get_objc_classname()):
                          				print(sv.webView().mainFrameURL())
                          			ret = analyze(sv,indent+'  ')
                          			if ret:
                          				return ret
                          	ret = analyze(main_view,'')
                          	return ret
                          
                          if __name__ == "__main__":
                          	searchDocPath() 
                          
                          cvp 1 Reply Last reply Reply Quote 0
                          • cvp
                            cvp @cvp last edited by cvp

                            @mikael I didn't know where to post this, congratulations 😀
                            Ha, Finland

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

                              @cvp, thanks, I’m so happy!

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

                                @mikael You have all to be happy:

                                • you have Pythonista
                                • you're a Python master
                                • you live in Finland

                                Seriously, I hope that your and your family are safe, be careful with this shit of virus

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