#!/usr/bin/python3
# -*- coding: utf-8 -*- 

## Here we imported both Gtk library and the WebKit2 engine.
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('WebKit2', '4.0')
from gi.repository import Gtk, WebKit2

class Handler:
  
  def backbutton_clicked(self, button): 
  ## When the user clicks on the Back button, the '.go_back()' method is activated, which will send the user to the previous page automatically, this method is part from the WebKit2 engine. 
    browserholder.go_back() 

  def refreshbutton_clicked(self, button): 
  ## Same thing here, the '.reload()' method is activated when the 'Refresh' button is clicked. 
    browserholder.reload() 
    
  def enterkey_clicked(self, button): 
  ## To load the URL automatically when the "Enter" key is hit from the keyboard while focusing on the entry box, we have to use the '.load_uri()' method and grab the URL from the entry box. 
    browserholder.load_uri(urlentry.get_text()) 
    
## Nothing new here.. We just imported the 'ui.glade' file. 
builder = Gtk.Builder() 
builder.add_from_file("/usr/share/pamboliada-webapp/ui.glade") 
builder.connect_signals(Handler()) 

window = builder.get_object("window1") 

## Here's the new part.. We created a global object called 'browserholder' which will contain the WebKit2 rendering engine, and we set it to 'WebKit2.WebView()' which is the default thing to do if you want to add a WebKit2 engine to your program. 
browserholder = WebKit2.WebView() 

## To disallow editing the webpage. 
#browserholder.set_editable(False) 

## The default URL to be loaded, we used the 'load_uri()' method. 

url = "http://www.pamboliada.cat"

browserholder.load_uri(url) 

urlentry = builder.get_object("entry1") 
urlentry.set_text(url) 

## Here we imported the scrolledwindow1 object from the ui.glade file. 
scrolled_window = builder.get_object("scrolledwindow1") 

## We used the '.add()' method to add the 'browserholder' object to the scrolled window, which contains our WebKit2 browser. 
scrolled_window.add(browserholder) 

## And finally, we showed the 'browserholder' object using the '.show()' method. 
browserholder.show() 
 
## Give that developer a cookie ! 
window.connect("delete-event", Gtk.main_quit) 
window.show_all() 
Gtk.main()

0f6171f4367c08395522a250651b6511859f2180
<mask token>


class Handler:
    <mask token>

    def refreshbutton_clicked(self, button):
        browserholder.reload()

    def enterkey_clicked(self, button):
        browserholder.load_uri(urlentry.get_text())


<mask token>

<mask token>


class Handler:

    def backbutton_clicked(self, button):
        browserholder.go_back()

    def refreshbutton_clicked(self, button):
        browserholder.reload()

    def enterkey_clicked(self, button):
        browserholder.load_uri(urlentry.get_text())


<mask token>

<mask token>
gi.require_version('Gtk', '3.0')
gi.require_version('WebKit2', '4.0')
<mask token>


class Handler:

    def backbutton_clicked(self, button):
        browserholder.go_back()

    def refreshbutton_clicked(self, button):
        browserholder.reload()

    def enterkey_clicked(self, button):
        browserholder.load_uri(urlentry.get_text())


<mask token>
builder.add_from_file('/usr/share/pamboliada-webapp/ui.glade')
builder.connect_signals(Handler())
<mask token>
browserholder.load_uri(url)
<mask token>
urlentry.set_text(url)
<mask token>
scrolled_window.add(browserholder)
browserholder.show()
window.connect('delete-event', Gtk.main_quit)
window.show_all()
Gtk.main()

import gi
gi.require_version('Gtk', '3.0')
gi.require_version('WebKit2', '4.0')
from gi.repository import Gtk, WebKit2


class Handler:

    def backbutton_clicked(self, button):
        browserholder.go_back()

    def refreshbutton_clicked(self, button):
        browserholder.reload()

    def enterkey_clicked(self, button):
        browserholder.load_uri(urlentry.get_text())


builder = Gtk.Builder()
builder.add_from_file('/usr/share/pamboliada-webapp/ui.glade')
builder.connect_signals(Handler())
window = builder.get_object('window1')
browserholder = WebKit2.WebView()
url = 'http://www.pamboliada.cat'
browserholder.load_uri(url)
urlentry = builder.get_object('entry1')
urlentry.set_text(url)
scrolled_window = builder.get_object('scrolledwindow1')
scrolled_window.add(browserholder)
browserholder.show()
window.connect('delete-event', Gtk.main_quit)
window.show_all()
Gtk.main()

#!/usr/bin/python3
# -*- coding: utf-8 -*- 

## Here we imported both Gtk library and the WebKit2 engine.
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('WebKit2', '4.0')
from gi.repository import Gtk, WebKit2

class Handler:
  
  def backbutton_clicked(self, button): 
  ## When the user clicks on the Back button, the '.go_back()' method is activated, which will send the user to the previous page automatically, this method is part from the WebKit2 engine. 
    browserholder.go_back() 

  def refreshbutton_clicked(self, button): 
  ## Same thing here, the '.reload()' method is activated when the 'Refresh' button is clicked. 
    browserholder.reload() 
    
  def enterkey_clicked(self, button): 
  ## To load the URL automatically when the "Enter" key is hit from the keyboard while focusing on the entry box, we have to use the '.load_uri()' method and grab the URL from the entry box. 
    browserholder.load_uri(urlentry.get_text()) 
    
## Nothing new here.. We just imported the 'ui.glade' file. 
builder = Gtk.Builder() 
builder.add_from_file("/usr/share/pamboliada-webapp/ui.glade") 
builder.connect_signals(Handler()) 

window = builder.get_object("window1") 

## Here's the new part.. We created a global object called 'browserholder' which will contain the WebKit2 rendering engine, and we set it to 'WebKit2.WebView()' which is the default thing to do if you want to add a WebKit2 engine to your program. 
browserholder = WebKit2.WebView() 

## To disallow editing the webpage. 
#browserholder.set_editable(False) 

## The default URL to be loaded, we used the 'load_uri()' method. 

url = "http://www.pamboliada.cat"

browserholder.load_uri(url) 

urlentry = builder.get_object("entry1") 
urlentry.set_text(url) 

## Here we imported the scrolledwindow1 object from the ui.glade file. 
scrolled_window = builder.get_object("scrolledwindow1") 

## We used the '.add()' method to add the 'browserholder' object to the scrolled window, which contains our WebKit2 browser. 
scrolled_window.add(browserholder) 

## And finally, we showed the 'browserholder' object using the '.show()' method. 
browserholder.show() 
 
## Give that developer a cookie ! 
window.connect("delete-event", Gtk.main_quit) 
window.show_all() 
Gtk.main()
