def ask(self, c, path, p=None): ''' Ask user whether to overwrite an @<file> tree. Return True if the user agrees. ''' if g.unitTesting: return False if self.yesno_all_time + 3 >= time.time() and self.yesno_all_answer: self.yesno_all_time = time.time() # Still reloading? Extend time. return bool('yes' in self.yesno_all_answer.lower()) if not p: for ef in self.files: if ef.path == path: where = ef.p.h break else: where = 'the outline node' else: where = p.h s = '\n'.join([ '%s has changed outside Leo.' % (g.splitLongFileName(path)), 'Reload %s in Leo?' % (where), ]) result = g.app.gui.runAskYesNoDialog(c, 'Overwrite the version in Leo?', s, yes_all=True, no_all=True) if result and "-all" in result.lower(): self.yesno_all_time = time.time() self.yesno_all_answer = result.lower() return bool(result and 'yes' in result.lower())
def ask(self, c, path, p=None): ''' Ask user whether to overwrite an @<file> tree. Return True if the user agrees. ''' if not p: for ef in self.files: if ef.path == path: where = ef.p.h break else: where = 'the outline node' else: where = p.h s = '\n'.join([ '%s has changed outside Leo.' % (g.splitLongFileName(path)), 'Overwrite %s?' % (where), ]) result = g.app.gui.runAskYesNoDialog(c, 'Overwrite the Leo outline?', s) return bool(result and result.lower() == 'yes')
def ask(self, c, path, p=None): ''' Ask user whether to overwrite an @<file> tree. Return True if the user agrees. ''' if p is None: for ef in self.files: if ef.path == path: where = ef.p.h break else: where = 'the outline node' else: where = p.h s = '\n'.join([ '%s has changed outside Leo.' % (g.splitLongFileName(path)), 'Overwrite %s?' % (where), ]) result = g.app.gui.runAskYesNoDialog(c, 'Overwrite the Leo outline?', s) return bool(result and result.lower() == 'yes')
def warn(self, c, path, p): ''' Warn that an @asis or @nosent node has been changed externally. There is *no way* to update the tree automatically. ''' if g.unitTesting or c not in g.app.commanders(): return if not p: g.trace('NO P') return g.app.gui.runAskOkDialog( c=c, message='\n'.join([ '%s has changed outside Leo.\n' % g.splitLongFileName(path), 'Leo can not update this file automatically.\n', 'This file was created from %s.\n' % p.h, 'Warning: refresh-from-disk will destroy all children.' ]), title='External file changed', )
def warn(self, c, path, p): ''' Warn that an @asis or @nosent node has been changed externally. There is *no way* to update the tree automatically. ''' if g.unitTesting or c not in g.app.commanders(): return if not p: g.trace('NO P') return g.app.gui.runAskOkDialog( c=c, message='\n'.join([ '%s has changed outside Leo.\n' % g.splitLongFileName(path), 'Leo can not update this file automatically.\n', 'This file was created from %s.\n' % p.h, 'Warning: refresh-from-disk will destroy all children.' ]), title='External file changed', )