diff options
Diffstat (limited to 'thirdparty/cairoplot-trunk/trunk/cairoplot/handlers')
9 files changed, 0 insertions, 162 deletions
diff --git a/thirdparty/cairoplot-trunk/trunk/cairoplot/handlers/__init__.py b/thirdparty/cairoplot-trunk/trunk/cairoplot/handlers/__init__.py deleted file mode 100755 index 364fb90..0000000 --- a/thirdparty/cairoplot-trunk/trunk/cairoplot/handlers/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -__all__ = ["handler", "png", "pdf", "ps", "svg", "vector"] - -# default handlers -from .handler import Handler -from .png import PNGHandler -from .pdf import PDFHandler -from .ps import PSHandler -from .svg import SVGHandler -from .vector import VectorHandler - diff --git a/thirdparty/cairoplot-trunk/trunk/cairoplot/handlers/fixedsize.py b/thirdparty/cairoplot-trunk/trunk/cairoplot/handlers/fixedsize.py deleted file mode 100755 index 3c25fdf..0000000 --- a/thirdparty/cairoplot-trunk/trunk/cairoplot/handlers/fixedsize.py +++ /dev/null @@ -1,30 +0,0 @@ - -import cairo -import cairoplot -from .handler import Handler as _Handler - -class FixedSizeHandler(_Handler): - """Base class for handlers with a fixed size.""" - - def __init__(self, width, height): - """Create with fixed width and height.""" - self.dimensions = {} - self.dimensions[cairoplot.HORZ] = width - self.dimensions[cairoplot.VERT] = height - - # sub-classes must create a surface - self.surface = None - - def prepare(self, plot): - """Prepare plot to render by setting its dimensions.""" - _Handler.prepare(self, plot) - plot.dimensions = self.dimensions - plot.context = cairo.Context(self.surface) - - def commit(self, plot): - """Commit the plot (to a file).""" - _Handler.commit(self, plot) - - # since pngs are different from other fixed size handlers, - # sub-classes are in charge of actual file writing - diff --git a/thirdparty/cairoplot-trunk/trunk/cairoplot/handlers/gtk.py b/thirdparty/cairoplot-trunk/trunk/cairoplot/handlers/gtk.py deleted file mode 100755 index 897c86f..0000000 --- a/thirdparty/cairoplot-trunk/trunk/cairoplot/handlers/gtk.py +++ /dev/null @@ -1,39 +0,0 @@ -from __future__ import absolute_import - -import gtk -import cairo -import cairoplot -from .handler import Handler as _Handler - -class GTKHandler(_Handler, gtk.DrawingArea): - """Handler to create plots that output to vector files.""" - - def __init__(self, *args, **kwargs): - """Create Handler for arbitrary surfaces.""" - _Handler.__init__(self) - gtk.DrawingArea.__init__(self) - - # users of this class must set plot manually - self.plot = None - self.context = None - - # connect events for resizing/redrawing - self.connect("expose_event", self.on_expose_event) - - def on_expose_event(self, widget, data): - """Redraws plot if need be.""" - - self.context = widget.window.cairo_create() - if (self.plot is not None): - self.plot.render() - - def prepare(self, plot): - """Update plot's size and context with custom widget.""" - _Handler.prepare(self, plot) - self.plot = plot - plot.context = self.context - - allocation = self.get_allocation() - plot.dimensions[cairoplot.HORZ] = allocation.width - plot.dimensions[cairoplot.VERT] = allocation.height - diff --git a/thirdparty/cairoplot-trunk/trunk/cairoplot/handlers/handler.py b/thirdparty/cairoplot-trunk/trunk/cairoplot/handlers/handler.py deleted file mode 100755 index 0ec54a7..0000000 --- a/thirdparty/cairoplot-trunk/trunk/cairoplot/handlers/handler.py +++ /dev/null @@ -1,11 +0,0 @@ - -class Handler(object): - """Base class for all handlers.""" - - def prepare(self, plot): - pass - - def commit(self, plot): - """All handlers need to finalize the cairo context.""" - plot.context.show_page() - diff --git a/thirdparty/cairoplot-trunk/trunk/cairoplot/handlers/pdf.py b/thirdparty/cairoplot-trunk/trunk/cairoplot/handlers/pdf.py deleted file mode 100755 index 30838c7..0000000 --- a/thirdparty/cairoplot-trunk/trunk/cairoplot/handlers/pdf.py +++ /dev/null @@ -1,12 +0,0 @@ - -import cairo -from .vector import VectorHandler as _VectorHandler - -class PDFHandler(_VectorHandler): - """Handler to create plots that output to pdf files.""" - - def __init__(self, filename, width, height): - """Creates a surface to be used by Cairo.""" - _VectorHandler.__init__(self, None, width, height) - self.surface = cairo.PDFSurface(filename, width, height) - diff --git a/thirdparty/cairoplot-trunk/trunk/cairoplot/handlers/png.py b/thirdparty/cairoplot-trunk/trunk/cairoplot/handlers/png.py deleted file mode 100755 index 6cce422..0000000 --- a/thirdparty/cairoplot-trunk/trunk/cairoplot/handlers/png.py +++ /dev/null @@ -1,19 +0,0 @@ - -import cairo - -from .fixedsize import FixedSizeHandler as _FixedSizeHandler - -class PNGHandler(_FixedSizeHandler): - """Handler to create plots that output to png files.""" - - def __init__(self, filename, width, height): - """Creates a surface to be used by Cairo.""" - _FixedSizeHandler.__init__(self, width, height) - self.filename = filename - self.surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height) - - def commit(self, plot): - """Writes plot to file.""" - _FixedSizeHandler.commit(self, plot) - self.surface.write_to_png(self.filename) - diff --git a/thirdparty/cairoplot-trunk/trunk/cairoplot/handlers/ps.py b/thirdparty/cairoplot-trunk/trunk/cairoplot/handlers/ps.py deleted file mode 100755 index 7a77781..0000000 --- a/thirdparty/cairoplot-trunk/trunk/cairoplot/handlers/ps.py +++ /dev/null @@ -1,12 +0,0 @@ - -import cairo -from .vector import VectorHandler as _VectorHandler - -class PSHandler(_VectorHandler): - """Handler to create plots that output to PostScript files.""" - - def __init__(self, filename, width, height): - """Creates a surface to be used by Cairo.""" - _VectorHandler.__init__(self, None, width, height) - self.surface = cairo.PSSurface(filename, width, height) - diff --git a/thirdparty/cairoplot-trunk/trunk/cairoplot/handlers/svg.py b/thirdparty/cairoplot-trunk/trunk/cairoplot/handlers/svg.py deleted file mode 100755 index 032fdc8..0000000 --- a/thirdparty/cairoplot-trunk/trunk/cairoplot/handlers/svg.py +++ /dev/null @@ -1,12 +0,0 @@ - -import cairo -from .vector import VectorHandler as _VectorHandler - -class SVGHandler(_VectorHandler): - """Handler to create plots that output to svg files.""" - - def __init__(self, filename, width, height): - """Creates a surface to be used by Cairo.""" - _VectorHandler.__init__(self, None, width, height) - self.surface = cairo.SVGSurface(filename, width, height) - diff --git a/thirdparty/cairoplot-trunk/trunk/cairoplot/handlers/vector.py b/thirdparty/cairoplot-trunk/trunk/cairoplot/handlers/vector.py deleted file mode 100755 index 0c4d4bc..0000000 --- a/thirdparty/cairoplot-trunk/trunk/cairoplot/handlers/vector.py +++ /dev/null @@ -1,17 +0,0 @@ - -import cairo -from .fixedsize import FixedSizeHandler as _FixedSizeHandler - -class VectorHandler(_FixedSizeHandler): - """Handler to create plots that output to vector files.""" - - def __init__(self, surface, *args, **kwargs): - """Create Handler for arbitrary surfaces.""" - _FixedSizeHandler.__init__(self, *args, **kwargs) - self.surface = surface - - def commit(self, plot): - """Writes plot to file.""" - _FixedSizeHandler.commit(self, plot) - self.surface.finish() - |