def update_url_buttons (self): if hasattr(self, 'shorten') and hasattr(self,'unshorten'): if misc.find_urls(self.message.GetValue()): self.shorten.Enable() self.unshorten.Enable() else: self.shorten.Disable() self.unshorten.Disable()
def update_url_buttons(self): if hasattr(self, 'shorten') and hasattr(self, 'unshorten'): if misc.find_urls(self.message.GetValue()): self.shorten.Enable() self.unshorten.Enable() else: self.shorten.Disable() self.unshorten.Disable()
def GetURLList(self): urls = [] tweet = self.message.GetValue() # If there is a reasonable selection of no more than 1 word, add it to the urls list. # selecting sometimes includes prior or subsequent spaces; remove. sel = self.message.GetStringSelection().strip() logging.debug("len sel: %s, len tweet: %s, sel: %s, tweet: %s" % (len(sel), len(tweet), sel, tweet)) # useful selection, not multi-word, not bit.ly if len(sel) > 3 and " " not in sel and "bit.ly" not in sel: logging.debug("Adding selection as URL: %s" % (sel)) urls.append(sel) # Find URLs from tweet. urls.extend(misc.find_urls(tweet)) return urls
def GetURLList(self): urls = [] tweet = self.message.GetValue() # If there is a reasonable selection of no more than 1 word, add it to the urls list. # selecting sometimes includes prior or subsequent spaces; remove. sel = self.message.GetStringSelection().strip() logging.debug("len sel: %s, len tweet: %s, sel: %s, tweet: %s" % (len(sel), len(tweet), sel, tweet)) # useful selection, not multi-word if len(sel) > 3 and " " not in sel: logging.debug("Adding selection as URL: %s" % (sel)) urls.append(sel) # Find URLs from tweet. urls.extend(misc.find_urls(tweet)) return urls
def get_urls(self, index=None, item=None): try: urls = misc.find_urls(self.get_text(index, item)) except: urls = [] return urls