Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove commented out code #466

Merged
merged 1 commit into from
Dec 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions enable/pyglet_backend/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ def __init__(self, enable_window, **kwargs):
# draw. If this flag is False, then the draw() method just passes.
self._dirty = True

#for key in kwargs:
# if key not in PygletWindow.VALID_CTOR_KWARGS:
# kwargs.pop(key)
super(PygletWindow, self).__init__(**kwargs)

# use a KeyStateHandler to remember the keyboard state. This
Expand Down
1 change: 0 additions & 1 deletion enable/savage/compliance/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ def openFile(self, filenameOrBuffer):

self.render.document = self.document
except:
#pdb.set_trace()
import traceback
self.render.document = None
traceback.print_exc()
Expand Down
21 changes: 0 additions & 21 deletions enable/savage/svg/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,6 @@ def pathHandler(func):
"""
@wraps(func)
def inner(self, node):
#brush = self.getBrushFromState()
#pen = self.getPenFromState()
#if not (brush or pen):
# return None, []
path = self.renderer.makePath()
results = func(self, node, path)

Expand Down Expand Up @@ -594,9 +590,7 @@ def addImageToDocument(self, node):
def getFontFromState(self):
font = self.renderer.getFont()
family = self.state.get("font-family")
#print 'family', family
if family:
#print "setting font", family
font.face_name = family

style = self.state.get("font-style")
Expand Down Expand Up @@ -627,7 +621,6 @@ def addTextToDocument(self, node):
if not (brush and hasattr(brush, 'IsOk') and brush.IsOk()):
black_tuple = (255,255,255,255)
brush = self.renderer.createBrush(black_tuple)
#print "using black brush"
# TODO: handle <tspan>, <a> and <tref>.
# TODO: handle xml:space="preserve"? The following more or less
# corresponds to xml:space="default".
Expand Down Expand Up @@ -959,7 +952,6 @@ def getBrushFromState(self, path=None):
if type == 'RGB':
r,g,b = details
elif type == "NONE":
#print 'returning null brush'
return self.renderer.NullBrush
opacity = self.state.get('fill-opacity', self.state.get('opacity', '1'))
opacity = float(opacity)
Expand Down Expand Up @@ -987,7 +979,6 @@ def addStrokeToPath(self, path, stroke):
relative = False
if type == type.lower():
relative = True
#ox, oy = path.GetCurrentPoint().Get()
ox, oy = path.GetCurrentPoint()
else:
ox = oy = 0
Expand All @@ -1007,7 +998,6 @@ def reflectPoint(point, relativeTo):
pt = normalizePoint(arg)
path.AddLineToPoint(*pt)
elif type == 'C':
#control1, control2, endpoint = arg
control1, control2, endpoint = sm.map(
normalizePoint, arg
)
Expand All @@ -1017,23 +1007,15 @@ def reflectPoint(point, relativeTo):
control2,
endpoint
)
#~ cp = path.GetCurrentPoint()
#~ path.AddCircle(c1x, c1y, 5)
#~ path.AddCircle(c2x, c2y, 3)
#~ path.AddCircle(x,y, 7)
#~ path.MoveToPoint(cp)
#~ print "C", control1, control2, endpoint

elif type == 'S':
#control2, endpoint = arg
control2, endpoint = sm.map(
normalizePoint, arg
)
if self.lastControl:
control1 = reflectPoint(self.lastControl, path.GetCurrentPoint())
else:
control1 = path.GetCurrentPoint()
#~ print "S", self.lastControl,":",control1, control2, endpoint
self.lastControl = control2
path.AddCurveToPoint(
control1,
Expand Down Expand Up @@ -1087,15 +1069,12 @@ def reflectPoint(point, relativeTo):
#~ Manually closing the path *and* calling CloseSubpath() appears
#~ to give correct results on win32

#pt = self.firstPoints.pop()
#path.AddLineToPoint(*pt)
path.CloseSubpath()

def render(self, context):
if not hasattr(self, "ops"):
return
for op, args in self.ops:
#print op, context, args
op(context, *args)

if __name__ == '__main__':
Expand Down
9 changes: 0 additions & 9 deletions enable/stacked_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ def stacked_preferred_size(container, components=None):
container._cached_preferred_size = container.fixed_preferred_size
return container.fixed_preferred_size

#if container.resizable == "":
# container._cached_preferred_size = container.outer_bounds[:]
# return container.outer_bounds

if components is None:
components = container.components

Expand All @@ -33,7 +29,6 @@ def stacked_preferred_size(container, components=None):

pref_size = component.get_preferred_size()
total_size += pref_size[ndx] + container.spacing
#print container, component, total_size
if pref_size[other_ndx] > max_other_size:
max_other_size = pref_size[other_ndx]

Expand Down Expand Up @@ -133,13 +128,9 @@ def stack_layout(container, components, align):
# If the component is resizable in the other dimension or it exceeds the
# container bounds, set it to the maximum size of the container

#component.set_outer_position(other_ndx, 0)
#component.set_outer_bounds(other_ndx, size[other_ndx])
position[other_ndx] = 0
bounds[other_ndx] = size[other_ndx]
else:
#component.set_outer_position(other_ndx, 0)
#old_coord = component.outer_position[other_ndx]
position[other_ndx] = 0
if align == "min":
pass
Expand Down
9 changes: 0 additions & 9 deletions enable/vtk_backend/vtk_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,12 @@ def __init__(self, render_window_interactor, renderer,
self._mapper.color_level = 255/2.0
self._actor2d.mapper = self._mapper

#self._size = tuple(self._get_control_size())
self._size = [0,0]
self._redraw_needed = True
self._layout_needed = True
#self._gc = self._create_gc(self._size)

rwi.initialize()

#if self.component is not None:
# self._paint()

def _add_observer(self, obj, event, cb):
""" Adds a vtk observer using messenger to avoid generating uncollectable objects. """
obj.add_observer(event, messenger.send)
Expand All @@ -176,7 +171,6 @@ def _vtk_render_event(self, vtk_obj, eventname):
self._rendering = False

def _vtk_expose_event(self, vtk_obj, eventname):
#print "Good gods! A VTK ExposeEvent!"
pass

def _pass_event_to_vtk(self, vtk_obj, eventname):
Expand Down Expand Up @@ -485,15 +479,12 @@ def _paint(self, event=None):


def _set_focus(self):
#print "set_focus unimplemented"
pass

def _capture_mouse(self):
#print "Capture mouse unimplemented"
pass

def _release_mouse(self):
#print "Release mouse unimplemented"
pass

def screen_to_window(self, x, y):
Expand Down
2 changes: 0 additions & 2 deletions kiva/agg/tests/compiled_path_test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,6 @@ def base_helper_lines(self,lines):
(3.0,3.0,agg.path_cmd_move_to, agg.path_flags_none),
(4.0,4.0,agg.path_cmd_line_to, agg.path_flags_none),
(0.0,0.0,agg.path_cmd_stop, agg.path_flags_none),))
#print 'desired:', desired
#print 'actual:', actual

self.assertRavelEqual(actual, desired)

Expand Down
8 changes: 0 additions & 8 deletions kiva/agg/tests/graphics_context_test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,6 @@ def base_lines(self, lines):
(3.0,3.0,agg.path_cmd_move_to, agg.path_flags_none),
(4.0,4.0,agg.path_cmd_line_to, agg.path_flags_none),
(0.0,0.0,agg.path_cmd_stop, agg.path_flags_none),))
#print 'desired:', desired
#print 'actual:', actual

self.assertTrue(allclose(actual,desired))

Expand Down Expand Up @@ -307,8 +305,6 @@ def test_clip_to_rect(self):
gc.line_to(10,10)
gc.clip_to_rect(5,5,5,5)
gc.stroke_path()
#print 'clipping on'
#print gc.bmp_array[:,:,0]
# make sure nothing was drawn in the corner
self.assertEqual(gc.bmp_array[-1,0,0], 255)

Expand All @@ -317,16 +313,12 @@ def test_stroke_path(self):
gc.move_to(0,0)
gc.line_to(5,5)
gc.stroke_path()
#print
#print "stroke lower-left to upper-right:"
#print gc.bmp_array[:,:,0]
# assert the lower left and upper corner are the same,
# and have something drawn in them.
self.assertEqual(gc.bmp_array[-1,0,0], gc.bmp_array[0,-1,0])
self.assertNotEqual(gc.bmp_array[-1,0,0], 255)

def test_set_get_text_position(self):
#print 'testing text position'
gc = agg.GraphicsContextArray((5,5))
gc.set_text_position(1,1)
actual = gc.get_text_position()
Expand Down
1 change: 0 additions & 1 deletion kiva/cairo.py
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,6 @@ def show_text_at_point(self, text, x, y):
"""
"""
ctx = self._ctx
#print text, list(ctx.get_matrix())
cur_path = ctx.copy_path()
ctx.save()
ctx.transform(self.text_matrix)
Expand Down
15 changes: 0 additions & 15 deletions kiva/pdfmetrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,6 @@ def bruteForceSearchForAFM(faceName):
return None



#for faceName in standardFonts:
# registerTypeFace(TypeFace(faceName))


class Encoding:
"""Object to help you create and refer to encodings."""
def __init__(self, name, base=None):
Expand Down Expand Up @@ -298,8 +293,6 @@ def makePDFObject(self):
# XXX Kiva specific change
raise NotImplementedError

#for encName in standardEncodings:
# registerEncoding(Encoding(encName))

class Font:
"""Represents a font (i.e., combination of face and encoding).
Expand Down Expand Up @@ -495,7 +488,6 @@ def getTypeFace(faceName):
if faceName in standardFonts:
face = TypeFace(faceName)
registerTypeFace(face)
#print 'auto-constructing type face %s' % face.name
return face
else:
#try a brute force search
Expand All @@ -519,7 +511,6 @@ def getEncoding(encName):
if encName in standardEncodings:
enc = Encoding(encName)
registerEncoding(enc)
#print 'auto-constructing encoding %s' % encName
return enc
else:
raise
Expand Down Expand Up @@ -550,12 +541,6 @@ def _slowStringWidth(text, fontName, fontSize):
"""Define this anyway so it can be tested, but whether it is used or not depends on _rl_accel"""
font = getFont(fontName)
return font.stringWidth(text, fontSize)
#this is faster, but will need more special-casing for multi-byte fonts.
#wid = getFont(fontName).widths
#w = 0
#for ch in text:
# w = w + wid[ord(ch)]
#return 0.001 * w * fontSize


