~straemer/ubuntu/quantal/update-manager/fix-for-1058070

« back to all changes in this revision

Viewing changes to UpdateManager/ReleaseNotesViewerWebkit.py

  • Committer: Package Import Robot
  • Author(s): Michael Terry
  • Date: 2012-06-29 10:59:30 UTC
  • mfrom: (389.1.2 precise-security)
  • Revision ID: package-import@ubuntu.com-20120629105930-0oaj9vdvykmvkjum
Tags: 1:0.165
* Implementation of "update on start" feature from spec
  https://wiki.ubuntu.com/SoftwareUpdates
* Use a single main window that changes instead of having modal dialogs
* Implement several special-purpose dialogs like "No updates" or
  "Dist upgrade needed" accordingn to the above spec
* Split out release upgrader code and DistUpgrade module into a separate
  source package
* Drop python-update-manager, as it is unused
* debian/tests:
  - Add dep8 tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# ReleaseNotesViewer.py
2
 
#  
3
 
#  Copyright (c) 2011 Canonical
4
 
#  
5
 
#  Author: Michael Vogt <mvo@ubutnu.com>
6
 
#
7
 
#  This modul provides an inheritance of the Gtk.TextView that is 
8
 
#  aware of http URLs and allows to open them in a browser.
9
 
#  It is based on the pygtk-demo "hypertext".
10
 
11
 
#  This program is free software; you can redistribute it and/or 
12
 
#  modify it under the terms of the GNU General Public License as 
13
 
#  published by the Free Software Foundation; either version 2 of the
14
 
#  License, or (at your option) any later version.
15
 
16
 
#  This program is distributed in the hope that it will be useful,
17
 
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 
#  GNU General Public License for more details.
20
 
21
 
#  You should have received a copy of the GNU General Public License
22
 
#  along with this program; if not, write to the Free Software
23
 
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24
 
#  USA
25
 
 
26
 
from __future__ import absolute_import
27
 
 
28
 
from gi.repository import Gtk
29
 
from gi.repository import WebKit
30
 
 
31
 
from .ReleaseNotesViewer import open_url
32
 
 
33
 
class ReleaseNotesViewerWebkit(WebKit.WebView):
34
 
    def __init__(self, notes_url):
35
 
        super(ReleaseNotesViewerWebkit, self).__init__()
36
 
        self.load_uri(notes_url)
37
 
        self.connect("navigation-policy-decision-requested", self._on_navigation_policy_decision_requested)
38
 
    def _on_navigation_policy_decision_requested(self, view, frame, request, action, policy):
39
 
        open_url(request.get_uri())
40
 
        policy.ignore()
41
 
        return True
42
 
        
43
 
    
44
 
if __name__ == "__main__":
45
 
    win = Gtk.Window()
46
 
    win.set_size_request(600, 400)
47
 
    scroll = Gtk.ScrolledWindow()
48
 
    rv = ReleaseNotesViewerWebkit("http://archive.ubuntu.com/ubuntu/dists/natty/main/dist-upgrader-all/0.150/ReleaseAnnouncement.html")
49
 
    scroll.add(rv)
50
 
    win.add(scroll)
51
 
    win.show_all()
52
 
    Gtk.main()
53
 
 
54