12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 # GNU General Public License for more details. |
16 # GNU General Public License for more details. |
14 # |
17 # |
15 # You should have received a copy of the GNU General Public License |
18 # You should have received a copy of the GNU General Public License |
16 # along with Printrun. If not, see <http://www.gnu.org/licenses/>. |
19 # along with Printrun. If not, see <http://www.gnu.org/licenses/>. |
|
20 |
|
21 from laser import Lasercutter |
17 |
22 |
18 import os |
23 import os |
19 import Queue |
24 import Queue |
20 import sys |
25 import sys |
21 import time |
26 import time |
1336 except: |
1341 except: |
1337 pass |
1342 pass |
1338 dlg = None |
1343 dlg = None |
1339 if filename is None: |
1344 if filename is None: |
1340 dlg = wx.FileDialog(self, _("Open file to print"), basedir, style = wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) |
1345 dlg = wx.FileDialog(self, _("Open file to print"), basedir, style = wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) |
1341 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 (*.*)|*.*")) |
1346 # add image files to GCODE file list |
|
1347 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 (*.*)|*.*")) |
1342 try: |
1348 try: |
1343 dlg.SetFilterIndex(self.settings.last_file_filter) |
1349 dlg.SetFilterIndex(self.settings.last_file_filter) |
1344 except: |
1350 except: |
1345 pass |
1351 pass |
1346 if filename or dlg.ShowModal() == wx.ID_OK: |
1352 if filename or dlg.ShowModal() == wx.ID_OK: |
1373 except: |
1379 except: |
1374 self.logError(_("Could not update recent files list:") + |
1380 self.logError(_("Could not update recent files list:") + |
1375 "\n" + traceback.format_exc()) |
1381 "\n" + traceback.format_exc()) |
1376 if name.lower().endswith(".stl") or name.lower().endswith(".obj"): |
1382 if name.lower().endswith(".stl") or name.lower().endswith(".obj"): |
1377 self.slice(name) |
1383 self.slice(name) |
|
1384 elif name.lower().endswith(".png") or name.lower().endswith(".jpg") or name.lower().endswith(".gif"): |
|
1385 # Generate GCODE from IMAGE |
|
1386 lc = Lasercutter(pronterwindow = self) |
|
1387 lc.image2gcode(name) |
|
1388 elif name.lower().endswith(".svg"): |
|
1389 # Generate GCODE from SVG |
|
1390 lc = Lasercutter(pronterwindow = self) |
|
1391 lc.svg2gcode(name) |
|
1392 elif name.lower().endswith(".hpgl") or name.lower().endswith(".plt"): |
|
1393 # Generate GCODE from HPGL |
|
1394 lc = Lasercutter(pronterwindow = self) |
|
1395 lc.hpgl2gcode(name) |
1378 else: |
1396 else: |
1379 self.load_gcode_async(name) |
1397 self.load_gcode_async(name) |
1380 else: |
1398 else: |
1381 dlg.Destroy() |
1399 dlg.Destroy() |
1382 |
1400 |