1 # Copyright (C) 2008 Jan Alonzo <jmalonzo@unpluggable.com>
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 class Inspector (gtk
.Window
):
21 def __init__ (self
, inspector
):
22 """initialize the WebInspector class"""
23 gtk
.Window
.__init
__(self
)
24 self
.set_default_size(600, 480)
26 self
._web
_inspector
= inspector
28 self
._web
_inspector
.connect("inspect-web-view",
29 self
._inspect
_web
_view
_cb
)
30 self
._web
_inspector
.connect("show-window",
32 self
._web
_inspector
.connect("attach-window",
33 self
._attach
_window
_cb
)
34 self
._web
_inspector
.connect("detach-window",
35 self
._detach
_window
_cb
)
36 self
._web
_inspector
.connect("close-window",
37 self
._close
_window
_cb
)
38 self
._web
_inspector
.connect("finished",
41 self
.connect("delete-event", self
._close
_window
_cb
)
43 def _inspect_web_view_cb (self
, inspector
, web_view
):
44 """Called when the 'inspect' menu item is activated"""
45 scrolled_window
= gtk
.ScrolledWindow()
46 scrolled_window
.props
.hscrollbar_policy
= gtk
.POLICY_AUTOMATIC
47 scrolled_window
.props
.vscrollbar_policy
= gtk
.POLICY_AUTOMATIC
48 webview
= webkit
.WebView()
49 scrolled_window
.add(webview
)
50 scrolled_window
.show_all()
52 self
.add(scrolled_window
)
55 def _show_window_cb (self
, inspector
):
56 """Called when the inspector window should be displayed"""
60 def _attach_window_cb (self
, inspector
):
61 """Called when the inspector should displayed in the same
62 window as the WebView being inspected
66 def _detach_window_cb (self
, inspector
):
67 """Called when the inspector should appear in a separate window"""
70 def _close_window_cb (self
, inspector
, view
):
71 """Called when the inspector window should be closed"""
75 def _finished_cb (self
, inspector
):
76 """Called when inspection is done"""
77 self
._web
_inspector
= 0