Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
- ### BEGIN LICENSE
- # This file is in the public domain
- ### END LICENSE
- import locale
- from locale import gettext as _
- locale.textdomain('brandsonic web')
- from gi.repository import Gtk, WebKit # pylint: disable=E0611
- import logging
- logger = logging.getLogger('brandsonicweb')
- from brandsonicweb_lib import Window
- from brandsonicweb.AboutBrandsonicwebDialog import AboutBrandsonicwebDialog
- from brandsonicweb.PreferencesBrandsonicwebDialog import PreferencesBrandsonicwebDialog
- from brandsonicweb import QuicksitesDialog
- # See brandsonicweb_lib.Window.py for more details about how this class works
- class BrandsonicwebWindow(Window):
- __gtype_name__ = "BrandsonicwebWindow"
- def finish_initializing(self, builder): # pylint: disable=E1002
- """Set up the main window"""
- super(BrandsonicwebWindow, self).finish_initializing(builder)
- self.AboutDialog = AboutBrandsonicwebDialog
- self.PreferencesDialog = PreferencesBrandsonicwebDialog
- # Code for other initialization actions should be added here.
- self.refreshbutton = self.builder.get_object("refreshbutton")
- self.backbutton = self.builder.get_object("backbutton")
- self.forwardbutton = self.builder.get_object("forwardbutton")
- self.stopbutton = self.builder.get_object("stopbutton")
- self.quicksitesbutton = self.builder.get_object("quicksitesbutton")
- self.printbutton = self.builder.get_object("printbutton")
- self.urlentry = self.builder.get_object("urlentry")
- self.scrolledwindow = self.builder.get_object("scrolledwindow")
- self.toolbar = self.builder.get_object("toolbar")
- self.quicksites_window = self.builder.get_object("quicksites_window")
- context = self.toolbar.get_style_context()
- context.add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR)
- self.webview = WebKit.WebView()
- self.scrolledwindow.add(self.webview)
- self.webview.show()
- self.webview.open("http://brandsonicapps.webs.com/portal.html")
- def on_refreshbutton_clicked(self, widget):
- self.webview.reload()
- def on_backbutton_clicked(self, widget):
- self.webview.go_back()
- def on_forwardbutton_clicked(self, widget):
- self.webview.go_forward()
- def on_stopbutton_clicked(self, widget):
- self.webview.stop_loading()
- def on_printbutton_clicked(self, widget):
- self.webview.webkit_web_frame_print_full ()
- def on_quicksitesbutton_clicked(self, widget):
- dialog = QuicksitesDialog.QuicksitesDialog()
- def on_urlentry_activate(self, widget):
- url = widget.get_text()
- self.webview.open(url)
- def update_buttons(self, widget, data=None):
- self.urlentry.set_text(widget.get_main_frame().get_uri() )
- self.backbutton.set_sensitive(self.webview.can_go_back())
- self.forwardbutton.set_sensitive(self.webview.can_go_forward())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement