printrun-src/printrun/pronterface.py

changeset 16
36d478bde840
parent 15
0bbb006204fc
child 19
234037fbca4b
--- a/printrun-src/printrun/pronterface.py	Fri Jun 03 09:16:07 2016 +0200
+++ b/printrun-src/printrun/pronterface.py	Fri Jun 03 09:42:44 2016 +0200
@@ -1,5 +1,8 @@
 #!/usr/bin/env python
 
+# FILE MODIFIED BY NEOSOFT - MALTE BAYER
+# Embed Lasercut functions from laser.py 
+
 # This file is part of the Printrun suite.
 #
 # Printrun is free software: you can redistribute it and/or modify
@@ -15,6 +18,8 @@
 # You should have received a copy of the GNU General Public License
 # along with Printrun.  If not, see <http://www.gnu.org/licenses/>.
 
+from laser import Lasercutter
+
 import os
 import Queue
 import sys
@@ -1338,7 +1343,8 @@
         dlg = None
         if filename is None:
             dlg = wx.FileDialog(self, _("Open file to print"), basedir, style = wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
-            dlg.SetWildcard(_("OBJ, STL, and GCODE files (*.gcode;*.gco;*.g;*.stl;*.STL;*.obj;*.OBJ)|*.gcode;*.gco;*.g;*.stl;*.STL;*.obj;*.OBJ|GCODE files (*.gcode;*.gco;*.g)|*.gcode;*.gco;*.g|OBJ, STL files (*.stl;*.STL;*.obj;*.OBJ)|*.stl;*.STL;*.obj;*.OBJ|All Files (*.*)|*.*"))
+            # add image files to GCODE file list
+            dlg.SetWildcard(_("GCODE and Image files|*.gcode;*.gco;*.g;*.png;*.svg;*.hpgl;*.plt|OBJ, STL, and GCODE files (*.gcode;*.gco;*.g;*.stl;*.STL;*.obj;*.OBJ)|*.gcode;*.gco;*.g;*.stl;*.STL;*.obj;*.OBJ|GCODE files (*.gcode;*.gco;*.g)|*.gcode;*.gco;*.g|OBJ, STL files (*.stl;*.STL;*.obj;*.OBJ)|*.stl;*.STL;*.obj;*.OBJ|All Files (*.*)|*.*"))
             try:
               dlg.SetFilterIndex(self.settings.last_file_filter)
             except:
@@ -1375,6 +1381,18 @@
                               "\n" + traceback.format_exc())
             if name.lower().endswith(".stl") or name.lower().endswith(".obj"):
                 self.slice(name)
+            elif name.lower().endswith(".png") or name.lower().endswith(".jpg") or name.lower().endswith(".gif"):
+                # Generate GCODE from IMAGE
+                lc = Lasercutter(pronterwindow = self)
+                lc.image2gcode(name)  
+            elif name.lower().endswith(".svg"):
+                # Generate GCODE from SVG
+                lc = Lasercutter(pronterwindow = self)
+                lc.svg2gcode(name)  
+            elif name.lower().endswith(".hpgl") or name.lower().endswith(".plt"):
+                # Generate GCODE from HPGL
+                lc = Lasercutter(pronterwindow = self)
+                lc.hpgl2gcode(name)  
             else:
                 self.load_gcode_async(name)
         else:

mercurial