def exec_diff_on_note(self, note, old_note): diff = self.get_diff() if not diff: return None pager = self.get_pager() if not pager: return None ltf = temp.tempfile_create(note) otf = temp.tempfile_create(old_note) out = temp.tempfile_create(None) try: subprocess.call(diff + u' ' + temp.tempfile_name(ltf) + u' ' + temp.tempfile_name(otf) + u' > ' + temp.tempfile_name(out), shell=True) subprocess.check_call(pager + u' ' + temp.tempfile_name(out), shell=True) except Exception, e: self.log(u'Command error: ' + str(e)) temp.tempfile_delete(ltf) temp.tempfile_delete(otf) temp.tempfile_delete(out) return None
def exec_cmd_on_note(self, note, cmd=None, raw=False): if not cmd: cmd = self.get_editor() if not cmd: return None tf = temp.tempfile_create(note if note else None, raw=raw) try: subprocess.check_call(cmd + u' ' + temp.tempfile_name(tf), shell=True) except Exception, e: self.log(u'Command error: ' + str(e)) temp.tempfile_delete(tf) return None