diff options
author | Johnathan Corgan <johnathan@corganlabs.com> | 2017-01-25 10:15:47 -0800 |
---|---|---|
committer | Johnathan Corgan <johnathan@corganlabs.com> | 2017-01-25 10:15:47 -0800 |
commit | 7c7fc1666e6ea393e537e084d5b393c43130b24d (patch) | |
tree | dfc3e06317130c4b882262a4ab3e17a91c74c1a7 | |
parent | e70db91c1621ff3673323a6514fd646575b11e43 (diff) | |
parent | 03fbdc92f87ce346c591714aada5b3ff4e7d561e (diff) |
Merge branch 'master' into next
Conflicts:
gr-atsc/CMakeLists.txt
-rw-r--r-- | gr-dtv/CMakeLists.txt | 2 | ||||
-rw-r--r-- | grc/gui/external_editor.py | 28 |
2 files changed, 15 insertions, 15 deletions
diff --git a/gr-dtv/CMakeLists.txt b/gr-dtv/CMakeLists.txt index cf17d0971d..c4b74f2283 100644 --- a/gr-dtv/CMakeLists.txt +++ b/gr-dtv/CMakeLists.txt @@ -27,6 +27,8 @@ include(GrBoost) ######################################################################## include(GrComponent) +find_package(GSL) + GR_REGISTER_COMPONENT("gr-dtv" ENABLE_GR_DTV Boost_FOUND GSL_FOUND diff --git a/grc/gui/external_editor.py b/grc/gui/external_editor.py index 76f21412b0..010bd71d1a 100644 --- a/grc/gui/external_editor.py +++ b/grc/gui/external_editor.py @@ -34,18 +34,14 @@ class ExternalEditor(threading.Thread): self.editor = editor self.callback = callback - self.tempfile = self._create_tempfile(name, value) + self.filename = self._create_tempfile(name, value) def _create_tempfile(self, name, value): - fp = tempfile.NamedTemporaryFile(mode='w', suffix='.py', - prefix=name + '_') - fp.write(value) - fp.flush() - return fp - - @property - def filename(self): - return self.tempfile.name + with tempfile.NamedTemporaryFile( + mode='wb', prefix=name + '_', suffix='.py', delete=False, + ) as fp: + fp.write(value.encode('utf-8')) + return fp.name def open_editor(self): proc = subprocess.Popen(args=(self.editor, self.filename)) @@ -65,16 +61,18 @@ class ExternalEditor(threading.Thread): if mtime > last_change: # print "file monitor: reload trigger for", filename last_change = mtime - with open(filename) as fp: - data = fp.read() + with open(filename, 'rb') as fp: + data = fp.read().decode('utf-8') self.callback(data) time.sleep(1) except Exception as e: print >> sys.stderr, "file monitor crashed:", str(e) - else: - # print "file monitor: done with", filename - pass + finally: + try: + os.remove(self.filename) + except OSError: + pass if __name__ == '__main__': |