From e0f5534553542ce478b4909456d7f879f4e5b1fc Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Thu, 3 Dec 2020 16:44:46 -0600 Subject: [PATCH] remove commented out code --- enable/pyglet_backend/window.py | 3 --- enable/savage/compliance/viewer.py | 1 - enable/savage/svg/document.py | 21 -------------------- enable/stacked_layout.py | 9 --------- enable/vtk_backend/vtk_window.py | 9 --------- kiva/agg/tests/compiled_path_test_case.py | 2 -- kiva/agg/tests/graphics_context_test_case.py | 8 -------- kiva/cairo.py | 1 - kiva/pdfmetrics.py | 15 -------------- kiva/tests/affine_test_case.py | 1 - kiva/tests/agg/test_image3.py | 19 ------------------ 11 files changed, 89 deletions(-) diff --git a/enable/pyglet_backend/window.py b/enable/pyglet_backend/window.py index d83ff0963..d28deea9c 100644 --- a/enable/pyglet_backend/window.py +++ b/enable/pyglet_backend/window.py @@ -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 diff --git a/enable/savage/compliance/viewer.py b/enable/savage/compliance/viewer.py index 95b540249..f0951d9b0 100644 --- a/enable/savage/compliance/viewer.py +++ b/enable/savage/compliance/viewer.py @@ -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() diff --git a/enable/savage/svg/document.py b/enable/savage/svg/document.py index d4ee4983b..c93a02620 100644 --- a/enable/savage/svg/document.py +++ b/enable/savage/svg/document.py @@ -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) @@ -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") @@ -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 , and . # TODO: handle xml:space="preserve"? The following more or less # corresponds to xml:space="default". @@ -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) @@ -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 @@ -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 ) @@ -1017,15 +1007,8 @@ 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 ) @@ -1033,7 +1016,6 @@ def reflectPoint(point, relativeTo): control1 = reflectPoint(self.lastControl, path.GetCurrentPoint()) else: control1 = path.GetCurrentPoint() - #~ print "S", self.lastControl,":",control1, control2, endpoint self.lastControl = control2 path.AddCurveToPoint( control1, @@ -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__': diff --git a/enable/stacked_layout.py b/enable/stacked_layout.py index 8a57fe3ae..9bc5eb067 100644 --- a/enable/stacked_layout.py +++ b/enable/stacked_layout.py @@ -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 @@ -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] @@ -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 diff --git a/enable/vtk_backend/vtk_window.py b/enable/vtk_backend/vtk_window.py index 38173217f..f6ae3e30c 100644 --- a/enable/vtk_backend/vtk_window.py +++ b/enable/vtk_backend/vtk_window.py @@ -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) @@ -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): @@ -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): diff --git a/kiva/agg/tests/compiled_path_test_case.py b/kiva/agg/tests/compiled_path_test_case.py index 8199141aa..d9afbf7ee 100644 --- a/kiva/agg/tests/compiled_path_test_case.py +++ b/kiva/agg/tests/compiled_path_test_case.py @@ -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) diff --git a/kiva/agg/tests/graphics_context_test_case.py b/kiva/agg/tests/graphics_context_test_case.py index 97285d697..3a915ef35 100644 --- a/kiva/agg/tests/graphics_context_test_case.py +++ b/kiva/agg/tests/graphics_context_test_case.py @@ -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)) @@ -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) @@ -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() diff --git a/kiva/cairo.py b/kiva/cairo.py index e92e0ae7b..a416d3987 100644 --- a/kiva/cairo.py +++ b/kiva/cairo.py @@ -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) diff --git a/kiva/pdfmetrics.py b/kiva/pdfmetrics.py index ca03348a7..e95e42387 100644 --- a/kiva/pdfmetrics.py +++ b/kiva/pdfmetrics.py @@ -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): @@ -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). @@ -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 @@ -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 @@ -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 diff --git a/kiva/tests/affine_test_case.py b/kiva/tests/affine_test_case.py index aa5851801..d6ed79daa 100644 --- a/kiva/tests/affine_test_case.py +++ b/kiva/tests/affine_test_case.py @@ -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 )) diff --git a/kiva/tests/agg/test_image3.py b/kiva/tests/agg/test_image3.py index f46e17a24..2a3e561b2 100644 --- a/kiva/tests/agg/test_image3.py +++ b/kiva/tests/agg/test_image3.py @@ -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') @@ -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') @@ -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)