Thread: [Python-gtkextra-commits] CVS: python-gtkextra2/gtkextra gtkextra-addons.defs,1.3,1.4 gtkextra-types
Status: Beta
Brought to you by:
treeves
From: <pyt...@li...> - 2003-01-02 22:01:08
|
Update of /cvsroot/python-gtkextra/python-gtkextra2/gtkextra In directory sc8-pr-cvs1:/tmp/cvs-serv32495/gtkextra Modified Files: gtkextra-addons.defs gtkextra-types.defs gtkextra.defs gtkextra.override Log Message: lots Index: gtkextra-addons.defs =================================================================== RCS file: /cvsroot/python-gtkextra/python-gtkextra2/gtkextra/gtkextra-addons.defs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** gtkextra-addons.defs 24 Dec 2002 18:49:10 -0000 1.3 --- gtkextra-addons.defs 2 Jan 2003 22:00:53 -0000 1.4 *************** *** 25,26 **** --- 25,37 ---- + (define-function gtk_sheet_range_new + (is-constructor-of "GtkSheetRange") + (c-name "gtk_sheet_range_new") + (return-type "GtkSheetRange*") + (parameters + '("gint" "row0" (default "0")) + '("gint" "col0" (default "0")) + '("gint" "rowi" (default "0")) + '("gint" "coli" (default "0")) + ) + ) Index: gtkextra-types.defs =================================================================== RCS file: /cvsroot/python-gtkextra/python-gtkextra2/gtkextra/gtkextra-types.defs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** gtkextra-types.defs 31 Dec 2002 18:04:19 -0000 1.5 --- gtkextra-types.defs 2 Jan 2003 22:00:54 -0000 1.6 *************** *** 2,5 **** --- 2,8 ---- ; object definitions ... + ; As for fields, I'm not sure which are safe to expose. + ; I also have no scrubbed which are set by functions. + ; Somebody can help me here. (define-object CharSelection *************** *** 30,33 **** --- 33,43 ---- (c-name "GtkComboBox") (gtype-id "GTK_TYPE_COMBO_BOX") + (fields + '("GtkWidget*" "button") + '("GtkWidget*" "arrow") + '("GtkWidget*" "popup") + '("GtkWidget*" "popwin") + '("GtkWidget*" "frame") + ) ) *************** *** 44,47 **** --- 54,65 ---- (c-name "GtkBorderCombo") (gtype-id "GTK_TYPE_BORDER_COMBO") + (fields + '("gint" "nrows") + '("gint" "ncols") + '("gint" "row") + '("gint" "column") + ; '("GtkWidget***" "button") + '("GtkWidget*" "table") + ) ) *************** *** 51,54 **** --- 69,84 ---- (c-name "GtkDirTree") (gtype-id "GTK_TYPE_DIR_TREE") + (fields + '("gchar*" "local_hostname") + '("gboolean" "show_hidden") + '("GdkPixmap*" "my_pc") + '("GdkPixmap*" "folder") + '("GdkPixmap*" "ofolder") + '("GdkPixmap*" "dennied") + '("GdkBitmap*" "my_pc_mask") + '("GdkBitmap*" "folder_mask") + '("GdkBitmap*" "ofolder_mask") + '("GdkBitmap*" "dennied_mask") + ) ) *************** *** 58,68 **** (c-name "GtkFontCombo") (gtype-id "GTK_TYPE_FONT_COMBO") ) ! (define-object IconFileSel (in-module "Gtk") (parent "GtkWindow") (c-name "GtkIconFileSel") (gtype-id "GTK_TYPE_ICON_FILE_SEL") ) --- 88,115 ---- (c-name "GtkFontCombo") (gtype-id "GTK_TYPE_FONT_COMBO") + (fields + '("GtkWidget*" "name_combo") + '("GtkWidget*" "size_combo") + '("GtkWidget*" "bold_button") + '("GtkWidget*" "italic_button") + ) ) ! (define-object IconFileSelection (in-module "Gtk") (parent "GtkWindow") (c-name "GtkIconFileSel") (gtype-id "GTK_TYPE_ICON_FILE_SEL") + (fields + '("GtkWidget*" "path_label") + '("GtkWidget*" "dir_tree") + '("GtkWidget*" "file_list") + '("GtkWidget*" "history_combo") + '("GtkWidget*" "file_entry") + '("GtkWidget*" "filter_entry") + '("GtkWidget*" "ok_button") + '("GtkWidget*" "cancel_button") + '("GtkWidget*" "action_area") + ) ) *************** *** 72,75 **** --- 119,125 ---- (c-name "GtkIconList") (gtype-id "GTK_TYPE_ICON_LIST") + (fields + '("gint" "num_icons") + ) ) *************** *** 95,98 **** --- 145,149 ---- (fields '("guint16" "flags") + '("GdkPixmap*" "pixmap") ) ) *************** *** 294,297 **** --- 345,360 ---- '("GtkWidget*" "entry") ;'("gpointer" "link") + ) + ) + + (define-boxed SheetRange + (in-module "Gtk") + (c-name "GtkSheetRange") + (gtype-id "GTK_TYPE_SHEET_RANGE") + (fields + '("gint" "row0") + '("gint" "col0") + '("gint" "rowi") + '("gint" "coli") ) ) Index: gtkextra.defs =================================================================== RCS file: /cvsroot/python-gtkextra/python-gtkextra2/gtkextra/gtkextra.defs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** gtkextra.defs 31 Dec 2002 18:04:19 -0000 1.7 --- gtkextra.defs 2 Jan 2003 22:00:55 -0000 1.8 *************** *** 5,8 **** --- 5,11 ---- ;; python ~/gnome-cvs/gnome-python/pygtk/codegen/mergedefs.py gtkextra_.defs gtkextra.defs > gtkextra_merged.defs ;; Then redo include's. + ;; + ;; Another thing is null-ok's on return of points. + ;; I have added that to many functions, but may have missed some that should have it. (include "gtkextra-types.defs") *************** *** 178,182 **** [...1106 lines suppressed...] '("GtkWidget*" "widget") --- 5900,5904 ---- (of-object "GtkSheet") (c-name "gtk_sheet_put") ! (return-type "GtkSheetChild*" (null-ok)) (parameters '("GtkWidget*" "widget") *************** *** 5956,5960 **** (of-object "GtkSheet") (c-name "gtk_sheet_get_child_at") ! (return-type "GtkSheetChild*") (parameters '("gint" "row") --- 5959,5963 ---- (of-object "GtkSheet") (c-name "gtk_sheet_get_child_at") ! (return-type "GtkSheetChild*" (null-ok)) (parameters '("gint" "row") Index: gtkextra.override =================================================================== RCS file: /cvsroot/python-gtkextra/python-gtkextra2/gtkextra/gtkextra.override,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** gtkextra.override 31 Dec 2002 18:04:19 -0000 1.8 --- gtkextra.override 2 Jan 2003 22:00:58 -0000 1.9 *************** *** 165,168 **** --- 165,181 ---- } + static GtkSheetRange* + gtk_sheet_range_new ( gint row0, gint col0, gint rowi, gint coli) + { + GtkSheetRange *p = g_new (GtkSheetRange, 1); + if (p) { + p->row0 = row0; + p->col0 = col0; + p->rowi = rowi; + p->coli = coli; + } + return p; + } + static void gtk_plot_draw_text_PY (GtkPlot *plot, GtkPlotText *text) *************** *** 960,963 **** --- 973,1091 ---- if (!self->obj) { PyErr_SetString(PyExc_RuntimeError, "could not create GtkPlotSurface object"); + return -1; + } + pygobject_register_wrapper((PyObject *)self); + return 0; + } + %% + override gtk_plot_csurface_new kwargs + static int + _wrap_gtk_plot_csurface_new(PyGObject *self, PyObject *args, PyObject *kwargs) + { + static char *kwlist[] = { "function", NULL }; + PyObject *function = NULL; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:GtkPlotCSurface.__init__", kwlist, &function)) + return -1; + + if (!function) + self->obj = (GObject *)gtk_plot_csurface_new(); + else { + if (!PyCallable_Check(function)) { + PyErr_SetString(PyExc_RuntimeError, "function argument must be callable"); + return -1; + } + self->obj = (GObject *)gtk_plot_csurface_new_function(pygtkextra_plot_function_3D); + if(self->obj) + pygtkextra_set_data(self, function_key, function); + } + if (!self->obj) { + PyErr_SetString(PyExc_RuntimeError, "could not create GtkPlotCSurface object"); + return -1; + } + pygobject_register_wrapper((PyObject *)self); + return 0; + } + %% + override gtk_plot_csurface_construct_function kwargs + static PyObject * + _wrap_gtk_plot_csurface_construct_function(PyGObject *self, PyObject *args, PyObject *kwargs) + { + static char *kwlist[] = { "function", NULL }; + PyObject *function; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:GtkPlotCSurface.construct_function", kwlist, &function)) + return NULL; + + if (!PyCallable_Check(function)) { + PyErr_SetString(PyExc_RuntimeError, "function argument must be callable"); + return NULL; + } + + gtk_plot_csurface_construct_function(GTK_PLOT_CSURFACE(self->obj), pygtkextra_plot_function_3D); + pygtkextra_set_data(self, function_key, function); + + Py_INCREF(Py_None); + return Py_None; + } + %% + override gtk_color_combo_new kwargs + static int + _wrap_gtk_color_combo_new(PyGObject *self, PyObject *args, PyObject *kwargs) + { + static char *kwlist1[] = { NULL }; + static char *kwlist2[] = { "nrows", "ncols", "colors", NULL }; + + if (PyArg_ParseTupleAndKeywords(args, kwargs, ":GtkColorCombo.__init__", kwlist1)) { + self->obj = (GObject *)gtk_color_combo_new(); + } + else { + int nrows, ncols; + int len, i; + PyObject *py_colors; + GdkColor **colors = NULL; + + PyErr_Clear(); + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "iiO:GtkColorCombo.__init__", kwlist2, + &nrows, &ncols, &py_colors)) + return -1; + + if (!PySequence_Check(py_colors)) { + PyErr_SetString(PyExc_TypeError, "colors must be a sequence of GdkColor"); + return -1; + } + + len = PySequence_Length(py_colors); + if ( len != nrows * ncols) { + PyErr_SetString(PyExc_TypeError, "colors length is not nrows * ncols "); + return -1; + } + + colors = (GdkColor**) g_new(GdkColor*, len); + if (!colors) { + PyErr_SetString(PyExc_RuntimeError, "g_new failed"); + return -1; + } + + for (i = 0; i < len; ++i) { + PyObject *py_color; + + py_color = PySequence_GetItem(py_colors, i); + if (pyg_boxed_check(py_color, GDK_TYPE_COLOR)) { + colors[i] = (GdkColor*) pyg_boxed_get(py_color, GdkColor); + Py_DECREF(py_color); + } + else { + PyErr_SetString(PyExc_TypeError, "colors items should be a GdkColor"); + g_free(colors); + Py_DECREF(py_color); + return -1; + } + } + self->obj = (GObject *)gtk_color_combo_new_with_values(nrows, ncols, *colors); + g_free(colors); + } + if (!self->obj) { + PyErr_SetString(PyExc_RuntimeError, "could not create GtkColorCombo object"); return -1; } |