/offlineimap/head: changeset 156
Moved verbosity checking into UIBase
This commit is contained in:
parent
0361dd4783
commit
c9b4de85b2
@ -22,9 +22,9 @@ import select, sys
|
||||
from threading import *
|
||||
|
||||
class TTYUI(UIBase):
|
||||
def __init__(self, verbose = 0):
|
||||
self.verbose = 0
|
||||
self.iswaiting = 0
|
||||
def __init__(s, verbose = 0):
|
||||
s.verbose = 0
|
||||
s.iswaiting = 0
|
||||
|
||||
def _msg(s, msg):
|
||||
if (currentThread().getName() == 'MainThread'):
|
||||
@ -38,18 +38,6 @@ class TTYUI(UIBase):
|
||||
(accountname, config.get(accountname, "remoteuser"),
|
||||
config.get(accountname, "remotehost")))
|
||||
|
||||
def syncingmessages(s, sr, sf, dr, df):
|
||||
if s.verbose:
|
||||
UIBase.syncingmessages(s, sr, sf, dr, df)
|
||||
|
||||
def loadmessagelist(s, repos, folder):
|
||||
if s.verbose:
|
||||
UIBase.syncingmessages(s, repos, folder)
|
||||
|
||||
def messagelistloaded(s, repos, folder, count):
|
||||
if s.verbose:
|
||||
UIBase.messagelistloaded(s, repos, folder, count)
|
||||
|
||||
def sleep(s, sleepsecs):
|
||||
s.iswaiting = 1
|
||||
try:
|
||||
|
@ -140,9 +140,6 @@ class ThreadFrame(Frame):
|
||||
|
||||
|
||||
class TkUI(UIBase):
|
||||
def __init__(self, verbose = 0):
|
||||
self.verbose = verbose
|
||||
|
||||
def isusable(s):
|
||||
try:
|
||||
Tk().destroy()
|
||||
@ -282,17 +279,4 @@ class TkUI(UIBase):
|
||||
time.sleep(sleepsecs)
|
||||
return s.sleeping_abort
|
||||
|
||||
################################################## Copied from TTY
|
||||
|
||||
def syncingmessages(s, sr, sf, dr, df):
|
||||
if s.verbose:
|
||||
UIBase.syncingmessages(s, sr, sf, dr, df)
|
||||
|
||||
def loadmessagelist(s, repos, folder):
|
||||
if s.verbose:
|
||||
UIBase.syncingmessages(s, repos, folder)
|
||||
|
||||
def messagelistloaded(s, repos, folder, count):
|
||||
if s.verbose:
|
||||
UIBase.messagelistloaded(s, repos, folder, count)
|
||||
|
||||
|
@ -22,6 +22,9 @@ import re, time, sys, traceback
|
||||
from StringIO import StringIO
|
||||
|
||||
class UIBase:
|
||||
def __init__(s, verbose = 0):
|
||||
s.verbose = verbose]
|
||||
|
||||
################################################## UTILS
|
||||
def _msg(s, msg):
|
||||
"""Generic tool called when no other works."""
|
||||
@ -77,16 +80,19 @@ class UIBase:
|
||||
folder.getname())
|
||||
|
||||
def loadmessagelist(s, repos, folder):
|
||||
if s.verbose:
|
||||
s._msg("Loading message list for %s[%s]" % (s.getnicename(repos),
|
||||
folder.getname()))
|
||||
|
||||
def messagelistloaded(s, repos, folder, count):
|
||||
if s.verbose:
|
||||
s._msg("Message list for %s[%s] loaded: %d messages" % \
|
||||
(s.getnicename(repos), folder.getname(), count))
|
||||
|
||||
############################## Message syncing
|
||||
|
||||
def syncingmessages(s, sr, sf, dr, df):
|
||||
if s.verbose:
|
||||
s._msg("Syncing messages %s[%s] -> %s[%s]" % (s.getnicename(sr),
|
||||
sf.getname(),
|
||||
s.getnicename(dr),
|
||||
|
Loading…
Reference in New Issue
Block a user