Example #1
0
 def Quote (self, buffer=None, index=None):
  """Allows you to quote the current tweet."""

  try:
   user = buffer.get_screen_name(index)
   if 'quoted_status' not in buffer[index]:
    id = buffer[index]['id']
   else:
    id = buffer[index]['quoted_status']['id']
   tweet_link = u"https://twitter.com/%s/statuses/%s" % (user, str(id))
  except:
   logging.debug("Quoter: Unable to retrieve post to reply to.")
   return output.speak(_("Item is not a post."), True)
  if self.session.config['UI']['DMSafeMode'] and 'source' not in buffer[index]:
   logging.debug("Quoter: Preventing quote of direct message in DM safe mode...")
   return output.speak(_("Cannot quote a direct message while DM safe mode is enabled."), True)
  title="Quote"
  choice = 0
  if self.session.config['UI']['RTStyle'] == 0 and 'source' in buffer[index]:
   choice = question_dialog(caption=_("Quote"), message=_("Would you like to add a comment?"))
   if choice == wx.ID_CANCEL:
    return output.speak(_("Canceled."), True)
   elif choice == wx.ID_NO:
    return call_threaded(self.session.post_update, text=tweet_link)
   else:
    return   self.NewTweet(buffer, index, tweet_link, title)
  elif self.session.config['UI']['RTStyle'] == 1:
   logging.debug("Retweeter: Automatically retweeting...")
   call_threaded(self.session.post_retweet, id)
  elif self.session.config['UI']['RTStyle'] == 2 or 'source' not in buffer[index]:
   self.NewTweet(buffer, index, tweet_link, title)
Example #2
0
 def Retweet (self, buffer=None, index=None):
  """Allows you to retweet (RT) the current tweet."""

  try:
   user = buffer.get_screen_name(index)
   text = templates.retweetTemplate(user, buffer.get_text(index))
   if 'retweeted_status' not in buffer[index]:
    id = buffer[index]['id']
   else:
    id = buffer[index]['retweeted_status']['id']
  except:
   logging.debug("Retweeter: Unable to retrieve post to reply to.")
   return output.speak(_("Item is not a post."), True)
  if self.session.config['UI']['DMSafeMode'] and 'source' not in buffer[index]:
   logging.debug("Retweeter: Preventing retweet of direct message in DM safe mode...")
   return output.speak(_("Cannot retweet a direct message while DM safe mode is enabled."), True)
  if self.session.is_current_user(user):
   logging.debug("Retweeter: Preventing retweet of user's own tweet...")
   return output.speak(_("Cannot retweet your own tweet."), True)
  title="Retweet"
  choice = 0
  if self.session.config['UI']['RTStyle'] == 0 and 'source' in buffer[index]:
   choice = question_dialog(caption=_("Retweet"), message=_("Would you like to add a comment?"))
   if choice == wx.ID_CANCEL:
    return output.speak(_("Canceled."), True)
   elif choice == wx.ID_NO:
    return call_threaded(self.session.post_retweet, id)
   else:
    return   self.NewTweet(buffer, index, text, title)
  elif self.session.config['UI']['RTStyle'] == 1:
   logging.debug("Retweeter: Automatically retweeting...")
   call_threaded(self.session.post_retweet, id)
  elif self.session.config['UI']['RTStyle'] == 2 or 'source' not in buffer[index]:
   self.NewTweet(buffer, index, text, title)
Example #3
0
def check_for_update():
    if not paths.is_frozen():
        return
    url = updater.find_update_url(application.update_url, application.version)
    if url is None:
        return
    new_path = os.path.join(paths.app_data_path(application.name), 'updates',
                            'update.zip')
    app_updater = updater.AutoUpdater(url,
                                      new_path,
                                      'bootstrap.exe',
                                      app_path=paths.app_path(),
                                      postexecute=paths.executable_path(),
                                      finish_callback=update_complete)
    d = question_dialog(
        parent=application.main_frame,
        caption=_("Update %s") % application.name,
        message=
        _("An update for %s is available, would you like to download and install it now?"
          ) % application.name,
        style=wx.YES | wx.NO | wx.ICON_WARNING)
    if d != wx.ID_YES:
        return logging.debug("User denied the update request!")
    logging.debug("User requested %s update.  Initialising update process." %
                  application.name)
    app_updater.start_update()
