'Sleep if the account is set to autorefresh.
:returns: 0:timeout expired, 1: canceled the timer,
2:request to abort the program,
100: if configured to not sleep at all.'

def _sleeper(self):

    if (not self.refreshperiod):
        return 100
    kaobjs = []
    if hasattr(self, 'localrepos'):
        kaobjs.append(self.localrepos)
    if hasattr(self, 'remoterepos'):
        kaobjs.append(self.remoterepos)
    for item in kaobjs:
        item.startkeepalive()
    refreshperiod = int((self.refreshperiod * 60))
    sleepresult = self.ui.sleep(refreshperiod, self)
    for item in kaobjs:
        item.stopkeepalive()
    if sleepresult:
        if (Account.abort_soon_signal.is_set() or Account.abort_NOW_signal.is_set()):
            return 2
        self.quicknum = 0
        return 1
    return 0
