import os |
import os, _winreg |
from decimal import Decimal |
from decimal import Decimal |
from simplegeneric import generic |
from simplegeneric import generic |
from peak.util.decorators import struct |
from peak.util.decorators import struct |
for ob in iter_options(ob): |
for ob in iter_options(ob): |
add_to_package(ob, package, isdefault) |
add_to_package(ob, package, isdefault) |
|
|
|
def _get_registry_string(root, path, subkey=None): |
|
"""Return the registry value or ``None`` if not found""" |
|
try: |
|
key = _winreg.OpenKey(root, path) |
|
try: |
|
return _winreg.QueryValueEx(key, subkey)[0] |
|
finally: |
|
_winreg.CloseKey(key) |
|
except WindowsError, e: |
|
if e.errno == 2: |
|
return None # entry not found |
|
raise |
|
|
|
|
inverses = dict( |
inverses = dict( |
def Layout(filename): |
def Layout(filename): |
"""Return an option specifying the desired layout""" |
"""Return an option specifying the desired layout""" |
return Option('DAZzle', os.path.abspath(filename), 'Layout') |
return Option('DAZzle', os.path.abspath(filename), 'Layout') |
|
|
@staticmethod |
@staticmethod |
def OutputFile(filename): |
def OutputFile(filename): |
"""Return an option specifying the desired layout""" |
"""Return an option specifying the desired layout""" |
Print = Start('PRINTING') |
Print = Start('PRINTING') |
Verify = Start('DAZ') |
Verify = Start('DAZ') |
|
|
|
exe_path = _get_registry_string( |
|
_winreg.HKEY_CLASSES_ROOT, 'lytfile\\shell\\open\\command' |
|
) |
|
|
|
#@staticmethod |
|
def get_preference(prefname): |
|
import _winreg |
|
return _get_registry_string( |
|
_winreg.HKEY_CURRENT_USER, |
|
'Software\\Envelope Manager\\dazzle\\Preferences', prefname |
|
) |
|
|
|
XMLDirectory = get_preference('XMLDirectory') |
|
LayoutDirectory = get_preference('LayoutDirectory') |
|
|
|
get_preference = staticmethod(get_preference) |
|
|
|
|
|
|
|
|
|
|
class Domestic: |
class Domestic: |
FirstClass = MailClass('FIRST') |
FirstClass = MailClass('FIRST') |
Priority = MailClass('PRIORITY') |
Priority = MailClass('PRIORITY') |
GXGNoDoc = MailClass('INTLGXGNODOC') |
GXGNoDoc = MailClass('INTLGXGNODOC') |
|
|
|
|
|
|
|
|
|
|
def DateAdvance(days): |
def DateAdvance(days): |
"""Return an option for the number of days ahead of time we're mailing""" |
"""Return an option for the number of days ahead of time we're mailing""" |
if not isinstance(days, int) or not (0<=days<=30): |
if not isinstance(days, int) or not (0<=days<=30): |
Tomorrow = DateAdvance(1) |
Tomorrow = DateAdvance(1) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Customs: |
class Customs: |
_make_symbols( |
_make_symbols( |
locals(), 'value', "NONE GEM CN22 CP72".split(), CustomsFormType |
locals(), 'value', "NONE GEM CN22 CP72".split(), CustomsFormType |