示例#1
0
 def start_inspector(self):
     view = self.webview
     self.webview = WebKit.WebView()
     settings = WebKit.WebSettings()
     settings.set_property('enable-developer-extras', True)
     view.set_settings(settings)
     self.inspector = view.get_inspector()
     self.inspector.connect("inspect-web-view", self.inspect)
     self.webview = WebKit.WebView()
     self.scrolledwindowinspector.add(self.webview)
     self.scrolledwindowinspector.show()
     self.source_code_text_view.hide()
     self.main_view_box_foot.show()
示例#2
0
 def __init__(self, application, uiFile):
     Gtk.ApplicationWindow.__init__(self, application = application)
     self.set_title(APPNAME)
     
     self.set_default_size(application.configuration.getint("Display", "window_width"), application.configuration.getint("Display", "window_height"))
     if application.configuration.getboolean("Display", "window_maximized"):
         self.maximize()
     
     self._application = application
     self._uiFile = uiFile
     
     self._headerbar = Gtk.HeaderBar()
     self._headerbar.set_show_close_button(True)
     self._headerbar.props.title = APPNAME
     self.set_titlebar(self._headerbar)
     
     sw = Gtk.ScrolledWindow()
     self.add(sw)
     self._webview = WebKit.WebView()
     sw.add(self._webview)
     
     self._webview.connect("script-alert", self._on_webview_script_alert)
             
     self._webview.open(urllib.pathname2url(self._uiFile))
     
     self.connect("size-allocate", self._on_size_allocate)
示例#3
0
文件: AppWindow.py 项目: vk2r/Fogger
 def inspect_webview(self, inspector, widget, data=None):
     inspector_view = WebKit.WebView()
     self.inspector_window.add(inspector_view)
     self.inspector_window.resize(800, 400)
     self.inspector_window.show_all()
     self.inspector_window.present()
     return inspector_view
示例#4
0
def main():
    global browser
    global window

    frontend = frontend_fill()

    window = gtk.Window()
    window.connect('destroy', gtk.main_quit)
    window.set_title("Linux Lite Control Center")
    window.set_icon(Pixbuf.new_from_file("{0}/litecc.png".format(app_dir)))
    window.set_size_request(870, 650)
    # Valtam do we need to resize window?
    window.set_resizable(False)
    window.set_position(gtk.WindowPosition.CENTER),
    browser = webkit.WebView()
    swindow = gtk.ScrolledWindow()
    window.add(swindow)
    swindow.add(browser)
    window.show_all()
    browser.connect("navigation-requested", functions)
    browser.load_html_string(frontend, "file://{0}/frontend/".format(app_dir))
    # no right click menu
    settings = browser.get_settings()
    settings.set_property('enable-default-context-menu', False)
    browser.set_settings(settings)
    # Engage
    gtk.main()
示例#5
0
    def __init__(self, main_instance):
        Gtk.ScrolledWindow.__init__(self)

        self._main_instance = main_instance
        self._view = WebKit.WebView()

        self._last_y_scroll = -1
        self._latest_y_scroll = -2

        settings = self._view.get_settings()
        settings.props.zoom_step = _ZOOM_AMOUNT

        additional_css_path = \
                os.path.join(env.SUGAR_ACTIVITY_ROOT,'styling', 'webkit.css')
        settings.props.user_stylesheet_uri = 'file://' + additional_css_path

        self._view.set_highlight_text_matches(True)

        self._view.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
        self._view.connect('button-press-event', self._disable_click)

        self.add(self._view)
        self.get_vscrollbar().set_child_visible(False)

        self.show_all()
示例#6
0
    def __init__(self):
        Gtk.Window.__init__(self, skip_pager_hint=True, skip_taskbar_hint=True)
        self.set_wmclass("sildesktopwidget", "sildesktopwidget")
        self.set_type_hint(Gdk.WindowTypeHint.DOCK)
        self.set_size_request(600, 400)
        self.set_keep_below(True)

        #Set transparency
        screen = self.get_screen()
        rgba = screen.get_rgba_visual()
        self.set_visual(rgba)
        self.override_background_color(Gtk.StateFlags.NORMAL,
                                       Gdk.RGBA(0, 0, 0, 0))

        #Add all the parts
        self.view = WebKit.WebView()
        self.view.set_transparent(True)
        self.view.override_background_color(Gtk.StateFlags.NORMAL,
                                            Gdk.RGBA(0, 0, 0, 0))
        self.view.props.settings.props.enable_default_context_menu = False
        # self.view.load_uri("file:///home/aquarius/Work/jobs.html")
        self.view.load_uri("https://www.bbc.co.uk/weather/2647793")

        box = Gtk.Box()
        self.add(box)
        box.pack_start(self.view, True, True, 0)
        self.set_decorated(False)
        self.connect("destroy", lambda q: Gtk.main_quit())

        #Show all the parts
        self.show_all()
        self.move(100, 100)
