@@ -134,7 +134,16 @@ def start_cef(self, start_url='http://google.com'):
134134 # and the GetViewRect will be called again. This time the render
135135 # handler callbacks will be available, it will work fine from
136136 # this point.
137- self .browser = cefpython .CreateBrowserSync (windowInfo , browserSettings , navigateUrl = "about:blank" )
137+ # --
138+ # Do not use "about:blank" as navigateUrl - this will cause
139+ # the GoBack() and GoForward() methods to not work.
140+ # --
141+ # TODO: get rid of the hard-coded path. Use the __file__ variable
142+ # to get the current directory. Using a path to a non-existent
143+ # local html file seems to not cause any problems, so it can
144+ # stay for a moment.
145+ self .browser = cefpython .CreateBrowserSync (windowInfo , browserSettings ,
146+ navigateUrl = "file:///home/czarek/cefpython/cefpython/cef3/linux/binaries_64bit/empty2.html" )
138147
139148 #set focus
140149 self .browser .SendFocusEvent (True )
@@ -146,7 +155,18 @@ def start_cef(self, start_url='http://google.com'):
146155 #Call WasResized() => force cef to call GetViewRect() and OnPaint afterwards
147156 self .browser .WasResized ()
148157
149- #Load desired start URL
158+ # Load desired start URL
159+ # TODO: let the local html file "empty.html" to finish loading,
160+ # call the LoadUrl() method with a 100ms delay. In the
161+ # empty.html you could add a "Loading.." text, this would
162+ # event useful, user would see some message instead of the
163+ # blank page. Sometimes the lag can cause the website to
164+ # load for a few seconds and user would be seeing only a
165+ # white screen and wonder of what is happening. The other
166+ # solution would be to change the mouse cursor to loading
167+ # state - but this won't work in touch screen devices? As
168+ # there is no cursor there. In wxpython there is the
169+ # wx.CallLater() method, is there anything similar in Kivy?
150170 self .browser .GetMainFrame ().LoadUrl (start_url )
151171
152172 #Clock.schedule_interval(self.press_key, 5)
@@ -214,6 +234,7 @@ def __init__(self, texture, parent):
214234
215235
216236 def OnPaint (self , browser , paintElementType , dirtyRects , buffer , width , height ):
237+ print "OnPaint()"
217238 if paintElementType != cefpython .PET_VIEW :
218239 print "Popups aren't implemented yet"
219240 return
@@ -229,11 +250,14 @@ def OnPaint(self, browser, paintElementType, dirtyRects, buffer, width, height):
229250
230251
231252 def GetViewRect (self , browser , rect ):
253+ print "GetViewRect()"
232254 width , height = self .texture .size
233255 rect .append (0 )
234256 rect .append (0 )
235257 rect .append (width )
236258 rect .append (height )
259+ print width
260+ print height
237261 return True
238262
239263
0 commit comments