Exemplo n.º 1
0
 def __init__(self, c):
     '''MakeStubFile.ctor. From StandAloneMakeStubFile.ctor.'''
     self.c = c
     self.msf = msf = g.importExtension(
         moduleName='make_stub_files',
         pluginName=None,
         verbose=False,
         required=False)
     x = msf.StandAloneMakeStubFile()
     # x is used *only* to init ivars.
     # Ivars set on the command line...
     self.config_fn = None
     self.enable_unit_tests = False
     self.files = []  # May also be set in the config file.
     self.output_directory = self.finalize(
         c.config.getString('stub-output-directory') or '.')
     self.output_fn = None
     self.overwrite = c.config.getBool('stub-overwrite',
                                       default=False)
     self.trace_matches = c.config.getBool('stub-trace-matches',
                                           default=False)
     self.trace_patterns = c.config.getBool('stub-trace-patterns',
                                            default=False)
     self.trace_reduce = c.config.getBool('stub-trace-reduce',
                                          default=False)
     self.trace_visitors = c.config.getBool('stub-trace-visitors',
                                            default=False)
     self.update_flag = c.config.getBool('stub-update',
                                         default=False)
     self.verbose = c.config.getBool('stub-verbose', default=False)
     self.warn = c.config.getBool('stub-warn', default=False)
     # Pattern lists & dicts, set by config sections...
     self.patterns_dict = {}
     self.names_dict = {}
     self.def_patterns = self.scan_patterns(
         'stub-def-name-patterns')
     self.general_patterns = self.scan_patterns(
         'stub-general-patterns')
     self.prefix_lines = self.scan('stub-prefix-lines')
     # Complete the dicts.
     x.make_patterns_dict()
     self.patterns_dict = x.patterns_dict
     self.op_name_dict = x.op_name_dict = x.make_op_name_dict()
     # Copy the ivars.
     x.def_patterns = self.def_patterns
     x.general_patterns = self.general_patterns
     x.prefix_lines = self.prefix_lines
Exemplo n.º 2
0
    def set_time_req(self,p):
        v = p.v
        tkSimpleDialog = g.importExtension('tkSimpleDialog',pluginName=__name__)
        initialvalue = str(self.time_init)
        if self.getat(v, 'time_req') != '':
            initialvalue = self.getat(v, 'time_req')
        prompt = '%s required' % self.time_name
        tr = tkSimpleDialog.askfloat(prompt, prompt, parent = self.c.frame.tree.canvas,
                                     initialvalue = str(initialvalue))

        if tr == None: return

        self.setat(v, 'time_req', tr)

        if self.getat(v, 'progress') == '':
            self.setat(v, 'progress', 0)
            self.pickles['progress'].set(0)

        self.redraw()
Exemplo n.º 3
0
For full documentation see:

  - http://leo.zwiki.org/Cleo 
  - http://leo.zwiki.org/cleodoc.html

'''
#@-<< docstring >>

#@@language python
#@@tabwidth -4

#@+<< imports >>
#@+node:tbrown.20060903121429.2: ** << imports >>
import leo.core.leoGlobals as g

Tk = g.importExtension('Tkinter',pluginName=__name__,verbose=True)
#@-<< imports >>
__version__ = "0.25.2"
#@+<< version history >>
#@+node:tbrown.20060903121429.3: ** << version history >>
#@@killcolor

#@+at Use and distribute under the same terms as leo itself.
# 
# Original code by Mark Ng <*****@*****.**>
# 
# 0.5  Priority arrows and Archetype-based colouring of headline texts.
# 0.6  Arbitary headline colouring.
# 0.7  Colouring for node types. Added "Others" type option
# 0.8  Added "Clear Priority" option
# 0.8.1  Fixed popup location
Exemplo n.º 4
0
            except Exception:
                fg = QtGui.QColor('black')
            pal = QtGui.QPalette(self.UI.label.palette())
            pal.setColor(QtGui.QPalette.WindowText, fg)
            self.UI.label.setPalette(pal)
            self.UI.label.setText(msg)
        #@+node:ekr.20140920145803.17993: *3* enableDelete
        def enableDelete(self, enable):
            self.UI.deleteBtn.setChecked(False)
            self.UI.deleteBtn.setEnabled(enable)
        #@-others
#@+node:ekr.20140920145803.17994: ** class backlinkTkUI
if g.app.gui.guiName() == "tkinter":

    Tk = g.importExtension('Tkinter',
        pluginName=__name__,
        verbose=True,
        required=True)

    class backlinkTkUI(object):
        # pylint: disable=no-member
        # This is old code.
        #@+others
        #@+node:ekr.20140920145803.17975: *3* __init__
        def __init__(self, owner):
            '''Ctor for backlinkTkUI class.'''
            self.owner = owner
            self.c = c = self.owner.c
            c.frame.log.createTab('Links', createText=False)
            w = c.frame.log.frameDict['Links']
            f = Tk.Frame(w)
            scrollbar = Tk.Scrollbar(f, orient=Tk.VERTICAL)
Exemplo n.º 5
0
# 0.9 EKR: Make sure self.c == keywords.get('c') in all hook handlers.
# 1.0 EKR: Added support for chapters: don't allow a dehoist of an @chapter node.
# 1.1 EKR: Use hoist-changed hook rather than idle-time hook to update the widgets.
# 1.2 bobjack:
#     - bind hois/dehoist buttons together if Tk and toolbar.py is enabled
#@-<< change history >>

__version__ = "1.2"

# print('at top of hoist.py')

#@+<< imports >>
#@+node:ekr.20040908093511.1: ** << imports >>
import leo.core.leoGlobals as g

Tk = g.importExtension('Tkinter')

import sys
#@-<< imports >>

activeHoistColor = "pink1"  # The Tk color to use for the active hoist button.

# Set this to 0 if the sizing of the toolbar controls doesn't look good on your platform.
USE_SIZER = False
USE_FIXED_SIZES = sys.platform != "darwin"
SIZER_HEIGHT = 23  # was 25
SIZER_WIDTH = 55  # was 70


#@+others
#@+node:ekr.20070301070027: ** init
Exemplo n.º 6
0
    def __dummy():
        """This is a __very important__ function."""
        return None


#@-<< example >>

#@@language python
#@@tabwidth -4

#@+<< imports >>
#@+node:ekr.20050101090207.3: ** << imports >>
import leo.core.leoGlobals as g
import tkFileDialog

Tk = g.importExtension('Tkinter', pluginName=__name__, verbose=True)
tkColorChooser = g.importExtension('tkColorChooser',
                                   pluginName=__name__,
                                   verbose=True)

try:
    import PIL
except ImportError:
    PIL = None

import os
import string  # zfill does not exist in Python 2.2.1
#@-<< imports >>

__version__ = "1.8"
#@+<< version history >>
Exemplo n.º 7
0
- Selecting a headline containing \@clip appends the contents of the clipboard to
  the end of the body pane.

- The double-click-icon-box command on a node whose headline contains \@view
  *<path-to-file>* places the contents of the file in the body pane.

- The double-click-icon-box command on a node whose headline contains \@strip
  *<path-to-file>* places the contents of the file in the body pane, with all
  sentinels removed.

This plugin also accumulates the effect of all \@path nodes.
'''
#@-<< docstring >>
__version__ = "0.9"
import leo.core.leoGlobals as g
path           = g.importExtension('path',          pluginName=__name__,verbose=True)
win32clipboard = g.importExtension('win32clipboard',pluginName=__name__,verbose=True)

#@+others
#@+node:ekr.20111104210837.9693: ** init
def init():
    '''Return True if the plugin has loaded successfully.'''
    ok = path and win32clipboard
        # Ok for unit testing.
    if ok:
        g.registerHandler("after-create-leo-frame",onCreate)
    elif not g.app.unitTesting:
        s = 'at_view plugin not loaded: win32Clipboard not present.'
        g.es_print(s)
    return ok
#@+node:ktenney.20041211072654.6: ** onCreate (at_view.py)
Exemplo n.º 8
0
Excel data in it, it should be able to determine its Excel data. It then creates
a dialog with the data presented as in a table for the user to see it.