示例#7
0
文件: app.py 项目: tlrlutz22/appkit
    def do_startup(self):
        """Gtk.Application.run() will call this function()"""

        Gtk.Application.do_startup(self)
        gtk_window = Gtk.ApplicationWindow(application=self)
        gtk_window.set_title('AppKit')
        webkit_web_view = WebKit.WebView()
        webkit_web_view.load_uri('http://localhost:' + str(self.port))

        screen = Gdk.Screen.get_default()
        monitor_geometry = screen.get_primary_monitor()
        monitor_geometry = screen.get_monitor_geometry(monitor_geometry)

        settings = webkit_web_view.get_settings()
        settings.set_property('enable-universal-access-from-file-uris', True)
        settings.set_property('enable-file-access-from-file-uris', True)
        settings.set_property('default-encoding', 'utf-8')
        gtk_window.set_default_size(
            monitor_geometry.width * 1.0 / 2.0,
            monitor_geometry.height * 3.0 / 5.0,
        )
        scrollWindow = Gtk.ScrolledWindow()
        scrollWindow.add(webkit_web_view)
        gtk_window.add(scrollWindow)
        gtk_window.connect('delete-event', self._on_gtk_window_destroy)
        webkit_web_view.connect('notify::title', self._on_notify_title)
        self.gtk_window = gtk_window
        self.webkit_web_view = webkit_web_view
        gtk_window.show_all()
示例#8
0
    def __init__(self, title, url, width, height, resizable, fullscreen,
                 min_size, webview_ready):
        BrowserView.instance = self

        self.webview_ready = webview_ready

        Gdk.threads_init()
        window = gtk.Window(title=title)

        if resizable:
            window.set_size_request(min_size[0], min_size[1])
            window.resize(width, height)
        else:
            window.set_size_request(width, height)

        window.set_resizable(resizable)
        window.set_position(gtk.WindowPosition.CENTER)

        if fullscreen:
            window.fullscreen()

        window.connect("delete-event", gtk.main_quit)

        scrolled_window = gtk.ScrolledWindow()
        window.add(scrolled_window)

        self.window = window
        self.webview = webkit.WebView()
        self.webview.connect("notify::visible", self._handle_webview_ready)
        self.webview.props.settings.props.enable_default_context_menu = False
        scrolled_window.add(self.webview)
        window.show_all()

        if url != None:
            self.webview.load_uri(url)
示例#9
0
 def __init__(self, win):
     self.win = win
     self.view = WebKit.WebView()
     self.win.box.pack_start(self.view, True, True, 0)
     self.message_mgr = Messages()
     self.current_msg = None
     self.show_msg('first')
