/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 *
|
from threading import *
|
||||||
|
|
||||||
class TTYUI(UIBase):
|
class TTYUI(UIBase):
|
||||||
def __init__(self, verbose = 0):
|
def __init__(s, verbose = 0):
|
||||||
self.verbose = 0
|
s.verbose = 0
|
||||||
self.iswaiting = 0
|
s.iswaiting = 0
|
||||||
|
|
||||||
def _msg(s, msg):
|
def _msg(s, msg):
|
||||||
if (currentThread().getName() == 'MainThread'):
|
if (currentThread().getName() == 'MainThread'):
|
||||||
@ -38,18 +38,6 @@ class TTYUI(UIBase):
|
|||||||
(accountname, config.get(accountname, "remoteuser"),
|
(accountname, config.get(accountname, "remoteuser"),
|
||||||
config.get(accountname, "remotehost")))
|
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):
|
def sleep(s, sleepsecs):
|
||||||
s.iswaiting = 1
|
s.iswaiting = 1
|
||||||
try:
|
try:
|
||||||
|
@ -140,9 +140,6 @@ class ThreadFrame(Frame):
|
|||||||
|
|
||||||
|
|
||||||
class TkUI(UIBase):
|
class TkUI(UIBase):
|
||||||
def __init__(self, verbose = 0):
|
|
||||||
self.verbose = verbose
|
|
||||||
|
|
||||||
def isusable(s):
|
def isusable(s):
|
||||||
try:
|
try:
|
||||||
Tk().destroy()
|
Tk().destroy()
|
||||||
@ -282,17 +279,4 @@ class TkUI(UIBase):
|
|||||||
time.sleep(sleepsecs)
|
time.sleep(sleepsecs)
|
||||||
return s.sleeping_abort
|
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
|
from StringIO import StringIO
|
||||||
|
|
||||||
class UIBase:
|
class UIBase:
|
||||||
|
def __init__(s, verbose = 0):
|
||||||
|
s.verbose = verbose]
|
||||||
|
|
||||||
################################################## UTILS
|
################################################## UTILS
|
||||||
def _msg(s, msg):
|
def _msg(s, msg):
|
||||||
"""Generic tool called when no other works."""
|
"""Generic tool called when no other works."""
|
||||||
@ -77,16 +80,19 @@ class UIBase:
|
|||||||
folder.getname())
|
folder.getname())
|
||||||
|
|
||||||
def loadmessagelist(s, repos, folder):
|
def loadmessagelist(s, repos, folder):
|
||||||
|
if s.verbose:
|
||||||
s._msg("Loading message list for %s[%s]" % (s.getnicename(repos),
|
s._msg("Loading message list for %s[%s]" % (s.getnicename(repos),
|
||||||
folder.getname()))
|
folder.getname()))
|
||||||
|
|
||||||
def messagelistloaded(s, repos, folder, count):
|
def messagelistloaded(s, repos, folder, count):
|
||||||
|
if s.verbose:
|
||||||
s._msg("Message list for %s[%s] loaded: %d messages" % \
|
s._msg("Message list for %s[%s] loaded: %d messages" % \
|
||||||
(s.getnicename(repos), folder.getname(), count))
|
(s.getnicename(repos), folder.getname(), count))
|
||||||
|
|
||||||
############################## Message syncing
|
############################## Message syncing
|
||||||
|
|
||||||
def syncingmessages(s, sr, sf, dr, df):
|
def syncingmessages(s, sr, sf, dr, df):
|
||||||
|
if s.verbose:
|
||||||
s._msg("Syncing messages %s[%s] -> %s[%s]" % (s.getnicename(sr),
|
s._msg("Syncing messages %s[%s] -> %s[%s]" % (s.getnicename(sr),
|
||||||
sf.getname(),
|
sf.getname(),
|
||||||
s.getnicename(dr),
|
s.getnicename(dr),
|
||||||
|
Loading…
Reference in New Issue
Block a user