DrPython 165 Preferences

Help
2007-04-13
2013-04-26
  • hebertodelrio
    hebertodelrio
    2007-04-13

    Hi there

    I have an Ubuntu box with python 2.4.3 and wxPython 2.8.3 and just downloaded DrPython and runs perfectly as opposed to my OS X box where is fails to run apparently caused by a problem with the fonts.

    In my Ubuntu box when I go to the Preferences menu and try to modify the following styles I get some errors:

    Edit Bookmarks Style

    Current Font (fixed) is not in the fontlist. 
    Setting to the default.

    Traceback (most recent call last):
      File "/usr/lib/python2.4/site-packages/drpython/drStyleDialog.py", line 365, in __init__
        self.FontList.index(self.font)
    ValueError: list.index(x): x not in list

    hit Close

    Something is quite screwy with fonts on your system.
    No font will be selected.
    Select one from the list manually.

    Traceback (most recent call last):
      File "/usr/lib/python2.4/site-packages/drpython/drStyleDialog.py", line 375, in __init__
        self.FontList.index(self.font)
    ValueError: list.index(x): x not in list

    hit CLose

    and finally the dialog appears

    The Edit Text Styles of Documents works fine

    Edit DrScript Styles fails the same kind of error

    Current Font (fixed) is not in the fontlist. 
    Setting to the default.

    Traceback (most recent call last):
      File "/usr/lib/python2.4/site-packages/drpython/drStyleDialog.py", line 365, in __init__
        self.FontList.index(self.font)
    ValueError: list.index(x): x not in list

    hit CLose

    Something is quite screwy with fonts on your system.
    No font will be selected.
    Select one from the list manually.

    Traceback (most recent call last):
      File "/usr/lib/python2.4/site-packages/drpython/drStyleDialog.py", line 375, in __init__
        self.FontList.index(self.font)
    ValueError: list.index(x): x not in list

    and then the dialog appears

    Edit Text Styles in Prompt fails too

    Current Font (Sans Serif) is not in the fontlist. 
    Setting to the Courier 12.

    Traceback (most recent call last):
      File "/usr/lib/python2.4/site-packages/drpython/drStyleDialog.py", line 892, in OnSelectStyle
        self.FontList.index(self.font)
    ValueError: list.index(x): x not in list

    Hit Close

    Something is quite screwy with fonts on your system.
    No font will be selected.
    Select one from the list manually.

    Traceback (most recent call last):
      File "/usr/lib/python2.4/site-packages/drpython/drStyleDialog.py", line 902, in OnSelectStyle
        self.FontList.index(self.font)
    ValueError: list.index(x): x not in list

    and then the dialog appears

    finally Edit Source Browser Style fails

    Current Font (Sans Serif) is not in the fontlist. 
    Setting to the default.

    Traceback (most recent call last):
      File "/usr/lib/python2.4/site-packages/drpython/drStyleDialog.py", line 365, in __init__
        self.FontList.index(self.font)
    ValueError: list.index(x): x not in list

    Hit Close

    Something is quite screwy with fonts on your system.
    No font will be selected.
    Select one from the list manually.

    Traceback (most recent call last):
      File "/usr/lib/python2.4/site-packages/drpython/drStyleDialog.py", line 375, in __init__
        self.FontList.index(self.font)
    ValueError: list.index(x): x not in list

    and then the dialog appears

    SHOULDN'T BE BETTER TO HAVE ONE SINGLE PLACE WHERE YOU CAN CHANGE THE FONTS INSTEAD TO GO TO, HOW MANY PLACES?, TO CHANGE THEM?

    WHY IS IT CRASHING THIS WAY?

    IS THERE A WAY TO FIX IT IN GENERAL FOR THE THREE PLATFORMS?

    I have looked into drPrefences.py in the <PYTHON DIRECTORY>/site-packages/drpython/ directory and it seems there are only two variables that have to be modified:

    defaultfont0
    defaultfont1

    but in the local drPreferences.dat in the <HOME DIRECTORY>/.drpython/ directory they do not appear, instead they have been substituted by their value all over the file, and to change this is not so pleasant.

    WOULDN'T BE BETTER TO KEEP SORT OF A COPY OF THE drPreferences.py IN THE LOCAL DIRECTORY TOO, INSTEAD OF THE drPreferences.dat FILE?

    TO SUMMARIZE:

    Wouldn't be better to have only one place in the DrPython application inside the Prefences Menu, where you can change the fonts, instead the way it is right now, and this to be saved in the local directory as a python directoy file where the important variables keep their value and you reference them instead of using their value?

    Heberto

     
    • Hi Heberto,

      first thanks for your feedback.
      Your message is quite long, I will take a closer look tomorrow.

      You are certainly right about a "central" place about change all fonts at once, if I understand you correctly.

       
    • hebertodelrio
      hebertodelrio
      2007-04-13

      Yes, you did understand correctly. Can you also try to explain the errors that I am getting
      when accessing in the Preferences Menu the Edit <SOMETHING> Styles. To me it seems that this is again
      a problem about some default fonts that cannot be found in my system. Shouldn't be reasonable to start with some fonts that based on the OS they would be always present?

      Heberto

       
    • I forward the Message from Antonio:

      svn commit drStyleDialog.py -m "Avoid error when default font doesn't exists "

      Those messages would be avoided if at drPreferences.py
      #Bookmarks Settings and 
      #DrScript Settings
      would not be default to «fixed» font.

      I didn't changed that because I don't know if at other linux flavours this font exists or not.

      So if you are curious, please make a svn checkout, here you have always
      the last state of the source.

       
    • hebertodelrio
      hebertodelrio
      2007-04-15

      If my comment below does not make sense please disregard it I considere my self a newbie on wxWidgets and/or wxPython

      Why instead explicitly naming the fonts you are using, instead you use the system font default, in the following way

      defaultfont = wx.SystemSettings.GetFont(wx.SYS_SYSTEM_FONT)

      and you have it OS independent?

       
    • Hello,

      I'm not the creator of this project more a "deputy".
      Yes, I consider to bring that in.

      Maybe it has to do something with:
      You are editing programming code, and almost all users use
      a proportional font to see the indentation in a right way.

       
    • a_barbosa
      a_barbosa
      2007-04-15

      Hy Heberto,

      First: thanks for your feedback.
      Second: sorry for the inconvenience.

      I'm part of the team responsible to keep drPython alive. In fact I'm the guilty one responsible for those default fonts. If you see in the code of drPreferences.py:
              if self.platform_is_windows:
                  defaultfont0="Courier"
                  defaultfont1="MS Sans Serif"
              else:
                  defaultfont0="Courier 10 Pitch"
                  defaultfont1="Sans"

      This way I didn't take care with Mac OsX, as I should!

      Anyhow, you would encounter that difficulty only once ;)

      Have you tried that latest cvs version?

      Answering at last part of your comments: Yes you can change all the fonts with only one operation. Try this:

      Menu [Options] + [Preferences] + [Document] + [Apply Text Property to all styles] and then choose [Font].

      Please feedback. We would like you to be satisfied with drPython as we are ;)

      Cheers,
      Antonio

       
    • hebertodelrio
      hebertodelrio
      2007-04-15

      It's me again

      OS X 10.4.x python 2.5 wxPython 2.8.3  drpython revison 219 it
      doesn't work still the same error, which either is a problem of
      drpython or it's a problem on wxPython, I do not think is a problem
      with the fonts suggested in another post

      The error messages is

      > python drpython.pyw
      Sans Serif
      Traceback (most recent call last):
        File "/Users/heberto/Downloads/drpython/drpython/drpython.pyw", line 36, in <module>
          drpython.main()
        File "/Users/heberto/Downloads/drpython/drpython/drpython.py", line 4025, in main
          app = DrApp(0)
        File "//Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/wx-2.8-mac-unicode/wx/_core.py", line 7757, in __init__
          self._BootstrapApp()
        File "//Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/wx-2.8-mac-unicode/wx/_core.py", line 7354, in _BootstrapApp
          return _core_.PyApp__BootstrapApp(*args, **kwargs)
        File "/Users/heberto/Downloads/drpython/drpython/drpython.py", line 4009, in OnInit
          self.frame = DrFrame(None, 101, "DrPython - Untitled 1")
        File "/Users/heberto/Downloads/drpython/drpython/drpython.py", line 531, in __init__
          self.ShowSourceBrowser()
        File "/Users/heberto/Downloads/drpython/drpython/drpython.py", line 3368, in ShowSourceBrowser
          self.SourceBrowser = drSourceBrowserPanel(target, -1, self.prefs.sourcebrowserpanel, i)
        File "/Users/heberto/Downloads/drpython/drpython/drSourceBrowser.py", line 166, in __init__
          self.classtree = drTree(self, -1, wx.Point(0, 0), wx.Size(400, 200), wx.TR_DEFAULT_STYLE|wx.TR_HIDE_ROOT, self.parent)
        File "/Users/heberto/Downloads/drpython/drpython/drSourceBrowser.py", line 73, in __init__
          w.SetFaceName(yarrr[0])
        File "//Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/wx-2.8-mac-unicode/wx/_gdi.py", line 2101, in SetFaceName
          return _gdi_.Font_SetFaceName(*args, **kwargs)
      wx._core.PyAssertionError: C++ assertion "status == noErr" failed at /BUILD/wxPython-src-2.8.3.0/src/mac/carbon/font.cpp(378) in MacFindFont(): couldn't modify ATSU style

       
      • a_barbosa
        a_barbosa
        2007-04-15

        Hi Heberto:

        As I refered before, this is related with in the code of drPreferences.py the MacOsX is not considered:

                if self.platform_is_windows:
                    defaultfont0="Courier"
                    defaultfont1="MS Sans Serif"
                else:
                    defaultfont0="Courier 10 Pitch"
                    defaultfont1="Sans"

        With this, the font defaults to "Sans" that should not exist as a standard font in Mac.
        I don't know by heart the name of a font suitable for Mac.
        Tomorrow, at office, I will have access to a Mac, so I will test that.

        Meanwhile, if you proceed and define a normal Mac font, the problems should disappear, is that so?

        Cheers
        AB

         
    • I think, there are more points in DrPython which do not care (much) of OSX.
      I suspect, the reasons are:
      1) not many people used or asked for OSX, so that was simply ignored.
      2) not many people have a OSX to test with it.

      I would be curious, how other similar programs handle it as spe or pype.
      Maybe a look into the demo would also be interesting.

      The other thing: I never understand the reason of applying textstyle
      for bookmarks and drscripts dialog. I suspect, it is just a playing thing. ;)

      I want to follow Antonio. We like you to be pleased with DrPython.

      Cheers,

       
    • >wx._core.PyAssertionError: C++ assertion "status == noErr" failed at >/BUILD/wxPython-src-2.8.3.0/src/mac/carbon/font.cpp(378) in
      >MacFindFont(): couldn't modify ATSU style

      The demo is working with all the fonts flawlessly?

      If so, anyway, it shuold be fixed.

       
    • hebertodelrio
      hebertodelrio
      2007-04-15

      The way to deal with fonts for OS X, and maybe this should be the way to do it os independent is like
      is done in the wxPython demo program: FontDialog.py

      since I am new with drpython I have no idea where to modify stuff or the proper way to do it, so for
      now the only way I can contribute is posting.

      I have access to an Ubuntu box and to an iMac Intel

       
    • hebertodelrio
      hebertodelrio
      2007-04-15

      I modify

      defaultfont0="Courier New"
      defaultfont1="Lucida Grande"

      Fonts that I tested run on OS X running the FontDialog.py part of the wxPython demo program and still produce the same crash

      BTW the wxPython demo.app donwloaded from wxPython.org site it works flawlessly, so I guess the problem is with drpython

      This is just my impression

       
      • a_barbosa
        a_barbosa
        2007-04-15

        Hi Heberto,

        I have just committed a new try of drPreferences.py. It is not so polite as it should, but it should not  produce any traceback.

        If you can (and if you still have patience:) please try again.

        Otherwise, tomorrow, I will try to fix it when I can put my hands on a apple.

        Thanks again.

        Cheers
        AB

         
    • hebertodelrio
      hebertodelrio
      2007-04-16

      what I did is renamed the drPreferences.py.r220 to drPreferences.py
      and run python drpython.pyw

      but still crash in exactly the same point and with the same reason,
      so I am guessing that this line is not the one causing the crash,
      don't you think?

      This is the error message which is still the same

      You might think this is caused by the fact I am running the unicode version of
      wxPython but I tried with both the ansi and the unicode and the error is
      exactly the same and in the same place.

      > python drpython.pyw
      Sans Serif
      Traceback (most recent call last):
        File "/Users/heberto/Downloads/drpython/drpython/drpython.pyw", line 36, in <module>
          drpython.main()
        File "/Users/heberto/Downloads/drpython/drpython/drpython.py", line 4025, in main
          app = DrApp(0)
        File "//Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/wx-2.8-mac-unicode/wx/_core.py", line 7757, in __init__
          self._BootstrapApp()
        File "//Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/wx-2.8-mac-unicode/wx/_core.py", line 7354, in _BootstrapApp
          return _core_.PyApp__BootstrapApp(*args, **kwargs)
        File "/Users/heberto/Downloads/drpython/drpython/drpython.py", line 4009, in OnInit
          self.frame = DrFrame(None, 101, "DrPython - Untitled 1")
        File "/Users/heberto/Downloads/drpython/drpython/drpython.py", line 531, in __init__
          self.ShowSourceBrowser()
        File "/Users/heberto/Downloads/drpython/drpython/drpython.py", line 3368, in ShowSourceBrowser
          self.SourceBrowser = drSourceBrowserPanel(target, -1, self.prefs.sourcebrowserpanel, i)
        File "/Users/heberto/Downloads/drpython/drpython/drSourceBrowser.py", line 166, in __init__
          self.classtree = drTree(self, -1, wx.Point(0, 0), wx.Size(400, 200), wx.TR_DEFAULT_STYLE|wx.TR_HIDE_ROOT, self.parent)
        File "/Users/heberto/Downloads/drpython/drpython/drSourceBrowser.py", line 73, in __init__
          w.SetFaceName(yarrr[0])
        File "//Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/wx-2.8-mac-unicode/wx/_gdi.py", line 2101, in SetFaceName
          return _gdi_.Font_SetFaceName(*args, **kwargs)
      wx._core.PyAssertionError: C++ assertion "status == noErr" failed at /BUILD/wxPython-src-2.8.3.0/src/mac/carbon/font.cpp(378) in MacFindFont(): couldn't modify ATSU style

       
    • a_barbosa
      a_barbosa
      2007-04-16

      Hi Heberto:

      I have spent about 2 hours on mac trying to fix the problem reported, and the results of my search is:

      If I try on MacOsx 10.3.9  + Python 2.4.4 + WxPython 2.8.3 : everything works as expected.

      But on MacOsx 10.4.9 + Python 2.5.0 + WxPython 2.8.3 Unicode, things are a little different:

      If I used the [Download Version], drPython does NOT starts! It gives a long crash report;)

      But if I use [SVN Version] everything works OK, without any traceback, but ONLY if I remove the .drpython folder!

      I suspect that you are someway using mixed files.

      Can you try a fresh install with the SVN code, instead of Download Version?

      If so, please REMOVE the folder [home]/Library/Preferences/.drpython

      Sorry for the inconvenience;(

      Cheers
      AB

       
    • hebertodelrio
      hebertodelrio
      2007-04-16

      I arose to the same conclusion at least for my setup, and the explanation is sort of natural
      the file preferences.dat which resides inside the .drpython directory has hard coded the name of the
      fonts used by the application, since the very first time that I runned the application it crashed
      this file kept the fonts. In my other attempts althought the applications had the correction to avoid the crash, still the application crashed due to the fact that it reads in case the file is present the preferences.dat file (this is the per user preferences file, am I correct?) and uses those fonts. My only problem was that I didn't know where was this file in my mac, now I know as soon as  I arrive home I will check your suggestion

      Thanks a lot

       
    • a_barbosa
      a_barbosa
      2007-04-16

      Hi Heberto,

      Yes that folder is hardcoded, but of course, you can change it:
      menu [Options] [Preferences] [General] -> scroll down the dialog: near the bottom: Default Preferences Directory

      I hope it will work ok now.

      Thanks for not «giving up». This is rather annoying! As we normally don't use MacOs, it is natural some other difficulties arise, later on.
      Please keep your patience: we will make our best to keep you happy with drPy!

      Cheers
      AB

       
    • hebertodelrio
      hebertodelrio
      2007-04-16

      It worked!!!!

      One last remark, for now, it would be nicer if when running on OS X the preferencesdirectory would be
      <HOME>/Library/Preferences/DrPython

      instead of
      <HOME>/Library/Preferences/.drpython

      Why? Because the Finder in OS X does not sees DOT FILES

      Thanks a lot for the beatiful work

      P.S. Any time soon would you be adding winpdb, or any GUI debugger to DrPython?

       
      • a_barbosa
        a_barbosa
        2007-04-16

        Hi Heberto,

        Good to know that!

        About the «invisible» folder, I can agree with you. The main reason of that it was that it «should» not be necessary to manually tweak it :)

        About adding more features to drPython, there are more important things that we think that should be improved. Mainly Code Completition.
        We must resist to the temptation of adding too many «nice features» ;)

        Our main goal is to keep it simple, light, robust, configurable and extensible.
        Are you acquainted to drScripts? It is a very nice feature of DrPython: If there is something that is missing for you: DO IT!

        Cheers
        AB

         
    • Hi,
      First: thanks to Antonio for the thorough examination and solution of that case.

      I agree to Antonio.
      The debug thing:
      First: It would be a lot of work.
      Second: If so, I would prefer a plugin, if possible
      Third: Using Winpdb would be enough (for me at least).

      I know, Stanis spe editor implements the winpdb program and wxglade into spe.
      But Heberto: if this is so desirable, you could try to implement it into the core or a plugin
      and send us patches. If you seriously interested, nothing speaks against adding you
      to our team.

      Cheers,