示例#10
0
    def do_activate(self):
        ## TODO : Maybe have to check the filetype ?

        # Store data in the window object
        windowdata = dict()
        self.window.reStPreviewData = windowdata

        scrolled_window = Gtk.ScrolledWindow()
        scrolled_window.set_property("hscrollbar-policy",
                                     Gtk.PolicyType.AUTOMATIC)
        scrolled_window.set_property("vscrollbar-policy",
                                     Gtk.PolicyType.AUTOMATIC)
        scrolled_window.set_property("shadow-type",
                                     Gtk.ShadowType.IN)

        html_view = WebKit.WebView()
        html_view.load_string("%s\n<p>reStructuredText Viewer</p>\n%s" %
                              (START_HTML, END_HTML), 'text/html', 'utf8', '')

        #scrolled_window.set_hadjustment(html_view.get_hadjustment())
        #scrolled_window.set_vadjustment(html_view.get_vadjustment())
        scrolled_window.add(html_view)
        scrolled_window.show_all()

        bottom = self.window.get_bottom_panel()
        image = Gtk.Image()
        image.set_from_icon_name("gnome-mime-text-html", Gtk.IconSize.MENU)
        bottom.add_item(scrolled_window, "rest-preview", "reStructuredText Preview", image)
        windowdata["bottom_panel"] = scrolled_window
        windowdata["html_doc"] = html_view

        manager = self.window.get_ui_manager()

        ## Added later
        self._action_group = Gtk.ActionGroup("reStPluginActions")
        self._action_group.add_actions([("preview", None, _("reStructuredText Preview"),
                                         "<Control><Shift>R", _("reStructuredText Preview"),
                                         self.on_update_preview),
                                        ("table", None, _("Create table"),
                                         None, _("Create a reStructuredText table"),
                                         self.on_create_table),
                                        ("sourcecode", None, _("Paste Code"),
                                         None, _("Paste source code"),
                                         self.on_paste_code),
                                        ("--> HTML", None, _("--> HTML"),
                                         None, _("Save as HTML document"),
                                         self.on_html),
                                        ("--> LaTeX", None, _("--> LaTeX"),
                                         None, _("Save as LaTeX document"),
                                         self.on_latex),
                                        ("--> LibreOffice", None, _("--> LibreOffice"),
                                         None, _("Save as LibreOffice ODF"),
                                         self.on_libreoffice),
        ])

        # Insert the action group
        manager.insert_action_group(self._action_group, -1)

        # Merge the UI
        self._ui_id = manager.add_ui_from_string(ui_str)
示例#11
0
def main():
    doc = rest_to_docopt(__doc__)
    args = docopt(doc, version=version)
    init_logger(args)

    with make_temporary_directory() as out_dir:
        with hwp5html(args['<hwp5file>'], out_dir) as index_path:
            base_uri = fspath2url(out_dir) + '/'
            # index_uri = fspath2url(index_path)
            with file(index_path) as f:
                content = f.read()

            view = WebKit.WebView()
            # view.load_uri(index_uri)
            view.load_string(content, 'text/html', 'utf-8', base_uri)

            scrolled_window = Gtk.ScrolledWindow()
            scrolled_window.add(view)

            vbox = Gtk.VBox()
            vbox.pack_start(scrolled_window, expand=True, fill=True, padding=0)

            window = Gtk.Window()
            window.add(vbox)
            window.connect('delete-event', Gtk.main_quit)
            window.set_default_size(600, 400)
            window.show_all()

            Gtk.main()
示例#12
0
    def __init__(self):
        self._restore_settings()
        self._restore_state()

        if self.state['logged_out']:
            self.state['logged_out'] = False
            self._save_state()

        self.input_username = ""
        self.input_password = ""

        self.logged_in = False

        self.icon = Gtk.Image.new_from_file("skype_icon.png").get_pixbuf()

        self.builder = self.create_builder()

        self.win = self.builder.get_object("applicationwindow")
        self._make_window_smaller()

        self.scroll_view = self.builder.get_object("scrolledwindow")

        self.web_view = WebKit.WebView()
        self.scroll_view.add(self.web_view)

        self._connect_signals()
 def __init__(self, url):
     self.code = None
     Gtk.Dialog.__init__(self)
     self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
     self.set_title(comun.APP)
     self.set_icon_from_file(comun.ICON)
     #
     vbox = Gtk.VBox(spacing=5)
     self.get_content_area().add(vbox)
     hbox1 = Gtk.HBox()
     vbox.pack_start(hbox1, True, True, 0)
     #
     self.scrolledwindow1 = Gtk.ScrolledWindow()
     self.scrolledwindow1.set_policy(Gtk.PolicyType.AUTOMATIC,
                                     Gtk.PolicyType.AUTOMATIC)
     self.scrolledwindow1.set_shadow_type(Gtk.ShadowType.IN)
     hbox1.pack_start(self.scrolledwindow1, True, True, 0)
     #
     self.viewer = WebKit.WebView()
     self.scrolledwindow1.add(self.viewer)
     self.scrolledwindow1.set_size_request(600, 420)
     self.viewer.connect('navigation-policy-decision-requested',
                         self.on_navigation_requested)
     self.viewer.open(url)
     #
     self.show_all()
示例#14
0
 def __init__(self):
     super(VideoPlayer, self).__init__()
     self.webkit = WebKit.WebView()
     self.webkit.connect("new-window-policy-decision-requested",
                         self._on_new_window)
     self.pack_start(self.webkit, True, True, 0)
     self._uri = ""
示例#15
0
    def make_mainview(self):
        """Create the activity view"""
        # Create global box
        vbox = Gtk.VBox(True)

        # Create webview
        scrolled_window = Gtk.ScrolledWindow()
        self.webview = webview = WebKit.WebView()
        scrolled_window.add(webview)
        webview.show()
        vbox.pack_start(scrolled_window, True, True, 0)
        scrolled_window.show()

        # Activate Enyo interface
        self.enyo = Enyo(webview)
        self.enyo.connect("ready", self.init_context)
        self.enyo.connect("save-gallery", self.save_gallery)

        # Go to first page
        web_app_page = os.path.join(activity.get_bundle_path(),
                                    "html/index.html")
        self.webview.load_uri('file://' + web_app_page)

        # Display all
        self.set_canvas(vbox)
        vbox.show()
示例#16
0
def test(url: str = 'https://inbox.google.com'):
    from gi.repository import Soup as libsoup
    from gi.repository import WebKit as libwebkit
    from gi.repository import Gtk as gtk
    from gi.repository import GLib as glib

    # proxy_uri = libsoup.URI.new(os.getenv('http_proxy'))
    # session = libwebkit.get_default_session()
    # session.set_property('proxy-uri', proxy_uri)

    webview = libwebkit.WebView()
    settings = webview.get_settings()
    settings.set_property(
        'user-agent', '''Mozilla/5.0 (X11; Linux x86_64)
                           AppleWebKit/537.36 (KHTML, like Gecko)
                           Chrome/47.0.2526.106 Safari/537.36''')
    webview.load_uri(url)

    scroll = gtk.ScrolledWindow()
    scroll.set_policy(gtk.PolicyType.AUTOMATIC, gtk.PolicyType.AUTOMATIC)
    scroll.set_shadow_type(gtk.ShadowType.IN)

    window = gtk.Window()
    window.connect_after('destroy', gtk.main_quit)
    window.add(scroll)
    scroll.add(webview)
    window.show_all()

    gtk.main()
示例#17
0
    def __init__(self):
        super(VKWebkitAuth, self).__init__(_("vk.com authorization"), None,
                                           Gtk.DialogFlags.MODAL, ())

        self.set_size_request(550, -1)
        self.auth_url = "http://oauth.vk.com/oauth/authorize?" + \
                        "redirect_uri=http://oauth.vk.com/blank.html&response_type=token&" + \
                        "client_id=%s&scope=%s" % (self.CLIENT_ID, ",".join(self.SCOPE))
        self.web_view = WebKit.WebView()
        self.web_view.show()
        self.vbox.pack_start(self.web_view, False, False, 0)

        self.web_view.connect('onload-event', self.on_load)
        session = WebKit.get_default_session()
        if FC().proxy_enable and FC().proxy_url:
            if FC().proxy_user and FC().proxy_password:
                proxy_url = "http://%s:%s@%s" % (
                    FC().proxy_user, FC().proxy_password, FC().proxy_url)
            else:
                proxy_url = "http://%s" % FC().proxy_url
            soup_url = Soup.URI.new(proxy_url)
            session.set_property("proxy-uri", soup_url)
        else:
            session.set_property("proxy-uri", None)

        cookiejar = Soup.CookieJarText.new(cookiefile, False)
        session.add_feature(cookiejar)

        self.access_token = None
        self.user_id = None
        self.first_page_loaded = False
    def __init__(self, address="127.0.0.1", port=54541):
        Gtk.Window.__init__(self, skip_pager_hint=True, skip_taskbar_hint=True)
        self.set_wmclass("sildesktopwidget", "sildesktopwidget")
        self.set_type_hint(Gdk.WindowTypeHint.DOCK)
        self.set_size_request(400, 400)
        self.set_keep_below(True)

        #Set transparency
        screen = self.get_screen()
        rgba = screen.get_rgba_visual()
        self.set_visual(rgba)
        self.override_background_color(Gtk.StateFlags.NORMAL,
                                       Gdk.RGBA(0, 0, 0, 0))

        #Add all the parts
        self.view = WebKit.WebView()
        self.view.set_transparent(True)
        self.view.override_background_color(Gtk.StateFlags.NORMAL,
                                            Gdk.RGBA(0, 0, 0, 0))
        self.view.props.settings.props.enable_default_context_menu = False
        self.view.load_uri("file://" + file_url)

        box = Gtk.Box()
        self.add(box)
        box.pack_start(self.view, True, True, 0)
        self.set_decorated(False)
        self.connect("destroy", lambda q: Gtk.main_quit())

        s = Gdk.Screen.get_default()
        w = s.get_width()
        h = s.get_height()
        #Show all the parts
        self.show_all()
        self.move(w - 450, 100)
示例#19
0
    def __init__(self, username, password, *args, **kwargs):
        super(BrowserTab, self).__init__(*args, **kwargs)

        self.webview = WebKit.WebView()
        self.show()

        scrolled_window = Gtk.ScrolledWindow()
        scrolled_window.add(self.webview)

        find_box = Gtk.HBox()
        close_button = Gtk.Button("Close")
        close_button.connect("clicked", lambda x: find_box.hide())
        self.find_entry = Gtk.Entry()
        self.find_entry.connect("activate",
                                lambda x: self.webview.search_text(self.find_entry.get_text(),
                                                                   False, True, True))

        find_box.pack_start(close_button, False, False, 0)
        find_box.pack_start(self.find_entry, False, False, 0)
        self.find_box = find_box

        self.pack_start(scrolled_window, True, True, 0)
        self.pack_start(find_box, False, False, 0)

        self.username = username
        self.password = password

        scrolled_window.show_all()
示例#20
0
 def __init__(self, dirname, graph_name):
     self.HEIGHT = 600
     self.WIDTH = 800
     self.dirname = dirname
     self.graph_name = graph_name
     # Init window
     Gtk.Window.__init__(self, title="Disk data visualization")
     self.set_default_size(self.WIDTH, self.HEIGHT)
     # Header Bar
     self.hb = Gtk.HeaderBar()
     self.hb.set_show_close_button(True)
     self.hb.props.title = "Disk data visualization"
     self.set_titlebar(self.hb)
     # Scroll
     self.scroll = Gtk.ScrolledWindow(None, None)
     # Webview
     self.webview = WebKit.WebView()
     self.webview.set_size_request(self.WIDTH - 50, self.HEIGHT - 80)
     # Button
     self.button = Gtk.Button(label="Help")
     self.button.connect("clicked", self.on_button_clicked)
     # Add the stuff together
     self.hb.pack_end(self.button)
     self.scroll.add(self.webview)
     self.add(self.scroll)
     # Generate and display the graph
     self.vis = visualizer.Visualizer()
     self.vis.create_graph(self.dirname, self.graph_name) 
     self.webview.open("file://localhost" + path.abspath(self.dirname) + "/" + self.graph_name+ ".svg")
示例#21
0
    def __init__(self, application, **kwargs):
        #print(self.game_list)
        self.lutris = application

        window = Gtk.Window()
        window.set_size_request(800, 600)

        # webkit (see use of webkit, cause this use jdk with alot dependencies)
        webView = WebKit.WebView()
        webView.connect("load-finished", self.on_load_finished)
        webView.connect("navigation-requested", self.on_navigation_requested)
        webView.open('' + os.path.join(datapath.get(), 'xmb', 'index.html'))

        settings = WebKit.WebSettings()
        settings.set_property('enable-default-context-menu', False)
        settings.set_property('enable-file-access-from-file-uris', True)
        webView.set_settings(settings)

        # to close window correct
        window.connect("destroy", self.on_quit)

        # scroll
        scrolls = Gtk.ScrolledWindow()
        scrolls.add(webView)

        # add webkit and start window
        #window.fullscreen()
        window.add(scrolls)
        window.show_all()
        Gtk.main()
示例#22
0
    def __init__(self):
        self.webpages = []

        Gtk.Window.__init__(self, title="SmartHome Kitchen")
        # self.fullscreen()
        self.set_border_width(3)

        self.notebook = Gtk.Notebook()
        self.add(self.notebook)

        self.chat_page = ChatWindow()
        self.sh_commands = SmartHomeCommands(self.chat_page)
        self.notebook.append_page(self.chat_page, Gtk.Label("GoogleA chat"))

        self.home_page = Gtk.Box()
        self.home_page.set_border_width(10)
        self.home_page.add(Gtk.Label("Home Page"))
        self.notebook.append_page(self.home_page, Gtk.Label("Smart Home Page"))

        page_size = Gtk.Adjustment(lower=10, page_size=100)
        scrollwindow = Gtk.ScrolledWindow(page_size)
        web_page = WebKit.WebView()
        web_page.load_uri("https://www.google.com")
        scrollwindow.add(web_page)
        self.add_tab(scrollwindow, 'Google')
        self.webpages.append(web_page)
