コード例 #1
0
# 0.6 EKR: (eliminated g.top)
#     - Add c arg to writeNodeAndTree.
#     - Set encoding to sys.getdefaultencoding() if there is no @encoding directive in effect.
# 0.7 EKR: cmd_ functions now get c arg.
# 0.8 EKR: set __plugin_name__ rather than __name__
#@-<< version history >>
#@+<< imports >>
#@+node:ekr.20040909105522: ** << imports >>
import leo.core.leoGlobals as g

try:
    # From win32 extensions: http://www.python.org/windows/win32/
    import win32com.client
    client = win32com.client
except ImportError:
    client = g.cantImport('win32com.client')

if g.isPython3:
    import configparser as ConfigParser
else:
    import ConfigParser

import sys

#@-<< imports >>


#@+others
#@+node:ekr.20050311165238: ** init
def init():
    '''Return True if the plugin has loaded successfully.'''
コード例 #2
0
#       That is, not installed properly by unit tests.
#
# 0.3 EKR:
#     - Declared click_registry and coloured_nodes global in init.
#@-<< version history >>
#@+<< imports >>
#@+node:pap.20041020001240.2: ** << imports >>
import leo.core.leoGlobals as g

import leo.plugins.tkGui as tkGui
leoTkinterTree = tkGui.leoTkinterTree

try:
    import Tkinter as Tk
except ImportError:
    Tk = g.cantImport("Tkinter")

if g.isPython3:
    import configparser as ConfigParser
else:
    import ConfigParser

import threading
import time

#@-<< imports >>


#@+others
#@+node:ekr.20050310105438: ** init
def init():
コード例 #3
0
#@+leo-ver=5-thin
#@+node:ekr.20050130120433: * @file test/failed_import.py
'''A plugin to test import problems.'''

import leo.core.leoGlobals as g

def onStart(tag, keywords):
    pass

# pylint: disable=unused-import
try:
    import xyzzy
except ImportError:
    g.cantImport('xyzzy', pluginName='failed_import')

def init():
    '''Return True if the plugin has loaded successfully.'''
    g.registerHandler("start2", onStart)
    g.plugin_signon(__name__)
    return True
#@-leo
コード例 #4
0
ファイル: xsltWithNodes.py プロジェクト: atmishra/leo-editor
from xml.dom import minidom

if g.isPython3:
    import io
    StringIO = io.StringIO
else:
    import cStringIO
    StringIO = cStringIO.StringIO

try:
    import Ft
    from Ft.Xml import InputSource
    from Ft.Xml.Xslt.Processor import Processor
except ImportError:
    g.cantImport("Ft",__name__)
    Ft = None

import weakref
#@-<< imports >>
#@+<<parser problems>>
#@+node:mork.20041024091024: ** <<parser problems>>
#@@killcolor

#@+at
# 1. Having space before the start of the document caused it not to work.  I fixed this by striping the whitespace from the start
# and end of the data at xslt time.
# 
# 2. having a @ right before a tag causes it to not process.
#     It appears to be safe to follow this pattern:
#     @ </end>
コード例 #5
0
#       That is, not installed properly by unit tests.
# 
# 0.3 EKR:
#     - Declared click_registry and coloured_nodes global in init.
#@-<< version history >>
#@+<< imports >>
#@+node:pap.20041020001240.2: ** << imports >>
import leo.core.leoGlobals as g 

import leo.plugins.tkGui as tkGui
leoTkinterTree = tkGui.leoTkinterTree

try: 
    import Tkinter as Tk 
except ImportError: 
    Tk = g.cantImport("Tkinter")

if g.isPython3:
    import configparser as ConfigParser
else:
    import ConfigParser

import threading 
import time 

#@-<< imports >>

#@+others
#@+node:ekr.20050310105438: ** init
def init ():
コード例 #6
0
from xml.dom import minidom

if g.isPython3:
    import io
    StringIO = io.StringIO
else:
    import cStringIO
    StringIO = cStringIO.StringIO

try:
    import Ft
    from Ft.Xml import InputSource
    from Ft.Xml.Xslt.Processor import Processor
except ImportError:
    g.cantImport("Ft",__name__)
    Ft = None

import weakref
#@-<< imports >>
#@+<<parser problems>>
#@+node:mork.20041024091024: ** <<parser problems>>
#@@killcolor

#@+at
# 1. Having space before the start of the document caused it not to work. I fixed
#    this by striping the whitespace from the start and end of the data at xslt
#    time.
# 
# 2. having a @ right before a tag causes it to not process.
#     It appears to be safe to follow this pattern:
コード例 #7
0
ファイル: failed_import.py プロジェクト: Darriall/leo-editor
#@+leo-ver=5-thin
#@+node:ekr.20050130120433: * @file test/failed_import.py
'''A plugin to test import problems.'''

import leo.core.leoGlobals as g

def onStart(tag,keywords):
    pass

# pylint: disable=unused-import
try:
    import xyzzy
except ImportError:
    g.cantImport('xyzzy',pluginName='failed_import')

def init():
    '''Return True if the plugin has loaded successfully.'''
    g.registerHandler("start2", onStart)
    g.plugin_signon(__name__)
    return True
#@-leo
コード例 #8
0
ファイル: word_export.py プロジェクト: SegundoBob/leo-editor
# 0.6 EKR: (eliminated g.top)
#     - Add c arg to writeNodeAndTree.
#     - Set encoding to sys.getdefaultencoding() if there is no @encoding directive in effect.
# 0.7 EKR: cmd_ functions now get c arg.
# 0.8 EKR: set __plugin_name__ rather than __name__
#@-<< version history >>
#@+<< imports >>
#@+node:ekr.20040909105522: ** << imports >>
import leo.core.leoGlobals as g

try:
    # From win32 extensions: http://www.python.org/windows/win32/
    import win32com.client
    client = win32com.client
except ImportError:
    g.cantImport('win32com.client')
    client = None

if g.isPython3:
    import configparser as ConfigParser
else:
    import ConfigParser

import sys
#@-<< imports >>

#@+others
#@+node:ekr.20050311165238: ** init
def init ():
    '''Return True if the plugin has loaded successfully.'''
    ok = client is not None # Ok for unit test: just uses Plugins menu.