File: Editra

package info (click to toggle)
wxwidgets2.8 2.8.7.1-1.1%2Blenny1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 226,072 kB
  • ctags: 277,896
  • sloc: cpp: 1,769,805; xml: 396,717; python: 234,264; ansic: 126,047; makefile: 49,752; sh: 14,235; asm: 284; sql: 263; lex: 194; perl: 139; yacc: 128; pascal: 95; php: 23; haskell: 20; ruby: 20; java: 18; erlang: 17; lisp: 13; tcl: 10; csh: 9; ml: 9; ada: 5
file content (79 lines) | stat: -rwxr-xr-x 3,464 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env python
###############################################################################
# Name: Editra                                                                #
# Purpose: Editra's main launch script                                        #
# Author: Cody Precord <cprecord@editra.org>                                  #
# Copyright: (c) 2007 Cody Precord <staff@editra.org>                         #
# Licence: wxWindows Licence                                                  #
###############################################################################


"""
#--------------------------------------------------------------------------#
# FILE:	Editra                                                             #
# AUTHOR: Cody Precord                                                     #
# LANGUAGE: Python                                                         #
# SUMMARY:                                                                 #
#  Launch script for the Editor. It first tries to look for Editra on the  #
# local path and if it is not there it tries to import the Main method     #
# from where Editra would be installed if it was installed using disutils  #
#                                                                          #
#--------------------------------------------------------------------------#
"""

__author__ = "Cody Precord <cprecord@editra.org>"
__svnid__ = "$Id: Exp $"
__revision__ = "$Revision:  $"

#--------------------------------------------------------------------------#
# Dependancies
import sys
import os

try:
    import src as esrc
    IS_LOCAL = True
except ImportError:
    try:
        import Editra as esrc
        IS_LOCAL = False
    except ImportError, msg:
        print "There was an error while tring to import Editra"
        print ("Make sure that Editra is on your PYTHONPATH and that "
               "you have wxPython installed.")
        print "ERROR MSG: "
        print str(msg)
        os._exit(1)

#--------------------------------------------------------------------------#
# There are currently some necessary hacks for launching editra from this
# script that will hopefully be removed in the not so distance future once
# the plugin managers meta registry is redesigned.

if __name__ == '__main__':
    # The initial import above is necessary to get the path of where
    # Editra is installed so that the src package can be put on the path.
    # If the src module is not on the path the plugins are unable to import
    # things from inside editras namespace properly. It also causes problems
    # with recongnizing plugins in Extension registry of the Plugins metaclass.
    SRC_DIR = os.path.dirname(esrc.__file__)
    if not IS_LOCAL:
        SRC_DIR = os.path.join(SRC_DIR, 'src')

    # Cleanup any of Editras modules that are already present before
    # importing Editra again so that the modules are imported with the
    # correct signature (i.e ed_theme vs src.ed_theme). As the plugin
    # manager currently registers the class objects metadata by using 
    # the classes module signature for identification.
    if not IS_LOCAL:
        torem = [ key for key in sys.modules.keys() 
                  if key.startswith('Editra') ]
        for key in torem:
            del sys.modules[key]
    else:
        if sys.modules.has_key('src'):
            del sys.modules['src']

    sys.path.insert(0, SRC_DIR)
    import Editra
    Editra.Main()