Example #4
0
 def remove_item(self, index=None):
     item = self[index]
     screen_name = None
     try:
         screen_name = self.get_screen_name(index)
         twitter_id = self[index]['id']
     except:
         pass
     item_type = self.get_item_type(index)
     if self.session.config['UI']['confirmRemovePost']:
         if self.session.is_current_user(screen_name) or item_type == "DM":
             confirmation = question_dialog(
                 caption=_("Remove Tweet"),
                 message=
                 _("The post you are trying to remove will also be deleted from Twitter.  Do you still wish to remove it?"
                   ))
             if confirmation != wx.ID_YES:
                 return output.speak(_("Canceled."), True)
     if self.session.is_current_user(screen_name) or item_type == "DM":
         try:
             if item_type == "DM":
                 self.session.api_call(
                     "destroy_direct_message",
                     preexec_message=_("Deleting direct message"),
                     action=_("deleting direct message"),
                     id=twitter_id)
             else:
                 self.session.api_call("destroy_status",
                                       preexec_message=_("removing item"),
                                       action=_("removing item"),
                                       id=twitter_id)
         except TweepError as e:
             if e.response is None or e.response.status != 404:
                 raise
     super(Twitter, self).remove_item(index)
Example #5
0
 def Exit(self):
  """Exits The Qube."""
  if not hasattr(global_vars, 'shutdown_lock'):
   global_vars.shutdown_lock = threading.Lock()
  with global_vars.shutdown_lock:
   if config.main['client']['AskForExit']:
    d = question_dialog(parent=application.main_frame, caption=_("Exit %s") % application.name, message=_("Are you sure you wish to exit %s?") % application.name, style=wx.YES|wx.NO|wx.ICON_WARNING)
    if d!= wx.ID_YES:
     return output.speak(_("Canceled."), True)
   output.speak(_("Exiting %s.") % application.name, True)
   shutdown.exit()
Example #6
0
def check_for_update():
 if not paths.is_frozen():
  return
 url = updater.find_update_url(application.update_url, application.version)
 if url is None:
  return
 new_path = os.path.join(paths.app_data_path(application.name), 'updates', 'update.zip')
 app_updater = updater.AutoUpdater(url, new_path, 'bootstrap.exe', app_path=paths.app_path(), postexecute=paths.executable_path(), finish_callback=update_complete)
 d = question_dialog(parent=application.main_frame, caption=_("Update %s") % application.name, message=_("An update for %s is available, would you like to download and install it now?") % application.name, style=wx.YES|wx.NO|wx.ICON_WARNING)
 if d!= wx.ID_YES:
  return logging.debug("User denied the update request!")
 logging.debug("User requested %s update.  Initialising update process." % application.name)
 app_updater.start_update()
Example #7
0
 def Exit(self):
     """Exits The Qube."""
     if not hasattr(global_vars, 'shutdown_lock'):
         global_vars.shutdown_lock = threading.Lock()
     with global_vars.shutdown_lock:
         if config.main['client']['AskForExit']:
             d = question_dialog(
                 parent=application.main_frame,
                 caption=_("Exit %s") % application.name,
                 message=_("Are you sure you wish to exit %s?") %
                 application.name,
                 style=wx.YES | wx.NO | wx.ICON_WARNING)
             if d != wx.ID_YES:
                 return output.speak(_("Canceled."), True)
         output.speak(_("Exiting %s.") % application.name, True)
         shutdown.exit()
