每次使用 self.webview.open 快速打开 URL 时都会看到缓冲

每次使用 self.webview.open 快速打开 URL 时都会看到缓冲

我是使用 python-quickly 开发应用程序的新手。这是我正在尝试的示例代码。每次我运行它时,都会根据 login.php 播放视频。但启动需要时间,或者我的理解是会发生缓冲。有没有办法让 URL 仅在第一次缓冲,然后每次播放时都无需缓冲?

import gettext
from gettext import gettext as _
gettext.textdomain('smallbrowser')

from gi.repository import Gtk, WebKit # pylint: disable=E0611
import logging
logger = logging.getLogger('smallbrowser')

from smallbrowser_lib import Window
from smallbrowser.AboutSmallbrowserDialog import AboutSmallbrowserDialog
from smallbrowser.PreferencesSmallbrowserDialog import PreferencesSmallbrowserDialog

# See smallbrowser_lib.Window.py for more details about how this class works
class SmallbrowserWindow(Window):
    __gtype_name__ = "SmallbrowserWindow"

    def finish_initializing(self, builder): # pylint: disable=E1002
        """Set up the main window"""
        super(SmallbrowserWindow, self).finish_initializing(builder)

        self.AboutDialog = AboutSmallbrowserDialog
        self.PreferencesDialog = PreferencesSmallbrowserDialog

        # Code for other initialization actions should be added here.

        self.refreshbutton = self.builder.get_object("refreshbutton")
        self.urlentry = self.builder.get_object("urlentry")
        self.scrollwindow = self.builder.get_object("scrollwindow")
        self.webview =  WebKit.WebView()  
        self.scrollwindow.add(self.webview)
        self.webview.show()
        self.webview.open("login.php")  

    def on_refreshbutton_clicked(self, widget):
        print "refresh"

相关内容