from SdlDotNet import * from System.Drawing import Color, Point class _KConfig: screenWidth = 1024 screenHeight = 768 fullscreen = True fontSize = screenWidth/18 bgcolour = Color.Black textcolour = Color.LimeGreen boldcolour = Color.Red codecolour = Color.NavajoWhite code_hilitecolour = Color.Yellow code_bgcolour = Color.Gray cursor_fgcolor = Color.LimeGreen titlecolour = Color.LimeGreen textfont = Font('/usr/local/share/fonts/TrueType/candara.ttf', fontSize) boldfont = Font('/usr/local/share/fonts/TrueType/candarab.ttf', fontSize) titlefont = Font('/usr/local/share/fonts/TrueType/candarab.ttf', int(fontSize*1.2)) codefont = Font('/usr/local/share/fonts/TrueType/consola.ttf', int(fontSize*0.9)) interp_font = Font('/usr/local/share/fonts/TrueType/consola.ttf', int(fontSize*0.45)) def set(self, n, v): if (n.lower().endswith('size') or n.lower().endswith('height') or n.lower().endswith('width')): v = int(v) elif n.lower().endswith('colour'): if hasattr(Color, v): v = getattr(Color, v) else: raise ValueError('no such color %s'%v) elif n.lower().endswith('font'): if ',' in v: fn, sz = v.split(',') sz = float(sz) if sz < 4: # arbitrary, I know sz = sz * self.fontSize v = Font(fn.strip(), int(sz)) else: v = Font(v.strip(), self.fontSize) elif v.lower == ('false', 'off'): v = False elif v.lower in ('true', 'on'): v = True print "setting", n, "to", repr(v) setattr(self, n, v) KC = _KConfig()