示例#1
0
 def __open_url(self, url):
     # Older webbrowser.py didn't check gconf
     from hotwire.sysdep import is_windows
     if sys.version_info[0] == 2 and sys.version_info[1] < 6 and (not is_windows()):
         try:
             import hotwire.externals.webbrowser as webbrowser
         except ImportError as e:
             _logger.warn("Couldn't import hotwire.externals.webbrowser", exc_info=True)
             import webbrowser
     else:
         import webbrowser            
     webbrowser.open(url)        
示例#2
0
 def __open_url(self, url):
     # Older webbrowser.py didn't check gconf
     from hotwire.sysdep import is_windows
     if sys.version_info[0] == 2 and sys.version_info[1] < 6 and (
             not is_windows()):
         try:
             import hotwire.externals.webbrowser as webbrowser
         except ImportError as e:
             _logger.warn("Couldn't import hotwire.externals.webbrowser",
                          exc_info=True)
             import webbrowser
     else:
         import webbrowser
     webbrowser.open(url)
示例#3
0
 def __on_event_after(self, textview, e):
     if e.type != gtk.gdk.BUTTON_RELEASE:
         return;
     if e.button != 1:
         return;
     (x, y) = self.__text.window_to_buffer_coords(gtk.TEXT_WINDOW_WIDGET, int(e.x), int(e.y))
     iter = self.__text.get_iter_at_location(x, y)
     for tag in iter.get_tags():
         if tag.get_property('name') == 'link':
             iterstart = iter.copy()
             iterend = iter.copy()
             iterstart.backward_to_tag_toggle(tag)
             iterend.forward_to_tag_toggle(tag)
             bufslice = self._buf.get_slice(iterstart, iterend)
             linkvalue = self.__links[bufslice]
             if isinstance(linkvalue, str):
                 webbrowser.open(linkvalue)
             elif hasattr(linkvalue, '__call__'):
                 linkvalue(bufslice)
             break
示例#4
0
        return False

    def __open_url(self, url):
        # Older webbrowser.py didn't check gconf
        from hotwire.sysdep import is_windows
        if sys.version_info[0] == 2 and sys.version_info[1] < 6 and (
                not is_windows()):
            try:
                import hotwire.externals.webbrowser as webbrowser
            except ImportError, e:
                _logger.warn("Couldn't import hotwire.externals.webbrowser",
                             exc_info=True)
                import webbrowser
        else:
            import webbrowser
        webbrowser.open(url)

    def __on_selection_changed(self, *args):
        have_selection = self.__term.get_has_selection()
        self.__copyaction.set_sensitive(have_selection)

    def __copy_cb(self, a):
        _logger.debug("doing copy")
        self.__term.copy_clipboard()

    def __paste_cb(self, a):
        _logger.debug("doing paste")
        self.__term.paste_clipboard()

    def _on_child_exited(self, term):
        _logger.debug("Caught child exited")
示例#5
0
            menu.popup(None, None, None, event.button, event.time)            
            return True
        return False             

    def __open_url(self, url):
        # Older webbrowser.py didn't check gconf
        from hotwire.sysdep import is_windows
        if sys.version_info[0] == 2 and sys.version_info[1] < 6 and (not is_windows()):
            try:
                import hotwire.externals.webbrowser as webbrowser
            except ImportError, e:
                _logger.warn("Couldn't import hotwire.externals.webbrowser", exc_info=True)
                import webbrowser
        else:
            import webbrowser            
        webbrowser.open(url)        
            
    def __on_selection_changed(self, *args):
        have_selection = self.__term.get_has_selection()
        self.__copyaction.set_sensitive(have_selection)

    def __copy_cb(self, a):
        _logger.debug("doing copy")
        self.__term.copy_clipboard()

    def __paste_cb(self, a):
        _logger.debug("doing paste")        
        self.__term.paste_clipboard()            
            
    def _on_child_exited(self, term):
        _logger.debug("Caught child exited")