Advertisement
segadude

Untitled

Jun 23rd, 2013
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.07 KB | None | 0 0
  1.             # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
  2. ### BEGIN LICENSE
  3. # This file is in the public domain
  4. ### END LICENSE
  5.  
  6. import locale
  7. from locale import gettext as _
  8. locale.textdomain('brandsonic web')
  9.  
  10. from gi.repository import Gtk, WebKit # pylint: disable=E0611
  11.  
  12. import logging
  13. logger = logging.getLogger('brandsonicweb')
  14.  
  15. from brandsonicweb_lib import Window
  16. from brandsonicweb.AboutBrandsonicwebDialog import AboutBrandsonicwebDialog
  17. from brandsonicweb.PreferencesBrandsonicwebDialog import PreferencesBrandsonicwebDialog
  18. from brandsonicweb import QuicksitesDialog
  19.  
  20. # See brandsonicweb_lib.Window.py for more details about how this class works
  21. class BrandsonicwebWindow(Window):
  22.     __gtype_name__ = "BrandsonicwebWindow"
  23.    
  24.     def finish_initializing(self, builder): # pylint: disable=E1002
  25.         """Set up the main window"""
  26.         super(BrandsonicwebWindow, self).finish_initializing(builder)
  27.  
  28.         self.AboutDialog = AboutBrandsonicwebDialog
  29.         self.PreferencesDialog = PreferencesBrandsonicwebDialog
  30.    
  31.         # Code for other initialization actions should be added here.
  32.  
  33.         self.refreshbutton = self.builder.get_object("refreshbutton")
  34.         self.backbutton = self.builder.get_object("backbutton")
  35.         self.forwardbutton = self.builder.get_object("forwardbutton")
  36.         self.stopbutton = self.builder.get_object("stopbutton")
  37.         self.quicksitesbutton = self.builder.get_object("quicksitesbutton")
  38.         self.printbutton = self.builder.get_object("printbutton")
  39.         self.urlentry = self.builder.get_object("urlentry")
  40.         self.scrolledwindow = self.builder.get_object("scrolledwindow")
  41.         self.toolbar = self.builder.get_object("toolbar")
  42.         self.quicksites_window = self.builder.get_object("quicksites_window")
  43.  
  44.         context = self.toolbar.get_style_context()
  45.         context.add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR)
  46.  
  47.  
  48.         self.webview = WebKit.WebView()
  49.  
  50.         self.scrolledwindow.add(self.webview)
  51.         self.webview.show()
  52.         self.webview.open("http://brandsonicapps.webs.com/portal.html")    
  53.    
  54.    
  55.     def on_refreshbutton_clicked(self, widget):
  56.        self.webview.reload()
  57.  
  58.     def on_backbutton_clicked(self, widget):
  59.        self.webview.go_back()
  60.    
  61.     def on_forwardbutton_clicked(self, widget):
  62.        self.webview.go_forward()
  63.        
  64.     def on_stopbutton_clicked(self, widget):
  65.        self.webview.stop_loading()
  66.      
  67.     def on_printbutton_clicked(self, widget):
  68.        self.webview.webkit_web_frame_print_full ()  
  69.  
  70.     def on_quicksitesbutton_clicked(self, widget):
  71.         dialog = QuicksitesDialog.QuicksitesDialog()
  72.        
  73.        
  74.    
  75.     def on_urlentry_activate(self, widget):
  76.        url = widget.get_text()
  77.        self.webview.open(url)
  78.  
  79.     def update_buttons(self, widget, data=None):
  80.         self.urlentry.set_text(widget.get_main_frame().get_uri() )
  81.         self.backbutton.set_sensitive(self.webview.can_go_back())
  82.         self.forwardbutton.set_sensitive(self.webview.can_go_forward())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement