Re: Python and Bonobo
- From: "Nickolay V. Shmyrev" <nshmyrev yandex ru>
- To: Gnome Development <gnome-devel-list gnome org>
- Cc: bouda1 wanadoo fr
- Subject: Re: Python and Bonobo
- Date: Wed, 13 Oct 2004 21:46:05 +0400
And the same could be implemented in python, but requires gnome-python
2.6
import pygtk
import gtk
import bonobo
import bonobo.ui
import Bonobo__POA, CORBA, sys
orb = CORBA.ORB_init(sys.argv)
class SimpleContainer (Bonobo__POA.UIContainer, bonobo.UnknownBaseImpl):
def __init__(self):
self._comp = None
bonobo.UnknownBaseImpl.__init__(self)
def registerComponent (self, name, c):
self._comp = c
def getComponent (self):
return self._comp
def zoom_callback(button, cwidget):
obj = cwidget.get_objref().queryInterface
("IDL:Bonobo/Zoomable:1.0")
obj.zoomIn()
def prev_callback(button, container):
container.getComponent().execVerb("GoPagePrev")
def next_callback(button, container):
container.getComponent().execVerb("GoPageNext")
win=gtk.Window()
vbox = gtk.VBox (False,6)
hbox = gtk.HBox (False,6)
container = SimpleContainer ()
cwidget = bonobo.ui.Widget("OAFIID:GNOME_PDF_Control",
container.queryInterface("IDL:Bonobo/UIContainer:1.0"))
prev = gtk.Button(stock=gtk.STOCK_GO_BACK)
next = gtk.Button(stock=gtk.STOCK_GO_FORWARD)
zoom = gtk.Button(stock=gtk.STOCK_ZOOM_IN)
zoom.connect("clicked", zoom_callback, cwidget)
next.connect("clicked", next_callback, container)
prev.connect("clicked", prev_callback, container)
win.add(vbox)
vbox.pack_start (cwidget, True, True, 0)
vbox.pack_start (hbox, False, False, 0)
hbox.add(prev)
hbox.add(next)
hbox.add(zoom)
win.show_all()
cwidget.get_control_frame().control_activate()
obj = cwidget.get_objref().queryInterface("IDL:Bonobo/PersistFile:1.0")
obj.load("file:/home/shmyrev/test.pdf")
gtk.main()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]