Requires Pmw and the tktable widget at http://sourceforge.net/projects/tktable

'''
#@-<< docstring >>

#@@language python
#@@tabwidth -4

#@+<< imports >>
#@+node:ekr.20041017035937.1: ** << imports >>
import leo.core.leoGlobals as g

Pmw    = g.importExtension("Pmw",    pluginName=__name__,verbose=True)
Tk     = g.importExtension('Tkinter',pluginName=__name__,verbose=True)
tktab  = g.importExtension('tktable',pluginName=__name__,verbose=True)

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

import csv
import weakref
#@-<< imports >>

__version__ = ".14"
#@+node:ekr.20040916075741: ** << version history >>
#@+at
# 
# 0.3 EKR:
#     - Converted to outline.
#     - Style improvements.
#     - Changes for 4.2 code base in hit().
#     - Use 'new' instead of 'start2' hook.
# 0.4 EKR:
#     - Changed 'new_c' logic to 'c' logic.
#@-<< version history >>
#@+<< imports >>
#@+node:ekr.20040916073636.2: ** << imports >>
import leo.core.leoGlobals as g

Tk  = g.importExtension('Tkinter',pluginName=__name__,verbose=True,required=True)
Pmw = g.importExtension("Pmw",    pluginName=__name__,verbose=True,required=True)

import weakref
#@-<< imports >>

#@+others
#@+node:ekr.20070301072310: ** init
def init ():

    ok = Tk and Pmw and g.app.gui.guiName() == "tkinter"

    if ok:
        g.registerHandler(('new2','menu2'), addCommand)
        g.plugin_signon( __name__ )
Exemplo n.º 10
0
  move all nodes marked for copying and moving from another window to this one.

'''
#@-<< docstring >>

#@@language python
#@@tabwidth -4

#@+<< imports >>
#@+node:mork.20041018131258.2: ** << imports >>
import leo.core.leoGlobals as g

import copy
import base64

Tkinter = g.importExtension('Tkinter', pluginName=__name__, verbose=True)
# Uses Tkinter.PhotoImage.
#@-<< imports >>

lassoers = {}  # Keys are commanders. Values are instances of class Lassoer.

__version__ = ".10"

#@+<<version history>>
#@+node:mork.20041021120027: ** <<version history>>
#@@killcolor
#@+at
# .1 -- We have started almost from scratch from the previous group Move
# operations. Many things are easier. We have a new way of marking things for
# moving. Instead of marking all nodes and thugishly moving them as clones or
# copies, the user can specify what type of operation he wants on the node. This
Exemplo n.º 11
0
- Selecting a headline containing \@clip appends the contents of the clipboard to
  the end of the body pane.

- The double-click-icon-box command on a node whose headline contains \@view
  *<path-to-file>* places the contents of the file in the body pane.

- The double-click-icon-box command on a node whose headline contains \@strip
  *<path-to-file>* places the contents of the file in the body pane, with all
  sentinels removed.

This plugin also accumulates the effect of all \@path nodes.
'''
#@-<< docstring >>
__version__ = "0.9"
import leo.core.leoGlobals as g
path = g.importExtension('path', pluginName=__name__, verbose=True)
win32clipboard = g.importExtension('win32clipboard',
                                   pluginName=__name__,
                                   verbose=True)


#@+others
#@+node:ekr.20111104210837.9693: ** init
def init():
    '''Return True if the plugin has loaded successfully.'''
    ok = path and win32clipboard
    # Ok for unit testing.
    if ok:
        g.registerHandler("after-create-leo-frame", onCreate)
    elif not g.app.unitTesting:
        s = 'at_view plugin not loaded: win32Clipboard not present.'
Exemplo n.º 12
0
'''Adds pie menus: http://www.piemenus.com/'''

#@@language python
#@@tabwidth -4

__version__ = ".29"

#@+<< pie_menus imports >>
#@+node:ekr.20040828122150.1: ** << pie_menus imports >>
import leo.core.leoGlobals as g

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

Tk = g.importExtension('Tkinter', pluginName=__name__, verbose=True)
tkFont = g.importExtension('tkFont', pluginName=__name__, verbose=True)

