diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 42fcc8df..7a39b750 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -39,6 +39,7 @@ from debug import logger import subprocess import datetime from helper_sql import * +from class_hashtag import * try: from PyQt4 import QtCore, QtGui @@ -58,65 +59,6 @@ except AttributeError: def _translate(context, text): return QtGui.QApplication.translate(context, text) -class hashtag(object): - - _instance = None - class Singleton: - def __init__(self): - #define class variables here - self.string = "" - self.dic = {} - self.array = [] - - def __init__(self): - if hashtag._instance is None: - # Create and remember instanc - hashtag._instance = hashtag.Singleton() - self._EventHandler_instance = hashtag._instance - - def __getattr__(self, aAttr): - return getattr(self._instance, aAttr) - - def __setattr__(self, aAttr, aValue): - return setattr(self._instance, aAttr, aValue) - - def update_array(self): - for w in sorted(self.dic, key=self.dic.get, reverse=True): - self.array.append(w) - - def extract (self,sentence): - array = [] - pattern='#' - count = 0 - for word in sentence.split(' '): - for word2 in word.split('\\n'): - if word2.startswith(pattern): - for word3 in word2.split('#'): - if(word3 != ''): - array.append('#'+word3.lower()) - print " "+word3+"\n" - count+=1 - self.update_dic(array) - return count - #return array - - def update_dic (self, array): - for item in array: - if (self.dic.get(item)==None): - self.dic[item]=1 - else: - self.dic[item]=self.dic[item]+1 - - def get_color(self, value , sum): - x = value/float(sum) - if(x==0.5): - return 0xffff - elif(x>0.5): - return int(x * 255) - else: - return int(255*x)+0xff00 - - def identiconize(address): size = 48