-
Notifications
You must be signed in to change notification settings - Fork 44
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
Python3 compatibility fixes #284
Changes from 24 commits
f30695d
a0b54f2
c05e2c4
0287cad
9838127
1fb7e72
2cd1509
67f76f3
903f48b
c1f66e0
f950f42
d43a075
3aebe74
c9e571b
9acbd4d
efbae1e
6b62549
dc2e3e6
58a690d
2a7983e
fd4fd79
fc07976
7bda4f8
b015584
1967c3c
e0453eb
412b479
dffcaa5
a8e9605
7afc595
e3830f0
4ea95a5
812b243
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
|
||
from __future__ import with_statement | ||
|
||
import six | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This import is unused here. |
||
from numpy import array, pi | ||
|
||
# Enthought library imports | ||
|
@@ -101,7 +103,7 @@ def normal_left_down(self, event): | |
"w": array((-far, -half_width, -near, half_width)) } | ||
if self.enable_center: | ||
rects["c"] = array((-near, -near, near, near)) | ||
for direction, rect in rects.items(): | ||
for direction, rect in six.iteritems(rects): | ||
if (rect[0] <= x <= rect[2]) and (rect[1] <= y <= rect[3]): | ||
self.event_state = "clicked" | ||
self.clicked = direction | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
Define the base Enable object traits | ||
""" | ||
|
||
import six | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also unused here |
||
# Major library imports | ||
from numpy import arange, array | ||
|
||
|
@@ -75,7 +77,7 @@ | |
'dot': array( [ 2.0, 2.0 ] ), | ||
'long dash': array( [ 9.0, 5.0 ] ) | ||
} | ||
__line_style_trait_map_keys = __line_style_trait_values.keys() | ||
__line_style_trait_map_keys = list(six.iterkeys(__line_style_trait_values)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For efficiency There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It runs once when the module is imported, so I wouldn't worry about it |
||
LineStyleEditor = EnumEditor( values=__line_style_trait_map_keys) | ||
|
||
def __line_style_trait( value='solid', **metadata ): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
|
||
import math | ||
|
||
import six | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unused import There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
from six.moves as sm | ||
|
||
from traits.api import Float, Property, List, Str, Range | ||
from enable.api import Component | ||
from kiva.trait_defs.kiva_font_trait import KivaFont | ||
|
@@ -37,7 +40,7 @@ class VUMeter(Component): | |
|
||
# Values of the percentage-based ticks; these are drawn and labeled along | ||
# the bottom of the curve axis. | ||
percent_ticks = List(range(0, 101, 20)) | ||
percent_ticks = List(list(sm.range(0, 101, 20))) | ||
|
||
# Text to write in the middle of the VU Meter. | ||
text = Str("VU") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's one set of parentheses too many here.
raise TraitError(object, name, 'a font descriptor string', repr( value ))