summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com>2017-03-17 15:44:08 +0100
committerJuergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com>2017-03-17 15:44:08 +0100
commite45b6dc502cf73fbc45e7ebebf367feb88e09e64 (patch)
treeb5b898a81e3da836756a206aeb5cbd495d1abc22
parent2fc4a28de8d70058310a6951cd93849c17d50908 (diff)
downloadqtivi-qface-e45b6dc502cf73fbc45e7ebebf367feb88e09e64.tar.gz
Fixed an issue with the reloading options for the reference generators
-rwxr-xr-xqface/builtin/qtcpp/qtcpp.py4
-rwxr-xr-xqface/builtin/qtqml/qtqml.py4
-rw-r--r--qface/watch.py15
3 files changed, 11 insertions, 12 deletions
diff --git a/qface/builtin/qtcpp/qtcpp.py b/qface/builtin/qtcpp/qtcpp.py
index 630e64a..283b8f6 100755
--- a/qface/builtin/qtcpp/qtcpp.py
+++ b/qface/builtin/qtcpp/qtcpp.py
@@ -71,8 +71,8 @@ def app(src, dst, reload):
"""Takes several files or directories as src and generates the code
in the given dst directory."""
if reload:
- script = '{0} {1} {2}'.format(Path(__file__).abspath(), ' '.join(src), dst)
- monitor(src, script)
+ script = Path(__file__).abspath()
+ monitor(script, src, dst)
else:
run(src, dst)
diff --git a/qface/builtin/qtqml/qtqml.py b/qface/builtin/qtqml/qtqml.py
index b5ed136..1d00d74 100755
--- a/qface/builtin/qtqml/qtqml.py
+++ b/qface/builtin/qtqml/qtqml.py
@@ -57,8 +57,8 @@ def app(src, dst, reload):
"""Takes several files or directories as src and generates the code
in the given dst directory."""
if reload:
- script = '{0} {1} {2}'.format(Path(__file__).abspath(), ' '.join(src), dst)
- monitor(src, script)
+ script = Path(__file__).abspath()
+ monitor(script, src, dst)
else:
run(src, dst)
diff --git a/qface/watch.py b/qface/watch.py
index 4a8512f..9129bfa 100644
--- a/qface/watch.py
+++ b/qface/watch.py
@@ -10,9 +10,9 @@ Provides an API to monitor the file system
"""
class RunScriptChangeHandler(FileSystemEventHandler):
- def __init__(self, argv):
+ def __init__(self, script):
super().__init__()
- self.argv = argv
+ self.script = script
self.is_running = False
def on_modified(self, event):
@@ -22,21 +22,20 @@ class RunScriptChangeHandler(FileSystemEventHandler):
if self.is_running:
return
self.is_running = True
- # cmd = '{0} {1}'.format(sys.executable, ' '.join(self.argv))
- sh(' '.join(self.argv), cwd=Path.getcwd())
+ sh(self.script, cwd=Path.getcwd())
self.is_running = False
-def monitor(src, argv):
+def monitor(script, src, dst):
"""
reloads the script given by argv when src files changes
"""
- script = Path(argv[0]).expand().abspath()
src = src if isinstance(src, (list, tuple)) else [src]
+ script = '{0} {1} {2}'.format(script, ' '.join(src), dst)
src = [Path(entry).expand().abspath() for entry in src]
- event_handler = RunScriptChangeHandler(argv)
+ event_handler = RunScriptChangeHandler(script)
observer = Observer()
- path = script.dirname().expand().abspath()
+ path = Path(script).dirname().expand().abspath()
click.secho('watch recursive: {0}'.format(path), fg='blue')
observer.schedule(event_handler, path, recursive=True)
for entry in src: