当前位置: 首页>>代码示例>>Python>>正文


Python Messenger._add_link方法代码示例

本文整理汇总了Python中messenger.Messenger._add_link方法的典型用法代码示例。如果您正苦于以下问题:Python Messenger._add_link方法的具体用法?Python Messenger._add_link怎么用?Python Messenger._add_link使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在messenger.Messenger的用法示例。


在下文中一共展示了Messenger._add_link方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: WebActivity

# 需要导入模块: from messenger import Messenger [as 别名]
# 或者: from messenger.Messenger import _add_link [as 别名]
class WebActivity(activity.Activity):
    def __init__(self, handle):
        activity.Activity.__init__(self, handle)

        _logger.debug('Starting the web activity')

        session = WebKit.get_default_session()
        session.set_property('accept-language-auto', True)
        session.set_property('ssl-use-system-ca-file', True)
        session.set_property('ssl-strict', False)

        # By default, cookies are not stored persistently, we have to
        # add a cookie jar so that they get saved to disk.  We use one
        # with a SQlite database:
        cookie_jar = SoupGNOME.CookieJarSqlite(filename=_cookies_db_path,
                                               read_only=False)
        session.add_feature(cookie_jar)

        _seed_xs_cookie(cookie_jar)

        # FIXME
        # downloadmanager.remove_old_parts()

        self._force_close = False
        self._tabbed_view = TabbedView()
        self._tabbed_view.connect('focus-url-entry', self._on_focus_url_entry)
        self._tabbed_view.connect('switch-page', self.__switch_page_cb)

        self._tray = HTray()
        self.set_tray(self._tray, Gtk.PositionType.BOTTOM)

        self._primary_toolbar = PrimaryToolbar(self._tabbed_view, self)
        self._edit_toolbar = EditToolbar(self)
        self._view_toolbar = ViewToolbar(self)

        self._primary_toolbar.connect('add-link', self._link_add_button_cb)

        self._primary_toolbar.connect('go-home', self._go_home_button_cb)

        self._primary_toolbar.connect('go-library', self._go_library_button_cb)

        self._primary_toolbar.connect('set-home', self._set_home_button_cb)

        self._primary_toolbar.connect('reset-home', self._reset_home_button_cb)

        self._edit_toolbar_button = ToolbarButton(
            page=self._edit_toolbar, icon_name='toolbar-edit')

        self._primary_toolbar.toolbar.insert(
            self._edit_toolbar_button, 1)

        view_toolbar_button = ToolbarButton(
            page=self._view_toolbar, icon_name='toolbar-view')
        self._primary_toolbar.toolbar.insert(
            view_toolbar_button, 2)

        self._primary_toolbar.show_all()
        self.set_toolbar_box(self._primary_toolbar)

        self.set_canvas(self._tabbed_view)
        self._tabbed_view.show()

        self.model = Model()
        self.model.connect('add_link', self._add_link_model_cb)

        self.connect('key-press-event', self._key_press_cb)

        if handle.uri:
            self._tabbed_view.current_browser.load_uri(handle.uri)
        elif not self._jobject.file_path:
            # TODO: we need this hack until we extend the activity API for
            # opening URIs and default docs.
            self._tabbed_view.load_homepage()

        self.messenger = None
        self.connect('shared', self._shared_cb)

        # Get the Presence Service
        self.pservice = presenceservice.get_instance()
        try:
            name, path = self.pservice.get_preferred_connection()
            self.tp_conn_name = name
            self.tp_conn_path = path
            self.conn = telepathy.client.Connection(name, path)
        except TypeError:
            _logger.debug('Offline')
        self.initiating = None

        if self.get_shared_activity() is not None:
            _logger.debug('shared: %s', self.get_shared())
            # We are joining the activity
            _logger.debug('Joined activity')
            self.connect('joined', self._joined_cb)
            if self.get_shared():
                # We've already joined
                self._joined_cb()
        else:
            _logger.debug('Created activity')

        # README: this is a workaround to remove old temp file
