11# encoding: utf-8
2- """PlotDevice | quartz-powered vector machine
2+
3+ #
4+ # 888 d8 888 ,e,
5+ # 888 88e 888 e88 88e d88 e88 888 ,e e, Y8b Y888P " e88'888 ,e e,
6+ # 888 888b 888 d888 888b d88888 d888 888 d88 88b Y8b Y8P 888 d888 '8 d88 88b
7+ # 888 888P 888 Y888 888P 888 Y888 888 888 , Y8b " 888 Y888 , 888 ,
8+ # 888 88" 888 "88 88" 888 "88 888 "YeeP" Y8P 888 "88,e8' "YeeP"
9+ # 888
10+ # 888
11+ #
12+
13+ """Quartz-powered vector machine
314
415Copyright (C) 2014 Samizdat Drafting Co.
516A derivative of http://nodebox.net/code by Frederik De Bleser & Tom De Smedt
819MIT Licensed (see README file for details)
920"""
1021
11- __title__ = 'plotdevice'
1222__version__ = '0.9.1'
13- __author__ = 'Christian Swinehart'
23+ __author__ = 'Christian Swinehart'
24+ __email__ = "drafting@samizdat.cc"
1425__credits__ = 'Frederik De Bleser, Tom De Smedt, Just van Rossum, & Marcos Ojeda'
15- __copyright__ = 'Copyright 2014 Samizdat Drafting Co.'
1626__license__ = 'MIT'
1727
18- # note whether the module is being used within the .app, via console.py, or from the repl
19- import sys , re
20- called_from = getattr (sys .modules ['__main__' ], '__file__' , '<interactive>' )
21- is_windowed = bool (re .search (r'plotdevice(-app|/run/console)\.py$' , called_from ))
22- in_setup = bool (called_from .endswith ('setup.py' ))
28+ # add the shared directory (for Libraries) to the path
29+ sys .path .append (os .path .join (os .getenv ('HOME' ), 'Library' , 'Application Support' , 'PlotDevice' ))
2330
2431# add the Extras directory to sys.path since every module depends on PyObjC and friends
2532try :
3239# print python exceptions to the console rather than silently failing
3340objc .setVerbose (True )
3441
35- # add any installed Libraries to the sys path
36- from os import getenv
37- from os .path import join
38- sys .path .append (join (getenv ('HOME' ), 'Library' , 'Application Support' , 'PlotDevice' ))
39-
4042# the global non-conflicting token (fingers crossed)
4143DEFAULT = '_p_l_o_t_d_e_v_i_c_e_'
4244
4345# please excuse our technical difficulties
4446class DeviceError (Exception ):
4547 pass
4648
49+ # note whether the module is being used within the .app, via console.py, or from the repl
50+ import sys , re , os
51+ called_from = getattr (sys .modules ['__main__' ], '__file__' , '<interactive>' )
52+ is_windowed = bool (re .search (r'plotdevice(-app|/run/console)\.py$' , called_from ))
53+ in_setup = bool (called_from .endswith ('setup.py' )) # (for builds)
54+
55+ # populate the namespace (or don't) accordingly
4756if is_windowed or in_setup :
4857 # if a script imports * from within the app/tool, nothing should be (re-)added to the
4958 # global namespace. we'll let the Sandbox handle populating the namespace instead.
@@ -61,3 +70,5 @@ class DeviceError(Exception):
6170 # context/canvas's internal ns
6271 globals ().update (ctx ._ns )
6372 __all__ = ctx ._ns .keys ()
73+
74+
0 commit comments