~ubuntu-branches/ubuntu/intrepid/plplot/intrepid

« back to all changes in this revision

Viewing changes to bindings/gnome2/python/cplplotcanvas.override

  • Committer: Bazaar Package Importer
  • Author(s): Rafael Laboissiere
  • Date: 2006-11-04 10:19:34 UTC
  • mfrom: (2.1.8 edgy)
  • Revision ID: james.westby@ubuntu.com-20061104101934-mlirvdg4gpwi6i5q
Tags: 5.6.1-10
* Orphaning the package
* debian/control: Changed the maintainer to the Debian QA Group

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C; c-basic-offset: 4 -*- */
 
2
 
 
3
/* cplplotcanvas.override - C python wrapper override for plplotcanvas
 
4
 
 
5
  Copyright (C) 2004, 2005 Thomas J. Duck
 
6
  All rights reserved.
 
7
 
 
8
  Thomas J. Duck <tom.duck@dal.ca>
 
9
  Department of Physics and Atmospheric Science,
 
10
  Dalhousie University, Halifax, Nova Scotia, Canada, B3H 3J5
 
11
 
 
12
 
 
13
NOTICE
 
14
 
 
15
  This library is free software; you can redistribute it and/or
 
16
  modify it under the terms of the GNU Lesser General Public
 
17
  License as published by the Free Software Foundation; either
 
18
  version 2.1 of the License, or (at your option) any later version.
 
19
 
 
20
  This library is distributed in the hope that it will be useful,
 
21
  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
22
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
23
  Lesser General Public License for more details.
 
24
 
 
25
  You should have received a copy of the GNU Lesser General Public
 
26
  License along with this library; if not, write to the Free Software
 
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
 
28
  USA 
 
29
*/
 
30
 
 
31
/*-------------------------------------------------------------------------*/
 
32
/*                                                                         */
 
33
/* NOTES                                                                   */
 
34
/*                                                                         */
 
35
/* ignore-glob section:                                                    */
 
36
/*                                                                         */
 
37
/*   Methods in the plplot common library that can be wrapped have         */
 
38
/*   been removed from the list.                                           */
 
39
/*                                                                         */
 
40
/*   Plplot methods with constant arguments are wrapped automatically.     */
 
41
/*                                                                         */
 
42
/*   Commonly-used routines with non-constant arguments are wrapped using  */
 
43
/*   overrides, below, if required for speed.                              */
 
44
/*                                                                         */
 
45
/*   Routines that cannot be automatically wrapped are called from python  */
 
46
/*   code in plplotcanvas.Canvas using __getattr__.                        */
 
47
/*                                                                         */
 
48
/*-------------------------------------------------------------------------*/
 
49
 
 
50
%%
 
51
headers
 
52
#include <Python.h>        
 
53
       
 
54
#include "pygobject.h"
 
55
#include "plplot.h"
 
56
#include "plplotcanvas.h"
 
57
 
 
58
#define PY_ARRAY_UNIQUE_SYMBOL plplotcanvasapi
 
59
#include "Numeric/arrayobject.h"
 
60
%%
 
61
%%modulename c_plplotcanvas
 
62
%%
 
63
import gnome.canvas.Canvas as PyGnomeCanvas_Type
 
64
%%
 
65
ignore-glob
 
66
  *_get_type
 
67
  plplot_canvas_arrows
 
68
  plplot_canvas_vect
 
69
  plplot_canvas_svect
 
70
  plplot_canvas_axes
 
71
  plplot_canvas_bin
 
72
  plplot_canvas_box
 
73
  plplot_canvas_box3
 
74
  plplot_canvas_calc_world
 
75
  plplot_canvas_cont
 
76
  plplot_canvas_fcont
 
77
  plplot_canvas_did2pc
 
78
  plplot_canvas_dip2dc
 
79
  plplot_canvas_errx
 
80
  plplot_canvas_erry
 
81
  plplot_canvas_fill
 
82
  plplot_canvas_fill3
 
83
  plplot_canvas_gchr
 
