|
From: Gustavo J. A. M. C. <gu...@us...> - 2002-04-14 17:34:05
|
Update of /cvsroot/numexp/gnumexp/src/xygraph
In directory usw-pr-cvs1:/tmp/cvs-serv20316
Modified Files:
numexp-xygraph
Log Message:
Wrap xygraph as a Bonobo::Control.
Index: numexp-xygraph
===================================================================
RCS file: /cvsroot/numexp/gnumexp/src/xygraph/numexp-xygraph,v
retrieving revision 1.1
retrieving revision 1.2
diff -U4 -r1.1 -r1.2
--- numexp-xygraph 27 Mar 2002 12:01:55 -0000 1.1
+++ numexp-xygraph 14 Apr 2002 17:34:03 -0000 1.2
@@ -1,9 +1,48 @@
#! /usr/bin/env python
-import Numexp_XYGraph as xy
+from Numexp_XYGraph import *
+import bonobo, bonobo.ui, Bonobo, Numexp
+EXECUTABLE_NAME = 'numexp-xygraph'
+VERSION = '0.0.1'
+FACTORY_IID = 'OAFIID:Numexp_XYGraphFactory'
+CONTROL_IID = 'OAFIID:Numexp_XYGraph'
+#DATA_DIR = '/opt/gnome/share'
+class XYGraphControl(bonobo.ui.Control):
+ def __init__(self):
+ self.xygraph = xygraph = XYGraphView()
+ lineattr = LineAttr(color=Color(0, 0, 0), thickness=.2, mode=Linemode.SOLID)
+ func = Function(lineattr, "Test function", "sin(x)+4", 'x')
+ func2 = Function(lineattr, "Test function", "cos(x)+4", 'x')
+ xygraph.plot_area.add_plot_object(func)
+ xygraph.plot_area.add_plot_object(func2)
+ bonobo.ui.Control.__init__(self, xygraph.get_toplevel_widget())
+ self.connect('activate', self.sample_merge_bonobo_items_cb)
+
+
+ def sample_merge_bonobo_items_cb(self, control, state):
+ print sample_merge_bonobo_items_cb
+
+
+def create_function(generic_factory, iid):
+ print "create_function: iid=" + iid
+ if iid == 'OAFIID:Numexp_XYGraph':
+ return XYGraphControl()
+
+
+bonobo.activate()
+
+## At the time of this writing, the bonobo python bindings were
+## incomplete, so this didn't work.
+#bonobo.bonobo_generic_factory_main(FACTORY_IID, create_function)
+
+
+factory = bonobo.GenericFactory(FACTORY_IID, create_function)
+bonobo.running_context_auto_exit_unref(factory)
+print "XYGraph Control server activated"
+bonobo.main()
|