Esempio n. 1
0
 def ListUrls(self, buffer=None, index=None):
  """List any URLs or mentions of a twitter screen name in a dialog."""

  urls = []
  try:
   urls.extend(buffer.get_urls(index))
  except:
   pass
  try:
   urls.extend(["@%s" % i for i in buffer.get_mentions(index)])
  except:
   pass
  try:
   urls.extend(["@%s" % buffer.get_screen_name(index)])
  except:
   pass
  urls = misc.RemoveDuplicates(urls)
  if not urls:
   logging.debug("No web addresses or usernames in current tweet.")
   return output.speak(_("No URLs detected in current post."), 1)
  logging.debug("Launching URL choice dialog.")
  dlg = modal_dialog(core.gui.ListURLsDialog, parent=self.session.frame, urls=urls)
  url = dlg.urls_list.GetStringSelection().replace("@","http://ww	w.twitter.com/")
  logging.debug("Opening URL: %s " % url)
  misc.open_url_in_browser(url)
Esempio n. 2
0
 def retrieve_access_token(self):
     output.speak(
         _("Please wait while an access token is retrieved from Twitter."),
         True)
     self.check_twitter_connection()
     auth_props = self.auth_handler.get_authentication_tokens()
     oauth_token = auth_props['oauth_token']
     oauth_token_secret = auth_props['oauth_token_secret']
     url = auth_props['auth_url']
     misc.open_url_in_browser(url)
     dlg = wx.TextEntryDialog(
         caption=_("Twitter Login"),
         message=
         _("Please enter the verification code from Twitter for session %s")
         % self.name,
         parent=self.frame)
     dlg.Raise()
     if dlg.ShowModal() != wx.ID_OK:
         raise ValueError("User canceled login")
     verification = dlg.GetValue().strip()
     self.auth_handler = Twython(str(self.config['oauth']['twitterKey']),
                                 str(self.config['oauth']['twitterSecret']),
                                 oauth_token, oauth_token_secret)
     token = self.auth_handler.get_authorized_tokens(verification)
     output.speak(_("Retrieved access token from Twitter."), True)
     self.config['oauth']['userKey'] = token['oauth_token']
     self.config['oauth']['userSecret'] = token['oauth_token_secret']
     logging.debug("Successfully retrieved an oAuth access token for user.")
     self.login()
Esempio n. 3
0
    def ListUrls(self, buffer=None, index=None):
        """List any URLs or mentions of a twitter screen name in a dialog."""

        urls = []
        try:
            urls.extend(buffer.get_urls(index))
        except:
            pass
        try:
            urls.extend(["@%s" % i for i in buffer.get_mentions(index)])
        except:
            pass
        try:
            urls.extend(["@%s" % buffer.get_screen_name(index)])
        except:
            pass
        urls = misc.RemoveDuplicates(urls)
        if not urls:
            logging.debug("No web addresses or usernames in current tweet.")
            return output.speak(_("No URLs detected in current post."), 1)
        logging.debug("Launching URL choice dialog.")
        dlg = modal_dialog(core.gui.ListURLsDialog,
                           parent=self.session.frame,
                           urls=urls)
        url = dlg.urls_list.GetStringSelection().replace(
            "@", "http://ww	w.twitter.com/")
        logging.debug("Opening URL: %s " % url)
        misc.open_url_in_browser(url)
Esempio n. 4
0
 def interact (self, index=None):
  """Opens the first URL in a Twitter item. Currently does not work if the only URL is a Twitter username.

"""

  urls = self.get_urls(index)
  if not urls:
   logging.debug("No web addresses or usernames in current item.")
   return output.speak(_("No URLs detected in current item."), True)
  url = urls[0]
  output.speak(_("Opening URL: %s" % url), True)
  logging.debug("Opening URL: %s" % url)
  misc.open_url_in_browser(url)
Esempio n. 5
0
 def ViewHelp(self, evt):
     evt.Skip()
     misc.open_url_in_browser(application.wx_appPath +
                              "\\documentation\\readme.html")
Esempio n. 6
0
 def ViewHelp(self, evt):
  evt.Skip()
  misc.open_url_in_browser(application.wx_appPath + "\\documentation\\readme.html")