Bug fixes plus a couple of suggestions

Developers
2004-09-30
2013-04-26
  • Chris Wilson
    Chris Wilson
    2004-09-30

    I sent the following to Dan earlier via email, but as far as I can tell it didn't make it. So here are the a couple of bugs (one pretty major) with the associated fixes.

    The following fixes refer to line numbers in v3.5.3.

    -------------------------------------------------------------------------

    Bug #1 - Annoying

    DrPython crashes and fails to load if the Visible By Default property of the source browser is set to true.

    Fix:

    drpython.py, change line 3186 to read:

    self.currentpage.OnSize(None)

    -------------------------------------------------------------------------

    Bug #2 - Minor

    After highlighting some text and selecting Find (and presumably replace) the text is shown correctly in the Search For combo-box, but the OK button to allow you to actually start the search is disabled until you change the search for text in some way.

    Fix:

    drFindReplaceDialog.py, add new line after 1061:

    self.OnTextChnaged(None)

    NOTE - This is the spelling as per the code, but it should probably be changed along with the actual function name and any calls to read "OnTextChanged".

    -------------------------------------------------------------------------

    Bug #3 - Quite a show-stopper really

    A number of the Scintilla shortcuts weren't working properly. For example - pressing Ctrl whilst using the cursor keys highlights as well as moving to the next word. Pressing Shift as well, jumps words as expected without highlighting. Exactly the opposite of what you'd expect.

    But much more importantly, pressing TAB at any point will return you to the top of the current source file.

    Fix:

    drShortcuts.py, change line 181:

    Remove the wx.stc.STC_CMD_DOCUMENTSTART entry from the list.

    -------------------------------------------------------------------------

    A couple of other things:

    Might I suggest adding a set of constants for use with the "currentlanguage" property to make things more readable.

    And a new feature proposal:

    Having an option to open files which are imported by the current source file. This could be added as either a dynamically built main menu, or an option available from a popup menu in the source browser. It may need to search the current directory then the python path to find the first instance of the specified file, but it would save a lot of time when it comes to bug hunting in other peoples code if nothing else.

    Despite my initial enthusiasm, I've not had chance to contribute anything to the DrPython project for quite some time. It's not that I'm any less interested, it's just I've been extremely busy and traveling a good deal for work over the past few months.

    Hopefully this will change soon. Keep up the good work guys.

     
    • Got it.

      Just quickly, first two bugs fixe din 3.5.4, third not a bug (hunch), try resetting shortcuts.

      Finally, the Open Imported Modules is in 3.5.4 (great idea!).  I still need to mess around with it a bit, so you can do it completely with the keyboard.

      Cheers,
      Dan

       
    • Hi Chris,

      do you use Windows or Linux?

      """
      Bug #3 - Quite a show-stopper really

      A number of the Scintilla shortcuts weren't working properly. For example - pressing Ctrl whilst using the cursor keys highlights as well as moving to the next word. Pressing Shift as well, jumps words as expected without highlighting. Exactly the opposite of what you'd expect.

      But much more importantly, pressing TAB at any point will return you to the top of the current source file.
      """

      I never saw any of these misbehaviours.
      is your stc shortcuts file messed up?
      What happens, if you rename it and start drpython again?

      >Hopefully this will change soon. Keep up the good work guys.

      Thanks, it would be great, if you will have ever more time for drPython ;)

       
    • Chris Wilson
      Chris Wilson
      2004-10-01

      Hi Franz,

      I'm running Windows XP on this particular machine, and I always do a vanilla install of DrPython for each new release to avoid any potential versioning problems/redundent source file issues, plus I don't have any plug-ins installed.

      Ordinarily I keep my preferences files between versions, but removing these completely and letting DrPython recreate the entire thing from scratch made no difference at all. Removing the line detailed above however fixed the problem.

      OK. Now today I've installed v3.5.4 which works fine, and now when I re-install v3.5.3 the problem is gone. Very strange! I'm not even going to spend time trying to work out how that's happened, I'll just be glad it's not an issue anymore.

      Still, it kept me entertained for half an hour or so yesterday when I should have been working, and I got chance to re-familiarise myself with the code which is always useful.

       
    • Yeah, about that....

      Turns out there was a big error (just where you said Chris).  So its fixed.

      Also turns out stc shortcuts were never reset!  That is fixed too.  Things should work smoothly now.

       
    • Bo
      Bo
      2004-10-04

      Here is a big bad bug. When I try to save a file with swedish characters it saves a file with zero bytes in it, without returning an error message. So I am unable to use it at all.

      Here are the offending characters 

      Im runing in windows XP using 3.5.5 with python 2.3.3

       
    • Ahoy.  Are you using the encoding plugin?

      Just using the core program, and saving the characters,
      I do not get an error at all.

      BTW, what version of wxPython are you running?

      Cheers,
      Dan

       
    • Bo
      Bo
      2004-10-12

      Ok, I loaded the encoding plugin and that solved it, however I still think its a bug that the file gets trashed with no warning.

      Why not include the encoding as default, its not exactly huge? Besides it worked with earlier versions, so you realy should do something about it.

      Bo)

       
    • I took it out of the main program because it could slow down opening large files.

      I'll look into doing something to keep the file from getting trashed.

      Any chance you can test and figure out what is going on where?  Perhaps there is a traceback if run from the prompt?

       
    • Dan Kruger
      Dan Kruger
      2004-10-14

      A suggestion that could compliment the Load Imported Modules idea...

      An option (at least for Python Editing) that allows you to store a profile (or profiles) that configure sys.path on load of DrPython.

      This would provide the Load Imported Modules an idea as to where it should begin looking for files to load.

      Also, Load Imported Modules isn't parsing out modules if their imports are indented into the script.  I haven't pinpointed the exact location of the problem yet.

      On a similar note, the source browser doesn't take into account if something is a multi-line string
      (starting with 3 quotes).  I happened to have a program that defined an sql statement something like this:
      """select files from
         import where x=3
      """

      "import where x=3" finds it's way into the source browser.

      Thanks,
      Dan

       
    • The indented thing is one of those erros that are so bleeding obvious they never occur to you ;), thanks, I'll fix it.  I'll look into the sys.path bit.

      The multiple line thing is, however, more difficult.

      One solutuion that occurs to me as I type, is to simply remove all triple quoted strings from the search copy of the text, before searching.  Of course, this would mess up line endings, and I don't think the overhead of checking the style of every match is neccessarily worth it.

      Perhaps replacing the triple quoted strings with all '#'s, except for newline characters?  That might work nicely.

      And yes, I often answer my own questions like this.
      (And there is some fascinating cognitive psych research into why this happens, as well as some interesting implications, but that's a whole new dicussion).

       
    • Hey Bo, I am adding the encoding bit back into the core (3.6.2).
      I really shouldn't have removed it.
      (The code has been slimmed down a lot though).  It will be on by default.  (It will autodetect utf-8, and default to local encoding detected by the locale module).

      Cheers,
      Dan

       
      • Bo
        Bo
        2004-10-21

        Hey, great to hear. Sorry I didn't respond to your last response I have been rather busy geting a server upgraded. I'll certainly give 3.6.2 a spin.

        Bo)