Example #8
0
    def Retweet(self, buffer=None, index=None):
        """Allows you to retweet (RT) the current tweet."""

        try:
            user = buffer.get_screen_name(index)
            text = templates.retweetTemplate(user, buffer.get_text(index))
            if 'retweeted_status' not in buffer[index]:
                id = buffer[index]['id']
            else:
                id = buffer[index]['retweeted_status']['id']
        except:
            logging.debug("Retweeter: Unable to retrieve post to reply to.")
            return output.speak(_("Item is not a post."), True)
        if self.session.config['UI']['DMSafeMode'] and 'source' not in buffer[
                index]:
            logging.debug(
                "Retweeter: Preventing retweet of direct message in DM safe mode..."
            )
            return output.speak(
                _("Cannot retweet a direct message while DM safe mode is enabled."
                  ), True)
        if self.session.is_current_user(user):
            logging.debug(
                "Retweeter: Preventing retweet of user's own tweet...")
            return output.speak(_("Cannot retweet your own tweet."), True)
        title = "Retweet"
        choice = 0
        if self.session.config['UI']['RTStyle'] == 0 and 'source' in buffer[
                index]:
            choice = question_dialog(
                caption=_("Retweet"),
                message=_("Would you like to add a comment?"))
            if choice == wx.ID_CANCEL:
                return output.speak(_("Canceled."), True)
            elif choice == wx.ID_NO:
                return call_threaded(self.session.post_retweet, id)
            else:
                return self.NewTweet(buffer, index, text, title)
        elif self.session.config['UI']['RTStyle'] == 1:
            logging.debug("Retweeter: Automatically retweeting...")
            call_threaded(self.session.post_retweet, id)
        elif self.session.config['UI'][
                'RTStyle'] == 2 or 'source' not in buffer[index]:
            self.NewTweet(buffer, index, text, title)
Example #9
0
    def Quote(self, buffer=None, index=None):
        """Allows you to quote the current tweet."""

        try:
            user = buffer.get_screen_name(index)
            if 'quoted_status' not in buffer[index]:
                id = buffer[index]['id']
            else:
                id = buffer[index]['quoted_status']['id']
            tweet_link = u"https://twitter.com/%s/statuses/%s" % (user,
                                                                  str(id))
        except:
            logging.debug("Quoter: Unable to retrieve post to reply to.")
            return output.speak(_("Item is not a post."), True)
        if self.session.config['UI']['DMSafeMode'] and 'source' not in buffer[
                index]:
            logging.debug(
                "Quoter: Preventing quote of direct message in DM safe mode..."
            )
            return output.speak(
                _("Cannot quote a direct message while DM safe mode is enabled."
                  ), True)
        title = "Quote"
        choice = 0
        if self.session.config['UI']['RTStyle'] == 0 and 'source' in buffer[
                index]:
            choice = question_dialog(
                caption=_("Quote"),
                message=_("Would you like to add a comment?"))
            if choice == wx.ID_CANCEL:
                return output.speak(_("Canceled."), True)
            elif choice == wx.ID_NO:
                return call_threaded(self.session.post_update, text=tweet_link)
            else:
                return self.NewTweet(buffer, index, tweet_link, title)
        elif self.session.config['UI']['RTStyle'] == 1:
            logging.debug("Retweeter: Automatically retweeting...")
            call_threaded(self.session.post_retweet, id)
        elif self.session.config['UI'][
                'RTStyle'] == 2 or 'source' not in buffer[index]:
            self.NewTweet(buffer, index, tweet_link, title)
Example #10
0
File: main.py Project: Oire/TheQube
 def remove_item(self, index = None):
  item = self[index]
  screen_name=None
  try:
   screen_name = self.get_screen_name(index)
   twitter_id = self[index]['id']
  except:
   pass
  item_type = self.get_item_type(index)
  if self.session.config['UI']['confirmRemovePost']:
   if self.session.is_current_user(screen_name) or item_type == "DM":
    confirmation = question_dialog(caption=_("Remove Tweet"), message=_("The post you are trying to remove will also be deleted from Twitter.  Do you still wish to remove it?"))
    if confirmation != wx.ID_YES:
     return output.speak(_("Canceled."), True)
  if self.session.is_current_user(screen_name) or item_type == "DM":
   try:
    if item_type == "DM":
     self.session.api_call("destroy_direct_message", preexec_message=_("Deleting direct message"), action=_("deleting direct message"), id=twitter_id)
    else:
     self.session.api_call("destroy_status", preexec_message=_("removing item"), action=_("removing item"), id=twitter_id)
   except TweepError as e:
    if e.response is None or e.response.status != 404:
     raise
  super(Twitter, self).remove_item(index)