import imghdr import time from PyQt4.QtCore import * from PyQt4.QtGui import * from app import constant, theme_manager from app import logger from app import misc from app import easy_thread from app.widget import picture_viewer from app.widget import text_editor from app.plugin import weiBaseException import urllib log = logger.getLogger(__name__) at_terminator = set(''' ~!@#$%^&*()+`={}|[]\;':",./<>?~!¥×()、;:‘’“”《》?,。''') url_legal = set('''!#$&'()*+,/:;=?@-._~''' + ''.join([chr(c) for c in range(ord('0'), ord('9')+1)]) + ''.join([chr(c) for c in range(ord('a'), ord('z')+1)]) + ''.join([chr(c) for c in range(ord('A'), ord('Z')+1)])) SIGNAL_FINISH = SIGNAL('downloadFinished') SIGNAL_THUMBNAIL_CLICKED = SIGNAL('thumbnailClicked') SIGNAL_RESPONSE_CLICKED = SIGNAL('responseClicked') SIGNAL_SUCCESSFUL_RESPONSE = SIGNAL('successfulResponse') class Text(QLabel): def __init__(self, text, parent=None): super(Text, self).__init__(text, parent)
# coding=utf-8 import urllib.parse from PyQt4.QtCore import * from PyQt4.QtGui import * from app import account_manager, theme_manager from app import logger from app import easy_thread from app.widget import text_editor from app.plugin import weiBaseException log = logger.getLogger(__name__) SIGNAL_SELECTED = SIGNAL('selected') SIGNAL_UNSELECTED = SIGNAL('unselected') class AccountButton(QLabel): ''' A button with two states: activated(display original image) and deactivated(greyscaled image) ''' def __init__(self, account, parent=None): super(AccountButton, self).__init__(parent) self.account = account self.enabled = account.if_send self.pixmaps = [ # Greyscaled logo QPixmap.fromImage(self.convertToGreyscale(account.service_icon)),