# XXX Kiva specific changes
Expand Down
1 change: 0 additions & 1 deletion kiva/tests/affine_test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def test_from_rotation(self):
transform = affine.affine_from_rotation(pi/4.)
pt1 = array([1.,0.,1.])
actual = dot(pt1,transform)
#cos_pi_4 = 0.70710678118654757
cos_pi_4 = cos(pi/4.0)
desired = array((cos_pi_4, cos_pi_4, 1.0))
assert(alltrue( (actual - desired) < 1e-6 ))
Expand Down
19 changes: 0 additions & 19 deletions kiva/tests/agg/test_image3.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,11 @@ def main3():
t1 = time.clock()
for i in range(N):
with gc:
#gc.rotate_ctm(.2)
gc.set_alpha(1.0)
gc.draw_image(agg_img)
#print pil_img.getpixel((300,300)), img[300,300], gc.bmp_array[300,300]
gc.translate_ctm(150,300)
gc.scale_ctm(10,10)
gc.set_fill_color((0.0,0,1.0,.25))
#gc.show_text("SUN")
t2 = time.clock()
print("images per second: %g" % (N/(t2-t1)))
gc.save('sun3.bmp')
Expand All @@ -153,14 +150,10 @@ def main4():
t1 = time.clock()
for i in range(N):
with gc:
#gc.rotate_ctm(.2)
#gc.set_alpha(0.5)
gc.draw_image(agg_img)
#print pil_img.getpixel((300,300)), img[300,300], gc.bmp_array[300,300]
gc.translate_ctm(150,300)
gc.scale_ctm(10,10)
gc.set_fill_color((0.0,0,1.0,.5))
#gc.show_text("SUN")
t2 = time.clock()
print("images per second: %g" % (N/(t2-t1)))
gc.save('sun2.bmp')
Expand Down Expand Up @@ -210,17 +203,5 @@ def main5(gc):

import profile
gc=agg.GraphicsContextArray((800,800))
#profile.run('main()')
#main5(gc)
#main5(gc)
#main5(gc)
#profile.run('main5(gc)')
#main()
#main2()
#main3()
#main4()

main()
#main2(gc)
#main4(gc)
#main5(gc)