Sorry, forgot to attach the patches!

----------

Here are another couple of patches for Soya-0.11.2.
(Haven't had a chance to upgrade to the latest
version, sorry -- hope you can incorporate them
if they're still useful.)

pudding/control.py:
   Fixes crash on keycodes > 255, and allows Delete
   as well as Backspace for erasing characters.

pudding/sysfont.py:
  Does a better job of finding installed fonts on MacOSX
  and associating them with the standard aliases (looks
  in System fonts directory, recognises .dfont as well
  as .ttf files) .

--
Greg
--- Soya-0.11.2-orig/pudding/control.py 2006-06-09 09:33:43.000000000 +1200
+++ Soya-0.11.2/pudding/control.py      2006-07-19 23:04:20.000000000 +1200
@@ -475,10 +475,10 @@
 
                if key == sdl.K_RETURN:
                        self.on_return()
-               elif key == sdl.K_BACKSPACE:
+               elif key == sdl.K_BACKSPACE or key == sdl.K_DELETE:
                        self.value = self.value[:-1]
                        self.on_value_changed()
-               elif key != 0:
+               elif 0 < key <= 255:
                        if chr(key) in string.printable:
                                self.value += chr(key)
                                self.on_value_changed()
--- Soya-0.11.2-orig/pudding/sysfont.py 2006-07-20 20:41:28.000000000 +1200
+++ Soya-0.11.2/pudding/sysfont.py      2006-07-20 20:52:33.000000000 +1200
@@ -104,29 +104,33 @@
 
 
 def initsysfonts_darwin():
-        """ read of the fonts on osx """
+       """ read of the fonts on osx """
 
-        paths = ['/Library/Fonts',
+       paths = ['/System/Library/Fonts',
+                               '/Library/Fonts',
                                '~/Library/Fonts',
                                '/Local/Library/Fonts',
                                '/Network/Library/Fonts']
-        fonts = {}
-        for p in paths:
-                d = os.path.expanduser(p)
-                if os.path.isdir(d):
-                        os.path.walk(d, _fontwalk_darwin, fonts)
-        return fonts
+       fonts = {}
+       for p in paths:
+               d = os.path.expanduser(p)
+               if os.path.isdir(d):
+                       os.path.walk(d, _fontwalk_darwin, fonts)
+       fonts["sans"] = fonts["Helvetica"]
+       fonts["serif"] = fonts["Times"]
+       fonts["fixed"] = fonts["Courier"]
+       fonts["wingdings"] = fonts["ZapfDingbats"]
+       return fonts
 
 def _fontwalk_darwin(fonts, path, files):
-        """ walk the path directory trees """
-        for font in files:
-                if font[-4:].lower() != '.ttf':
-                        continue
-                name = font[:-4]
-                font = os.path.join( path, font )
-                bold = 0
-                italic = 0
-                _addfont(name, bold, italic, font, fonts)
+       """ walk the path directory trees """
+       for font in files:
+               name, ext = os.path.splitext(font)
+               if ext in (".ttf", ".dfont"):
+                       font = os.path.join( path, font )
+                       bold = 0
+                       italic = 0
+                       _addfont(name, bold, italic, font, fonts)
 
 
 
_______________________________________________
Soya-user mailing list
[email protected]
https://mail.gna.org/listinfo/soya-user

Reply via email to