def activate(self, leaf): # Send in UTF-8 encoding lang_code = __kupfer_settings__["lang"] search_url="http://%s.wikipedia.org/w/index.php?title=Special:Search&go=Go" % lang_code # will encode search=text, where `text` is escaped query_url = search_url + "&" + urllib.urlencode({"search": leaf.object}) utils.show_url(query_url)
def activate(self, leaf): """Called when item is selected via Enter/click""" entry = id2data[leaf.id2key] if _settings_key(leaf.id2key) in __kupfer_settings__: url_prefix = __kupfer_settings__[_settings_key(leaf.id2key)] else: url_prefix = entry["url"] utils.show_url(url_prefix + entry["part"])
def activate(self, leaf): # Send in UTF-8 encoding lang_code = __kupfer_settings__["lang"] search_url = "http://%s.wikipedia.org/w/index.php?title=Special:Search&go=Go" % lang_code # will encode search=text, where `text` is escaped query_url = search_url + "&" + urllib.urlencode( {"search": leaf.object}) utils.show_url(query_url)
def activate(self, leaf): # Send in UTF-8 encoding lang_code = __kupfer_settings__["lang"] search_url = "http://www.google.se/#hl=%s&tbs=dfn:1" % lang_code # will encode search=text, where `text` is escaped query_url = search_url + "&" + urllib.urlencode({"q": leaf.object}) utils.show_url(query_url)
def run_command(typ, action_data, leaf_data): """Run command. Called from actions""" if typ == 'command': cmd = substitute(action_data['cmd'], leaf_data) env = action_data['env'] utils.launch_commandline(cmd) elif typ == 'uri': uri = substitute(action_data['uri'], leaf_data) utils.show_url(uri)
def activate(self, item): url = None if is_issue(item): i = get_issue(item, self.jira) url = i.permalink() else: p = get_project(item, self.jira) url = __kupfer_settings__['jira_url'] + \ '/projects/' + p.key + '/summary' show_url(url)
def activate(self, obj, ctx=None): utils.show_url(obj.object)
def activate(self, leaf): language = __kupfer_settings__["language"] query_url = "https://www.youtube.com/results?search_query=" + leaf.object + "+trailer+" + language utils.show_url(query_url)
def activate(self, leaf): engine = __kupfer_settings__["search_engine"] query_url = URLS[engine] + "?" + urllib.parse.urlencode( {"q": leaf.object}) utils.show_url(query_url)
def activate(self, leaf): email = email_from_leaf(leaf) utils.show_url("mailto:%s" % email)
def activate_multiple(self, objects): recipients = ",".join(email_from_leaf(L) for L in objects) url = "mailto:" + recipients utils.show_url(url)
def activate(self, leaf): url = LINK.format(leaf.currier, leaf.code) show_url(url)
def __call__(self, *args): from kupfer import utils, version utils.show_url(version.WEBSITE) raise IgnoreResultException
def activate(self, leaf): url = is_url(leaf.object) utils.show_url(url)
def activate(self, leaf, email_leaf=None): if email_leaf: email = email_leaf.object utils.show_url("mailto:%s" % email)
def show_help(ctxenv=None): """ Show Kupfer help pages, if possible """ if not utils.show_help_url("ghelp:%s" % version.PACKAGE_NAME): utils.show_url(version.HELP_WEBSITE)
def show_help(): """ Show Kupfer help pages, if possible """ utils.show_url(version.WEBSITE)
def _do_search_engine(terms, search_url, encoding="UTF-8"): """Show an url searching for @search_url with @terms""" utils.show_url(_query_url(terms, search_url))
def open_url(self, url): utils.show_url(url)
def activate(self, obj): url = GMAIL_EDIT_CONTACT_URL % dict(contact=obj.google_contact_id) utils.show_url(url)
def activate(self, leaf): show_url(to_correios_url(leaf))
def activate_multiple(self, objects): recipients = ",".join( urllib.quote(email_from_leaf(L)) for L in objects) url = GMAIL_NEW_MAIL_URL % dict(emails=recipients) utils.show_url(url)
def activate(self, leaf): search_url = "https://duckduckgo.com/" query_url = search_url + "?" + urllib.urlencode({"q" : leaf.object}) utils.show_url(query_url)
def activate(self, leaf): query_url = "http://" + leaf.object utils.show_url(query_url)
def _do_search_engine(terms, search_url, encoding="UTF-8"): """Show an url searching for @search_url with @terms""" query_url = search_url.replace("{searchTerms}", _urlencode(terms)) utils.show_url(query_url)
def activate(self, obj, iobj): filepath = obj.object email = email_from_leaf(iobj) # FIXME: revisit for unicode email addresses url = "mailto:%s?attach=%s" % (email, filepath) utils.show_url(url)
def _do_search_engine(terms, search_url, encoding="UTF-8"): """Show an url searching for @search_url with @terms""" #search_url = search_url.encode(encoding, "ignore") #terms_enc = terms.encode(encoding, "ignore") query_url = search_url.replace("%s", quote(terms)) utils.show_url(query_url)
def activate(self, leaf, iobj): dest_lang = iobj.object params = urllib.urlencode(dict(u=leaf.object, sl='auto', tl=dest_lang)) url = 'http://translate.google.com/translate?' + params utils.show_url(url)
def activate(self, leaf, iobj): text = urllib.quote(unicode(leaf.object).encode('utf-8')) dest_lang = iobj.object url = 'http://' + _GOOGLE_TRANSLATE_HOST + _GOOGLE_TRANS_LANG_PATH + \ "#auto|" + dest_lang + "|" + text utils.show_url(url)
def show_help(): """ Show Kupfer help pages, if possible """ if not utils.show_url("ghelp:%s" % version.PACKAGE_NAME): utils.show_url(version.WEBSITE)
def activate(self, leaf, iobj): dest_lang = iobj.object params = urllib.urlencode(dict(u=leaf.object, sl='auto', tl=dest_lang )) url = 'http://translate.google.com/translate?' + params utils.show_url(url)
def activate_multiple(self, objects, iobjects): # FIXME: revisit for unicode email addresses recipients = ",".join(email_from_leaf(I) for I in iobjects) attachlist = "?attach=" + "&attach=".join(L.object for L in objects) url = "mailto:" + recipients + attachlist utils.show_url(url)
def _do_search_engine(terms, search_url, encoding="UTF-8"): """Show an url searching for @search_url with @terms""" search_url = search_url.encode(encoding, "ignore") terms_enc = terms.encode(encoding, "ignore") query_url = search_url.replace("{searchTerms}", _urlencode(terms_enc)) utils.show_url(query_url)
def activate(self, leaf): utils.show_url("https://www.instapaper.com/edit?url=%s" % leaf.object)
def activate(self, leaf): search_url = "https://www.dict.cc/" query_url = search_url + "?" + urllib.parse.urlencode( {"s": leaf.object}) utils.show_url(query_url)
def activate_multiple(self, objects): recipients = ",".join(urllib.quote(contacts.email_from_leaf(L)) for L in objects) url = GMAIL_NEW_MAIL_URL % dict(emails=recipients) utils.show_url(url)
def activate(self, leaf): url_w = "https://web.whatsapp.com/send?phone=" url_number = url_w + leaf.object utils.show_url(url_number)