COMMENT = 0
TWEET = 1
APP_ROOT = os.path.dirname(os.path.abspath(__file__))
DATA_ROOT = os.path.expanduser('~/.weii')
AVATER_SIZE = 64
AVATER_IN_TWEET_SIZE = 40
TRAY_ICON = os.path.join(APP_ROOT, 'theme/logo.png')
ALL_ACCOUNTS = os.path.join(APP_ROOT, 'theme/all.png')
APP_LOGO = os.path.join(APP_ROOT, 'theme/logo.png')
ALL_ACCOUNTS_AVATAR = os.path.join(APP_ROOT, 'theme/logo.png')
BROKEN_AVATAR = os.path.join(APP_ROOT, 'theme/broken_avatar.png')
BROKEN_IMAGE = os.path.join(APP_ROOT, 'theme/broken_image.png')
BUBLE = os.path.join(APP_ROOT, 'theme/buble.png')
CURSOR_MAGNIFY = os.path.join(APP_ROOT, 'theme/cursor_magnify.png')
DATABASE = os.path.join(DATA_ROOT, 'db.sqlite')
GLOBAL_CONFIG = os.path.join(DATA_ROOT, 'conf.ini')
KEYWORDS_FILE = os.path.join(DATA_ROOT, 'keywords.txt') SIGNAL_TASK_FINISH = SIGNAL('taskFinished')
class Task(QObject):
    def __init__(self, func, args=(), kwargs={}, callback=None, parent=None):
    def run(self):
def start(func, args=(), kwargs={}, callback=None):
def onFinished(task, args): INFO = 'Info'
SKIN = 'Skin'
ICON = 'Icon'
THEME_CONFIG = 'conf.ini'
    THEME_ROOT = os.path.join( constant.APP_ROOT, 'theme', theme_name )
    ICON_ROOT = os.path.join( THEME_ROOT, 'icon' )
class Theme():
def __loadTheme( theme_name = 'default' ):
def setCurrentTheme(theme_name):
def getCurrentTheme():
def getParameter(section, key):
def getPath(): ALL_ACCOUNTS = ('all_accounts', 'all_accounts')
SIGNAL_ACCOUNT_ADDED = SIGNAL('AccountAdded')
SIGNAL_ACCOUNT_DELETED = SIGNAL('AccountDeleted')
class Account:
    def __init__(self, account_plugin, if_send, if_receive):
    def getUserInfo(self, uid='', screen_name=''):
    def getEmotionDict(self, emotion_list):
    def setProxy(self, host, port):
def dummyInitAccount():
def initAccount():
def getEmitter():
def getCurrentAccount():
def setCurrentAccount(service, username):
def getAllAccount():
def addAccount(service, uid, username, access_token, data='', proxy={}):
def deleteAccount(account): def getLogger(name):
def setLogLevel(level): class IconButton(QToolButton):
    def __init__(self, parent=None):
    def loadIcon(self, icon_file_name):
    def setBuble(self, count):
    def paintEvent(self, ev): class StackedWidget(QWidget):
    def __init__(self, parent=None):
    def addWidget(self, w):
    def removeWidget(self, w):
    def currentWidget(self):
    def setCurrentWidget(self, w):
    def showCurrentWidget(self):
    def sizeHint(self):
    def setScrollPosition(self, w, pos):
    def getScrollPosition(self, w):
    def count(self): class TreeWidgetItem(QTreeWidgetItem):
class SettingWindow(QDialog):
class WebView(QDialog):
class AccountOption(QWidget):
class SingleAccountWidget(QWidget):
class NetworkOption(QWidget):
    def __init__(self, parent, strings):
    def __hash__(self):
    def __init__(self, parent=None):
    def setupUI(self):
    def expandFirstLayer(self):
    def onItemClicked_Tree(self, tree_widget_item, column):
    def onAccountDelete(self, account):
    def addAccountOption(self):
        def addAccount(account):
    def addNetworkOption(self):
    def __init__(self, url, callback_url, parent=None):
    def setupUI(self):
    def onUrlChange(self, url):
    def getRedirectedUrl(self):
    def __init__(self, parent=None):
    def setupUI(self):
    def updateUI(self, service, access_token, access_token_secret):
    def initItems(self):
    def onClicked_BtnAdd(self):
    def retrieveData(self, service, redirected_url, data, plugin_class, proxy):
    def addAccount(self, service):
    def __init__(self, account, parent=None):
    def setupUI(self):
    def onClicked_BtnDelete(self):
    def onClicked_BtnApply(self):
    def __init__(self, parent=None):
    def setupUI(self):
    def onClicked_BtnApply(self): SIGNAL_SELECTED = SIGNAL('selected')
