From 41889d62ed8e65612b0070173cd3ab2ae1acf958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Sat, 24 Nov 2012 15:53:03 +0100 Subject: [PATCH 1/8] Added missing files to setup.py If I install Printrun via setup.py, I don't have gcoder.py and I cannot even use pronterface.py: Traceback (most recent call last): File "/bin/pronterface.py", line 46, in import pronsole File "/usr/bin/pronsole.py", line 23, in from gcoder import GCode So I've added this to setup.py. Also, pronsole.ico is missing, added that to (not needed at runtime, but is usefull for desktop files) --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index af9f481..b190cc5 100755 --- a/setup.py +++ b/setup.py @@ -112,7 +112,7 @@ if sys.argv[1] in ("install", "uninstall") and len (prefix): sys.argv += ["--prefix", prefix] target_images_path = "share/pronterface/images/" -data_files = [('share/pixmaps/', ['P-face.ico','plater.ico'])] +data_files = [('share/pixmaps/', ['P-face.ico','plater.ico','pronsole.ico'])] for basedir, subdirs, files in os.walk("images"): images = [] @@ -145,7 +145,7 @@ setup ( license = "GPLv3", data_files = data_files, packages = ["printrun", "printrun.svg"], - scripts = ["pronsole.py", "pronterface.py", "plater.py", "printcore.py"], + scripts = ["pronsole.py", "pronterface.py", "plater.py", "printcore.py", "gcoder.py"], cmdclass = {"uninstall" : uninstall, "install" : install, "install_data" : install_data} From d90166b04c6b09f4fa464552c47370868f3611f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Sun, 13 Jan 2013 12:18:47 +0100 Subject: [PATCH 2/8] Making the whole package GNU GPLv3+. --- README.md | 2 ++ printrun/SkeinforgeQuickEditDialog.py | 14 ++++++++++++++ printrun/bmpDisplay.py | 15 ++++++++++++++ printrun/bufferedcanvas.py | 28 +++++++++++---------------- printrun/calibrateextruder.py | 17 +++++++++++++++- printrun/gcview.py | 15 ++++++++++++++ printrun/printrun_utils.py | 15 ++++++++++++++ printrun/svg/__init__.py | 15 ++++++++++++++ printrun/svg/attributes.py | 15 ++++++++++++++ printrun/svg/css/__init__.py | 15 ++++++++++++++ printrun/svg/css/atrule.py | 15 ++++++++++++++ printrun/svg/css/block.py | 15 ++++++++++++++ printrun/svg/css/colour.py | 15 ++++++++++++++ printrun/svg/css/identifier.py | 15 ++++++++++++++ printrun/svg/css/inline.py | 15 ++++++++++++++ printrun/svg/css/transform.py | 15 ++++++++++++++ printrun/svg/css/values.py | 15 ++++++++++++++ printrun/svg/document.py | 15 ++++++++++++++ printrun/svg/pathdata.py | 15 ++++++++++++++ printrun/webinterface.py | 15 ++++++++++++++ 20 files changed, 283 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index b18e5a0..5c5588f 100644 --- a/README.md +++ b/README.md @@ -180,3 +180,5 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Printrun. If not, see . ``` + +All scripts should contain this license note, if not, feel free to ask us. Please note that files where it is difficult to state this license note (such as images) are distributed under the same terms. diff --git a/printrun/SkeinforgeQuickEditDialog.py b/printrun/SkeinforgeQuickEditDialog.py index aaafa9e..4218671 100644 --- a/printrun/SkeinforgeQuickEditDialog.py +++ b/printrun/SkeinforgeQuickEditDialog.py @@ -1,4 +1,18 @@ #!/usr/bin/env python +# This file is part of the Printrun suite. +# +# Printrun is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Printrun is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Printrun. If not, see . from skeinforge.fabmetheus_utilities import archive from skeinforge.fabmetheus_utilities import settings diff --git a/printrun/bmpDisplay.py b/printrun/bmpDisplay.py index 99a4f5b..5e941bd 100644 --- a/printrun/bmpDisplay.py +++ b/printrun/bmpDisplay.py @@ -1,3 +1,18 @@ +# This file is part of the Printrun suite. +# +# Printrun is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Printrun is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Printrun. If not, see . + # create a simple image slide show using the # wx.PaintDC surface as a canvas and # DrawBitmap(bitmap, x, y, bool transparent) diff --git a/printrun/bufferedcanvas.py b/printrun/bufferedcanvas.py index 283962a..85ad019 100644 --- a/printrun/bufferedcanvas.py +++ b/printrun/bufferedcanvas.py @@ -18,26 +18,20 @@ url: __author__ = 'Daniel Keep ' __license__ = """ -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public License as -published by the Free Software Foundation; either version 2.1 of the -License, or (at your option) any later version. +This file is part of the Printrun suite. -As a special exception, the copyright holders of this library -hereby recind Section 3 of the GNU Lesser General Public License. This -means that you MAY NOT apply the terms of the ordinary GNU General -Public License instead of this License to any given copy of the -Library. This has been done to prevent users of the Library from being -denied access or the ability to use future improvements. +Printrun is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. -This library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser -General Public License for more details. +Printrun is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +You should have received a copy of the GNU General Public License +along with Printrun. If not, see . """ __all__ = ['BufferedCanvas'] diff --git a/printrun/calibrateextruder.py b/printrun/calibrateextruder.py index 9509203..7246b17 100644 --- a/printrun/calibrateextruder.py +++ b/printrun/calibrateextruder.py @@ -1,7 +1,22 @@ #!/usr/bin/python +# This file is part of the Printrun suite. +# +# Printrun is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Printrun is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Printrun. If not, see . + #Interactive RepRap e axis calibration program #(C) Nathan Zadoks 2011 -#Licensed under CC-BY-SA or GPLv2 and higher - Pick your poison. + s = 300 #Extrusion speed (mm/min) n = 100 #Default length to extrude m= 0 #User-entered measured extrusion length diff --git a/printrun/gcview.py b/printrun/gcview.py index 6b0370e..488ad54 100755 --- a/printrun/gcview.py +++ b/printrun/gcview.py @@ -1,4 +1,19 @@ #!/usr/bin/python +# This file is part of the Printrun suite. +# +# Printrun is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Printrun is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Printrun. If not, see . + import os import math import wx diff --git a/printrun/printrun_utils.py b/printrun/printrun_utils.py index 725d3cc..4ba2a1f 100644 --- a/printrun/printrun_utils.py +++ b/printrun/printrun_utils.py @@ -1,3 +1,18 @@ +# This file is part of the Printrun suite. +# +# Printrun is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Printrun is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Printrun. If not, see . + import os, sys import gettext diff --git a/printrun/svg/__init__.py b/printrun/svg/__init__.py index 298e1e0..5d41cbb 100644 --- a/printrun/svg/__init__.py +++ b/printrun/svg/__init__.py @@ -1,3 +1,18 @@ +# This file is part of the Printrun suite. +# +# Printrun is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Printrun is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Printrun. If not, see . + """ """ diff --git a/printrun/svg/attributes.py b/printrun/svg/attributes.py index 1c177a3..526718f 100644 --- a/printrun/svg/attributes.py +++ b/printrun/svg/attributes.py @@ -1,3 +1,18 @@ +# This file is part of the Printrun suite. +# +# Printrun is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Printrun is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Printrun. If not, see . + """ Parsers for specific attributes """ diff --git a/printrun/svg/css/__init__.py b/printrun/svg/css/__init__.py index a8dfcbd..8a3f576 100644 --- a/printrun/svg/css/__init__.py +++ b/printrun/svg/css/__init__.py @@ -1,3 +1,18 @@ +# This file is part of the Printrun suite. +# +# Printrun is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Printrun is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Printrun. If not, see . + from __future__ import absolute_import from .transform import transformList from .inline import inlineStyle diff --git a/printrun/svg/css/atrule.py b/printrun/svg/css/atrule.py index 7a0face..c652b17 100644 --- a/printrun/svg/css/atrule.py +++ b/printrun/svg/css/atrule.py @@ -1,3 +1,18 @@ +# This file is part of the Printrun suite. +# +# Printrun is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Printrun is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Printrun. If not, see . + """ CSS at-rules""" from pyparsing import Literal, Combine diff --git a/printrun/svg/css/block.py b/printrun/svg/css/block.py index 804f0c2..cccd1f4 100644 --- a/printrun/svg/css/block.py +++ b/printrun/svg/css/block.py @@ -1,3 +1,18 @@ +# This file is part of the Printrun suite. +# +# Printrun is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Printrun is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Printrun. If not, see . + """ CSS blocks """ diff --git a/printrun/svg/css/colour.py b/printrun/svg/css/colour.py index c7b6e87..5d0a248 100644 --- a/printrun/svg/css/colour.py +++ b/printrun/svg/css/colour.py @@ -1,3 +1,18 @@ +# This file is part of the Printrun suite. +# +# Printrun is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Printrun is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Printrun. If not, see . + """ Parsing for CSS colour values. Supported formats: diff --git a/printrun/svg/css/identifier.py b/printrun/svg/css/identifier.py index 64472ee..4581473 100644 --- a/printrun/svg/css/identifier.py +++ b/printrun/svg/css/identifier.py @@ -1,3 +1,18 @@ +# This file is part of the Printrun suite. +# +# Printrun is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Printrun is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Printrun. If not, see . + """ Parse CSS identifiers. More complicated than it sounds""" from pyparsing import Word, Literal, Regex, Combine, Optional, White, oneOf, ZeroOrMore diff --git a/printrun/svg/css/inline.py b/printrun/svg/css/inline.py index 9d23e70..6b3a58d 100644 --- a/printrun/svg/css/inline.py +++ b/printrun/svg/css/inline.py @@ -1,3 +1,18 @@ +# This file is part of the Printrun suite. +# +# Printrun is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Printrun is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Printrun. If not, see . + """ Parser for inline CSS in style attributes """ def inlineStyle(styleString): diff --git a/printrun/svg/css/transform.py b/printrun/svg/css/transform.py index 852b39b..2e72bd6 100644 --- a/printrun/svg/css/transform.py +++ b/printrun/svg/css/transform.py @@ -1,3 +1,18 @@ +# This file is part of the Printrun suite. +# +# Printrun is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Printrun is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Printrun. If not, see . + """ Parsing for CSS and CSS-style values, such as transform and filter attributes. """ diff --git a/printrun/svg/css/values.py b/printrun/svg/css/values.py index 48efbd0..d806b2a 100644 --- a/printrun/svg/css/values.py +++ b/printrun/svg/css/values.py @@ -1,3 +1,18 @@ +# This file is part of the Printrun suite. +# +# Printrun is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Printrun is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Printrun. If not, see . + """ Parser for various kinds of CSS values as per CSS2 spec section 4.3 """ diff --git a/printrun/svg/document.py b/printrun/svg/document.py index ecb28d0..6058c3a 100644 --- a/printrun/svg/document.py +++ b/printrun/svg/document.py @@ -1,3 +1,18 @@ +# This file is part of the Printrun suite. +# +# Printrun is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Printrun is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Printrun. If not, see . + """ SVGDocument """ diff --git a/printrun/svg/pathdata.py b/printrun/svg/pathdata.py index 7081df9..c2b45dd 100644 --- a/printrun/svg/pathdata.py +++ b/printrun/svg/pathdata.py @@ -1,3 +1,18 @@ +# This file is part of the Printrun suite. +# +# Printrun is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Printrun is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Printrun. If not, see . + """ SVG path data parser diff --git a/printrun/webinterface.py b/printrun/webinterface.py index d317f09..bc0d564 100644 --- a/printrun/webinterface.py +++ b/printrun/webinterface.py @@ -1,4 +1,19 @@ #!/usr/bin/python +# This file is part of the Printrun suite. +# +# Printrun is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Printrun is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Printrun. If not, see . + import pronterface import cherrypy, re, ConfigParser, threading, sys import os.path From 094dffa53bfbbf1df0ab67b0a1b05523dacf011c Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sun, 13 Jan 2013 13:27:14 +0100 Subject: [PATCH 3/8] Bugfix: printcore.py -s was generating garbage output --- printcore.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/printcore.py b/printcore.py index c431321..bb6501c 100755 --- a/printcore.py +++ b/printcore.py @@ -388,7 +388,7 @@ if __name__ == '__main__': while p.printing: time.sleep(1) if statusreport: - sys.stdout.write("\b\b\b\b%02.1f%%" % (100 * float(p.queueindex) / len(p.mainqueue),) ) + sys.stdout.write("%02.1f%%\r" % (100 * float(p.queueindex) / len(p.mainqueue),) ) sys.stdout.flush() p.disconnect() sys.exit(0) From 629a53ac5ce1106c7cafbf30fc5eb926c7ce8e51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Sun, 13 Jan 2013 20:57:15 +0100 Subject: [PATCH 4/8] gcoder.py reads only hte content of the file Previously, gcoder.py read not only the content of the file, but also it's filename. This could have led to unexpected exceptions. --- gcoder.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcoder.py b/gcoder.py index 9ed22c5..79c95bc 100755 --- a/gcoder.py +++ b/gcoder.py @@ -210,7 +210,7 @@ def main(): print "usage: %s filename.gcode" % sys.argv[0] return - gcode = GCode(sys.argv[1]) + gcode = GCode(list(open(sys.argv[1]))) gcode.measure() @@ -221,4 +221,4 @@ def main(): print "Filament used: %0.02fmm" % gcode.filament_length() if __name__ == '__main__': - main() \ No newline at end of file + main() From f942c1a00724a87ef0d115cc237bf48f8c837a70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 15 Jan 2013 21:22:56 +0100 Subject: [PATCH 5/8] Tell the user, there was an error while connecting Before, when there was an error while connecting, user didn't know, when Pronterface wasn't launched from the terminal. So you could just hit Connect button several times and all you've get was: Connecting... Connecting... Connecting... Now, when there is an exception during the connection, the user will notice: Connecting... Error: You are trying to connect to a non-exisiting port. Or: Connecting... Error: You don't have permission to open /dev/ttyUSB0. You might need to add yourself to the dialout group. Unfortunately pyserial's SerialException doesn't provide errno yet, so the message isn't so user friendly: Connecting... could not open port None: [Errno 2] No such file or directory: 'None' I've filled a bug report with patch to pyserial. Together with this I've realised, there is unnecessary UTF8 decoding of the output. When user has UTF-8 locale, there was an exception when printing the exception to the output (almost an exception inception). So I have dropped it, but feel free to add it back, if I broke anything else. --- pronterface.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/pronterface.py b/pronterface.py index 476ffb9..c13b8f7 100755 --- a/pronterface.py +++ b/pronterface.py @@ -28,6 +28,7 @@ except: import sys, glob, time, datetime, threading, traceback, cStringIO, subprocess from printrun.pronterface_widgets import * +from serial import SerialException StringIO = cStringIO @@ -72,7 +73,7 @@ class Tee(object): self.target(data) except: pass - self.stdout.write(data.encode("utf-8")) + self.stdout.write(data) def flush(self): self.stdout.flush() @@ -1420,7 +1421,19 @@ class PronterWindow(MainWindow, pronsole.pronsole): self.paused = 0 if self.sdprinting: self.p.send_now("M26 S0") - self.p.connect(port, baud) + try: + self.p.connect(port, baud) + except SerialException as e: + # Currently, there is no errno, but it should be there in the future + if e.errno == 2: + print _("Error: You are trying to connect to a non-exisiting port.") + elif e.errno == 8: + print _("Error: You don't have permission to open %s.") % port + print _("You might need to add yourself to the dialout group.") + else: + print e + # Kill the thread anyway + raise self.statuscheck = True if port != self.settings.port: self.set("port", port) From ee386e00919210991775550ff2f0a23887f042f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 23 Jan 2013 16:55:38 +0100 Subject: [PATCH 6/8] Adding UTF-8 decoding back --- pronterface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pronterface.py b/pronterface.py index c13b8f7..87a18a3 100755 --- a/pronterface.py +++ b/pronterface.py @@ -73,7 +73,7 @@ class Tee(object): self.target(data) except: pass - self.stdout.write(data) + self.stdout.write(data.encode("utf-8")) def flush(self): self.stdout.flush() From 064974b7336f02856fd5929eff63a6781892071b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 23 Jan 2013 17:11:08 +0100 Subject: [PATCH 7/8] Handle UTF encoding better --- pronterface.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pronterface.py b/pronterface.py index 87a18a3..add45e1 100755 --- a/pronterface.py +++ b/pronterface.py @@ -73,7 +73,11 @@ class Tee(object): self.target(data) except: pass - self.stdout.write(data.encode("utf-8")) + try: + data = data.encode("utf-8") + except: + pass + self.stdout.write(data) def flush(self): self.stdout.flush() From 354bfb090fefa9577c36cf8fbb1127e0aaf6f3a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 23 Jan 2013 17:12:01 +0100 Subject: [PATCH 8/8] Do not rise, but end the scope --- pronterface.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pronterface.py b/pronterface.py index add45e1..89536eb 100755 --- a/pronterface.py +++ b/pronterface.py @@ -1436,8 +1436,8 @@ class PronterWindow(MainWindow, pronsole.pronsole): print _("You might need to add yourself to the dialout group.") else: print e - # Kill the thread anyway - raise + # Kill the scope anyway + return self.statuscheck = True if port != self.settings.port: self.set("port", port)