Hi all!

Firstly, sorry for so long time without any feedback, I was working in other 
projects :$ but now I've changed the webbrowser widget, before it was using 
gtkmozembbed, now is using webkit (pywebkitgtk[1]) and is GtkWebkit[1] must be 
installed too

I've created a local branch of openobject-client-4.2

And I've applied my patches to add webbrowser widget

[1] http://code.google.com/p/pywebkitgtk
[2] http://live.gnome.org/WebKitGtk

Here is the patch:


--- old/bin/widget/view/form_gtk/parser.py   2008-01-29 
15:27:34 +0000
+++ new/bin/widget/view/form_gtk/parser.py   2008-08-03 
16:26:14 +0000
@@ -675,6 +675,7 @@
 import picture
 import url
 import image
+import webbrowser
 
 
 widgets_type = {
@@ -703,6 +704,7 @@
    'callto' : (url.callto, 1, False, False),
    'sip' : (url.sip, 1, False, False),
    'image' : (image.image_wid, 1, False, False),
+   'webbrowser': (webbrowser.webbrowser, 1, False, 
False),
 }
 
 # vim:noexpandtab:

--- old/bin/widget/view/form_gtk/webbrowser.py   1970-01-01 
00:00:00 +0000
+++ new/bin/widget/view/form_gtk/webbrowser.py   2008-08-03 
16:26:14 +0000
@@ -0,0 +1,60 @@
+##############################################################################
+#
+# Copyright (c) 2008 Eduard Carreras i Nadal. All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, 
USA.
+#
+##############################################################################
+
+import interface
+import gtk
+import webkit
+
+
+
+class webbrowser(interface.widget_interface):
+
+   def __init__(self, window, parent, model, 
attrs={}):
+      interface.widget_interface.__init__(self, 
window, parent=parent, attrs=attrs)
+      
+      self._about = 
"""<html><head><title></title></head><body></body></html>"""
+&nbsp; &nbsp;&nbsp; &nbsp;self.widget = gtk.ScrolledWindow&#40;&#41;
+&nbsp; &nbsp;&nbsp; &nbsp;self.widget.props.hscrollbar_policy = 
gtk.POLICY_AUTOMATIC
+&nbsp; &nbsp;&nbsp; &nbsp;self.widget.props.vscrollbar_policy = 
gtk.POLICY_AUTOMATIC
+&nbsp; &nbsp;&nbsp; &nbsp;
+&nbsp; &nbsp;&nbsp; &nbsp;self._browser = webkit.WebView&#40;&#41;
+&nbsp; &nbsp;&nbsp; &nbsp;self.widget.add&#40;self._browser&#41;
+&nbsp; &nbsp;&nbsp; &nbsp;
+&nbsp; &nbsp;&nbsp; &nbsp;self.widget.show_all&#40;&#41;
+
+&nbsp; &nbsp;def display&#40;self, model, model_field&#41;&#58;
+&nbsp; &nbsp;&nbsp; &nbsp;super&#40;webbrowser, self&#41;.display&#40;model, 
model_field&#41;
+&nbsp; &nbsp;&nbsp; &nbsp;if not model_field or not 
model_field.get&#40;model&#41;&#58;
+&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
&nbsp;self._browser.load_string&#40;self._about, "text/html", "utf-8", 
"about&#58;"&#41;
+&nbsp; &nbsp;&nbsp; &nbsp;else&#58;
+&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
&nbsp;self._browser.open&#40;model_field.get&#40;model&#41;&#41;
+&nbsp; &nbsp;
+&nbsp; &nbsp;def destroy&#40;self&#41;&#58;
+&nbsp; &nbsp;&nbsp; &nbsp;pass
+&nbsp; &nbsp;&nbsp; &nbsp;
+&nbsp; &nbsp;def set_value&#40;self, model, model_field&#41;&#58;
+&nbsp; &nbsp;&nbsp; &nbsp;pass


------------------------
Eduard Carreras i Nadal <ecarreras>
GISCE ENGINYERIA S.L.




_______________________________________________
Tinyerp-users mailing list
http://tiny.be/mailman/listinfo/tinyerp-users

Reply via email to