Thu, 21 Aug 2008 19:52:54 +0200
Small fixes to HPGL plotter (be a little bit more robust)
pygpibtoolkit/plotter/hpgl_parser.py | file | annotate | diff | comparison | revisions | |
pygpibtoolkit/plotter/hpgl_qt.py | file | annotate | diff | comparison | revisions |
--- a/pygpibtoolkit/plotter/hpgl_parser.py Thu Aug 21 19:52:02 2008 +0200 +++ b/pygpibtoolkit/plotter/hpgl_parser.py Thu Aug 21 19:52:54 2008 +0200 @@ -40,7 +40,11 @@ else: cmd = data[self.idx: self.idx+2].upper() self.idx += 2 - getattr(self, cmd)() + try: + getattr(self, cmd)() + except AttributeError: + print "WARNING: received unknown command %s"%repr(cmd) + while self.idx<len(data) and data[self.idx] in [';','\n','\r', '\a', ' ']: self.idx += 1
--- a/pygpibtoolkit/plotter/hpgl_qt.py Thu Aug 21 19:52:02 2008 +0200 +++ b/pygpibtoolkit/plotter/hpgl_qt.py Thu Aug 21 19:52:54 2008 +0200 @@ -89,7 +89,7 @@ def SP(self): HPGLParser.SP(self) - color = self.pen_colors[self.pen] + color = self.pen_colors[self.pen % len(self.pen_colors)] if isinstance(color, tuple): color = QtGui.QColor(*color) else: