summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Shramov <psha@kamba.psha.org.ru>2010-12-06 19:43:09 +0300
committerPavel Shramov <psha@kamba.psha.org.ru>2010-12-06 21:02:15 +0300
commit5a130eebdeb9b0d02ff060fcc79c7a7b1821902d (patch)
tree9912f39fc799a69bdb700fb936258a41194b356c
parente01c51ad4b889c942db7dcaeaff00cddf8a3c442 (diff)
downloadlinuxcnc-5a130eebdeb9b0d02ff060fcc79c7a7b1821902d.tar.gz
linuxcnc-5a130eebdeb9b0d02ff060fcc79c7a7b1821902d.zip
gremlin: Add make rules for gremlin
Split gremlin script from module and install it to bin/ Install module to lib/python
-rw-r--r--src/Makefile1
-rw-r--r--src/emc/usr_intf/gremlin/Submakefile14
-rwxr-xr-xsrc/emc/usr_intf/gremlin/gremlin-run38
-rwxr-xr-xsrc/emc/usr_intf/gremlin/gremlin.py28
4 files changed, 53 insertions, 28 deletions
diff --git a/src/Makefile b/src/Makefile
index 06f59801f..f6e909bac 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -105,6 +105,7 @@ SUBDIRS := \
hal/user_comps hal/user_comps/vismach hal/classicladder hal/utils hal \
\
emc/usr_intf/axis emc/usr_intf/touchy emc/usr_intf/stepconf emc/usr_intf/pncconf \
+ emc/usr_intf/gremlin \
emc/usr_intf emc/nml_intf emc/task emc/iotask emc/kinematics emc/canterp \
emc/motion emc/ini emc/rs274ngc emc/sai emc \
\
diff --git a/src/emc/usr_intf/gremlin/Submakefile b/src/emc/usr_intf/gremlin/Submakefile
new file mode 100644
index 000000000..f41abc9e5
--- /dev/null
+++ b/src/emc/usr_intf/gremlin/Submakefile
@@ -0,0 +1,14 @@
+PYTARGETS += ../bin/gremlin ../lib/python/gremlin.py
+PYI18NSRCS += emc/usr_intf/gremlin/gremlin.py
+
+../lib/python/%: emc/usr_intf/gremlin/%
+ @$(ECHO) Syntax checking python script $(notdir $@)
+ @$(PYTHON) -c 'import sys; compile(open(sys.argv[1]).read(), sys.argv[1], "exec")' $<
+ $(ECHO) Copying python script $(notdir $@)
+ @cp $< $@
+
+../bin/gremlin: emc/usr_intf/gremlin/gremlin-run
+ @$(ECHO) Syntax checking python script $(notdir $@)
+ @$(PYTHON) -c 'import sys; compile(open(sys.argv[1]).read(), sys.argv[1], "exec")' $<
+ $(ECHO) Copying python script $(notdir $@)
+ @(echo '#!$(PYTHON)'; sed '1 { /^#!/d; }' $<) > $@.tmp && chmod +x $@.tmp && mv -f $@.tmp $@
diff --git a/src/emc/usr_intf/gremlin/gremlin-run b/src/emc/usr_intf/gremlin/gremlin-run
new file mode 100755
index 000000000..e4ab9257f
--- /dev/null
+++ b/src/emc/usr_intf/gremlin/gremlin-run
@@ -0,0 +1,38 @@
+#!/usr/bin/python
+
+import os
+import gtk
+
+import emc
+from gremlin import Gremlin
+
+def W(p, k, *args, **kw):
+ w = k(*args, **kw)
+ w.show()
+ p.add(w)
+ return w
+
+class GremlinApp(gtk.Window):
+ def __init__(self, inifile):
+ if not inifile:
+ inifile = os.environ.get('INI_FILE_NAME', None)
+
+ inifile = emc.ini(inifile)
+ gtk.Window.__init__(self)
+
+ self.vbox = W(self, gtk.VBox)
+ self.gremlin = W(self.vbox, Gremlin, inifile)
+ self.gremlin.set_size_request(400, 400)
+
+ self.connect("destroy", self.quit)
+
+ self.show()
+ def quit(self, event):
+ gtk.main_quit()
+
+def main():
+ from sys import argv
+ g = GremlinApp(argv[1])
+ gtk.main()
+
+if __name__ == '__main__': raise SystemExit, main()
diff --git a/src/emc/usr_intf/gremlin/gremlin.py b/src/emc/usr_intf/gremlin/gremlin.py
index c478bf2e7..ddf537cc4 100755
--- a/src/emc/usr_intf/gremlin/gremlin.py
+++ b/src/emc/usr_intf/gremlin/gremlin.py
@@ -35,12 +35,6 @@ class StatCanon(rs274.glcanon.GLCanon, rs274.interpret.StatMixin):
def is_lathe(self): return False
-def W(p, k, *args, **kw):
- w = k(*args, **kw)
- w.show()
- p.add(w)
- return w
-
class Gremlin(gtk.gtkgl.widget.DrawingArea, glnav.GlNavBase,
rs274.glcanon.GlCanonDraw):
rotation_vectors = [(1.,0.,0.), (0., 0., 1.)]
@@ -274,25 +268,3 @@ class Gremlin(gtk.gtkgl.widget.DrawingArea, glnav.GlNavBase,
def scroll(self, widget, event):
if event.direction == gtk.gdk.SCROLL_UP: self.zoomin()
elif event.direction == gtk.gdk.SCROLL_DOWN: self.zoomout()
-
-class GremlinApp(gtk.Window):
- def __init__(self, inifile):
- inifile = emc.ini(inifile)
- gtk.Window.__init__(self)
-
- self.vbox = W(self, gtk.VBox)
- self.gremlin = W(self.vbox, Gremlin, inifile)
- self.gremlin.set_size_request(400, 400)
-
- self.connect("destroy", self.quit)
-
- self.show()
- def quit(self, event):
- gtk.main_quit()
-
-def main():
- from sys import argv
- g = GremlinApp(argv[1])
- gtk.main()
-
-if __name__ == '__main__': raise SystemExit, main()