Home | Trees | Indices | Help |
|
---|
|
1 #! /usr/bin/env python 2 # -*- coding: utf-8 -*- 3 4 # Copyright (C) 2011 ~ 2012 Deepin, Inc. 5 # 2011 ~ 2012 Xia Bin 6 # 7 # Author: Xia Bin <xiabin@linuxdeepin.com> 8 # Maintainer: Xia Bin <xiabin@linuxdeepin.com> 9 # 10 # This program is free software: you can redistribute it and/or modify 11 # it under the terms of the GNU General Public License as published by 12 # the Free Software Foundation, either version 3 of the License, or 13 # any later version. 14 # 15 # This program is distributed in the hope that it will be useful, 16 # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 # GNU General Public License for more details. 19 # 20 # You should have received a copy of the GNU General Public License 21 # along with this program. If not, see <http://www.gnu.org/licenses/>. 22 23 import webkit 24 import dtk_webkit_cookie 25 from gtk import gdk 2628 ''' 29 @undocumented: save_adjustment 30 @undocumented: do_scroll 31 WebView wrap that support cookie. 32 ''' 337035 ''' 36 Init for WebView. 37 38 @param cookie_filepath: Filepath to save cookie. 39 ''' 40 webkit.WebView.__init__(self) 41 self.cookie_filepath = cookie_filepath 42 if self.cookie_filepath != None: 43 dtk_webkit_cookie.add_cookie(cookie_filepath) 44 settings = self.get_settings() 45 settings.set_property("enable-default-context-menu", False) 46 self.connect("set-scroll-adjustments", self.save_adjustment) 47 self.connect("scroll-event", self.do_scroll)4850 ''' 51 the callback of "set-scroll-adjustmens" 52 ''' 53 self.vadjustment = vadj 54 self.hadjustment = hadj5557 value = self.vadjustment.value 58 step = self.vadjustment.step_increment 59 page_size = self.vadjustment.page_size 60 upper = self.vadjustment.upper 61 62 if e.direction == gdk.SCROLL_DOWN: 63 self.vadjustment.set_value(min(upper-page_size-1, value+step)) 64 return True 65 elif e.direction == gdk.SCROLL_UP: 66 self.vadjustment.set_value(max(0, value-step)) 67 return True 68 else: 69 return False
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Aug 8 13:17:39 2012 | http://epydoc.sourceforge.net |