Menu

myPrefsFile.py

Developers
liyinghui
2004-04-19
2004-04-22
  • liyinghui

    liyinghui - 2004-04-19

    Dan:
        I'v finished my work, and send to an email. Please check it out.

     
    • Daniel Pozmanter

      It looks good, except it does not work with themes.
      Once you make it work with themes, you can plop it in.

      This looks MUCH better than what I had, and so long as the result plays well with the current format, all is good.

       
    • liyinghui

      liyinghui - 2004-04-19

      How to test with theme? Any ideas? This function I have not used yet.

       
    • Daniel Pozmanter

      I can alter the file to work with themes.
      Or you can:
      You either need a seperate set of functions to handle themes, or you need to divide preferences into two lists, one of themeable items, one of non-themeable items.
      I think the seperate list is necessary in both cases.

       
    • liyinghui

      liyinghui - 2004-04-20

      I'll test is soon.

       
    • liyinghui

      liyinghui - 2004-04-20

      But I can not find where the variable THEME was set True. So every options were written. Even the old drPrefsFile.py does the same.

       
    • liyinghui

      liyinghui - 2004-04-20

      Oh, I'v found in drThemeMenu.py. But I found if I load the aqua theme, then make it as default theme. And I remove it in preferences dialog. The icons still remain there. I found that the iconfile option still has value. If it is a bug?

       
    • liyinghui

      liyinghui - 2004-04-20

      I'v tested my code, but cann't find error. When I choice savint theme, only style-like options are saved in theme file. Loading from theme is seem fine also. Are you sure there is some wrong?

       
    • Daniel Pozmanter

      The code may be fine.  As long as you can read and write themes properly, life is good.

      Here is the litmus test.

      Save a theme while in SDI mode.
      Close DrPython
      Switch to MDI mode.  Save.
      Now load the theme.
      Back in SDI mode?  Then you code is broken.
      Still in MDI mode?  Then life is sweet.

       
    • liyinghui

      liyinghui - 2004-04-21

      Oh, poor mdi, I'll test it soon. I'v tested in mdi, not in sdi.

       
    • Daniel Pozmanter

      The point of the litmus test is:

      Does saving a theme record a non-themeable preference?   I din't want to load a theme file, and
      have my default find values, the location of where I locally store python docs, my default directory, etc changed!

      A theme should only store how things look.
      So when you say your prefsfile.py works, does it store extra info, or does it only store theme info in each theme file?

       
    • liyinghui

      liyinghui - 2004-04-21

      You can test like this:
      saving theme to a theme file. Then open a another DrPython, save theme to an another theme file. Then diff them seeing if there are some difference.

      I could not find any error. May be my steps are not like yours.

       
    • Daniel Pozmanter

      No, that won't work.

      Let's say you have 3 prefs:

      a = default directory
      b = text style
      c = icon file

      You want to save all three in the prefs file.
      You want to save ONLY b and c in the theme file.

      If the theme file contains a, b, and c, then prefsfile.py does not work right.

      If the theme file contains b, and c only, life is good.

      Perhaps diff ' ing a theme file and a preferences file would work.  If there ARE differences, then all is well.  If the two are the same, then your modifications need to be tweaked.

       
    • liyinghui

      liyinghui - 2004-04-22

      If I choice saving theme, the theme file does contains b and c, excludes a. Whether you want to say if the theme file contians all a, b and c, the prefsfile.py will still run well which should be right , otherwise there is a bug?

       
    • Daniel Pozmanter

      so your code only saves theme stuff to the theme file?  Cool beans, then it is all set. 2.4.6 should be out soon, and we can commence work on the 3.x tree.

       
    • liyinghui

      liyinghui - 2004-04-22

      Yeah! For example,
      ('windowwidth', 'window.width', TINT, False),
      the forth value indicates process with theme.

      The code is:
      if (not THEME and not flag) or flag:
      ____SetPrefProperty(prefs, pname, value, type)

      flag is the forth value.

      if flag is true, whatever theme is , the option always is written to theme file.    -----just like iconfile and text style option.

      if flag is false, as theme is false(no theme), the option will be written to general preference file; as theme is true(in theme), the option will not be written to theme preference file.

      Is it all right?

       
    • Daniel Pozmanter

      Ooops.  My bad, I missed that.
      There must be a lesson in here somewhere.

      Anyway, yes, you code is great.

      Hold off a day or two, 2.4.6 is almost out, then plop that sucker in.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.