FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

removed last vestiges of value-ladder ‘magic’ · plotdevice/plotdevice@a2ac635 · GitHub

Repository navigation

Commit a2ac635

Browse files
committed
removed last vestiges of value-ladder ‘magic’
1 parent 2f91f5b commit a2ac635

4 files changed

Lines changed: 6 additions & 13 deletions

File tree

‎plotdevice/__init__.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
__version__='0.9'
2-
__MAGIC = '_p_l_o_t_d_e_v_i_c_e_'
32

43
def get_version():
54
return __version__
@@ -29,6 +28,9 @@ class DeviceError(Exception):
2928
from os.path import join
3029
sys.path.append(join(getenv('HOME'), 'Library', 'Application Support', 'PlotDevice'))
3130

31+
# the global non-conflicting token (fingers crossed)
32+
DEFAULT = '_p_l_o_t_d_e_v_i_c_e_'
33+
3234
if is_windowed or in_setup:
3335
# if a script imports * from within the app/tool, nothing should be (re-)added to the
3436
# global namespace. we'll let the Sandbox handle populating the namespace instead.

‎plotdevice/gfx/atoms.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from Quartz import *
55
from collections import namedtuple, defaultdict
66

7-
from plotdevice import DeviceError
7+
from plotdevice import DeviceError, DEFAULT
88
from ..util import _copy_attrs, _copy_attr, _flatten, trim_zeroes
99
from .colors import Color
1010
from .transform import Transform
@@ -308,7 +308,6 @@ def _set_dashstyle(self, *segments):
308308
self._penstyle = self._penstyle._replace(dash=steps)
309309
dash = dashstyle = property(_get_dashstyle, _set_dashstyle)
310310

311-
from plotdevice import __MAGIC as DEFAULT
312311
class StyleMixin(Grob):
313312
"""Mixin class for text-styling support.
314313
Adds the stylesheet, fill, and style attributes to the class."""

‎plotdevice/gfx/typography.py‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from AppKit import *
77
from Foundation import *
88

9-
from plotdevice import DeviceError
9+
from plotdevice import DeviceError, DEFAULT
1010
from .atoms import TransformMixin, ColorMixin, EffectsMixin, StyleMixin, BoundsMixin, Grob
1111
from . import _save, _restore, _ns_context
1212
from .transform import Transform, Region, Size
@@ -19,9 +19,6 @@
1919
__all__ = ("Text", "Family", "Font", "Stylesheet",
2020
"LEFT", "RIGHT", "CENTER", "JUSTIFY", "DEFAULT")
2121

22-
# hopefully non-conflicting style name for the stylesheet defaults
23-
from plotdevice import __MAGIC as DEFAULT
24-
2522
# text alignments
2623
LEFT = "left"
2724
RIGHT = "right"

‎plotdevice/run/sandbox.py‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from AppKit import *
99
from ..run import stacktrace, coredump
1010
from ..lib.io import MovieExportSession, ImageExportSession
11-
from plotdevice import util, context, gfx, DeviceError, __MAGIC as MAGICVAR
11+
from plotdevice import util, context, gfx, DeviceError
1212

1313
__all__ = ['Sandbox']
1414

@@ -53,7 +53,6 @@ def __init__(self, delegate=None):
5353
self.session = None # the image/movie export session (if any)
5454
self.stationery = False # whether the script is from the examples folder
5555
self.delegate = None # object with exportStatus and exportProgress methods
56-
self.magicvar = 0 # used for value ladders
5756

5857
# set up the graphics plumbing
5958
self.canvas = context.Canvas()
@@ -139,7 +138,6 @@ def compile(self, src=None):
139138
self.namespace.update(dict(self._env))
140139
# self.__doc__ = {}
141140
# self.namespace.update(dict( __doc__=self.__doc__, ))
142-
self.namespace[MAGICVAR] = self.magicvar # Add the magic var
143141

144142
result = Outcome(True, [])
145143
if not self._code:
@@ -191,9 +189,6 @@ def render(self, method=None):
191189
# Reset the context state (and bind the .gfx objects as a side-effect)
192190
self.context._resetContext()
193191

194-
# Initalize the magicvar
195-
self.namespace[MAGICVAR] = self.magicvar
196-
197192
# Set the frame/pagenum
198193
self.namespace['PAGENUM'] = self.namespace['FRAME'] = self._meta.next
199194

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL