def onCreate(tag, keywords): """Handle the per-Leo-file settings.""" global gDict c = keywords.get('c') if g.app.killed or not c or not c.exists: return if g.unitTesting: return # 2011/02/28 # 2011/02/28: do nothing here if we already have registered the idle-time hook. d = gDict.get(c.hash()) if d: return active = c.config.getBool('mod_autosave_active', default=False) interval = c.config.getInt('mod_autosave_interval') if active: # Create an entry in the global settings dict. d = { 'last': time.time(), 'interval': interval, } gDict[c.hash()] = d g.es("auto save enabled every %s sec." % (interval), color="orange") g.registerHandler('idle', onIdle) g.enableIdleTimeHook() else: g.es("@bool mod_autosave_active=False", color='orange')
def onCreate(tag, keywords): """Handle the per-Leo-file settings.""" global gDict c = keywords.get('c') if g.app.killed or not c or not c.exists: return if g.unitTesting: return # 2011/02/28 # 2011/02/28: do nothing here if we already have registered the idle-time hook. d = gDict.get(c.hash()) if d: return active = c.config.getBool('mod_autosave_active',default=False) interval = c.config.getInt('mod_autosave_interval') if active: # Create an entry in the global settings dict. d = { 'last':time.time(), 'interval':interval, } gDict[c.hash()] = d g.es("auto save enabled every %s sec." % ( interval),color="orange") g.registerHandler('idle',onIdle) g.enableIdleTimeHook() else: g.es("@bool mod_autosave_active=False",color='orange')
def activate (self): '''Activate the vr-window.''' pc = self if pc.active: return if trace: g.trace('=====') pc.inited = True pc.active = True g.registerHandler('select2',pc.update) g.registerHandler('idle',pc.update) # Enable the idle-time hook if it has not already been enabled. if not g.app.idleTimeHook: g.enableIdleTimeHook(idleTimeDelay=1000)
def init(): # Equivalent functionality comes with contextmenu.py on qt ui. ok = Tk and g.app.gui.guiName() == 'tkinter' if ok: g.app.hasOpenWithMenu = True g.enableIdleTimeHook(idleTimeDelay=1000) # Check every second. g.registerHandler("idle", on_idle) g.registerHandler('menu2', create_open_with_menu) g.plugin_signon(__name__) return ok
def activate (self): pc = self if pc.active: return pc.inited = True pc.active = True g.registerHandler('select2',pc.update) g.registerHandler('idle',pc.update) # Enable the idle-time hook if it has not already been enabled. if not g.app.idleTimeHook: g.enableIdleTimeHook(idleTimeDelay=1000)
def OnIconDoubleClick(tag,keywords): global RunNode,RunList,OwnIdleHook,ExitCode c=keywords.get('c') if not c or not c.exists: return p = c.p # g.trace(c.shortFileName()) h = p.h if g.match_word(h,0,"@run"): if RunNode or RunList: g.error("@run already running!") else: #@+<< handle double click in @run icon >> #@+node:ekr.20040910102554: *4* << handle double click in @run icon >> RunList = [] for p2 in p.self_and_subtree(): if g.match_word(p2.h,0,"@run"): # g.trace(p2.h) # 2009/10/30: don't use iter copy arg. RunList.append(p2.copy()) ExitCode = None OwnIdleHook = True g.enableIdleTimeHook(idleTimeDelay=100) #@-<< handle double click in @run icon >> elif g.match_word(h,0,"@in"): if RunNode: #@+<< handle double click in @in icon >> #@+node:ekr.20040910102554.1: *4* << handle double click in @in icon >> b = p.b try: In.write(b.encode(Encoding)+"\n") In.flush() g.es(b) except IOError as ioerr: g.error("@run IOError: "+str(ioerr))
def OnIconDoubleClick(tag, keywords): global RunNode, RunList, OwnIdleHook, ExitCode c = keywords.get('c') if not c or not c.exists: return p = c.p # g.trace(c.shortFileName()) h = p.h if g.match_word(h, 0, "@run"): if RunNode or RunList: g.error("@run already running!") else: #@+<< handle double click in @run icon >> #@+node:ekr.20040910102554: *4* << handle double click in @run icon >> RunList = [] for p2 in p.self_and_subtree(): if g.match_word(p2.h, 0, "@run"): # g.trace(p2.h) # 2009/10/30: don't use iter copy arg. RunList.append(p2.copy()) ExitCode = None OwnIdleHook = True g.enableIdleTimeHook(idleTimeDelay=100) #@-<< handle double click in @run icon >> elif g.match_word(h, 0, "@in"): if RunNode: #@+<< handle double click in @in icon >> #@+node:ekr.20040910102554.1: *4* << handle double click in @in icon >> b = p.b try: In.write(b.encode(Encoding) + "\n") In.flush() g.es(b) except IOError as ioerr: g.error("@run IOError: " + str(ioerr))