SIGNAL_UNSELECTED = SIGNAL('unselected')
class AccountButton(QLabel):
class PicButton(QLabel):
class NewTweetWindow(QDialog):
    def __init__(self, account, parent=None):
    def convertToGreyscale(self, image):
    def mouseReleaseEvent(self, ev):
    def __init__(self, image=None, parent=None):
    def mouseReleaseEvent(self, ev):
    def __init__(self, parent=None):
    def setupUI(self):
    def renderUI(self):
    def updateUI(self, result_list):
    def selectAccount(self, account):
    def unselectAccount(self, account):
    def getSelectedAccounts(self):
    def sendTweet(self, accounts, text, pic):
    def onClicked_BtnSend(self):
    def onClicked_UploadPic(self): class AccountStruct:
    class Plugin:
class LabelButton(QLabel):
class AccountButton(LabelButton):
class AccountGroup(QWidget):
    def __init__(self, *argv):
    def mouseReleaseEvent(self, ev):
    def __init__(self, account, parent=None):
    def mouseReleaseEvent(self, ev):
    def __init__(self, parent=None):
    def setupUI(self):
    def addAccount(self, account):
    def enterEvent(self, ev):
    def leaveEvent(self, ev):
    def onAccountAdded(self, account):
    def onAccountDeleted(self, account):
    def onClicked_Account(self, account):
LEFT_ARROW = '◀'
RIGHT_ARROW = '▶'
import imghdr
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from app import constant, easy_thread
from app import theme_manager
from app import account_manager
from app import logger
from app.widget import icon_button
from app.widget import stacked_widget
from app.widget import setting_window
from app.widget import new_tweet_window
from app.widget import account_group
from app.widget.ContentWidget import *
#!/usr/bin/env python3
# coding=utf-8



log = logger.getLogger(__name__)

# TODO: round-corner tooltip
MainWindow_QSS = '''
MainWindow {
    background-color:%s;
    background-image:url(%s);
    background-repeat:no-repeat;
    padding: 5px
}
QToolButton {
    width:32 px; height:32 px;
    border-style: outset;
    border-radius: 5px;
}
QToolButton:hover {
    background-color:%s
}
QLabel#account {
    color: white;
    font-size: 16px;
    font-weight: bold;
}
'''

SIGNAL_UPDATE_UNREADS = SIGNAL('updateUnreads')

class ButtonGroup:
    '''
    Ensure that only one button can be activated
    '''

    def __init__( self, group, action ):
        '''
        @param group: List of buttons
        @param action: Function object that will be applied to activated button
                        def action(button):
        '''
        self.group = group
        self.action = action
        self.current_button = self.group[0]

    def setActive( self, button ):
        if(button in self.group):
            self.current_button.setStyleSheet( '' )
            self.current_button = button
            self.action( button )
            
    def getCurrent(self):
        return self.current_button
    
class ScrollArea(QScrollArea):
    def resizeEvent(self, ev):
        if(self.verticalScrollBar().isVisible()):
            scrollbar_width = self.verticalScrollBar().width() + 5  # 5 for additional space
        else:
            scrollbar_width = 2 # 2 for additional space
        self.widget().setFixedWidth(self.width() - scrollbar_width)

class MainWindow( QDialog ):
    '''
    Main window for app
    '''

    def __init__( self, parent = None ):
        super( MainWindow, self ).__init__( parent )
        self.first_show = True

        self.setWindowTitle('weii')
        self.setupTray()
        self.setMinimumSize( 400, 600 )
        self.setupUI()
        self.renderUI()
        self.renderUserInfo()
        
        # Show home by default

        self.home.setStyleSheet( 'background-color: %s;' % theme_manager.getParameter('Skin', 'icon-chosen') )