home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / MacHacksBug / Python 1.5.2c1 / Mac / Tools / IDE / W.py < prev    next >
Encoding:
Python Source  |  2000-06-23  |  878 b   |  41 lines

  1. """Widgets for the Macintosh. Built on top of FrameWork"""
  2.  
  3. __version__ = "0.3"
  4.  
  5. from Wbase import *
  6. from Wcontrols import *
  7. from Wtext import *
  8. from Wlists import *
  9. from Wwindows import *
  10. from Wmenus import *
  11.  
  12. _application = None
  13. _signature = None
  14.  
  15. AlertError = 'AlertError'
  16.  
  17. def setapplication(app, sig):
  18.     global _application, _signature
  19.     _application = app
  20.     _signature = sig
  21.  
  22. def getapplication():
  23.     if _application is None:
  24.         raise WidgetsError, 'W not properly initialized: unknown Application'
  25.     return _application
  26.  
  27. def getdefaultfont():
  28.     prefs = getapplication().getprefs()
  29.     if not prefs.defaultfont:
  30.         prefs.defaultfont = ("Python-Sans", 0, 9, (0, 0, 0))
  31.     return prefs.defaultfont
  32.  
  33. def Message(text):
  34.     import EasyDialogs, Qd, string
  35.     Qd.InitCursor()
  36.     text = string.replace(text, "\n", "\r")
  37.     if not text:
  38.         text = '<Alert text not specified>'
  39.     EasyDialogs.Message(text)
  40.  
  41.