Skip to content

Commit ac9ba1e

Browse files
committed
cleanup; option to not display text when there is an image; replaced print statements with logging calls.
1 parent acc1e1e commit ac9ba1e

9 files changed

+134
-237
lines changed

CommandBar.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import talkshowConfig
22
import pyglet
33

4-
#from widget import Widget
4+
from talkshowLogger import logger
5+
6+
debug = logger.debug
7+
info = logger.info
8+
warn = logger.warn
59

610
class CommandBar(object):
711

@@ -45,12 +49,12 @@ def __init__(self, screen, orientation=0):
4549

4650

4751
if self.orientation == 0:
48-
print "orientation 0"
52+
debug("orientation 0")
4953
increaseX = int(self.style.warning.width) + self.imagePadding[1] + self.imagePadding[3]
5054
increaseY = 0
5155

5256
else:
53-
print "orientation 1"
57+
debug("orientation 1")
5458
increaseX = 0
5559
increaseY = int(self.style.warning.height) + self.imagePadding[0] + self.imagePadding[2]
5660

TO_DO_s.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
# TODO: Add a method in Talkshow object to test if all is well configured.
4747

4848

49-
# replace print with proper logging calls
5049
# strange paths replace by os.dirsep
5150
# refactor code into more classes/files
5251
# documentation on structure

delayed_call.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
import pyglet
22
import weakref
33

4+
5+
from talkshowLogger import logger
6+
7+
debug = logger.debug
8+
info = logger.info
9+
warn = logger.warn
10+
411
class NoCookie: pass
512

613
class DelayedCall:
@@ -63,7 +70,7 @@ def _callme(ref):
6370

6471
def cancel(self):
6572
if self.scheduled:
66-
print "cancel!"
73+
debug("cancel!")
6774
pyglet.clock.unschedule(self.identifier)
6875
self.scheduled = False
6976
self.func = None

parseCSS.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
import tinycss
88
import os
99

10+
from talkshowLogger import logger
11+
12+
debug = logger.debug
13+
info = logger.info
14+
warn = logger.warn
1015

1116
class Struct(object):
1217
'''Struct to convert a python dict (which you access by myDict["key1"]) into a class,
@@ -34,7 +39,7 @@ def __init__(self, filename):
3439
if os.path.exists(filename):
3540
self.parseFile()
3641
else:
37-
print "filename %s not found" % filename
42+
warn( "filename %s not found" % filename)
3843

3944
def parseFile(self):
4045
parser = tinycss.make_parser()
@@ -44,12 +49,12 @@ def parseFile(self):
4449
try:
4550
self.dict = {removeHashesAndDots(rule.selector.as_css()):{declaration.name:makeFloatsOutOfPercentages(declaration.value.as_css()) for declaration in rule.declarations } for rule in stylesheet.rules}
4651
except Exception, e:
47-
print "problem with submethod, only generating basicDict"
52+
warn( "problem with submethod, only generating basicDict")
4853
raise e
4954
try:
5055
self.style = Struct(**{removeHashesAndDots(rule.selector.as_css()):Struct(**{declaration.name.replace('-','_'):makeFloatsOutOfPercentages(declaration.value.as_css()) for declaration in rule.declarations }) for rule in stylesheet.rules})
5156
except Exception, e:
52-
print "problem with submethod, only generating basicDict and dict"
57+
warn( "problem with submethod, only generating basicDict and dict")
5358
raise e
5459

5560

0 commit comments

Comments
 (0)