84
  plplot_canvas_gcol0
 
85
  plplot_canvas_gcolbg
 
86
  plplot_canvas_gcompression
 
87
  plplot_canvas_gdev
 
88
  plplot_canvas_gdidev
 
89
  plplot_canvas_gdiori
 
90
  plplot_canvas_gdiplt
 
91
  plplot_canvas_glevel
 
92
  plplot_canvas_gpage
 
93
  plplot_canvas_griddata
 
94
  plplot_canvas_gspa
 
95
  plplot_canvas_gver
 
96
  plplot_canvas_gvpd
 
97
  plplot_canvas_gvpw
 
98
  plplot_canvas_gxax
 
99
  plplot_canvas_gyax
 
100
  plplot_canvas_gzax
 
101
  plplot_canvas_hist
 
102
  plplot_canvas_lab
 
103
  plplot_canvas_line3
 
104
  plplot_canvas_map
 
105
  plplot_canvas_meridians
 
106
  plplot_canvas_mesh
 
107
  plplot_canvas_meshc
 
108
  plplot_canvas_plmtex
 
109
  plplot_canvas_plot3d
 
110
  plplot_canvas_plot3dc
 
111
  plplot_canvas_plot3dcl
 
112
  plplot_canvas_pat
 
113
  plplot_canvas_poin
 
114
  plplot_canvas_poin3
 
115
  plplot_canvas_poly3
 
116
  plplot_canvas_ptex
 
117
  plplot_canvas_scmap0
 
118
  plplot_canvas_gcmap0n
 
119
  plplot_canvas_scmap1
 
120
  plplot_canvas_scmap1l
 
121
  plplot_canvas_shade
 
122
  plplot_canvas_shade1
 
123
  plplot_canvas_shades
 
124
  plplot_canvas_fshade
 
125
  plplot_canvas_image
 
126
  plplot_canvas_styl
 
127
  plplot_canvas_surf3d
 
128
  plplot_canvas_surf3dl
 
129
  plplot_canvas_sym
 
130
  plplot_canvas_xormod
 
131
%%
 
132
override plplot_canvas_new args, kwargs
 
133
static int
 
134
_wrap_plplot_canvas_new(PyGObject *self, PyObject *args, PyObject *kwargs)
 
135
{
 
136
    GType obj_type = pyg_type_from_object((PyObject *) self);
 
137
 
 
138
    self->obj = g_object_new(obj_type, "aa", TRUE, NULL);
 
139
    if (!self->obj) {
 
140
        PyErr_SetString(PyExc_RuntimeError, "could not create %(typename)s object");
 
141
        return -1;
 
142
    }
 
143
 
 
144
    pygobject_register_wrapper((PyObject *)self);
 
145
    return 0;
 
146
}
 
147
%%
 
148
override plplot_canvas_line args
 
149
static PyObject* _wrap_plplot_canvas_line(PyGObject *self,
 
150
                                          PyObject *args)
 
151
{
 
152
    PyObject *x_,*y_;
 
153
    PyArrayObject *x, *y;
 
154
 
 
155
    if(!PyArg_UnpackTuple(args,"ref",2,2,&x_,&y_))
 
156
        return NULL;
 
157
 
 
158
    if(!PyArray_Check(x_)) return NULL;
 
159
    if( (x = (PyArrayObject *)
 
160
         PyArray_ContiguousFromObject(x_, PyArray_DOUBLE, 1, 1)) == NULL)
 
161
        return NULL;
 
162
 
 
163
    if(!PyArray_Check(y_)) return NULL;
 
164
    if( (y = (PyArrayObject *)
 
165
         PyArray_ContiguousFromObject(y_, PyArray_DOUBLE, 1, 1)) == NULL)
 
166
        return NULL;
 
167
 
 
168
    plplot_canvas_line(PLPLOT_CANVAS(self->obj),
 
169
                       x->dimensions[0],(double*)x->data,(double*)y->data);
 
170
 
 
171
    return Py_BuildValue("");
 
172
}