Autocompletion: strange behaviour

  • Nicolas Chopin

    Nicolas Chopin - 2006-09-05

    I really like DrPython; it works smoothly with matplotlib, which is not the case for many other editors. Plus, its interface is simple and clean.

    I have problems with the Autocompletion plugin v 0.0.3 (calltips are really nice for python beginners like me):
    Office computer: Linux, Kubuntu 6.06, DrPython installed from repositories, plugin does not seem to work.
    Home computer: Linux, Suse 10.1, most recent version of DrPython, autocompletion works except that calltips work only for standard commands, e.g.:
    range(10)    # works
    scipy.arange(10) # does not
    (Even if scipy has been imported)

    In the latter case, is it a bug, or simply a current limitation?

    Hope you can help. Anyway, thanks for developping this nice python editor. I forgot to say: it's really easy to install, even when it's not packaged for your distro!

    All te best
    Nicolas Chopin

    • Nicolas Chopin

      Nicolas Chopin - 2006-09-05

      Oops, I meant CodeCompletion, not AutoCompletion, sorry.

      Another quick comment: it would be nice to have 'interactivity' by default, or button that toggle this feature on/off, rather than having to enter -i manually in the settings. People like me who are interested in Numerical analysis needs interactivity for analysing/plotting data; etc. That's only my two cents!

    • Franz Steinhaeusler

      Hello Nicolas,

      I'm not the project manager. I have installed the Version 0.2.1. Please verify again: Help => About Plugin =>

      Version: 0.2.1

      Yes, I can confirm this, this scipy.arange doesn't produce any tip, but in PyCrust it does.

      (I don't know, if Daniel is still working on DrPython).
      I suspect, the reason is following:
      If I compare PyCrust and DrPython:

      import wx
      wx.Frame( Calltip is "Proxy of C++ class"; this is not so useful) and in Pycrust, all the parameters are shown.

      If I look at the source, I see another difference:

      class Frame(TopLevelWindow):
          """Proxy of C++ Frame class"""
          def __repr__(self):
              return "<%s.%s; proxy of C++ wxFrame instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
          def __init__(self, *args, **kwargs):
              __init__(self, Window parent, int id=-1, String title=EmptyString,
                  Point pos=DefaultPosition, Size size=DefaultSize,
                  long style=DEFAULT_FRAME_STYLE, String name=FrameNameStr) -> Frame

      This means, pycrust takes the __init__ doc string, but DrPython the class definition string.

      So I think, this plugin could be improved, but I don't think, it is a bug.

      For the interactivity, I don't quite understand:

      Do you mean changing between prompt and edit window by "Program => Open a Python Interpreter (F7)" and "View => Toggle Prompt (F6)"?

    • Nicolas Chopin

      Nicolas Chopin - 2006-09-06

      Hi Franz,
      thanks for the quick reply.

      CodeCompletion not working (KUbuntu 6.06): checked again, with last versions of DrPython and plugin (installed directly or manually by downloading first); still not working at all.

      CodeCompletion working partially (Suse 10.1): I am not sure I follow all the technical details, but I believe you!  ;-)
      Can I forward these comments to the authors of this plug-in, so that they consider applying these change?

      Interactivity: sorry, I was unclear.
      When I execute a script, I'd like to be able to enter additional commands in the shell after the execution; for instance, additionnal plots or calculations. By default, I guess the shell is simply 'terminated' when the script end. BTW, this also make plot disapear, which is inconvenient!
      For the moment, I simply put -i in Preferences>General>Python Arguments, but a I guess a more obvious way to do this would be beneficial for newbies; especially those in numerical analysis like me.
      Actually, I have just realised that -i is not a perfect solution, because if run the script x times, it opens x shells; in matlab or similar environments, you always keep one shell open, which you can 'restart' if needed by some command.

      • Franz Steinhaeusler

        Hi Nicolas,

        For the code completion:
        best would be to inform Dan, the Boss here. :)

        Your other suggestion, I think, would be a feature requset.

        I sent him an email.

    • Franz Steinhaeusler

      Hello, Dan is very busy and it is not so likely he will have time later too.

      I want to answer again instead:

      For the code completion:

      I normally use PyCrust (I've written some patches) to get autocompletion;
      even with some search capabilities und show derived/non dervied class members.
      like that:

      It would be an idea to write such an animal for DrPython. ExtCodeCompletion or so. I
      don't want to change the normal codecompletion plugin.

      For the second question: You could try to create a plugin for that.

      • Nicolas Chopin

        Nicolas Chopin - 2006-09-14

        Well, thanks anyway.

        For call tips, well I'll try to live without it. :-)

        For my other suggestion:
        I am not a developper, so I guess writing a plug-in is a bit beyond my capacities. On the other hand, I realised that what I am trying to do could be achieved in the following simple way:
        * Add a command (+keybinding) to submit current Document to current prompt
        * Add another command (+keybinding) to submit highlighted text to current prompt.

        Provided, you enter -i in the "Python Arguments" in Preferences, you get very close to the Matlab behaviour, e.g. only one shell constantly open, in which you submit your calculations.

        Is there any documentation somewhere on how to write plug-ins? I could give a try.
        Alternatively, I could try to bring this to the attention of the Scipy community, and see if anyone can help.

        Again, it's quite rare to find an editor which works smoothly with Matplotlib (the plotting library of Scipy); so scientists using python should definitevely have a look at DrPython. On the other hand, I think that scientists really need the kind of shell interaction I've described before.

        Thanks again for your time,

    • Franz Steinhaeusler

      You already tried some plugins or
      installed some plugins from:

      In your DrPython Help, there should be a good explanation
      of how to write your own plugins.
      DrPython Help
      Customize and Extend => Plugins

      or also on the Homepage of DrPython:

      You can also find some of my page.

      Try them and study them, which come closest to yours and alter it.
      Believe me, developing plugins is interesting and enjoyment.

      Most plugins should work.
      I say this, because a lot of changes happened in the core,
      while the plugins were created.

      If you have another question then or right now,
      please do not hesitate to ask.
      I personally don't have so much time now, sorry,
      to assist you in extending or writing in plugins.

      You could also take a look at the scripts sections here in the forum or on my page.


      • Nicolas Chopin

        Nicolas Chopin - 2006-09-15

        incredible! I thought this was way too complicated for me, but you're right, it's not so hard.
        I've just tried to fiddle around yesterday night, and managed to write two scripts that do the commands I described above!
        In case(?) anybody would be interested by similar commands, the scripts look like:

        # Submit selected text to Prompt
        # Submit entire text to Prompt

        And then I added keybindings manually to these two scripts.

        If I manage to understand why the CodeCompletion plug-in does not work on one of my machine, everything will be perfect! :-)

        Thank you very much for your help and advice!

        • Franz Steinhaeusler

          you're welcome, I'm glad you got the solution! :)

          Oh yes, I'm curious about every script.

          I'm also interested to get a better code completion.
          I (as I said) patched pycrust, and if I have time,
          I want to try a new plugin for code completion,
          or if you want to try, all the better. :-)
          And as I said already, I find it really a pity,
          DrPython is not developed any further.

          I think, it is already so usable, that only left are a few bug fixes (if they are exist of course) and maybe simplify some things.

          There are so many interfaces for plugins, so maybe most can be done with it.


Log in to post a comment.