Exemplo n.º 1
0
 def __init__(self, note, **kwargs):
     self.title = tomboy().GetNoteTitle(note)
     deskbar.interfaces.Match.__init__(self,
         name= self.title,
         icon="note.png", category="notes", **kwargs)
     self.note = note
     self.add_action( TomboyOpenNoteAction(self.note, self.title) )
     self.add_action( TomboyDeleteNoteAction(self.note, self.title) )
     self.add_action( CopyToClipboardAction(_("Title"), self.title) )
     self.add_action( CopyToClipboardAction(_("Contents"), tomboy().GetNoteContents(self.note) ))
Exemplo n.º 2
0
 def get_name(self, text=None):
     """Because the text variable for history entries contains the text
     typed for the history search (and not the text of the orginal action),
     we store the original text seperately."""
     result = CopyToClipboardAction.get_name(self, text)
     result["origtext"] = self.text
     return result
Exemplo n.º 3
0
 def get_name(self, text = None):
     """Because the text variable for history entries contains the text
     typed for the history search (and not the text of the orginal action),
     we store the original text seperately."""
     result = CopyToClipboardAction.get_name (self, text)
     result["origtext"] = self.text
     return result
Exemplo n.º 4
0
def get_actions_for_uri(uri, display_name=None):
    """
    Return a list of applications suitable for
    the file depending on MIME type
    
    The default application is not included.
    Use the OpenFileAction for that purpose.
    
    @param uri: Unescaped URI or path of the file
    @param display_name: The optional name of
    the file for display. 
    """
    if not uri.startswith("file://"):
        gfile = gio.File(path=uri)
    else:
        gfile = gio.File(uri=uri)
    if display_name == None:
        display_name = gfile.get_basename()

    # Check if file exists
    path = gfile.get_path()
    if path == None:
        LOGGER.warning("File %s does not exist", uri)
        return []

    # If we have a directory only return one action
    if isdir(path):
        return [CopyToClipboardAction(_("Location"), gfile.get_path())]

    try:
        fileinfo = gfile.query_info("standard::content-type")
    except Exception, msg:
        LOGGER.error("Could not retrieve content type of %s: %s",
                     gfile.get_path(), msg)
        return []
Exemplo n.º 5
0
    def __init__(self, url=None, summary=None, **args):
        deskbar.interfaces.Match.__init__(self,
                                          category="web",
                                          icon="yahoo.png",
                                          **args)
        self.url = url
        self.set_snippet(summary)

        self.add_action(OpenYahooAction(self.get_name(), self.url))
        self.add_action(CopyToClipboardAction(_("URL"), self.url))
Exemplo n.º 6
0
 def __init__(self, name=None, drive=None, icon=None, **args):
     deskbar.interfaces.Match.__init__(self,
                                       name=name,
                                       category="places",
                                       icon=icon,
                                       **args)
     self.drive = drive
     self.add_action(OpenWithCajaAction(name, drive))
     # FIXME:
     # _("Location") should be _("Location of %s") % name
     self.add_action(CopyToClipboardAction(_("Location"), drive))
Exemplo n.º 7
0
    def __init__(self, result=None, **args):
        deskbar.interfaces.Match.__init__(self,
                                          category="web",
                                          icon="google.png",
                                          **args)
        self._name = htmldecode(result['titleNoFormatting'])
        self.url = result['url']
        self.set_snippet(htmldecode(result['content']))

        self.add_action(OpenGoogleAction(self.get_name(), self.url))
        self.add_action(CopyToClipboardAction(_("URL"), self.url))
Exemplo n.º 8
0
    def __init__(self, name=None, url=None, is_history=False, **args):
        deskbar.interfaces.Match.__init__(self,
                                          name=cgi.escape(name),
                                          category="web",
                                          **args)
        self._priority = 10

        self.url = url
        if is_history:
            item_type = OpenBrowserItemAction.HISTORY_TYPE
        else:
            item_type = OpenBrowserItemAction.BOOKMARK_TYPE
        self.add_action(OpenBrowserItemAction(name, self.url, item_type))
        self.add_action(CopyToClipboardAction(_("URL"), self.url))
Exemplo n.º 9
0
    def __init__(self, id, title, content, pkg_name, pkg_uri, **args):
        deskbar.interfaces.Match.__init__(self,
                                          name=title,
                                          category="web",
                                          icon="google.png",
                                          **args)
        self._id = id

        self.set_snippet(content)
        # Display only the filename and not the complete path
        self.add_action(OpenGoogleCodeSearchAction(basename(title), id), True)
        if pkg_uri.startswith("http") or pkg_uri.startswith("ftp"):
            self.add_action(
                GoToPackageLocationAction(basename(pkg_name), pkg_uri))
            self.add_action(CopyToClipboardAction(_("URL"), pkg_uri))
Exemplo n.º 10
0
 def __init__(self, text, answer):
     CopyToClipboardAction.__init__(self, answer, answer)
     self.text = text
Exemplo n.º 11
0
 def __init__ (self, text, answer):
     CopyToClipboardAction.__init__ (self, answer, answer)
     self.text = text
Exemplo n.º 12
0
 def __init__(self, name, email, uri, pixbuf=None, **args):
     deskbar.interfaces.Match.__init__(self, name=name, pixbuf=pixbuf, category="people")
     
     self.add_action( SendEmailToAction(name, email), True )
     self.add_action( EditEvolutionContactAction(name, email, uri) )
     self.add_action( CopyToClipboardAction(name, email) )
Exemplo n.º 13
0
        return []

    actions = []

    default_appinfo = gio.app_info_get_default_for_type(
        fileinfo.get_content_type(), True)
    for appinfo in gio.app_info_get_all_for_type(fileinfo.get_content_type()):
        if default_appinfo == None \
        or appinfo.get_executable() != default_appinfo.get_executable():
            cmd = appinfo.get_executable()
            args = [gfile.get_path()]

            cmd_args = cmd.split(" ")
            if len(cmd_args) > 0:
                cmd = cmd_args[0]
                args = cmd_args[1:] + args

            actions.append(
                OpenWithApplicationAction(
                    display_name,
                    cmd,
                    args,
                    display_program_name=appinfo.get_name()))

    actions.append(GoToLocationAction(display_name, gfile.get_uri()))
    actions.append(SendFileViaEmailAction(display_name, gfile.get_uri()))
    actions.append(
        CopyToClipboardAction(_("URL of %s") % display_name, gfile.get_path()))

    return actions