hello,
I sometimes wonder if I'm the only stupid guy,
that while developing platform independent applications,
again makes the mistake of using a platform dependent component.
I guess it should be possible to wrap such a component,
and replace it with the closest look-alike,
and at the same time give a warning in the OS were the orginal component is available.
As I don't want to touch the default libraries,
and as I don't know how to replace something like "os.lib.iewin",
I've the following temporary solution:
Instead of :
import wx.lib.iewin as iewin
I use :
import my_iewin as iewin
Now in my_iewin is a wrapper and also the desired warning (see code below).
This is not a perfect solution,
and probably I still have to add a number of dummy methods to _My_IEHtmlWindow
but it works, at least for me.
The only thing I'm going to add is to instruct my IDE to warn me if "wx.lib.iewin" is used outside my_iewin.
Probably there are much more OS-dependent modules,
so I'll use the same approach for these,
unless there are better solutions.
Are there better ways to solve this problem ?
BTW, how is webkit going ?
thanks,
Stef Mientki
import wx
import wx.html
import wxp_widgets
class _My_IEHtmlWindow ( wx.html.HtmlWindow ) :
def LoadUrl ( self, URL ) :
self.LoadPage ( URL )
if wx.Platform == '__WXMSW__':
print '***** WARNING *****'
print ' wx.lib.iewin.IEHtmlWindow is only supported under MS-Windows'
import wx.lib.iewin as iewin
IEHtmlWindow = iewin.IEHtmlWindow
else :
IEHtmlWindow = _My_IEHtmlWindow