示例#23
0
    def __init__(self, *args, **kwargs):
        super(BasicoBrowser, self).__init__(*args, **kwargs)

        self.webview = WebKit.WebView()

        settings = self.webview.get_settings()
        settings.set_property('enable-developer-extras', True)
        settings.set_property('enable-default-context-menu', True)

        settings.set_property('default-encoding', 'utf-8')
        settings.set_property('enable-private-browsing', True)
        settings.set_property('enable-html5-local-storage', True)

        # disable plugins, like Adobe Flash and Java
        settings.set_property('enable-plugins', True)

        # scale other content besides from text as well
        self.webview.set_full_content_zoom(True)

        self.show()
        scrolled_window = Gtk.ScrolledWindow()
        scrolled_window.add(self.webview)
        scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC,
                                   Gtk.PolicyType.AUTOMATIC)
        scrolled_window.set_hexpand(True)
        scrolled_window.set_vexpand(True)
        self.pack_start(scrolled_window, True, True, 0)
        scrolled_window.show_all()
示例#24
0
def _start_login_process(window, callback):
    sw = Gtk.ScrolledWindow()

    wk = WebKit.WebView()
    sw.add(wk)

    win = Gtk.Window()
    win.resize(400, 400)
    win.add(sw)
    win.set_modal(True)
    win.set_transient_for(window)
    win.show_all()

    wk.open(
        'https://oauth.vk.com/authorize?client_id=5604598&response_type=token&scope=friends,audio,offline,a&display=mobile'
    )

    def login_succeeded(webview, frame):
        if frame.get_uri().startswith('https://oauth.vk.com/blank.html'):
            info = urlparse(frame.get_uri())
            access_token = parse_qs(info.fragment).get('access_token')[0]
            callback(access_token)
            win.hide()

    wk.connect('load-finished', login_succeeded)
    def __init__(self, parent):
        Gtk.Dialog.__init__(self, "My Dialog", parent, 0,
                            (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL))

        oauth_url = "{0}/authorize?response_type=token&client_id={1}&redirect_uri={2}&scope=read%20write".format(
            BASE_URL, CLIENT_ID, CALLBACK_URL)
        self.settings = Gio.Settings(
            "com.andrewsomething.digitalocean-indicator")

        box = self.get_content_area()
        self.web = WebKit.WebView()
        self.scrolled = Gtk.ScrolledWindow()
        self.scrolled.add(self.web)
        box.pack_start(self.scrolled, True, True, 0)

        self.set_size_request(850, 650)
        self.set_position(Gtk.WindowPosition.CENTER)
        self.set_title("Authorize")
        self.set_skip_taskbar_hint(True)
        self.set_resizable(False)
        self.set_default_size(850, 650)
        self.web.load_uri(oauth_url)
        self.show_all()
        self.web.connect('navigation-policy-decision-requested',
                         self.navigation_callback)
示例#26
0
def main():
    global browser
    global window
    frontend = frontend_fill()
    window = gtk.Window()
    window.connect('destroy', gtk.main_quit)
    window.set_title(appname)
    window.set_icon(Pixbuf.new_from_file(app_icon))
    rootsize = tkinter.Tk()
    if rootsize.winfo_screenheight() > 700:
        window.set_resizable(True)
        window.set_size_request(890, 660)
    else:
        window.set_resizable(True)
        window.set_size_request(890, 500)
    window.set_position(gtk.WindowPosition.CENTER),
    browser = webkit.WebView()
    swindow = gtk.ScrolledWindow()
    window.add(swindow)
    swindow.add(browser)
    window.show_all()
    browser.connect("navigation-requested", functions)
    browser.load_html_string(frontend, "file://{0}/frontend/".format(app_dir))
    settings = browser.get_settings()
    settings.set_property('enable-default-context-menu', False)
    browser.set_settings(settings)
    gtk.main()
