# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_GO_FORWARD [as 别名]
def __init__(self, url):
from pychess.System.uistuff import keepWindowSize
self.window = Gtk.Window()
keepWindowSize("webkitbrowser", self.window, (800, 600))
self.vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.window.add(self.vbox)
self.box = Gtk.Box()
self.toolbar = Gtk.Toolbar()
self.box.pack_start(self.toolbar, False, False, 0)
self.go_back_button = Gtk.ToolButton(stock_id=Gtk.STOCK_GO_BACK)
self.toolbar.insert(self.go_back_button, -1)
self.go_forward_button = Gtk.ToolButton(stock_id=Gtk.STOCK_GO_FORWARD)
self.toolbar.insert(self.go_forward_button, -1)
self.go_refresh_button = Gtk.ToolButton(stock_id=Gtk.STOCK_REFRESH)
self.toolbar.insert(self.go_refresh_button, -1)
self.url = Gtk.Entry()
self.box.pack_start(self.url, True, True, 0)
self.search_entry = Gtk.SearchEntry()
self.box.pack_start(self.search_entry, False, False, 0)
self.vbox.pack_start(self.box, False, False, 0)
self.view = WebKit.WebView()
self.scrolled_window = Gtk.ScrolledWindow()
self.scrolled_window.add(self.view)
self.vbox.pack_start(self.scrolled_window, True, True, 0)
self.window.show_all()
self.view.connect("load-committed", self.check_buttons)
self.view.connect("title-changed", self.change_title)
self.url.connect("activate", self.go)
self.search_entry.connect("activate", self.search)
self.go_back_button.connect("clicked", self.go_back)
self.go_forward_button.connect("clicked", self.go_forward)
self.go_refresh_button.connect("clicked", self.refresh)
self.view.open(url)
self.view.show()