#.........这里部分代码省略.........
开发者ID:City-busz,项目名称:browse-activity,代码行数:103,代码来源:webactivity.py

示例2: WebActivity

# 需要导入模块: from messenger import Messenger [as 别名]
# 或者: from messenger.Messenger import _add_link [as 别名]
class WebActivity(activity.Activity):
    def __init__(self, handle):
        activity.Activity.__init__(self, handle)

        _logger.debug('Starting the web activity')
        
        # figure out if we're an SSB
        self.is_ssb = ssb.get_is_ssb(self)

        self._browser = Browser()
        
        _set_accept_languages()
        _seed_xs_cookie()
        _set_dbus_globals(self.get_bundle_id())        
                        
        # don't pick up the sugar theme - use the native mozilla one instead
        cls = components.classes['@mozilla.org/preferences-service;1']
        pref_service = cls.getService(components.interfaces.nsIPrefService)
        branch = pref_service.getBranch("mozilla.widget.")
        branch.setBoolPref("disable-native-theme", True)

        toolbox = activity.ActivityToolbox(self)

        self._edit_toolbar = EditToolbar(self._browser)
        toolbox.add_toolbar(_('Edit'), self._edit_toolbar)
        self._edit_toolbar.show()

        self._web_toolbar = WebToolbar(self)
        toolbox.add_toolbar(_('Browse'), self._web_toolbar)
        self._web_toolbar.show()
       
        self._tray = HTray()
        self.set_tray(self._tray, gtk.POS_BOTTOM)
        self._tray.show()
        
        self._view_toolbar = ViewToolbar(self)
        toolbox.add_toolbar(_('View'), self._view_toolbar)
        self._view_toolbar.show()
        
        # the bookmarklet bar doesn't show up if empty
        self._bm_toolbar = None
            
        self.set_toolbox(toolbox)
        toolbox.show()        
                
        self.set_canvas(self._browser)
        self._browser.show()

        self._browser.history.connect('session-link-changed', 
                                      self._session_history_changed_cb)
        self._web_toolbar.connect('add-link', self._link_add_button_cb)

        self._browser.connect("notify::title", self._title_changed_cb)
        
        self._bm_store = bookmarklets.get_store()
        self._bm_store.connect('add_bookmarklet', self._add_bookmarklet_cb)
        self._bm_store.connect('overwrite_bookmarklet',
                               self._overwrite_bookmarklet_cb)
        for name in self._bm_store.list():
            self._add_bookmarklet(name)

        self.model = Model()
        self.model.connect('add_link', self._add_link_model_cb)

        self.current = _('blank')
        self.webtitle = _('blank')
        self.connect('key-press-event', self._key_press_cb)
                     
        self.toolbox.set_current_toolbar(_TOOLBAR_BROWSE)
                
        if self.is_ssb:
            # set permanent homepage for SSBs
            f = open(os.path.join(activity.get_bundle_path(),
                                  'data/homepage'))
            self.homepage = f.read()
            f.close()
            
        # enable userscript saving
        self._browser.userscript.connect('userscript-found',
                                         self._userscript_found_cb)    
        # enable userscript injecting
        self._browser.userscript.connect('userscript-inject',
                                         self._userscript_inject_cb)

        if handle.uri:
            self._browser.load_uri(handle.uri)        
        elif not self._jobject.file_path:
            # TODO: we need this hack until we extend the activity API for
            # opening URIs and default docs.
            self._load_homepage()

        self.messenger = None
        self.connect('shared', self._shared_cb)

        # Get the Presence Service        
        self.pservice = presenceservice.get_instance()
        try:
            name, path = self.pservice.get_preferred_connection()
            self.tp_conn_name = name
            self.tp_conn_path = path
#.........这里部分代码省略.........
开发者ID:lucian1900,项目名称:Webified,代码行数:103,代码来源:webactivity.py


注:本文中的messenger.Messenger._add_link方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。