import weakref
#@-<< pie_menus imports >>
#@+<< version history >>
#@+node:ekr.20050518065635: ** << version history >>
#@+at
#
# .28 EKR: Added import for tkFont.
# .29 EKR: import tkGui as needed.
#@-<< version history >>

timeids = weakref.WeakKeyDictionary()
fas = weakref.WeakKeyDictionary()
Exemplo n.º 13
0
#@@language python
#@@tabwidth -4

#@+<<imports>>
#@+node:ekr.20050301095332.2: ** <<imports>>
import leo.core.leoGlobals as g

import leo.core.leoAtFile as leoAtFile
import leo.core.leoCommands as leoCommands

import leo.plugins.tkGui as tkGui
leoTkinterDialog = tkGui.leoTkinterDialog
tkinterListBoxDialog = tkGui.tkinterListBoxDialog

Tk = g.importExtension('Tkinter', pluginName=__name__, verbose=True)
Pmw = g.importExtension("Pmw", pluginName=__name__, verbose=True)

import binascii
import os
import pickle
#@-<<imports>>
__version__ = "1.6"

#@+<< version history >>
#@+node:ekr.20050301103957: ** << version history >>
#@@killcolor

#@+at
# 1.2: By Bernhard Mulder.
# 1.3 EKR: Mods for 4.3 code base.
Exemplo n.º 14
0
# 0.9 EKR: Make sure self.c == keywords.get('c') in all hook handlers.
# 1.0 EKR: Added support for chapters: don't allow a dehoist of an @chapter node.
# 1.1 EKR: Use hoist-changed hook rather than idle-time hook to update the widgets.
# 1.2 bobjack:
#     - bind hois/dehoist buttons together if Tk and toolbar.py is enabled
#@-<< change history >>

__version__ = "1.2"

# print('at top of hoist.py')

#@+<< imports >>
#@+node:ekr.20040908093511.1: ** << imports >>
import leo.core.leoGlobals as g

Tk = g.importExtension('Tkinter')

import sys
#@-<< imports >>

activeHoistColor = "pink1" # The Tk color to use for the active hoist button.

# Set this to 0 if the sizing of the toolbar controls doesn't look good on your platform.
USE_SIZER = False
USE_FIXED_SIZES = sys.platform != "darwin"
SIZER_HEIGHT = 23 # was 25
SIZER_WIDTH = 55 # was 70


#@+others
#@+node:ekr.20070301070027: ** init
Exemplo n.º 15
0
if 0:
    def __dummy():
        """This is a __very important__ function."""
        return None
#@-<< example >>

#@@language python
#@@tabwidth -4

#@+<< imports >>
#@+node:ekr.20050101090207.3: ** << imports >>
import leo.core.leoGlobals as g
import tkFileDialog

Tk =             g.importExtension('Tkinter',       pluginName=__name__,verbose=True)
tkColorChooser = g.importExtension('tkColorChooser',pluginName=__name__,verbose=True)

try:
    import PIL
except ImportError:
    PIL = None

import os
import string  # zfill does not exist in Python 2.2.1
#@-<< imports >>

__version__ = "1.8"
#@+<< version history >>
#@+node:ekr.20050311104330: ** << version history >>
#@@nocolor
Exemplo n.º 16
0
attributes of one another.

'''
#@-<< docstring >>

#@@language python
#@@tabwidth -4

#@+<< imports >>
#@+node:ekr.20110602070710.3454: ** << imports >>
import leo.core.leoGlobals as g

import leo.plugins.tkGui as tkGui
leoTkinterFrame = tkGui.leoTkinterFrame   

Pmw = g.importExtension('Pmw',pluginName=__name__,verbose=True,required=True)
#@-<< imports >>

__version__ = ".5"
#@+<< version history >>
#@+node:ekr.20110602070710.3455: ** << version history >>
#@@killcolor

#@+at
# 
# 0.3 EKR:  Base on version 0.2 from Leo User.
#     - Minor changes:  new/different section names.
#     - Use g.importExtension to import PMW.
#     - Added init function.
# 
# 0.4 EKR: