['Path to the wxPython demo folder.', 'If empty, wxPython/demo is used.'], 'type: dirpath') Plugins.registerPreference( 'wxPythonDemo', 'wpShowWxPythonDemoTemplate', 'False', [ 'Should a template for an empty wxPython demo file', 'be available on the Palette.' ]) if Preferences.wpWxPythonDemoFolder: demoDir = Preferences.wpWxPythonDemoFolder else: demoDir = os.path.join(os.path.dirname(wx.__file__), 'demo') if not os.path.exists(demoDir): raise Plugins.SkipPlugin( _('wxPython demo directory not found.\n' 'Please define the path under Preferences->Plug-ins')) true = 1 false = 0 def importFromWxPyDemo(name): cwd = os.getcwd() sys.path.insert(0, demoDir) try: os.chdir(demoDir) try: return __import__(name, globals()) finally: os.chdir(cwd)