示例#27
0
    def __init__(self):
        self.builder = Gtk.Builder()

        self.builder.add_from_file("roksolana.glade")
        self.builder.connect_signals(self)

        self.toolbar1 = self.builder.get_object("toolbar1")
        self.back = self.builder.get_object("back")
        self.forward = self.builder.get_object("forward")
        self.refresh = self.builder.get_object("refresh")
        self.stop = self.builder.get_object("stop")
        self.url = self.builder.get_object("url")
        self.spinner = self.builder.get_object("spinner")
        self.progressbar = self.builder.get_object("progressbar")
        self.window = self.builder.get_object("window1")
        self.window.connect('destroy', lambda w: Gtk.main_quit())
        self.scrolledwindow = self.builder.get_object("scrolledwindow")
        self.window.show_all()

        self.webview = WebKit.WebView()
        self.scrolledwindow.add(self.webview)
        self.webview.open('http://google.com')
        self.webview.connect('title-changed', self.change_title)
        self.webview.connect('load-committed', self.change_url)
        self.webview.connect('load-committed', self.spinner_on)
        self.webview.connect('load_finished', self.spinner_off)
        #self.webview.connect('load-committed', self.progress_on)
        #self.webview.connect('load-progress-changed', self.progress_change)
        #self.webview.connect('document_load_finished',self.progress_off)
        self.webview.show()
示例#28
0
 def area_derecha_del_panel(self):
     scrolled_window = Gtk.ScrolledWindow()
     scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC,
                                Gtk.PolicyType.AUTOMATIC)
     self.descriptor = WebKit.WebView()
     scrolled_window.add_with_viewport(self.descriptor)
     return scrolled_window
示例#29
0
文件: AppWindow.py 项目: vk2r/Fogger
    def setup_webview(self):
        self.webview = getattr(self, 'webview', None) or WebKit.WebView()
        self.setup_websettings()
        self.setup_webkit_session()
        self.webview_inspector = self.webview.get_inspector()
        self.webview_inspector.connect('inspect-web-view', self.inspect_webview)
        self.inspector_window = Gtk.Window()
        if self.root:
            self.downloads = self.root.downloads
        else:
            self.downloads = DownloadManager(self)
        self.webview.connect('notify::progress', self.on_load_progress)
        self.webview.connect('notify::title', self.on_title_changed)
        self.webview.connect('download-requested', self.downloads.requested)
        self.webview.connect('resource-request-starting', self.on_resource_request_starting)
        self.webview.connect('geolocation-policy-decision-requested', self.on_request_geo_permission)
        self.webview.connect('create-web-view', self.on_create_webview)
        self.webview.connect('database-quota-exceeded', self.on_database_quota_exceeded)
        frame = self.webview.get_main_frame()
        frame.connect('notify::load-status', self.on_frame_load_status)

        self.webcontainer.add(self.webview)
        self.webview.show()

        try:
            self.js_lib = open(get_media_file('js/fogger.js', '')).read()
        except:
            logger.error('Error reading fogger.js')
            self.js_lib = ""
示例#30
0
 def __init__(self):
     Renderer.__init__(self)
     self.window = webkit.WebView()
     try:
         self.window.set_custom_encoding('utf-8')  # needs webkit 1.1.10
     except:  # pylint: disable-msg=W0702
         pass
     settings = self.window.get_settings()
     try:
         proxy = os.environ['http_proxy']
         # webkit use libsoup instead of libcurl.
         #if proxy:
         #    settings.set_property("use-proxy", True)
     except:  # pylint: disable-msg=W0702
         pass
     try:  # needs webkit 1.1.22
         settings.set_property("auto-resize-window", True)
     except:  # pylint: disable-msg=W0702
         pass
     try:  # needs webkit 1.1.2
         settings.set_property("enable-private-browsing", True)
     except:  # pylint: disable-msg=W0702
         pass
     #settings.set_property("ident-string", get_identity())
     # do we need it ? Yes if webkit avoid to use local files for security
     ## The following available starting from WebKitGTK+ 1.1.13
     #settings.set_property("enable-universal-access-from-file-uris", True)
     self.browser = WEBKIT
     self.title = None
     self.frame = self.window.get_main_frame()
     self.window.connect("document-load-finished", self.page_loaded)
     self.fct = None