diff options
author | Tim Peters <tim.peters@gmail.com> | 2004-07-18 06:16:08 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2004-07-18 06:16:08 (GMT) |
commit | 182b5aca27d376b08a2904bed42b751496f932f3 (patch) | |
tree | df13115820dbc879c0fe2eae488c9f8c0215a7da /Lib | |
parent | e6ddc8b20b493fef2e7cffb2e1351fe1d238857e (diff) | |
download | cpython-182b5aca27d376b08a2904bed42b751496f932f3.zip cpython-182b5aca27d376b08a2904bed42b751496f932f3.tar.gz cpython-182b5aca27d376b08a2904bed42b751496f932f3.tar.bz2 |
Whitespace normalization, via reindent.py.
Diffstat (limited to 'Lib')
179 files changed, 5387 insertions, 5419 deletions
diff --git a/Lib/_threading_local.py b/Lib/_threading_local.py index 209c035..c90fde0 100644 --- a/Lib/_threading_local.py +++ b/Lib/_threading_local.py @@ -81,7 +81,7 @@ Now we have a default number: 2 an initial color: - + >>> mydata.color 'red' >>> del mydata.color @@ -216,7 +216,7 @@ class local(_localbase): # if enumerate fails, as it seems to do during # shutdown, we'll skip cleanup under the assumption # that there is nothing to clean up - return + return for thread in threads: try: @@ -228,7 +228,7 @@ class local(_localbase): if key in __dict__: try: del __dict__[key] - except KeyError: + except KeyError: pass # didn't have anything in this thread return __del__ diff --git a/Lib/asyncore.py b/Lib/asyncore.py index 5f60219..4fb12f1 100644 --- a/Lib/asyncore.py +++ b/Lib/asyncore.py @@ -268,7 +268,7 @@ class dispatcher: reuse_constant = socket.SO_EXCLUSIVEADDRUSE else: reuse_constant = socket.SO_REUSEADDR - + self.socket.setsockopt( socket.SOL_SOCKET, reuse_constant, self.socket.getsockopt(socket.SOL_SOCKET, @@ -276,7 +276,7 @@ class dispatcher: ) except socket.error: pass - + # ================================================== # predicates for select() # these are used as filters for the lists of sockets diff --git a/Lib/bsddb/test/test_basics.py b/Lib/bsddb/test/test_basics.py index 09571ab..155705d 100644 --- a/Lib/bsddb/test/test_basics.py +++ b/Lib/bsddb/test/test_basics.py @@ -301,7 +301,7 @@ class BasicTestCase(unittest.TestCase): else: txn = None c = self.d.cursor(txn=txn) - + rec = c.first() count = 0 while rec is not None: @@ -318,7 +318,7 @@ class BasicTestCase(unittest.TestCase): else: self.fail("unexpected DBNotFoundError") assert c.get_current_size() == len(c.current()[1]), "%s != len(%r)" % (c.get_current_size(), c.current()[1]) - + assert count == self._numKeys @@ -351,7 +351,7 @@ class BasicTestCase(unittest.TestCase): rec = c.set('empty value') assert rec[1] == '' assert c.get_current_size() == 0 - + try: n = c.set('bad key') except db.DBNotFoundError, val: diff --git a/Lib/cgitb.py b/Lib/cgitb.py index d287001..db46b25 100644 --- a/Lib/cgitb.py +++ b/Lib/cgitb.py @@ -42,13 +42,13 @@ def small(text): return '<small>' + text + '</small>' else: return '' - + def strong(text): if text: return '<strong>' + text + '</strong>' else: return '' - + def grey(text): if text: return '<font color="#909090">' + text + '</font>' diff --git a/Lib/curses/__init__.py b/Lib/curses/__init__.py index 1838de8..aba540b 100644 --- a/Lib/curses/__init__.py +++ b/Lib/curses/__init__.py @@ -7,7 +7,7 @@ the package, and perhaps a particular module inside it. from curses import textpad curses.initwin() ... - + """ __revision__ = "$Id$" @@ -29,13 +29,13 @@ def initscr(): for key, value in _curses.__dict__.items(): if key[0:4] == 'ACS_' or key in ('LINES', 'COLS'): setattr(curses, key, value) - + return stdscr # This is a similar wrapper for start_color(), which adds the COLORS and # COLOR_PAIRS variables which are only available after start_color() is # called. - + def start_color(): import _curses, curses retval = _curses.start_color() @@ -43,7 +43,7 @@ def start_color(): curses.COLORS = _curses.COLORS if hasattr(_curses, 'COLOR_PAIRS'): curses.COLOR_PAIRS = _curses.COLOR_PAIRS - return retval + return retval # Import Python has_key() implementation if _curses doesn't contain has_key() @@ -51,4 +51,3 @@ try: has_key except NameError: from has_key import has_key - diff --git a/Lib/curses/has_key.py b/Lib/curses/has_key.py index 0987952..60b7be9 100644 --- a/Lib/curses/has_key.py +++ b/Lib/curses/has_key.py @@ -8,154 +8,154 @@ import _curses # Table mapping curses keys to the terminfo capability name _capability_names = { - _curses.KEY_A1: 'ka1', - _curses.KEY_A3: 'ka3', - _curses.KEY_B2: 'kb2', - _curses.KEY_BACKSPACE: 'kbs', - _curses.KEY_BEG: 'kbeg', - _curses.KEY_BTAB: 'kcbt', - _curses.KEY_C1: 'kc1', - _curses.KEY_C3: 'kc3', - _curses.KEY_CANCEL: 'kcan', - _curses.KEY_CATAB: 'ktbc', - _curses.KEY_CLEAR: 'kclr', - _curses.KEY_CLOSE: 'kclo', - _curses.KEY_COMMAND: 'kcmd', - _curses.KEY_COPY: 'kcpy', - _curses.KEY_CREATE: 'kcrt', - _curses.KEY_CTAB: 'kctab', - _curses.KEY_DC: 'kdch1', - _curses.KEY_DL: 'kdl1', - _curses.KEY_DOWN: 'kcud1', - _curses.KEY_EIC: 'krmir', - _curses.KEY_END: 'kend', - _curses.KEY_ENTER: 'kent', - _curses.KEY_EOL: 'kel', - _curses.KEY_EOS: 'ked', - _curses.KEY_EXIT: 'kext', - _curses.KEY_F0: 'kf0', - _curses.KEY_F1: 'kf1', - _curses.KEY_F10: 'kf10', - _curses.KEY_F11: 'kf11', - _curses.KEY_F12: 'kf12', - _curses.KEY_F13: 'kf13', - _curses.KEY_F14: 'kf14', - _curses.KEY_F15: 'kf15', - _curses.KEY_F16: 'kf16', - _curses.KEY_F17: 'kf17', - _curses.KEY_F18: 'kf18', - _curses.KEY_F19: 'kf19', - _curses.KEY_F2: 'kf2', - _curses.KEY_F20: 'kf20', - _curses.KEY_F21: 'kf21', - _curses.KEY_F22: 'kf22', - _curses.KEY_F23: 'kf23', - _curses.KEY_F24: 'kf24', - _curses.KEY_F25: 'kf25', - _curses.KEY_F26: 'kf26', - _curses.KEY_F27: 'kf27', - _curses.KEY_F28: 'kf28', - _curses.KEY_F29: 'kf29', - _curses.KEY_F3: 'kf3', - _curses.KEY_F30: 'kf30', - _curses.KEY_F31: 'kf31', - _curses.KEY_F32: 'kf32', - _curses.KEY_F33: 'kf33', - _curses.KEY_F34: 'kf34', - _curses.KEY_F35: 'kf35', - _curses.KEY_F36: 'kf36', - _curses.KEY_F37: 'kf37', - _curses.KEY_F38: 'kf38', - _curses.KEY_F39: 'kf39', - _curses.KEY_F4: 'kf4', - _curses.KEY_F40: 'kf40', - _curses.KEY_F41: 'kf41', - _curses.KEY_F42: 'kf42', - _curses.KEY_F43: 'kf43', - _curses.KEY_F44: 'kf44', - _curses.KEY_F45: 'kf45', - _curses.KEY_F46: 'kf46', - _curses.KEY_F47: 'kf47', - _curses.KEY_F48: 'kf48', - _curses.KEY_F49: 'kf49', - _curses.KEY_F5: 'kf5', - _curses.KEY_F50: 'kf50', - _curses.KEY_F51: 'kf51', - _curses.KEY_F52: 'kf52', - _curses.KEY_F53: 'kf53', - _curses.KEY_F54: 'kf54', - _curses.KEY_F55: 'kf55', - _curses.KEY_F56: 'kf56', - _curses.KEY_F57: 'kf57', - _curses.KEY_F58: 'kf58', - _curses.KEY_F59: 'kf59', - _curses.KEY_F6: 'kf6', - _curses.KEY_F60: 'kf60', - _curses.KEY_F61: 'kf61', - _curses.KEY_F62: 'kf62', - _curses.KEY_F63: 'kf63', - _curses.KEY_F7: 'kf7', - _curses.KEY_F8: 'kf8', - _curses.KEY_F9: 'kf9', - _curses.KEY_FIND: 'kfnd', - _curses.KEY_HELP: 'khlp', - _curses.KEY_HOME: 'khome', - _curses.KEY_IC: 'kich1', - _curses.KEY_IL: 'kil1', - _curses.KEY_LEFT: 'kcub1', - _curses.KEY_LL: 'kll', - _curses.KEY_MARK: 'kmrk', - _curses.KEY_MESSAGE: 'kmsg', - _curses.KEY_MOVE: 'kmov', - _curses.KEY_NEXT: 'knxt', - _curses.KEY_NPAGE: 'knp', - _curses.KEY_OPEN: 'kopn', - _curses.KEY_OPTIONS: 'kopt', - _curses.KEY_PPAGE: 'kpp', - _curses.KEY_PREVIOUS: 'kprv', - _curses.KEY_PRINT: 'kprt', - _curses.KEY_REDO: 'krdo', - _curses.KEY_REFERENCE: 'kref', - _curses.KEY_REFRESH: 'krfr', - _curses.KEY_REPLACE: 'krpl', - _curses.KEY_RESTART: 'krst', - _curses.KEY_RESUME: 'kres', - _curses.KEY_RIGHT: 'kcuf1', - _curses.KEY_SAVE: 'ksav', - _curses.KEY_SBEG: 'kBEG', - _curses.KEY_SCANCEL: 'kCAN', - _curses.KEY_SCOMMAND: 'kCMD', - _curses.KEY_SCOPY: 'kCPY', - _curses.KEY_SCREATE: 'kCRT', - _curses.KEY_SDC: 'kDC', - _curses.KEY_SDL: 'kDL', - _curses.KEY_SELECT: 'kslt', - _curses.KEY_SEND: 'kEND', - _curses.KEY_SEOL: 'kEOL', - _curses.KEY_SEXIT: 'kEXT', - _curses.KEY_SF: 'kind', - _curses.KEY_SFIND: 'kFND', - _curses.KEY_SHELP: 'kHLP', - _curses.KEY_SHOME: 'kHOM', - _curses.KEY_SIC: 'kIC', - _curses.KEY_SLEFT: 'kLFT', - _curses.KEY_SMESSAGE: 'kMSG', - _curses.KEY_SMOVE: 'kMOV', - _curses.KEY_SNEXT: 'kNXT', - _curses.KEY_SOPTIONS: 'kOPT', - _curses.KEY_SPREVIOUS: 'kPRV', - _curses.KEY_SPRINT: 'kPRT', - _curses.KEY_SR: 'kri', - _curses.KEY_SREDO: 'kRDO', - _curses.KEY_SREPLACE: 'kRPL', - _curses.KEY_SRIGHT: 'kRIT', - _curses.KEY_SRSUME: 'kRES', - _curses.KEY_SSAVE: 'kSAV', - _curses.KEY_SSUSPEND: 'kSPD', - _curses.KEY_STAB: 'khts', - _curses.KEY_SUNDO: 'kUND', - _curses.KEY_SUSPEND: 'kspd', - _curses.KEY_UNDO: 'kund', + _curses.KEY_A1: 'ka1', + _curses.KEY_A3: 'ka3', + _curses.KEY_B2: 'kb2', + _curses.KEY_BACKSPACE: 'kbs', + _curses.KEY_BEG: 'kbeg', + _curses.KEY_BTAB: 'kcbt', + _curses.KEY_C1: 'kc1', + _curses.KEY_C3: 'kc3', + _curses.KEY_CANCEL: 'kcan', + _curses.KEY_CATAB: 'ktbc', + _curses.KEY_CLEAR: 'kclr', + _curses.KEY_CLOSE: 'kclo', + _curses.KEY_COMMAND: 'kcmd', + _curses.KEY_COPY: 'kcpy', + _curses.KEY_CREATE: 'kcrt', + _curses.KEY_CTAB: 'kctab', + _curses.KEY_DC: 'kdch1', + _curses.KEY_DL: 'kdl1', + _curses.KEY_DOWN: 'kcud1', + _curses.KEY_EIC: 'krmir', + _curses.KEY_END: 'kend', + _curses.KEY_ENTER: 'kent', + _curses.KEY_EOL: 'kel', + _curses.KEY_EOS: 'ked', + _curses.KEY_EXIT: 'kext', + _curses.KEY_F0: 'kf0', + _curses.KEY_F1: 'kf1', + _curses.KEY_F10: 'kf10', + _curses.KEY_F11: 'kf11', + _curses.KEY_F12: 'kf12', + _curses.KEY_F13: 'kf13', + _curses.KEY_F14: 'kf14', + _curses.KEY_F15: 'kf15', + _curses.KEY_F16: 'kf16', + _curses.KEY_F17: 'kf17', + _curses.KEY_F18: 'kf18', + _curses.KEY_F19: 'kf19', + _curses.KEY_F2: 'kf2', + _curses.KEY_F20: 'kf20', + _curses.KEY_F21: 'kf21', + _curses.KEY_F22: 'kf22', + _curses.KEY_F23: 'kf23', + _curses.KEY_F24: 'kf24', + _curses.KEY_F25: 'kf25', + _curses.KEY_F26: 'kf26', + _curses.KEY_F27: 'kf27', + _curses.KEY_F28: 'kf28', + _curses.KEY_F29: 'kf29', + _curses.KEY_F3: 'kf3', + _curses.KEY_F30: 'kf30', + _curses.KEY_F31: 'kf31', + _curses.KEY_F32: 'kf32', + _curses.KEY_F33: 'kf33', + _curses.KEY_F34: 'kf34', + _curses.KEY_F35: 'kf35', + _curses.KEY_F36: 'kf36', + _curses.KEY_F37: 'kf37', + _curses.KEY_F38: 'kf38', + _curses.KEY_F39: 'kf39', + _curses.KEY_F4: 'kf4', + _curses.KEY_F40: 'kf40', + _curses.KEY_F41: 'kf41', + _curses.KEY_F42: 'kf42', + _curses.KEY_F43: 'kf43', + _curses.KEY_F44: 'kf44', + _curses.KEY_F45: 'kf45', + _curses.KEY_F46: 'kf46', + _curses.KEY_F47: 'kf47', + _curses.KEY_F48: 'kf48', + _curses.KEY_F49: 'kf49', + _curses.KEY_F5: 'kf5', + _curses.KEY_F50: 'kf50', + _curses.KEY_F51: 'kf51', + _curses.KEY_F52: 'kf52', + _curses.KEY_F53: 'kf53', + _curses.KEY_F54: 'kf54', + _curses.KEY_F55: 'kf55', + _curses.KEY_F56: 'kf56', + _curses.KEY_F57: 'kf57', + _curses.KEY_F58: 'kf58', + _curses.KEY_F59: 'kf59', + _curses.KEY_F6: 'kf6', + _curses.KEY_F60: 'kf60', + _curses.KEY_F61: 'kf61', + _curses.KEY_F62: 'kf62', + _curses.KEY_F63: 'kf63', + _curses.KEY_F7: 'kf7', + _curses.KEY_F8: 'kf8', + _curses.KEY_F9: 'kf9', + _curses.KEY_FIND: 'kfnd', + _curses.KEY_HELP: 'khlp', + _curses.KEY_HOME: 'khome', + _curses.KEY_IC: 'kich1', + _curses.KEY_IL: 'kil1', + _curses.KEY_LEFT: 'kcub1', + _curses.KEY_LL: 'kll', + _curses.KEY_MARK: 'kmrk', + _curses.KEY_MESSAGE: 'kmsg', + _curses.KEY_MOVE: 'kmov', + _curses.KEY_NEXT: 'knxt', + _curses.KEY_NPAGE: 'knp', + _curses.KEY_OPEN: 'kopn', + _curses.KEY_OPTIONS: 'kopt', + _curses.KEY_PPAGE: 'kpp', + _curses.KEY_PREVIOUS: 'kprv', + _curses.KEY_PRINT: 'kprt', + _curses.KEY_REDO: 'krdo', + _curses.KEY_REFERENCE: 'kref', + _curses.KEY_REFRESH: 'krfr', + _curses.KEY_REPLACE: 'krpl', + _curses.KEY_RESTART: 'krst', + _curses.KEY_RESUME: 'kres', + _curses.KEY_RIGHT: 'kcuf1', + _curses.KEY_SAVE: 'ksav', + _curses.KEY_SBEG: 'kBEG', + _curses.KEY_SCANCEL: 'kCAN', + _curses.KEY_SCOMMAND: 'kCMD', + _curses.KEY_SCOPY: 'kCPY', + _curses.KEY_SCREATE: 'kCRT', + _curses.KEY_SDC: 'kDC', + _curses.KEY_SDL: 'kDL', + _curses.KEY_SELECT: 'kslt', + _curses.KEY_SEND: 'kEND', + _curses.KEY_SEOL: 'kEOL', + _curses.KEY_SEXIT: 'kEXT', + _curses.KEY_SF: 'kind', + _curses.KEY_SFIND: 'kFND', + _curses.KEY_SHELP: 'kHLP', + _curses.KEY_SHOME: 'kHOM', + _curses.KEY_SIC: 'kIC', + _curses.KEY_SLEFT: 'kLFT', + _curses.KEY_SMESSAGE: 'kMSG', + _curses.KEY_SMOVE: 'kMOV', + _curses.KEY_SNEXT: 'kNXT', + _curses.KEY_SOPTIONS: 'kOPT', + _curses.KEY_SPREVIOUS: 'kPRV', + _curses.KEY_SPRINT: 'kPRT', + _curses.KEY_SR: 'kri', + _curses.KEY_SREDO: 'kRDO', + _curses.KEY_SREPLACE: 'kRPL', + _curses.KEY_SRIGHT: 'kRIT', + _curses.KEY_SRSUME: 'kRES', + _curses.KEY_SSAVE: 'kSAV', + _curses.KEY_SSUSPEND: 'kSPD', + _curses.KEY_STAB: 'khts', + _curses.KEY_SUNDO: 'kUND', + _curses.KEY_SUSPEND: 'kspd', + _curses.KEY_UNDO: 'kund', _curses.KEY_UP: 'kcuu1' } @@ -190,5 +190,3 @@ if __name__ == '__main__': finally: _curses.endwin() for i in L: print i - - diff --git a/Lib/curses/panel.py b/Lib/curses/panel.py index 2c86d4c..aacca85 100644 --- a/Lib/curses/panel.py +++ b/Lib/curses/panel.py @@ -6,4 +6,3 @@ Module for using panels with curses. __revision__ = "$Id$" from _curses_panel import * - diff --git a/Lib/distutils/archive_util.py b/Lib/distutils/archive_util.py index d5b3096..55babe6 100644 --- a/Lib/distutils/archive_util.py +++ b/Lib/distutils/archive_util.py @@ -68,7 +68,7 @@ def make_zipfile (base_name, base_dir, verbose=0, dry_run=0): import zipfile except ImportError: zipfile = None - + zip_filename = base_name + ".zip" mkpath(os.path.dirname(zip_filename), dry_run=dry_run) @@ -79,7 +79,7 @@ def make_zipfile (base_name, base_dir, verbose=0, dry_run=0): zipoptions = "-r" else: zipoptions = "-rq" - + try: spawn(["zip", zipoptions, zip_filename, base_dir], dry_run=dry_run) diff --git a/Lib/distutils/bcppcompiler.py b/Lib/distutils/bcppcompiler.py index b0360a2..f995e36 100644 --- a/Lib/distutils/bcppcompiler.py +++ b/Lib/distutils/bcppcompiler.py @@ -85,7 +85,7 @@ class BCPPCompiler(CCompiler) : def compile(self, sources, output_dir=None, macros=None, include_dirs=None, debug=0, extra_preargs=None, extra_postargs=None, depends=None): - + macros, objects, extra_postargs, pp_opts, build = \ self._setup_compile(output_dir, macros, include_dirs, sources, depends, extra_postargs) diff --git a/Lib/distutils/ccompiler.py b/Lib/distutils/ccompiler.py index ebd93c2..a3b1ffa 100644 --- a/Lib/distutils/ccompiler.py +++ b/Lib/distutils/ccompiler.py @@ -685,7 +685,7 @@ class CCompiler: # A concrete compiler class can either override this method # entirely or implement _compile(). - + macros, objects, extra_postargs, pp_opts, build = \ self._setup_compile(output_dir, macros, include_dirs, sources, depends, extra_postargs) @@ -703,7 +703,7 @@ class CCompiler: def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): """Compile 'src' to product 'obj'.""" - + # A concrete compiler class that does not override compile() # should implement _compile(). pass diff --git a/Lib/distutils/cmd.py b/Lib/distutils/cmd.py index 9362410..be8e826 100644 --- a/Lib/distutils/cmd.py +++ b/Lib/distutils/cmd.py @@ -79,7 +79,7 @@ class Command: # verbose is largely ignored, but needs to be set for # backwards compatibility (I think)? self.verbose = dist.verbose - + # Some commands define a 'self.force' option to ignore file # timestamps, but methods defined *here* assume that # 'self.force' exists for all commands. So define it here @@ -100,7 +100,7 @@ class Command: # XXX A more explicit way to customize dry_run would be better. - + def __getattr__ (self, attr): if attr == 'dry_run': myval = getattr(self, "_" + attr) diff --git a/Lib/distutils/command/bdist.py b/Lib/distutils/command/bdist.py index 7c606ff..4eca9c3 100644 --- a/Lib/distutils/command/bdist.py +++ b/Lib/distutils/command/bdist.py @@ -78,7 +78,7 @@ class bdist (Command): 'wininst': ('bdist_wininst', "Windows executable installer"), 'zip': ('bdist_dumb', "ZIP file"), - #'pkgtool': ('bdist_pkgtool', + #'pkgtool': ('bdist_pkgtool', # "Solaris pkgtool distribution"), #'sdux': ('bdist_sdux', "HP-UX swinstall depot"), } diff --git a/Lib/distutils/command/bdist_dumb.py b/Lib/distutils/command/bdist_dumb.py index 8ee3a5c..3db332d 100644 --- a/Lib/distutils/command/bdist_dumb.py +++ b/Lib/distutils/command/bdist_dumb.py @@ -53,7 +53,7 @@ class bdist_dumb (Command): self.dist_dir = None self.skip_build = 0 self.relative = 0 - + # initialize_options() diff --git a/Lib/distutils/command/bdist_wininst.py b/Lib/distutils/command/bdist_wininst.py index 7c593ad..d91c089 100644 --- a/Lib/distutils/command/bdist_wininst.py +++ b/Lib/distutils/command/bdist_wininst.py @@ -115,7 +115,7 @@ class bdist_wininst (Command): # we do not want to include pyc or pyo files install_lib.compile = 0 install_lib.optimize = 0 - + # If we are building an installer for a Python version other # than the one we are currently running, then we need to ensure # our build_lib reflects the other Python version rather than ours. diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py index 0c37768..04cd742 100644 --- a/Lib/distutils/command/build_ext.py +++ b/Lib/distutils/command/build_ext.py @@ -173,7 +173,7 @@ class build_ext (Command): self.include_dirs.append(os.path.join(sys.exec_prefix, 'PC')) self.library_dirs.append(os.path.join(sys.exec_prefix, 'PCBuild')) - # OS/2 (EMX) doesn't support Debug vs Release builds, but has the + # OS/2 (EMX) doesn't support Debug vs Release builds, but has the # import libraries in its "Config" subdirectory if os.name == 'os2': self.library_dirs.append(os.path.join(sys.exec_prefix, 'Config')) @@ -636,7 +636,7 @@ class build_ext (Command): # EMX/GCC requires the python library explicitly, and I # believe VACPP does as well (though not confirmed) - AIM Apr01 template = "python%d%d" - # debug versions of the main DLL aren't supported, at least + # debug versions of the main DLL aren't supported, at least # not at this time - AIM Apr01 #if self.debug: # template = template + '_d' diff --git a/Lib/distutils/command/build_scripts.py b/Lib/distutils/command/build_scripts.py index 165a009..e0fcc23 100644 --- a/Lib/distutils/command/build_scripts.py +++ b/Lib/distutils/command/build_scripts.py @@ -94,7 +94,7 @@ class build_scripts (Command): if not self.dry_run: outf = open(outfile, "w") if not sysconfig.python_build: - outf.write("#!%s%s\n" % + outf.write("#!%s%s\n" % (os.path.normpath(sys.executable), post_interp)) else: diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py index 3c36ede..175f785 100644 --- a/Lib/distutils/command/install.py +++ b/Lib/distutils/command/install.py @@ -537,7 +537,7 @@ class install (Command): not (self.path_file and self.install_path_file) and install_lib not in sys_path): log.debug(("modules installed to '%s', which is not in " - "Python's module search path (sys.path) -- " + "Python's module search path (sys.path) -- " "you'll have to change the search path yourself"), self.install_lib) diff --git a/Lib/distutils/command/register.py b/Lib/distutils/command/register.py index 8e347ce..8104ce0 100644 --- a/Lib/distutils/command/register.py +++ b/Lib/distutils/command/register.py @@ -286,4 +286,3 @@ Your selection [default 1]: ''', if self.show_response: print '-'*75, data, '-'*75 return result - diff --git a/Lib/distutils/core.py b/Lib/distutils/core.py index fba463c..fef291f 100644 --- a/Lib/distutils/core.py +++ b/Lib/distutils/core.py @@ -239,4 +239,3 @@ def run_setup (script_name, script_args=None, stop_after="run"): return _setup_distribution # run_setup () - diff --git a/Lib/distutils/cygwinccompiler.py b/Lib/distutils/cygwinccompiler.py index 0101bae..a962007 100644 --- a/Lib/distutils/cygwinccompiler.py +++ b/Lib/distutils/cygwinccompiler.py @@ -75,7 +75,7 @@ class CygwinCCompiler (UnixCCompiler): (status, details)) if status is not CONFIG_H_OK: self.warn( - "Python's pyconfig.h doesn't seem to support your compiler. " + "Python's pyconfig.h doesn't seem to support your compiler. " "Reason: %s. " "Compiling may fail because of undefined preprocessor macros." % details) diff --git a/Lib/distutils/debug.py b/Lib/distutils/debug.py index e195ebd..2a87eb5 100644 --- a/Lib/distutils/debug.py +++ b/Lib/distutils/debug.py @@ -7,4 +7,3 @@ __revision__ = "$Id$" # If DISTUTILS_DEBUG is anything other than the empty string, we run in # debug mode. DEBUG = os.environ.get('DISTUTILS_DEBUG') - diff --git a/Lib/distutils/dir_util.py b/Lib/distutils/dir_util.py index e479b62..77f64c4 100644 --- a/Lib/distutils/dir_util.py +++ b/Lib/distutils/dir_util.py @@ -225,4 +225,3 @@ def ensure_relative (path): if path[0:1] == os.sep: path = drive + path[1:] return path - diff --git a/Lib/distutils/dist.py b/Lib/distutils/dist.py index 7d0a7ba..b4dd0b9 100644 --- a/Lib/distutils/dist.py +++ b/Lib/distutils/dist.py @@ -231,7 +231,7 @@ class Distribution: newreq.append((pkg, LooseVersion(ver))) attrs['requires'] = newreq - # Build up the provides object. If the setup() has no + # Build up the provides object. If the setup() has no # provides line, we use packages or modules and the version # to synthesise the provides. If no version is provided (no # pun intended) we don't have a provides entry at all. @@ -1137,7 +1137,7 @@ class DistributionMetadata: return self.download_url or "UNKNOWN" def get_requires(self): - return [ '%s%s%s'%(x, (y and '-') or '', y or '') + return [ '%s%s%s'%(x, (y and '-') or '', y or '') for x,y in self.requires ] def get_provides(self): diff --git a/Lib/distutils/file_util.py b/Lib/distutils/file_util.py index e230ce5..e2b1c51 100644 --- a/Lib/distutils/file_util.py +++ b/Lib/distutils/file_util.py @@ -42,7 +42,7 @@ def _copy_file_contents (src, dst, buffer_size=16*1024): except os.error, (errno, errstr): raise DistutilsFileError, \ "could not delete '%s': %s" % (dst, errstr) - + try: fdst = open(dst, 'wb') except os.error, (errno, errstr): diff --git a/Lib/distutils/filelist.py b/Lib/distutils/filelist.py index 0872e96..566d87a 100644 --- a/Lib/distutils/filelist.py +++ b/Lib/distutils/filelist.py @@ -167,7 +167,7 @@ class FileList: for pattern in patterns: if not self.include_pattern(pattern, prefix=dir): log.warn(("warning: no files found matching '%s' " + - "under directory '%s'"), + "under directory '%s'"), pattern, dir) elif action == 'recursive-exclude': diff --git a/Lib/distutils/log.py b/Lib/distutils/log.py index 01420da..024e7c2 100644 --- a/Lib/distutils/log.py +++ b/Lib/distutils/log.py @@ -28,16 +28,16 @@ class Log: def debug(self, msg, *args): self._log(DEBUG, msg, args) - + def info(self, msg, *args): self._log(INFO, msg, args) - + def warn(self, msg, *args): self._log(WARN, msg, args) - + def error(self, msg, *args): self._log(ERROR, msg, args) - + def fatal(self, msg, *args): self._log(FATAL, msg, args) diff --git a/Lib/distutils/msvccompiler.py b/Lib/distutils/msvccompiler.py index 1441ea0..168881a 100644 --- a/Lib/distutils/msvccompiler.py +++ b/Lib/distutils/msvccompiler.py @@ -117,7 +117,7 @@ class MacroExpander: if d: self.macros["$(%s)" % macro] = d[key] break - + def load_macros(self, version): vsbase = r"Software\Microsoft\VisualStudio\%0.1f" % version self.set_macro("VCInstallDir", vsbase + r"\Setup\VC", "productdir") @@ -166,7 +166,7 @@ def get_build_version(): return majorVersion + minorVersion # else we don't know what version of the compiler this is return None - + class MSVCCompiler (CCompiler) : """Concrete class that implements an interface to Microsoft Visual C++, @@ -525,7 +525,7 @@ class MSVCCompiler (CCompiler) : return fn return exe - + def get_msvc_paths(self, path, platform='x86'): """Get a list of devstudio directories (include, lib or path). @@ -576,4 +576,3 @@ class MSVCCompiler (CCompiler) : p = self.get_msvc_paths(name) if p: os.environ[name] = string.join(p, ';') - diff --git a/Lib/distutils/spawn.py b/Lib/distutils/spawn.py index 67391e8..a89b88c 100644 --- a/Lib/distutils/spawn.py +++ b/Lib/distutils/spawn.py @@ -97,7 +97,7 @@ def _spawn_os2 (cmd, #cmd = _nt_quote_args(cmd) if search_path: # either we find one or it stays the same - executable = find_executable(executable) or executable + executable = find_executable(executable) or executable log.info(string.join([executable] + cmd[1:], ' ')) if not dry_run: # spawnv for OS/2 EMX requires a full path to the .exe diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py index c912a15..0a4e14c 100644 --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -367,7 +367,7 @@ def _init_posix(): my_msg = ('$MACOSX_DEPLOYMENT_TARGET mismatch: now "%s" but "%s" during configure' % (cur_target, cfg_target)) raise DistutilsPlatformError(my_msg) - + # On AIX, there are wrong paths to the linker scripts in the Makefile # -- these paths are relative to the Python source, but when installed # the scripts are in another directory. diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py index 11ecb9f..24cbcb5 100644 --- a/Lib/distutils/unixccompiler.py +++ b/Lib/distutils/unixccompiler.py @@ -206,7 +206,7 @@ class UnixCCompiler(CCompiler): elif sys.platform[:5] == "hp-ux": return "+s -L" + dir elif compiler[:3] == "gcc" or compiler[:3] == "g++": - return "-Wl,-R" + dir + return "-Wl,-R" + dir else: return "-R" + dir @@ -217,7 +217,7 @@ class UnixCCompiler(CCompiler): shared_f = self.library_filename(lib, lib_type='shared') dylib_f = self.library_filename(lib, lib_type='dylib') static_f = self.library_filename(lib, lib_type='static') - + for dir in dirs: shared = os.path.join(dir, shared_f) dylib = os.path.join(dir, dylib_f) @@ -232,6 +232,6 @@ class UnixCCompiler(CCompiler): return shared elif os.path.exists(static): return static - + # Oops, didn't find it in *any* of 'dirs' return None diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py index 12775d6..387e9bd 100644 --- a/Lib/distutils/util.py +++ b/Lib/distutils/util.py @@ -300,7 +300,7 @@ def execute (func, args, msg=None, verbose=0, dry_run=0): def strtobool (val): """Convert a string representation of truth to true (1) or false (0). - + True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values are 'n', 'no', 'f', 'false', 'off', and '0'. Raises ValueError if 'val' is anything else. diff --git a/Lib/dummy_threading.py b/Lib/dummy_threading.py index 4d0b744..48f7c4c 100644 --- a/Lib/dummy_threading.py +++ b/Lib/dummy_threading.py @@ -46,7 +46,7 @@ try: held__threading_local = sys_modules['_threading_local'] holding__threading_local = True del sys_modules['_threading_local'] - + import threading # Need a copy of the code kept somewhere... sys_modules['_dummy_threading'] = sys_modules['threading'] diff --git a/Lib/lib-old/Para.py b/Lib/lib-old/Para.py index 2e6aa4c..2fd8dc6 100644 --- a/Lib/lib-old/Para.py +++ b/Lib/lib-old/Para.py @@ -1,4 +1,4 @@ -# Text formatting abstractions +# Text formatting abstractions # Note -- this module is obsolete, it's too slow anyway @@ -14,330 +14,330 @@ Int = type(0) # different screen locations. Once rendered, it can be queried # for mouse hits, and parts of the text can be highlighted class Para: - # - def __init__(self): - self.words = [] # The words - self.just = 'l' # Justification: 'l', 'r', 'lr' or 'c' - self.indent_left = self.indent_right = self.indent_hang = 0 - # Final lay-out parameters, may change - self.left = self.top = self.right = self.bottom = \ - self.width = self.height = self.lines = None - # - # Add a word, computing size information for it. - # Words may also be added manually by appending to self.words - # Each word should be a 7-tuple: - # (font, text, width, space, stretch, ascent, descent) - def addword(self, d, font, text, space, stretch): - if font is not None: - d.setfont(font) - width = d.textwidth(text) - ascent = d.baseline() - descent = d.lineheight() - ascent - spw = d.textwidth(' ') - space = space * spw - stretch = stretch * spw - tuple = (font, text, width, space, stretch, ascent, descent) - self.words.append(tuple) - # - # Hooks to begin and end anchors -- insert numbers in the word list! - def bgn_anchor(self, id): - self.words.append(id) - # - def end_anchor(self, id): - self.words.append(0) - # - # Return the total length (width) of the text added so far, in pixels - def getlength(self): - total = 0 - for word in self.words: - if type(word) is not Int: - total = total + word[2] + word[3] - return total - # - # Tab to a given position (relative to the current left indent): - # remove all stretch, add fixed space up to the new indent. - # If the current position is already at the tab stop, - # don't add any new space (but still remove the stretch) - def tabto(self, tab): - total = 0 - as, de = 1, 0 - for i in range(len(self.words)): - word = self.words[i] - if type(word) is Int: continue - (fo, te, wi, sp, st, as, de) = word - self.words[i] = (fo, te, wi, sp, 0, as, de) - total = total + wi + sp - if total < tab: - self.words.append((None, '', 0, tab-total, 0, as, de)) - # - # Make a hanging tag: tab to hang, increment indent_left by hang, - # and reset indent_hang to -hang - def makehangingtag(self, hang): - self.tabto(hang) - self.indent_left = self.indent_left + hang - self.indent_hang = -hang - # - # Decide where the line breaks will be given some screen width - def layout(self, linewidth): - self.width = linewidth - height = 0 - self.lines = lines = [] - avail1 = self.width - self.indent_left - self.indent_right - avail = avail1 - self.indent_hang - words = self.words - i = 0 - n = len(words) - lastfont = None - while i < n: - firstfont = lastfont - charcount = 0 - width = 0 - stretch = 0 - ascent = 0 - descent = 0 - lsp = 0 - j = i - while i < n: - word = words[i] - if type(word) is Int: - if word > 0 and width >= avail: - break - i = i+1 - continue - fo, te, wi, sp, st, as, de = word - if width + wi > avail and width > 0 and wi > 0: - break - if fo is not None: - lastfont = fo - if width == 0: - firstfont = fo - charcount = charcount + len(te) + (sp > 0) - width = width + wi + sp - lsp = sp - stretch = stretch + st - lst = st - ascent = max(ascent, as) - descent = max(descent, de) - i = i+1 - while i > j and type(words[i-1]) is Int and \ - words[i-1] > 0: i = i-1 - width = width - lsp - if i < n: - stretch = stretch - lst - else: - stretch = 0 - tuple = i-j, firstfont, charcount, width, stretch, \ - ascent, descent - lines.append(tuple) - height = height + ascent + descent - avail = avail1 - self.height = height - # - # Call a function for all words in a line - def visit(self, wordfunc, anchorfunc): - avail1 = self.width - self.indent_left - self.indent_right - avail = avail1 - self.indent_hang - v = self.top - i = 0 - for tuple in self.lines: - wordcount, firstfont, charcount, width, stretch, \ - ascent, descent = tuple - h = self.left + self.indent_left - if i == 0: h = h + self.indent_hang - extra = 0 - if self.just == 'r': h = h + avail - width - elif self.just == 'c': h = h + (avail - width) / 2 - elif self.just == 'lr' and stretch > 0: - extra = avail - width - v2 = v + ascent + descent - for j in range(i, i+wordcount): - word = self.words[j] - if type(word) is Int: - ok = anchorfunc(self, tuple, word, \ - h, v) - if ok is not None: return ok - continue - fo, te, wi, sp, st, as, de = word - if extra > 0 and stretch > 0: - ex = extra * st / stretch - extra = extra - ex - stretch = stretch - st - else: - ex = 0 - h2 = h + wi + sp + ex - ok = wordfunc(self, tuple, word, h, v, \ - h2, v2, (j==i), (j==i+wordcount-1)) - if ok is not None: return ok - h = h2 - v = v2 - i = i + wordcount - avail = avail1 - # - # Render a paragraph in "drawing object" d, using the rectangle - # given by (left, top, right) with an unspecified bottom. - # Return the computed bottom of the text. - def render(self, d, left, top, right): - if self.width != right-left: - self.layout(right-left) - self.left = left - self.top = top - self.right = right - self.bottom = self.top + self.height - self.anchorid = 0 - try: - self.d = d - self.visit(self.__class__._renderword, \ - self.__class__._renderanchor) - finally: - self.d = None - return self.bottom - # - def _renderword(self, tuple, word, h, v, h2, v2, isfirst, islast): - if word[0] is not None: self.d.setfont(word[0]) - baseline = v + tuple[5] - self.d.text((h, baseline - word[5]), word[1]) - if self.anchorid > 0: - self.d.line((h, baseline+2), (h2, baseline+2)) - # - def _renderanchor(self, tuple, word, h, v): - self.anchorid = word - # - # Return which anchor(s) was hit by the mouse - def hitcheck(self, mouseh, mousev): - self.mouseh = mouseh - self.mousev = mousev - self.anchorid = 0 - self.hits = [] - self.visit(self.__class__._hitcheckword, \ - self.__class__._hitcheckanchor) - return self.hits - # - def _hitcheckword(self, tuple, word, h, v, h2, v2, isfirst, islast): - if self.anchorid > 0 and h <= self.mouseh <= h2 and \ - v <= self.mousev <= v2: - self.hits.append(self.anchorid) - # - def _hitcheckanchor(self, tuple, word, h, v): - self.anchorid = word - # - # Return whether the given anchor id is present - def hasanchor(self, id): - return id in self.words or -id in self.words - # - # Extract the raw text from the word list, substituting one space - # for non-empty inter-word space, and terminating with '\n' - def extract(self): - text = '' - for w in self.words: - if type(w) is not Int: - word = w[1] - if w[3]: word = word + ' ' - text = text + word - return text + '\n' - # - # Return which character position was hit by the mouse, as - # an offset in the entire text as returned by extract(). - # Return None if the mouse was not in this paragraph - def whereis(self, d, mouseh, mousev): - if mousev < self.top or mousev > self.bottom: - return None - self.mouseh = mouseh - self.mousev = mousev - self.lastfont = None - self.charcount = 0 - try: - self.d = d - return self.visit(self.__class__._whereisword, \ - self.__class__._whereisanchor) - finally: - self.d = None - # - def _whereisword(self, tuple, word, h1, v1, h2, v2, isfirst, islast): - fo, te, wi, sp, st, as, de = word - if fo is not None: self.lastfont = fo - h = h1 - if isfirst: h1 = 0 - if islast: h2 = 999999 - if not (v1 <= self.mousev <= v2 and h1 <= self.mouseh <= h2): - self.charcount = self.charcount + len(te) + (sp > 0) - return - if self.lastfont is not None: - self.d.setfont(self.lastfont) - cc = 0 - for c in te: - cw = self.d.textwidth(c) - if self.mouseh <= h + cw/2: - return self.charcount + cc - cc = cc+1 - h = h+cw - self.charcount = self.charcount + cc - if self.mouseh <= (h+h2) / 2: - return self.charcount - else: - return self.charcount + 1 - # - def _whereisanchor(self, tuple, word, h, v): - pass - # - # Return screen position corresponding to position in paragraph. - # Return tuple (h, vtop, vbaseline, vbottom). - # This is more or less the inverse of whereis() - def screenpos(self, d, pos): - if pos < 0: - ascent, descent = self.lines[0][5:7] - return self.left, self.top, self.top + ascent, \ - self.top + ascent + descent - self.pos = pos - self.lastfont = None - try: - self.d = d - ok = self.visit(self.__class__._screenposword, \ - self.__class__._screenposanchor) - finally: - self.d = None - if ok is None: - ascent, descent = self.lines[-1][5:7] - ok = self.right, self.bottom - ascent - descent, \ - self.bottom - descent, self.bottom - return ok - # - def _screenposword(self, tuple, word, h1, v1, h2, v2, isfirst, islast): - fo, te, wi, sp, st, as, de = word - if fo is not None: self.lastfont = fo - cc = len(te) + (sp > 0) - if self.pos > cc: - self.pos = self.pos - cc - return - if self.pos < cc: - self.d.setfont(self.lastfont) - h = h1 + self.d.textwidth(te[:self.pos]) - else: - h = h2 - ascent, descent = tuple[5:7] - return h, v1, v1+ascent, v2 - # - def _screenposanchor(self, tuple, word, h, v): - pass - # - # Invert the stretch of text between pos1 and pos2. - # If pos1 is None, the beginning is implied; - # if pos2 is None, the end is implied. - # Undoes its own effect when called again with the same arguments - def invert(self, d, pos1, pos2): - if pos1 is None: - pos1 = self.left, self.top, self.top, self.top - else: - pos1 = self.screenpos(d, pos1) - if pos2 is None: - pos2 = self.right, self.bottom,self.bottom,self.bottom - else: - pos2 = self.screenpos(d, pos2) - h1, top1, baseline1, bottom1 = pos1 - h2, top2, baseline2, bottom2 = pos2 - if bottom1 <= top2: - d.invert((h1, top1), (self.right, bottom1)) - h1 = self.left - if bottom1 < top2: - d.invert((h1, bottom1), (self.right, top2)) - top1, bottom1 = top2, bottom2 - d.invert((h1, top1), (h2, bottom2)) + # + def __init__(self): + self.words = [] # The words + self.just = 'l' # Justification: 'l', 'r', 'lr' or 'c' + self.indent_left = self.indent_right = self.indent_hang = 0 + # Final lay-out parameters, may change + self.left = self.top = self.right = self.bottom = \ + self.width = self.height = self.lines = None + # + # Add a word, computing size information for it. + # Words may also be added manually by appending to self.words + # Each word should be a 7-tuple: + # (font, text, width, space, stretch, ascent, descent) + def addword(self, d, font, text, space, stretch): + if font is not None: + d.setfont(font) + width = d.textwidth(text) + ascent = d.baseline() + descent = d.lineheight() - ascent + spw = d.textwidth(' ') + space = space * spw + stretch = stretch * spw + tuple = (font, text, width, space, stretch, ascent, descent) + self.words.append(tuple) + # + # Hooks to begin and end anchors -- insert numbers in the word list! + def bgn_anchor(self, id): + self.words.append(id) + # + def end_anchor(self, id): + self.words.append(0) + # + # Return the total length (width) of the text added so far, in pixels + def getlength(self): + total = 0 + for word in self.words: + if type(word) is not Int: + total = total + word[2] + word[3] + return total + # + # Tab to a given position (relative to the current left indent): + # remove all stretch, add fixed space up to the new indent. + # If the current position is already at the tab stop, + # don't add any new space (but still remove the stretch) + def tabto(self, tab): + total = 0 + as, de = 1, 0 + for i in range(len(self.words)): + word = self.words[i] + if type(word) is Int: continue + (fo, te, wi, sp, st, as, de) = word + self.words[i] = (fo, te, wi, sp, 0, as, de) + total = total + wi + sp + if total < tab: + self.words.append((None, '', 0, tab-total, 0, as, de)) + # + # Make a hanging tag: tab to hang, increment indent_left by hang, + # and reset indent_hang to -hang + def makehangingtag(self, hang): + self.tabto(hang) + self.indent_left = self.indent_left + hang + self.indent_hang = -hang + # + # Decide where the line breaks will be given some screen width + def layout(self, linewidth): + self.width = linewidth + height = 0 + self.lines = lines = [] + avail1 = self.width - self.indent_left - self.indent_right + avail = avail1 - self.indent_hang + words = self.words + i = 0 + n = len(words) + lastfont = None + while i < n: + firstfont = lastfont + charcount = 0 + width = 0 + stretch = 0 + ascent = 0 + descent = 0 + lsp = 0 + j = i + while i < n: + word = words[i] + if type(word) is Int: + if word > 0 and width >= avail: + break + i = i+1 + continue + fo, te, wi, sp, st, as, de = word + if width + wi > avail and width > 0 and wi > 0: + break + if fo is not None: + lastfont = fo + if width == 0: + firstfont = fo + charcount = charcount + len(te) + (sp > 0) + width = width + wi + sp + lsp = sp + stretch = stretch + st + lst = st + ascent = max(ascent, as) + descent = max(descent, de) + i = i+1 + while i > j and type(words[i-1]) is Int and \ + words[i-1] > 0: i = i-1 + width = width - lsp + if i < n: + stretch = stretch - lst + else: + stretch = 0 + tuple = i-j, firstfont, charcount, width, stretch, \ + ascent, descent + lines.append(tuple) + height = height + ascent + descent + avail = avail1 + self.height = height + # + # Call a function for all words in a line + def visit(self, wordfunc, anchorfunc): + avail1 = self.width - self.indent_left - self.indent_right + avail = avail1 - self.indent_hang + v = self.top + i = 0 + for tuple in self.lines: + wordcount, firstfont, charcount, width, stretch, \ + ascent, descent = tuple + h = self.left + self.indent_left + if i == 0: h = h + self.indent_hang + extra = 0 + if self.just == 'r': h = h + avail - width + elif self.just == 'c': h = h + (avail - width) / 2 + elif self.just == 'lr' and stretch > 0: + extra = avail - width + v2 = v + ascent + descent + for j in range(i, i+wordcount): + word = self.words[j] + if type(word) is Int: + ok = anchorfunc(self, tuple, word, \ + h, v) + if ok is not None: return ok + continue + fo, te, wi, sp, st, as, de = word + if extra > 0 and stretch > 0: + ex = extra * st / stretch + extra = extra - ex + stretch = stretch - st + else: + ex = 0 + h2 = h + wi + sp + ex + ok = wordfunc(self, tuple, word, h, v, \ + h2, v2, (j==i), (j==i+wordcount-1)) + if ok is not None: return ok + h = h2 + v = v2 + i = i + wordcount + avail = avail1 + # + # Render a paragraph in "drawing object" d, using the rectangle + # given by (left, top, right) with an unspecified bottom. + # Return the computed bottom of the text. + def render(self, d, left, top, right): + if self.width != right-left: + self.layout(right-left) + self.left = left + self.top = top + self.right = right + self.bottom = self.top + self.height + self.anchorid = 0 + try: + self.d = d + self.visit(self.__class__._renderword, \ + self.__class__._renderanchor) + finally: + self.d = None + return self.bottom + # + def _renderword(self, tuple, word, h, v, h2, v2, isfirst, islast): + if word[0] is not None: self.d.setfont(word[0]) + baseline = v + tuple[5] + self.d.text((h, baseline - word[5]), word[1]) + if self.anchorid > 0: + self.d.line((h, baseline+2), (h2, baseline+2)) + # + def _renderanchor(self, tuple, word, h, v): + self.anchorid = word + # + # Return which anchor(s) was hit by the mouse + def hitcheck(self, mouseh, mousev): + self.mouseh = mouseh + self.mousev = mousev + self.anchorid = 0 + self.hits = [] + self.visit(self.__class__._hitcheckword, \ + self.__class__._hitcheckanchor) + return self.hits + # + def _hitcheckword(self, tuple, word, h, v, h2, v2, isfirst, islast): + if self.anchorid > 0 and h <= self.mouseh <= h2 and \ + v <= self.mousev <= v2: + self.hits.append(self.anchorid) + # + def _hitcheckanchor(self, tuple, word, h, v): + self.anchorid = word + # + # Return whether the given anchor id is present + def hasanchor(self, id): + return id in self.words or -id in self.words + # + # Extract the raw text from the word list, substituting one space + # for non-empty inter-word space, and terminating with '\n' + def extract(self): + text = '' + for w in self.words: + if type(w) is not Int: + word = w[1] + if w[3]: word = word + ' ' + text = text + word + return text + '\n' + # + # Return which character position was hit by the mouse, as + # an offset in the entire text as returned by extract(). + # Return None if the mouse was not in this paragraph + def whereis(self, d, mouseh, mousev): + if mousev < self.top or mousev > self.bottom: + return None + self.mouseh = mouseh + self.mousev = mousev + self.lastfont = None + self.charcount = 0 + try: + self.d = d + return self.visit(self.__class__._whereisword, \ + self.__class__._whereisanchor) + finally: + self.d = None + # + def _whereisword(self, tuple, word, h1, v1, h2, v2, isfirst, islast): + fo, te, wi, sp, st, as, de = word + if fo is not None: self.lastfont = fo + h = h1 + if isfirst: h1 = 0 + if islast: h2 = 999999 + if not (v1 <= self.mousev <= v2 and h1 <= self.mouseh <= h2): + self.charcount = self.charcount + len(te) + (sp > 0) + return + if self.lastfont is not None: + self.d.setfont(self.lastfont) + cc = 0 + for c in te: + cw = self.d.textwidth(c) + if self.mouseh <= h + cw/2: + return self.charcount + cc + cc = cc+1 + h = h+cw + self.charcount = self.charcount + cc + if self.mouseh <= (h+h2) / 2: + return self.charcount + else: + return self.charcount + 1 + # + def _whereisanchor(self, tuple, word, h, v): + pass + # + # Return screen position corresponding to position in paragraph. + # Return tuple (h, vtop, vbaseline, vbottom). + # This is more or less the inverse of whereis() + def screenpos(self, d, pos): + if pos < 0: + ascent, descent = self.lines[0][5:7] + return self.left, self.top, self.top + ascent, \ + self.top + ascent + descent + self.pos = pos + self.lastfont = None + try: + self.d = d + ok = self.visit(self.__class__._screenposword, \ + self.__class__._screenposanchor) + finally: + self.d = None + if ok is None: + ascent, descent = self.lines[-1][5:7] + ok = self.right, self.bottom - ascent - descent, \ + self.bottom - descent, self.bottom + return ok + # + def _screenposword(self, tuple, word, h1, v1, h2, v2, isfirst, islast): + fo, te, wi, sp, st, as, de = word + if fo is not None: self.lastfont = fo + cc = len(te) + (sp > 0) + if self.pos > cc: + self.pos = self.pos - cc + return + if self.pos < cc: + self.d.setfont(self.lastfont) + h = h1 + self.d.textwidth(te[:self.pos]) + else: + h = h2 + ascent, descent = tuple[5:7] + return h, v1, v1+ascent, v2 + # + def _screenposanchor(self, tuple, word, h, v): + pass + # + # Invert the stretch of text between pos1 and pos2. + # If pos1 is None, the beginning is implied; + # if pos2 is None, the end is implied. + # Undoes its own effect when called again with the same arguments + def invert(self, d, pos1, pos2): + if pos1 is None: + pos1 = self.left, self.top, self.top, self.top + else: + pos1 = self.screenpos(d, pos1) + if pos2 is None: + pos2 = self.right, self.bottom,self.bottom,self.bottom + else: + pos2 = self.screenpos(d, pos2) + h1, top1, baseline1, bottom1 = pos1 + h2, top2, baseline2, bottom2 = pos2 + if bottom1 <= top2: + d.invert((h1, top1), (self.right, bottom1)) + h1 = self.left + if bottom1 < top2: + d.invert((h1, bottom1), (self.right, top2)) + top1, bottom1 = top2, bottom2 + d.invert((h1, top1), (h2, bottom2)) diff --git a/Lib/lib-old/addpack.py b/Lib/lib-old/addpack.py index 3d09236..2fb2601 100644 --- a/Lib/lib-old/addpack.py +++ b/Lib/lib-old/addpack.py @@ -33,35 +33,35 @@ # # If no directory is found, ImportError is raised. -_packs = {} # {pack: [pathname, ...], ...} +_packs = {} # {pack: [pathname, ...], ...} def addpack(pack, *locations): - import os - if os.path.isabs(pack): - base = os.path.basename(pack) - else: - base = pack - if _packs.has_key(base): - return - import sys - path = [] - for loc in _flatten(locations) + sys.path: - fn = os.path.join(loc, base) - if fn not in path and os.path.isdir(fn): - path.append(fn) - if pack != base and pack not in path and os.path.isdir(pack): - path.append(pack) - if not path: raise ImportError, 'package ' + pack + ' not found' - _packs[base] = path - for fn in path: - if fn not in sys.path: - sys.path.append(fn) + import os + if os.path.isabs(pack): + base = os.path.basename(pack) + else: + base = pack + if _packs.has_key(base): + return + import sys + path = [] + for loc in _flatten(locations) + sys.path: + fn = os.path.join(loc, base) + if fn not in path and os.path.isdir(fn): + path.append(fn) + if pack != base and pack not in path and os.path.isdir(pack): + path.append(pack) + if not path: raise ImportError, 'package ' + pack + ' not found' + _packs[base] = path + for fn in path: + if fn not in sys.path: + sys.path.append(fn) def _flatten(locations): - locs = [] - for loc in locations: - if type(loc) == type(''): - locs.append(loc) - else: - locs = locs + _flatten(loc) - return locs + locs = [] + for loc in locations: + if type(loc) == type(''): + locs.append(loc) + else: + locs = locs + _flatten(loc) + return locs diff --git a/Lib/lib-old/codehack.py b/Lib/lib-old/codehack.py index 248205b..0b5e3a1 100644 --- a/Lib/lib-old/codehack.py +++ b/Lib/lib-old/codehack.py @@ -36,46 +36,46 @@ identchars = string.ascii_letters + string.digits + '_' # Identifier characters _namecache = {} # The cache def getcodename(co): - try: - return co.co_name - except AttributeError: - pass - key = `co` # arbitrary but uniquely identifying string - if _namecache.has_key(key): return _namecache[key] - filename = co.co_filename - code = co.co_code - name = '' - if ord(code[0]) == SET_LINENO: - lineno = ord(code[1]) | ord(code[2]) << 8 - line = linecache.getline(filename, lineno) - words = line.split() - if len(words) >= 2 and words[0] in ('def', 'class'): - name = words[1] - for i in range(len(name)): - if name[i] not in identchars: - name = name[:i] - break - _namecache[key] = name - return name + try: + return co.co_name + except AttributeError: + pass + key = `co` # arbitrary but uniquely identifying string + if _namecache.has_key(key): return _namecache[key] + filename = co.co_filename + code = co.co_code + name = '' + if ord(code[0]) == SET_LINENO: + lineno = ord(code[1]) | ord(code[2]) << 8 + line = linecache.getline(filename, lineno) + words = line.split() + if len(words) >= 2 and words[0] in ('def', 'class'): + name = words[1] + for i in range(len(name)): + if name[i] not in identchars: + name = name[:i] + break + _namecache[key] = name + return name # Use the above routine to find a function's name. def getfuncname(func): - try: - return func.func_name - except AttributeError: - pass - return getcodename(func.func_code) + try: + return func.func_name + except AttributeError: + pass + return getcodename(func.func_code) # A part of the above code to extract just the line number from a code object. def getlineno(co): - try: - return co.co_firstlineno - except AttributeError: - pass - code = co.co_code - if ord(code[0]) == SET_LINENO: - return ord(code[1]) | ord(code[2]) << 8 - else: - return -1 + try: + return co.co_firstlineno + except AttributeError: + pass + code = co.co_code + if ord(code[0]) == SET_LINENO: + return ord(code[1]) | ord(code[2]) << 8 + else: + return -1 diff --git a/Lib/lib-old/dump.py b/Lib/lib-old/dump.py index ec895b7..60bdba8 100644 --- a/Lib/lib-old/dump.py +++ b/Lib/lib-old/dump.py @@ -23,41 +23,41 @@ # Dump a whole symbol table # def dumpsymtab(dict): - for key in dict.keys(): - dumpvar(key, dict[key]) + for key in dict.keys(): + dumpvar(key, dict[key]) # Dump a single variable # def dumpvar(name, x): - import sys - t = type(x) - if t == type({}): - print name, '= {}' - for key in x.keys(): - item = x[key] - if not printable(item): - print '#', - print name, '[', `key`, '] =', `item` - elif t in (type(''), type(0), type(0.0), type([]), type(())): - if not printable(x): - print '#', - print name, '=', `x` - elif t == type(sys): - print 'import', name, '#', x - else: - print '#', name, '=', x + import sys + t = type(x) + if t == type({}): + print name, '= {}' + for key in x.keys(): + item = x[key] + if not printable(item): + print '#', + print name, '[', `key`, '] =', `item` + elif t in (type(''), type(0), type(0.0), type([]), type(())): + if not printable(x): + print '#', + print name, '=', `x` + elif t == type(sys): + print 'import', name, '#', x + else: + print '#', name, '=', x # check if a value is printable in a way that can be read back with input() # def printable(x): - t = type(x) - if t in (type(''), type(0), type(0.0)): - return 1 - if t in (type([]), type(())): - for item in x: - if not printable(item): - return 0 - return 1 - if x == {}: - return 1 - return 0 + t = type(x) + if t in (type(''), type(0), type(0.0)): + return 1 + if t in (type([]), type(())): + for item in x: + if not printable(item): + return 0 + return 1 + if x == {}: + return 1 + return 0 diff --git a/Lib/lib-old/find.py b/Lib/lib-old/find.py index ccd9fdb..39ad771 100644 --- a/Lib/lib-old/find.py +++ b/Lib/lib-old/find.py @@ -6,21 +6,21 @@ _debug = 0 _prune = ['(*)'] def find(pattern, dir = os.curdir): - list = [] - names = os.listdir(dir) - names.sort() - for name in names: - if name in (os.curdir, os.pardir): - continue - fullname = os.path.join(dir, name) - if fnmatch.fnmatch(name, pattern): - list.append(fullname) - if os.path.isdir(fullname) and not os.path.islink(fullname): - for p in _prune: - if fnmatch.fnmatch(name, p): - if _debug: print "skip", `fullname` - break - else: - if _debug: print "descend into", `fullname` - list = list + find(pattern, fullname) - return list + list = [] + names = os.listdir(dir) + names.sort() + for name in names: + if name in (os.curdir, os.pardir): + continue + fullname = os.path.join(dir, name) + if fnmatch.fnmatch(name, pattern): + list.append(fullname) + if os.path.isdir(fullname) and not os.path.islink(fullname): + for p in _prune: + if fnmatch.fnmatch(name, p): + if _debug: print "skip", `fullname` + break + else: + if _debug: print "descend into", `fullname` + list = list + find(pattern, fullname) + return list diff --git a/Lib/lib-old/fmt.py b/Lib/lib-old/fmt.py index dfea987..997d37a 100644 --- a/Lib/lib-old/fmt.py +++ b/Lib/lib-old/fmt.py @@ -12,96 +12,96 @@ import Para # Formatter back-end to do nothing at all with the paragraphs class NullBackEnd: - # - def __init__(self): - pass - # - def addpara(self, p): - pass - # - def bgn_anchor(self, id): - pass - # - def end_anchor(self, id): - pass + # + def __init__(self): + pass + # + def addpara(self, p): + pass + # + def bgn_anchor(self, id): + pass + # + def end_anchor(self, id): + pass # Formatter back-end to collect the paragraphs in a list class SavingBackEnd(NullBackEnd): - # - def __init__(self): - self.paralist = [] - # - def addpara(self, p): - self.paralist.append(p) - # - def hitcheck(self, h, v): - hits = [] - for p in self.paralist: - if p.top <= v <= p.bottom: - for id in p.hitcheck(h, v): - if id not in hits: - hits.append(id) - return hits - # - def extract(self): - text = '' - for p in self.paralist: - text = text + (p.extract()) - return text - # - def extractpart(self, long1, long2): - if long1 > long2: long1, long2 = long2, long1 - para1, pos1 = long1 - para2, pos2 = long2 - text = '' - while para1 < para2: - ptext = self.paralist[para1].extract() - text = text + ptext[pos1:] - pos1 = 0 - para1 = para1 + 1 - ptext = self.paralist[para2].extract() - return text + ptext[pos1:pos2] - # - def whereis(self, d, h, v): - total = 0 - for i in range(len(self.paralist)): - p = self.paralist[i] - result = p.whereis(d, h, v) - if result is not None: - return i, result - return None - # - def roundtowords(self, long1, long2): - i, offset = long1 - text = self.paralist[i].extract() - while offset > 0 and text[offset-1] != ' ': offset = offset-1 - long1 = i, offset - # - i, offset = long2 - text = self.paralist[i].extract() - n = len(text) - while offset < n-1 and text[offset] != ' ': offset = offset+1 - long2 = i, offset - # - return long1, long2 - # - def roundtoparagraphs(self, long1, long2): - long1 = long1[0], 0 - long2 = long2[0], len(self.paralist[long2[0]].extract()) - return long1, long2 + # + def __init__(self): + self.paralist = [] + # + def addpara(self, p): + self.paralist.append(p) + # + def hitcheck(self, h, v): + hits = [] + for p in self.paralist: + if p.top <= v <= p.bottom: + for id in p.hitcheck(h, v): + if id not in hits: + hits.append(id) + return hits + # + def extract(self): + text = '' + for p in self.paralist: + text = text + (p.extract()) + return text + # + def extractpart(self, long1, long2): + if long1 > long2: long1, long2 = long2, long1 + para1, pos1 = long1 + para2, pos2 = long2 + text = '' + while para1 < para2: + ptext = self.paralist[para1].extract() + text = text + ptext[pos1:] + pos1 = 0 + para1 = para1 + 1 + ptext = self.paralist[para2].extract() + return text + ptext[pos1:pos2] + # + def whereis(self, d, h, v): + total = 0 + for i in range(len(self.paralist)): + p = self.paralist[i] + result = p.whereis(d, h, v) + if result is not None: + return i, result + return None + # + def roundtowords(self, long1, long2): + i, offset = long1 + text = self.paralist[i].extract() + while offset > 0 and text[offset-1] != ' ': offset = offset-1 + long1 = i, offset + # + i, offset = long2 + text = self.paralist[i].extract() + n = len(text) + while offset < n-1 and text[offset] != ' ': offset = offset+1 + long2 = i, offset + # + return long1, long2 + # + def roundtoparagraphs(self, long1, long2): + long1 = long1[0], 0 + long2 = long2[0], len(self.paralist[long2[0]].extract()) + return long1, long2 # Formatter back-end to send the text directly to the drawing object class WritingBackEnd(NullBackEnd): - # - def __init__(self, d, width): - self.d = d - self.width = width - self.lineno = 0 - # - def addpara(self, p): - self.lineno = p.render(self.d, 0, self.lineno, self.width) + # + def __init__(self, d, width): + self.d = d + self.width = width + self.lineno = 0 + # + def addpara(self, p): + self.lineno = p.render(self.d, 0, self.lineno, self.width) # A formatter receives a stream of formatting instructions and assembles @@ -125,192 +125,192 @@ class WritingBackEnd(NullBackEnd): # needvspace(nlines) # addword(word, nspaces) class BaseFormatter: - # - def __init__(self, d, b): - # Drawing object used for text measurements - self.d = d - # - # BackEnd object receiving completed paragraphs - self.b = b - # - # Parameters of the formatting model - self.leftindent = 0 - self.just = 'l' - self.font = None - self.blanklines = 0 - # - # Parameters derived from the current font - self.space = d.textwidth(' ') - self.line = d.lineheight() - self.ascent = d.baseline() - self.descent = self.line - self.ascent - # - # Parameter derived from the default font - self.n_space = self.space - # - # Current paragraph being built - self.para = None - self.nospace = 1 - # - # Font to set on the next word - self.nextfont = None - # - def newpara(self): - return Para.Para() - # - def setfont(self, font): - if font is None: return - self.font = self.nextfont = font - d = self.d - d.setfont(font) - self.space = d.textwidth(' ') - self.line = d.lineheight() - self.ascent = d.baseline() - self.descent = self.line - self.ascent - # - def setleftindent(self, nspaces): - self.leftindent = int(self.n_space * nspaces) - if self.para: - hang = self.leftindent - self.para.indent_left - if hang > 0 and self.para.getlength() <= hang: - self.para.makehangingtag(hang) - self.nospace = 1 - else: - self.flush() - # - def setrightindent(self, nspaces): - self.rightindent = int(self.n_space * nspaces) - if self.para: - self.para.indent_right = self.rightindent - self.flush() - # - def setjust(self, just): - self.just = just - if self.para: - self.para.just = self.just - # - def flush(self): - if self.para: - self.b.addpara(self.para) - self.para = None - if self.font is not None: - self.d.setfont(self.font) - self.nospace = 1 - # - def vspace(self, nlines): - self.flush() - if nlines > 0: - self.para = self.newpara() - tuple = None, '', 0, 0, 0, int(nlines*self.line), 0 - self.para.words.append(tuple) - self.flush() - self.blanklines = self.blanklines + nlines - # - def needvspace(self, nlines): - self.flush() # Just to be sure - if nlines > self.blanklines: - self.vspace(nlines - self.blanklines) - # - def addword(self, text, space): - if self.nospace and not text: - return - self.nospace = 0 - self.blanklines = 0 - if not self.para: - self.para = self.newpara() - self.para.indent_left = self.leftindent - self.para.just = self.just - self.nextfont = self.font - space = int(space * self.space) - self.para.words.append((self.nextfont, text, - self.d.textwidth(text), space, space, - self.ascent, self.descent)) - self.nextfont = None - # - def bgn_anchor(self, id): - if not self.para: - self.nospace = 0 - self.addword('', 0) - self.para.bgn_anchor(id) - # - def end_anchor(self, id): - if not self.para: - self.nospace = 0 - self.addword('', 0) - self.para.end_anchor(id) + # + def __init__(self, d, b): + # Drawing object used for text measurements + self.d = d + # + # BackEnd object receiving completed paragraphs + self.b = b + # + # Parameters of the formatting model + self.leftindent = 0 + self.just = 'l' + self.font = None + self.blanklines = 0 + # + # Parameters derived from the current font + self.space = d.textwidth(' ') + self.line = d.lineheight() + self.ascent = d.baseline() + self.descent = self.line - self.ascent + # + # Parameter derived from the default font + self.n_space = self.space + # + # Current paragraph being built + self.para = None + self.nospace = 1 + # + # Font to set on the next word + self.nextfont = None + # + def newpara(self): + return Para.Para() + # + def setfont(self, font): + if font is None: return + self.font = self.nextfont = font + d = self.d + d.setfont(font) + self.space = d.textwidth(' ') + self.line = d.lineheight() + self.ascent = d.baseline() + self.descent = self.line - self.ascent + # + def setleftindent(self, nspaces): + self.leftindent = int(self.n_space * nspaces) + if self.para: + hang = self.leftindent - self.para.indent_left + if hang > 0 and self.para.getlength() <= hang: + self.para.makehangingtag(hang) + self.nospace = 1 + else: + self.flush() + # + def setrightindent(self, nspaces): + self.rightindent = int(self.n_space * nspaces) + if self.para: + self.para.indent_right = self.rightindent + self.flush() + # + def setjust(self, just): + self.just = just + if self.para: + self.para.just = self.just + # + def flush(self): + if self.para: + self.b.addpara(self.para) + self.para = None + if self.font is not None: + self.d.setfont(self.font) + self.nospace = 1 + # + def vspace(self, nlines): + self.flush() + if nlines > 0: + self.para = self.newpara() + tuple = None, '', 0, 0, 0, int(nlines*self.line), 0 + self.para.words.append(tuple) + self.flush() + self.blanklines = self.blanklines + nlines + # + def needvspace(self, nlines): + self.flush() # Just to be sure + if nlines > self.blanklines: + self.vspace(nlines - self.blanklines) + # + def addword(self, text, space): + if self.nospace and not text: + return + self.nospace = 0 + self.blanklines = 0 + if not self.para: + self.para = self.newpara() + self.para.indent_left = self.leftindent + self.para.just = self.just + self.nextfont = self.font + space = int(space * self.space) + self.para.words.append((self.nextfont, text, + self.d.textwidth(text), space, space, + self.ascent, self.descent)) + self.nextfont = None + # + def bgn_anchor(self, id): + if not self.para: + self.nospace = 0 + self.addword('', 0) + self.para.bgn_anchor(id) + # + def end_anchor(self, id): + if not self.para: + self.nospace = 0 + self.addword('', 0) + self.para.end_anchor(id) # Measuring object for measuring text as viewed on a tty class NullMeasurer: - # - def __init__(self): - pass - # - def setfont(self, font): - pass - # - def textwidth(self, text): - return len(text) - # - def lineheight(self): - return 1 - # - def baseline(self): - return 0 + # + def __init__(self): + pass + # + def setfont(self, font): + pass + # + def textwidth(self, text): + return len(text) + # + def lineheight(self): + return 1 + # + def baseline(self): + return 0 # Drawing object for writing plain ASCII text to a file class FileWriter: - # - def __init__(self, fp): - self.fp = fp - self.lineno, self.colno = 0, 0 - # - def setfont(self, font): - pass - # - def text(self, (h, v), str): - if not str: return - if '\n' in str: - raise ValueError, 'can\'t write \\n' - while self.lineno < v: - self.fp.write('\n') - self.colno, self.lineno = 0, self.lineno + 1 - while self.lineno > v: - # XXX This should never happen... - self.fp.write('\033[A') # ANSI up arrow - self.lineno = self.lineno - 1 - if self.colno < h: - self.fp.write(' ' * (h - self.colno)) - elif self.colno > h: - self.fp.write('\b' * (self.colno - h)) - self.colno = h - self.fp.write(str) - self.colno = h + len(str) + # + def __init__(self, fp): + self.fp = fp + self.lineno, self.colno = 0, 0 + # + def setfont(self, font): + pass + # + def text(self, (h, v), str): + if not str: return + if '\n' in str: + raise ValueError, 'can\'t write \\n' + while self.lineno < v: + self.fp.write('\n') + self.colno, self.lineno = 0, self.lineno + 1 + while self.lineno > v: + # XXX This should never happen... + self.fp.write('\033[A') # ANSI up arrow + self.lineno = self.lineno - 1 + if self.colno < h: + self.fp.write(' ' * (h - self.colno)) + elif self.colno > h: + self.fp.write('\b' * (self.colno - h)) + self.colno = h + self.fp.write(str) + self.colno = h + len(str) # Formatting class to do nothing at all with the data class NullFormatter(BaseFormatter): - # - def __init__(self): - d = NullMeasurer() - b = NullBackEnd() - BaseFormatter.__init__(self, d, b) + # + def __init__(self): + d = NullMeasurer() + b = NullBackEnd() + BaseFormatter.__init__(self, d, b) # Formatting class to write directly to a file class WritingFormatter(BaseFormatter): - # - def __init__(self, fp, width): - dm = NullMeasurer() - dw = FileWriter(fp) - b = WritingBackEnd(dw, width) - BaseFormatter.__init__(self, dm, b) - self.blanklines = 1 - # - # Suppress multiple blank lines - def needvspace(self, nlines): - BaseFormatter.needvspace(self, min(1, nlines)) + # + def __init__(self, fp, width): + dm = NullMeasurer() + dw = FileWriter(fp) + b = WritingBackEnd(dw, width) + BaseFormatter.__init__(self, dm, b) + self.blanklines = 1 + # + # Suppress multiple blank lines + def needvspace(self, nlines): + BaseFormatter.needvspace(self, min(1, nlines)) # A "FunnyFormatter" writes ASCII text with a twist: *bold words*, @@ -320,10 +320,10 @@ class WritingFormatter(BaseFormatter): # Moreover, if the font is in upper case, the text is converted to # UPPER CASE. class FunnyFormatter(WritingFormatter): - # - def flush(self): - if self.para: finalize(self.para) - WritingFormatter.flush(self) + # + def flush(self): + if self.para: finalize(self.para) + WritingFormatter.flush(self) # Surrounds *bold words* and _italic text_ in a paragraph with @@ -334,33 +334,33 @@ openchar = \ closechar = \ {'b':'*', 'i':'_', 'u':'_', 'q':'\'', 'B':'*', 'I':'_', 'U':'_', 'Q':'\''} def finalize(para): - oldfont = curfont = 'r' - para.words.append(('r', '', 0, 0, 0, 0)) # temporary, deleted at end - for i in range(len(para.words)): - fo, te, wi = para.words[i][:3] - if fo is not None: curfont = fo - if curfont != oldfont: - if closechar.has_key(oldfont): - c = closechar[oldfont] - j = i-1 - while j > 0 and para.words[j][1] == '': j = j-1 - fo1, te1, wi1 = para.words[j][:3] - te1 = te1 + c - wi1 = wi1 + len(c) - para.words[j] = (fo1, te1, wi1) + \ - para.words[j][3:] - if openchar.has_key(curfont) and te: - c = openchar[curfont] - te = c + te - wi = len(c) + wi - para.words[i] = (fo, te, wi) + \ - para.words[i][3:] - if te: oldfont = curfont - else: oldfont = 'r' - if curfont in string.uppercase: - te = string.upper(te) - para.words[i] = (fo, te, wi) + para.words[i][3:] - del para.words[-1] + oldfont = curfont = 'r' + para.words.append(('r', '', 0, 0, 0, 0)) # temporary, deleted at end + for i in range(len(para.words)): + fo, te, wi = para.words[i][:3] + if fo is not None: curfont = fo + if curfont != oldfont: + if closechar.has_key(oldfont): + c = closechar[oldfont] + j = i-1 + while j > 0 and para.words[j][1] == '': j = j-1 + fo1, te1, wi1 = para.words[j][:3] + te1 = te1 + c + wi1 = wi1 + len(c) + para.words[j] = (fo1, te1, wi1) + \ + para.words[j][3:] + if openchar.has_key(curfont) and te: + c = openchar[curfont] + te = c + te + wi = len(c) + wi + para.words[i] = (fo, te, wi) + \ + para.words[i][3:] + if te: oldfont = curfont + else: oldfont = 'r' + if curfont in string.uppercase: + te = string.upper(te) + para.words[i] = (fo, te, wi) + para.words[i][3:] + del para.words[-1] # Formatter back-end to draw the text in a window. @@ -368,256 +368,256 @@ def finalize(para): # to minimize the delay before the user sees anything. # This manages the entire "document" of the window. class StdwinBackEnd(SavingBackEnd): - # - def __init__(self, window, drawnow): - self.window = window - self.drawnow = drawnow - self.width = window.getwinsize()[0] - self.selection = None - self.height = 0 - window.setorigin(0, 0) - window.setdocsize(0, 0) - self.d = window.begindrawing() - SavingBackEnd.__init__(self) - # - def finish(self): - self.d.close() - self.d = None - self.window.setdocsize(0, self.height) - # - def addpara(self, p): - self.paralist.append(p) - if self.drawnow: - self.height = \ - p.render(self.d, 0, self.height, self.width) - else: - p.layout(self.width) - p.left = 0 - p.top = self.height - p.right = self.width - p.bottom = self.height + p.height - self.height = p.bottom - # - def resize(self): - self.window.change((0, 0), (self.width, self.height)) - self.width = self.window.getwinsize()[0] - self.height = 0 - for p in self.paralist: - p.layout(self.width) - p.left = 0 - p.top = self.height - p.right = self.width - p.bottom = self.height + p.height - self.height = p.bottom - self.window.change((0, 0), (self.width, self.height)) - self.window.setdocsize(0, self.height) - # - def redraw(self, area): - d = self.window.begindrawing() - (left, top), (right, bottom) = area - d.erase(area) - d.cliprect(area) - for p in self.paralist: - if top < p.bottom and p.top < bottom: - v = p.render(d, p.left, p.top, p.right) - if self.selection: - self.invert(d, self.selection) - d.close() - # - def setselection(self, new): - if new: - long1, long2 = new - pos1 = long1[:3] - pos2 = long2[:3] - new = pos1, pos2 - if new != self.selection: - d = self.window.begindrawing() - if self.selection: - self.invert(d, self.selection) - if new: - self.invert(d, new) - d.close() - self.selection = new - # - def getselection(self): - return self.selection - # - def extractselection(self): - if self.selection: - a, b = self.selection - return self.extractpart(a, b) - else: - return None - # - def invert(self, d, region): - long1, long2 = region - if long1 > long2: long1, long2 = long2, long1 - para1, pos1 = long1 - para2, pos2 = long2 - while para1 < para2: - self.paralist[para1].invert(d, pos1, None) - pos1 = None - para1 = para1 + 1 - self.paralist[para2].invert(d, pos1, pos2) - # - def search(self, prog): - import re, string - if type(prog) is type(''): - prog = re.compile(string.lower(prog)) - if self.selection: - iold = self.selection[0][0] - else: - iold = -1 - hit = None - for i in range(len(self.paralist)): - if i == iold or i < iold and hit: - continue - p = self.paralist[i] - text = string.lower(p.extract()) - match = prog.search(text) - if match: - a, b = match.group(0) - long1 = i, a - long2 = i, b - hit = long1, long2 - if i > iold: - break - if hit: - self.setselection(hit) - i = hit[0][0] - p = self.paralist[i] - self.window.show((p.left, p.top), (p.right, p.bottom)) - return 1 - else: - return 0 - # - def showanchor(self, id): - for i in range(len(self.paralist)): - p = self.paralist[i] - if p.hasanchor(id): - long1 = i, 0 - long2 = i, len(p.extract()) - hit = long1, long2 - self.setselection(hit) - self.window.show( - (p.left, p.top), (p.right, p.bottom)) - break + # + def __init__(self, window, drawnow): + self.window = window + self.drawnow = drawnow + self.width = window.getwinsize()[0] + self.selection = None + self.height = 0 + window.setorigin(0, 0) + window.setdocsize(0, 0) + self.d = window.begindrawing() + SavingBackEnd.__init__(self) + # + def finish(self): + self.d.close() + self.d = None + self.window.setdocsize(0, self.height) + # + def addpara(self, p): + self.paralist.append(p) + if self.drawnow: + self.height = \ + p.render(self.d, 0, self.height, self.width) + else: + p.layout(self.width) + p.left = 0 + p.top = self.height + p.right = self.width + p.bottom = self.height + p.height + self.height = p.bottom + # + def resize(self): + self.window.change((0, 0), (self.width, self.height)) + self.width = self.window.getwinsize()[0] + self.height = 0 + for p in self.paralist: + p.layout(self.width) + p.left = 0 + p.top = self.height + p.right = self.width + p.bottom = self.height + p.height + self.height = p.bottom + self.window.change((0, 0), (self.width, self.height)) + self.window.setdocsize(0, self.height) + # + def redraw(self, area): + d = self.window.begindrawing() + (left, top), (right, bottom) = area + d.erase(area) + d.cliprect(area) + for p in self.paralist: + if top < p.bottom and p.top < bottom: + v = p.render(d, p.left, p.top, p.right) + if self.selection: + self.invert(d, self.selection) + d.close() + # + def setselection(self, new): + if new: + long1, long2 = new + pos1 = long1[:3] + pos2 = long2[:3] + new = pos1, pos2 + if new != self.selection: + d = self.window.begindrawing() + if self.selection: + self.invert(d, self.selection) + if new: + self.invert(d, new) + d.close() + self.selection = new + # + def getselection(self): + return self.selection + # + def extractselection(self): + if self.selection: + a, b = self.selection + return self.extractpart(a, b) + else: + return None + # + def invert(self, d, region): + long1, long2 = region + if long1 > long2: long1, long2 = long2, long1 + para1, pos1 = long1 + para2, pos2 = long2 + while para1 < para2: + self.paralist[para1].invert(d, pos1, None) + pos1 = None + para1 = para1 + 1 + self.paralist[para2].invert(d, pos1, pos2) + # + def search(self, prog): + import re, string + if type(prog) is type(''): + prog = re.compile(string.lower(prog)) + if self.selection: + iold = self.selection[0][0] + else: + iold = -1 + hit = None + for i in range(len(self.paralist)): + if i == iold or i < iold and hit: + continue + p = self.paralist[i] + text = string.lower(p.extract()) + match = prog.search(text) + if match: + a, b = match.group(0) + long1 = i, a + long2 = i, b + hit = long1, long2 + if i > iold: + break + if hit: + self.setselection(hit) + i = hit[0][0] + p = self.paralist[i] + self.window.show((p.left, p.top), (p.right, p.bottom)) + return 1 + else: + return 0 + # + def showanchor(self, id): + for i in range(len(self.paralist)): + p = self.paralist[i] + if p.hasanchor(id): + long1 = i, 0 + long2 = i, len(p.extract()) + hit = long1, long2 + self.setselection(hit) + self.window.show( + (p.left, p.top), (p.right, p.bottom)) + break # GL extensions class GLFontCache: - # - def __init__(self): - self.reset() - self.setfont('') - # - def reset(self): - self.fontkey = None - self.fonthandle = None - self.fontinfo = None - self.fontcache = {} - # - def close(self): - self.reset() - # - def setfont(self, fontkey): - if fontkey == '': - fontkey = 'Times-Roman 12' - elif ' ' not in fontkey: - fontkey = fontkey + ' 12' - if fontkey == self.fontkey: - return - if self.fontcache.has_key(fontkey): - handle = self.fontcache[fontkey] - else: - import string - i = string.index(fontkey, ' ') - name, sizestr = fontkey[:i], fontkey[i:] - size = eval(sizestr) - key1 = name + ' 1' - key = name + ' ' + `size` - # NB key may differ from fontkey! - if self.fontcache.has_key(key): - handle = self.fontcache[key] - else: - if self.fontcache.has_key(key1): - handle = self.fontcache[key1] - else: - import fm - handle = fm.findfont(name) - self.fontcache[key1] = handle - handle = handle.scalefont(size) - self.fontcache[fontkey] = \ - self.fontcache[key] = handle - self.fontkey = fontkey - if self.fonthandle != handle: - self.fonthandle = handle - self.fontinfo = handle.getfontinfo() - handle.setfont() + # + def __init__(self): + self.reset() + self.setfont('') + # + def reset(self): + self.fontkey = None + self.fonthandle = None + self.fontinfo = None + self.fontcache = {} + # + def close(self): + self.reset() + # + def setfont(self, fontkey): + if fontkey == '': + fontkey = 'Times-Roman 12' + elif ' ' not in fontkey: + fontkey = fontkey + ' 12' + if fontkey == self.fontkey: + return + if self.fontcache.has_key(fontkey): + handle = self.fontcache[fontkey] + else: + import string + i = string.index(fontkey, ' ') + name, sizestr = fontkey[:i], fontkey[i:] + size = eval(sizestr) + key1 = name + ' 1' + key = name + ' ' + `size` + # NB key may differ from fontkey! + if self.fontcache.has_key(key): + handle = self.fontcache[key] + else: + if self.fontcache.has_key(key1): + handle = self.fontcache[key1] + else: + import fm + handle = fm.findfont(name) + self.fontcache[key1] = handle + handle = handle.scalefont(size) + self.fontcache[fontkey] = \ + self.fontcache[key] = handle + self.fontkey = fontkey + if self.fonthandle != handle: + self.fonthandle = handle + self.fontinfo = handle.getfontinfo() + handle.setfont() class GLMeasurer(GLFontCache): - # - def textwidth(self, text): - return self.fonthandle.getstrwidth(text) - # - def baseline(self): - return self.fontinfo[6] - self.fontinfo[3] - # - def lineheight(self): - return self.fontinfo[6] + # + def textwidth(self, text): + return self.fonthandle.getstrwidth(text) + # + def baseline(self): + return self.fontinfo[6] - self.fontinfo[3] + # + def lineheight(self): + return self.fontinfo[6] class GLWriter(GLFontCache): - # - # NOTES: - # (1) Use gl.ortho2 to use X pixel coordinates! - # - def text(self, (h, v), text): - import gl, fm - gl.cmov2i(h, v + self.fontinfo[6] - self.fontinfo[3]) - fm.prstr(text) - # - def setfont(self, fontkey): - oldhandle = self.fonthandle - GLFontCache.setfont(fontkey) - if self.fonthandle != oldhandle: - handle.setfont() + # + # NOTES: + # (1) Use gl.ortho2 to use X pixel coordinates! + # + def text(self, (h, v), text): + import gl, fm + gl.cmov2i(h, v + self.fontinfo[6] - self.fontinfo[3]) + fm.prstr(text) + # + def setfont(self, fontkey): + oldhandle = self.fonthandle + GLFontCache.setfont(fontkey) + if self.fonthandle != oldhandle: + handle.setfont() class GLMeasurerWriter(GLMeasurer, GLWriter): - pass + pass class GLBackEnd(SavingBackEnd): - # - def __init__(self, wid): - import gl - gl.winset(wid) - self.wid = wid - self.width = gl.getsize()[1] - self.height = 0 - self.d = GLMeasurerWriter() - SavingBackEnd.__init__(self) - # - def finish(self): - pass - # - def addpara(self, p): - self.paralist.append(p) - self.height = p.render(self.d, 0, self.height, self.width) - # - def redraw(self): - import gl - gl.winset(self.wid) - width = gl.getsize()[1] - if width != self.width: - setdocsize = 1 - self.width = width - for p in self.paralist: - p.top = p.bottom = None - d = self.d - v = 0 - for p in self.paralist: - v = p.render(d, 0, v, width) + # + def __init__(self, wid): + import gl + gl.winset(wid) + self.wid = wid + self.width = gl.getsize()[1] + self.height = 0 + self.d = GLMeasurerWriter() + SavingBackEnd.__init__(self) + # + def finish(self): + pass + # + def addpara(self, p): + self.paralist.append(p) + self.height = p.render(self.d, 0, self.height, self.width) + # + def redraw(self): + import gl + gl.winset(self.wid) + width = gl.getsize()[1] + if width != self.width: + setdocsize = 1 + self.width = width + for p in self.paralist: + p.top = p.bottom = None + d = self.d + v = 0 + for p in self.paralist: + v = p.render(d, 0, v, width) diff --git a/Lib/lib-old/grep.py b/Lib/lib-old/grep.py index bdefbe6..2926746 100644 --- a/Lib/lib-old/grep.py +++ b/Lib/lib-old/grep.py @@ -8,72 +8,72 @@ opt_show_filename = 0 opt_show_lineno = 1 def grep(pat, *files): - return ggrep(RE_SYNTAX_GREP, pat, files) + return ggrep(RE_SYNTAX_GREP, pat, files) def egrep(pat, *files): - return ggrep(RE_SYNTAX_EGREP, pat, files) + return ggrep(RE_SYNTAX_EGREP, pat, files) def emgrep(pat, *files): - return ggrep(RE_SYNTAX_EMACS, pat, files) + return ggrep(RE_SYNTAX_EMACS, pat, files) def ggrep(syntax, pat, files): - if len(files) == 1 and type(files[0]) == type([]): - files = files[0] - global opt_show_filename - opt_show_filename = (len(files) != 1) - syntax = regex.set_syntax(syntax) - try: - prog = regex.compile(pat) - finally: - syntax = regex.set_syntax(syntax) - for filename in files: - fp = open(filename, 'r') - lineno = 0 - while 1: - line = fp.readline() - if not line: break - lineno = lineno + 1 - if prog.search(line) >= 0: - showline(filename, lineno, line, prog) - fp.close() + if len(files) == 1 and type(files[0]) == type([]): + files = files[0] + global opt_show_filename + opt_show_filename = (len(files) != 1) + syntax = regex.set_syntax(syntax) + try: + prog = regex.compile(pat) + finally: + syntax = regex.set_syntax(syntax) + for filename in files: + fp = open(filename, 'r') + lineno = 0 + while 1: + line = fp.readline() + if not line: break + lineno = lineno + 1 + if prog.search(line) >= 0: + showline(filename, lineno, line, prog) + fp.close() def pgrep(pat, *files): - if len(files) == 1 and type(files[0]) == type([]): - files = files[0] - global opt_show_filename - opt_show_filename = (len(files) != 1) - import re - prog = re.compile(pat) - for filename in files: - fp = open(filename, 'r') - lineno = 0 - while 1: - line = fp.readline() - if not line: break - lineno = lineno + 1 - if prog.search(line): - showline(filename, lineno, line, prog) - fp.close() + if len(files) == 1 and type(files[0]) == type([]): + files = files[0] + global opt_show_filename + opt_show_filename = (len(files) != 1) + import re + prog = re.compile(pat) + for filename in files: + fp = open(filename, 'r') + lineno = 0 + while 1: + line = fp.readline() + if not line: break + lineno = lineno + 1 + if prog.search(line): + showline(filename, lineno, line, prog) + fp.close() def showline(filename, lineno, line, prog): - if line[-1:] == '\n': line = line[:-1] - if opt_show_lineno: - prefix = `lineno`.rjust(3) + ': ' - else: - prefix = '' - if opt_show_filename: - prefix = filename + ': ' + prefix - print prefix + line - if opt_show_where: - start, end = prog.regs()[0] - line = line[:start] - if '\t' not in line: - prefix = ' ' * (len(prefix) + start) - else: - prefix = ' ' * len(prefix) - for c in line: - if c != '\t': c = ' ' - prefix = prefix + c - if start == end: prefix = prefix + '\\' - else: prefix = prefix + '^'*(end-start) - print prefix + if line[-1:] == '\n': line = line[:-1] + if opt_show_lineno: + prefix = `lineno`.rjust(3) + ': ' + else: + prefix = '' + if opt_show_filename: + prefix = filename + ': ' + prefix + print prefix + line + if opt_show_where: + start, end = prog.regs()[0] + line = line[:start] + if '\t' not in line: + prefix = ' ' * (len(prefix) + start) + else: + prefix = ' ' * len(prefix) + for c in line: + if c != '\t': c = ' ' + prefix = prefix + c + if start == end: prefix = prefix + '\\' + else: prefix = prefix + '^'*(end-start) + print prefix diff --git a/Lib/lib-old/lockfile.py b/Lib/lib-old/lockfile.py index 3aaeac0..cde9b48 100644 --- a/Lib/lib-old/lockfile.py +++ b/Lib/lib-old/lockfile.py @@ -1,15 +1,15 @@ import struct, fcntl def writelock(f): - _lock(f, fcntl.F_WRLCK) + _lock(f, fcntl.F_WRLCK) def readlock(f): - _lock(f, fcntl.F_RDLCK) + _lock(f, fcntl.F_RDLCK) def unlock(f): - _lock(f, fcntl.F_UNLCK) + _lock(f, fcntl.F_UNLCK) def _lock(f, op): - dummy = fcntl.fcntl(f.fileno(), fcntl.F_SETLKW, - struct.pack('2h8l', op, - 0, 0, 0, 0, 0, 0, 0, 0, 0)) + dummy = fcntl.fcntl(f.fileno(), fcntl.F_SETLKW, + struct.pack('2h8l', op, + 0, 0, 0, 0, 0, 0, 0, 0, 0)) diff --git a/Lib/lib-old/newdir.py b/Lib/lib-old/newdir.py index 937c49e..356becc 100644 --- a/Lib/lib-old/newdir.py +++ b/Lib/lib-old/newdir.py @@ -5,69 +5,69 @@ # the current local name space by default def listattrs(x): - try: - dictkeys = x.__dict__.keys() - except (AttributeError, TypeError): - dictkeys = [] - # - try: - methods = x.__methods__ - except (AttributeError, TypeError): - methods = [] - # - try: - members = x.__members__ - except (AttributeError, TypeError): - members = [] - # - try: - the_class = x.__class__ - except (AttributeError, TypeError): - the_class = None - # - try: - bases = x.__bases__ - except (AttributeError, TypeError): - bases = () - # - total = dictkeys + methods + members - if the_class: - # It's a class instace; add the class's attributes - # that are functions (methods)... - class_attrs = listattrs(the_class) - class_methods = [] - for name in class_attrs: - if is_function(getattr(the_class, name)): - class_methods.append(name) - total = total + class_methods - elif bases: - # It's a derived class; add the base class attributes - for base in bases: - base_attrs = listattrs(base) - total = total + base_attrs - total.sort() - return total - i = 0 - while i+1 < len(total): - if total[i] == total[i+1]: - del total[i+1] - else: - i = i+1 - return total + try: + dictkeys = x.__dict__.keys() + except (AttributeError, TypeError): + dictkeys = [] + # + try: + methods = x.__methods__ + except (AttributeError, TypeError): + methods = [] + # + try: + members = x.__members__ + except (AttributeError, TypeError): + members = [] + # + try: + the_class = x.__class__ + except (AttributeError, TypeError): + the_class = None + # + try: + bases = x.__bases__ + except (AttributeError, TypeError): + bases = () + # + total = dictkeys + methods + members + if the_class: + # It's a class instace; add the class's attributes + # that are functions (methods)... + class_attrs = listattrs(the_class) + class_methods = [] + for name in class_attrs: + if is_function(getattr(the_class, name)): + class_methods.append(name) + total = total + class_methods + elif bases: + # It's a derived class; add the base class attributes + for base in bases: + base_attrs = listattrs(base) + total = total + base_attrs + total.sort() + return total + i = 0 + while i+1 < len(total): + if total[i] == total[i+1]: + del total[i+1] + else: + i = i+1 + return total # Helper to recognize functions def is_function(x): - return type(x) == type(is_function) + return type(x) == type(is_function) # Approximation of builtin dir(); but note that this lists the user's # variables by default, not the current local name space. def dir(x = None): - if x is not None: - return listattrs(x) - else: - import __main__ - return listattrs(__main__) + if x is not None: + return listattrs(x) + else: + import __main__ + return listattrs(__main__) diff --git a/Lib/lib-old/packmail.py b/Lib/lib-old/packmail.py index 9c2b566..e569108 100644 --- a/Lib/lib-old/packmail.py +++ b/Lib/lib-old/packmail.py @@ -8,104 +8,104 @@ from stat import ST_MTIME # Print help def help(): - print 'All fns have a file open for writing as first parameter' - print 'pack(f, fullname, name): pack fullname as name' - print 'packsome(f, directory, namelist): selected files from directory' - print 'packall(f, directory): pack all files from directory' - print 'packnotolder(f, directory, name): pack all files from directory' - print ' that are not older than a file there' - print 'packtree(f, directory): pack entire directory tree' + print 'All fns have a file open for writing as first parameter' + print 'pack(f, fullname, name): pack fullname as name' + print 'packsome(f, directory, namelist): selected files from directory' + print 'packall(f, directory): pack all files from directory' + print 'packnotolder(f, directory, name): pack all files from directory' + print ' that are not older than a file there' + print 'packtree(f, directory): pack entire directory tree' # Pack one file def pack(outfp, file, name): - fp = open(file, 'r') - outfp.write('echo ' + name + '\n') - outfp.write('sed "s/^X//" >"' + name + '" <<"!"\n') - while 1: - line = fp.readline() - if not line: break - if line[-1:] != '\n': - line = line + '\n' - outfp.write('X' + line) - outfp.write('!\n') - fp.close() + fp = open(file, 'r') + outfp.write('echo ' + name + '\n') + outfp.write('sed "s/^X//" >"' + name + '" <<"!"\n') + while 1: + line = fp.readline() + if not line: break + if line[-1:] != '\n': + line = line + '\n' + outfp.write('X' + line) + outfp.write('!\n') + fp.close() # Pack some files from a directory def packsome(outfp, dirname, names): - for name in names: - print name - file = os.path.join(dirname, name) - pack(outfp, file, name) + for name in names: + print name + file = os.path.join(dirname, name) + pack(outfp, file, name) # Pack all files from a directory def packall(outfp, dirname): - names = os.listdir(dirname) - try: - names.remove('.') - except: - pass - try: - names.remove('..') - except: - pass - names.sort() - packsome(outfp, dirname, names) + names = os.listdir(dirname) + try: + names.remove('.') + except: + pass + try: + names.remove('..') + except: + pass + names.sort() + packsome(outfp, dirname, names) # Pack all files from a directory that are not older than a give one def packnotolder(outfp, dirname, oldest): - names = os.listdir(dirname) - try: - names.remove('.') - except: - pass - try: - names.remove('..') - except: - pass - oldest = os.path.join(dirname, oldest) - st = os.stat(oldest) - mtime = st[ST_MTIME] - todo = [] - for name in names: - print name, '...', - st = os.stat(os.path.join(dirname, name)) - if st[ST_MTIME] >= mtime: - print 'Yes.' - todo.append(name) - else: - print 'No.' - todo.sort() - packsome(outfp, dirname, todo) + names = os.listdir(dirname) + try: + names.remove('.') + except: + pass + try: + names.remove('..') + except: + pass + oldest = os.path.join(dirname, oldest) + st = os.stat(oldest) + mtime = st[ST_MTIME] + todo = [] + for name in names: + print name, '...', + st = os.stat(os.path.join(dirname, name)) + if st[ST_MTIME] >= mtime: + print 'Yes.' + todo.append(name) + else: + print 'No.' + todo.sort() + packsome(outfp, dirname, todo) # Pack a whole tree (no exceptions) def packtree(outfp, dirname): - print 'packtree', dirname - outfp.write('mkdir ' + unixfix(dirname) + '\n') - names = os.listdir(dirname) - try: - names.remove('.') - except: - pass - try: - names.remove('..') - except: - pass - subdirs = [] - for name in names: - fullname = os.path.join(dirname, name) - if os.path.isdir(fullname): - subdirs.append(fullname) - else: - print 'pack', fullname - pack(outfp, fullname, unixfix(fullname)) - for subdirname in subdirs: - packtree(outfp, subdirname) + print 'packtree', dirname + outfp.write('mkdir ' + unixfix(dirname) + '\n') + names = os.listdir(dirname) + try: + names.remove('.') + except: + pass + try: + names.remove('..') + except: + pass + subdirs = [] + for name in names: + fullname = os.path.join(dirname, name) + if os.path.isdir(fullname): + subdirs.append(fullname) + else: + print 'pack', fullname + pack(outfp, fullname, unixfix(fullname)) + for subdirname in subdirs: + packtree(outfp, subdirname) def unixfix(name): - comps = name.split(os.sep) - res = '' - for comp in comps: - if comp: - if res: res = res + '/' - res = res + comp - return res + comps = name.split(os.sep) + res = '' + for comp in comps: + if comp: + if res: res = res + '/' + res = res + comp + return res diff --git a/Lib/lib-old/poly.py b/Lib/lib-old/poly.py index f89bd14..fe6a1dc 100644 --- a/Lib/lib-old/poly.py +++ b/Lib/lib-old/poly.py @@ -6,47 +6,47 @@ # taken out by normalize(). def normalize(p): # Strip unnecessary zero coefficients - n = len(p) - while n: - if p[n-1]: return p[:n] - n = n-1 - return [] + n = len(p) + while n: + if p[n-1]: return p[:n] + n = n-1 + return [] def plus(a, b): - if len(a) < len(b): a, b = b, a # make sure a is the longest - res = a[:] # make a copy - for i in range(len(b)): - res[i] = res[i] + b[i] - return normalize(res) + if len(a) < len(b): a, b = b, a # make sure a is the longest + res = a[:] # make a copy + for i in range(len(b)): + res[i] = res[i] + b[i] + return normalize(res) def minus(a, b): - neg_b = map(lambda x: -x, b[:]) - return plus(a, neg_b) + neg_b = map(lambda x: -x, b[:]) + return plus(a, neg_b) def one(power, coeff): # Representation of coeff * x**power - res = [] - for i in range(power): res.append(0) - return res + [coeff] + res = [] + for i in range(power): res.append(0) + return res + [coeff] def times(a, b): - res = [] - for i in range(len(a)): - for j in range(len(b)): - res = plus(res, one(i+j, a[i]*b[j])) - return res + res = [] + for i in range(len(a)): + for j in range(len(b)): + res = plus(res, one(i+j, a[i]*b[j])) + return res def power(a, n): # Raise polynomial a to the positive integral power n - if n == 0: return [1] - if n == 1: return a - if n/2*2 == n: - b = power(a, n/2) - return times(b, b) - return times(power(a, n-1), a) + if n == 0: return [1] + if n == 1: return a + if n/2*2 == n: + b = power(a, n/2) + return times(b, b) + return times(power(a, n-1), a) def der(a): # First derivative - res = a[1:] - for i in range(len(res)): - res[i] = res[i] * (i+1) - return res + res = a[1:] + for i in range(len(res)): + res[i] = res[i] * (i+1) + return res # Computing a primitive function would require rational arithmetic... diff --git a/Lib/lib-old/rand.py b/Lib/lib-old/rand.py index c299d0a..a557b69 100644 --- a/Lib/lib-old/rand.py +++ b/Lib/lib-old/rand.py @@ -4,10 +4,10 @@ import whrandom def srand(seed): - whrandom.seed(seed%256, seed/256%256, seed/65536%256) + whrandom.seed(seed%256, seed/256%256, seed/65536%256) def rand(): - return int(whrandom.random() * 32768.0) % 32768 + return int(whrandom.random() * 32768.0) % 32768 def choice(seq): - return seq[rand() % len(seq)] + return seq[rand() % len(seq)] diff --git a/Lib/lib-old/tb.py b/Lib/lib-old/tb.py index 57851aa..9063559 100644 --- a/Lib/lib-old/tb.py +++ b/Lib/lib-old/tb.py @@ -12,166 +12,166 @@ def br(): browser(sys.last_traceback) def tb(): printtb(sys.last_traceback) def browser(tb): - if not tb: - print 'No traceback.' - return - tblist = [] - while tb: - tblist.append(tb) - tb = tb.tb_next - ptr = len(tblist)-1 - tb = tblist[ptr] - while 1: - if tb != tblist[ptr]: - tb = tblist[ptr] - print `ptr` + ':', - printtbheader(tb) - try: - line = raw_input('TB: ') - except KeyboardInterrupt: - print '\n[Interrupted]' - break - except EOFError: - print '\n[EOF]' - break - cmd = line.strip() - if cmd: - if cmd == 'quit': - break - elif cmd == 'list': - browserlist(tb) - elif cmd == 'up': - if ptr-1 >= 0: ptr = ptr-1 - else: print 'Bottom of stack.' - elif cmd == 'down': - if ptr+1 < len(tblist): ptr = ptr+1 - else: print 'Top of stack.' - elif cmd == 'locals': - printsymbols(tb.tb_frame.f_locals) - elif cmd == 'globals': - printsymbols(tb.tb_frame.f_globals) - elif cmd in ('?', 'help'): - browserhelp() - else: - browserexec(tb, cmd) + if not tb: + print 'No traceback.' + return + tblist = [] + while tb: + tblist.append(tb) + tb = tb.tb_next + ptr = len(tblist)-1 + tb = tblist[ptr] + while 1: + if tb != tblist[ptr]: + tb = tblist[ptr] + print `ptr` + ':', + printtbheader(tb) + try: + line = raw_input('TB: ') + except KeyboardInterrupt: + print '\n[Interrupted]' + break + except EOFError: + print '\n[EOF]' + break + cmd = line.strip() + if cmd: + if cmd == 'quit': + break + elif cmd == 'list': + browserlist(tb) + elif cmd == 'up': + if ptr-1 >= 0: ptr = ptr-1 + else: print 'Bottom of stack.' + elif cmd == 'down': + if ptr+1 < len(tblist): ptr = ptr+1 + else: print 'Top of stack.' + elif cmd == 'locals': + printsymbols(tb.tb_frame.f_locals) + elif cmd == 'globals': + printsymbols(tb.tb_frame.f_globals) + elif cmd in ('?', 'help'): + browserhelp() + else: + browserexec(tb, cmd) def browserlist(tb): - filename = tb.tb_frame.f_code.co_filename - lineno = tb.tb_lineno - last = lineno - first = max(1, last-10) - for i in range(first, last+1): - if i == lineno: prefix = '***' + `i`.rjust(4) + ':' - else: prefix = `i`.rjust(7) + ':' - line = linecache.getline(filename, i) - if line[-1:] == '\n': line = line[:-1] - print prefix + line + filename = tb.tb_frame.f_code.co_filename + lineno = tb.tb_lineno + last = lineno + first = max(1, last-10) + for i in range(first, last+1): + if i == lineno: prefix = '***' + `i`.rjust(4) + ':' + else: prefix = `i`.rjust(7) + ':' + line = linecache.getline(filename, i) + if line[-1:] == '\n': line = line[:-1] + print prefix + line def browserexec(tb, cmd): - locals = tb.tb_frame.f_locals - globals = tb.tb_frame.f_globals - try: - exec cmd+'\n' in globals, locals - except: - t, v = sys.exc_info()[:2] - print '*** Exception:', - if type(t) is type(''): - print t, - else: - print t.__name__, - if v is not None: - print ':', v, - print - print 'Type help to get help.' + locals = tb.tb_frame.f_locals + globals = tb.tb_frame.f_globals + try: + exec cmd+'\n' in globals, locals + except: + t, v = sys.exc_info()[:2] + print '*** Exception:', + if type(t) is type(''): + print t, + else: + print t.__name__, + if v is not None: + print ':', v, + print + print 'Type help to get help.' def browserhelp(): - print - print ' This is the traceback browser. Commands are:' - print ' up : move one level up in the call stack' - print ' down : move one level down in the call stack' - print ' locals : print all local variables at this level' - print ' globals : print all global variables at this level' - print ' list : list source code around the failure' - print ' help : print help (what you are reading now)' - print ' quit : back to command interpreter' - print ' Typing any other 1-line statement will execute it' - print ' using the current level\'s symbol tables' - print + print + print ' This is the traceback browser. Commands are:' + print ' up : move one level up in the call stack' + print ' down : move one level down in the call stack' + print ' locals : print all local variables at this level' + print ' globals : print all global variables at this level' + print ' list : list source code around the failure' + print ' help : print help (what you are reading now)' + print ' quit : back to command interpreter' + print ' Typing any other 1-line statement will execute it' + print ' using the current level\'s symbol tables' + print def printtb(tb): - while tb: - print1tb(tb) - tb = tb.tb_next + while tb: + print1tb(tb) + tb = tb.tb_next def print1tb(tb): - printtbheader(tb) - if tb.tb_frame.f_locals is not tb.tb_frame.f_globals: - printsymbols(tb.tb_frame.f_locals) + printtbheader(tb) + if tb.tb_frame.f_locals is not tb.tb_frame.f_globals: + printsymbols(tb.tb_frame.f_locals) def printtbheader(tb): - filename = tb.tb_frame.f_code.co_filename - lineno = tb.tb_lineno - info = '"' + filename + '"(' + `lineno` + ')' - line = linecache.getline(filename, lineno) - if line: - info = info + ': ' + line.strip() - print info + filename = tb.tb_frame.f_code.co_filename + lineno = tb.tb_lineno + info = '"' + filename + '"(' + `lineno` + ')' + line = linecache.getline(filename, lineno) + if line: + info = info + ': ' + line.strip() + print info def printsymbols(d): - keys = d.keys() - keys.sort() - for name in keys: - print ' ' + name.ljust(12) + ':', - printobject(d[name], 4) - print + keys = d.keys() + keys.sort() + for name in keys: + print ' ' + name.ljust(12) + ':', + printobject(d[name], 4) + print def printobject(v, maxlevel): - if v is None: - print 'None', - elif type(v) in (type(0), type(0.0)): - print v, - elif type(v) is type(''): - if len(v) > 20: - print `v[:17] + '...'`, - else: - print `v`, - elif type(v) is type(()): - print '(', - printlist(v, maxlevel) - print ')', - elif type(v) is type([]): - print '[', - printlist(v, maxlevel) - print ']', - elif type(v) is type({}): - print '{', - printdict(v, maxlevel) - print '}', - else: - print v, + if v is None: + print 'None', + elif type(v) in (type(0), type(0.0)): + print v, + elif type(v) is type(''): + if len(v) > 20: + print `v[:17] + '...'`, + else: + print `v`, + elif type(v) is type(()): + print '(', + printlist(v, maxlevel) + print ')', + elif type(v) is type([]): + print '[', + printlist(v, maxlevel) + print ']', + elif type(v) is type({}): + print '{', + printdict(v, maxlevel) + print '}', + else: + print v, def printlist(v, maxlevel): - n = len(v) - if n == 0: return - if maxlevel <= 0: - print '...', - return - for i in range(min(6, n)): - printobject(v[i], maxlevel-1) - if i+1 < n: print ',', - if n > 6: print '...', + n = len(v) + if n == 0: return + if maxlevel <= 0: + print '...', + return + for i in range(min(6, n)): + printobject(v[i], maxlevel-1) + if i+1 < n: print ',', + if n > 6: print '...', def printdict(v, maxlevel): - keys = v.keys() - n = len(keys) - if n == 0: return - if maxlevel <= 0: - print '...', - return - keys.sort() - for i in range(min(6, n)): - key = keys[i] - print `key` + ':', - printobject(v[key], maxlevel-1) - if i+1 < n: print ',', - if n > 6: print '...', + keys = v.keys() + n = len(keys) + if n == 0: return + if maxlevel <= 0: + print '...', + return + keys.sort() + for i in range(min(6, n)): + key = keys[i] + print `key` + ':', + printobject(v[key], maxlevel-1) + if i+1 < n: print ',', + if n > 6: print '...', diff --git a/Lib/lib-old/util.py b/Lib/lib-old/util.py index 6cb1433..104af1e 100644 --- a/Lib/lib-old/util.py +++ b/Lib/lib-old/util.py @@ -10,16 +10,16 @@ # If it occurs more than once, remove the first occurrence. # def remove(item, list): - if item in list: list.remove(item) + if item in list: list.remove(item) # Return a string containing a file's contents. # def readfile(fn): - return readopenfile(open(fn, 'r')) + return readopenfile(open(fn, 'r')) # Read an open file until EOF. # def readopenfile(fp): - return fp.read() + return fp.read() diff --git a/Lib/lib-old/zmod.py b/Lib/lib-old/zmod.py index 7259bf8..55f49df 100644 --- a/Lib/lib-old/zmod.py +++ b/Lib/lib-old/zmod.py @@ -1,7 +1,7 @@ # module 'zmod' # Compute properties of mathematical "fields" formed by taking -# Z/n (the whole numbers modulo some whole number n) and an +# Z/n (the whole numbers modulo some whole number n) and an # irreducible polynomial (i.e., a polynomial with only complex zeros), # e.g., Z/5 and X**2 + 2. # @@ -30,65 +30,65 @@ P = poly.plus(poly.one(0, 2), poly.one(2, 1)) # 2 + x**2 # Return x modulo y. Returns >= 0 even if x < 0. def mod(x, y): - return divmod(x, y)[1] + return divmod(x, y)[1] # Normalize a polynomial modulo n and modulo p. def norm(a, n, p): - a = poly.modulo(a, p) - a = a[:] - for i in range(len(a)): a[i] = mod(a[i], n) - a = poly.normalize(a) - return a + a = poly.modulo(a, p) + a = a[:] + for i in range(len(a)): a[i] = mod(a[i], n) + a = poly.normalize(a) + return a # Make a list of all n^d elements of the proposed field. def make_all(mat): - all = [] - for row in mat: - for a in row: - all.append(a) - return all + all = [] + for row in mat: + for a in row: + all.append(a) + return all def make_elements(n, d): - if d == 0: return [poly.one(0, 0)] - sub = make_elements(n, d-1) - all = [] - for a in sub: - for i in range(n): - all.append(poly.plus(a, poly.one(d-1, i))) - return all + if d == 0: return [poly.one(0, 0)] + sub = make_elements(n, d-1) + all = [] + for a in sub: + for i in range(n): + all.append(poly.plus(a, poly.one(d-1, i))) + return all def make_inv(all, n, p): - x = poly.one(1, 1) - inv = [] - for a in all: - inv.append(norm(poly.times(a, x), n, p)) - return inv + x = poly.one(1, 1) + inv = [] + for a in all: + inv.append(norm(poly.times(a, x), n, p)) + return inv def checkfield(n, p): - all = make_elements(n, len(p)-1) - inv = make_inv(all, n, p) - all1 = all[:] - inv1 = inv[:] - all1.sort() - inv1.sort() - if all1 == inv1: print 'BINGO!' - else: - print 'Sorry:', n, p - print all - print inv + all = make_elements(n, len(p)-1) + inv = make_inv(all, n, p) + all1 = all[:] + inv1 = inv[:] + all1.sort() + inv1.sort() + if all1 == inv1: print 'BINGO!' + else: + print 'Sorry:', n, p + print all + print inv def rj(s, width): - if type(s) is not type(''): s = `s` - n = len(s) - if n >= width: return s - return ' '*(width - n) + s + if type(s) is not type(''): s = `s` + n = len(s) + if n >= width: return s + return ' '*(width - n) + s def lj(s, width): - if type(s) is not type(''): s = `s` - n = len(s) - if n >= width: return s - return s + ' '*(width - n) + if type(s) is not type(''): s = `s` + n = len(s) + if n >= width: return s + return s + ' '*(width - n) diff --git a/Lib/lib-tk/Tix.py b/Lib/lib-tk/Tix.py index f19bf97..eb349dd 100755 --- a/Lib/lib-tk/Tix.py +++ b/Lib/lib-tk/Tix.py @@ -1104,15 +1104,15 @@ class ListNoteBook(TixWidget): return self.subwidget_list[name] def page(self, name): - return self.subwidget(name) + return self.subwidget(name) def pages(self): - # Can't call subwidgets_all directly because we don't want .nbframe - names = self.tk.split(self.tk.call(self._w, 'pages')) - ret = [] - for x in names: - ret.append(self.subwidget(x)) - return ret + # Can't call subwidgets_all directly because we don't want .nbframe + names = self.tk.split(self.tk.call(self._w, 'pages')) + ret = [] + for x in names: + ret.append(self.subwidget(x)) + return ret def raise_page(self, name): # raise is a python keyword self.tk.call(self._w, 'raise', name) @@ -1737,7 +1737,7 @@ class _dummyNoteBookFrame(NoteBookFrame, TixSubWidget): class _dummyPanedWindow(PanedWindow, TixSubWidget): def __init__(self, master, name, destroy_physically=1): - TixSubWidget.__init__(self, master, name, destroy_physically) + TixSubWidget.__init__(self, master, name, destroy_physically) ######################## ### Utility Routines ### diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py index 5ad065d..3ffd2df 100644 --- a/Lib/lib-tk/Tkinter.py +++ b/Lib/lib-tk/Tkinter.py @@ -1557,7 +1557,7 @@ class Tk(Misc, Wm): self._tkloaded = 0 # to avoid recursions in the getattr code in case of failure, we # ensure that self.tk is always _something_. - self.tk = None + self.tk = None if baseName is None: import sys, os baseName = os.path.basename(sys.argv[0]) diff --git a/Lib/lib-tk/tkFileDialog.py b/Lib/lib-tk/tkFileDialog.py index c2c661c..a35feed 100644 --- a/Lib/lib-tk/tkFileDialog.py +++ b/Lib/lib-tk/tkFileDialog.py @@ -131,8 +131,8 @@ def asksaveasfilename(**options): def askopenfilenames(**options): """Ask for multiple filenames to open - - Returns a list of filenames or empty list if + + Returns a list of filenames or empty list if cancel button selected """ options["multiple"]=1 @@ -151,8 +151,8 @@ def askopenfile(mode = "r", **options): def askopenfiles(mode = "r", **options): """Ask for multiple filenames and return the open file objects - - returns a list of open file objects or an empty list if + + returns a list of open file objects or an empty list if cancel selected """ @@ -204,7 +204,7 @@ if __name__ == "__main__": fp=open(openfilename,"r") fp.close() except: - print "Could not open File: " + print "Could not open File: " print sys.exc_info()[1] print "open", openfilename.encode(enc) @@ -213,4 +213,3 @@ if __name__ == "__main__": saveasfilename=asksaveasfilename() print "saveas", saveasfilename.encode(enc) - diff --git a/Lib/plat-atheos/IN.py b/Lib/plat-atheos/IN.py index a386a21..53f3d55 100644 --- a/Lib/plat-atheos/IN.py +++ b/Lib/plat-atheos/IN.py @@ -50,7 +50,7 @@ def __P(args): return args def __PMT(args): return args -def __P(args): return () +def __P(args): return () def __PMT(args): return () @@ -60,7 +60,7 @@ def __STRING(x): return "x" def __ASMNAME(cname): return __ASMNAME2 (__USER_LABEL_PREFIX__, cname) -def __attribute__(xyz): return +def __attribute__(xyz): return __USE_EXTERN_INLINES = 1 @@ -942,4 +942,3 @@ def IN6_IS_ADDR_MC_SITELOCAL(a): return \ def IN6_IS_ADDR_MC_ORGLOCAL(a): return \ def IN6_IS_ADDR_MC_GLOBAL(a): return \ - diff --git a/Lib/plat-atheos/TYPES.py b/Lib/plat-atheos/TYPES.py index 8166108..314ca73 100644 --- a/Lib/plat-atheos/TYPES.py +++ b/Lib/plat-atheos/TYPES.py @@ -50,7 +50,7 @@ def __P(args): return args def __PMT(args): return args -def __P(args): return () +def __P(args): return () def __PMT(args): return () @@ -60,7 +60,7 @@ def __STRING(x): return "x" def __ASMNAME(cname): return __ASMNAME2 (__USER_LABEL_PREFIX__, cname) -def __attribute__(xyz): return +def __attribute__(xyz): return __USE_EXTERN_INLINES = 1 @@ -140,4 +140,3 @@ _SYS_SYSMACROS_H = 1 def major(dev): return ( (( (dev) >> 8) & 0xff)) def minor(dev): return ( ((dev) & 0xff)) - diff --git a/Lib/plat-beos5/IN.py b/Lib/plat-beos5/IN.py index 1878a85..362cb41 100644 --- a/Lib/plat-beos5/IN.py +++ b/Lib/plat-beos5/IN.py @@ -324,4 +324,4 @@ FDSETSIZE = FD_SETSIZE NFDBITS = 32 def _FDMSKNO(fd): return ((fd) / NFDBITS) -def _FDBITNO(fd): return ((fd) % NFDBITS)
\ No newline at end of file +def _FDBITNO(fd): return ((fd) % NFDBITS) diff --git a/Lib/plat-irix5/AL.py b/Lib/plat-irix5/AL.py index ed17cde..ec941a2 100755 --- a/Lib/plat-irix5/AL.py +++ b/Lib/plat-irix5/AL.py @@ -1,61 +1,61 @@ -RATE_48000 = 48000 -RATE_44100 = 44100 -RATE_32000 = 32000 -RATE_22050 = 22050 -RATE_16000 = 16000 -RATE_11025 = 11025 -RATE_8000 = 8000 +RATE_48000 = 48000 +RATE_44100 = 44100 +RATE_32000 = 32000 +RATE_22050 = 22050 +RATE_16000 = 16000 +RATE_11025 = 11025 +RATE_8000 = 8000 SAMPFMT_TWOSCOMP= 1 -SAMPFMT_FLOAT = 32 -SAMPFMT_DOUBLE = 64 +SAMPFMT_FLOAT = 32 +SAMPFMT_DOUBLE = 64 -SAMPLE_8 = 1 -SAMPLE_16 = 2 - # SAMPLE_24 is the low 24 bits of a long, sign extended to 32 bits -SAMPLE_24 = 4 +SAMPLE_8 = 1 +SAMPLE_16 = 2 + # SAMPLE_24 is the low 24 bits of a long, sign extended to 32 bits +SAMPLE_24 = 4 -MONO = 1 -STEREO = 2 -QUADRO = 4 # 4CHANNEL is not a legal Python name +MONO = 1 +STEREO = 2 +QUADRO = 4 # 4CHANNEL is not a legal Python name -INPUT_LINE = 0 -INPUT_MIC = 1 -INPUT_DIGITAL = 2 +INPUT_LINE = 0 +INPUT_MIC = 1 +INPUT_DIGITAL = 2 -MONITOR_OFF = 0 -MONITOR_ON = 1 +MONITOR_OFF = 0 +MONITOR_ON = 1 -ERROR_NUMBER = 0 -ERROR_TYPE = 1 -ERROR_LOCATION_LSP = 2 -ERROR_LOCATION_MSP = 3 -ERROR_LENGTH = 4 +ERROR_NUMBER = 0 +ERROR_TYPE = 1 +ERROR_LOCATION_LSP = 2 +ERROR_LOCATION_MSP = 3 +ERROR_LENGTH = 4 -ERROR_INPUT_UNDERFLOW = 0 -ERROR_OUTPUT_OVERFLOW = 1 +ERROR_INPUT_UNDERFLOW = 0 +ERROR_OUTPUT_OVERFLOW = 1 # These seem to be not supported anymore: -##HOLD, RELEASE = 0, 1 -##ATTAIL, ATHEAD, ATMARK, ATTIME = 0, 1, 2, 3 - -DEFAULT_DEVICE = 1 - -INPUT_SOURCE = 0 -LEFT_INPUT_ATTEN = 1 -RIGHT_INPUT_ATTEN = 2 -INPUT_RATE = 3 -OUTPUT_RATE = 4 -LEFT_SPEAKER_GAIN = 5 -RIGHT_SPEAKER_GAIN = 6 -INPUT_COUNT = 7 -OUTPUT_COUNT = 8 -UNUSED_COUNT = 9 -SYNC_INPUT_TO_AES = 10 -SYNC_OUTPUT_TO_AES = 11 -MONITOR_CTL = 12 -LEFT_MONITOR_ATTEN = 13 -RIGHT_MONITOR_ATTEN = 14 - -ENUM_VALUE = 0 # only certain values are valid -RANGE_VALUE = 1 # any value in range is valid +##HOLD, RELEASE = 0, 1 +##ATTAIL, ATHEAD, ATMARK, ATTIME = 0, 1, 2, 3 + +DEFAULT_DEVICE = 1 + +INPUT_SOURCE = 0 +LEFT_INPUT_ATTEN = 1 +RIGHT_INPUT_ATTEN = 2 +INPUT_RATE = 3 +OUTPUT_RATE = 4 +LEFT_SPEAKER_GAIN = 5 +RIGHT_SPEAKER_GAIN = 6 +INPUT_COUNT = 7 +OUTPUT_COUNT = 8 +UNUSED_COUNT = 9 +SYNC_INPUT_TO_AES = 10 +SYNC_OUTPUT_TO_AES = 11 +MONITOR_CTL = 12 +LEFT_MONITOR_ATTEN = 13 +RIGHT_MONITOR_ATTEN = 14 + +ENUM_VALUE = 0 # only certain values are valid +RANGE_VALUE = 1 # any value in range is valid diff --git a/Lib/plat-irix5/CD.py b/Lib/plat-irix5/CD.py index ad56561..8c1e03b 100755 --- a/Lib/plat-irix5/CD.py +++ b/Lib/plat-irix5/CD.py @@ -1,34 +1,34 @@ -ERROR = 0 -NODISC = 1 -READY = 2 -PLAYING = 3 -PAUSED = 4 -STILL = 5 +ERROR = 0 +NODISC = 1 +READY = 2 +PLAYING = 3 +PAUSED = 4 +STILL = 5 -AUDIO = 0 -PNUM = 1 -INDEX = 2 -PTIME = 3 -ATIME = 4 -CATALOG = 5 -IDENT = 6 -CONTROL = 7 +AUDIO = 0 +PNUM = 1 +INDEX = 2 +PTIME = 3 +ATIME = 4 +CATALOG = 5 +IDENT = 6 +CONTROL = 7 -CDDA_DATASIZE = 2352 +CDDA_DATASIZE = 2352 -##CDDA_SUBCODESIZE = (sizeof(struct subcodeQ)) -##CDDA_BLOCKSIZE = (sizeof(struct cdframe)) -##CDDA_NUMSAMPLES = (CDDA_DATASIZE/2) +##CDDA_SUBCODESIZE = (sizeof(struct subcodeQ)) +##CDDA_BLOCKSIZE = (sizeof(struct cdframe)) +##CDDA_NUMSAMPLES = (CDDA_DATASIZE/2) ## -##CDQ_PREEMP_MASK = 0xd -##CDQ_COPY_MASK = 0xb -##CDQ_DDATA_MASK = 0xd -##CDQ_BROADCAST_MASK = 0x8 -##CDQ_PREEMPHASIS = 0x1 -##CDQ_COPY_PERMITTED = 0x2 -##CDQ_DIGITAL_DATA = 0x4 -##CDQ_BROADCAST_USE = 0x8 +##CDQ_PREEMP_MASK = 0xd +##CDQ_COPY_MASK = 0xb +##CDQ_DDATA_MASK = 0xd +##CDQ_BROADCAST_MASK = 0x8 +##CDQ_PREEMPHASIS = 0x1 +##CDQ_COPY_PERMITTED = 0x2 +##CDQ_DIGITAL_DATA = 0x4 +##CDQ_BROADCAST_USE = 0x8 ## -##CDQ_MODE1 = 0x1 -##CDQ_MODE2 = 0x2 -##CDQ_MODE3 = 0x3 +##CDQ_MODE1 = 0x1 +##CDQ_MODE2 = 0x2 +##CDQ_MODE3 = 0x3 diff --git a/Lib/plat-irix5/CL.py b/Lib/plat-irix5/CL.py index 468ecaa..23259c5 100755 --- a/Lib/plat-irix5/CL.py +++ b/Lib/plat-irix5/CL.py @@ -1,24 +1,24 @@ # Backward compatible module CL. # All relevant symbols are now defined in the module cl. try: - from cl import * + from cl import * except ImportError: - from CL_old import * + from CL_old import * else: - del CompressImage - del DecompressImage - del GetAlgorithmName - del OpenCompressor - del OpenDecompressor - del QueryAlgorithms - del QueryMaxHeaderSize - del QueryScheme - del QuerySchemeFromName - del SetDefault - del SetMax - del SetMin - try: - del cvt_type - except NameError: - pass - del error + del CompressImage + del DecompressImage + del GetAlgorithmName + del OpenCompressor + del OpenDecompressor + del QueryAlgorithms + del QueryMaxHeaderSize + del QueryScheme + del QuerySchemeFromName + del SetDefault + del SetMax + del SetMin + try: + del cvt_type + except NameError: + pass + del error diff --git a/Lib/plat-irix5/CL_old.py b/Lib/plat-irix5/CL_old.py index d9a4100..967b497 100755 --- a/Lib/plat-irix5/CL_old.py +++ b/Lib/plat-irix5/CL_old.py @@ -1,8 +1,8 @@ # # cl.h - Compression Library typedefs and prototypes # -# 01/07/92 Cleanup by Brian Knittel -# 02/18/92 Original Version by Brian Knittel +# 01/07/92 Cleanup by Brian Knittel +# 02/18/92 Original Version by Brian Knittel # # @@ -14,13 +14,13 @@ MAX_NUMBER_OF_ORIGINAL_FORMATS = 32 MONO = 0 STEREO_INTERLEAVED = 1 -# Video +# Video # YUV is defined to be the same thing as YCrCb (luma and two chroma components). -# 422 is appended to YUV (or YCrCb) if the chroma is sub-sampled by 2 -# horizontally, packed as U Y1 V Y2 (byte order). -# 422HC is appended to YUV (or YCrCb) if the chroma is sub-sampled by 2 -# vertically in addition to horizontally, and is packed the same as -# 422 except that U & V are not valid on the second line. +# 422 is appended to YUV (or YCrCb) if the chroma is sub-sampled by 2 +# horizontally, packed as U Y1 V Y2 (byte order). +# 422HC is appended to YUV (or YCrCb) if the chroma is sub-sampled by 2 +# vertically in addition to horizontally, and is packed the same as +# 422 except that U & V are not valid on the second line. # RGB = 0 RGBX = 1 @@ -29,62 +29,62 @@ RGB332 = 3 GRAYSCALE = 4 Y = 4 -YUV = 5 -YCbCr = 5 -YUV422 = 6 # 4:2:2 sampling -YCbCr422 = 6 # 4:2:2 sampling -YUV422HC = 7 # 4:1:1 sampling -YCbCr422HC = 7 # 4:1:1 sampling -YUV422DC = 7 # 4:1:1 sampling -YCbCr422DC = 7 # 4:1:1 sampling +YUV = 5 +YCbCr = 5 +YUV422 = 6 # 4:2:2 sampling +YCbCr422 = 6 # 4:2:2 sampling +YUV422HC = 7 # 4:1:1 sampling +YCbCr422HC = 7 # 4:1:1 sampling +YUV422DC = 7 # 4:1:1 sampling +YCbCr422DC = 7 # 4:1:1 sampling -BEST_FIT = -1 +BEST_FIT = -1 def BytesPerSample(s): - if s in (MONO, YUV): - return 2 - elif s == STEREO_INTERLEAVED: - return 4 - else: - return 0 + if s in (MONO, YUV): + return 2 + elif s == STEREO_INTERLEAVED: + return 4 + else: + return 0 def BytesPerPixel(f): - if f in (RGB, YUV): - return 3 - elif f in (RGBX, RGBA): - return 4 - elif f in (RGB332, GRAYSCALE): - return 1 - else: - return 2 + if f in (RGB, YUV): + return 3 + elif f in (RGBX, RGBA): + return 4 + elif f in (RGB332, GRAYSCALE): + return 1 + else: + return 2 def AudioFormatName(f): - if f == MONO: - return 'MONO' - elif f == STEREO_INTERLEAVED: - return 'STEREO_INTERLEAVED' - else: - return 'Not a valid format' + if f == MONO: + return 'MONO' + elif f == STEREO_INTERLEAVED: + return 'STEREO_INTERLEAVED' + else: + return 'Not a valid format' def VideoFormatName(f): - if f == RGB: - return 'RGB' - elif f == RGBX: - return 'RGBX' - elif f == RGBA: - return 'RGBA' - elif f == RGB332: - return 'RGB332' - elif f == GRAYSCALE: - return 'GRAYSCALE' - elif f == YUV: - return 'YUV' - elif f == YUV422: - return 'YUV422' - elif f == YUV422DC: - return 'YUV422DC' - else: - return 'Not a valid format' + if f == RGB: + return 'RGB' + elif f == RGBX: + return 'RGBX' + elif f == RGBA: + return 'RGBA' + elif f == RGB332: + return 'RGB332' + elif f == GRAYSCALE: + return 'GRAYSCALE' + elif f == YUV: + return 'YUV' + elif f == YUV422: + return 'YUV422' + elif f == YUV422DC: + return 'YUV422DC' + else: + return 'Not a valid format' MAX_NUMBER_OF_AUDIO_ALGORITHMS = 32 MAX_NUMBER_OF_VIDEO_ALGORITHMS = 32 @@ -96,11 +96,11 @@ AUDIO = 0 VIDEO = 1 def AlgorithmNumber(scheme): - return scheme & 0x7fff + return scheme & 0x7fff def AlgorithmType(scheme): - return (scheme >> 15) & 1 + return (scheme >> 15) & 1 def Algorithm(type, n): - return n | ((type & 1) << 15) + return n | ((type & 1) << 15) # # "compressionScheme" argument values @@ -114,7 +114,7 @@ G711_ALAW = Algorithm(AUDIO, 2) ALAW = Algorithm(AUDIO, 2) AWARE_MPEG_AUDIO = Algorithm(AUDIO, 3) AWARE_MULTIRATE = Algorithm(AUDIO, 4) - + UNCOMPRESSED = Algorithm(VIDEO, 0) UNCOMPRESSED_VIDEO = Algorithm(VIDEO, 0) RLE = Algorithm(VIDEO, 1) @@ -130,7 +130,7 @@ RTR1 = Algorithm(VIDEO, 5) MAX_NUMBER_OF_PARAMS = 256 # Default Parameters IMAGE_WIDTH = 0 -IMAGE_HEIGHT = 1 +IMAGE_HEIGHT = 1 ORIGINAL_FORMAT = 2 INTERNAL_FORMAT = 3 COMPONENTS = 4 @@ -138,7 +138,7 @@ BITS_PER_COMPONENT = 5 FRAME_RATE = 6 COMPRESSION_RATIO = 7 EXACT_COMPRESSION_RATIO = 8 -FRAME_BUFFER_SIZE = 9 +FRAME_BUFFER_SIZE = 9 COMPRESSED_BUFFER_SIZE = 10 BLOCK_SIZE = 11 PREROLL = 12 @@ -165,10 +165,10 @@ ZOOM_Y = NUMBER_OF_PARAMS + 2 # # Parameter value types # -ENUM_VALUE = 0 # only certain constant values are valid -RANGE_VALUE = 1 # any value in a given range is valid -FLOATING_ENUM_VALUE = 2 # only certain constant floating point values are valid -FLOATING_RANGE_VALUE = 3 # any value in a given floating point range is valid +ENUM_VALUE = 0 # only certain constant values are valid +RANGE_VALUE = 1 # any value in a given range is valid +FLOATING_ENUM_VALUE = 2 # only certain constant floating point values are valid +FLOATING_RANGE_VALUE = 3 # any value in a given floating point range is valid # # Algorithm Functionality @@ -208,29 +208,29 @@ HEADER_START_CODE = 0xc1C0DEC # error codes # -BAD_NO_BUFFERSPACE = -2 # no space for internal buffers -BAD_PVBUFFER = -3 # param/val buffer doesn't make sense -BAD_BUFFERLENGTH_NEG = -4 # negative buffer length -BAD_BUFFERLENGTH_ODD = -5 # odd length parameter/value buffer -BAD_PARAM = -6 # invalid parameter -BAD_COMPRESSION_SCHEME = -7 # compression scheme parameter invalid -BAD_COMPRESSOR_HANDLE = -8 # compression handle parameter invalid -BAD_COMPRESSOR_HANDLE_POINTER = -9 # compression handle pointer invalid -BAD_BUFFER_HANDLE = -10 # buffer handle invalid -BAD_BUFFER_QUERY_SIZE = -11 # buffer query size too large -JPEG_ERROR = -12 # error from libjpeg -BAD_FRAME_SIZE = -13 # frame size invalid -PARAM_OUT_OF_RANGE = -14 # parameter out of range -ADDED_ALGORITHM_ERROR = -15 # added algorithm had a unique error -BAD_ALGORITHM_TYPE = -16 # bad algorithm type -BAD_ALGORITHM_NAME = -17 # bad algorithm name -BAD_BUFFERING = -18 # bad buffering calls -BUFFER_NOT_CREATED = -19 # buffer not created -BAD_BUFFER_EXISTS = -20 # buffer already created -BAD_INTERNAL_FORMAT = -21 # invalid internal format -BAD_BUFFER_POINTER = -22 # invalid buffer pointer -FRAME_BUFFER_SIZE_ZERO = -23 # frame buffer has zero size -BAD_STREAM_HEADER = -24 # invalid stream header - -BAD_LICENSE = -25 # netls license not valid -AWARE_ERROR = -26 # error from libawcmp +BAD_NO_BUFFERSPACE = -2 # no space for internal buffers +BAD_PVBUFFER = -3 # param/val buffer doesn't make sense +BAD_BUFFERLENGTH_NEG = -4 # negative buffer length +BAD_BUFFERLENGTH_ODD = -5 # odd length parameter/value buffer +BAD_PARAM = -6 # invalid parameter +BAD_COMPRESSION_SCHEME = -7 # compression scheme parameter invalid +BAD_COMPRESSOR_HANDLE = -8 # compression handle parameter invalid +BAD_COMPRESSOR_HANDLE_POINTER = -9 # compression handle pointer invalid +BAD_BUFFER_HANDLE = -10 # buffer handle invalid +BAD_BUFFER_QUERY_SIZE = -11 # buffer query size too large +JPEG_ERROR = -12 # error from libjpeg +BAD_FRAME_SIZE = -13 # frame size invalid +PARAM_OUT_OF_RANGE = -14 # parameter out of range +ADDED_ALGORITHM_ERROR = -15 # added algorithm had a unique error +BAD_ALGORITHM_TYPE = -16 # bad algorithm type +BAD_ALGORITHM_NAME = -17 # bad algorithm name +BAD_BUFFERING = -18 # bad buffering calls +BUFFER_NOT_CREATED = -19 # buffer not created +BAD_BUFFER_EXISTS = -20 # buffer already created +BAD_INTERNAL_FORMAT = -21 # invalid internal format +BAD_BUFFER_POINTER = -22 # invalid buffer pointer +FRAME_BUFFER_SIZE_ZERO = -23 # frame buffer has zero size +BAD_STREAM_HEADER = -24 # invalid stream header + +BAD_LICENSE = -25 # netls license not valid +AWARE_ERROR = -26 # error from libawcmp diff --git a/Lib/plat-irix5/FL.py b/Lib/plat-irix5/FL.py index ae665e3..727da4c 100755 --- a/Lib/plat-irix5/FL.py +++ b/Lib/plat-irix5/FL.py @@ -7,9 +7,9 @@ _v20 = 1 _v21 = 1 ##import fl ##try: -## _v20 = (fl.get_rgbmode is not None) +## _v20 = (fl.get_rgbmode is not None) ##except: -## _v20 = 0 +## _v20 = 0 ##del fl NULL = 0 @@ -20,7 +20,7 @@ EVENT = -1 LABEL_SIZE = 64 if _v20: - SHORTCUT_SIZE = 32 + SHORTCUT_SIZE = 32 PLACE_FREE = 0 PLACE_SIZE = 1 PLACE_ASPECT = 2 @@ -119,7 +119,7 @@ TOUCH_BUTTON = 4 INOUT_BUTTON = 5 RETURN_BUTTON = 6 if _v20: - HIDDEN_RET_BUTTON = 7 + HIDDEN_RET_BUTTON = 7 BUTTON_BOXTYPE = UP_BOX BUTTON_COL1 = COL1 BUTTON_COL2 = COL1 @@ -129,20 +129,20 @@ BUTTON_MCOL1 = MCOL BUTTON_MCOL2 = MCOL BUTTON_BW = BOUND_WIDTH if _v20: - CHART = 4 - BAR_CHART = 0 - HORBAR_CHART = 1 - LINE_CHART = 2 - FILLED_CHART = 3 - SPIKE_CHART = 4 - PIE_CHART = 5 - SPECIALPIE_CHART = 6 - CHART_BOXTYPE = BORDER_BOX - CHART_COL1 = COL1 - CHART_LCOL = LCOL - CHART_ALIGN = ALIGN_BOTTOM - CHART_BW = BOUND_WIDTH - CHART_MAX = 128 + CHART = 4 + BAR_CHART = 0 + HORBAR_CHART = 1 + LINE_CHART = 2 + FILLED_CHART = 3 + SPIKE_CHART = 4 + PIE_CHART = 5 + SPECIALPIE_CHART = 6 + CHART_BOXTYPE = BORDER_BOX + CHART_COL1 = COL1 + CHART_LCOL = LCOL + CHART_ALIGN = ALIGN_BOTTOM + CHART_BW = BOUND_WIDTH + CHART_MAX = 128 CHOICE = 42 NORMAL_CHOICE = 0 CHOICE_BOXTYPE = DOWN_BOX @@ -173,11 +173,11 @@ COUNTER_COL2 = 4 COUNTER_LCOL = LCOL COUNTER_ALIGN = ALIGN_BOTTOM if _v20: - COUNTER_BW = BOUND_WIDTH + COUNTER_BW = BOUND_WIDTH else: - DEFAULT = 51 - RETURN_DEFAULT = 0 - ALWAYS_DEFAULT = 1 + DEFAULT = 51 + RETURN_DEFAULT = 0 + ALWAYS_DEFAULT = 1 DIAL = 22 NORMAL_DIAL = 0 LINE_DIAL = 1 @@ -197,14 +197,14 @@ ALL_FREE = 5 INPUT = 31 NORMAL_INPUT = 0 if _v20: - FLOAT_INPUT = 1 - INT_INPUT = 2 - HIDDEN_INPUT = 3 - if _v21: - MULTILINE_INPUT = 4 - SECRET_INPUT = 5 + FLOAT_INPUT = 1 + INT_INPUT = 2 + HIDDEN_INPUT = 3 + if _v21: + MULTILINE_INPUT = 4 + SECRET_INPUT = 5 else: - ALWAYS_INPUT = 1 + ALWAYS_INPUT = 1 INPUT_BOXTYPE = DOWN_BOX INPUT_COL1 = 13 INPUT_COL2 = 5 diff --git a/Lib/plat-irix5/SV.py b/Lib/plat-irix5/SV.py index 08fb917..db8efe5 100755 --- a/Lib/plat-irix5/SV.py +++ b/Lib/plat-irix5/SV.py @@ -7,16 +7,16 @@ BLANKING_BUFFER_SIZE = 2 MAX_SOURCES = 2 # mode parameter for Bind calls -IN_OFF = 0 # No Video -IN_OVER = 1 # Video over graphics -IN_UNDER = 2 # Video under graphics -IN_REPLACE = 3 # Video replaces entire win +IN_OFF = 0 # No Video +IN_OVER = 1 # Video over graphics +IN_UNDER = 2 # Video under graphics +IN_REPLACE = 3 # Video replaces entire win # mode parameters for LoadMap calls. Specifies buffer, always 256 entries -INPUT_COLORMAP = 0 # tuples of 8-bit RGB -CHROMA_KEY_MAP = 1 # tuples of 8-bit RGB -COLOR_SPACE_MAP = 2 # tuples of 8-bit RGB -GAMMA_MAP = 3 # tuples of 24-bit red values +INPUT_COLORMAP = 0 # tuples of 8-bit RGB +CHROMA_KEY_MAP = 1 # tuples of 8-bit RGB +COLOR_SPACE_MAP = 2 # tuples of 8-bit RGB +GAMMA_MAP = 3 # tuples of 24-bit red values # mode parameters for UseExclusive calls INPUT = 0 @@ -24,9 +24,9 @@ OUTPUT = 1 IN_OUT = 2 # Format constants for the capture routines -RGB8_FRAMES = 0 # noninterleaved 8 bit 3:2:3 RBG fields -RGB32_FRAMES = 1 # 32-bit 8:8:8 RGB frames -YUV411_FRAMES = 2 # interleaved, 8:2:2 YUV format +RGB8_FRAMES = 0 # noninterleaved 8 bit 3:2:3 RBG fields +RGB32_FRAMES = 1 # 32-bit 8:8:8 RGB frames +YUV411_FRAMES = 2 # interleaved, 8:2:2 YUV format YUV411_FRAMES_AND_BLANKING_BUFFER = 3 # diff --git a/Lib/plat-irix5/cddb.py b/Lib/plat-irix5/cddb.py index c4a95cd..7b2711f 100755 --- a/Lib/plat-irix5/cddb.py +++ b/Lib/plat-irix5/cddb.py @@ -20,185 +20,185 @@ _cddbrc = '.cddb' _DB_ID_NTRACKS = 5 _dbid_map = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ@_=+abcdefghijklmnopqrstuvwxyz' def _dbid(v): - if v >= len(_dbid_map): - return string.zfill(v, 2) - else: - return _dbid_map[v] + if v >= len(_dbid_map): + return string.zfill(v, 2) + else: + return _dbid_map[v] def tochash(toc): - if type(toc) == type(''): - tracklist = [] - for i in range(2, len(toc), 4): - tracklist.append((None, - (int(toc[i:i+2]), - int(toc[i+2:i+4])))) - else: - tracklist = toc - ntracks = len(tracklist) - hash = _dbid((ntracks >> 4) & 0xF) + _dbid(ntracks & 0xF) - if ntracks <= _DB_ID_NTRACKS: - nidtracks = ntracks - else: - nidtracks = _DB_ID_NTRACKS - 1 - min = 0 - sec = 0 - for track in tracklist: - start, length = track - min = min + length[0] - sec = sec + length[1] - min = min + sec / 60 - sec = sec % 60 - hash = hash + _dbid(min) + _dbid(sec) - for i in range(nidtracks): - start, length = tracklist[i] - hash = hash + _dbid(length[0]) + _dbid(length[1]) - return hash - + if type(toc) == type(''): + tracklist = [] + for i in range(2, len(toc), 4): + tracklist.append((None, + (int(toc[i:i+2]), + int(toc[i+2:i+4])))) + else: + tracklist = toc + ntracks = len(tracklist) + hash = _dbid((ntracks >> 4) & 0xF) + _dbid(ntracks & 0xF) + if ntracks <= _DB_ID_NTRACKS: + nidtracks = ntracks + else: + nidtracks = _DB_ID_NTRACKS - 1 + min = 0 + sec = 0 + for track in tracklist: + start, length = track + min = min + length[0] + sec = sec + length[1] + min = min + sec / 60 + sec = sec % 60 + hash = hash + _dbid(min) + _dbid(sec) + for i in range(nidtracks): + start, length = tracklist[i] + hash = hash + _dbid(length[0]) + _dbid(length[1]) + return hash + class Cddb: - def __init__(self, tracklist): - if os.environ.has_key('CDDB_PATH'): - path = os.environ['CDDB_PATH'] - cddb_path = path.split(',') - else: - home = os.environ['HOME'] - cddb_path = [home + '/' + _cddbrc] + def __init__(self, tracklist): + if os.environ.has_key('CDDB_PATH'): + path = os.environ['CDDB_PATH'] + cddb_path = path.split(',') + else: + home = os.environ['HOME'] + cddb_path = [home + '/' + _cddbrc] - self._get_id(tracklist) + self._get_id(tracklist) - for dir in cddb_path: - file = dir + '/' + self.id + '.rdb' - try: - f = open(file, 'r') - self.file = file - break - except IOError: - pass - ntracks = int(self.id[:2], 16) - self.artist = '' - self.title = '' - self.track = [None] + [''] * ntracks - self.trackartist = [None] + [''] * ntracks - self.notes = [] - if not hasattr(self, 'file'): - return - import re - reg = re.compile(r'^([^.]*)\.([^:]*):[\t ]+(.*)') - while 1: - line = f.readline() - if not line: - break - match = reg.match(line) - if not match: - print 'syntax error in ' + file - continue - name1, name2, value = match.group(1, 2, 3) - if name1 == 'album': - if name2 == 'artist': - self.artist = value - elif name2 == 'title': - self.title = value - elif name2 == 'toc': - if not self.toc: - self.toc = value - if self.toc != value: - print 'toc\'s don\'t match' - elif name2 == 'notes': - self.notes.append(value) - elif name1[:5] == 'track': - try: - trackno = int(name1[5:]) - except strings.atoi_error: - print 'syntax error in ' + file - continue - if trackno > ntracks: - print 'track number %r in file %r out of range' % (trackno, file) - continue - if name2 == 'title': - self.track[trackno] = value - elif name2 == 'artist': - self.trackartist[trackno] = value - f.close() - for i in range(2, len(self.track)): - track = self.track[i] - # if track title starts with `,', use initial part - # of previous track's title - if track and track[0] == ',': - try: - off = self.track[i - 1].index(',') - except ValueError: - pass - else: - self.track[i] = self.track[i-1][:off] \ - + track + for dir in cddb_path: + file = dir + '/' + self.id + '.rdb' + try: + f = open(file, 'r') + self.file = file + break + except IOError: + pass + ntracks = int(self.id[:2], 16) + self.artist = '' + self.title = '' + self.track = [None] + [''] * ntracks + self.trackartist = [None] + [''] * ntracks + self.notes = [] + if not hasattr(self, 'file'): + return + import re + reg = re.compile(r'^([^.]*)\.([^:]*):[\t ]+(.*)') + while 1: + line = f.readline() + if not line: + break + match = reg.match(line) + if not match: + print 'syntax error in ' + file + continue + name1, name2, value = match.group(1, 2, 3) + if name1 == 'album': + if name2 == 'artist': + self.artist = value + elif name2 == 'title': + self.title = value + elif name2 == 'toc': + if not self.toc: + self.toc = value + if self.toc != value: + print 'toc\'s don\'t match' + elif name2 == 'notes': + self.notes.append(value) + elif name1[:5] == 'track': + try: + trackno = int(name1[5:]) + except strings.atoi_error: + print 'syntax error in ' + file + continue + if trackno > ntracks: + print 'track number %r in file %r out of range' % (trackno, file) + continue + if name2 == 'title': + self.track[trackno] = value + elif name2 == 'artist': + self.trackartist[trackno] = value + f.close() + for i in range(2, len(self.track)): + track = self.track[i] + # if track title starts with `,', use initial part + # of previous track's title + if track and track[0] == ',': + try: + off = self.track[i - 1].index(',') + except ValueError: + pass + else: + self.track[i] = self.track[i-1][:off] \ + + track - def _get_id(self, tracklist): - # fill in self.id and self.toc. - # if the argument is a string ending in .rdb, the part - # upto the suffix is taken as the id. - if type(tracklist) == type(''): - if tracklist[-4:] == '.rdb': - self.id = tracklist[:-4] - self.toc = '' - return - t = [] - for i in range(2, len(tracklist), 4): - t.append((None, \ - (int(tracklist[i:i+2]), \ - int(tracklist[i+2:i+4])))) - tracklist = t - ntracks = len(tracklist) - self.id = _dbid((ntracks >> 4) & 0xF) + _dbid(ntracks & 0xF) - if ntracks <= _DB_ID_NTRACKS: - nidtracks = ntracks - else: - nidtracks = _DB_ID_NTRACKS - 1 - min = 0 - sec = 0 - for track in tracklist: - start, length = track - min = min + length[0] - sec = sec + length[1] - min = min + sec / 60 - sec = sec % 60 - self.id = self.id + _dbid(min) + _dbid(sec) - for i in range(nidtracks): - start, length = tracklist[i] - self.id = self.id + _dbid(length[0]) + _dbid(length[1]) - self.toc = string.zfill(ntracks, 2) - for track in tracklist: - start, length = track - self.toc = self.toc + string.zfill(length[0], 2) + \ - string.zfill(length[1], 2) + def _get_id(self, tracklist): + # fill in self.id and self.toc. + # if the argument is a string ending in .rdb, the part + # upto the suffix is taken as the id. + if type(tracklist) == type(''): + if tracklist[-4:] == '.rdb': + self.id = tracklist[:-4] + self.toc = '' + return + t = [] + for i in range(2, len(tracklist), 4): + t.append((None, \ + (int(tracklist[i:i+2]), \ + int(tracklist[i+2:i+4])))) + tracklist = t + ntracks = len(tracklist) + self.id = _dbid((ntracks >> 4) & 0xF) + _dbid(ntracks & 0xF) + if ntracks <= _DB_ID_NTRACKS: + nidtracks = ntracks + else: + nidtracks = _DB_ID_NTRACKS - 1 + min = 0 + sec = 0 + for track in tracklist: + start, length = track + min = min + length[0] + sec = sec + length[1] + min = min + sec / 60 + sec = sec % 60 + self.id = self.id + _dbid(min) + _dbid(sec) + for i in range(nidtracks): + start, length = tracklist[i] + self.id = self.id + _dbid(length[0]) + _dbid(length[1]) + self.toc = string.zfill(ntracks, 2) + for track in tracklist: + start, length = track + self.toc = self.toc + string.zfill(length[0], 2) + \ + string.zfill(length[1], 2) - def write(self): - import posixpath - if os.environ.has_key('CDDB_WRITE_DIR'): - dir = os.environ['CDDB_WRITE_DIR'] - else: - dir = os.environ['HOME'] + '/' + _cddbrc - file = dir + '/' + self.id + '.rdb' - if posixpath.exists(file): - # make backup copy - posix.rename(file, file + '~') - f = open(file, 'w') - f.write('album.title:\t' + self.title + '\n') - f.write('album.artist:\t' + self.artist + '\n') - f.write('album.toc:\t' + self.toc + '\n') - for note in self.notes: - f.write('album.notes:\t' + note + '\n') - prevpref = None - for i in range(1, len(self.track)): - if self.trackartist[i]: - f.write('track%r.artist:\t%s\n' % (i, self.trackartist[i])) - track = self.track[i] - try: - off = track.index(',') - except ValuError: - prevpref = None - else: - if prevpref and track[:off] == prevpref: - track = track[off:] - else: - prevpref = track[:off] - f.write('track%r.title:\t%s\n' % (i, track)) - f.close() + def write(self): + import posixpath + if os.environ.has_key('CDDB_WRITE_DIR'): + dir = os.environ['CDDB_WRITE_DIR'] + else: + dir = os.environ['HOME'] + '/' + _cddbrc + file = dir + '/' + self.id + '.rdb' + if posixpath.exists(file): + # make backup copy + posix.rename(file, file + '~') + f = open(file, 'w') + f.write('album.title:\t' + self.title + '\n') + f.write('album.artist:\t' + self.artist + '\n') + f.write('album.toc:\t' + self.toc + '\n') + for note in self.notes: + f.write('album.notes:\t' + note + '\n') + prevpref = None + for i in range(1, len(self.track)): + if self.trackartist[i]: + f.write('track%r.artist:\t%s\n' % (i, self.trackartist[i])) + track = self.track[i] + try: + off = track.index(',') + except ValuError: + prevpref = None + else: + if prevpref and track[:off] == prevpref: + track = track[off:] + else: + prevpref = track[:off] + f.write('track%r.title:\t%s\n' % (i, track)) + f.close() diff --git a/Lib/plat-irix5/cdplayer.py b/Lib/plat-irix5/cdplayer.py index 0dd3fe0..1c0168f 100755 --- a/Lib/plat-irix5/cdplayer.py +++ b/Lib/plat-irix5/cdplayer.py @@ -17,72 +17,72 @@ cdplayerrc = '.cdplayerrc' class Cdplayer: - def __init__(self, tracklist): - import string - self.artist = '' - self.title = '' - if type(tracklist) == type(''): - t = [] - for i in range(2, len(tracklist), 4): - t.append((None, \ - (string.atoi(tracklist[i:i+2]), \ - string.atoi(tracklist[i+2:i+4])))) - tracklist = t - self.track = [None] + [''] * len(tracklist) - self.id = 'd' + string.zfill(len(tracklist), 2) - for track in tracklist: - start, length = track - self.id = self.id + string.zfill(length[0], 2) + \ - string.zfill(length[1], 2) - try: - import posix - f = open(posix.environ['HOME'] + '/' + cdplayerrc, 'r') - except IOError: - return - import re - reg = re.compile(r'^([^:]*):\t(.*)') - s = self.id + '.' - l = len(s) - while 1: - line = f.readline() - if line == '': - break - if line[:l] == s: - line = line[l:] - match = reg.match(line) - if not match: - print 'syntax error in ~/' + cdplayerrc - continue - name, value = match.group(1, 2) - if name == 'title': - self.title = value - elif name == 'artist': - self.artist = value - elif name[:5] == 'track': - trackno = string.atoi(name[6:]) - self.track[trackno] = value - f.close() + def __init__(self, tracklist): + import string + self.artist = '' + self.title = '' + if type(tracklist) == type(''): + t = [] + for i in range(2, len(tracklist), 4): + t.append((None, \ + (string.atoi(tracklist[i:i+2]), \ + string.atoi(tracklist[i+2:i+4])))) + tracklist = t + self.track = [None] + [''] * len(tracklist) + self.id = 'd' + string.zfill(len(tracklist), 2) + for track in tracklist: + start, length = track + self.id = self.id + string.zfill(length[0], 2) + \ + string.zfill(length[1], 2) + try: + import posix + f = open(posix.environ['HOME'] + '/' + cdplayerrc, 'r') + except IOError: + return + import re + reg = re.compile(r'^([^:]*):\t(.*)') + s = self.id + '.' + l = len(s) + while 1: + line = f.readline() + if line == '': + break + if line[:l] == s: + line = line[l:] + match = reg.match(line) + if not match: + print 'syntax error in ~/' + cdplayerrc + continue + name, value = match.group(1, 2) + if name == 'title': + self.title = value + elif name == 'artist': + self.artist = value + elif name[:5] == 'track': + trackno = string.atoi(name[6:]) + self.track[trackno] = value + f.close() - def write(self): - import posix - filename = posix.environ['HOME'] + '/' + cdplayerrc - try: - old = open(filename, 'r') - except IOError: - old = open('/dev/null', 'r') - new = open(filename + '.new', 'w') - s = self.id + '.' - l = len(s) - while 1: - line = old.readline() - if line == '': - break - if line[:l] != s: - new.write(line) - new.write(self.id + '.title:\t' + self.title + '\n') - new.write(self.id + '.artist:\t' + self.artist + '\n') - for i in range(1, len(self.track)): - new.write('%s.track.%r:\t%s\n' % (self.id, i, self.track[i])) - old.close() - new.close() - posix.rename(filename + '.new', filename) + def write(self): + import posix + filename = posix.environ['HOME'] + '/' + cdplayerrc + try: + old = open(filename, 'r') + except IOError: + old = open('/dev/null', 'r') + new = open(filename + '.new', 'w') + s = self.id + '.' + l = len(s) + while 1: + line = old.readline() + if line == '': + break + if line[:l] != s: + new.write(line) + new.write(self.id + '.title:\t' + self.title + '\n') + new.write(self.id + '.artist:\t' + self.artist + '\n') + for i in range(1, len(self.track)): + new.write('%s.track.%r:\t%s\n' % (self.id, i, self.track[i])) + old.close() + new.close() + posix.rename(filename + '.new', filename) diff --git a/Lib/plat-irix5/flp.py b/Lib/plat-irix5/flp.py index b22bc1a..4f9175f 100755 --- a/Lib/plat-irix5/flp.py +++ b/Lib/plat-irix5/flp.py @@ -80,18 +80,18 @@ def checkcache(filename): fp.close() def _unpack_cache(altforms): - forms = {} - for name in altforms.keys(): - altobj, altlist = altforms[name] - obj = _newobj() - obj.make(altobj) - list = [] - for altobj in altlist: - nobj = _newobj() - nobj.make(altobj) - list.append(nobj) - forms[name] = obj, list - return forms + forms = {} + for name in altforms.keys(): + altobj, altlist = altforms[name] + obj = _newobj() + obj.make(altobj) + list = [] + for altobj in altlist: + nobj = _newobj() + nobj.make(altobj) + list.append(nobj) + forms[name] = obj, list + return forms def rdlong(fp): s = fp.read(4) @@ -277,8 +277,8 @@ def _parse_line(line): return line name, value = match.group(1, 2) if name[0] == 'N': - name = string.join(string.split(name),'') - name = string.lower(name) + name = string.join(string.split(name),'') + name = string.lower(name) name = string.capitalize(name) try: pf = _parse_func[name] @@ -292,7 +292,7 @@ def _readline(file): if not line: raise EOFError return line[:-1] - + def _parse_1_line(file): line = _readline(file) while line == '': diff --git a/Lib/plat-irix5/jpeg.py b/Lib/plat-irix5/jpeg.py index da20d6b..f8fc7e7 100755 --- a/Lib/plat-irix5/jpeg.py +++ b/Lib/plat-irix5/jpeg.py @@ -6,7 +6,7 @@ # XXX the resulting file causes weirdness. class error(Exception): - pass + pass options = {'quality': 75, 'optimize': 0, 'smooth': 0, 'forcegray': 0} @@ -14,98 +14,98 @@ comp = None decomp = None def compress(imgdata, width, height, bytesperpixel): - global comp - import cl - if comp is None: comp = cl.OpenCompressor(cl.JPEG) - if bytesperpixel == 1: - format = cl.GRAYSCALE - elif bytesperpixel == 4: - format = cl.RGBX - if options['forcegray']: - iformat = cl.GRAYSCALE - else: - iformat = cl.YUV - # XXX How to support 'optimize'? - params = [cl.IMAGE_WIDTH, width, cl.IMAGE_HEIGHT, height, \ - cl.ORIGINAL_FORMAT, format, \ - cl.ORIENTATION, cl.BOTTOM_UP, \ - cl.QUALITY_FACTOR, options['quality'], \ - cl.INTERNAL_FORMAT, iformat, \ - ] - comp.SetParams(params) - jpegdata = comp.Compress(1, imgdata) - return jpegdata + global comp + import cl + if comp is None: comp = cl.OpenCompressor(cl.JPEG) + if bytesperpixel == 1: + format = cl.GRAYSCALE + elif bytesperpixel == 4: + format = cl.RGBX + if options['forcegray']: + iformat = cl.GRAYSCALE + else: + iformat = cl.YUV + # XXX How to support 'optimize'? + params = [cl.IMAGE_WIDTH, width, cl.IMAGE_HEIGHT, height, \ + cl.ORIGINAL_FORMAT, format, \ + cl.ORIENTATION, cl.BOTTOM_UP, \ + cl.QUALITY_FACTOR, options['quality'], \ + cl.INTERNAL_FORMAT, iformat, \ + ] + comp.SetParams(params) + jpegdata = comp.Compress(1, imgdata) + return jpegdata def decompress(jpegdata): - global decomp - import cl - if decomp is None: decomp = cl.OpenDecompressor(cl.JPEG) - headersize = decomp.ReadHeader(jpegdata) - params = [cl.IMAGE_WIDTH, 0, cl.IMAGE_HEIGHT, 0, cl.INTERNAL_FORMAT, 0] - decomp.GetParams(params) - width, height, format = params[1], params[3], params[5] - if format == cl.GRAYSCALE or options['forcegray']: - format = cl.GRAYSCALE - bytesperpixel = 1 - else: - format = cl.RGBX - bytesperpixel = 4 - # XXX How to support 'smooth'? - params = [cl.ORIGINAL_FORMAT, format, \ - cl.ORIENTATION, cl.BOTTOM_UP, \ - cl.FRAME_BUFFER_SIZE, width*height*bytesperpixel] - decomp.SetParams(params) - imgdata = decomp.Decompress(1, jpegdata) - return imgdata, width, height, bytesperpixel + global decomp + import cl + if decomp is None: decomp = cl.OpenDecompressor(cl.JPEG) + headersize = decomp.ReadHeader(jpegdata) + params = [cl.IMAGE_WIDTH, 0, cl.IMAGE_HEIGHT, 0, cl.INTERNAL_FORMAT, 0] + decomp.GetParams(params) + width, height, format = params[1], params[3], params[5] + if format == cl.GRAYSCALE or options['forcegray']: + format = cl.GRAYSCALE + bytesperpixel = 1 + else: + format = cl.RGBX + bytesperpixel = 4 + # XXX How to support 'smooth'? + params = [cl.ORIGINAL_FORMAT, format, \ + cl.ORIENTATION, cl.BOTTOM_UP, \ + cl.FRAME_BUFFER_SIZE, width*height*bytesperpixel] + decomp.SetParams(params) + imgdata = decomp.Decompress(1, jpegdata) + return imgdata, width, height, bytesperpixel def setoption(name, value): - if type(value) is not type(0): - raise TypeError, 'jpeg.setoption: numeric options only' - if name == 'forcegrey': - name = 'forcegray' - if not options.has_key(name): - raise KeyError, 'jpeg.setoption: unknown option name' - options[name] = int(value) + if type(value) is not type(0): + raise TypeError, 'jpeg.setoption: numeric options only' + if name == 'forcegrey': + name = 'forcegray' + if not options.has_key(name): + raise KeyError, 'jpeg.setoption: unknown option name' + options[name] = int(value) def test(): - import sys - if sys.argv[1:2] == ['-g']: - del sys.argv[1] - setoption('forcegray', 1) - if not sys.argv[1:]: - sys.argv.append('/usr/local/images/data/jpg/asterix.jpg') - for file in sys.argv[1:]: - show(file) + import sys + if sys.argv[1:2] == ['-g']: + del sys.argv[1] + setoption('forcegray', 1) + if not sys.argv[1:]: + sys.argv.append('/usr/local/images/data/jpg/asterix.jpg') + for file in sys.argv[1:]: + show(file) def show(file): - import gl, GL, DEVICE - jpegdata = open(file, 'r').read() - imgdata, width, height, bytesperpixel = decompress(jpegdata) - gl.foreground() - gl.prefsize(width, height) - win = gl.winopen(file) - if bytesperpixel == 1: - gl.cmode() - gl.pixmode(GL.PM_SIZE, 8) - gl.gconfig() - for i in range(256): - gl.mapcolor(i, i, i, i) - else: - gl.RGBmode() - gl.pixmode(GL.PM_SIZE, 32) - gl.gconfig() - gl.qdevice(DEVICE.REDRAW) - gl.qdevice(DEVICE.ESCKEY) - gl.qdevice(DEVICE.WINQUIT) - gl.qdevice(DEVICE.WINSHUT) - gl.lrectwrite(0, 0, width-1, height-1, imgdata) - while 1: - dev, val = gl.qread() - if dev in (DEVICE.ESCKEY, DEVICE.WINSHUT, DEVICE.WINQUIT): - break - if dev == DEVICE.REDRAW: - gl.lrectwrite(0, 0, width-1, height-1, imgdata) - gl.winclose(win) - # Now test the compression and write the result to a fixed filename - newjpegdata = compress(imgdata, width, height, bytesperpixel) - open('/tmp/j.jpg', 'w').write(newjpegdata) + import gl, GL, DEVICE + jpegdata = open(file, 'r').read() + imgdata, width, height, bytesperpixel = decompress(jpegdata) + gl.foreground() + gl.prefsize(width, height) + win = gl.winopen(file) + if bytesperpixel == 1: + gl.cmode() + gl.pixmode(GL.PM_SIZE, 8) + gl.gconfig() + for i in range(256): + gl.mapcolor(i, i, i, i) + else: + gl.RGBmode() + gl.pixmode(GL.PM_SIZE, 32) + gl.gconfig() + gl.qdevice(DEVICE.REDRAW) + gl.qdevice(DEVICE.ESCKEY) + gl.qdevice(DEVICE.WINQUIT) + gl.qdevice(DEVICE.WINSHUT) + gl.lrectwrite(0, 0, width-1, height-1, imgdata) + while 1: + dev, val = gl.qread() + if dev in (DEVICE.ESCKEY, DEVICE.WINSHUT, DEVICE.WINQUIT): + break + if dev == DEVICE.REDRAW: + gl.lrectwrite(0, 0, width-1, height-1, imgdata) + gl.winclose(win) + # Now test the compression and write the result to a fixed filename + newjpegdata = compress(imgdata, width, height, bytesperpixel) + open('/tmp/j.jpg', 'w').write(newjpegdata) diff --git a/Lib/plat-irix5/panel.py b/Lib/plat-irix5/panel.py index 3aa7448..12e62a5 100755 --- a/Lib/plat-irix5/panel.py +++ b/Lib/plat-irix5/panel.py @@ -17,82 +17,82 @@ debug = 0 # Test if an object is a list. # def is_list(x): - return type(x) == type([]) + return type(x) == type([]) # Reverse a list. # def reverse(list): - res = [] - for item in list: - res.insert(0, item) - return res + res = [] + for item in list: + res.insert(0, item) + return res # Get an attribute of a list, which may itself be another list. # Don't use 'prop' for name. # def getattrlist(list, name): - for item in list: - if item and is_list(item) and item[0] == name: - return item[1:] - return [] + for item in list: + if item and is_list(item) and item[0] == name: + return item[1:] + return [] # Get a property of a list, which may itself be another list. # def getproplist(list, name): - for item in list: - if item and is_list(item) and item[0] == 'prop': - if len(item) > 1 and item[1] == name: - return item[2:] - return [] + for item in list: + if item and is_list(item) and item[0] == 'prop': + if len(item) > 1 and item[1] == name: + return item[2:] + return [] # Test if an actuator description contains the property 'end-of-group' # def is_endgroup(list): - x = getproplist(list, 'end-of-group') - return (x and x[0] == '#t') + x = getproplist(list, 'end-of-group') + return (x and x[0] == '#t') # Neatly display an actuator definition given as S-expression # the prefix string is printed before each line. # def show_actuator(prefix, a): - for item in a: - if not is_list(item): - print prefix, item - elif item and item[0] == 'al': - print prefix, 'Subactuator list:' - for a in item[1:]: - show_actuator(prefix + ' ', a) - elif len(item) == 2: - print prefix, item[0], '=>', item[1] - elif len(item) == 3 and item[0] == 'prop': - print prefix, 'Prop', item[1], '=>', - print item[2] - else: - print prefix, '?', item + for item in a: + if not is_list(item): + print prefix, item + elif item and item[0] == 'al': + print prefix, 'Subactuator list:' + for a in item[1:]: + show_actuator(prefix + ' ', a) + elif len(item) == 2: + print prefix, item[0], '=>', item[1] + elif len(item) == 3 and item[0] == 'prop': + print prefix, 'Prop', item[1], '=>', + print item[2] + else: + print prefix, '?', item # Neatly display a panel. # def show_panel(prefix, p): - for item in p: - if not is_list(item): - print prefix, item - elif item and item[0] == 'al': - print prefix, 'Actuator list:' - for a in item[1:]: - show_actuator(prefix + ' ', a) - elif len(item) == 2: - print prefix, item[0], '=>', item[1] - elif len(item) == 3 and item[0] == 'prop': - print prefix, 'Prop', item[1], '=>', - print item[2] - else: - print prefix, '?', item + for item in p: + if not is_list(item): + print prefix, item + elif item and item[0] == 'al': + print prefix, 'Actuator list:' + for a in item[1:]: + show_actuator(prefix + ' ', a) + elif len(item) == 2: + print prefix, item[0], '=>', item[1] + elif len(item) == 3 and item[0] == 'prop': + print prefix, 'Prop', item[1], '=>', + print item[2] + else: + print prefix, '?', item # Exception raised by build_actuator or build_panel. @@ -103,7 +103,7 @@ panel_error = 'panel error' # Dummy callback used to initialize the callbacks. # def dummy_callback(arg): - pass + pass # Assign attributes to members of the target. @@ -111,60 +111,60 @@ def dummy_callback(arg): # The member name is the attribute name prefixed with the prefix. # def assign_members(target, attrlist, exclist, prefix): - for item in attrlist: - if is_list(item) and len(item) == 2 and item[0] not in exclist: - name, value = item[0], item[1] - ok = 1 - if value[0] in '-0123456789': - value = eval(value) - elif value[0] == '"': - value = value[1:-1] - elif value == 'move-then-resize': - # Strange default set by Panel Editor... - ok = 0 - else: - print 'unknown value', value, 'for', name - ok = 0 - if ok: - lhs = 'target.' + prefix + name - stmt = lhs + '=' + repr(value) - if debug: print 'exec', stmt - try: - exec stmt + '\n' - except KeyboardInterrupt: # Don't catch this! - raise KeyboardInterrupt - except: - print 'assign failed:', stmt + for item in attrlist: + if is_list(item) and len(item) == 2 and item[0] not in exclist: + name, value = item[0], item[1] + ok = 1 + if value[0] in '-0123456789': + value = eval(value) + elif value[0] == '"': + value = value[1:-1] + elif value == 'move-then-resize': + # Strange default set by Panel Editor... + ok = 0 + else: + print 'unknown value', value, 'for', name + ok = 0 + if ok: + lhs = 'target.' + prefix + name + stmt = lhs + '=' + repr(value) + if debug: print 'exec', stmt + try: + exec stmt + '\n' + except KeyboardInterrupt: # Don't catch this! + raise KeyboardInterrupt + except: + print 'assign failed:', stmt # Build a real actuator from an actuator description. # Return a pair (actuator, name). # def build_actuator(descr): - namelist = getattrlist(descr, 'name') - if namelist: - # Assume it is a string - actuatorname = namelist[0][1:-1] - else: - actuatorname = '' - type = descr[0] - if type[:4] == 'pnl_': type = type[4:] - act = pnl.mkact(type) - act.downfunc = act.activefunc = act.upfunc = dummy_callback - # - assign_members(act, descr[1:], ['al', 'data', 'name'], '') - # - # Treat actuator-specific data - # - datalist = getattrlist(descr, 'data') - prefix = '' - if type[-4:] == 'puck': - prefix = 'puck_' - elif type == 'mouse': - prefix = 'mouse_' - assign_members(act, datalist, [], prefix) - # - return act, actuatorname + namelist = getattrlist(descr, 'name') + if namelist: + # Assume it is a string + actuatorname = namelist[0][1:-1] + else: + actuatorname = '' + type = descr[0] + if type[:4] == 'pnl_': type = type[4:] + act = pnl.mkact(type) + act.downfunc = act.activefunc = act.upfunc = dummy_callback + # + assign_members(act, descr[1:], ['al', 'data', 'name'], '') + # + # Treat actuator-specific data + # + datalist = getattrlist(descr, 'data') + prefix = '' + if type[-4:] == 'puck': + prefix = 'puck_' + elif type == 'mouse': + prefix = 'mouse_' + assign_members(act, datalist, [], prefix) + # + return act, actuatorname # Build all sub-actuators and add them to the super-actuator. @@ -176,27 +176,27 @@ def build_actuator(descr): # to a sub-actuator. # def build_subactuators(panel, super_act, al): - # - # This is nearly the same loop as below in build_panel(), - # except a call is made to addsubact() instead of addact(). - # - for a in al: - act, name = build_actuator(a) - act.addsubact(super_act) - if name: - stmt = 'panel.' + name + ' = act' - if debug: print 'exec', stmt - exec stmt + '\n' - if is_endgroup(a): - panel.endgroup() - sub_al = getattrlist(a, 'al') - if sub_al: - build_subactuators(panel, act, sub_al) - # - # Fix the actuator to which whe just added subactuators. - # This can't hurt (I hope) and is needed for the scroll actuator. - # - super_act.fixact() + # + # This is nearly the same loop as below in build_panel(), + # except a call is made to addsubact() instead of addact(). + # + for a in al: + act, name = build_actuator(a) + act.addsubact(super_act) + if name: + stmt = 'panel.' + name + ' = act' + if debug: print 'exec', stmt + exec stmt + '\n' + if is_endgroup(a): + panel.endgroup() + sub_al = getattrlist(a, 'al') + if sub_al: + build_subactuators(panel, act, sub_al) + # + # Fix the actuator to which whe just added subactuators. + # This can't hurt (I hope) and is needed for the scroll actuator. + # + super_act.fixact() # Build a real panel from a panel definition. @@ -204,78 +204,78 @@ def build_subactuators(panel, super_act, al): # reference to a. # def build_panel(descr): - # - # Sanity check - # - if (not descr) or descr[0] != 'panel': - raise panel_error, 'panel description must start with "panel"' - # - if debug: show_panel('', descr) - # - # Create an empty panel - # - panel = pnl.mkpanel() - # - # Assign panel attributes - # - assign_members(panel, descr[1:], ['al'], '') - # - # Look for actuator list - # - al = getattrlist(descr, 'al') - # - # The order in which actuators are created is important - # because of the endgroup() operator. - # Unfortunately the Panel Editor outputs the actuator list - # in reverse order, so we reverse it here. - # - al = reverse(al) - # - for a in al: - act, name = build_actuator(a) - act.addact(panel) - if name: - stmt = 'panel.' + name + ' = act' - exec stmt + '\n' - if is_endgroup(a): - panel.endgroup() - sub_al = getattrlist(a, 'al') - if sub_al: - build_subactuators(panel, act, sub_al) - # - return panel + # + # Sanity check + # + if (not descr) or descr[0] != 'panel': + raise panel_error, 'panel description must start with "panel"' + # + if debug: show_panel('', descr) + # + # Create an empty panel + # + panel = pnl.mkpanel() + # + # Assign panel attributes + # + assign_members(panel, descr[1:], ['al'], '') + # + # Look for actuator list + # + al = getattrlist(descr, 'al') + # + # The order in which actuators are created is important + # because of the endgroup() operator. + # Unfortunately the Panel Editor outputs the actuator list + # in reverse order, so we reverse it here. + # + al = reverse(al) + # + for a in al: + act, name = build_actuator(a) + act.addact(panel) + if name: + stmt = 'panel.' + name + ' = act' + exec stmt + '\n' + if is_endgroup(a): + panel.endgroup() + sub_al = getattrlist(a, 'al') + if sub_al: + build_subactuators(panel, act, sub_al) + # + return panel # Wrapper around pnl.dopanel() which calls call-back functions. # def my_dopanel(): - # Extract only the first 4 elements to allow for future expansion - a, down, active, up = pnl.dopanel()[:4] - if down: - down.downfunc(down) - if active: - active.activefunc(active) - if up: - up.upfunc(up) - return a + # Extract only the first 4 elements to allow for future expansion + a, down, active, up = pnl.dopanel()[:4] + if down: + down.downfunc(down) + if active: + active.activefunc(active) + if up: + up.upfunc(up) + return a # Create one or more panels from a description file (S-expressions) # generated by the Panel Editor. -# +# def defpanellist(file): - import panelparser - descrlist = panelparser.parse_file(open(file, 'r')) - panellist = [] - for descr in descrlist: - panellist.append(build_panel(descr)) - return panellist + import panelparser + descrlist = panelparser.parse_file(open(file, 'r')) + panellist = [] + for descr in descrlist: + panellist.append(build_panel(descr)) + return panellist # Import everything from built-in method pnl, so the user can always # use panel.foo() instead of pnl.foo(). # This gives *no* performance penalty once this module is imported. # -from pnl import * # for export +from pnl import * # for export -dopanel = my_dopanel # override pnl.dopanel +dopanel = my_dopanel # override pnl.dopanel diff --git a/Lib/plat-irix5/panelparser.py b/Lib/plat-irix5/panelparser.py index ee50971..c831c49 100755 --- a/Lib/plat-irix5/panelparser.py +++ b/Lib/plat-irix5/panelparser.py @@ -15,47 +15,47 @@ separators = operators + whitespace + ';' + '"' # Return a list of tokens (strings). # def tokenize_string(s): - tokens = [] - while s: - c = s[:1] - if c in whitespace: - s = s[1:] - elif c == ';': - s = '' - elif c == '"': - n = len(s) - i = 1 - while i < n: - c = s[i] - i = i+1 - if c == '"': break - if c == '\\': i = i+1 - tokens.append(s[:i]) - s = s[i:] - elif c in operators: - tokens.append(c) - s = s[1:] - else: - n = len(s) - i = 1 - while i < n: - if s[i] in separators: break - i = i+1 - tokens.append(s[:i]) - s = s[i:] - return tokens + tokens = [] + while s: + c = s[:1] + if c in whitespace: + s = s[1:] + elif c == ';': + s = '' + elif c == '"': + n = len(s) + i = 1 + while i < n: + c = s[i] + i = i+1 + if c == '"': break + if c == '\\': i = i+1 + tokens.append(s[:i]) + s = s[i:] + elif c in operators: + tokens.append(c) + s = s[1:] + else: + n = len(s) + i = 1 + while i < n: + if s[i] in separators: break + i = i+1 + tokens.append(s[:i]) + s = s[i:] + return tokens # Tokenize a whole file (given as file object, not as file name). # Return a list of tokens (strings). # def tokenize_file(fp): - tokens = [] - while 1: - line = fp.readline() - if not line: break - tokens = tokens + tokenize_string(line) - return tokens + tokens = [] + while 1: + line = fp.readline() + if not line: break + tokens = tokens + tokenize_string(line) + return tokens # Exception raised by parse_exr. @@ -71,50 +71,50 @@ syntax_error = 'syntax error' # May raise syntax_error. # def parse_expr(tokens): - if (not tokens) or tokens[0] != '(': - raise syntax_error, 'expected "("' - tokens = tokens[1:] - expr = [] - while 1: - if not tokens: - raise syntax_error, 'missing ")"' - if tokens[0] == ')': - return expr, tokens[1:] - elif tokens[0] == '(': - subexpr, tokens = parse_expr(tokens) - expr.append(subexpr) - else: - expr.append(tokens[0]) - tokens = tokens[1:] + if (not tokens) or tokens[0] != '(': + raise syntax_error, 'expected "("' + tokens = tokens[1:] + expr = [] + while 1: + if not tokens: + raise syntax_error, 'missing ")"' + if tokens[0] == ')': + return expr, tokens[1:] + elif tokens[0] == '(': + subexpr, tokens = parse_expr(tokens) + expr.append(subexpr) + else: + expr.append(tokens[0]) + tokens = tokens[1:] # Parse a file (given as file object, not as file name). # Return a list of parsed S-expressions found at the top level. # def parse_file(fp): - tokens = tokenize_file(fp) - exprlist = [] - while tokens: - expr, tokens = parse_expr(tokens) - exprlist.append(expr) - return exprlist + tokens = tokenize_file(fp) + exprlist = [] + while tokens: + expr, tokens = parse_expr(tokens) + exprlist.append(expr) + return exprlist # EXAMPLE: # # The input -# '(hip (hop hur-ray))' +# '(hip (hop hur-ray))' # # passed to tokenize_string() returns the token list -# ['(', 'hip', '(', 'hop', 'hur-ray', ')', ')'] +# ['(', 'hip', '(', 'hop', 'hur-ray', ')', ')'] # # When this is passed to parse_expr() it returns the expression -# ['hip', ['hop', 'hur-ray']] +# ['hip', ['hop', 'hur-ray']] # plus an empty token list (because there are no tokens left. # # When a file containing the example is passed to parse_file() it returns # a list whose only element is the output of parse_expr() above: -# [['hip', ['hop', 'hur-ray']]] +# [['hip', ['hop', 'hur-ray']]] # TOKENIZING: @@ -123,6 +123,6 @@ def parse_file(fp): # # Tokens are separated by whitespace, except the following characters # always form a separate token (outside strings): -# ( ) ' +# ( ) ' # Strings are enclosed in double quotes (") and backslash (\) is used # as escape character in strings. diff --git a/Lib/plat-irix5/readcd.py b/Lib/plat-irix5/readcd.py index f278ba4..5453ce4 100755 --- a/Lib/plat-irix5/readcd.py +++ b/Lib/plat-irix5/readcd.py @@ -3,242 +3,242 @@ import cd, CD class Error(Exception): - pass + pass class _Stop(Exception): - pass + pass def _doatime(self, cb_type, data): - if ((data[0] * 60) + data[1]) * 75 + data[2] > self.end: -## print 'done with list entry', repr(self.listindex) - raise _Stop - func, arg = self.callbacks[cb_type] - if func: - func(arg, cb_type, data) + if ((data[0] * 60) + data[1]) * 75 + data[2] > self.end: +## print 'done with list entry', repr(self.listindex) + raise _Stop + func, arg = self.callbacks[cb_type] + if func: + func(arg, cb_type, data) def _dopnum(self, cb_type, data): - if data > self.end: -## print 'done with list entry', repr(self.listindex) - raise _Stop - func, arg = self.callbacks[cb_type] - if func: - func(arg, cb_type, data) + if data > self.end: +## print 'done with list entry', repr(self.listindex) + raise _Stop + func, arg = self.callbacks[cb_type] + if func: + func(arg, cb_type, data) class Readcd: - def __init__(self, *arg): - if len(arg) == 0: - self.player = cd.open() - elif len(arg) == 1: - self.player = cd.open(arg[0]) - elif len(arg) == 2: - self.player = cd.open(arg[0], arg[1]) - else: - raise Error, 'bad __init__ call' - self.list = [] - self.callbacks = [(None, None)] * 8 - self.parser = cd.createparser() - self.playing = 0 - self.end = 0 - self.status = None - self.trackinfo = None - - def eject(self): - self.player.eject() - self.list = [] - self.end = 0 - self.listindex = 0 - self.status = None - self.trackinfo = None - if self.playing: -## print 'stop playing from eject' - raise _Stop - - def pmsf2msf(self, track, min, sec, frame): - if not self.status: - self.cachestatus() - if track < self.status[5] or track > self.status[6]: - raise Error, 'track number out of range' - if not self.trackinfo: - self.cacheinfo() - start, total = self.trackinfo[track] - start = ((start[0] * 60) + start[1]) * 75 + start[2] - total = ((total[0] * 60) + total[1]) * 75 + total[2] - block = ((min * 60) + sec) * 75 + frame - if block > total: - raise Error, 'out of range' - block = start + block - min, block = divmod(block, 75*60) - sec, frame = divmod(block, 75) - return min, sec, frame - - def reset(self): - self.list = [] - - def appendtrack(self, track): - self.appendstretch(track, track) - - def appendstretch(self, start, end): - if not self.status: - self.cachestatus() - if not start: - start = 1 - if not end: - end = self.status[6] - if type(end) == type(0): - if end < self.status[5] or end > self.status[6]: - raise Error, 'range error' - else: - l = len(end) - if l == 4: - prog, min, sec, frame = end - if prog < self.status[5] or prog > self.status[6]: - raise Error, 'range error' - end = self.pmsf2msf(prog, min, sec, frame) - elif l != 3: - raise Error, 'syntax error' - if type(start) == type(0): - if start < self.status[5] or start > self.status[6]: - raise Error, 'range error' - if len(self.list) > 0: - s, e = self.list[-1] - if type(e) == type(0): - if start == e+1: - start = s - del self.list[-1] - else: - l = len(start) - if l == 4: - prog, min, sec, frame = start - if prog < self.status[5] or prog > self.status[6]: - raise Error, 'range error' - start = self.pmsf2msf(prog, min, sec, frame) - elif l != 3: - raise Error, 'syntax error' - self.list.append((start, end)) - - def settracks(self, list): - self.list = [] - for track in list: - self.appendtrack(track) - - def setcallback(self, cb_type, func, arg): - if cb_type < 0 or cb_type >= 8: - raise Error, 'type out of range' - self.callbacks[cb_type] = (func, arg) - if self.playing: - start, end = self.list[self.listindex] - if type(end) == type(0): - if cb_type != CD.PNUM: - self.parser.setcallback(cb_type, func, arg) - else: - if cb_type != CD.ATIME: - self.parser.setcallback(cb_type, func, arg) - - def removecallback(self, cb_type): - if cb_type < 0 or cb_type >= 8: - raise Error, 'type out of range' - self.callbacks[cb_type] = (None, None) - if self.playing: - start, end = self.list[self.listindex] - if type(end) == type(0): - if cb_type != CD.PNUM: - self.parser.removecallback(cb_type) - else: - if cb_type != CD.ATIME: - self.parser.removecallback(cb_type) - - def gettrackinfo(self, *arg): - if not self.status: - self.cachestatus() - if not self.trackinfo: - self.cacheinfo() - if len(arg) == 0: - return self.trackinfo[self.status[5]:self.status[6]+1] - result = [] - for i in arg: - if i < self.status[5] or i > self.status[6]: - raise Error, 'range error' - result.append(self.trackinfo[i]) - return result - - def cacheinfo(self): - if not self.status: - self.cachestatus() - self.trackinfo = [] - for i in range(self.status[5]): - self.trackinfo.append(None) - for i in range(self.status[5], self.status[6]+1): - self.trackinfo.append(self.player.gettrackinfo(i)) - - def cachestatus(self): - self.status = self.player.getstatus() - if self.status[0] == CD.NODISC: - self.status = None - raise Error, 'no disc in player' - - def getstatus(self): - return self.player.getstatus() - - def play(self): - if not self.status: - self.cachestatus() - size = self.player.bestreadsize() - self.listindex = 0 - self.playing = 0 - for i in range(8): - func, arg = self.callbacks[i] - if func: - self.parser.setcallback(i, func, arg) - else: - self.parser.removecallback(i) - if len(self.list) == 0: - for i in range(self.status[5], self.status[6]+1): - self.appendtrack(i) - try: - while 1: - if not self.playing: - if self.listindex >= len(self.list): - return - start, end = self.list[self.listindex] - if type(start) == type(0): - dummy = self.player.seektrack( - start) - else: - min, sec, frame = start - dummy = self.player.seek( - min, sec, frame) - if type(end) == type(0): - self.parser.setcallback( - CD.PNUM, _dopnum, self) - self.end = end - func, arg = \ - self.callbacks[CD.ATIME] - if func: - self.parser.setcallback(CD.ATIME, func, arg) - else: - self.parser.removecallback(CD.ATIME) - else: - min, sec, frame = end - self.parser.setcallback( - CD.ATIME, _doatime, - self) - self.end = (min * 60 + sec) * \ - 75 + frame - func, arg = \ - self.callbacks[CD.PNUM] - if func: - self.parser.setcallback(CD.PNUM, func, arg) - else: - self.parser.removecallback(CD.PNUM) - self.playing = 1 - data = self.player.readda(size) - if data == '': - self.playing = 0 - self.listindex = self.listindex + 1 - continue - try: - self.parser.parseframe(data) - except _Stop: - self.playing = 0 - self.listindex = self.listindex + 1 - finally: - self.playing = 0 + def __init__(self, *arg): + if len(arg) == 0: + self.player = cd.open() + elif len(arg) == 1: + self.player = cd.open(arg[0]) + elif len(arg) == 2: + self.player = cd.open(arg[0], arg[1]) + else: + raise Error, 'bad __init__ call' + self.list = [] + self.callbacks = [(None, None)] * 8 + self.parser = cd.createparser() + self.playing = 0 + self.end = 0 + self.status = None + self.trackinfo = None + + def eject(self): + self.player.eject() + self.list = [] + self.end = 0 + self.listindex = 0 + self.status = None + self.trackinfo = None + if self.playing: +## print 'stop playing from eject' + raise _Stop + + def pmsf2msf(self, track, min, sec, frame): + if not self.status: + self.cachestatus() + if track < self.status[5] or track > self.status[6]: + raise Error, 'track number out of range' + if not self.trackinfo: + self.cacheinfo() + start, total = self.trackinfo[track] + start = ((start[0] * 60) + start[1]) * 75 + start[2] + total = ((total[0] * 60) + total[1]) * 75 + total[2] + block = ((min * 60) + sec) * 75 + frame + if block > total: + raise Error, 'out of range' + block = start + block + min, block = divmod(block, 75*60) + sec, frame = divmod(block, 75) + return min, sec, frame + + def reset(self): + self.list = [] + + def appendtrack(self, track): + self.appendstretch(track, track) + + def appendstretch(self, start, end): + if not self.status: + self.cachestatus() + if not start: + start = 1 + if not end: + end = self.status[6] + if type(end) == type(0): + if end < self.status[5] or end > self.status[6]: + raise Error, 'range error' + else: + l = len(end) + if l == 4: + prog, min, sec, frame = end + if prog < self.status[5] or prog > self.status[6]: + raise Error, 'range error' + end = self.pmsf2msf(prog, min, sec, frame) + elif l != 3: + raise Error, 'syntax error' + if type(start) == type(0): + if start < self.status[5] or start > self.status[6]: + raise Error, 'range error' + if len(self.list) > 0: + s, e = self.list[-1] + if type(e) == type(0): + if start == e+1: + start = s + del self.list[-1] + else: + l = len(start) + if l == 4: + prog, min, sec, frame = start + if prog < self.status[5] or prog > self.status[6]: + raise Error, 'range error' + start = self.pmsf2msf(prog, min, sec, frame) + elif l != 3: + raise Error, 'syntax error' + self.list.append((start, end)) + + def settracks(self, list): + self.list = [] + for track in list: + self.appendtrack(track) + + def setcallback(self, cb_type, func, arg): + if cb_type < 0 or cb_type >= 8: + raise Error, 'type out of range' + self.callbacks[cb_type] = (func, arg) + if self.playing: + start, end = self.list[self.listindex] + if type(end) == type(0): + if cb_type != CD.PNUM: + self.parser.setcallback(cb_type, func, arg) + else: + if cb_type != CD.ATIME: + self.parser.setcallback(cb_type, func, arg) + + def removecallback(self, cb_type): + if cb_type < 0 or cb_type >= 8: + raise Error, 'type out of range' + self.callbacks[cb_type] = (None, None) + if self.playing: + start, end = self.list[self.listindex] + if type(end) == type(0): + if cb_type != CD.PNUM: + self.parser.removecallback(cb_type) + else: + if cb_type != CD.ATIME: + self.parser.removecallback(cb_type) + + def gettrackinfo(self, *arg): + if not self.status: + self.cachestatus() + if not self.trackinfo: + self.cacheinfo() + if len(arg) == 0: + return self.trackinfo[self.status[5]:self.status[6]+1] + result = [] + for i in arg: + if i < self.status[5] or i > self.status[6]: + raise Error, 'range error' + result.append(self.trackinfo[i]) + return result + + def cacheinfo(self): + if not self.status: + self.cachestatus() + self.trackinfo = [] + for i in range(self.status[5]): + self.trackinfo.append(None) + for i in range(self.status[5], self.status[6]+1): + self.trackinfo.append(self.player.gettrackinfo(i)) + + def cachestatus(self): + self.status = self.player.getstatus() + if self.status[0] == CD.NODISC: + self.status = None + raise Error, 'no disc in player' + + def getstatus(self): + return self.player.getstatus() + + def play(self): + if not self.status: + self.cachestatus() + size = self.player.bestreadsize() + self.listindex = 0 + self.playing = 0 + for i in range(8): + func, arg = self.callbacks[i] + if func: + self.parser.setcallback(i, func, arg) + else: + self.parser.removecallback(i) + if len(self.list) == 0: + for i in range(self.status[5], self.status[6]+1): + self.appendtrack(i) + try: + while 1: + if not self.playing: + if self.listindex >= len(self.list): + return + start, end = self.list[self.listindex] + if type(start) == type(0): + dummy = self.player.seektrack( + start) + else: + min, sec, frame = start + dummy = self.player.seek( + min, sec, frame) + if type(end) == type(0): + self.parser.setcallback( + CD.PNUM, _dopnum, self) + self.end = end + func, arg = \ + self.callbacks[CD.ATIME] + if func: + self.parser.setcallback(CD.ATIME, func, arg) + else: + self.parser.removecallback(CD.ATIME) + else: + min, sec, frame = end + self.parser.setcallback( + CD.ATIME, _doatime, + self) + self.end = (min * 60 + sec) * \ + 75 + frame + func, arg = \ + self.callbacks[CD.PNUM] + if func: + self.parser.setcallback(CD.PNUM, func, arg) + else: + self.parser.removecallback(CD.PNUM) + self.playing = 1 + data = self.player.readda(size) + if data == '': + self.playing = 0 + self.listindex = self.listindex + 1 + continue + try: + self.parser.parseframe(data) + except _Stop: + self.playing = 0 + self.listindex = self.listindex + 1 + finally: + self.playing = 0 diff --git a/Lib/plat-irix5/torgb.py b/Lib/plat-irix5/torgb.py index c2b1740..54c86c4 100755 --- a/Lib/plat-irix5/torgb.py +++ b/Lib/plat-irix5/torgb.py @@ -51,49 +51,49 @@ uncompress.append('uncompress', '--') class error(Exception): - pass + pass def torgb(filename): - temps = [] - ret = None - try: - ret = _torgb(filename, temps) - finally: - for temp in temps[:]: - if temp != ret: - try: - os.unlink(temp) - except os.error: - pass - temps.remove(temp) - return ret + temps = [] + ret = None + try: + ret = _torgb(filename, temps) + finally: + for temp in temps[:]: + if temp != ret: + try: + os.unlink(temp) + except os.error: + pass + temps.remove(temp) + return ret def _torgb(filename, temps): - if filename[-2:] == '.Z': - (fd, fname) = tempfile.mkstemp() - os.close(fd) - temps.append(fname) - sts = uncompress.copy(filename, fname) - if sts: - raise error, filename + ': uncompress failed' - else: - fname = filename - try: - ftype = imghdr.what(fname) - except IOError, msg: - if type(msg) == type(()) and len(msg) == 2 and \ - type(msg[0]) == type(0) and type(msg[1]) == type(''): - msg = msg[1] - if type(msg) is not type(''): - msg = repr(msg) - raise error, filename + ': ' + msg - if ftype == 'rgb': - return fname - if ftype is None or not table.has_key(ftype): - raise error, '%s: unsupported image file type %r' % (filename, ftype) - (fd, temp) = tempfile.mkstemp() - os.close(fd) - sts = table[ftype].copy(fname, temp) - if sts: - raise error, filename + ': conversion to rgb failed' - return temp + if filename[-2:] == '.Z': + (fd, fname) = tempfile.mkstemp() + os.close(fd) + temps.append(fname) + sts = uncompress.copy(filename, fname) + if sts: + raise error, filename + ': uncompress failed' + else: + fname = filename + try: + ftype = imghdr.what(fname) + except IOError, msg: + if type(msg) == type(()) and len(msg) == 2 and \ + type(msg[0]) == type(0) and type(msg[1]) == type(''): + msg = msg[1] + if type(msg) is not type(''): + msg = repr(msg) + raise error, filename + ': ' + msg + if ftype == 'rgb': + return fname + if ftype is None or not table.has_key(ftype): + raise error, '%s: unsupported image file type %r' % (filename, ftype) + (fd, temp) = tempfile.mkstemp() + os.close(fd) + sts = table[ftype].copy(fname, temp) + if sts: + raise error, filename + ': conversion to rgb failed' + return temp diff --git a/Lib/plat-irix6/AL.py b/Lib/plat-irix6/AL.py index ed17cde..ec941a2 100644 --- a/Lib/plat-irix6/AL.py +++ b/Lib/plat-irix6/AL.py @@ -1,61 +1,61 @@ -RATE_48000 = 48000 -RATE_44100 = 44100 -RATE_32000 = 32000 -RATE_22050 = 22050 -RATE_16000 = 16000 -RATE_11025 = 11025 -RATE_8000 = 8000 +RATE_48000 = 48000 +RATE_44100 = 44100 +RATE_32000 = 32000 +RATE_22050 = 22050 +RATE_16000 = 16000 +RATE_11025 = 11025 +RATE_8000 = 8000 SAMPFMT_TWOSCOMP= 1 -SAMPFMT_FLOAT = 32 -SAMPFMT_DOUBLE = 64 +SAMPFMT_FLOAT = 32 +SAMPFMT_DOUBLE = 64 -SAMPLE_8 = 1 -SAMPLE_16 = 2 - # SAMPLE_24 is the low 24 bits of a long, sign extended to 32 bits -SAMPLE_24 = 4 +SAMPLE_8 = 1 +SAMPLE_16 = 2 + # SAMPLE_24 is the low 24 bits of a long, sign extended to 32 bits +SAMPLE_24 = 4 -MONO = 1 -STEREO = 2 -QUADRO = 4 # 4CHANNEL is not a legal Python name +MONO = 1 +STEREO = 2 +QUADRO = 4 # 4CHANNEL is not a legal Python name -INPUT_LINE = 0 -INPUT_MIC = 1 -INPUT_DIGITAL = 2 +INPUT_LINE = 0 +INPUT_MIC = 1 +INPUT_DIGITAL = 2 -MONITOR_OFF = 0 -MONITOR_ON = 1 +MONITOR_OFF = 0 +MONITOR_ON = 1 -ERROR_NUMBER = 0 -ERROR_TYPE = 1 -ERROR_LOCATION_LSP = 2 -ERROR_LOCATION_MSP = 3 -ERROR_LENGTH = 4 +ERROR_NUMBER = 0 +ERROR_TYPE = 1 +ERROR_LOCATION_LSP = 2 +ERROR_LOCATION_MSP = 3 +ERROR_LENGTH = 4 -ERROR_INPUT_UNDERFLOW = 0 -ERROR_OUTPUT_OVERFLOW = 1 +ERROR_INPUT_UNDERFLOW = 0 +ERROR_OUTPUT_OVERFLOW = 1 # These seem to be not supported anymore: -##HOLD, RELEASE = 0, 1 -##ATTAIL, ATHEAD, ATMARK, ATTIME = 0, 1, 2, 3 - -DEFAULT_DEVICE = 1 - -INPUT_SOURCE = 0 -LEFT_INPUT_ATTEN = 1 -RIGHT_INPUT_ATTEN = 2 -INPUT_RATE = 3 -OUTPUT_RATE = 4 -LEFT_SPEAKER_GAIN = 5 -RIGHT_SPEAKER_GAIN = 6 -INPUT_COUNT = 7 -OUTPUT_COUNT = 8 -UNUSED_COUNT = 9 -SYNC_INPUT_TO_AES = 10 -SYNC_OUTPUT_TO_AES = 11 -MONITOR_CTL = 12 -LEFT_MONITOR_ATTEN = 13 -RIGHT_MONITOR_ATTEN = 14 - -ENUM_VALUE = 0 # only certain values are valid -RANGE_VALUE = 1 # any value in range is valid +##HOLD, RELEASE = 0, 1 +##ATTAIL, ATHEAD, ATMARK, ATTIME = 0, 1, 2, 3 + +DEFAULT_DEVICE = 1 + +INPUT_SOURCE = 0 +LEFT_INPUT_ATTEN = 1 +RIGHT_INPUT_ATTEN = 2 +INPUT_RATE = 3 +OUTPUT_RATE = 4 +LEFT_SPEAKER_GAIN = 5 +RIGHT_SPEAKER_GAIN = 6 +INPUT_COUNT = 7 +OUTPUT_COUNT = 8 +UNUSED_COUNT = 9 +SYNC_INPUT_TO_AES = 10 +SYNC_OUTPUT_TO_AES = 11 +MONITOR_CTL = 12 +LEFT_MONITOR_ATTEN = 13 +RIGHT_MONITOR_ATTEN = 14 + +ENUM_VALUE = 0 # only certain values are valid +RANGE_VALUE = 1 # any value in range is valid diff --git a/Lib/plat-irix6/CD.py b/Lib/plat-irix6/CD.py index ad56561..8c1e03b 100644 --- a/Lib/plat-irix6/CD.py +++ b/Lib/plat-irix6/CD.py @@ -1,34 +1,34 @@ -ERROR = 0 -NODISC = 1 -READY = 2 -PLAYING = 3 -PAUSED = 4 -STILL = 5 +ERROR = 0 +NODISC = 1 +READY = 2 +PLAYING = 3 +PAUSED = 4 +STILL = 5 -AUDIO = 0 -PNUM = 1 -INDEX = 2 -PTIME = 3 -ATIME = 4 -CATALOG = 5 -IDENT = 6 -CONTROL = 7 +AUDIO = 0 +PNUM = 1 +INDEX = 2 +PTIME = 3 +ATIME = 4 +CATALOG = 5 +IDENT = 6 +CONTROL = 7 -CDDA_DATASIZE = 2352 +CDDA_DATASIZE = 2352 -##CDDA_SUBCODESIZE = (sizeof(struct subcodeQ)) -##CDDA_BLOCKSIZE = (sizeof(struct cdframe)) -##CDDA_NUMSAMPLES = (CDDA_DATASIZE/2) +##CDDA_SUBCODESIZE = (sizeof(struct subcodeQ)) +##CDDA_BLOCKSIZE = (sizeof(struct cdframe)) +##CDDA_NUMSAMPLES = (CDDA_DATASIZE/2) ## -##CDQ_PREEMP_MASK = 0xd -##CDQ_COPY_MASK = 0xb -##CDQ_DDATA_MASK = 0xd -##CDQ_BROADCAST_MASK = 0x8 -##CDQ_PREEMPHASIS = 0x1 -##CDQ_COPY_PERMITTED = 0x2 -##CDQ_DIGITAL_DATA = 0x4 -##CDQ_BROADCAST_USE = 0x8 +##CDQ_PREEMP_MASK = 0xd +##CDQ_COPY_MASK = 0xb +##CDQ_DDATA_MASK = 0xd +##CDQ_BROADCAST_MASK = 0x8 +##CDQ_PREEMPHASIS = 0x1 +##CDQ_COPY_PERMITTED = 0x2 +##CDQ_DIGITAL_DATA = 0x4 +##CDQ_BROADCAST_USE = 0x8 ## -##CDQ_MODE1 = 0x1 -##CDQ_MODE2 = 0x2 -##CDQ_MODE3 = 0x3 +##CDQ_MODE1 = 0x1 +##CDQ_MODE2 = 0x2 +##CDQ_MODE3 = 0x3 diff --git a/Lib/plat-irix6/CL.py b/Lib/plat-irix6/CL.py index 468ecaa..23259c5 100644 --- a/Lib/plat-irix6/CL.py +++ b/Lib/plat-irix6/CL.py @@ -1,24 +1,24 @@ # Backward compatible module CL. # All relevant symbols are now defined in the module cl. try: - from cl import * + from cl import * except ImportError: - from CL_old import * + from CL_old import * else: - del CompressImage - del DecompressImage - del GetAlgorithmName - del OpenCompressor - del OpenDecompressor - del QueryAlgorithms - del QueryMaxHeaderSize - del QueryScheme - del QuerySchemeFromName - del SetDefault - del SetMax - del SetMin - try: - del cvt_type - except NameError: - pass - del error + del CompressImage + del DecompressImage + del GetAlgorithmName + del OpenCompressor + del OpenDecompressor + del QueryAlgorithms + del QueryMaxHeaderSize + del QueryScheme + del QuerySchemeFromName + del SetDefault + del SetMax + del SetMin + try: + del cvt_type + except NameError: + pass + del error diff --git a/Lib/plat-irix6/FILE.py b/Lib/plat-irix6/FILE.py index 087d2ec..ab74d7c 100644 --- a/Lib/plat-irix6/FILE.py +++ b/Lib/plat-irix6/FILE.py @@ -441,7 +441,7 @@ def OFFTOBB(bytes): return (((__uint64_t)(bytes) + BBSIZE - 1) >> BBSHIFT) def OFFTOBBT(bytes): return ((off_t)(bytes) >> BBSHIFT) -def BBTOOFF(bbs): return ((off_t)(bbs) << BBSHIFT) +def BBTOOFF(bbs): return ((off_t)(bbs) << BBSHIFT) SEEKLIMIT32 = 0x7fffffff MAXBSIZE = 8192 @@ -489,9 +489,9 @@ MRLOCK_BEHAVIOR = 0x2 MRLOCK_DBLTRIPPABLE = 0x4 MRLOCK_ALLOW_EQUAL_PRI = 0x8 MRLOCK_DEFAULT = MRLOCK_BARRIER -def mraccess(mrp): return mraccessf(mrp, 0) +def mraccess(mrp): return mraccessf(mrp, 0) -def mrupdate(mrp): return mrupdatef(mrp, 0) +def mrupdate(mrp): return mrupdatef(mrp, 0) def mp_mutex_unlock(m): return mutex_unlock(m) diff --git a/Lib/plat-irix6/FL.py b/Lib/plat-irix6/FL.py index ae665e3..727da4c 100644 --- a/Lib/plat-irix6/FL.py +++ b/Lib/plat-irix6/FL.py @@ -7,9 +7,9 @@ _v20 = 1 _v21 = 1 ##import fl ##try: -## _v20 = (fl.get_rgbmode is not None) +## _v20 = (fl.get_rgbmode is not None) ##except: -## _v20 = 0 +## _v20 = 0 ##del fl NULL = 0 @@ -20,7 +20,7 @@ EVENT = -1 LABEL_SIZE = 64 if _v20: - SHORTCUT_SIZE = 32 + SHORTCUT_SIZE = 32 PLACE_FREE = 0 PLACE_SIZE = 1 PLACE_ASPECT = 2 @@ -119,7 +119,7 @@ TOUCH_BUTTON = 4 INOUT_BUTTON = 5 RETURN_BUTTON = 6 if _v20: - HIDDEN_RET_BUTTON = 7 + HIDDEN_RET_BUTTON = 7 BUTTON_BOXTYPE = UP_BOX BUTTON_COL1 = COL1 BUTTON_COL2 = COL1 @@ -129,20 +129,20 @@ BUTTON_MCOL1 = MCOL BUTTON_MCOL2 = MCOL BUTTON_BW = BOUND_WIDTH if _v20: - CHART = 4 - BAR_CHART = 0 - HORBAR_CHART = 1 - LINE_CHART = 2 - FILLED_CHART = 3 - SPIKE_CHART = 4 - PIE_CHART = 5 - SPECIALPIE_CHART = 6 - CHART_BOXTYPE = BORDER_BOX - CHART_COL1 = COL1 - CHART_LCOL = LCOL - CHART_ALIGN = ALIGN_BOTTOM - CHART_BW = BOUND_WIDTH - CHART_MAX = 128 + CHART = 4 + BAR_CHART = 0 + HORBAR_CHART = 1 + LINE_CHART = 2 + FILLED_CHART = 3 + SPIKE_CHART = 4 + PIE_CHART = 5 + SPECIALPIE_CHART = 6 + CHART_BOXTYPE = BORDER_BOX + CHART_COL1 = COL1 + CHART_LCOL = LCOL + CHART_ALIGN = ALIGN_BOTTOM + CHART_BW = BOUND_WIDTH + CHART_MAX = 128 CHOICE = 42 NORMAL_CHOICE = 0 CHOICE_BOXTYPE = DOWN_BOX @@ -173,11 +173,11 @@ COUNTER_COL2 = 4 COUNTER_LCOL = LCOL COUNTER_ALIGN = ALIGN_BOTTOM if _v20: - COUNTER_BW = BOUND_WIDTH + COUNTER_BW = BOUND_WIDTH else: - DEFAULT = 51 - RETURN_DEFAULT = 0 - ALWAYS_DEFAULT = 1 + DEFAULT = 51 + RETURN_DEFAULT = 0 + ALWAYS_DEFAULT = 1 DIAL = 22 NORMAL_DIAL = 0 LINE_DIAL = 1 @@ -197,14 +197,14 @@ ALL_FREE = 5 INPUT = 31 NORMAL_INPUT = 0 if _v20: - FLOAT_INPUT = 1 - INT_INPUT = 2 - HIDDEN_INPUT = 3 - if _v21: - MULTILINE_INPUT = 4 - SECRET_INPUT = 5 + FLOAT_INPUT = 1 + INT_INPUT = 2 + HIDDEN_INPUT = 3 + if _v21: + MULTILINE_INPUT = 4 + SECRET_INPUT = 5 else: - ALWAYS_INPUT = 1 + ALWAYS_INPUT = 1 INPUT_BOXTYPE = DOWN_BOX INPUT_COL1 = 13 INPUT_COL2 = 5 diff --git a/Lib/plat-irix6/SV.py b/Lib/plat-irix6/SV.py index 08fb917..db8efe5 100644 --- a/Lib/plat-irix6/SV.py +++ b/Lib/plat-irix6/SV.py @@ -7,16 +7,16 @@ BLANKING_BUFFER_SIZE = 2 MAX_SOURCES = 2 # mode parameter for Bind calls -IN_OFF = 0 # No Video -IN_OVER = 1 # Video over graphics -IN_UNDER = 2 # Video under graphics -IN_REPLACE = 3 # Video replaces entire win +IN_OFF = 0 # No Video +IN_OVER = 1 # Video over graphics +IN_UNDER = 2 # Video under graphics +IN_REPLACE = 3 # Video replaces entire win # mode parameters for LoadMap calls. Specifies buffer, always 256 entries -INPUT_COLORMAP = 0 # tuples of 8-bit RGB -CHROMA_KEY_MAP = 1 # tuples of 8-bit RGB -COLOR_SPACE_MAP = 2 # tuples of 8-bit RGB -GAMMA_MAP = 3 # tuples of 24-bit red values +INPUT_COLORMAP = 0 # tuples of 8-bit RGB +CHROMA_KEY_MAP = 1 # tuples of 8-bit RGB +COLOR_SPACE_MAP = 2 # tuples of 8-bit RGB +GAMMA_MAP = 3 # tuples of 24-bit red values # mode parameters for UseExclusive calls INPUT = 0 @@ -24,9 +24,9 @@ OUTPUT = 1 IN_OUT = 2 # Format constants for the capture routines -RGB8_FRAMES = 0 # noninterleaved 8 bit 3:2:3 RBG fields -RGB32_FRAMES = 1 # 32-bit 8:8:8 RGB frames -YUV411_FRAMES = 2 # interleaved, 8:2:2 YUV format +RGB8_FRAMES = 0 # noninterleaved 8 bit 3:2:3 RBG fields +RGB32_FRAMES = 1 # 32-bit 8:8:8 RGB frames +YUV411_FRAMES = 2 # interleaved, 8:2:2 YUV format YUV411_FRAMES_AND_BLANKING_BUFFER = 3 # diff --git a/Lib/plat-irix6/cddb.py b/Lib/plat-irix6/cddb.py index 256927c..4588305 100644 --- a/Lib/plat-irix6/cddb.py +++ b/Lib/plat-irix6/cddb.py @@ -20,185 +20,185 @@ _cddbrc = '.cddb' _DB_ID_NTRACKS = 5 _dbid_map = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ@_=+abcdefghijklmnopqrstuvwxyz' def _dbid(v): - if v >= len(_dbid_map): - return string.zfill(v, 2) - else: - return _dbid_map[v] + if v >= len(_dbid_map): + return string.zfill(v, 2) + else: + return _dbid_map[v] def tochash(toc): - if type(toc) == type(''): - tracklist = [] - for i in range(2, len(toc), 4): - tracklist.append((None, - (int(toc[i:i+2]), - int(toc[i+2:i+4])))) - else: - tracklist = toc - ntracks = len(tracklist) - hash = _dbid((ntracks >> 4) & 0xF) + _dbid(ntracks & 0xF) - if ntracks <= _DB_ID_NTRACKS: - nidtracks = ntracks - else: - nidtracks = _DB_ID_NTRACKS - 1 - min = 0 - sec = 0 - for track in tracklist: - start, length = track - min = min + length[0] - sec = sec + length[1] - min = min + sec / 60 - sec = sec % 60 - hash = hash + _dbid(min) + _dbid(sec) - for i in range(nidtracks): - start, length = tracklist[i] - hash = hash + _dbid(length[0]) + _dbid(length[1]) - return hash - + if type(toc) == type(''): + tracklist = [] + for i in range(2, len(toc), 4): + tracklist.append((None, + (int(toc[i:i+2]), + int(toc[i+2:i+4])))) + else: + tracklist = toc + ntracks = len(tracklist) + hash = _dbid((ntracks >> 4) & 0xF) + _dbid(ntracks & 0xF) + if ntracks <= _DB_ID_NTRACKS: + nidtracks = ntracks + else: + nidtracks = _DB_ID_NTRACKS - 1 + min = 0 + sec = 0 + for track in tracklist: + start, length = track + min = min + length[0] + sec = sec + length[1] + min = min + sec / 60 + sec = sec % 60 + hash = hash + _dbid(min) + _dbid(sec) + for i in range(nidtracks): + start, length = tracklist[i] + hash = hash + _dbid(length[0]) + _dbid(length[1]) + return hash + class Cddb: - def __init__(self, tracklist): - if os.environ.has_key('CDDB_PATH'): - path = os.environ['CDDB_PATH'] - cddb_path = path.split(',') - else: - home = os.environ['HOME'] - cddb_path = [home + '/' + _cddbrc] + def __init__(self, tracklist): + if os.environ.has_key('CDDB_PATH'): + path = os.environ['CDDB_PATH'] + cddb_path = path.split(',') + else: + home = os.environ['HOME'] + cddb_path = [home + '/' + _cddbrc] - self._get_id(tracklist) + self._get_id(tracklist) - for dir in cddb_path: - file = dir + '/' + self.id + '.rdb' - try: - f = open(file, 'r') - self.file = file - break - except IOError: - pass - ntracks = int(self.id[:2], 16) - self.artist = '' - self.title = '' - self.track = [None] + [''] * ntracks - self.trackartist = [None] + [''] * ntracks - self.notes = [] - if not hasattr(self, 'file'): - return - import re - reg = re.compile(r'^([^.]*)\.([^:]*):[\t ]+(.*)') - while 1: - line = f.readline() - if not line: - break - match = reg.match(line) - if not match: - print 'syntax error in ' + file - continue - name1, name2, value = match.group(1, 2, 3) - if name1 == 'album': - if name2 == 'artist': - self.artist = value - elif name2 == 'title': - self.title = value - elif name2 == 'toc': - if not self.toc: - self.toc = value - if self.toc != value: - print 'toc\'s don\'t match' - elif name2 == 'notes': - self.notes.append(value) - elif name1[:5] == 'track': - try: - trackno = int(name1[5:]) - except ValueError: - print 'syntax error in ' + file - continue - if trackno > ntracks: - print 'track number %r in file %s out of range' % (trackno, file) - continue - if name2 == 'title': - self.track[trackno] = value - elif name2 == 'artist': - self.trackartist[trackno] = value - f.close() - for i in range(2, len(self.track)): - track = self.track[i] - # if track title starts with `,', use initial part - # of previous track's title - if track and track[0] == ',': - try: - off = self.track[i - 1].index(',') - except ValueError: - pass - else: - self.track[i] = self.track[i-1][:off] \ - + track + for dir in cddb_path: + file = dir + '/' + self.id + '.rdb' + try: + f = open(file, 'r') + self.file = file + break + except IOError: + pass + ntracks = int(self.id[:2], 16) + self.artist = '' + self.title = '' + self.track = [None] + [''] * ntracks + self.trackartist = [None] + [''] * ntracks + self.notes = [] + if not hasattr(self, 'file'): + return + import re + reg = re.compile(r'^([^.]*)\.([^:]*):[\t ]+(.*)') + while 1: + line = f.readline() + if not line: + break + match = reg.match(line) + if not match: + print 'syntax error in ' + file + continue + name1, name2, value = match.group(1, 2, 3) + if name1 == 'album': + if name2 == 'artist': + self.artist = value + elif name2 == 'title': + self.title = value + elif name2 == 'toc': + if not self.toc: + self.toc = value + if self.toc != value: + print 'toc\'s don\'t match' + elif name2 == 'notes': + self.notes.append(value) + elif name1[:5] == 'track': + try: + trackno = int(name1[5:]) + except ValueError: + print 'syntax error in ' + file + continue + if trackno > ntracks: + print 'track number %r in file %s out of range' % (trackno, file) + continue + if name2 == 'title': + self.track[trackno] = value + elif name2 == 'artist': + self.trackartist[trackno] = value + f.close() + for i in range(2, len(self.track)): + track = self.track[i] + # if track title starts with `,', use initial part + # of previous track's title + if track and track[0] == ',': + try: + off = self.track[i - 1].index(',') + except ValueError: + pass + else: + self.track[i] = self.track[i-1][:off] \ + + track - def _get_id(self, tracklist): - # fill in self.id and self.toc. - # if the argument is a string ending in .rdb, the part - # upto the suffix is taken as the id. - if type(tracklist) == type(''): - if tracklist[-4:] == '.rdb': - self.id = tracklist[:-4] - self.toc = '' - return - t = [] - for i in range(2, len(tracklist), 4): - t.append((None, \ - (int(tracklist[i:i+2]), \ - int(tracklist[i+2:i+4])))) - tracklist = t - ntracks = len(tracklist) - self.id = _dbid((ntracks >> 4) & 0xF) + _dbid(ntracks & 0xF) - if ntracks <= _DB_ID_NTRACKS: - nidtracks = ntracks - else: - nidtracks = _DB_ID_NTRACKS - 1 - min = 0 - sec = 0 - for track in tracklist: - start, length = track - min = min + length[0] - sec = sec + length[1] - min = min + sec / 60 - sec = sec % 60 - self.id = self.id + _dbid(min) + _dbid(sec) - for i in range(nidtracks): - start, length = tracklist[i] - self.id = self.id + _dbid(length[0]) + _dbid(length[1]) - self.toc = string.zfill(ntracks, 2) - for track in tracklist: - start, length = track - self.toc = self.toc + string.zfill(length[0], 2) + \ - string.zfill(length[1], 2) + def _get_id(self, tracklist): + # fill in self.id and self.toc. + # if the argument is a string ending in .rdb, the part + # upto the suffix is taken as the id. + if type(tracklist) == type(''): + if tracklist[-4:] == '.rdb': + self.id = tracklist[:-4] + self.toc = '' + return + t = [] + for i in range(2, len(tracklist), 4): + t.append((None, \ + (int(tracklist[i:i+2]), \ + int(tracklist[i+2:i+4])))) + tracklist = t + ntracks = len(tracklist) + self.id = _dbid((ntracks >> 4) & 0xF) + _dbid(ntracks & 0xF) + if ntracks <= _DB_ID_NTRACKS: + nidtracks = ntracks + else: + nidtracks = _DB_ID_NTRACKS - 1 + min = 0 + sec = 0 + for track in tracklist: + start, length = track + min = min + length[0] + sec = sec + length[1] + min = min + sec / 60 + sec = sec % 60 + self.id = self.id + _dbid(min) + _dbid(sec) + for i in range(nidtracks): + start, length = tracklist[i] + self.id = self.id + _dbid(length[0]) + _dbid(length[1]) + self.toc = string.zfill(ntracks, 2) + for track in tracklist: + start, length = track + self.toc = self.toc + string.zfill(length[0], 2) + \ + string.zfill(length[1], 2) - def write(self): - import posixpath - if os.environ.has_key('CDDB_WRITE_DIR'): - dir = os.environ['CDDB_WRITE_DIR'] - else: - dir = os.environ['HOME'] + '/' + _cddbrc - file = dir + '/' + self.id + '.rdb' - if posixpath.exists(file): - # make backup copy - posix.rename(file, file + '~') - f = open(file, 'w') - f.write('album.title:\t' + self.title + '\n') - f.write('album.artist:\t' + self.artist + '\n') - f.write('album.toc:\t' + self.toc + '\n') - for note in self.notes: - f.write('album.notes:\t' + note + '\n') - prevpref = None - for i in range(1, len(self.track)): - if self.trackartist[i]: - f.write('track%r.artist:\t%s\n' % (i, self.trackartist[i])) - track = self.track[i] - try: - off = track.index(',') - except ValueError: - prevpref = None - else: - if prevpref and track[:off] == prevpref: - track = track[off:] - else: - prevpref = track[:off] - f.write('track%r.title:\t%s\n' % (i, track)) - f.close() + def write(self): + import posixpath + if os.environ.has_key('CDDB_WRITE_DIR'): + dir = os.environ['CDDB_WRITE_DIR'] + else: + dir = os.environ['HOME'] + '/' + _cddbrc + file = dir + '/' + self.id + '.rdb' + if posixpath.exists(file): + # make backup copy + posix.rename(file, file + '~') + f = open(file, 'w') + f.write('album.title:\t' + self.title + '\n') + f.write('album.artist:\t' + self.artist + '\n') + f.write('album.toc:\t' + self.toc + '\n') + for note in self.notes: + f.write('album.notes:\t' + note + '\n') + prevpref = None + for i in range(1, len(self.track)): + if self.trackartist[i]: + f.write('track%r.artist:\t%s\n' % (i, self.trackartist[i])) + track = self.track[i] + try: + off = track.index(',') + except ValueError: + prevpref = None + else: + if prevpref and track[:off] == prevpref: + track = track[off:] + else: + prevpref = track[:off] + f.write('track%r.title:\t%s\n' % (i, track)) + f.close() diff --git a/Lib/plat-irix6/cdplayer.py b/Lib/plat-irix6/cdplayer.py index 4ba3f51..d4bc732 100644 --- a/Lib/plat-irix6/cdplayer.py +++ b/Lib/plat-irix6/cdplayer.py @@ -17,72 +17,72 @@ cdplayerrc = '.cdplayerrc' class Cdplayer: - def __init__(self, tracklist): - import string - self.artist = '' - self.title = '' - if type(tracklist) == type(''): - t = [] - for i in range(2, len(tracklist), 4): - t.append((None, \ - (int(tracklist[i:i+2]), \ - int(tracklist[i+2:i+4])))) - tracklist = t - self.track = [None] + [''] * len(tracklist) - self.id = 'd' + string.zfill(len(tracklist), 2) - for track in tracklist: - start, length = track - self.id = self.id + string.zfill(length[0], 2) + \ - string.zfill(length[1], 2) - try: - import posix - f = open(posix.environ['HOME'] + '/' + cdplayerrc, 'r') - except IOError: - return - import re - reg = re.compile(r'^([^:]*):\t(.*)') - s = self.id + '.' - l = len(s) - while 1: - line = f.readline() - if line == '': - break - if line[:l] == s: - line = line[l:] - match = reg.match(line) - if not match: - print 'syntax error in ~/' + cdplayerrc - continue - name, value = match.group(1, 2) - if name == 'title': - self.title = value - elif name == 'artist': - self.artist = value - elif name[:5] == 'track': - trackno = int(name[6:]) - self.track[trackno] = value - f.close() + def __init__(self, tracklist): + import string + self.artist = '' + self.title = '' + if type(tracklist) == type(''): + t = [] + for i in range(2, len(tracklist), 4): + t.append((None, \ + (int(tracklist[i:i+2]), \ + int(tracklist[i+2:i+4])))) + tracklist = t + self.track = [None] + [''] * len(tracklist) + self.id = 'd' + string.zfill(len(tracklist), 2) + for track in tracklist: + start, length = track + self.id = self.id + string.zfill(length[0], 2) + \ + string.zfill(length[1], 2) + try: + import posix + f = open(posix.environ['HOME'] + '/' + cdplayerrc, 'r') + except IOError: + return + import re + reg = re.compile(r'^([^:]*):\t(.*)') + s = self.id + '.' + l = len(s) + while 1: + line = f.readline() + if line == '': + break + if line[:l] == s: + line = line[l:] + match = reg.match(line) + if not match: + print 'syntax error in ~/' + cdplayerrc + continue + name, value = match.group(1, 2) + if name == 'title': + self.title = value + elif name == 'artist': + self.artist = value + elif name[:5] == 'track': + trackno = int(name[6:]) + self.track[trackno] = value + f.close() - def write(self): - import posix - filename = posix.environ['HOME'] + '/' + cdplayerrc - try: - old = open(filename, 'r') - except IOError: - old = open('/dev/null', 'r') - new = open(filename + '.new', 'w') - s = self.id + '.' - l = len(s) - while 1: - line = old.readline() - if line == '': - break - if line[:l] != s: - new.write(line) - new.write(self.id + '.title:\t' + self.title + '\n') - new.write(self.id + '.artist:\t' + self.artist + '\n') - for i in range(1, len(self.track)): - new.write('%s.track.%r:\t%s\n' % (i, track)) - old.close() - new.close() - posix.rename(filename + '.new', filename) + def write(self): + import posix + filename = posix.environ['HOME'] + '/' + cdplayerrc + try: + old = open(filename, 'r') + except IOError: + old = open('/dev/null', 'r') + new = open(filename + '.new', 'w') + s = self.id + '.' + l = len(s) + while 1: + line = old.readline() + if line == '': + break + if line[:l] != s: + new.write(line) + new.write(self.id + '.title:\t' + self.title + '\n') + new.write(self.id + '.artist:\t' + self.artist + '\n') + for i in range(1, len(self.track)): + new.write('%s.track.%r:\t%s\n' % (i, track)) + old.close() + new.close() + posix.rename(filename + '.new', filename) diff --git a/Lib/plat-irix6/flp.py b/Lib/plat-irix6/flp.py index aa23107..f745472 100644 --- a/Lib/plat-irix6/flp.py +++ b/Lib/plat-irix6/flp.py @@ -79,18 +79,18 @@ def checkcache(filename): fp.close() def _unpack_cache(altforms): - forms = {} - for name in altforms.keys(): - altobj, altlist = altforms[name] - obj = _newobj() - obj.make(altobj) - list = [] - for altobj in altlist: - nobj = _newobj() - nobj.make(altobj) - list.append(nobj) - forms[name] = obj, list - return forms + forms = {} + for name in altforms.keys(): + altobj, altlist = altforms[name] + obj = _newobj() + obj.make(altobj) + list = [] + for altobj in altlist: + nobj = _newobj() + nobj.make(altobj) + list.append(nobj) + forms[name] = obj, list + return forms def rdlong(fp): s = fp.read(4) @@ -276,8 +276,8 @@ def _parse_line(line): return line name, value = match.group(1, 2) if name[0] == 'N': - name = ''.join(name.split()) - name = name.lower() + name = ''.join(name.split()) + name = name.lower() name = name.capitalize() try: pf = _parse_func[name] @@ -291,7 +291,7 @@ def _readline(file): if not line: raise EOFError return line[:-1] - + def _parse_1_line(file): line = _readline(file) while line == '': diff --git a/Lib/plat-irix6/jpeg.py b/Lib/plat-irix6/jpeg.py index 2354f40..0b52031 100644 --- a/Lib/plat-irix6/jpeg.py +++ b/Lib/plat-irix6/jpeg.py @@ -6,7 +6,7 @@ # XXX the resulting file causes weirdness. class error(Exception): - pass + pass options = {'quality': 75, 'optimize': 0, 'smooth': 0, 'forcegray': 0} @@ -14,98 +14,98 @@ comp = None decomp = None def compress(imgdata, width, height, bytesperpixel): - global comp - import cl - if comp is None: comp = cl.OpenCompressor(cl.JPEG) - if bytesperpixel == 1: - format = cl.GRAYSCALE - elif bytesperpixel == 4: - format = cl.RGBX - if options['forcegray']: - iformat = cl.GRAYSCALE - else: - iformat = cl.YUV - # XXX How to support 'optimize'? - params = [cl.IMAGE_WIDTH, width, cl.IMAGE_HEIGHT, height, - cl.ORIGINAL_FORMAT, format, - cl.ORIENTATION, cl.BOTTOM_UP, - cl.QUALITY_FACTOR, options['quality'], - cl.INTERNAL_FORMAT, iformat, - ] - comp.SetParams(params) - jpegdata = comp.Compress(1, imgdata) - return jpegdata + global comp + import cl + if comp is None: comp = cl.OpenCompressor(cl.JPEG) + if bytesperpixel == 1: + format = cl.GRAYSCALE + elif bytesperpixel == 4: + format = cl.RGBX + if options['forcegray']: + iformat = cl.GRAYSCALE + else: + iformat = cl.YUV + # XXX How to support 'optimize'? + params = [cl.IMAGE_WIDTH, width, cl.IMAGE_HEIGHT, height, + cl.ORIGINAL_FORMAT, format, + cl.ORIENTATION, cl.BOTTOM_UP, + cl.QUALITY_FACTOR, options['quality'], + cl.INTERNAL_FORMAT, iformat, + ] + comp.SetParams(params) + jpegdata = comp.Compress(1, imgdata) + return jpegdata def decompress(jpegdata): - global decomp - import cl - if decomp is None: decomp = cl.OpenDecompressor(cl.JPEG) - headersize = decomp.ReadHeader(jpegdata) - params = [cl.IMAGE_WIDTH, 0, cl.IMAGE_HEIGHT, 0, cl.INTERNAL_FORMAT, 0] - decomp.GetParams(params) - width, height, format = params[1], params[3], params[5] - if format == cl.GRAYSCALE or options['forcegray']: - format = cl.GRAYSCALE - bytesperpixel = 1 - else: - format = cl.RGBX - bytesperpixel = 4 - # XXX How to support 'smooth'? - params = [cl.ORIGINAL_FORMAT, format, - cl.ORIENTATION, cl.BOTTOM_UP, - cl.FRAME_BUFFER_SIZE, width*height*bytesperpixel] - decomp.SetParams(params) - imgdata = decomp.Decompress(1, jpegdata) - return imgdata, width, height, bytesperpixel + global decomp + import cl + if decomp is None: decomp = cl.OpenDecompressor(cl.JPEG) + headersize = decomp.ReadHeader(jpegdata) + params = [cl.IMAGE_WIDTH, 0, cl.IMAGE_HEIGHT, 0, cl.INTERNAL_FORMAT, 0] + decomp.GetParams(params) + width, height, format = params[1], params[3], params[5] + if format == cl.GRAYSCALE or options['forcegray']: + format = cl.GRAYSCALE + bytesperpixel = 1 + else: + format = cl.RGBX + bytesperpixel = 4 + # XXX How to support 'smooth'? + params = [cl.ORIGINAL_FORMAT, format, + cl.ORIENTATION, cl.BOTTOM_UP, + cl.FRAME_BUFFER_SIZE, width*height*bytesperpixel] + decomp.SetParams(params) + imgdata = decomp.Decompress(1, jpegdata) + return imgdata, width, height, bytesperpixel def setoption(name, value): - if type(value) is not type(0): - raise TypeError, 'jpeg.setoption: numeric options only' - if name == 'forcegrey': - name = 'forcegray' - if not options.has_key(name): - raise KeyError, 'jpeg.setoption: unknown option name' - options[name] = int(value) + if type(value) is not type(0): + raise TypeError, 'jpeg.setoption: numeric options only' + if name == 'forcegrey': + name = 'forcegray' + if not options.has_key(name): + raise KeyError, 'jpeg.setoption: unknown option name' + options[name] = int(value) def test(): - import sys - if sys.argv[1:2] == ['-g']: - del sys.argv[1] - setoption('forcegray', 1) - if not sys.argv[1:]: - sys.argv.append('/usr/local/images/data/jpg/asterix.jpg') - for file in sys.argv[1:]: - show(file) + import sys + if sys.argv[1:2] == ['-g']: + del sys.argv[1] + setoption('forcegray', 1) + if not sys.argv[1:]: + sys.argv.append('/usr/local/images/data/jpg/asterix.jpg') + for file in sys.argv[1:]: + show(file) def show(file): - import gl, GL, DEVICE - jpegdata = open(file, 'r').read() - imgdata, width, height, bytesperpixel = decompress(jpegdata) - gl.foreground() - gl.prefsize(width, height) - win = gl.winopen(file) - if bytesperpixel == 1: - gl.cmode() - gl.pixmode(GL.PM_SIZE, 8) - gl.gconfig() - for i in range(256): - gl.mapcolor(i, i, i, i) - else: - gl.RGBmode() - gl.pixmode(GL.PM_SIZE, 32) - gl.gconfig() - gl.qdevice(DEVICE.REDRAW) - gl.qdevice(DEVICE.ESCKEY) - gl.qdevice(DEVICE.WINQUIT) - gl.qdevice(DEVICE.WINSHUT) - gl.lrectwrite(0, 0, width-1, height-1, imgdata) - while 1: - dev, val = gl.qread() - if dev in (DEVICE.ESCKEY, DEVICE.WINSHUT, DEVICE.WINQUIT): - break - if dev == DEVICE.REDRAW: - gl.lrectwrite(0, 0, width-1, height-1, imgdata) - gl.winclose(win) - # Now test the compression and write the result to a fixed filename - newjpegdata = compress(imgdata, width, height, bytesperpixel) - open('/tmp/j.jpg', 'w').write(newjpegdata) + import gl, GL, DEVICE + jpegdata = open(file, 'r').read() + imgdata, width, height, bytesperpixel = decompress(jpegdata) + gl.foreground() + gl.prefsize(width, height) + win = gl.winopen(file) + if bytesperpixel == 1: + gl.cmode() + gl.pixmode(GL.PM_SIZE, 8) + gl.gconfig() + for i in range(256): + gl.mapcolor(i, i, i, i) + else: + gl.RGBmode() + gl.pixmode(GL.PM_SIZE, 32) + gl.gconfig() + gl.qdevice(DEVICE.REDRAW) + gl.qdevice(DEVICE.ESCKEY) + gl.qdevice(DEVICE.WINQUIT) + gl.qdevice(DEVICE.WINSHUT) + gl.lrectwrite(0, 0, width-1, height-1, imgdata) + while 1: + dev, val = gl.qread() + if dev in (DEVICE.ESCKEY, DEVICE.WINSHUT, DEVICE.WINQUIT): + break + if dev == DEVICE.REDRAW: + gl.lrectwrite(0, 0, width-1, height-1, imgdata) + gl.winclose(win) + # Now test the compression and write the result to a fixed filename + newjpegdata = compress(imgdata, width, height, bytesperpixel) + open('/tmp/j.jpg', 'w').write(newjpegdata) diff --git a/Lib/plat-irix6/panel.py b/Lib/plat-irix6/panel.py index 3aa7448..12e62a5 100644 --- a/Lib/plat-irix6/panel.py +++ b/Lib/plat-irix6/panel.py @@ -17,82 +17,82 @@ debug = 0 # Test if an object is a list. # def is_list(x): - return type(x) == type([]) + return type(x) == type([]) # Reverse a list. # def reverse(list): - res = [] - for item in list: - res.insert(0, item) - return res + res = [] + for item in list: + res.insert(0, item) + return res # Get an attribute of a list, which may itself be another list. # Don't use 'prop' for name. # def getattrlist(list, name): - for item in list: - if item and is_list(item) and item[0] == name: - return item[1:] - return [] + for item in list: + if item and is_list(item) and item[0] == name: + return item[1:] + return [] # Get a property of a list, which may itself be another list. # def getproplist(list, name): - for item in list: - if item and is_list(item) and item[0] == 'prop': - if len(item) > 1 and item[1] == name: - return item[2:] - return [] + for item in list: + if item and is_list(item) and item[0] == 'prop': + if len(item) > 1 and item[1] == name: + return item[2:] + return [] # Test if an actuator description contains the property 'end-of-group' # def is_endgroup(list): - x = getproplist(list, 'end-of-group') - return (x and x[0] == '#t') + x = getproplist(list, 'end-of-group') + return (x and x[0] == '#t') # Neatly display an actuator definition given as S-expression # the prefix string is printed before each line. # def show_actuator(prefix, a): - for item in a: - if not is_list(item): - print prefix, item - elif item and item[0] == 'al': - print prefix, 'Subactuator list:' - for a in item[1:]: - show_actuator(prefix + ' ', a) - elif len(item) == 2: - print prefix, item[0], '=>', item[1] - elif len(item) == 3 and item[0] == 'prop': - print prefix, 'Prop', item[1], '=>', - print item[2] - else: - print prefix, '?', item + for item in a: + if not is_list(item): + print prefix, item + elif item and item[0] == 'al': + print prefix, 'Subactuator list:' + for a in item[1:]: + show_actuator(prefix + ' ', a) + elif len(item) == 2: + print prefix, item[0], '=>', item[1] + elif len(item) == 3 and item[0] == 'prop': + print prefix, 'Prop', item[1], '=>', + print item[2] + else: + print prefix, '?', item # Neatly display a panel. # def show_panel(prefix, p): - for item in p: - if not is_list(item): - print prefix, item - elif item and item[0] == 'al': - print prefix, 'Actuator list:' - for a in item[1:]: - show_actuator(prefix + ' ', a) - elif len(item) == 2: - print prefix, item[0], '=>', item[1] - elif len(item) == 3 and item[0] == 'prop': - print prefix, 'Prop', item[1], '=>', - print item[2] - else: - print prefix, '?', item + for item in p: + if not is_list(item): + print prefix, item + elif item and item[0] == 'al': + print prefix, 'Actuator list:' + for a in item[1:]: + show_actuator(prefix + ' ', a) + elif len(item) == 2: + print prefix, item[0], '=>', item[1] + elif len(item) == 3 and item[0] == 'prop': + print prefix, 'Prop', item[1], '=>', + print item[2] + else: + print prefix, '?', item # Exception raised by build_actuator or build_panel. @@ -103,7 +103,7 @@ panel_error = 'panel error' # Dummy callback used to initialize the callbacks. # def dummy_callback(arg): - pass + pass # Assign attributes to members of the target. @@ -111,60 +111,60 @@ def dummy_callback(arg): # The member name is the attribute name prefixed with the prefix. # def assign_members(target, attrlist, exclist, prefix): - for item in attrlist: - if is_list(item) and len(item) == 2 and item[0] not in exclist: - name, value = item[0], item[1] - ok = 1 - if value[0] in '-0123456789': - value = eval(value) - elif value[0] == '"': - value = value[1:-1] - elif value == 'move-then-resize': - # Strange default set by Panel Editor... - ok = 0 - else: - print 'unknown value', value, 'for', name - ok = 0 - if ok: - lhs = 'target.' + prefix + name - stmt = lhs + '=' + repr(value) - if debug: print 'exec', stmt - try: - exec stmt + '\n' - except KeyboardInterrupt: # Don't catch this! - raise KeyboardInterrupt - except: - print 'assign failed:', stmt + for item in attrlist: + if is_list(item) and len(item) == 2 and item[0] not in exclist: + name, value = item[0], item[1] + ok = 1 + if value[0] in '-0123456789': + value = eval(value) + elif value[0] == '"': + value = value[1:-1] + elif value == 'move-then-resize': + # Strange default set by Panel Editor... + ok = 0 + else: + print 'unknown value', value, 'for', name + ok = 0 + if ok: + lhs = 'target.' + prefix + name + stmt = lhs + '=' + repr(value) + if debug: print 'exec', stmt + try: + exec stmt + '\n' + except KeyboardInterrupt: # Don't catch this! + raise KeyboardInterrupt + except: + print 'assign failed:', stmt # Build a real actuator from an actuator description. # Return a pair (actuator, name). # def build_actuator(descr): - namelist = getattrlist(descr, 'name') - if namelist: - # Assume it is a string - actuatorname = namelist[0][1:-1] - else: - actuatorname = '' - type = descr[0] - if type[:4] == 'pnl_': type = type[4:] - act = pnl.mkact(type) - act.downfunc = act.activefunc = act.upfunc = dummy_callback - # - assign_members(act, descr[1:], ['al', 'data', 'name'], '') - # - # Treat actuator-specific data - # - datalist = getattrlist(descr, 'data') - prefix = '' - if type[-4:] == 'puck': - prefix = 'puck_' - elif type == 'mouse': - prefix = 'mouse_' - assign_members(act, datalist, [], prefix) - # - return act, actuatorname + namelist = getattrlist(descr, 'name') + if namelist: + # Assume it is a string + actuatorname = namelist[0][1:-1] + else: + actuatorname = '' + type = descr[0] + if type[:4] == 'pnl_': type = type[4:] + act = pnl.mkact(type) + act.downfunc = act.activefunc = act.upfunc = dummy_callback + # + assign_members(act, descr[1:], ['al', 'data', 'name'], '') + # + # Treat actuator-specific data + # + datalist = getattrlist(descr, 'data') + prefix = '' + if type[-4:] == 'puck': + prefix = 'puck_' + elif type == 'mouse': + prefix = 'mouse_' + assign_members(act, datalist, [], prefix) + # + return act, actuatorname # Build all sub-actuators and add them to the super-actuator. @@ -176,27 +176,27 @@ def build_actuator(descr): # to a sub-actuator. # def build_subactuators(panel, super_act, al): - # - # This is nearly the same loop as below in build_panel(), - # except a call is made to addsubact() instead of addact(). - # - for a in al: - act, name = build_actuator(a) - act.addsubact(super_act) - if name: - stmt = 'panel.' + name + ' = act' - if debug: print 'exec', stmt - exec stmt + '\n' - if is_endgroup(a): - panel.endgroup() - sub_al = getattrlist(a, 'al') - if sub_al: - build_subactuators(panel, act, sub_al) - # - # Fix the actuator to which whe just added subactuators. - # This can't hurt (I hope) and is needed for the scroll actuator. - # - super_act.fixact() + # + # This is nearly the same loop as below in build_panel(), + # except a call is made to addsubact() instead of addact(). + # + for a in al: + act, name = build_actuator(a) + act.addsubact(super_act) + if name: + stmt = 'panel.' + name + ' = act' + if debug: print 'exec', stmt + exec stmt + '\n' + if is_endgroup(a): + panel.endgroup() + sub_al = getattrlist(a, 'al') + if sub_al: + build_subactuators(panel, act, sub_al) + # + # Fix the actuator to which whe just added subactuators. + # This can't hurt (I hope) and is needed for the scroll actuator. + # + super_act.fixact() # Build a real panel from a panel definition. @@ -204,78 +204,78 @@ def build_subactuators(panel, super_act, al): # reference to a. # def build_panel(descr): - # - # Sanity check - # - if (not descr) or descr[0] != 'panel': - raise panel_error, 'panel description must start with "panel"' - # - if debug: show_panel('', descr) - # - # Create an empty panel - # - panel = pnl.mkpanel() - # - # Assign panel attributes - # - assign_members(panel, descr[1:], ['al'], '') - # - # Look for actuator list - # - al = getattrlist(descr, 'al') - # - # The order in which actuators are created is important - # because of the endgroup() operator. - # Unfortunately the Panel Editor outputs the actuator list - # in reverse order, so we reverse it here. - # - al = reverse(al) - # - for a in al: - act, name = build_actuator(a) - act.addact(panel) - if name: - stmt = 'panel.' + name + ' = act' - exec stmt + '\n' - if is_endgroup(a): - panel.endgroup() - sub_al = getattrlist(a, 'al') - if sub_al: - build_subactuators(panel, act, sub_al) - # - return panel + # + # Sanity check + # + if (not descr) or descr[0] != 'panel': + raise panel_error, 'panel description must start with "panel"' + # + if debug: show_panel('', descr) + # + # Create an empty panel + # + panel = pnl.mkpanel() + # + # Assign panel attributes + # + assign_members(panel, descr[1:], ['al'], '') + # + # Look for actuator list + # + al = getattrlist(descr, 'al') + # + # The order in which actuators are created is important + # because of the endgroup() operator. + # Unfortunately the Panel Editor outputs the actuator list + # in reverse order, so we reverse it here. + # + al = reverse(al) + # + for a in al: + act, name = build_actuator(a) + act.addact(panel) + if name: + stmt = 'panel.' + name + ' = act' + exec stmt + '\n' + if is_endgroup(a): + panel.endgroup() + sub_al = getattrlist(a, 'al') + if sub_al: + build_subactuators(panel, act, sub_al) + # + return panel # Wrapper around pnl.dopanel() which calls call-back functions. # def my_dopanel(): - # Extract only the first 4 elements to allow for future expansion - a, down, active, up = pnl.dopanel()[:4] - if down: - down.downfunc(down) - if active: - active.activefunc(active) - if up: - up.upfunc(up) - return a + # Extract only the first 4 elements to allow for future expansion + a, down, active, up = pnl.dopanel()[:4] + if down: + down.downfunc(down) + if active: + active.activefunc(active) + if up: + up.upfunc(up) + return a # Create one or more panels from a description file (S-expressions) # generated by the Panel Editor. -# +# def defpanellist(file): - import panelparser - descrlist = panelparser.parse_file(open(file, 'r')) - panellist = [] - for descr in descrlist: - panellist.append(build_panel(descr)) - return panellist + import panelparser + descrlist = panelparser.parse_file(open(file, 'r')) + panellist = [] + for descr in descrlist: + panellist.append(build_panel(descr)) + return panellist # Import everything from built-in method pnl, so the user can always # use panel.foo() instead of pnl.foo(). # This gives *no* performance penalty once this module is imported. # -from pnl import * # for export +from pnl import * # for export -dopanel = my_dopanel # override pnl.dopanel +dopanel = my_dopanel # override pnl.dopanel diff --git a/Lib/plat-irix6/panelparser.py b/Lib/plat-irix6/panelparser.py index ee50971..c831c49 100644 --- a/Lib/plat-irix6/panelparser.py +++ b/Lib/plat-irix6/panelparser.py @@ -15,47 +15,47 @@ separators = operators + whitespace + ';' + '"' # Return a list of tokens (strings). # def tokenize_string(s): - tokens = [] - while s: - c = s[:1] - if c in whitespace: - s = s[1:] - elif c == ';': - s = '' - elif c == '"': - n = len(s) - i = 1 - while i < n: - c = s[i] - i = i+1 - if c == '"': break - if c == '\\': i = i+1 - tokens.append(s[:i]) - s = s[i:] - elif c in operators: - tokens.append(c) - s = s[1:] - else: - n = len(s) - i = 1 - while i < n: - if s[i] in separators: break - i = i+1 - tokens.append(s[:i]) - s = s[i:] - return tokens + tokens = [] + while s: + c = s[:1] + if c in whitespace: + s = s[1:] + elif c == ';': + s = '' + elif c == '"': + n = len(s) + i = 1 + while i < n: + c = s[i] + i = i+1 + if c == '"': break + if c == '\\': i = i+1 + tokens.append(s[:i]) + s = s[i:] + elif c in operators: + tokens.append(c) + s = s[1:] + else: + n = len(s) + i = 1 + while i < n: + if s[i] in separators: break + i = i+1 + tokens.append(s[:i]) + s = s[i:] + return tokens # Tokenize a whole file (given as file object, not as file name). # Return a list of tokens (strings). # def tokenize_file(fp): - tokens = [] - while 1: - line = fp.readline() - if not line: break - tokens = tokens + tokenize_string(line) - return tokens + tokens = [] + while 1: + line = fp.readline() + if not line: break + tokens = tokens + tokenize_string(line) + return tokens # Exception raised by parse_exr. @@ -71,50 +71,50 @@ syntax_error = 'syntax error' # May raise syntax_error. # def parse_expr(tokens): - if (not tokens) or tokens[0] != '(': - raise syntax_error, 'expected "("' - tokens = tokens[1:] - expr = [] - while 1: - if not tokens: - raise syntax_error, 'missing ")"' - if tokens[0] == ')': - return expr, tokens[1:] - elif tokens[0] == '(': - subexpr, tokens = parse_expr(tokens) - expr.append(subexpr) - else: - expr.append(tokens[0]) - tokens = tokens[1:] + if (not tokens) or tokens[0] != '(': + raise syntax_error, 'expected "("' + tokens = tokens[1:] + expr = [] + while 1: + if not tokens: + raise syntax_error, 'missing ")"' + if tokens[0] == ')': + return expr, tokens[1:] + elif tokens[0] == '(': + subexpr, tokens = parse_expr(tokens) + expr.append(subexpr) + else: + expr.append(tokens[0]) + tokens = tokens[1:] # Parse a file (given as file object, not as file name). # Return a list of parsed S-expressions found at the top level. # def parse_file(fp): - tokens = tokenize_file(fp) - exprlist = [] - while tokens: - expr, tokens = parse_expr(tokens) - exprlist.append(expr) - return exprlist + tokens = tokenize_file(fp) + exprlist = [] + while tokens: + expr, tokens = parse_expr(tokens) + exprlist.append(expr) + return exprlist # EXAMPLE: # # The input -# '(hip (hop hur-ray))' +# '(hip (hop hur-ray))' # # passed to tokenize_string() returns the token list -# ['(', 'hip', '(', 'hop', 'hur-ray', ')', ')'] +# ['(', 'hip', '(', 'hop', 'hur-ray', ')', ')'] # # When this is passed to parse_expr() it returns the expression -# ['hip', ['hop', 'hur-ray']] +# ['hip', ['hop', 'hur-ray']] # plus an empty token list (because there are no tokens left. # # When a file containing the example is passed to parse_file() it returns # a list whose only element is the output of parse_expr() above: -# [['hip', ['hop', 'hur-ray']]] +# [['hip', ['hop', 'hur-ray']]] # TOKENIZING: @@ -123,6 +123,6 @@ def parse_file(fp): # # Tokens are separated by whitespace, except the following characters # always form a separate token (outside strings): -# ( ) ' +# ( ) ' # Strings are enclosed in double quotes (") and backslash (\) is used # as escape character in strings. diff --git a/Lib/plat-irix6/readcd.py b/Lib/plat-irix6/readcd.py index f278ba4..5453ce4 100644 --- a/Lib/plat-irix6/readcd.py +++ b/Lib/plat-irix6/readcd.py @@ -3,242 +3,242 @@ import cd, CD class Error(Exception): - pass + pass class _Stop(Exception): - pass + pass def _doatime(self, cb_type, data): - if ((data[0] * 60) + data[1]) * 75 + data[2] > self.end: -## print 'done with list entry', repr(self.listindex) - raise _Stop - func, arg = self.callbacks[cb_type] - if func: - func(arg, cb_type, data) + if ((data[0] * 60) + data[1]) * 75 + data[2] > self.end: +## print 'done with list entry', repr(self.listindex) + raise _Stop + func, arg = self.callbacks[cb_type] + if func: + func(arg, cb_type, data) def _dopnum(self, cb_type, data): - if data > self.end: -## print 'done with list entry', repr(self.listindex) - raise _Stop - func, arg = self.callbacks[cb_type] - if func: - func(arg, cb_type, data) + if data > self.end: +## print 'done with list entry', repr(self.listindex) + raise _Stop + func, arg = self.callbacks[cb_type] + if func: + func(arg, cb_type, data) class Readcd: - def __init__(self, *arg): - if len(arg) == 0: - self.player = cd.open() - elif len(arg) == 1: - self.player = cd.open(arg[0]) - elif len(arg) == 2: - self.player = cd.open(arg[0], arg[1]) - else: - raise Error, 'bad __init__ call' - self.list = [] - self.callbacks = [(None, None)] * 8 - self.parser = cd.createparser() - self.playing = 0 - self.end = 0 - self.status = None - self.trackinfo = None - - def eject(self): - self.player.eject() - self.list = [] - self.end = 0 - self.listindex = 0 - self.status = None - self.trackinfo = None - if self.playing: -## print 'stop playing from eject' - raise _Stop - - def pmsf2msf(self, track, min, sec, frame): - if not self.status: - self.cachestatus() - if track < self.status[5] or track > self.status[6]: - raise Error, 'track number out of range' - if not self.trackinfo: - self.cacheinfo() - start, total = self.trackinfo[track] - start = ((start[0] * 60) + start[1]) * 75 + start[2] - total = ((total[0] * 60) + total[1]) * 75 + total[2] - block = ((min * 60) + sec) * 75 + frame - if block > total: - raise Error, 'out of range' - block = start + block - min, block = divmod(block, 75*60) - sec, frame = divmod(block, 75) - return min, sec, frame - - def reset(self): - self.list = [] - - def appendtrack(self, track): - self.appendstretch(track, track) - - def appendstretch(self, start, end): - if not self.status: - self.cachestatus() - if not start: - start = 1 - if not end: - end = self.status[6] - if type(end) == type(0): - if end < self.status[5] or end > self.status[6]: - raise Error, 'range error' - else: - l = len(end) - if l == 4: - prog, min, sec, frame = end - if prog < self.status[5] or prog > self.status[6]: - raise Error, 'range error' - end = self.pmsf2msf(prog, min, sec, frame) - elif l != 3: - raise Error, 'syntax error' - if type(start) == type(0): - if start < self.status[5] or start > self.status[6]: - raise Error, 'range error' - if len(self.list) > 0: - s, e = self.list[-1] - if type(e) == type(0): - if start == e+1: - start = s - del self.list[-1] - else: - l = len(start) - if l == 4: - prog, min, sec, frame = start - if prog < self.status[5] or prog > self.status[6]: - raise Error, 'range error' - start = self.pmsf2msf(prog, min, sec, frame) - elif l != 3: - raise Error, 'syntax error' - self.list.append((start, end)) - - def settracks(self, list): - self.list = [] - for track in list: - self.appendtrack(track) - - def setcallback(self, cb_type, func, arg): - if cb_type < 0 or cb_type >= 8: - raise Error, 'type out of range' - self.callbacks[cb_type] = (func, arg) - if self.playing: - start, end = self.list[self.listindex] - if type(end) == type(0): - if cb_type != CD.PNUM: - self.parser.setcallback(cb_type, func, arg) - else: - if cb_type != CD.ATIME: - self.parser.setcallback(cb_type, func, arg) - - def removecallback(self, cb_type): - if cb_type < 0 or cb_type >= 8: - raise Error, 'type out of range' - self.callbacks[cb_type] = (None, None) - if self.playing: - start, end = self.list[self.listindex] - if type(end) == type(0): - if cb_type != CD.PNUM: - self.parser.removecallback(cb_type) - else: - if cb_type != CD.ATIME: - self.parser.removecallback(cb_type) - - def gettrackinfo(self, *arg): - if not self.status: - self.cachestatus() - if not self.trackinfo: - self.cacheinfo() - if len(arg) == 0: - return self.trackinfo[self.status[5]:self.status[6]+1] - result = [] - for i in arg: - if i < self.status[5] or i > self.status[6]: - raise Error, 'range error' - result.append(self.trackinfo[i]) - return result - - def cacheinfo(self): - if not self.status: - self.cachestatus() - self.trackinfo = [] - for i in range(self.status[5]): - self.trackinfo.append(None) - for i in range(self.status[5], self.status[6]+1): - self.trackinfo.append(self.player.gettrackinfo(i)) - - def cachestatus(self): - self.status = self.player.getstatus() - if self.status[0] == CD.NODISC: - self.status = None - raise Error, 'no disc in player' - - def getstatus(self): - return self.player.getstatus() - - def play(self): - if not self.status: - self.cachestatus() - size = self.player.bestreadsize() - self.listindex = 0 - self.playing = 0 - for i in range(8): - func, arg = self.callbacks[i] - if func: - self.parser.setcallback(i, func, arg) - else: - self.parser.removecallback(i) - if len(self.list) == 0: - for i in range(self.status[5], self.status[6]+1): - self.appendtrack(i) - try: - while 1: - if not self.playing: - if self.listindex >= len(self.list): - return - start, end = self.list[self.listindex] - if type(start) == type(0): - dummy = self.player.seektrack( - start) - else: - min, sec, frame = start - dummy = self.player.seek( - min, sec, frame) - if type(end) == type(0): - self.parser.setcallback( - CD.PNUM, _dopnum, self) - self.end = end - func, arg = \ - self.callbacks[CD.ATIME] - if func: - self.parser.setcallback(CD.ATIME, func, arg) - else: - self.parser.removecallback(CD.ATIME) - else: - min, sec, frame = end - self.parser.setcallback( - CD.ATIME, _doatime, - self) - self.end = (min * 60 + sec) * \ - 75 + frame - func, arg = \ - self.callbacks[CD.PNUM] - if func: - self.parser.setcallback(CD.PNUM, func, arg) - else: - self.parser.removecallback(CD.PNUM) - self.playing = 1 - data = self.player.readda(size) - if data == '': - self.playing = 0 - self.listindex = self.listindex + 1 - continue - try: - self.parser.parseframe(data) - except _Stop: - self.playing = 0 - self.listindex = self.listindex + 1 - finally: - self.playing = 0 + def __init__(self, *arg): + if len(arg) == 0: + self.player = cd.open() + elif len(arg) == 1: + self.player = cd.open(arg[0]) + elif len(arg) == 2: + self.player = cd.open(arg[0], arg[1]) + else: + raise Error, 'bad __init__ call' + self.list = [] + self.callbacks = [(None, None)] * 8 + self.parser = cd.createparser() + self.playing = 0 + self.end = 0 + self.status = None + self.trackinfo = None + + def eject(self): + self.player.eject() + self.list = [] + self.end = 0 + self.listindex = 0 + self.status = None + self.trackinfo = None + if self.playing: +## print 'stop playing from eject' + raise _Stop + + def pmsf2msf(self, track, min, sec, frame): + if not self.status: + self.cachestatus() + if track < self.status[5] or track > self.status[6]: + raise Error, 'track number out of range' + if not self.trackinfo: + self.cacheinfo() + start, total = self.trackinfo[track] + start = ((start[0] * 60) + start[1]) * 75 + start[2] + total = ((total[0] * 60) + total[1]) * 75 + total[2] + block = ((min * 60) + sec) * 75 + frame + if block > total: + raise Error, 'out of range' + block = start + block + min, block = divmod(block, 75*60) + sec, frame = divmod(block, 75) + return min, sec, frame + + def reset(self): + self.list = [] + + def appendtrack(self, track): + self.appendstretch(track, track) + + def appendstretch(self, start, end): + if not self.status: + self.cachestatus() + if not start: + start = 1 + if not end: + end = self.status[6] + if type(end) == type(0): + if end < self.status[5] or end > self.status[6]: + raise Error, 'range error' + else: + l = len(end) + if l == 4: + prog, min, sec, frame = end + if prog < self.status[5] or prog > self.status[6]: + raise Error, 'range error' + end = self.pmsf2msf(prog, min, sec, frame) + elif l != 3: + raise Error, 'syntax error' + if type(start) == type(0): + if start < self.status[5] or start > self.status[6]: + raise Error, 'range error' + if len(self.list) > 0: + s, e = self.list[-1] + if type(e) == type(0): + if start == e+1: + start = s + del self.list[-1] + else: + l = len(start) + if l == 4: + prog, min, sec, frame = start + if prog < self.status[5] or prog > self.status[6]: + raise Error, 'range error' + start = self.pmsf2msf(prog, min, sec, frame) + elif l != 3: + raise Error, 'syntax error' + self.list.append((start, end)) + + def settracks(self, list): + self.list = [] + for track in list: + self.appendtrack(track) + + def setcallback(self, cb_type, func, arg): + if cb_type < 0 or cb_type >= 8: + raise Error, 'type out of range' + self.callbacks[cb_type] = (func, arg) + if self.playing: + start, end = self.list[self.listindex] + if type(end) == type(0): + if cb_type != CD.PNUM: + self.parser.setcallback(cb_type, func, arg) + else: + if cb_type != CD.ATIME: + self.parser.setcallback(cb_type, func, arg) + + def removecallback(self, cb_type): + if cb_type < 0 or cb_type >= 8: + raise Error, 'type out of range' + self.callbacks[cb_type] = (None, None) + if self.playing: + start, end = self.list[self.listindex] + if type(end) == type(0): + if cb_type != CD.PNUM: + self.parser.removecallback(cb_type) + else: + if cb_type != CD.ATIME: + self.parser.removecallback(cb_type) + + def gettrackinfo(self, *arg): + if not self.status: + self.cachestatus() + if not self.trackinfo: + self.cacheinfo() + if len(arg) == 0: + return self.trackinfo[self.status[5]:self.status[6]+1] + result = [] + for i in arg: + if i < self.status[5] or i > self.status[6]: + raise Error, 'range error' + result.append(self.trackinfo[i]) + return result + + def cacheinfo(self): + if not self.status: + self.cachestatus() + self.trackinfo = [] + for i in range(self.status[5]): + self.trackinfo.append(None) + for i in range(self.status[5], self.status[6]+1): + self.trackinfo.append(self.player.gettrackinfo(i)) + + def cachestatus(self): + self.status = self.player.getstatus() + if self.status[0] == CD.NODISC: + self.status = None + raise Error, 'no disc in player' + + def getstatus(self): + return self.player.getstatus() + + def play(self): + if not self.status: + self.cachestatus() + size = self.player.bestreadsize() + self.listindex = 0 + self.playing = 0 + for i in range(8): + func, arg = self.callbacks[i] + if func: + self.parser.setcallback(i, func, arg) + else: + self.parser.removecallback(i) + if len(self.list) == 0: + for i in range(self.status[5], self.status[6]+1): + self.appendtrack(i) + try: + while 1: + if not self.playing: + if self.listindex >= len(self.list): + return + start, end = self.list[self.listindex] + if type(start) == type(0): + dummy = self.player.seektrack( + start) + else: + min, sec, frame = start + dummy = self.player.seek( + min, sec, frame) + if type(end) == type(0): + self.parser.setcallback( + CD.PNUM, _dopnum, self) + self.end = end + func, arg = \ + self.callbacks[CD.ATIME] + if func: + self.parser.setcallback(CD.ATIME, func, arg) + else: + self.parser.removecallback(CD.ATIME) + else: + min, sec, frame = end + self.parser.setcallback( + CD.ATIME, _doatime, + self) + self.end = (min * 60 + sec) * \ + 75 + frame + func, arg = \ + self.callbacks[CD.PNUM] + if func: + self.parser.setcallback(CD.PNUM, func, arg) + else: + self.parser.removecallback(CD.PNUM) + self.playing = 1 + data = self.player.readda(size) + if data == '': + self.playing = 0 + self.listindex = self.listindex + 1 + continue + try: + self.parser.parseframe(data) + except _Stop: + self.playing = 0 + self.listindex = self.listindex + 1 + finally: + self.playing = 0 diff --git a/Lib/plat-irix6/torgb.py b/Lib/plat-irix6/torgb.py index c2b1740..54c86c4 100644 --- a/Lib/plat-irix6/torgb.py +++ b/Lib/plat-irix6/torgb.py @@ -51,49 +51,49 @@ uncompress.append('uncompress', '--') class error(Exception): - pass + pass def torgb(filename): - temps = [] - ret = None - try: - ret = _torgb(filename, temps) - finally: - for temp in temps[:]: - if temp != ret: - try: - os.unlink(temp) - except os.error: - pass - temps.remove(temp) - return ret + temps = [] + ret = None + try: + ret = _torgb(filename, temps) + finally: + for temp in temps[:]: + if temp != ret: + try: + os.unlink(temp) + except os.error: + pass + temps.remove(temp) + return ret def _torgb(filename, temps): - if filename[-2:] == '.Z': - (fd, fname) = tempfile.mkstemp() - os.close(fd) - temps.append(fname) - sts = uncompress.copy(filename, fname) - if sts: - raise error, filename + ': uncompress failed' - else: - fname = filename - try: - ftype = imghdr.what(fname) - except IOError, msg: - if type(msg) == type(()) and len(msg) == 2 and \ - type(msg[0]) == type(0) and type(msg[1]) == type(''): - msg = msg[1] - if type(msg) is not type(''): - msg = repr(msg) - raise error, filename + ': ' + msg - if ftype == 'rgb': - return fname - if ftype is None or not table.has_key(ftype): - raise error, '%s: unsupported image file type %r' % (filename, ftype) - (fd, temp) = tempfile.mkstemp() - os.close(fd) - sts = table[ftype].copy(fname, temp) - if sts: - raise error, filename + ': conversion to rgb failed' - return temp + if filename[-2:] == '.Z': + (fd, fname) = tempfile.mkstemp() + os.close(fd) + temps.append(fname) + sts = uncompress.copy(filename, fname) + if sts: + raise error, filename + ': uncompress failed' + else: + fname = filename + try: + ftype = imghdr.what(fname) + except IOError, msg: + if type(msg) == type(()) and len(msg) == 2 and \ + type(msg[0]) == type(0) and type(msg[1]) == type(''): + msg = msg[1] + if type(msg) is not type(''): + msg = repr(msg) + raise error, filename + ': ' + msg + if ftype == 'rgb': + return fname + if ftype is None or not table.has_key(ftype): + raise error, '%s: unsupported image file type %r' % (filename, ftype) + (fd, temp) = tempfile.mkstemp() + os.close(fd) + sts = table[ftype].copy(fname, temp) + if sts: + raise error, filename + ': conversion to rgb failed' + return temp diff --git a/Lib/plat-linux2/DLFCN.py b/Lib/plat-linux2/DLFCN.py index 16ec538..e23340a 100644 --- a/Lib/plat-linux2/DLFCN.py +++ b/Lib/plat-linux2/DLFCN.py @@ -61,11 +61,11 @@ __flexarr = [] __flexarr = [1] def __ASMNAME(cname): return __ASMNAME2 (__USER_LABEL_PREFIX__, cname) -def __attribute__(xyz): return +def __attribute__(xyz): return def __attribute_format_arg__(x): return __attribute__ ((__format_arg__ (x))) -def __attribute_format_arg__(x): return +def __attribute_format_arg__(x): return __USE_LARGEFILE = 1 __USE_LARGEFILE64 = 1 diff --git a/Lib/plat-linux2/IN.py b/Lib/plat-linux2/IN.py index c63c15e..2020b03 100644 --- a/Lib/plat-linux2/IN.py +++ b/Lib/plat-linux2/IN.py @@ -61,11 +61,11 @@ __flexarr = [] __flexarr = [1] def __ASMNAME(cname): return __ASMNAME2 (__USER_LABEL_PREFIX__, cname) -def __attribute__(xyz): return +def __attribute__(xyz): return def __attribute_format_arg__(x): return __attribute__ ((__format_arg__ (x))) -def __attribute_format_arg__(x): return +def __attribute_format_arg__(x): return __USE_LARGEFILE = 1 __USE_LARGEFILE64 = 1 @@ -613,4 +613,3 @@ def IN6_IS_ADDR_MC_SITELOCAL(a): return \ def IN6_IS_ADDR_MC_ORGLOCAL(a): return \ def IN6_IS_ADDR_MC_GLOBAL(a): return \ - diff --git a/Lib/plat-linux2/TYPES.py b/Lib/plat-linux2/TYPES.py index 2006bfc..0cdd599 100644 --- a/Lib/plat-linux2/TYPES.py +++ b/Lib/plat-linux2/TYPES.py @@ -61,11 +61,11 @@ __flexarr = [] __flexarr = [1] def __ASMNAME(cname): return __ASMNAME2 (__USER_LABEL_PREFIX__, cname) -def __attribute__(xyz): return +def __attribute__(xyz): return def __attribute_format_arg__(x): return __attribute__ ((__format_arg__ (x))) -def __attribute_format_arg__(x): return +def __attribute_format_arg__(x): return __USE_LARGEFILE = 1 __USE_LARGEFILE64 = 1 @@ -168,4 +168,3 @@ def minor(dev): return ((dev).__val[1] & 0xff) def major(dev): return (((dev).__val[0] >> 8) & 0xff) def minor(dev): return ((dev).__val[0] & 0xff) - diff --git a/Lib/plat-mac/Audio_mac.py b/Lib/plat-mac/Audio_mac.py index 5350e55..fd96095 100644 --- a/Lib/plat-mac/Audio_mac.py +++ b/Lib/plat-mac/Audio_mac.py @@ -81,7 +81,7 @@ class Play_Audio_mac: del self._gc[0] if self._usercallback: self._usercallback() - + def setcallback(self, callback): self._usercallback = callback diff --git a/Lib/plat-mac/Carbon/Aliases.py b/Lib/plat-mac/Carbon/Aliases.py index 1211e3d..55e1a1f 100644 --- a/Lib/plat-mac/Carbon/Aliases.py +++ b/Lib/plat-mac/Carbon/Aliases.py @@ -3,16 +3,16 @@ def FOUR_CHAR_CODE(x): return x true = True false = False -rAliasType = FOUR_CHAR_CODE('alis') +rAliasType = FOUR_CHAR_CODE('alis') kARMMountVol = 0x00000001 kARMNoUI = 0x00000002 kARMMultVols = 0x00000008 kARMSearch = 0x00000100 kARMSearchMore = 0x00000200 -kARMSearchRelFirst = 0x00000400 +kARMSearchRelFirst = 0x00000400 asiZoneName = -3 asiServerName = -2 asiVolumeName = -1 asiAliasName = 0 -asiParentName = 1 -kResolveAliasFileNoUI = 0x00000001 +asiParentName = 1 +kResolveAliasFileNoUI = 0x00000001 diff --git a/Lib/plat-mac/Carbon/Appearance.py b/Lib/plat-mac/Carbon/Appearance.py index e42e531..d99c6dc 100644 --- a/Lib/plat-mac/Carbon/Appearance.py +++ b/Lib/plat-mac/Carbon/Appearance.py @@ -5,7 +5,7 @@ kAppearanceEventClass = FOUR_CHAR_CODE('appr') kAEAppearanceChanged = FOUR_CHAR_CODE('thme') kAESystemFontChanged = FOUR_CHAR_CODE('sysf') kAESmallSystemFontChanged = FOUR_CHAR_CODE('ssfn') -kAEViewsFontChanged = FOUR_CHAR_CODE('vfnt') +kAEViewsFontChanged = FOUR_CHAR_CODE('vfnt') kThemeDataFileType = FOUR_CHAR_CODE('thme') kThemePlatinumFileType = FOUR_CHAR_CODE('pltn') kThemeCustomThemesFileType = FOUR_CHAR_CODE('scen') @@ -64,12 +64,12 @@ kThemeBrushDrawerBackground = 51 kThemeBrushToolbarBackground = 52 kThemeBrushSheetBackgroundTransparent = 53 kThemeBrushMenuBackground = 54 -kThemeBrushMenuBackgroundSelected = 55 +kThemeBrushMenuBackgroundSelected = 55 kThemeBrushSheetBackground = kThemeBrushSheetBackgroundOpaque kThemeBrushBlack = -1 kThemeBrushWhite = -2 kThemeBrushPrimaryHighlightColor = -3 -kThemeBrushSecondaryHighlightColor = -4 +kThemeBrushSecondaryHighlightColor = -4 kThemeTextColorDialogActive = 1 kThemeTextColorDialogInactive = 2 kThemeTextColorAlertActive = 3 @@ -127,7 +127,7 @@ kThemeStateUnavailable = 7 kThemeStateUnavailableInactive = 8 kThemeStateDisabled = 0 kThemeStatePressedUp = 2 -kThemeStatePressedDown = 3 +kThemeStatePressedDown = 3 kThemeArrowCursor = 0 kThemeCopyArrowCursor = 1 kThemeAliasArrowCursor = 2 @@ -165,7 +165,7 @@ kThemeMenuItemAtBottom = 0x0200 kThemeMenuItemHierBackground = 0x0400 kThemeMenuItemPopUpBackground = 0x0800 kThemeMenuItemHasIcon = 0x8000 -kThemeMenuItemNoBackground = 0x4000 +kThemeMenuItemNoBackground = 0x4000 kThemeBackgroundTabPane = 1 kThemeBackgroundPlacard = 2 kThemeBackgroundWindowHeader = 3 @@ -178,7 +178,7 @@ kThemeHighlightColorTag = FOUR_CHAR_CODE('hcol') kThemeScrollBarArrowStyleTag = FOUR_CHAR_CODE('sbar') kThemeScrollBarThumbStyleTag = FOUR_CHAR_CODE('sbth') kThemeSoundsEnabledTag = FOUR_CHAR_CODE('snds') -kThemeDblClickCollapseTag = FOUR_CHAR_CODE('coll') +kThemeDblClickCollapseTag = FOUR_CHAR_CODE('coll') kThemeAppearanceFileNameTag = FOUR_CHAR_CODE('thme') kThemeSystemFontTag = FOUR_CHAR_CODE('lgsf') kThemeSmallSystemFontTag = FOUR_CHAR_CODE('smsf') @@ -195,18 +195,18 @@ kThemeSoundTrackNameTag = FOUR_CHAR_CODE('sndt') kThemeSoundMaskTag = FOUR_CHAR_CODE('smsk') kThemeUserDefinedTag = FOUR_CHAR_CODE('user') kThemeSmoothFontEnabledTag = FOUR_CHAR_CODE('smoo') -kThemeSmoothFontMinSizeTag = FOUR_CHAR_CODE('smos') +kThemeSmoothFontMinSizeTag = FOUR_CHAR_CODE('smos') kTiledOnScreen = 1 kCenterOnScreen = 2 kFitToScreen = 3 kFillScreen = 4 -kUseBestGuess = 5 +kUseBestGuess = 5 kThemeCheckBoxClassicX = 0 -kThemeCheckBoxCheckMark = 1 +kThemeCheckBoxCheckMark = 1 kThemeScrollBarArrowsSingle = 0 -kThemeScrollBarArrowsLowerRight = 1 +kThemeScrollBarArrowsLowerRight = 1 kThemeScrollBarThumbNormal = 0 -kThemeScrollBarThumbProportional = 1 +kThemeScrollBarThumbProportional = 1 kThemeSystemFont = 0 kThemeSmallSystemFont = 1 kThemeSmallEmphasizedSystemFont = 2 @@ -238,7 +238,7 @@ kThemeSmallTabHeight = 16 kThemeLargeTabHeight = 21 kThemeTabPaneOverlap = 3 kThemeSmallTabHeightMax = 19 -kThemeLargeTabHeightMax = 24 +kThemeLargeTabHeightMax = 24 kThemeMediumScrollBar = 0 kThemeSmallScrollBar = 1 kThemeMediumSlider = 2 @@ -309,7 +309,7 @@ kThemeArrow9pt = 3 kThemeGrowLeft = (1 << 0) kThemeGrowRight = (1 << 1) kThemeGrowUp = (1 << 2) -kThemeGrowDown = (1 << 3) +kThemeGrowDown = (1 << 3) kThemePushButton = 0 kThemeCheckBox = 1 kThemeRadioButton = 2 @@ -351,7 +351,7 @@ kThemeAdornmentShadowOnly = kThemeAdornmentHeaderButtonShadowOnly kThemeAdornmentArrowLeftArrow = (1 << 6) kThemeAdornmentArrowDownArrow = (1 << 7) kThemeAdornmentArrowDoubleArrow = (1 << 8) -kThemeAdornmentArrowUpArrow = (1 << 9) +kThemeAdornmentArrowUpArrow = (1 << 9) kThemeNoSounds = 0 kThemeWindowSoundsMask = (1 << 0) kThemeMenuSoundsMask = (1 << 1) @@ -629,7 +629,7 @@ kThemeSelectedMenuItemTextColor = kThemeTextColorMenuItemSelected kThemeDisabledMenuItemTextColor = kThemeTextColorMenuItemDisabled kThemeActivePopupLabelTextColor = kThemeTextColorPopupLabelActive kThemeInactivePopupLabelTextColor = kThemeTextColorPopupLabelInactive -kAEThemeSwitch = kAEAppearanceChanged +kAEThemeSwitch = kAEAppearanceChanged kThemeNoAdornment = kThemeAdornmentNone kThemeDefaultAdornment = kThemeAdornmentDefault kThemeFocusAdornment = kThemeAdornmentFocus @@ -641,7 +641,7 @@ kThemeMetricRadioButtonGlyphHeight = kThemeMetricRadioButtonHeight kThemeMetricDisclosureButtonSize = kThemeMetricDisclosureButtonHeight kThemeMetricBestListHeaderHeight = kThemeMetricListHeaderHeight kThemeMetricSmallProgressBarThickness = kThemeMetricNormalProgressBarThickness -kThemeMetricProgressBarThickness = kThemeMetricLargeProgressBarThickness +kThemeMetricProgressBarThickness = kThemeMetricLargeProgressBarThickness kThemeScrollBar = kThemeMediumScrollBar kThemeSlider = kThemeMediumSlider kThemeProgressBar = kThemeMediumProgressBar diff --git a/Lib/plat-mac/Carbon/AppleEvents.py b/Lib/plat-mac/Carbon/AppleEvents.py index 7253a3e..e23c079 100644 --- a/Lib/plat-mac/Carbon/AppleEvents.py +++ b/Lib/plat-mac/Carbon/AppleEvents.py @@ -44,7 +44,7 @@ typeQDRectangle = FOUR_CHAR_CODE('qdrt') typeFixed = FOUR_CHAR_CODE('fixd') typeProcessSerialNumber = FOUR_CHAR_CODE('psn ') typeApplicationURL = FOUR_CHAR_CODE('aprl') -typeNull = FOUR_CHAR_CODE('null') +typeNull = FOUR_CHAR_CODE('null') typeSessionID = FOUR_CHAR_CODE('ssid') typeTargetID = FOUR_CHAR_CODE('targ') typeDispatcherID = FOUR_CHAR_CODE('dspt') @@ -59,19 +59,19 @@ keyInteractLevelAttr = FOUR_CHAR_CODE('inte') keyEventSourceAttr = FOUR_CHAR_CODE('esrc') keyMissedKeywordAttr = FOUR_CHAR_CODE('miss') keyOriginalAddressAttr = FOUR_CHAR_CODE('from') -keyAcceptTimeoutAttr = FOUR_CHAR_CODE('actm') +keyAcceptTimeoutAttr = FOUR_CHAR_CODE('actm') kAEDescListFactorNone = 0 kAEDescListFactorType = 4 kAEDescListFactorTypeAndSize = 8 kAutoGenerateReturnID = -1 -kAnyTransactionID = 0 +kAnyTransactionID = 0 kAEDataArray = 0 kAEPackedArray = 1 kAEDescArray = 3 kAEKeyDescArray = 4 kAEHandleArray = 2 kAENormalPriority = 0x00000000 -kAEHighPriority = 0x00000001 +kAEHighPriority = 0x00000001 kAENoReply = 0x00000001 kAEQueueReply = 0x00000002 kAEWaitReply = 0x00000003 @@ -83,9 +83,9 @@ kAEAlwaysInteract = 0x00000030 kAECanSwitchLayer = 0x00000040 kAEDontRecord = 0x00001000 kAEDontExecute = 0x00002000 -kAEProcessNonReplyEvents = 0x00008000 +kAEProcessNonReplyEvents = 0x00008000 kAEDefaultTimeout = -1 -kNoTimeOut = -2 +kNoTimeOut = -2 kAEInteractWithSelf = 0 kAEInteractWithLocal = 1 kAEInteractWithAll = 2 @@ -95,9 +95,9 @@ kAEIgnoreAppEventHandler = 0x00000002 kAEIgnoreSysPhacHandler = 0x00000004 kAEIgnoreSysEventHandler = 0x00000008 kAEIngoreBuiltInEventHandler = 0x00000010 -# kAEDontDisposeOnResume = (long)0x80000000 +# kAEDontDisposeOnResume = (long)0x80000000 kAENoDispatch = 0 -# kAEUseStandardDispatch = (long)0xFFFFFFFF +# kAEUseStandardDispatch = (long)0xFFFFFFFF keyDirectObject = FOUR_CHAR_CODE('----') keyErrorNumber = FOUR_CHAR_CODE('errn') keyErrorString = FOUR_CHAR_CODE('errs') @@ -105,7 +105,7 @@ keyProcessSerialNumber = FOUR_CHAR_CODE('psn ') keyPreDispatch = FOUR_CHAR_CODE('phac') keySelectProc = FOUR_CHAR_CODE('selh') keyAERecorderCount = FOUR_CHAR_CODE('recr') -keyAEVersion = FOUR_CHAR_CODE('vers') +keyAEVersion = FOUR_CHAR_CODE('vers') kCoreEventClass = FOUR_CHAR_CODE('aevt') kAEOpenApplication = FOUR_CHAR_CODE('oapp') kAEOpenDocuments = FOUR_CHAR_CODE('odoc') @@ -113,12 +113,12 @@ kAEPrintDocuments = FOUR_CHAR_CODE('pdoc') kAEQuitApplication = FOUR_CHAR_CODE('quit') kAEAnswer = FOUR_CHAR_CODE('ansr') kAEApplicationDied = FOUR_CHAR_CODE('obit') -kAEShowPreferences = FOUR_CHAR_CODE('pref') +kAEShowPreferences = FOUR_CHAR_CODE('pref') kAEStartRecording = FOUR_CHAR_CODE('reca') kAEStopRecording = FOUR_CHAR_CODE('recc') kAENotifyStartRecording = FOUR_CHAR_CODE('rec1') kAENotifyStopRecording = FOUR_CHAR_CODE('rec0') -kAENotifyRecording = FOUR_CHAR_CODE('recr') +kAENotifyRecording = FOUR_CHAR_CODE('recr') kAEUnknownSource = 0 kAEDirectCall = 1 kAESameProcess = 2 @@ -143,7 +143,7 @@ cGraphicLine = FOUR_CHAR_CODE('glin') cGraphicObject = FOUR_CHAR_CODE('cgob') cGraphicShape = FOUR_CHAR_CODE('cgsh') cGraphicText = FOUR_CHAR_CODE('cgtx') -cGroupedGraphic = FOUR_CHAR_CODE('cpic') +cGroupedGraphic = FOUR_CHAR_CODE('cpic') cInsertionLoc = FOUR_CHAR_CODE('insl') cInsertionPoint = FOUR_CHAR_CODE('cins') cIntlText = FOUR_CHAR_CODE('itxt') @@ -163,7 +163,7 @@ cMenuItem = FOUR_CHAR_CODE('cmen') cObject = FOUR_CHAR_CODE('cobj') cObjectSpecifier = FOUR_CHAR_CODE('obj ') cOpenableObject = FOUR_CHAR_CODE('coob') -cOval = FOUR_CHAR_CODE('covl') +cOval = FOUR_CHAR_CODE('covl') cParagraph = FOUR_CHAR_CODE('cpar') cPICT = FOUR_CHAR_CODE('PICT') cPixel = FOUR_CHAR_CODE('cpxl') @@ -183,7 +183,7 @@ cTable = FOUR_CHAR_CODE('ctbl') cText = FOUR_CHAR_CODE('ctxt') cTextFlow = FOUR_CHAR_CODE('cflo') cTextStyles = FOUR_CHAR_CODE('tsty') -cType = FOUR_CHAR_CODE('type') +cType = FOUR_CHAR_CODE('type') cVersion = FOUR_CHAR_CODE('vers') cWindow = FOUR_CHAR_CODE('cwin') cWord = FOUR_CHAR_CODE('cwor') @@ -203,7 +203,7 @@ kAEAliasSelection = FOUR_CHAR_CODE('sali') kAEAllCaps = FOUR_CHAR_CODE('alcp') kAEArrowAtEnd = FOUR_CHAR_CODE('aren') kAEArrowAtStart = FOUR_CHAR_CODE('arst') -kAEArrowBothEnds = FOUR_CHAR_CODE('arbo') +kAEArrowBothEnds = FOUR_CHAR_CODE('arbo') kAEAsk = FOUR_CHAR_CODE('ask ') kAEBefore = FOUR_CHAR_CODE('befo') kAEBeginning = FOUR_CHAR_CODE('bgng') @@ -223,7 +223,7 @@ kAECountElements = FOUR_CHAR_CODE('cnte') kAECreateElement = FOUR_CHAR_CODE('crel') kAECreatePublisher = FOUR_CHAR_CODE('cpub') kAECut = FOUR_CHAR_CODE('cut ') -kAEDelete = FOUR_CHAR_CODE('delo') +kAEDelete = FOUR_CHAR_CODE('delo') kAEDoObjectsExist = FOUR_CHAR_CODE('doex') kAEDoScript = FOUR_CHAR_CODE('dosc') kAEDrag = FOUR_CHAR_CODE('drag') @@ -243,7 +243,7 @@ kAEGetClassInfo = FOUR_CHAR_CODE('qobj') kAEGetData = FOUR_CHAR_CODE('getd') kAEGetDataSize = FOUR_CHAR_CODE('dsiz') kAEGetEventInfo = FOUR_CHAR_CODE('gtei') -kAEGetInfoSelection = FOUR_CHAR_CODE('sinf') +kAEGetInfoSelection = FOUR_CHAR_CODE('sinf') kAEGetPrivilegeSelection = FOUR_CHAR_CODE('sprv') kAEGetSuiteInfo = FOUR_CHAR_CODE('gtsi') kAEGreaterThan = FOUR_CHAR_CODE('> ') @@ -263,7 +263,7 @@ kAEMiscStandards = FOUR_CHAR_CODE('misc') kAEModifiable = FOUR_CHAR_CODE('modf') kAEMove = FOUR_CHAR_CODE('move') kAENo = FOUR_CHAR_CODE('no ') -kAENoArrow = FOUR_CHAR_CODE('arno') +kAENoArrow = FOUR_CHAR_CODE('arno') kAENonmodifiable = FOUR_CHAR_CODE('nmod') kAEOpen = FOUR_CHAR_CODE('odoc') kAEOpenSelection = FOUR_CHAR_CODE('sope') @@ -283,7 +283,7 @@ kAEQDBic = FOUR_CHAR_CODE('bic ') kAEQDBlend = FOUR_CHAR_CODE('blnd') kAEQDCopy = FOUR_CHAR_CODE('cpy ') kAEQDNotBic = FOUR_CHAR_CODE('nbic') -kAEQDNotCopy = FOUR_CHAR_CODE('ncpy') +kAEQDNotCopy = FOUR_CHAR_CODE('ncpy') kAEQDNotOr = FOUR_CHAR_CODE('ntor') kAEQDNotXor = FOUR_CHAR_CODE('nxor') kAEQDOr = FOUR_CHAR_CODE('or ') @@ -304,7 +304,7 @@ kAERevert = FOUR_CHAR_CODE('rvrt') kAERightJustified = FOUR_CHAR_CODE('rght') kAESave = FOUR_CHAR_CODE('save') kAESelect = FOUR_CHAR_CODE('slct') -kAESetData = FOUR_CHAR_CODE('setd') +kAESetData = FOUR_CHAR_CODE('setd') kAESetPosition = FOUR_CHAR_CODE('posn') kAEShadow = FOUR_CHAR_CODE('shad') kAEShowClipboard = FOUR_CHAR_CODE('shcl') @@ -322,7 +322,7 @@ kAEUnderline = FOUR_CHAR_CODE('undl') kAEUndo = FOUR_CHAR_CODE('undo') kAEWholeWordEquals = FOUR_CHAR_CODE('wweq') kAEYes = FOUR_CHAR_CODE('yes ') -kAEZoom = FOUR_CHAR_CODE('zoom') +kAEZoom = FOUR_CHAR_CODE('zoom') kAEMouseClass = FOUR_CHAR_CODE('mous') kAEDown = FOUR_CHAR_CODE('down') kAEUp = FOUR_CHAR_CODE('up ') @@ -347,7 +347,7 @@ kAEWakeUpEvent = FOUR_CHAR_CODE('wake') kAEScrapEvent = FOUR_CHAR_CODE('scrp') kAEHighLevel = FOUR_CHAR_CODE('high') keyAEAngle = FOUR_CHAR_CODE('kang') -keyAEArcAngle = FOUR_CHAR_CODE('parc') +keyAEArcAngle = FOUR_CHAR_CODE('parc') keyAEBaseAddr = FOUR_CHAR_CODE('badd') keyAEBestType = FOUR_CHAR_CODE('pbst') keyAEBgndColor = FOUR_CHAR_CODE('kbcl') @@ -367,7 +367,7 @@ keyAEDescType = FOUR_CHAR_CODE('dstp') keyAEDestination = FOUR_CHAR_CODE('dest') keyAEDoAntiAlias = FOUR_CHAR_CODE('anta') keyAEDoDithered = FOUR_CHAR_CODE('gdit') -keyAEDoRotate = FOUR_CHAR_CODE('kdrt') +keyAEDoRotate = FOUR_CHAR_CODE('kdrt') keyAEDoScale = FOUR_CHAR_CODE('ksca') keyAEDoTranslate = FOUR_CHAR_CODE('ktra') keyAEEditionFileLoc = FOUR_CHAR_CODE('eloc') @@ -387,7 +387,7 @@ keyAEGraphicObjects = FOUR_CHAR_CODE('gobs') keyAEID = FOUR_CHAR_CODE('ID ') keyAEImageQuality = FOUR_CHAR_CODE('gqua') keyAEInsertHere = FOUR_CHAR_CODE('insh') -keyAEKeyForms = FOUR_CHAR_CODE('keyf') +keyAEKeyForms = FOUR_CHAR_CODE('keyf') keyAEKeyword = FOUR_CHAR_CODE('kywd') keyAELevel = FOUR_CHAR_CODE('levl') keyAELineArrow = FOUR_CHAR_CODE('arro') @@ -407,7 +407,7 @@ keyAEPixMapMinus = FOUR_CHAR_CODE('kpmm') keyAEPMTable = FOUR_CHAR_CODE('kpmt') keyAEPointList = FOUR_CHAR_CODE('ptlt') keyAEPointSize = FOUR_CHAR_CODE('ptsz') -keyAEPosition = FOUR_CHAR_CODE('kpos') +keyAEPosition = FOUR_CHAR_CODE('kpos') keyAEPropData = FOUR_CHAR_CODE('prdt') keyAEProperties = FOUR_CHAR_CODE('qpro') keyAEProperty = FOUR_CHAR_CODE('kprp') @@ -427,7 +427,7 @@ keyAEScriptTag = FOUR_CHAR_CODE('psct') keyAEShowWhere = FOUR_CHAR_CODE('show') keyAEStartAngle = FOUR_CHAR_CODE('pang') keyAEStartPoint = FOUR_CHAR_CODE('pstp') -keyAEStyles = FOUR_CHAR_CODE('ksty') +keyAEStyles = FOUR_CHAR_CODE('ksty') keyAESuiteID = FOUR_CHAR_CODE('suit') keyAEText = FOUR_CHAR_CODE('ktxt') keyAETextColor = FOUR_CHAR_CODE('ptxc') @@ -444,7 +444,7 @@ keyAEUniformStyles = FOUR_CHAR_CODE('ustl') keyAEUpdateOn = FOUR_CHAR_CODE('pupd') keyAEUserTerm = FOUR_CHAR_CODE('utrm') keyAEWindow = FOUR_CHAR_CODE('wndw') -keyAEWritingCode = FOUR_CHAR_CODE('wrcd') +keyAEWritingCode = FOUR_CHAR_CODE('wrcd') keyMiscellaneous = FOUR_CHAR_CODE('fmsc') keySelection = FOUR_CHAR_CODE('fsel') keyWindow = FOUR_CHAR_CODE('kwnd') @@ -477,7 +477,7 @@ pEnabled = FOUR_CHAR_CODE('enbl') pEndPoint = FOUR_CHAR_CODE('pend') pFillColor = FOUR_CHAR_CODE('flcl') pFillPattern = FOUR_CHAR_CODE('flpt') -pFont = FOUR_CHAR_CODE('font') +pFont = FOUR_CHAR_CODE('font') pFormula = FOUR_CHAR_CODE('pfor') pGraphicObjects = FOUR_CHAR_CODE('gobs') pHasCloseBox = FOUR_CHAR_CODE('hclb') @@ -497,7 +497,7 @@ pItemNumber = FOUR_CHAR_CODE('itmn') pJustification = FOUR_CHAR_CODE('pjst') pLineArrow = FOUR_CHAR_CODE('arro') pMenuID = FOUR_CHAR_CODE('mnid') -pName = FOUR_CHAR_CODE('pnam') +pName = FOUR_CHAR_CODE('pnam') pNewElementLoc = FOUR_CHAR_CODE('pnel') pPenColor = FOUR_CHAR_CODE('ppcl') pPenPattern = FOUR_CHAR_CODE('pppa') @@ -517,7 +517,7 @@ pStartPoint = FOUR_CHAR_CODE('pstp') pTextColor = FOUR_CHAR_CODE('ptxc') pTextFont = FOUR_CHAR_CODE('ptxf') pTextItemDelimiters = FOUR_CHAR_CODE('txdl') -pTextPointSize = FOUR_CHAR_CODE('ptps') +pTextPointSize = FOUR_CHAR_CODE('ptps') pTextStyles = FOUR_CHAR_CODE('txst') pTransferMode = FOUR_CHAR_CODE('pptm') pTranslation = FOUR_CHAR_CODE('ptrs') @@ -525,7 +525,7 @@ pUniformStyles = FOUR_CHAR_CODE('ustl') pUpdateOn = FOUR_CHAR_CODE('pupd') pUserSelection = FOUR_CHAR_CODE('pusl') pVersion = FOUR_CHAR_CODE('vers') -pVisible = FOUR_CHAR_CODE('pvis') +pVisible = FOUR_CHAR_CODE('pvis') typeAEText = FOUR_CHAR_CODE('tTXT') typeArc = FOUR_CHAR_CODE('carc') typeBest = FOUR_CHAR_CODE('best') @@ -539,7 +539,7 @@ typeDrawingArea = FOUR_CHAR_CODE('cdrw') typeElemInfo = FOUR_CHAR_CODE('elin') typeEnumeration = FOUR_CHAR_CODE('enum') typeEPS = FOUR_CHAR_CODE('EPS ') -typeEventInfo = FOUR_CHAR_CODE('evin') +typeEventInfo = FOUR_CHAR_CODE('evin') typeFinderWindow = FOUR_CHAR_CODE('fwin') typeFixedPoint = FOUR_CHAR_CODE('fpnt') typeFixedRectangle = FOUR_CHAR_CODE('frct') @@ -558,7 +558,7 @@ typeLongRectangle = FOUR_CHAR_CODE('lrct') typeMachineLoc = FOUR_CHAR_CODE('mLoc') typeOval = FOUR_CHAR_CODE('covl') typeParamInfo = FOUR_CHAR_CODE('pmin') -typePict = FOUR_CHAR_CODE('PICT') +typePict = FOUR_CHAR_CODE('PICT') typePixelMap = FOUR_CHAR_CODE('cpix') typePixMapMinus = FOUR_CHAR_CODE('tpmm') typePolygon = FOUR_CHAR_CODE('cpgn') @@ -578,9 +578,9 @@ typeScript = FOUR_CHAR_CODE('scpt') typeStyledText = FOUR_CHAR_CODE('STXT') typeSuiteInfo = FOUR_CHAR_CODE('suin') typeTable = FOUR_CHAR_CODE('ctbl') -typeTextStyles = FOUR_CHAR_CODE('tsty') +typeTextStyles = FOUR_CHAR_CODE('tsty') typeTIFF = FOUR_CHAR_CODE('TIFF') -typeVersion = FOUR_CHAR_CODE('vers') +typeVersion = FOUR_CHAR_CODE('vers') kAEMenuClass = FOUR_CHAR_CODE('menu') kAEMenuSelect = FOUR_CHAR_CODE('mhit') kAEMouseDown = FOUR_CHAR_CODE('mdwn') @@ -640,7 +640,7 @@ typeOffsetArray = FOUR_CHAR_CODE('ofay') typeTextRangeArray = FOUR_CHAR_CODE('tray') typeLowLevelEventRecord = FOUR_CHAR_CODE('evtr') typeEventRef = FOUR_CHAR_CODE('evrf') -typeText = typeChar +typeText = typeChar kTSMOutsideOfBody = 1 kTSMInsideOfBody = 2 kTSMInsideOfActiveInputArea = 3 @@ -653,7 +653,7 @@ kConvertedText = 4 kSelectedConvertedText = 5 kBlockFillText = 6 kOutlineText = 7 -kSelectedText = 8 +kSelectedText = 8 keyAEHiliteRange = FOUR_CHAR_CODE('hrng') keyAEPinRange = FOUR_CHAR_CODE('pnrg') keyAEClauseOffsets = FOUR_CHAR_CODE('clau') @@ -661,7 +661,7 @@ keyAEOffset = FOUR_CHAR_CODE('ofst') keyAEPoint = FOUR_CHAR_CODE('gpos') keyAELeftSide = FOUR_CHAR_CODE('klef') keyAERegionClass = FOUR_CHAR_CODE('rgnc') -keyAEDragging = FOUR_CHAR_CODE('bool') +keyAEDragging = FOUR_CHAR_CODE('bool') keyAELeadingEdge = keyAELeftSide typeUnicodeText = FOUR_CHAR_CODE('utxt') typeStyledUnicodeText = FOUR_CHAR_CODE('sutx') @@ -710,7 +710,7 @@ kFAAttachCommand = FOUR_CHAR_CODE('atfa') kFARemoveCommand = FOUR_CHAR_CODE('rmfa') kFAEditCommand = FOUR_CHAR_CODE('edfa') kFAFileParam = FOUR_CHAR_CODE('faal') -kFAIndexParam = FOUR_CHAR_CODE('indx') +kFAIndexParam = FOUR_CHAR_CODE('indx') kAEInternetSuite = FOUR_CHAR_CODE('gurl') kAEISWebStarSuite = FOUR_CHAR_CODE('WWW\xbd') kAEISGetURL = FOUR_CHAR_CODE('gurl') @@ -917,7 +917,7 @@ keyAEObject2 = FOUR_CHAR_CODE('obj2') keyAEDesiredClass = FOUR_CHAR_CODE('want') keyAEContainer = FOUR_CHAR_CODE('from') keyAEKeyForm = FOUR_CHAR_CODE('form') -keyAEKeyData = FOUR_CHAR_CODE('seld') +keyAEKeyData = FOUR_CHAR_CODE('seld') keyAERangeStart = FOUR_CHAR_CODE('star') keyAERangeStop = FOUR_CHAR_CODE('stop') keyDisposeTokenProc = FOUR_CHAR_CODE('xtok') @@ -926,7 +926,7 @@ keyAECountProc = FOUR_CHAR_CODE('cont') keyAEMarkTokenProc = FOUR_CHAR_CODE('mkid') keyAEMarkProc = FOUR_CHAR_CODE('mark') keyAEAdjustMarksProc = FOUR_CHAR_CODE('adjm') -keyAEGetErrDescProc = FOUR_CHAR_CODE('indc') +keyAEGetErrDescProc = FOUR_CHAR_CODE('indc') formAbsolutePosition = FOUR_CHAR_CODE('indx') formRelativePosition = FOUR_CHAR_CODE('rele') formTest = FOUR_CHAR_CODE('test') @@ -943,7 +943,7 @@ typeIndexDescriptor = FOUR_CHAR_CODE('inde') typeRangeDescriptor = FOUR_CHAR_CODE('rang') typeLogicalDescriptor = FOUR_CHAR_CODE('logi') typeCompDescriptor = FOUR_CHAR_CODE('cmpd') -typeOSLTokenList = FOUR_CHAR_CODE('ostl') +typeOSLTokenList = FOUR_CHAR_CODE('ostl') kAEIDoMinimum = 0x0000 kAEIDoWhose = 0x0001 kAEIDoMarking = 0x0004 @@ -957,4 +957,4 @@ typeWhoseRange = FOUR_CHAR_CODE('wrng') keyAEWhoseRangeStart = FOUR_CHAR_CODE('wstr') keyAEWhoseRangeStop = FOUR_CHAR_CODE('wstp') keyAEIndex = FOUR_CHAR_CODE('kidx') -keyAETest = FOUR_CHAR_CODE('ktst') +keyAETest = FOUR_CHAR_CODE('ktst') diff --git a/Lib/plat-mac/Carbon/CarbonEvents.py b/Lib/plat-mac/Carbon/CarbonEvents.py index ff4f69c..357ee5d 100755 --- a/Lib/plat-mac/Carbon/CarbonEvents.py +++ b/Lib/plat-mac/Carbon/CarbonEvents.py @@ -71,9 +71,9 @@ kEventRawKeyRepeat = 2 kEventRawKeyUp = 3 kEventRawKeyModifiersChanged = 4 kEventHotKeyPressed = 5 -kEventHotKeyReleased = 6 +kEventHotKeyReleased = 6 kEventKeyModifierNumLockBit = 16 -kEventKeyModifierFnBit = 17 +kEventKeyModifierFnBit = 17 kEventKeyModifierNumLockMask = 1L << kEventKeyModifierNumLockBit kEventKeyModifierFnMask = 1L << kEventKeyModifierFnBit kEventAppActivated = 1 @@ -262,18 +262,18 @@ kControlBoundsChangeSizeChanged = (1 << 2) kControlBoundsChangePositionChanged = (1 << 3) kEventTabletPoint = 1 kEventTabletProximity = 2 -kEventTabletPointer = 1 +kEventTabletPointer = 1 kEventVolumeMounted = 1 -kEventVolumeUnmounted = 2 -typeFSVolumeRefNum = FOUR_CHAR_CODE('voln') +kEventVolumeUnmounted = 2 +typeFSVolumeRefNum = FOUR_CHAR_CODE('voln') kEventAppearanceScrollBarVariantChanged = 1 kEventServiceCopy = 1 kEventServicePaste = 2 kEventServiceGetTypes = 3 kEventServicePerform = 4 -kEventParamDirectObject = FOUR_CHAR_CODE('----') +kEventParamDirectObject = FOUR_CHAR_CODE('----') kEventParamPostTarget = FOUR_CHAR_CODE('ptrg') -typeEventTargetRef = FOUR_CHAR_CODE('etrg') +typeEventTargetRef = FOUR_CHAR_CODE('etrg') kEventParamWindowRef = FOUR_CHAR_CODE('wind') kEventParamGrafPort = FOUR_CHAR_CODE('graf') kEventParamDragRef = FOUR_CHAR_CODE('drag') @@ -304,7 +304,7 @@ typeCFTypeRef = FOUR_CHAR_CODE('cfty') typeCGContextRef = FOUR_CHAR_CODE('cntx') typeHIPoint = FOUR_CHAR_CODE('hipt') typeHISize = FOUR_CHAR_CODE('hisz') -typeHIRect = FOUR_CHAR_CODE('hirc') +typeHIRect = FOUR_CHAR_CODE('hirc') kEventParamMouseLocation = FOUR_CHAR_CODE('mloc') kEventParamMouseButton = FOUR_CHAR_CODE('mbtn') kEventParamClickCount = FOUR_CHAR_CODE('ccnt') @@ -314,13 +314,13 @@ kEventParamMouseDelta = FOUR_CHAR_CODE('mdta') kEventParamMouseChord = FOUR_CHAR_CODE('chor') kEventParamTabletEventType = FOUR_CHAR_CODE('tblt') typeMouseButton = FOUR_CHAR_CODE('mbtn') -typeMouseWheelAxis = FOUR_CHAR_CODE('mwax') +typeMouseWheelAxis = FOUR_CHAR_CODE('mwax') kEventParamKeyCode = FOUR_CHAR_CODE('kcod') kEventParamKeyMacCharCodes = FOUR_CHAR_CODE('kchr') kEventParamKeyModifiers = FOUR_CHAR_CODE('kmod') kEventParamKeyUnicodes = FOUR_CHAR_CODE('kuni') kEventParamKeyboardType = FOUR_CHAR_CODE('kbdt') -typeEventHotKeyID = FOUR_CHAR_CODE('hkid') +typeEventHotKeyID = FOUR_CHAR_CODE('hkid') kEventParamTextInputSendRefCon = FOUR_CHAR_CODE('tsrc') kEventParamTextInputSendComponentInstance = FOUR_CHAR_CODE('tsci') kEventParamTextInputSendSLRec = FOUR_CHAR_CODE('tssl') @@ -350,9 +350,9 @@ kEventParamTextInputSendShowHide = FOUR_CHAR_CODE('tssh') kEventParamTextInputReplyShowHide = FOUR_CHAR_CODE('trsh') kEventParamTextInputSendKeyboardEvent = FOUR_CHAR_CODE('tske') kEventParamTextInputSendTextServiceEncoding = FOUR_CHAR_CODE('tsse') -kEventParamTextInputSendTextServiceMacEncoding = FOUR_CHAR_CODE('tssm') +kEventParamTextInputSendTextServiceMacEncoding = FOUR_CHAR_CODE('tssm') kEventParamHICommand = FOUR_CHAR_CODE('hcmd') -typeHICommand = FOUR_CHAR_CODE('hcmd') +typeHICommand = FOUR_CHAR_CODE('hcmd') kEventParamWindowFeatures = FOUR_CHAR_CODE('wftr') kEventParamWindowDefPart = FOUR_CHAR_CODE('wdpc') kEventParamCurrentBounds = FOUR_CHAR_CODE('crct') @@ -375,7 +375,7 @@ kEventParamPreviousDockRect = FOUR_CHAR_CODE('pdrc') kEventParamCurrentDockRect = FOUR_CHAR_CODE('cdrc') typeWindowRegionCode = FOUR_CHAR_CODE('wshp') typeWindowDefPartCode = FOUR_CHAR_CODE('wdpt') -typeClickActivationResult = FOUR_CHAR_CODE('clac') +typeClickActivationResult = FOUR_CHAR_CODE('clac') kEventParamControlPart = FOUR_CHAR_CODE('cprt') kEventParamInitCollection = FOUR_CHAR_CODE('icol') kEventParamControlMessage = FOUR_CHAR_CODE('cmsg') @@ -402,7 +402,7 @@ kEventParamControlOriginalOwningWindow = FOUR_CHAR_CODE('coow') kEventParamControlCurrentOwningWindow = FOUR_CHAR_CODE('ccow') typeControlActionUPP = FOUR_CHAR_CODE('caup') typeIndicatorDragConstraint = FOUR_CHAR_CODE('cidc') -typeControlPartCode = FOUR_CHAR_CODE('cprt') +typeControlPartCode = FOUR_CHAR_CODE('cprt') kEventParamCurrentMenuTrackingMode = FOUR_CHAR_CODE('cmtm') kEventParamNewMenuTrackingMode = FOUR_CHAR_CODE('nmtm') kEventParamMenuFirstOpen = FOUR_CHAR_CODE('1sto') @@ -428,24 +428,24 @@ typeMenuCommand = FOUR_CHAR_CODE('mcmd') typeMenuTrackingMode = FOUR_CHAR_CODE('mtmd') typeMenuEventOptions = FOUR_CHAR_CODE('meop') typeThemeMenuState = FOUR_CHAR_CODE('tmns') -typeThemeMenuItemType = FOUR_CHAR_CODE('tmit') +typeThemeMenuItemType = FOUR_CHAR_CODE('tmit') kEventParamProcessID = FOUR_CHAR_CODE('psn ') kEventParamLaunchRefCon = FOUR_CHAR_CODE('lref') -kEventParamLaunchErr = FOUR_CHAR_CODE('err ') +kEventParamLaunchErr = FOUR_CHAR_CODE('err ') kEventParamTabletPointRec = FOUR_CHAR_CODE('tbrc') kEventParamTabletProximityRec = FOUR_CHAR_CODE('tbpx') typeTabletPointRec = FOUR_CHAR_CODE('tbrc') typeTabletProximityRec = FOUR_CHAR_CODE('tbpx') kEventParamTabletPointerRec = FOUR_CHAR_CODE('tbrc') -typeTabletPointerRec = FOUR_CHAR_CODE('tbrc') -kEventParamNewScrollBarVariant = FOUR_CHAR_CODE('nsbv') +typeTabletPointerRec = FOUR_CHAR_CODE('tbrc') +kEventParamNewScrollBarVariant = FOUR_CHAR_CODE('nsbv') kEventParamScrapRef = FOUR_CHAR_CODE('scrp') kEventParamServiceCopyTypes = FOUR_CHAR_CODE('svsd') kEventParamServicePasteTypes = FOUR_CHAR_CODE('svpt') kEventParamServiceMessageName = FOUR_CHAR_CODE('svmg') kEventParamServiceUserData = FOUR_CHAR_CODE('svud') typeScrapRef = FOUR_CHAR_CODE('scrp') -typeCFMutableArrayRef = FOUR_CHAR_CODE('cfma') +typeCFMutableArrayRef = FOUR_CHAR_CODE('cfma') # sHandler = NewEventHandlerUPP( x ) kMouseTrackingMousePressed = kMouseTrackingMouseDown kMouseTrackingMouseReleased = kMouseTrackingMouseUp diff --git a/Lib/plat-mac/Carbon/Components.py b/Lib/plat-mac/Carbon/Components.py index 3fbca02..75574cf 100644 --- a/Lib/plat-mac/Carbon/Components.py +++ b/Lib/plat-mac/Carbon/Components.py @@ -3,7 +3,7 @@ def FOUR_CHAR_CODE(x): return x kAppleManufacturer = FOUR_CHAR_CODE('appl') kComponentResourceType = FOUR_CHAR_CODE('thng') -kComponentAliasResourceType = FOUR_CHAR_CODE('thga') +kComponentAliasResourceType = FOUR_CHAR_CODE('thga') kAnyComponentType = 0 kAnyComponentSubType = 0 kAnyComponentManufacturer = 0 @@ -19,7 +19,7 @@ kComponentTargetSelect = -6 kComponentUnregisterSelect = -7 kComponentGetMPWorkFunctionSelect = -8 kComponentExecuteWiredActionSelect = -9 -kComponentGetPublicResourceSelect = -10 +kComponentGetPublicResourceSelect = -10 componentDoAutoVersion = (1 << 0) componentWantsUnregister = (1 << 1) componentAutoVersionIncludeFlags = (1 << 2) diff --git a/Lib/plat-mac/Carbon/ControlAccessor.py b/Lib/plat-mac/Carbon/ControlAccessor.py index 791544e..0998925 100644 --- a/Lib/plat-mac/Carbon/ControlAccessor.py +++ b/Lib/plat-mac/Carbon/ControlAccessor.py @@ -6,22 +6,22 @@ import struct # These needn't go through this module, but are here for completeness def SetControlData_Handle(control, part, selector, data): control.SetControlData_Handle(part, selector, data) - + def GetControlData_Handle(control, part, selector): return control.GetControlData_Handle(part, selector) - + _accessdict = { kControlPopupButtonMenuHandleTag: (SetControlData_Handle, GetControlData_Handle), } _codingdict = { kControlPushButtonDefaultTag : ("b", None, None), - + kControlEditTextTextTag: (None, None, None), kControlEditTextPasswordTag: (None, None, None), - + kControlPopupButtonMenuIDTag: ("h", None, None), - + kControlListBoxDoubleClickTag: ("b", None, None), } @@ -38,7 +38,7 @@ def SetControlData(control, part, selector, data): if structfmt: data = struct.pack(structfmt, data) control.SetControlData(part, selector, data) - + def GetControlData(control, part, selector): if _accessdict.has_key(selector): setfunc, getfunc = _accessdict[selector] @@ -54,4 +54,3 @@ def GetControlData(control, part, selector): if type(data) == type(()) and len(data) == 1: data = data[0] return data - diff --git a/Lib/plat-mac/Carbon/Controls.py b/Lib/plat-mac/Carbon/Controls.py index d4bbda3..6e5d8ea 100644 --- a/Lib/plat-mac/Carbon/Controls.py +++ b/Lib/plat-mac/Carbon/Controls.py @@ -17,20 +17,20 @@ kControlDefProcResourceType = FOUR_CHAR_CODE('CDEF') controlNotifyNothing = FOUR_CHAR_CODE('nada') controlNotifyClick = FOUR_CHAR_CODE('clik') controlNotifyFocus = FOUR_CHAR_CODE('focu') -controlNotifyKey = FOUR_CHAR_CODE('key ') -kControlCanAutoInvalidate = 1L << 0 +controlNotifyKey = FOUR_CHAR_CODE('key ') +kControlCanAutoInvalidate = 1L << 0 staticTextProc = 256 editTextProc = 272 iconProc = 288 userItemProc = 304 -pictItemProc = 320 +pictItemProc = 320 cFrameColor = 0 cBodyColor = 1 cTextColor = 2 cThumbColor = 3 kNumberCtlCTabEntries = 4 kControlNoVariant = 0 -kControlUsesOwningWindowsFontVariant = 1 << 3 +kControlUsesOwningWindowsFontVariant = 1 << 3 kControlNoPart = 0 kControlIndicatorPart = 129 kControlDisabledPart = 254 @@ -40,7 +40,7 @@ kControlStructureMetaPart = -1 kControlContentMetaPart = -2 kControlFocusNoPart = 0 kControlFocusNextPart = -1 -kControlFocusPrevPart = -2 +kControlFocusPrevPart = -2 kControlCollectionTagBounds = FOUR_CHAR_CODE('boun') kControlCollectionTagValue = FOUR_CHAR_CODE('valu') kControlCollectionTagMinimum = FOUR_CHAR_CODE('min ') @@ -53,7 +53,7 @@ kControlCollectionTagUnicodeTitle = FOUR_CHAR_CODE('uttl') kControlCollectionTagIDSignature = FOUR_CHAR_CODE('idsi') kControlCollectionTagIDID = FOUR_CHAR_CODE('idid') kControlCollectionTagCommand = FOUR_CHAR_CODE('cmd ') -kControlCollectionTagVarCode = FOUR_CHAR_CODE('varc') +kControlCollectionTagVarCode = FOUR_CHAR_CODE('varc') kControlContentTextOnly = 0 kControlNoContent = 0 kControlContentIconSuiteRes = 1 @@ -67,11 +67,11 @@ kControlContentIconRef = 132 kControlContentICON = 133 kControlKeyScriptBehaviorAllowAnyScript = FOUR_CHAR_CODE('any ') kControlKeyScriptBehaviorPrefersRoman = FOUR_CHAR_CODE('prmn') -kControlKeyScriptBehaviorRequiresRoman = FOUR_CHAR_CODE('rrmn') +kControlKeyScriptBehaviorRequiresRoman = FOUR_CHAR_CODE('rrmn') kControlFontBigSystemFont = -1 kControlFontSmallSystemFont = -2 kControlFontSmallBoldSystemFont = -3 -kControlFontViewSystemFont = -4 +kControlFontViewSystemFont = -4 kControlUseFontMask = 0x0001 kControlUseFaceMask = 0x0002 kControlUseSizeMask = 0x0004 @@ -81,12 +81,12 @@ kControlUseModeMask = 0x0020 kControlUseJustMask = 0x0040 kControlUseAllMask = 0x00FF kControlAddFontSizeMask = 0x0100 -kControlAddToMetaFontMask = 0x0200 -kControlUseThemeFontIDMask = 0x0080 +kControlAddToMetaFontMask = 0x0200 +kControlUseThemeFontIDMask = 0x0080 kDoNotActivateAndIgnoreClick = 0 kDoNotActivateAndHandleClick = 1 kActivateAndIgnoreClick = 2 -kActivateAndHandleClick = 3 +kActivateAndHandleClick = 3 kControlFontStyleTag = FOUR_CHAR_CODE('font') kControlKeyFilterTag = FOUR_CHAR_CODE('fltr') kControlKindTag = FOUR_CHAR_CODE('kind') @@ -110,7 +110,7 @@ kControlSupportsFlattening = 1 << 19 kControlSupportsSetCursor = 1 << 20 kControlSupportsContextualMenus = 1 << 21 kControlSupportsClickActivation = 1 << 22 -kControlIdlesWithTimer = 1 << 23 +kControlIdlesWithTimer = 1 << 23 drawCntl = 0 testCntl = 1 calcCRgns = 2 @@ -149,7 +149,7 @@ kControlMsgDragWithin = 40 kControlMsgDragReceive = 41 kControlMsgDisplayDebugInfo = 46 kControlMsgContextualMenuClick = 47 -kControlMsgGetClickActivation = 48 +kControlMsgGetClickActivation = 48 kControlSizeNormal = 0 kControlSizeSmall = 1 kControlSizeLarge = 2 @@ -165,9 +165,9 @@ noConstraint = kNoConstraint hAxisOnly = 1 vAxisOnly = 2 kControlDefProcPtr = 0 -kControlDefObjectClass = 1 +kControlDefObjectClass = 1 kControlKindSignatureApple = FOUR_CHAR_CODE('appl') -kControlPropertyPersistent = 0x00000001 +kControlPropertyPersistent = 0x00000001 kDragTrackingEnterControl = 2 kDragTrackingInControl = 3 kDragTrackingLeaveControl = 4 @@ -178,7 +178,7 @@ kInIndicatorControlPart = kControlIndicatorPart kReservedControlPart = kControlDisabledPart kControlInactiveControlPart = kControlInactivePart kControlTabListResType = FOUR_CHAR_CODE('tab#') -kControlListDescResType = FOUR_CHAR_CODE('ldes') +kControlListDescResType = FOUR_CHAR_CODE('ldes') kControlCheckBoxUncheckedValue = 0 kControlCheckBoxCheckedValue = 1 kControlCheckBoxMixedValue = 2 @@ -228,7 +228,7 @@ kControlClockMinuteMonthPart = 10 kControlClockSecondYearPart = 11 kControlClockAMPMPart = 12 kControlDataBrowserPart = 24 -kControlDataBrowserDraggedPart = 25 +kControlDataBrowserDraggedPart = 25 kControlBevelButtonSmallBevelProc = 32 kControlBevelButtonNormalBevelProc = 33 kControlBevelButtonLargeBevelProc = 34 @@ -245,7 +245,7 @@ kControlBehaviorSticky = 0x0200 kControlBehaviorSingleValueMenu = 0 kControlBehaviorMultiValueMenu = 0x4000 kControlBehaviorOffsetContents = 0x8000 -kControlBehaviorCommandMenu = 0x2000 +kControlBehaviorCommandMenu = 0x2000 kControlBevelButtonMenuOnBottom = 0 kControlBevelButtonMenuOnRight = (1 << 2) kControlKindBevelButton = FOUR_CHAR_CODE('bevl') @@ -279,12 +279,12 @@ kControlBevelButtonTextPlaceTag = FOUR_CHAR_CODE('tplc') kControlBevelButtonMenuValueTag = FOUR_CHAR_CODE('mval') kControlBevelButtonMenuHandleTag = FOUR_CHAR_CODE('mhnd') kControlBevelButtonMenuRefTag = FOUR_CHAR_CODE('mhnd') -# kControlBevelButtonCenterPopupGlyphTag = FOUR_CHAR_CODE('pglc') +# kControlBevelButtonCenterPopupGlyphTag = FOUR_CHAR_CODE('pglc') kControlBevelButtonLastMenuTag = FOUR_CHAR_CODE('lmnu') -kControlBevelButtonMenuDelayTag = FOUR_CHAR_CODE('mdly') -kControlBevelButtonScaleIconTag = FOUR_CHAR_CODE('scal') +kControlBevelButtonMenuDelayTag = FOUR_CHAR_CODE('mdly') +kControlBevelButtonScaleIconTag = FOUR_CHAR_CODE('scal') kControlBevelButtonOwnedMenuRefTag = FOUR_CHAR_CODE('omrf') -kControlBevelButtonKindTag = FOUR_CHAR_CODE('bebk') +kControlBevelButtonKindTag = FOUR_CHAR_CODE('bebk') kControlSliderProc = 48 kControlSliderLiveFeedback = (1 << 0) kControlSliderHasTickMarks = (1 << 1) @@ -302,18 +302,18 @@ kControlDisclosureTrianglePointDefault = 0 kControlDisclosureTrianglePointRight = 1 kControlDisclosureTrianglePointLeft = 2 kControlKindDisclosureTriangle = FOUR_CHAR_CODE('dist') -kControlTriangleLastValueTag = FOUR_CHAR_CODE('last') +kControlTriangleLastValueTag = FOUR_CHAR_CODE('last') kControlProgressBarProc = 80 kControlRelevanceBarProc = 81 kControlKindProgressBar = FOUR_CHAR_CODE('prgb') kControlKindRelevanceBar = FOUR_CHAR_CODE('relb') kControlProgressBarIndeterminateTag = FOUR_CHAR_CODE('inde') -kControlProgressBarAnimatingTag = FOUR_CHAR_CODE('anim') +kControlProgressBarAnimatingTag = FOUR_CHAR_CODE('anim') kControlLittleArrowsProc = 96 kControlKindLittleArrows = FOUR_CHAR_CODE('larr') kControlChasingArrowsProc = 112 kControlKindChasingArrows = FOUR_CHAR_CODE('carr') -kControlChasingArrowsAnimatingTag = FOUR_CHAR_CODE('anim') +kControlChasingArrowsAnimatingTag = FOUR_CHAR_CODE('anim') kControlTabLargeProc = 128 kControlTabSmallProc = 129 kControlTabLargeNorthProc = 128 @@ -323,7 +323,7 @@ kControlTabSmallSouthProc = 131 kControlTabLargeEastProc = 132 kControlTabSmallEastProc = 133 kControlTabLargeWestProc = 134 -kControlTabSmallWestProc = 135 +kControlTabSmallWestProc = 135 kControlTabDirectionNorth = 0 kControlTabDirectionSouth = 1 kControlTabDirectionEast = 2 @@ -333,11 +333,11 @@ kControlTabSizeSmall = kControlSizeSmall kControlKindTabs = FOUR_CHAR_CODE('tabs') kControlTabContentRectTag = FOUR_CHAR_CODE('rect') kControlTabEnabledFlagTag = FOUR_CHAR_CODE('enab') -kControlTabFontStyleTag = kControlFontStyleTag -kControlTabInfoTag = FOUR_CHAR_CODE('tabi') -kControlTabImageContentTag = FOUR_CHAR_CODE('cont') +kControlTabFontStyleTag = kControlFontStyleTag +kControlTabInfoTag = FOUR_CHAR_CODE('tabi') +kControlTabImageContentTag = FOUR_CHAR_CODE('cont') kControlTabInfoVersionZero = 0 -kControlTabInfoVersionOne = 1 +kControlTabInfoVersionOne = 1 kControlSeparatorLineProc = 144 kControlKindSeparator = FOUR_CHAR_CODE('sepa') kControlGroupBoxTextTitleProc = 160 @@ -351,13 +351,13 @@ kControlKindCheckGroupBox = FOUR_CHAR_CODE('cgrp') kControlKindPopupGroupBox = FOUR_CHAR_CODE('pgrp') kControlGroupBoxMenuHandleTag = FOUR_CHAR_CODE('mhan') kControlGroupBoxMenuRefTag = FOUR_CHAR_CODE('mhan') -kControlGroupBoxFontStyleTag = kControlFontStyleTag -kControlGroupBoxTitleRectTag = FOUR_CHAR_CODE('trec') +kControlGroupBoxFontStyleTag = kControlFontStyleTag +kControlGroupBoxTitleRectTag = FOUR_CHAR_CODE('trec') kControlImageWellProc = 176 kControlKindImageWell = FOUR_CHAR_CODE('well') kControlImageWellContentTag = FOUR_CHAR_CODE('cont') kControlImageWellTransformTag = FOUR_CHAR_CODE('tran') -kControlImageWellIsDragDestinationTag = FOUR_CHAR_CODE('drag') +kControlImageWellIsDragDestinationTag = FOUR_CHAR_CODE('drag') kControlPopupArrowEastProc = 192 kControlPopupArrowWestProc = 193 kControlPopupArrowNorthProc = 194 @@ -392,7 +392,7 @@ kControlClockIsLive = 2 kControlKindClock = FOUR_CHAR_CODE('clck') kControlClockLongDateTag = FOUR_CHAR_CODE('date') kControlClockFontStyleTag = kControlFontStyleTag -kControlClockAnimatingTag = FOUR_CHAR_CODE('anim') +kControlClockAnimatingTag = FOUR_CHAR_CODE('anim') kControlUserPaneProc = 256 kControlKindUserPane = FOUR_CHAR_CODE('upan') kControlUserItemDrawProcTag = FOUR_CHAR_CODE('uidp') @@ -403,63 +403,63 @@ kControlUserPaneIdleProcTag = FOUR_CHAR_CODE('idle') kControlUserPaneKeyDownProcTag = FOUR_CHAR_CODE('keyd') kControlUserPaneActivateProcTag = FOUR_CHAR_CODE('acti') kControlUserPaneFocusProcTag = FOUR_CHAR_CODE('foci') -kControlUserPaneBackgroundProcTag = FOUR_CHAR_CODE('back') +kControlUserPaneBackgroundProcTag = FOUR_CHAR_CODE('back') kControlEditTextProc = 272 kControlEditTextPasswordProc = 274 -kControlEditTextInlineInputProc = 276 +kControlEditTextInlineInputProc = 276 kControlKindEditText = FOUR_CHAR_CODE('etxt') kControlEditTextStyleTag = kControlFontStyleTag kControlEditTextTextTag = FOUR_CHAR_CODE('text') kControlEditTextTEHandleTag = FOUR_CHAR_CODE('than') kControlEditTextKeyFilterTag = kControlKeyFilterTag kControlEditTextSelectionTag = FOUR_CHAR_CODE('sele') -kControlEditTextPasswordTag = FOUR_CHAR_CODE('pass') +kControlEditTextPasswordTag = FOUR_CHAR_CODE('pass') kControlEditTextKeyScriptBehaviorTag = FOUR_CHAR_CODE('kscr') kControlEditTextLockedTag = FOUR_CHAR_CODE('lock') kControlEditTextFixedTextTag = FOUR_CHAR_CODE('ftxt') kControlEditTextValidationProcTag = FOUR_CHAR_CODE('vali') kControlEditTextInlinePreUpdateProcTag = FOUR_CHAR_CODE('prup') -kControlEditTextInlinePostUpdateProcTag = FOUR_CHAR_CODE('poup') +kControlEditTextInlinePostUpdateProcTag = FOUR_CHAR_CODE('poup') kControlEditTextCFStringTag = FOUR_CHAR_CODE('cfst') -kControlEditTextPasswordCFStringTag = FOUR_CHAR_CODE('pwcf') +kControlEditTextPasswordCFStringTag = FOUR_CHAR_CODE('pwcf') kControlStaticTextProc = 288 kControlKindStaticText = FOUR_CHAR_CODE('stxt') kControlStaticTextStyleTag = kControlFontStyleTag kControlStaticTextTextTag = FOUR_CHAR_CODE('text') -kControlStaticTextTextHeightTag = FOUR_CHAR_CODE('thei') -kControlStaticTextTruncTag = FOUR_CHAR_CODE('trun') -kControlStaticTextCFStringTag = FOUR_CHAR_CODE('cfst') +kControlStaticTextTextHeightTag = FOUR_CHAR_CODE('thei') +kControlStaticTextTruncTag = FOUR_CHAR_CODE('trun') +kControlStaticTextCFStringTag = FOUR_CHAR_CODE('cfst') kControlPictureProc = 304 -kControlPictureNoTrackProc = 305 +kControlPictureNoTrackProc = 305 kControlKindPicture = FOUR_CHAR_CODE('pict') -kControlPictureHandleTag = FOUR_CHAR_CODE('pich') +kControlPictureHandleTag = FOUR_CHAR_CODE('pich') kControlIconProc = 320 kControlIconNoTrackProc = 321 kControlIconSuiteProc = 322 -kControlIconSuiteNoTrackProc = 323 +kControlIconSuiteNoTrackProc = 323 kControlIconRefProc = 324 -kControlIconRefNoTrackProc = 325 +kControlIconRefNoTrackProc = 325 kControlKindIcon = FOUR_CHAR_CODE('icon') kControlIconTransformTag = FOUR_CHAR_CODE('trfm') -kControlIconAlignmentTag = FOUR_CHAR_CODE('algn') +kControlIconAlignmentTag = FOUR_CHAR_CODE('algn') kControlIconResourceIDTag = FOUR_CHAR_CODE('ires') -kControlIconContentTag = FOUR_CHAR_CODE('cont') +kControlIconContentTag = FOUR_CHAR_CODE('cont') kControlWindowHeaderProc = 336 -kControlWindowListViewHeaderProc = 337 +kControlWindowListViewHeaderProc = 337 kControlKindWindowHeader = FOUR_CHAR_CODE('whed') kControlListBoxProc = 352 kControlListBoxAutoSizeProc = 353 kControlKindListBox = FOUR_CHAR_CODE('lbox') kControlListBoxListHandleTag = FOUR_CHAR_CODE('lhan') kControlListBoxKeyFilterTag = kControlKeyFilterTag -kControlListBoxFontStyleTag = kControlFontStyleTag +kControlListBoxFontStyleTag = kControlFontStyleTag kControlListBoxDoubleClickTag = FOUR_CHAR_CODE('dblc') -kControlListBoxLDEFTag = FOUR_CHAR_CODE('ldef') +kControlListBoxLDEFTag = FOUR_CHAR_CODE('ldef') kControlPushButtonProc = 368 kControlCheckBoxProc = 369 kControlRadioButtonProc = 370 kControlPushButLeftIconProc = 374 -kControlPushButRightIconProc = 375 +kControlPushButRightIconProc = 375 kControlCheckBoxAutoToggleProc = 371 kControlRadioButtonAutoToggleProc = 372 kControlPushButtonIconOnLeft = 6 @@ -469,11 +469,11 @@ kControlKindPushIconButton = FOUR_CHAR_CODE('picn') kControlKindRadioButton = FOUR_CHAR_CODE('rdio') kControlKindCheckBox = FOUR_CHAR_CODE('cbox') kControlPushButtonDefaultTag = FOUR_CHAR_CODE('dflt') -kControlPushButtonCancelTag = FOUR_CHAR_CODE('cncl') +kControlPushButtonCancelTag = FOUR_CHAR_CODE('cncl') kControlScrollBarProc = 384 -kControlScrollBarLiveProc = 386 +kControlScrollBarLiveProc = 386 kControlKindScrollBar = FOUR_CHAR_CODE('sbar') -kControlScrollBarShowsArrowsTag = FOUR_CHAR_CODE('arro') +kControlScrollBarShowsArrowsTag = FOUR_CHAR_CODE('arro') kControlPopupButtonProc = 400 kControlPopupFixedWidthVariant = 1 << 0 kControlPopupVariableWidthVariant = 1 << 1 @@ -482,10 +482,10 @@ kControlPopupUseWFontVariant = kControlUsesOwningWindowsFontVariant kControlKindPopupButton = FOUR_CHAR_CODE('popb') kControlPopupButtonMenuHandleTag = FOUR_CHAR_CODE('mhan') kControlPopupButtonMenuRefTag = FOUR_CHAR_CODE('mhan') -kControlPopupButtonMenuIDTag = FOUR_CHAR_CODE('mnid') +kControlPopupButtonMenuIDTag = FOUR_CHAR_CODE('mnid') kControlPopupButtonExtraHeightTag = FOUR_CHAR_CODE('exht') -kControlPopupButtonOwnedMenuRefTag = FOUR_CHAR_CODE('omrf') -kControlPopupButtonCheckCurrentTag = FOUR_CHAR_CODE('chck') +kControlPopupButtonOwnedMenuRefTag = FOUR_CHAR_CODE('omrf') +kControlPopupButtonCheckCurrentTag = FOUR_CHAR_CODE('chck') kControlRadioGroupProc = 416 kControlKindRadioGroup = FOUR_CHAR_CODE('rgrp') kControlScrollTextBoxProc = 432 @@ -495,14 +495,14 @@ kControlScrollTextBoxDelayBeforeAutoScrollTag = FOUR_CHAR_CODE('stdl') kControlScrollTextBoxDelayBetweenAutoScrollTag = FOUR_CHAR_CODE('scdl') kControlScrollTextBoxAutoScrollAmountTag = FOUR_CHAR_CODE('samt') kControlScrollTextBoxContentsTag = FOUR_CHAR_CODE('tres') -kControlScrollTextBoxAnimatingTag = FOUR_CHAR_CODE('anim') +kControlScrollTextBoxAnimatingTag = FOUR_CHAR_CODE('anim') kControlKindDisclosureButton = FOUR_CHAR_CODE('disb') kControlDisclosureButtonClosed = 0 kControlDisclosureButtonDisclosed = 1 kControlRoundButtonNormalSize = kControlSizeNormal kControlRoundButtonLargeSize = kControlSizeLarge kControlRoundButtonContentTag = FOUR_CHAR_CODE('cont') -kControlRoundButtonSizeTag = kControlSizeTag +kControlRoundButtonSizeTag = kControlSizeTag kControlKindRoundButton = FOUR_CHAR_CODE('rndb') kControlKindDataBrowser = FOUR_CHAR_CODE('datb') errDataBrowserNotConfigured = -4970 @@ -511,7 +511,7 @@ errDataBrowserItemNotAdded = -4975 errDataBrowserPropertyNotFound = -4972 errDataBrowserInvalidPropertyPart = -4973 errDataBrowserInvalidPropertyData = -4974 -errDataBrowserPropertyNotSupported = -4979 +errDataBrowserPropertyNotSupported = -4979 kControlDataBrowserIncludesFrameAndFocusTag = FOUR_CHAR_CODE('brdr') kControlDataBrowserKeyFilterTag = kControlEditTextKeyFilterTag kControlDataBrowserEditTextKeyFilterTag = kControlDataBrowserKeyFilterTag @@ -525,23 +525,23 @@ kDataBrowserResetSelection = 1 << 2 kDataBrowserCmdTogglesSelection = 1 << 3 kDataBrowserNoDisjointSelection = 1 << 4 kDataBrowserAlwaysExtendSelection = 1 << 5 -kDataBrowserNeverEmptySelectionSet = 1 << 6 +kDataBrowserNeverEmptySelectionSet = 1 << 6 kDataBrowserOrderUndefined = 0 kDataBrowserOrderIncreasing = 1 kDataBrowserOrderDecreasing = 2 -kDataBrowserNoItem = 0L +kDataBrowserNoItem = 0L kDataBrowserItemNoState = 0 # kDataBrowserItemAnyState = (unsigned long)(-1) kDataBrowserItemIsSelected = 1 << 0 kDataBrowserContainerIsOpen = 1 << 1 -kDataBrowserItemIsDragTarget = 1 << 2 +kDataBrowserItemIsDragTarget = 1 << 2 kDataBrowserRevealOnly = 0 kDataBrowserRevealAndCenterInView = 1 << 0 kDataBrowserRevealWithoutSelecting = 1 << 1 kDataBrowserItemsAdd = 0 kDataBrowserItemsAssign = 1 kDataBrowserItemsToggle = 2 -kDataBrowserItemsRemove = 3 +kDataBrowserItemsRemove = 3 kDataBrowserSelectionAnchorUp = 0 kDataBrowserSelectionAnchorDown = 1 kDataBrowserSelectionAnchorLeft = 2 @@ -568,7 +568,7 @@ kDataBrowserContainerSorted = 12 kDataBrowserUserToggledContainer = 16 kDataBrowserTargetChanged = 15 kDataBrowserUserStateChanged = 13 -kDataBrowserSelectionSetChanged = 14 +kDataBrowserSelectionSetChanged = 14 kDataBrowserItemNoProperty = 0L kDataBrowserItemIsActiveProperty = 1L kDataBrowserItemIsSelectableProperty = 2L @@ -580,7 +580,7 @@ kDataBrowserContainerIsSortableProperty = 7L kDataBrowserItemSelfIdentityProperty = 8L kDataBrowserContainerAliasIDProperty = 9L kDataBrowserColumnViewPreviewProperty = 10L -kDataBrowserItemParentContainerProperty = 11L +kDataBrowserItemParentContainerProperty = 11L kDataBrowserCustomType = 0x3F3F3F3F kDataBrowserIconType = FOUR_CHAR_CODE('icnr') kDataBrowserTextType = FOUR_CHAR_CODE('text') @@ -590,7 +590,7 @@ kDataBrowserCheckboxType = FOUR_CHAR_CODE('chbx') kDataBrowserProgressBarType = FOUR_CHAR_CODE('prog') kDataBrowserRelevanceRankType = FOUR_CHAR_CODE('rank') kDataBrowserPopupMenuType = FOUR_CHAR_CODE('menu') -kDataBrowserIconAndTextType = FOUR_CHAR_CODE('ticn') +kDataBrowserIconAndTextType = FOUR_CHAR_CODE('ticn') kDataBrowserPropertyEnclosingPart = 0L kDataBrowserPropertyContentPart = FOUR_CHAR_CODE('----') kDataBrowserPropertyDisclosurePart = FOUR_CHAR_CODE('disc') @@ -604,7 +604,7 @@ kDataBrowserUniversalPropertyFlagsMask = 0xFF kDataBrowserPropertyIsMutable = 1 << 0 kDataBrowserDefaultPropertyFlags = 0 << 0 kDataBrowserUniversalPropertyFlags = kDataBrowserUniversalPropertyFlagsMask -kDataBrowserPropertyIsEditable = kDataBrowserPropertyIsMutable +kDataBrowserPropertyIsEditable = kDataBrowserPropertyIsMutable kDataBrowserPropertyFlagsOffset = 8 kDataBrowserPropertyFlagsMask = 0xFF << kDataBrowserPropertyFlagsOffset kDataBrowserCheckboxTriState = 1 << kDataBrowserPropertyFlagsOffset @@ -620,10 +620,10 @@ kDataBrowserTruncateTextAtEnd = 2 << kDataBrowserPropertyFlagsOffset kDataBrowserTruncateTextMiddle = 0 << kDataBrowserPropertyFlagsOffset kDataBrowserTruncateTextAtStart = 1 << kDataBrowserPropertyFlagsOffset kDataBrowserPropertyModificationFlags = kDataBrowserPropertyFlagsMask -kDataBrowserRelativeDateTime = kDataBrowserDateTimeRelative +kDataBrowserRelativeDateTime = kDataBrowserDateTimeRelative kDataBrowserViewSpecificFlagsOffset = 16 kDataBrowserViewSpecificFlagsMask = 0xFF << kDataBrowserViewSpecificFlagsOffset -kDataBrowserViewSpecificPropertyFlags = kDataBrowserViewSpecificFlagsMask +kDataBrowserViewSpecificPropertyFlags = kDataBrowserViewSpecificFlagsMask kDataBrowserClientPropertyFlagsOffset = 24 # kDataBrowserClientPropertyFlagsMask = (unsigned long)(0xFF << kDataBrowserClientPropertyFlagsOffset) kDataBrowserLatestCallbacks = 0 diff --git a/Lib/plat-mac/Carbon/CoreFoundation.py b/Lib/plat-mac/Carbon/CoreFoundation.py index 2907c1d..8d9c894 100644 --- a/Lib/plat-mac/Carbon/CoreFoundation.py +++ b/Lib/plat-mac/Carbon/CoreFoundation.py @@ -16,13 +16,13 @@ kCFStringEncodingNextStepLatin = 0x0B01 kCFStringEncodingASCII = 0x0600 kCFStringEncodingUnicode = 0x0100 kCFStringEncodingUTF8 = 0x08000100 -kCFStringEncodingNonLossyASCII = 0x0BFF +kCFStringEncodingNonLossyASCII = 0x0BFF kCFCompareCaseInsensitive = 1 kCFCompareBackwards = 4 kCFCompareAnchored = 8 kCFCompareNonliteral = 16 kCFCompareLocalized = 32 -kCFCompareNumerically = 64 +kCFCompareNumerically = 64 kCFURLPOSIXPathStyle = 0 kCFURLHFSPathStyle = 1 kCFURLWindowsPathStyle = 2 diff --git a/Lib/plat-mac/Carbon/CoreGraphics.py b/Lib/plat-mac/Carbon/CoreGraphics.py index d7a6f02..f4cb0b9 100755 --- a/Lib/plat-mac/Carbon/CoreGraphics.py +++ b/Lib/plat-mac/Carbon/CoreGraphics.py @@ -25,4 +25,4 @@ kCGEncodingMacRoman = 1 kCGInterpolationDefault = 0 kCGInterpolationNone = 1 kCGInterpolationLow = 2 -kCGInterpolationHigh = 3 +kCGInterpolationHigh = 3 diff --git a/Lib/plat-mac/Carbon/Dialogs.py b/Lib/plat-mac/Carbon/Dialogs.py index 9d2fa8f..f846d7c 100644 --- a/Lib/plat-mac/Carbon/Dialogs.py +++ b/Lib/plat-mac/Carbon/Dialogs.py @@ -45,7 +45,7 @@ kAlertCautionAlert = 2 kAlertPlainAlert = 3 kAlertDefaultOKText = -1 kAlertDefaultCancelText = -1 -kAlertDefaultOtherText = -1 +kAlertDefaultOtherText = -1 kAlertStdAlertOKButton = 1 kAlertStdAlertCancelButton = 2 kAlertStdAlertOtherButton = 3 @@ -71,8 +71,8 @@ kDialogFontAddFontSizeMask = 0x0100 kDialogFontUseFontNameMask = 0x0200 kDialogFontAddToMetaFontMask = 0x0400 kDialogFontUseThemeFontIDMask = 0x0080 -kHICommandOther = FOUR_CHAR_CODE('othr') -kStdCFStringAlertVersionOne = 1 +kHICommandOther = FOUR_CHAR_CODE('othr') +kStdCFStringAlertVersionOne = 1 kStdAlertDoNotDisposeSheet = 1 << 0 kStdAlertDoNotAnimateOnDefault = 1 << 1 kStdAlertDoNotAnimateOnCancel = 1 << 2 diff --git a/Lib/plat-mac/Carbon/Dragconst.py b/Lib/plat-mac/Carbon/Dragconst.py index e5c8b89..38e12be 100644 --- a/Lib/plat-mac/Carbon/Dragconst.py +++ b/Lib/plat-mac/Carbon/Dragconst.py @@ -6,56 +6,56 @@ from Carbon.QuickDraw import * fkDragActionAll = -1 -kDragHasLeftSenderWindow = (1 << 0) +kDragHasLeftSenderWindow = (1 << 0) kDragInsideSenderApplication = (1 << 1) -kDragInsideSenderWindow = (1 << 2) -kDragRegionAndImage = (1 << 4) -flavorSenderOnly = (1 << 0) -flavorSenderTranslated = (1 << 1) -flavorNotSaved = (1 << 2) -flavorSystemTranslated = (1 << 8) +kDragInsideSenderWindow = (1 << 2) +kDragRegionAndImage = (1 << 4) +flavorSenderOnly = (1 << 0) +flavorSenderTranslated = (1 << 1) +flavorNotSaved = (1 << 2) +flavorSystemTranslated = (1 << 8) kDragHasLeftSenderWindow = (1L << 0) kDragInsideSenderApplication = (1L << 1) -kDragInsideSenderWindow = (1L << 2) +kDragInsideSenderWindow = (1L << 2) kDragBehaviorNone = 0 -kDragBehaviorZoomBackAnimation = (1L << 0) -kDragRegionAndImage = (1L << 4) +kDragBehaviorZoomBackAnimation = (1L << 0) +kDragRegionAndImage = (1L << 4) kDragStandardTranslucency = 0L kDragDarkTranslucency = 1L kDragDarkerTranslucency = 2L -kDragOpaqueTranslucency = 3L +kDragOpaqueTranslucency = 3L kDragRegionBegin = 1 kDragRegionDraw = 2 kDragRegionHide = 3 kDragRegionIdle = 4 -kDragRegionEnd = 5 +kDragRegionEnd = 5 kZoomNoAcceleration = 0 kZoomAccelerate = 1 -kZoomDecelerate = 2 +kZoomDecelerate = 2 flavorSenderOnly = (1 << 0) flavorSenderTranslated = (1 << 1) flavorNotSaved = (1 << 2) flavorSystemTranslated = (1 << 8) -flavorDataPromised = (1 << 9) +flavorDataPromised = (1 << 9) kDragFlavorTypeHFS = FOUR_CHAR_CODE('hfs ') kDragFlavorTypePromiseHFS = FOUR_CHAR_CODE('phfs') flavorTypeHFS = kDragFlavorTypeHFS -flavorTypePromiseHFS = kDragFlavorTypePromiseHFS +flavorTypePromiseHFS = kDragFlavorTypePromiseHFS kDragPromisedFlavorFindFile = FOUR_CHAR_CODE('rWm1') -kDragPromisedFlavor = FOUR_CHAR_CODE('fssP') +kDragPromisedFlavor = FOUR_CHAR_CODE('fssP') kDragPseudoCreatorVolumeOrDirectory = FOUR_CHAR_CODE('MACS') kDragPseudoFileTypeVolume = FOUR_CHAR_CODE('disk') -kDragPseudoFileTypeDirectory = FOUR_CHAR_CODE('fold') -flavorTypeDirectory = FOUR_CHAR_CODE('diry') +kDragPseudoFileTypeDirectory = FOUR_CHAR_CODE('fold') +flavorTypeDirectory = FOUR_CHAR_CODE('diry') kFlavorTypeClippingName = FOUR_CHAR_CODE('clnm') kFlavorTypeClippingFilename = FOUR_CHAR_CODE('clfn') kFlavorTypeDragToTrashOnly = FOUR_CHAR_CODE('fdtt') -kFlavorTypeFinderNoTrackingBehavior = FOUR_CHAR_CODE('fntb') +kFlavorTypeFinderNoTrackingBehavior = FOUR_CHAR_CODE('fntb') kDragTrackingEnterHandler = 1 kDragTrackingEnterWindow = 2 kDragTrackingInWindow = 3 kDragTrackingLeaveWindow = 4 -kDragTrackingLeaveHandler = 5 +kDragTrackingLeaveHandler = 5 kDragActionNothing = 0L kDragActionCopy = 1L kDragActionAlias = (1L << 1) @@ -66,21 +66,21 @@ kDragActionDelete = (1L << 5) # kDragActionAll = (long)0xFFFFFFFF dragHasLeftSenderWindow = kDragHasLeftSenderWindow dragInsideSenderApplication = kDragInsideSenderApplication -dragInsideSenderWindow = kDragInsideSenderWindow +dragInsideSenderWindow = kDragInsideSenderWindow dragTrackingEnterHandler = kDragTrackingEnterHandler dragTrackingEnterWindow = kDragTrackingEnterWindow dragTrackingInWindow = kDragTrackingInWindow dragTrackingLeaveWindow = kDragTrackingLeaveWindow -dragTrackingLeaveHandler = kDragTrackingLeaveHandler +dragTrackingLeaveHandler = kDragTrackingLeaveHandler dragRegionBegin = kDragRegionBegin dragRegionDraw = kDragRegionDraw dragRegionHide = kDragRegionHide dragRegionIdle = kDragRegionIdle -dragRegionEnd = kDragRegionEnd +dragRegionEnd = kDragRegionEnd zoomNoAcceleration = kZoomNoAcceleration zoomAccelerate = kZoomAccelerate -zoomDecelerate = kZoomDecelerate +zoomDecelerate = kZoomDecelerate kDragStandardImage = kDragStandardTranslucency kDragDarkImage = kDragDarkTranslucency kDragDarkerImage = kDragDarkerTranslucency -kDragOpaqueImage = kDragOpaqueTranslucency +kDragOpaqueImage = kDragOpaqueTranslucency diff --git a/Lib/plat-mac/Carbon/Events.py b/Lib/plat-mac/Carbon/Events.py index 4853469..269f4f1 100644 --- a/Lib/plat-mac/Carbon/Events.py +++ b/Lib/plat-mac/Carbon/Events.py @@ -21,15 +21,15 @@ diskMask = 1 << diskEvt activMask = 1 << activateEvt highLevelEventMask = 0x0400 osMask = 1 << osEvt -everyEvent = 0xFFFF +everyEvent = 0xFFFF charCodeMask = 0x000000FF keyCodeMask = 0x0000FF00 adbAddrMask = 0x00FF0000 # osEvtMessageMask = (unsigned long)0xFF000000 mouseMovedMessage = 0x00FA suspendResumeMessage = 0x0001 -resumeFlag = 1 -convertClipboardFlag = 2 +resumeFlag = 1 +convertClipboardFlag = 2 activeFlagBit = 0 btnStateBit = 7 cmdKeyBit = 8 @@ -39,7 +39,7 @@ optionKeyBit = 11 controlKeyBit = 12 rightShiftKeyBit = 13 rightOptionKeyBit = 14 -rightControlKeyBit = 15 +rightControlKeyBit = 15 activeFlag = 1 << activeFlagBit btnState = 1 << btnStateBit cmdKey = 1 << cmdKeyBit @@ -87,7 +87,7 @@ kPencilUnicode = 0x270E kCheckUnicode = 0x2713 kDiamondUnicode = 0x25C6 kBulletUnicode = 0x2022 -kAppleLogoUnicode = 0xF8FF +kAppleLogoUnicode = 0xF8FF networkEvt = 10 driverEvt = 11 app1Evt = 12 diff --git a/Lib/plat-mac/Carbon/Files.py b/Lib/plat-mac/Carbon/Files.py index 54fe4b8..678bbc7 100644 --- a/Lib/plat-mac/Carbon/Files.py +++ b/Lib/plat-mac/Carbon/Files.py @@ -9,7 +9,7 @@ fsWrPerm = 0x02 fsRdWrPerm = 0x03 fsRdWrShPerm = 0x04 fsRdDenyPerm = 0x10 -fsWrDenyPerm = 0x20 +fsWrDenyPerm = 0x20 fsRtParID = 1 fsRtDirID = 2 fsAtMark = 0 @@ -27,7 +27,7 @@ forceReadBit = 6 forceReadMask = 0x0040 newLineBit = 7 newLineMask = 0x0080 -newLineCharMask = 0xFF00 +newLineCharMask = 0xFF00 fsSBPartialName = 1 fsSBFullName = 2 fsSBFlAttrib = 4 @@ -69,7 +69,7 @@ fsSBDrCrDatBit = 9 fsSBDrMdDatBit = 10 fsSBDrBkDatBit = 11 fsSBDrFndrInfoBit = 12 -fsSBDrParIDBit = 13 +fsSBDrParIDBit = 13 bLimitFCBs = 31 bLocalWList = 30 bNoMiniFndr = 29 @@ -106,19 +106,19 @@ bSupportsLongNames = 5 bSupportsMultiScriptNames = 6 bSupportsNamedForks = 7 bSupportsSubtreeIterators = 8 -bL2PCanMapFileBlocks = 9 +bL2PCanMapFileBlocks = 9 bParentModDateChanges = 10 -bAncestorModDateChanges = 11 +bAncestorModDateChanges = 11 bSupportsSymbolicLinks = 13 bIsAutoMounted = 14 -bAllowCDiDataHandler = 17 +bAllowCDiDataHandler = 17 kLargeIcon = 1 kLarge4BitIcon = 2 kLarge8BitIcon = 3 kSmallIcon = 4 kSmall4BitIcon = 5 kSmall8BitIcon = 6 -kicnsIconFamily = 239 +kicnsIconFamily = 239 kLargeIconSize = 256 kLarge4BitIconSize = 512 kLarge8BitIconSize = 1024 @@ -229,7 +229,7 @@ kioACAccessOwnerReadMask = 0x00000002 kioACAccessOwnerSearchBit = 0 kioACAccessOwnerSearchMask = 0x00000001 kfullPrivileges = 0x00070007 -kownerPrivileges = 0x00000007 +kownerPrivileges = 0x00000007 knoUser = 0 kadministratorUser = 1 knoGroup = 0 @@ -243,12 +243,12 @@ volMountInteractMask = 0x8000 volMountChangedBit = 14 volMountChangedMask = 0x4000 volMountFSReservedMask = 0x00FF -volMountSysReservedMask = 0xFF00 -kAFPExtendedFlagsAlternateAddressMask = 1 +volMountSysReservedMask = 0xFF00 +kAFPExtendedFlagsAlternateAddressMask = 1 kAFPTagTypeIP = 0x01 kAFPTagTypeIPPort = 0x02 kAFPTagTypeDDP = 0x03 -kAFPTagTypeDNS = 0x04 +kAFPTagTypeDNS = 0x04 kAFPTagLengthIP = 0x06 kAFPTagLengthIPPort = 0x08 kAFPTagLengthDDP = 0x06 @@ -276,7 +276,7 @@ kFSCatInfoUserAccess = 0x00080000 kFSCatInfoAllDates = 0x000003E0 kFSCatInfoGettableInfo = 0x0003FFFF kFSCatInfoSettableInfo = 0x00001FE3 -# kFSCatInfoReserved = (long)0xFFFC0000 +# kFSCatInfoReserved = (long)0xFFFC0000 kFSNodeLockedBit = 0 kFSNodeLockedMask = 0x0001 kFSNodeResOpenBit = 2 @@ -311,7 +311,7 @@ kFSAllocDefaultFlags = 0x0000 kFSAllocAllOrNothingMask = 0x0001 kFSAllocContiguousMask = 0x0002 kFSAllocNoRoundUpMask = 0x0004 -kFSAllocReservedMask = 0xFFF8 +kFSAllocReservedMask = 0xFFF8 kFSVolInfoNone = 0x0000 kFSVolInfoCreateDate = 0x0001 kFSVolInfoModDate = 0x0002 @@ -330,7 +330,7 @@ kFSVolInfoFlags = 0x2000 kFSVolInfoFSInfo = 0x4000 kFSVolInfoDriveInfo = 0x8000 kFSVolInfoGettableInfo = 0xFFFF -kFSVolInfoSettableInfo = 0x3004 +kFSVolInfoSettableInfo = 0x3004 kFSVolFlagDefaultVolumeBit = 5 kFSVolFlagDefaultVolumeMask = 0x0020 kFSVolFlagFilesOpenBit = 6 @@ -341,19 +341,19 @@ kFSVolFlagSoftwareLockedBit = 15 kFSVolFlagSoftwareLockedMask = 0x8000 kFNDirectoryModifiedMessage = 1 kFNNoImplicitAllSubscription = (1 << 0) -rAliasType = FOUR_CHAR_CODE('alis') +rAliasType = FOUR_CHAR_CODE('alis') kARMMountVol = 0x00000001 kARMNoUI = 0x00000002 kARMMultVols = 0x00000008 kARMSearch = 0x00000100 kARMSearchMore = 0x00000200 -kARMSearchRelFirst = 0x00000400 +kARMSearchRelFirst = 0x00000400 asiZoneName = -3 asiServerName = -2 asiVolumeName = -1 asiAliasName = 0 -asiParentName = 1 -kResolveAliasFileNoUI = 0x00000001 +asiParentName = 1 +kResolveAliasFileNoUI = 0x00000001 kClippingCreator = FOUR_CHAR_CODE('drag') kClippingPictureType = FOUR_CHAR_CODE('clpp') kClippingTextType = FOUR_CHAR_CODE('clpt') @@ -369,7 +369,7 @@ kInternetLocationAFP = FOUR_CHAR_CODE('ilaf') kInternetLocationAppleTalk = FOUR_CHAR_CODE('ilat') kInternetLocationNSL = FOUR_CHAR_CODE('ilns') kInternetLocationGeneric = FOUR_CHAR_CODE('ilge') -kCustomIconResource = -16455 +kCustomIconResource = -16455 kCustomBadgeResourceType = FOUR_CHAR_CODE('badg') kCustomBadgeResourceID = kCustomIconResource kCustomBadgeResourceVersion = 0 @@ -388,7 +388,7 @@ kContainerCDROMAliasType = FOUR_CHAR_CODE('cddr') kApplicationCPAliasType = FOUR_CHAR_CODE('acdp') kApplicationDAAliasType = FOUR_CHAR_CODE('addp') kPackageAliasType = FOUR_CHAR_CODE('fpka') -kAppPackageAliasType = FOUR_CHAR_CODE('fapa') +kAppPackageAliasType = FOUR_CHAR_CODE('fapa') kSystemFolderAliasType = FOUR_CHAR_CODE('fasy') kAppleMenuFolderAliasType = FOUR_CHAR_CODE('faam') kStartupFolderAliasType = FOUR_CHAR_CODE('fast') @@ -410,7 +410,7 @@ kIsStationery = 0x0800 kNameLocked = 0x1000 kHasBundle = 0x2000 kIsInvisible = 0x4000 -kIsAlias = 0x8000 +kIsAlias = 0x8000 fOnDesk = kIsOnDesk fHasBundle = kHasBundle fInvisible = kIsInvisible @@ -420,7 +420,7 @@ fDisk = 0 kIsStationary = kIsStationery kExtendedFlagsAreInvalid = 0x8000 kExtendedFlagHasCustomBadge = 0x0100 -kExtendedFlagHasRoutingInfo = 0x0004 +kExtendedFlagHasRoutingInfo = 0x0004 kFirstMagicBusyFiletype = FOUR_CHAR_CODE('bzy ') kLastMagicBusyFiletype = FOUR_CHAR_CODE('bzy?') kMagicBusyCreationDate = 0x4F3AFDB0 diff --git a/Lib/plat-mac/Carbon/Folders.py b/Lib/plat-mac/Carbon/Folders.py index f22b2ba..52cf158 100644 --- a/Lib/plat-mac/Carbon/Folders.py +++ b/Lib/plat-mac/Carbon/Folders.py @@ -9,7 +9,7 @@ kSystemDomain = -32766 kLocalDomain = -32765 kNetworkDomain = -32764 kUserDomain = -32763 -kClassicDomain = -32762 +kClassicDomain = -32762 kCreateFolder = true kDontCreateFolder = false kSystemFolderType = FOUR_CHAR_CODE('macs') @@ -28,7 +28,7 @@ kExtensionFolderType = FOUR_CHAR_CODE('extn') kFontsFolderType = FOUR_CHAR_CODE('font') kPreferencesFolderType = FOUR_CHAR_CODE('pref') kSystemPreferencesFolderType = FOUR_CHAR_CODE('sprf') -kTemporaryFolderType = FOUR_CHAR_CODE('temp') +kTemporaryFolderType = FOUR_CHAR_CODE('temp') kExtensionDisabledFolderType = FOUR_CHAR_CODE('extD') kControlPanelDisabledFolderType = FOUR_CHAR_CODE('ctrD') kSystemExtensionDisabledFolderType = FOUR_CHAR_CODE('macD') @@ -86,7 +86,7 @@ kKeychainFolderType = FOUR_CHAR_CODE('kchn') kQuickTimeExtensionsFolderType = FOUR_CHAR_CODE('qtex') kDisplayExtensionsFolderType = FOUR_CHAR_CODE('dspl') kMultiprocessingFolderType = FOUR_CHAR_CODE('mpxf') -kPrintingPlugInsFolderType = FOUR_CHAR_CODE('pplg') +kPrintingPlugInsFolderType = FOUR_CHAR_CODE('pplg') kDomainTopLevelFolderType = FOUR_CHAR_CODE('dtop') kDomainLibraryFolderType = FOUR_CHAR_CODE('dlib') kColorSyncFolderType = FOUR_CHAR_CODE('sync') @@ -127,15 +127,15 @@ kInstallerReceiptsFolderType = FOUR_CHAR_CODE('rcpt') kFileSystemSupportFolderType = FOUR_CHAR_CODE('fsys') kAppleShareSupportFolderType = FOUR_CHAR_CODE('shar') kAppleShareAuthenticationFolderType = FOUR_CHAR_CODE('auth') -kMIDIDriversFolderType = FOUR_CHAR_CODE('midi') +kMIDIDriversFolderType = FOUR_CHAR_CODE('midi') kLocalesFolderType = FOUR_CHAR_CODE('\xc4loc') -kFindByContentPluginsFolderType = FOUR_CHAR_CODE('fbcp') +kFindByContentPluginsFolderType = FOUR_CHAR_CODE('fbcp') kUsersFolderType = FOUR_CHAR_CODE('usrs') kCurrentUserFolderType = FOUR_CHAR_CODE('cusr') kCurrentUserRemoteFolderLocation = FOUR_CHAR_CODE('rusf') kCurrentUserRemoteFolderType = FOUR_CHAR_CODE('rusr') kSharedUserDataFolderType = FOUR_CHAR_CODE('sdat') -kVolumeSettingsFolderType = FOUR_CHAR_CODE('vsfd') +kVolumeSettingsFolderType = FOUR_CHAR_CODE('vsfd') kAppleshareAutomountServerAliasesFolderType = FOUR_CHAR_CODE('srv\xc4') kPreMacOS91ApplicationsFolderType = FOUR_CHAR_CODE('\x8cpps') kPreMacOS91InstallerLogsFolderType = FOUR_CHAR_CODE('\x94lgf') @@ -145,7 +145,7 @@ kPreMacOS91AppleExtrasFolderType = FOUR_CHAR_CODE('\x8cex\xc4') kPreMacOS91MacOSReadMesFolderType = FOUR_CHAR_CODE('\xb5or\xc4') kPreMacOS91InternetFolderType = FOUR_CHAR_CODE('\x94nt\xc4') kPreMacOS91AutomountedServersFolderType = FOUR_CHAR_CODE('\xa7rv\xc4') -kPreMacOS91StationeryFolderType = FOUR_CHAR_CODE('\xbfdst') +kPreMacOS91StationeryFolderType = FOUR_CHAR_CODE('\xbfdst') kCreateFolderAtBoot = 0x00000002 kCreateFolderAtBootBit = 1 kFolderCreatedInvisible = 0x00000004 @@ -171,7 +171,7 @@ kRelativeFolder = FOUR_CHAR_CODE('relf') kSpecialFolder = FOUR_CHAR_CODE('spcf') kBlessedFolder = FOUR_CHAR_CODE('blsf') kRootFolder = FOUR_CHAR_CODE('rotf') -kCurrentUserFolderLocation = FOUR_CHAR_CODE('cusf') +kCurrentUserFolderLocation = FOUR_CHAR_CODE('cusf') kFindFolderRedirectionFlagUseDistinctUserFoldersBit = 0 kFindFolderRedirectionFlagUseGivenVRefAndDirIDAsUserFolderBit = 1 kFindFolderRedirectionFlagsUseGivenVRefNumAndDirIDAsRemoteUserFolderBit = 2 @@ -184,7 +184,7 @@ kFolderManagerNotificationMessagePreUserLogIn = FOUR_CHAR_CODE('logj') kFolderManagerNotificationMessageUserLogOut = FOUR_CHAR_CODE('log-') kFolderManagerNotificationMessagePostUserLogOut = FOUR_CHAR_CODE('logp') kFolderManagerNotificationDiscardCachedData = FOUR_CHAR_CODE('dche') -kFolderManagerNotificationMessageLoginStartup = FOUR_CHAR_CODE('stup') +kFolderManagerNotificationMessageLoginStartup = FOUR_CHAR_CODE('stup') kDoNotRemoveWhenCurrentApplicationQuitsBit = 0 -kDoNotRemoveWheCurrentApplicationQuitsBit = kDoNotRemoveWhenCurrentApplicationQuitsBit +kDoNotRemoveWheCurrentApplicationQuitsBit = kDoNotRemoveWhenCurrentApplicationQuitsBit kStopIfAnyNotificationProcReturnsErrorBit = 31 diff --git a/Lib/plat-mac/Carbon/Icons.py b/Lib/plat-mac/Carbon/Icons.py index 1ed8d50..86dae63 100644 --- a/Lib/plat-mac/Carbon/Icons.py +++ b/Lib/plat-mac/Carbon/Icons.py @@ -254,7 +254,7 @@ kTrueTypeFontIcon = FOUR_CHAR_CODE('tfil') kTrueTypeFlatFontIcon = FOUR_CHAR_CODE('sfnt') kTrueTypeMultiFlatFontIcon = FOUR_CHAR_CODE('ttcf') kUserIDiskIcon = FOUR_CHAR_CODE('udsk') -kInternationResourcesIcon = kInternationalResourcesIcon +kInternationResourcesIcon = kInternationalResourcesIcon kInternetLocationHTTPIcon = FOUR_CHAR_CODE('ilht') kInternetLocationFTPIcon = FOUR_CHAR_CODE('ilft') kInternetLocationAppleShareIcon = FOUR_CHAR_CODE('ilaf') diff --git a/Lib/plat-mac/Carbon/LaunchServices.py b/Lib/plat-mac/Carbon/LaunchServices.py index 22bb421..daff446 100644 --- a/Lib/plat-mac/Carbon/LaunchServices.py +++ b/Lib/plat-mac/Carbon/LaunchServices.py @@ -20,10 +20,10 @@ kLSNotRegisteredErr = -10819 kLSAppDoesNotClaimTypeErr = -10820 kLSAppDoesNotSupportSchemeWarning = -10821 kLSServerCommunicationErr = -10822 -kLSCannotSetInfoErr = -10823 +kLSCannotSetInfoErr = -10823 kLSInitializeDefaults = 0x00000001 -kLSMinCatInfoBitmap = (kFSCatInfoNodeFlags | kFSCatInfoParentDirID | kFSCatInfoFinderInfo | kFSCatInfoFinderXInfo) -# kLSInvalidExtensionIndex = (unsigned long)0xFFFFFFFF +kLSMinCatInfoBitmap = (kFSCatInfoNodeFlags | kFSCatInfoParentDirID | kFSCatInfoFinderInfo | kFSCatInfoFinderXInfo) +# kLSInvalidExtensionIndex = (unsigned long)0xFFFFFFFF kLSRequestExtension = 0x00000001 kLSRequestTypeCreator = 0x00000002 kLSRequestBasicFlagsOnly = 0x00000004 @@ -31,7 +31,7 @@ kLSRequestAppTypeFlags = 0x00000008 kLSRequestAllFlags = 0x00000010 kLSRequestIconAndKind = 0x00000020 kLSRequestExtensionFlagsOnly = 0x00000040 -# kLSRequestAllInfo = (unsigned long)0xFFFFFFFF +# kLSRequestAllInfo = (unsigned long)0xFFFFFFFF kLSItemInfoIsPlainFile = 0x00000001 kLSItemInfoIsPackage = 0x00000002 kLSItemInfoIsApplication = 0x00000004 @@ -45,16 +45,16 @@ kLSItemInfoAppPrefersNative = 0x00000200 kLSItemInfoAppPrefersClassic = 0x00000400 kLSItemInfoAppIsScriptable = 0x00000800 kLSItemInfoIsVolume = 0x00001000 -kLSItemInfoExtensionIsHidden = 0x00100000 +kLSItemInfoExtensionIsHidden = 0x00100000 kLSRolesNone = 0x00000001 kLSRolesViewer = 0x00000002 kLSRolesEditor = 0x00000004 -# kLSRolesAll = (unsigned long)0xFFFFFFFF +# kLSRolesAll = (unsigned long)0xFFFFFFFF kLSUnknownKindID = 0 # kLSUnknownType = 0 # kLSUnknownCreator = 0 kLSAcceptDefault = 0x00000001 -kLSAcceptAllowLoginUI = 0x00000002 +kLSAcceptAllowLoginUI = 0x00000002 kLSLaunchDefaults = 0x00000001 kLSLaunchAndPrint = 0x00000002 kLSLaunchReserved2 = 0x00000004 @@ -71,4 +71,4 @@ kLSLaunchStartClassic = 0x00020000 kLSLaunchInClassic = 0x00040000 kLSLaunchNewInstance = 0x00080000 kLSLaunchAndHide = 0x00100000 -kLSLaunchAndHideOthers = 0x00200000 +kLSLaunchAndHideOthers = 0x00200000 diff --git a/Lib/plat-mac/Carbon/Lists.py b/Lib/plat-mac/Carbon/Lists.py index 76518ba..723294c 100644 --- a/Lib/plat-mac/Carbon/Lists.py +++ b/Lib/plat-mac/Carbon/Lists.py @@ -4,7 +4,7 @@ def FOUR_CHAR_CODE(x): return x listNotifyNothing = FOUR_CHAR_CODE('nada') listNotifyClick = FOUR_CHAR_CODE('clik') listNotifyDoubleClick = FOUR_CHAR_CODE('dblc') -listNotifyPreClick = FOUR_CHAR_CODE('pclk') +listNotifyPreClick = FOUR_CHAR_CODE('pclk') lDrawingModeOffBit = 3 lDoVAutoscrollBit = 1 lDoHAutoscrollBit = 0 diff --git a/Lib/plat-mac/Carbon/MacHelp.py b/Lib/plat-mac/Carbon/MacHelp.py index a231a8d..06b9912 100644 --- a/Lib/plat-mac/Carbon/MacHelp.py +++ b/Lib/plat-mac/Carbon/MacHelp.py @@ -51,8 +51,8 @@ kHMContentProvided = 0 kHMContentNotProvided = 1 kHMContentNotProvidedDontPropagate = 2 kHMMinimumContentIndex = 0 -kHMMaximumContentIndex = 1 +kHMMaximumContentIndex = 1 errHMIllegalContentForMinimumState = -10980 -errHMIllegalContentForMaximumState = -10981 +errHMIllegalContentForMaximumState = -10981 kHMIllegalContentForMinimumState = errHMIllegalContentForMinimumState kHelpTagEventHandlerTag = FOUR_CHAR_CODE('hevt') diff --git a/Lib/plat-mac/Carbon/MacTextEditor.py b/Lib/plat-mac/Carbon/MacTextEditor.py index fcc6fd2..4609d8d 100644 --- a/Lib/plat-mac/Carbon/MacTextEditor.py +++ b/Lib/plat-mac/Carbon/MacTextEditor.py @@ -145,7 +145,7 @@ kTXNDropAction = 11 kTXNMoveAction = 12 kTXNFontFeatureAction = 13 kTXNFontVariationAction = 14 -kTXNUndoLastAction = 1024 +kTXNUndoLastAction = 1024 # kTXNClearThisControl = (long)0xFFFFFFFF # kTXNClearTheseFontFeatures = (long)0x80000000 kTXNReadWrite = false @@ -176,7 +176,7 @@ kTXNFlushLeft = 1 kTXNFlushRight = 2 kTXNCenter = 4 kTXNFullJust = 8 -kTXNForceFullJust = 16 +kTXNForceFullJust = 16 kScrollBarsAlwaysActive = true kScrollBarsSyncWithFocus = false # kTXNDontCareTypeSize = (long)0xFFFFFFFF @@ -192,7 +192,7 @@ kTXNSingleStylePerTextDocumentResType = FOUR_CHAR_CODE('MPSR') kTXNMultipleStylesPerTextDocumentResType = FOUR_CHAR_CODE('styl') kTXNShowStart = false kTXNShowEnd = true -kTXNDefaultFontName = 0 +kTXNDefaultFontName = 0 kTXNDefaultFontSize = 0x000C0000 kTXNDefaultFontStyle = normal kTXNQDFontNameAttribute = FOUR_CHAR_CODE('fntn') diff --git a/Lib/plat-mac/Carbon/MediaDescr.py b/Lib/plat-mac/Carbon/MediaDescr.py index acacfb1..254634b 100644 --- a/Lib/plat-mac/Carbon/MediaDescr.py +++ b/Lib/plat-mac/Carbon/MediaDescr.py @@ -4,58 +4,58 @@ import struct Error = 'MediaDescr.Error' class _MediaDescriptionCodec: - def __init__(self, trunc, size, names, fmt): - self.trunc = trunc - self.size = size - self.names = names - self.fmt = fmt + def __init__(self, trunc, size, names, fmt): + self.trunc = trunc + self.size = size + self.names = names + self.fmt = fmt - def decode(self, data): - if self.trunc: - data = data[:self.size] - values = struct.unpack(self.fmt, data) - if len(values) != len(self.names): - raise Error, ('Format length does not match number of names', descr) - rv = {} - for i in range(len(values)): - name = self.names[i] - value = values[i] - if type(name) == type(()): - name, cod, dec = name - value = dec(value) - rv[name] = value - return rv + def decode(self, data): + if self.trunc: + data = data[:self.size] + values = struct.unpack(self.fmt, data) + if len(values) != len(self.names): + raise Error, ('Format length does not match number of names', descr) + rv = {} + for i in range(len(values)): + name = self.names[i] + value = values[i] + if type(name) == type(()): + name, cod, dec = name + value = dec(value) + rv[name] = value + return rv - def encode(dict): - list = [self.fmt] - for name in self.names: - if type(name) == type(()): - name, cod, dec = name - else: - cod = dec = None - value = dict[name] - if cod: - value = cod(value) - list.append(value) - rv = struct.pack(*list) - return rv + def encode(dict): + list = [self.fmt] + for name in self.names: + if type(name) == type(()): + name, cod, dec = name + else: + cod = dec = None + value = dict[name] + if cod: + value = cod(value) + list.append(value) + rv = struct.pack(*list) + return rv # Helper functions def _tofixed(float): - hi = int(float) - lo = int(float*0x10000) & 0xffff - return (hi<<16)|lo + hi = int(float) + lo = int(float*0x10000) & 0xffff + return (hi<<16)|lo def _fromfixed(fixed): - hi = (fixed >> 16) & 0xffff - lo = (fixed & 0xffff) - return hi + (lo / float(0x10000)) + hi = (fixed >> 16) & 0xffff + lo = (fixed & 0xffff) + return hi + (lo / float(0x10000)) def _tostr31(str): - return chr(len(str)) + str + '\0'*(31-len(str)) + return chr(len(str)) + str + '\0'*(31-len(str)) def _fromstr31(str31): - return str31[1:1+ord(str31[0])] + return str31[1:1+ord(str31[0])] SampleDescription = _MediaDescriptionCodec( 1, # May be longer, truncate diff --git a/Lib/plat-mac/Carbon/Menus.py b/Lib/plat-mac/Carbon/Menus.py index abdde79..01affb0 100644 --- a/Lib/plat-mac/Carbon/Menus.py +++ b/Lib/plat-mac/Carbon/Menus.py @@ -1,7 +1,7 @@ # Generated from 'Menus.h' def FOUR_CHAR_CODE(x): return x -noMark = 0 +noMark = 0 kMenuDrawMsg = 0 kMenuSizeMsg = 2 kMenuPopUpMsg = 3 @@ -15,7 +15,7 @@ mChooseMsg = 1 mDrawItemMsg = 4 kMenuChooseMsg = 1 kMenuDrawItemMsg = 4 -kThemeSavvyMenuResponse = 0x7473 +kThemeSavvyMenuResponse = 0x7473 kMenuInitMsg = 8 kMenuDisposeMsg = 9 kMenuFindItemMsg = 10 @@ -26,14 +26,14 @@ hMenuCmd = 27 hierMenu = -1 kInsertHierarchicalMenu = -1 mctAllItems = -98 -mctLastIDIndic = -99 +mctLastIDIndic = -99 kMenuStdMenuProc = 63 kMenuStdMenuBarProc = 63 kMenuNoModifiers = 0 kMenuShiftModifier = (1 << 0) kMenuOptionModifier = (1 << 1) kMenuControlModifier = (1 << 2) -kMenuNoCommandModifier = (1 << 3) +kMenuNoCommandModifier = (1 << 3) kMenuNoIcon = 0 kMenuIconType = 1 kMenuShrinkIconType = 2 @@ -43,7 +43,7 @@ kMenuIconSuiteType = 5 kMenuIconRefType = 6 kMenuCGImageRefType = 7 kMenuSystemIconSelectorType = 8 -kMenuIconResourceType = 9 +kMenuIconResourceType = 9 kMenuNullGlyph = 0x00 kMenuTabRightGlyph = 0x02 kMenuTabLeftGlyph = 0x03 @@ -101,7 +101,7 @@ kMenuF12Glyph = 0x7A kMenuF13Glyph = 0x87 kMenuF14Glyph = 0x88 kMenuF15Glyph = 0x89 -kMenuControlISOGlyph = 0x8A +kMenuControlISOGlyph = 0x8A kMenuAttrExcludesMarkColumn = (1 << 0) kMenuAttrAutoDisable = (1 << 2) kMenuAttrUsePencilGlyph = (1 << 3) @@ -147,14 +147,14 @@ kMenuItemDataIndent = (1 << 19) kMenuItemDataCmdVirtualKey = (1 << 20) kMenuItemDataAllDataVersionOne = 0x000FFFFF kMenuItemDataAllDataVersionTwo = kMenuItemDataAllDataVersionOne | kMenuItemDataCmdVirtualKey -kMenuDefProcPtr = 0 -kMenuPropertyPersistent = 0x00000001 +kMenuDefProcPtr = 0 +kMenuPropertyPersistent = 0x00000001 kHierarchicalFontMenuOption = 0x00000001 gestaltContextualMenuAttr = FOUR_CHAR_CODE('cmnu') gestaltContextualMenuUnusedBit = 0 gestaltContextualMenuTrapAvailable = 1 gestaltContextualMenuHasAttributeAndModifierKeys = 2 -gestaltContextualMenuHasUnicodeSupport = 3 +gestaltContextualMenuHasUnicodeSupport = 3 kCMHelpItemNoHelp = 0 kCMHelpItemAppleGuide = 1 kCMHelpItemOtherHelp = 2 diff --git a/Lib/plat-mac/Carbon/OSAconst.py b/Lib/plat-mac/Carbon/OSAconst.py index ccce00a..3b64c24 100644 --- a/Lib/plat-mac/Carbon/OSAconst.py +++ b/Lib/plat-mac/Carbon/OSAconst.py @@ -18,10 +18,10 @@ typeOSADialectInfo = FOUR_CHAR_CODE('difo') keyOSADialectName = FOUR_CHAR_CODE('dnam') keyOSADialectCode = FOUR_CHAR_CODE('dcod') keyOSADialectLangCode = FOUR_CHAR_CODE('dlcd') -keyOSADialectScriptCode = FOUR_CHAR_CODE('dscd') +keyOSADialectScriptCode = FOUR_CHAR_CODE('dscd') kOSANullScript = 0L kOSANullMode = 0 -kOSAModeNull = 0 +kOSAModeNull = 0 kOSASupportsCompiling = 0x0002 kOSASupportsGetSource = 0x0004 kOSASupportsAECoercion = 0x0008 @@ -130,4 +130,4 @@ keyProcedureName = FOUR_CHAR_CODE('dfnm') keyStatementRange = FOUR_CHAR_CODE('dfsr') keyLocalsNames = FOUR_CHAR_CODE('dfln') keyGlobalsNames = FOUR_CHAR_CODE('dfgn') -keyParamsNames = FOUR_CHAR_CODE('dfpn') +keyParamsNames = FOUR_CHAR_CODE('dfpn') diff --git a/Lib/plat-mac/Carbon/Qt.py b/Lib/plat-mac/Carbon/Qt.py index 23d44d2..590a92a 100644 --- a/Lib/plat-mac/Carbon/Qt.py +++ b/Lib/plat-mac/Carbon/Qt.py @@ -3,4 +3,3 @@ try: _ = AddFilePreview except: raise ImportError, "Old (2.3) _Qt.so module loaded in stead of new (2.4) _Qt.so" -
\ No newline at end of file diff --git a/Lib/plat-mac/Carbon/QuickDraw.py b/Lib/plat-mac/Carbon/QuickDraw.py index 9209a35..65c2f9a 100644 --- a/Lib/plat-mac/Carbon/QuickDraw.py +++ b/Lib/plat-mac/Carbon/QuickDraw.py @@ -2,15 +2,15 @@ def FOUR_CHAR_CODE(x): return x -normal = 0 -bold = 1 -italic = 2 -underline = 4 -outline = 8 -shadow = 0x10 -condense = 0x20 -extend = 0x40 -invalColReq = -1 +normal = 0 +bold = 1 +italic = 2 +underline = 4 +outline = 8 +shadow = 0x10 +condense = 0x20 +extend = 0x40 +invalColReq = -1 srcCopy = 0 srcOr = 1 srcXor = 2 @@ -68,7 +68,7 @@ picRParen = 1 clutType = 0 fixedType = 1 directType = 2 -gdDevType = 0 +gdDevType = 0 interlacedDevice = 2 hwMirroredDevice = 4 roundedDevice = 5 @@ -85,7 +85,7 @@ hiliteBit = 7 pHiliteBit = 0 defQDColors = 127 RGBDirect = 16 -baseAddr32 = 4 +baseAddr32 = 4 sysPatListID = 0 iBeamCursor = 1 crossCursor = 2 @@ -125,7 +125,7 @@ k32ARGBPixelFormat = 0x00000020 k1IndexedGrayPixelFormat = 0x00000021 k2IndexedGrayPixelFormat = 0x00000022 k4IndexedGrayPixelFormat = 0x00000024 -k8IndexedGrayPixelFormat = 0x00000028 +k8IndexedGrayPixelFormat = 0x00000028 k16LE555PixelFormat = FOUR_CHAR_CODE('L555') k16LE5551PixelFormat = FOUR_CHAR_CODE('5551') k16BE565PixelFormat = FOUR_CHAR_CODE('B565') @@ -141,7 +141,7 @@ kYUV411PixelFormat = FOUR_CHAR_CODE('Y411') kYVYU422PixelFormat = FOUR_CHAR_CODE('YVYU') kUYVY422PixelFormat = FOUR_CHAR_CODE('UYVY') kYUV211PixelFormat = FOUR_CHAR_CODE('Y211') -k2vuyPixelFormat = FOUR_CHAR_CODE('2vuy') +k2vuyPixelFormat = FOUR_CHAR_CODE('2vuy') kCursorImageMajorVersion = 0x0001 kCursorImageMinorVersion = 0x0000 kQDParseRegionFromTop = (1 << 0) @@ -157,7 +157,7 @@ colorXorXFer = 52 noiseXFer = 53 customXFer = 54 kXFer1PixelAtATime = 0x00000001 -kXFerConvertPixelToRGB32 = 0x00000002 +kXFerConvertPixelToRGB32 = 0x00000002 kCursorComponentsVersion = 0x00010001 kCursorComponentType = FOUR_CHAR_CODE('curs') cursorDoesAnimate = 1L << 0 @@ -179,20 +179,20 @@ kCursorComponentLastReserved = 0x0050 def FOUR_CHAR_CODE(x): return x -normal = 0 -bold = 1 -italic = 2 -underline = 4 -outline = 8 -shadow = 0x10 -condense = 0x20 -extend = 0x40 +normal = 0 +bold = 1 +italic = 2 +underline = 4 +outline = 8 +shadow = 0x10 +condense = 0x20 +extend = 0x40 leftCaret = 0 rightCaret = -1 -kHilite = 1 +kHilite = 1 smLeftCaret = 0 smRightCaret = -1 -smHilite = 1 +smHilite = 1 onlyStyleRun = 0 leftStyleRun = 1 rightStyleRun = 2 @@ -200,17 +200,17 @@ middleStyleRun = 3 smOnlyStyleRun = 0 smLeftStyleRun = 1 smRightStyleRun = 2 -smMiddleStyleRun = 3 +smMiddleStyleRun = 3 truncEnd = 0 truncMiddle = 0x4000 smTruncEnd = 0 -smTruncMiddle = 0x4000 +smTruncMiddle = 0x4000 notTruncated = 0 truncated = 1 truncErr = -1 smNotTruncated = 0 smTruncated = 1 -smTruncErr = -1 +smTruncErr = -1 smBreakWord = 0 smBreakChar = 1 smBreakOverflow = 2 diff --git a/Lib/plat-mac/Carbon/QuickTime.py b/Lib/plat-mac/Carbon/QuickTime.py index 6ab0304..8fba58c 100644 --- a/Lib/plat-mac/Carbon/QuickTime.py +++ b/Lib/plat-mac/Carbon/QuickTime.py @@ -118,7 +118,7 @@ dfDropShadow = 1 << 12 dfAntiAlias = 1 << 13 dfKeyedText = 1 << 14 dfInverseHilite = 1 << 15 -dfTextColorHilite = 1 << 16 +dfTextColorHilite = 1 << 16 searchTextDontGoToFoundTime = 1L << 16 searchTextDontHiliteFoundText = 1L << 17 searchTextOneTrackOnly = 1L << 18 @@ -144,7 +144,7 @@ kTextKeyEntry = 18 kTextMouseDown = 19 kTextTextBox = 20 kTextEditState = 21 -kTextLength = 22 +kTextLength = 22 k3DMediaRendererEntry = FOUR_CHAR_CODE('rend') k3DMediaRendererName = FOUR_CHAR_CODE('name') k3DMediaRendererCode = FOUR_CHAR_CODE('rcod') @@ -295,7 +295,7 @@ kActionListPasteFromXML = 13315 kActionListSetMatchingFromXML = 13316 kActionListSetFromURL = 13317 kActionListExchangeLists = 13318 -kActionListServerQuery = 13319 +kActionListServerQuery = 13319 kOperandExpression = 1 kOperandConstant = 2 kOperandSubscribedToChannel = 3 @@ -430,7 +430,7 @@ kOperandFlashTrackVariable = 9216 kOperandStringLength = 10240 kOperandStringCompare = 10241 kOperandStringSubString = 10242 -kOperandStringConcat = 10243 +kOperandStringConcat = 10243 kFirstMovieAction = kActionMovieSetVolume kLastMovieAction = kActionMovieSetScale kFirstTrackAction = kActionTrackSetVolume @@ -477,7 +477,7 @@ kTargetSpriteName = FOUR_CHAR_CODE('spna') kTargetSpriteID = FOUR_CHAR_CODE('spid') kTargetSpriteIndex = FOUR_CHAR_CODE('spin') kTargetQD3DNamedObjectName = FOUR_CHAR_CODE('nana') -kTargetCurrentQTEventParams = FOUR_CHAR_CODE('evpa') +kTargetCurrentQTEventParams = FOUR_CHAR_CODE('evpa') kQTEventType = FOUR_CHAR_CODE('evnt') kAction = FOUR_CHAR_CODE('actn') kWhichAction = FOUR_CHAR_CODE('whic') @@ -508,7 +508,7 @@ kQTEventKey = FOUR_CHAR_CODE('key ') kQTEventMovieLoaded = FOUR_CHAR_CODE('load') kQTEventRequestToModifyMovie = FOUR_CHAR_CODE('reqm') kQTEventListReceived = FOUR_CHAR_CODE('list') -kQTEventKeyUp = FOUR_CHAR_CODE('keyU') +kQTEventKeyUp = FOUR_CHAR_CODE('keyU') kActionFlagActionIsDelta = 1L << 1 kActionFlagParameterWrapsAround = 1L << 2 kActionFlagActionIsToggle = 1L << 3 @@ -574,12 +574,12 @@ callBackAtInterrupt = 0x8000 callBackAtDeferredTask = 0x4000 qtcbNeedsRateChanges = 1 qtcbNeedsTimeChanges = 2 -qtcbNeedsStartStopChanges = 4 +qtcbNeedsStartStopChanges = 4 keepInRam = 1 << 0 unkeepInRam = 1 << 1 flushFromRam = 1 << 2 loadForwardTrackEdits = 1 << 3 -loadBackwardTrackEdits = 1 << 4 +loadBackwardTrackEdits = 1 << 4 newMovieActive = 1 << 0 newMovieDontResolveDataRefs = 1 << 1 newMovieDontAskUnresolvedDataRefs = 1 << 2 @@ -593,7 +593,7 @@ trackUsageInMovie = 1 << 1 trackUsageInPreview = 1 << 2 trackUsageInPoster = 1 << 3 mediaSampleNotSync = 1 << 0 -mediaSampleShadowSync = 1 << 1 +mediaSampleShadowSync = 1 << 1 pasteInParallel = 1 << 0 showUserSettingsDialog = 1 << 1 movieToFileOnlyExport = 1 << 2 @@ -615,17 +615,17 @@ flattenDontInterleaveFlatten = 1L << 3 flattenFSSpecPtrIsDataRefRecordPtr = 1L << 4 flattenCompressMovieResource = 1L << 5 flattenForceMovieResourceBeforeMovieData = 1L << 6 -movieInDataForkResID = -1 +movieInDataForkResID = -1 mcTopLeftMovie = 1 << 0 mcScaleMovieToFit = 1 << 1 mcWithBadge = 1 << 2 mcNotVisible = 1 << 3 -mcWithFrame = 1 << 4 +mcWithFrame = 1 << 4 movieScrapDontZeroScrap = 1 << 0 movieScrapOnlyPutMovie = 1 << 1 dataRefSelfReference = 1 << 0 dataRefWasNotResolved = 1 << 1 -kMovieAnchorDataRefIsDefault = 1 << 0 +kMovieAnchorDataRefIsDefault = 1 << 0 hintsScrubMode = 1 << 0 hintsLoop = 1 << 1 hintsDontPurge = 1 << 2 @@ -667,11 +667,11 @@ kGetMovieImporterValidateToFind = 1L << 0 kGetMovieImporterAllowNewFile = 1L << 1 kGetMovieImporterDontConsiderGraphicsImporters = 1L << 2 kGetMovieImporterDontConsiderFileOnlyImporters = 1L << 6 -kGetMovieImporterAutoImportOnly = 1L << 10 +kGetMovieImporterAutoImportOnly = 1L << 10 kQTGetMIMETypeInfoIsQuickTimeMovieType = FOUR_CHAR_CODE('moov') -kQTGetMIMETypeInfoIsUnhelpfulType = FOUR_CHAR_CODE('dumb') +kQTGetMIMETypeInfoIsUnhelpfulType = FOUR_CHAR_CODE('dumb') kQTCopyUserDataReplace = FOUR_CHAR_CODE('rplc') -kQTCopyUserDataMerge = FOUR_CHAR_CODE('merg') +kQTCopyUserDataMerge = FOUR_CHAR_CODE('merg') kMovieLoadStateError = -1L kMovieLoadStateLoading = 1000 kMovieLoadStateLoaded = 2000 @@ -682,7 +682,7 @@ kQTDontUseDataToFindImporter = 1L << 0 kQTDontLookForMovieImporterIfGraphicsImporterFound = 1L << 1 kQTAllowOpeningStillImagesAsMovies = 1L << 2 kQTAllowImportersThatWouldCreateNewFile = 1L << 3 -kQTAllowAggressiveImporters = 1L << 4 +kQTAllowAggressiveImporters = 1L << 4 preloadAlways = 1L << 0 preloadOnlyIfEnabled = 1L << 1 fullScreenHideCursor = 1L << 0 @@ -693,13 +693,13 @@ movieExecuteWiredActionDontExecute = 1L << 0 kRefConNavigationNext = 0 kRefConNavigationPrevious = 1 kRefConPropertyCanHaveFocus = 1 -kRefConPropertyHasFocus = 2 +kRefConPropertyHasFocus = 2 kTrackFocusCanEditFlag = FOUR_CHAR_CODE('kedt') kTrackDefaultFocusFlags = FOUR_CHAR_CODE('kfoc') kTrackFocusDefaultRefcon = FOUR_CHAR_CODE('kref') kTrackFocusOn = 1 -kTrackHandlesTabs = 2 -kFlashTrackPropertyAcceptAllClicks = FOUR_CHAR_CODE('clik') +kTrackHandlesTabs = 2 +kFlashTrackPropertyAcceptAllClicks = FOUR_CHAR_CODE('clik') kBackgroundSpriteLayerNum = 32767 kSpritePropertyMatrix = 1 kSpritePropertyImageDescription = 2 @@ -746,7 +746,7 @@ kTweenRecordNoFlags = 0 kTweenRecordIsAtInterruptTime = 0x00000001 kEffectNameAtom = FOUR_CHAR_CODE('name') kEffectTypeAtom = FOUR_CHAR_CODE('type') -kEffectManufacturerAtom = FOUR_CHAR_CODE('manu') +kEffectManufacturerAtom = FOUR_CHAR_CODE('manu') pdActionConfirmDialog = 1 pdActionSetAppleMenu = 2 pdActionSetEditMenu = 3 @@ -781,20 +781,20 @@ pdActionCustomSetEditCallout = 31 pdActionCustomGetEnableValue = 32 pdActionCustomSetSampleTime = 33 pdActionCustomGetValue = 34 -pdActionCustomDoEditCommand = 35 +pdActionCustomDoEditCommand = 35 pdSampleTimeDisplayOptionsNone = 0x00000000 pdActionFocusOff = 0 pdActionFocusFirst = 1 pdActionFocusLast = 2 pdActionFocusForward = 3 -pdActionFocusBackward = 4 -elOptionsIncludeNoneInList = 0x00000001 +pdActionFocusBackward = 4 +elOptionsIncludeNoneInList = 0x00000001 pdOptionsCollectOneValue = 0x00000001 pdOptionsAllowOptionalInterpolations = 0x00000002 pdOptionsModalDialogBox = 0x00000004 pdOptionsEditCurrentEffectOnly = 0x00000008 -pdOptionsHidePreview = 0x00000010 -effectIsRealtime = 0 +pdOptionsHidePreview = 0x00000010 +effectIsRealtime = 0 kAccessKeyAtomType = FOUR_CHAR_CODE('acky') kAccessKeySystemFlag = 1L << 0 ConnectionSpeedPrefsType = FOUR_CHAR_CODE('cspd') @@ -818,14 +818,14 @@ kQTParseTextHREFBaseURL = FOUR_CHAR_CODE('burl') kQTParseTextHREFClickPoint = FOUR_CHAR_CODE('clik') kQTParseTextHREFUseAltDelim = FOUR_CHAR_CODE('altd') kQTParseTextHREFDelimiter = FOUR_CHAR_CODE('delm') -kQTParseTextHREFRecomposeHREF = FOUR_CHAR_CODE('rhrf') +kQTParseTextHREFRecomposeHREF = FOUR_CHAR_CODE('rhrf') kQTParseTextHREFURL = FOUR_CHAR_CODE('url ') kQTParseTextHREFTarget = FOUR_CHAR_CODE('targ') kQTParseTextHREFChapter = FOUR_CHAR_CODE('chap') kQTParseTextHREFIsAutoHREF = FOUR_CHAR_CODE('auto') kQTParseTextHREFIsServerMap = FOUR_CHAR_CODE('smap') kQTParseTextHREFHREF = FOUR_CHAR_CODE('href') -kQTParseTextHREFEMBEDArgs = FOUR_CHAR_CODE('mbed') +kQTParseTextHREFEMBEDArgs = FOUR_CHAR_CODE('mbed') kTrackReferenceChapterList = FOUR_CHAR_CODE('chap') kTrackReferenceTimeCode = FOUR_CHAR_CODE('tmcd') kTrackReferenceModifier = FOUR_CHAR_CODE('ssrc') @@ -920,16 +920,16 @@ kQTRestrictionEditDontCut = (1L << 1) kQTRestrictionEditDontPaste = (1L << 2) kQTRestrictionEditDontClear = (1L << 3) kQTRestrictionEditDontModify = (1L << 4) -kQTRestrictionEditDontExtract = (1L << 5) +kQTRestrictionEditDontExtract = (1L << 5) videoFlagDontLeanAhead = 1L << 0 txtProcDefaultDisplay = 0 txtProcDontDisplay = 1 -txtProcDoDisplay = 2 +txtProcDoDisplay = 2 findTextEdgeOK = 1 << 0 findTextCaseSensitive = 1 << 1 findTextReverseSearch = 1 << 2 findTextWrapAround = 1 << 3 -findTextUseOffset = 1 << 4 +findTextUseOffset = 1 << 4 dropShadowOffsetType = FOUR_CHAR_CODE('drpo') dropShadowTranslucencyType = FOUR_CHAR_CODE('drpt') spriteHitTestBounds = 1L << 0 @@ -937,7 +937,7 @@ spriteHitTestImage = 1L << 1 spriteHitTestInvisibleSprites = 1L << 2 spriteHitTestIsClick = 1L << 3 spriteHitTestLocInDisplayCoordinates = 1L << 4 -spriteHitTestTreatAllSpritesAsHitTestable = 1L << 5 +spriteHitTestTreatAllSpritesAsHitTestable = 1L << 5 kSpriteAtomType = FOUR_CHAR_CODE('sprt') kSpriteImagesContainerAtomType = FOUR_CHAR_CODE('imct') kSpriteImageAtomType = FOUR_CHAR_CODE('imag') @@ -974,7 +974,7 @@ kMovieMediaRegionAtom = FOUR_CHAR_CODE('regi') kMovieMediaSlaveTrackDuration = FOUR_CHAR_CODE('sltr') kMovieMediaEnableFrameStepping = FOUR_CHAR_CODE('enfs') kMovieMediaBackgroundColor = FOUR_CHAR_CODE('bkcl') -kMovieMediaPrerollTime = FOUR_CHAR_CODE('prer') +kMovieMediaPrerollTime = FOUR_CHAR_CODE('prer') kMovieMediaFitNone = 0 kMovieMediaFitScroll = FOUR_CHAR_CODE('scro') kMovieMediaFitClipIfNecessary = FOUR_CHAR_CODE('hidd') @@ -992,9 +992,9 @@ kMoviePropertyTimeScale = FOUR_CHAR_CODE('tims') kMoviePropertyTime = FOUR_CHAR_CODE('timv') kMoviePropertyNaturalBounds = FOUR_CHAR_CODE('natb') kMoviePropertyMatrix = FOUR_CHAR_CODE('mtrx') -kMoviePropertyTrackList = FOUR_CHAR_CODE('tlst') +kMoviePropertyTrackList = FOUR_CHAR_CODE('tlst') kTrackPropertyMediaType = FOUR_CHAR_CODE('mtyp') -kTrackPropertyInstantiation = FOUR_CHAR_CODE('inst') +kTrackPropertyInstantiation = FOUR_CHAR_CODE('inst') MovieControllerComponentType = FOUR_CHAR_CODE('play') kMovieControllerQTVRFlag = 1 << 0 kMovieControllerDontDisplayToUser = 1 << 1 @@ -1074,7 +1074,7 @@ mcActionAppMessageReceived = 85 mcActionEvaluateExpressionWithType = 89 mcActionGetMovieName = 90 mcActionGetMovieID = 91 -mcActionGetMovieActive = 92 +mcActionGetMovieActive = 92 mcFlagSuppressMovieFrame = 1 << 0 mcFlagSuppressStepButtons = 1 << 1 mcFlagSuppressSpeakerButton = 1 << 2 @@ -1114,7 +1114,7 @@ kQTAppMessageSoftwareChanged = 1 kQTAppMessageWindowCloseRequested = 3 kQTAppMessageExitFullScreenRequested = 4 kQTAppMessageDisplayChannels = 5 -kQTAppMessageEnterFullScreenRequested = 6 +kQTAppMessageEnterFullScreenRequested = 6 kFetchAsBooleanPtr = 1 kFetchAsShortPtr = 2 kFetchAsLongPtr = 3 @@ -1324,7 +1324,7 @@ k4444YpCbCrA8CodecType = FOUR_CHAR_CODE('v408') k422YpCbCr16CodecType = FOUR_CHAR_CODE('v216') k422YpCbCr10CodecType = FOUR_CHAR_CODE('v210') k444YpCbCr10CodecType = FOUR_CHAR_CODE('v410') -k4444YpCbCrA8RCodecType = FOUR_CHAR_CODE('r408') +k4444YpCbCrA8RCodecType = FOUR_CHAR_CODE('r408') kBlurImageFilterType = FOUR_CHAR_CODE('blur') kSharpenImageFilterType = FOUR_CHAR_CODE('shrp') kEdgeDetectImageFilterType = FOUR_CHAR_CODE('edge') @@ -1359,10 +1359,10 @@ k64ARGBPixelFormat = FOUR_CHAR_CODE('b64a') k48RGBPixelFormat = FOUR_CHAR_CODE('b48r') k32AlphaGrayPixelFormat = FOUR_CHAR_CODE('b32a') k16GrayPixelFormat = FOUR_CHAR_CODE('b16g') -k422YpCbCr8PixelFormat = FOUR_CHAR_CODE('2vuy') +k422YpCbCr8PixelFormat = FOUR_CHAR_CODE('2vuy') k4444YpCbCrA8PixelFormat = FOUR_CHAR_CODE('v408') -k4444YpCbCrA8RPixelFormat = FOUR_CHAR_CODE('r408') -kYUV420PixelFormat = FOUR_CHAR_CODE('y420') +k4444YpCbCrA8RPixelFormat = FOUR_CHAR_CODE('r408') +kYUV420PixelFormat = FOUR_CHAR_CODE('y420') codecInfoDoes1 = (1L << 0) codecInfoDoes2 = (1L << 1) codecInfoDoes4 = (1L << 2) @@ -1386,7 +1386,7 @@ codecInfoDoesBlend = (1L << 19) codecInfoDoesWarp = (1L << 20) codecInfoDoesRecompress = (1L << 21) codecInfoDoesSpool = (1L << 22) -codecInfoDoesRateConstrain = (1L << 23) +codecInfoDoesRateConstrain = (1L << 23) codecInfoDepth1 = (1L << 0) codecInfoDepth2 = (1L << 1) codecInfoDepth4 = (1L << 2) @@ -1400,7 +1400,7 @@ codecInfoDepth36 = (1L << 9) codecInfoDepth40 = (1L << 10) codecInfoStoresClut = (1L << 11) codecInfoDoesLossless = (1L << 12) -codecInfoSequenceSensitive = (1L << 13) +codecInfoSequenceSensitive = (1L << 13) codecFlagUseImageBuffer = (1L << 0) codecFlagUseScreenBuffer = (1L << 1) codecFlagUpdatePrevious = (1L << 2) @@ -1416,7 +1416,7 @@ codecFlagDontUseNewImageBuffer = (1L << 10) codecFlagInterlaceUpdate = (1L << 11) codecFlagCatchUpDiff = (1L << 12) codecFlagSupportDisable = (1L << 13) -codecFlagReenable = (1L << 14) +codecFlagReenable = (1L << 14) codecFlagOutUpdateOnNextIdle = (1L << 9) codecFlagOutUpdateOnDataSourceChange = (1L << 10) codecFlagSequenceSensitive = (1L << 11) @@ -1426,21 +1426,21 @@ codecFlagUsedNewImageBuffer = (1L << 14) codecFlagUsedImageBuffer = (1L << 15) codecMinimumDataSize = 32768L compressorComponentType = FOUR_CHAR_CODE('imco') -decompressorComponentType = FOUR_CHAR_CODE('imdc') +decompressorComponentType = FOUR_CHAR_CODE('imdc') codecLosslessQuality = 0x00000400 codecMaxQuality = 0x000003FF codecMinQuality = 0x00000000 codecLowQuality = 0x00000100 codecNormalQuality = 0x00000200 codecHighQuality = 0x00000300 -codecLockBitsShieldCursor = (1 << 0) +codecLockBitsShieldCursor = (1 << 0) codecCompletionSource = (1 << 0) codecCompletionDest = (1 << 1) codecCompletionDontUnshield = (1 << 2) codecCompletionWentOffscreen = (1 << 3) codecCompletionUnlockBits = (1 << 4) codecCompletionForceChainFlush = (1 << 5) -codecCompletionDropped = (1 << 6) +codecCompletionDropped = (1 << 6) codecProgressOpen = 0 codecProgressUpdatePercent = 1 codecProgressClose = 2 @@ -1473,14 +1473,14 @@ codecDSequenceFlushInsteadOfDirtying = (1L << 8) codecDSequenceEnableSubPixelPositioning = (1L << 9) kICMSequenceTaskWeight = FOUR_CHAR_CODE('twei') kICMSequenceTaskName = FOUR_CHAR_CODE('tnam') -kICMSequenceUserPreferredCodecs = FOUR_CHAR_CODE('punt') +kICMSequenceUserPreferredCodecs = FOUR_CHAR_CODE('punt') kImageDescriptionSampleFormat = FOUR_CHAR_CODE('idfm') kImageDescriptionClassicAtomFormat = FOUR_CHAR_CODE('atom') kImageDescriptionQTAtomFormat = FOUR_CHAR_CODE('qtat') kImageDescriptionEffectDataFormat = FOUR_CHAR_CODE('fxat') kImageDescriptionPrivateDataFormat = FOUR_CHAR_CODE('priv') kImageDescriptionAlternateCodec = FOUR_CHAR_CODE('subs') -kImageDescriptionColorSpace = FOUR_CHAR_CODE('cspc') +kImageDescriptionColorSpace = FOUR_CHAR_CODE('cspc') sfpItemPreviewAreaUser = 11 sfpItemPreviewStaticText = 12 sfpItemPreviewDividerUser = 13 @@ -1500,14 +1500,14 @@ kICMTempThenAppMemory = 1L << 12 kICMAppThenTempMemory = 1L << 13 kQTUsePlatformDefaultGammaLevel = 0 kQTUseSourceGammaLevel = -1L -kQTCCIR601VideoGammaLevel = 0x00023333 +kQTCCIR601VideoGammaLevel = 0x00023333 identityMatrixType = 0x00 translateMatrixType = 0x01 scaleMatrixType = 0x02 scaleTranslateMatrixType = 0x03 linearMatrixType = 0x04 linearTranslateMatrixType = 0x05 -perspectiveMatrixType = 0x06 +perspectiveMatrixType = 0x06 GraphicsImporterComponentType = FOUR_CHAR_CODE('grip') graphicsImporterUsesImageDecompressor = 1L << 23 quickTimeImageFileImageDescriptionAtom = FOUR_CHAR_CODE('idsc') @@ -1530,12 +1530,12 @@ kQTPhotoshopLayerOpacity = FOUR_CHAR_CODE('lopa') kQTPhotoshopLayerClipping = FOUR_CHAR_CODE('lclp') kQTPhotoshopLayerFlags = FOUR_CHAR_CODE('lflg') kQTPhotoshopLayerName = FOUR_CHAR_CODE('\xa9lnm') -kQTPhotoshopLayerUnicodeName = FOUR_CHAR_CODE('luni') +kQTPhotoshopLayerUnicodeName = FOUR_CHAR_CODE('luni') kQTIndexedImageType = FOUR_CHAR_CODE('nth?') kQTIndexedImageIsThumbnail = FOUR_CHAR_CODE('n=th') kQTIndexedImageIsLayer = FOUR_CHAR_CODE('n=ly') kQTIndexedImageIsPage = FOUR_CHAR_CODE('n=pg') -kQTIndexedImageIsMultiResolution = FOUR_CHAR_CODE('n=rs') +kQTIndexedImageIsMultiResolution = FOUR_CHAR_CODE('n=rs') kQTTIFFUserDataPrefix = 0x74690000 kQTTIFFExifUserDataPrefix = 0x65780000 kQTTIFFExifGPSUserDataPrefix = 0x67700000 @@ -1548,14 +1548,14 @@ kQTTIFFUserDataWhitePoint = 0x7469013E kQTTIFFUserDataPrimaryChromaticities = 0x7469013F kQTTIFFUserDataTransferRange = 0x74690156 kQTTIFFUserDataYCbCrPositioning = 0x74690213 -kQTTIFFUserDataReferenceBlackWhite = 0x74690214 +kQTTIFFUserDataReferenceBlackWhite = 0x74690214 kQTTIFFUserDataModelPixelScale = 0x7469830E kQTTIFFUserDataModelTransformation = 0x746985D8 kQTTIFFUserDataModelTiepoint = 0x74698482 kQTTIFFUserDataGeoKeyDirectory = 0x746987AF kQTTIFFUserDataGeoDoubleParams = 0x746987B0 kQTTIFFUserDataGeoAsciiParams = 0x746987B1 -kQTTIFFUserDataIntergraphMatrix = 0x74698480 +kQTTIFFUserDataIntergraphMatrix = 0x74698480 kQTExifUserDataExifVersion = 0x65789000 kQTExifUserDataFlashPixVersion = 0x6578A000 kQTExifUserDataColorSpace = 0x6578A001 @@ -1594,7 +1594,7 @@ kQTExifUserDataSubjectLocation = 0x6578A214 kQTExifUserDataExposureIndex = 0x6578A215 kQTExifUserDataSensingMethod = 0x6578A217 kQTExifUserDataFileSource = 0x6578A300 -kQTExifUserDataSceneType = 0x6578A301 +kQTExifUserDataSceneType = 0x6578A301 kQTExifUserDataGPSVersionID = 0x06770000 kQTExifUserDataGPSLatitudeRef = 0x06770001 kQTExifUserDataGPSLatitude = 0x06770002 @@ -1621,7 +1621,7 @@ kQTExifUserDataGPSDestLongitude = 0x06770016 kQTExifUserDataGPSDestBearingRef = 0x06770017 kQTExifUserDataGPSDestBearing = 0x06770018 kQTExifUserDataGPSDestDistanceRef = 0x06770019 -kQTExifUserDataGPSDestDistance = 0x0677001A +kQTExifUserDataGPSDestDistance = 0x0677001A GraphicsExporterComponentType = FOUR_CHAR_CODE('grex') kBaseGraphicsExporterSubType = FOUR_CHAR_CODE('base') graphicsExporterIsBaseExporter = 1L << 0 @@ -1638,7 +1638,7 @@ kQTMetaData = FOUR_CHAR_CODE('meta') kQTTIFFCompressionMethod = FOUR_CHAR_CODE('tifc') kQTTIFFCompression_None = 1 kQTTIFFCompression_PackBits = 32773L -kQTTIFFLittleEndian = FOUR_CHAR_CODE('tife') +kQTTIFFLittleEndian = FOUR_CHAR_CODE('tife') kQTPNGFilterPreference = FOUR_CHAR_CODE('pngf') kQTPNGFilterBestForColorType = FOUR_CHAR_CODE('bflt') kQTPNGFilterNone = 0 @@ -1795,10 +1795,10 @@ clockComponentType = FOUR_CHAR_CODE('clok') systemTickClock = FOUR_CHAR_CODE('tick') systemSecondClock = FOUR_CHAR_CODE('seco') systemMillisecondClock = FOUR_CHAR_CODE('mill') -systemMicrosecondClock = FOUR_CHAR_CODE('micr') +systemMicrosecondClock = FOUR_CHAR_CODE('micr') kClockRateIsLinear = 1 kClockImplementsCallBacks = 2 -kClockCanHandleIntermittentSound = 4 +kClockCanHandleIntermittentSound = 4 StandardCompressionType = FOUR_CHAR_CODE('scdi') StandardCompressionSubType = FOUR_CHAR_CODE('imag') StandardCompressionSubTypeSound = FOUR_CHAR_CODE('soun') @@ -1861,21 +1861,21 @@ scCodecManufacturerType = FOUR_CHAR_CODE('cmfr') scSoundVBRCompressionOK = FOUR_CHAR_CODE('cvbr') scSoundInputSampleRateType = FOUR_CHAR_CODE('ssir') scSoundSampleRateChangeOK = FOUR_CHAR_CODE('rcok') -scAvailableCompressionListType = FOUR_CHAR_CODE('avai') +scAvailableCompressionListType = FOUR_CHAR_CODE('avai') scGetCompression = 1 scShowMotionSettings = 1L << 0 scSettingsChangedItem = -1 scCompressFlagIgnoreIdenticalFrames = 1 kQTSettingsVideo = FOUR_CHAR_CODE('vide') kQTSettingsSound = FOUR_CHAR_CODE('soun') -kQTSettingsComponentVersion = FOUR_CHAR_CODE('vers') +kQTSettingsComponentVersion = FOUR_CHAR_CODE('vers') TweenComponentType = FOUR_CHAR_CODE('twen') TCSourceRefNameType = FOUR_CHAR_CODE('name') tcDropFrame = 1 << 0 tc24HourMax = 1 << 1 tcNegTimesOK = 1 << 2 tcCounter = 1 << 3 -tctNegFlag = 0x80 +tctNegFlag = 0x80 tcdfShowTimeCode = 1 << 0 MovieImportType = FOUR_CHAR_CODE('eat ') MovieExportType = FOUR_CHAR_CODE('spit') @@ -1938,7 +1938,7 @@ kQTMediaConfigUseAppByDefault = (1L << 28) kQTMediaConfigUsePluginByDefault = (1L << 29) kQTMediaConfigDefaultsMask = (kQTMediaConfigUseAppByDefault | kQTMediaConfigUsePluginByDefault) kQTMediaConfigDefaultsShift = 12 -kQTMediaConfigHasFileHasQTAtoms = (1L << 30) +kQTMediaConfigHasFileHasQTAtoms = (1L << 30) kQTMediaConfigStreamGroupID = FOUR_CHAR_CODE('strm') kQTMediaConfigInteractiveGroupID = FOUR_CHAR_CODE('intr') kQTMediaConfigVideoGroupID = FOUR_CHAR_CODE('eyes') @@ -1950,7 +1950,7 @@ kQTMediaConfigMiscGroupID = FOUR_CHAR_CODE('misc') kQTMediaInfoNetGroup = FOUR_CHAR_CODE('net ') kQTMediaInfoWinGroup = FOUR_CHAR_CODE('win ') kQTMediaInfoMacGroup = FOUR_CHAR_CODE('mac ') -kQTMediaInfoMiscGroup = 0x3F3F3F3F +kQTMediaInfoMiscGroup = 0x3F3F3F3F kMimeInfoMimeTypeTag = FOUR_CHAR_CODE('mime') kMimeInfoFileExtensionTag = FOUR_CHAR_CODE('ext ') kMimeInfoDescriptionTag = FOUR_CHAR_CODE('desc') @@ -2008,7 +2008,7 @@ kQTSettingsTime = FOUR_CHAR_CODE('time') kQTSettingsTimeDuration = FOUR_CHAR_CODE('dura') kQTSettingsAudioCDTrack = FOUR_CHAR_CODE('trak') kQTSettingsAudioCDTrackRateShift = FOUR_CHAR_CODE('rshf') -kQTSettingsDVExportDVFormat = FOUR_CHAR_CODE('dvcf') +kQTSettingsDVExportDVFormat = FOUR_CHAR_CODE('dvcf') kQTPresetsListResourceType = FOUR_CHAR_CODE('stg#') kQTPresetsPlatformListResourceType = FOUR_CHAR_CODE('stgp') kQTPresetInfoIsDivider = 1 @@ -2021,9 +2021,9 @@ movieExportWidth = FOUR_CHAR_CODE('wdth') movieExportHeight = FOUR_CHAR_CODE('hegt') movieExportDuration = FOUR_CHAR_CODE('dura') movieExportVideoFilter = FOUR_CHAR_CODE('iflt') -movieExportTimeScale = FOUR_CHAR_CODE('tmsc') -kQTBrowserInfoCanUseSystemFolderPlugin = (1L << 0) -kQTPreFlightOpenComponent = (1L << 1) +movieExportTimeScale = FOUR_CHAR_CODE('tmsc') +kQTBrowserInfoCanUseSystemFolderPlugin = (1L << 0) +kQTPreFlightOpenComponent = (1L << 1) pnotComponentWantsEvents = 1 pnotComponentNeedsNoCache = 2 ShowFilePreviewComponentType = FOUR_CHAR_CODE('pnot') @@ -2047,29 +2047,29 @@ kDataRefExtensionMacOSFileType = FOUR_CHAR_CODE('ftyp') kDataRefExtensionInitializationData = FOUR_CHAR_CODE('data') kDataRefExtensionQuickTimeMediaType = FOUR_CHAR_CODE('mtyp') kDataHChokeToMovieDataRate = 1 << 0 -kDataHChokeToParam = 1 << 1 +kDataHChokeToParam = 1 << 1 kDataHExtendedSchedule = FOUR_CHAR_CODE('xtnd') kDataHInfoFlagNeverStreams = 1 << 0 kDataHInfoFlagCanUpdateDataRefs = 1 << 1 -kDataHInfoFlagNeedsNetworkBandwidth = 1 << 2 +kDataHInfoFlagNeedsNetworkBandwidth = 1 << 2 kDataHFileTypeMacOSFileType = FOUR_CHAR_CODE('ftyp') kDataHFileTypeExtension = FOUR_CHAR_CODE('fext') kDataHFileTypeMIME = FOUR_CHAR_CODE('mime') kDataHCreateFileButDontCreateResFile = (1L << 0) -kDataHMovieUsageDoAppendMDAT = 1L << 0 +kDataHMovieUsageDoAppendMDAT = 1L << 0 kDataHTempUseSameDirectory = 1L << 0 kDataHTempUseSameVolume = 1L << 1 kDataHTempCreateFile = 1L << 2 -kDataHTempOpenFile = 1L << 3 -kDataHGetDataRateInfiniteRate = 0x7FFFFFFF -kDataHSetTimeHintsSkipBandwidthRequest = 1 << 0 +kDataHTempOpenFile = 1L << 3 +kDataHGetDataRateInfiniteRate = 0x7FFFFFFF +kDataHSetTimeHintsSkipBandwidthRequest = 1 << 0 videoDigitizerComponentType = FOUR_CHAR_CODE('vdig') vdigInterfaceRev = 2 ntscIn = 0 currentIn = 0 palIn = 1 secamIn = 2 -ntscReallyIn = 3 +ntscReallyIn = 3 compositeIn = 0 sVideoIn = 1 rgbComponentIn = 2 @@ -2081,16 +2081,16 @@ sdiIn = 7 vdPlayThruOff = 0 vdPlayThruOn = 1 vdDigitizerBW = 0 -vdDigitizerRGB = 1 +vdDigitizerRGB = 1 vdBroadcastMode = 0 -vdVTRMode = 1 +vdVTRMode = 1 vdUseAnyField = 0 vdUseOddField = 1 -vdUseEvenField = 2 +vdUseEvenField = 2 vdTypeBasic = 0 vdTypeAlpha = 1 vdTypeMask = 2 -vdTypeKey = 3 +vdTypeKey = 3 digiInDoesNTSC = 1L << 0 digiInDoesPAL = 1L << 1 digiInDoesSECAM = 1L << 2 @@ -2101,7 +2101,7 @@ digiInDoesComponent = 1L << 10 digiInVTR_Broadcast = 1L << 11 digiInDoesColor = 1L << 12 digiInDoesBW = 1L << 13 -digiInSignalLock = 1L << 31 +digiInSignalLock = 1L << 31 digiOutDoes1 = 1L << 0 digiOutDoes2 = 1L << 1 digiOutDoes4 = 1L << 2 @@ -2132,7 +2132,7 @@ digiOutDoesCompress = 1L << 27 digiOutDoesCompressOnly = 1L << 28 digiOutDoesPlayThruDuringCompress = 1L << 29 digiOutDoesCompressPartiallyVisible = 1L << 30 -digiOutDoesNotNeedCopyOfCompressData = 1L << 31 +digiOutDoesNotNeedCopyOfCompressData = 1L << 31 dmaDepth1 = 1 dmaDepth2 = 2 dmaDepth4 = 4 @@ -2144,7 +2144,7 @@ dmaDepth4Gray = 128 dmaDepth8Gray = 256 kVDIGControlledFrameRate = -1 vdDeviceFlagShowInputsAsDevices = (1 << 0) -vdDeviceFlagHideDevice = (1 << 1) +vdDeviceFlagHideDevice = (1 << 1) vdFlagCaptureStarting = (1 << 0) vdFlagCaptureStopping = (1 << 1) vdFlagCaptureIsForPreview = (1 << 2) @@ -2152,7 +2152,7 @@ vdFlagCaptureIsForRecord = (1 << 3) vdFlagCaptureLowLatency = (1 << 4) vdFlagCaptureAlwaysUseTimeBase = (1 << 5) vdFlagCaptureSetSettingsBegin = (1 << 6) -vdFlagCaptureSetSettingsEnd = (1 << 7) +vdFlagCaptureSetSettingsEnd = (1 << 7) xmlParseComponentType = FOUR_CHAR_CODE('pars') xmlParseComponentSubType = FOUR_CHAR_CODE('xml ') xmlIdentifierInvalid = 0 @@ -2164,7 +2164,7 @@ elementFlagAlwaysSelfContained = 1L << 0 elementFlagPreserveWhiteSpace = 1L << 1 xmlParseFlagAllowUppercase = 1L << 0 xmlParseFlagAllowUnquotedAttributeValues = 1L << 1 -xmlParseFlagEventParseOnly = 1L << 2 +xmlParseFlagEventParseOnly = 1L << 2 attributeValueKindCharString = 0 attributeValueKindInteger = 1L << 0 attributeValueKindPercent = 1L << 1 @@ -2195,7 +2195,7 @@ seqGrabRecord = 1 seqGrabPreview = 2 seqGrabPlayDuringRecord = 4 seqGrabLowLatencyCapture = 8 -seqGrabAlwaysUseTimeBase = 16 +seqGrabAlwaysUseTimeBase = 16 seqGrabHasBounds = 1 seqGrabHasVolume = 2 seqGrabHasDiscreteSamples = 4 @@ -2227,9 +2227,9 @@ channelPlayFast = 1 channelPlayHighQuality = 2 channelPlayAllData = 4 sgSetSettingsBegin = (1 << 0) -sgSetSettingsEnd = (1 << 1) +sgSetSettingsEnd = (1 << 1) kSGSmallestDITLSize = -1 -kSGLargestDITLSize = -2 +kSGLargestDITLSize = -2 sgChannelAtom = FOUR_CHAR_CODE('chan') sgChannelSettingsAtom = FOUR_CHAR_CODE('ctom') sgChannelDescription = FOUR_CHAR_CODE('cdsc') @@ -2277,7 +2277,7 @@ kQTVOName = FOUR_CHAR_CODE('name') kQTVODecompressors = FOUR_CHAR_CODE('deco') kQTVODecompressorType = FOUR_CHAR_CODE('dety') kQTVODecompressorContinuous = FOUR_CHAR_CODE('cont') -kQTVODecompressorComponent = FOUR_CHAR_CODE('cmpt') +kQTVODecompressorComponent = FOUR_CHAR_CODE('cmpt') kClockGetTimeSelect = 0x0001 kClockNewCallBackSelect = 0x0002 kClockDisposeCallBackSelect = 0x0003 @@ -2804,7 +2804,7 @@ forceUpdateNewBuffer = 1 << 1 mHitTestBounds = 1L << 0 mHitTestImage = 1L << 1 mHitTestInvisible = 1L << 2 -mHitTestIsClick = 1L << 3 +mHitTestIsClick = 1L << 3 mOpaque = 1L << 0 mInvisible = 1L << 1 kMediaQTIdleFrequencySelector = FOUR_CHAR_CODE('idfq') @@ -2815,7 +2815,7 @@ kMediaVideoParamSharpness = 4 kMediaVideoParamSaturation = 5 kMediaVideoParamBlackLevel = 6 kMediaVideoParamWhiteLevel = 7 -kMHInfoEncodedFrameRate = FOUR_CHAR_CODE('orat') +kMHInfoEncodedFrameRate = FOUR_CHAR_CODE('orat') kEmptyPurgableChunksOverAllowance = 1 kCallComponentExecuteWiredActionSelect = -9 kMediaSetChunkManagementFlagsSelect = 0x0415 @@ -2937,7 +2937,7 @@ kaiLibraryDescType = FOUR_CHAR_CODE('ldsc') kInstKnobMissingUnknown = 0 kInstKnobMissingDefault = (1 << 0) kMusicLoopTypeNormal = 0 -kMusicLoopTypePalindrome = 1 +kMusicLoopTypePalindrome = 1 instSamplePreProcessFlag = 1 << 0 kQTMIDIComponentType = FOUR_CHAR_CODE('midi') kOMSComponentSubType = FOUR_CHAR_CODE('OMS ') @@ -2946,18 +2946,18 @@ kMIDIManagerComponentSubType = FOUR_CHAR_CODE('mmgr') kOSXMIDIComponentSubType = FOUR_CHAR_CODE('osxm') kMusicPacketPortLost = 1 kMusicPacketPortFound = 2 -kMusicPacketTimeGap = 3 +kMusicPacketTimeGap = 3 kAppleSysexID = 0x11 kAppleSysexCmdSampleSize = 0x0001 kAppleSysexCmdSampleBreak = 0x0002 kAppleSysexCmdAtomicInstrument = 0x0010 -kAppleSysexCmdDeveloper = 0x7F00 +kAppleSysexCmdDeveloper = 0x7F00 kSynthesizerConnectionFMS = 1 kSynthesizerConnectionMMgr = 2 kSynthesizerConnectionOMS = 4 kSynthesizerConnectionQT = 8 kSynthesizerConnectionOSXMIDI = 16 -kSynthesizerConnectionUnavailable = 256 +kSynthesizerConnectionUnavailable = 256 kMusicComponentType = FOUR_CHAR_CODE('musi') kInstrumentComponentType = FOUR_CHAR_CODE('inst') kSoftSynthComponentSubType = FOUR_CHAR_CODE('ss ') @@ -2976,7 +2976,7 @@ kSynthesizerSlowSetPart = 1 << 10 kSynthesizerOffline = 1 << 12 kSynthesizerGM = 1 << 14 kSynthesizerDLS = 1 << 15 -kSynthesizerSoundLocalization = 1 << 16 +kSynthesizerSoundLocalization = 1 << 16 kControllerModulationWheel = 1 kControllerBreath = 2 kControllerFoot = 4 @@ -3081,8 +3081,8 @@ kQTMSKnobReverbThresholdID = 0x0200003E kQTMSKnobVolumeAttackVelScalingID = 0x0200003F kQTMSKnobLastIDPlus1 = 0x02000040 kControllerMaximum = 0x00007FFF -# kControllerMinimum = (long)0xFFFF8000 -kVoiceCountDynamic = -1 +# kControllerMinimum = (long)0xFFFF8000 +kVoiceCountDynamic = -1 kFirstGMInstrument = 0x00000001 kLastGMInstrument = 0x00000080 kFirstGSInstrument = 0x00000081 @@ -3116,9 +3116,9 @@ kKnobTypeSetting = 6 << 12 kKnobTypeMilliseconds = 7 << 12 kKnobTypePercentage = 8 << 12 kKnobTypeHertz = 9 << 12 -kKnobTypeButton = 10 << 12 +kKnobTypeButton = 10 << 12 kUnknownKnobValue = 0x7FFFFFFF -kDefaultKnobValue = 0x7FFFFFFE +kDefaultKnobValue = 0x7FFFFFFE notImplementedMusicErr = (0x80000000 | (0xFFFF & (notImplementedMusicOSErr))) cantSendToSynthesizerErr = (0x80000000 | (0xFFFF & (cantSendToSynthesizerOSErr))) cantReceiveFromSynthesizerErr = (0x80000000 | (0xFFFF & (cantReceiveFromSynthesizerOSErr))) @@ -3142,13 +3142,13 @@ kGetAtomicInstNoSamples = kGetAtomicInstNoExpandedSamples | kGetAtomicInstNoOrig kGetAtomicInstNoKnobList = 1 << 2 kGetAtomicInstNoInstrumentInfo = 1 << 3 kGetAtomicInstOriginalKnobList = 1 << 4 -kGetAtomicInstAllKnobs = 1 << 5 +kGetAtomicInstAllKnobs = 1 << 5 kSetAtomicInstKeepOriginalInstrument = 1 << 0 kSetAtomicInstShareAcrossParts = 1 << 1 kSetAtomicInstCallerTosses = 1 << 2 kSetAtomicInstCallerGuarantees = 1 << 3 kSetAtomicInstInterruptSafe = 1 << 4 -kSetAtomicInstDontPreprocess = 1 << 7 +kSetAtomicInstDontPreprocess = 1 << 7 kInstrumentNamesModifiable = 1 kInstrumentNamesBoth = 2 kGenericMusicComponentSubtype = FOUR_CHAR_CODE('gene') @@ -3196,13 +3196,13 @@ kGenericMusicCallParts = 1 << 5 kGenericMusicCallInstrument = 1 << 6 kGenericMusicCallNumber = 1 << 7 kGenericMusicCallROMInstrument = 1 << 8 -kGenericMusicAllDefaults = 1 << 9 +kGenericMusicAllDefaults = 1 << 9 kGetInstrumentInfoNoBuiltIn = 1 << 0 kGetInstrumentInfoMidiUserInst = 1 << 1 kGetInstrumentInfoNoIText = 1 << 2 kNoteRequestNoGM = 1 kNoteRequestNoSynthType = 2 -kNoteRequestSynthMustMatch = 4 +kNoteRequestSynthMustMatch = 4 kNoteRequestSpecifyMIDIChannel = 0x80 kPickDontMix = 1 kPickSameSynth = 2 @@ -3210,11 +3210,11 @@ kPickUserInsts = 4 kPickEditAllowEdit = 8 kPickEditAllowPick = 16 kPickEditSynthGlobal = 32 -kPickEditControllers = 64 +kPickEditControllers = 64 kNoteAllocatorComponentType = FOUR_CHAR_CODE('nota') kNADummyOneSelect = 29 kNADummyTwoSelect = 30 -kTuneQueueDepth = 8 +kTuneQueueDepth = 8 kTunePlayerComponentType = FOUR_CHAR_CODE('tune') kTuneStartNow = 1 kTuneDontClipNotes = 2 @@ -3227,9 +3227,9 @@ kTuneStartNewMaster = 16384 kTuneStopFade = 1 kTuneStopSustain = 2 kTuneStopInstant = 4 -kTuneStopReleaseChannels = 8 +kTuneStopReleaseChannels = 8 kTuneMixMute = 1 -kTuneMixSolo = 2 +kTuneMixSolo = 2 kRestEventType = 0x00000000 kNoteEventType = 0x00000001 kControlEventType = 0x00000002 @@ -3347,10 +3347,10 @@ kGeneralEventMIDIChannel = 8 kGeneralEventPartChange = 9 kGeneralEventNoOp = 10 kGeneralEventUsedNotes = 11 -kGeneralEventPartMix = 12 +kGeneralEventPartMix = 12 kMarkerEventEnd = 0 kMarkerEventBeat = 1 -kMarkerEventTempo = 2 +kMarkerEventTempo = 2 kCurrentlyNativeEndian = 1 kCurrentlyNotNativeEndian = 2 kQTMIDIGetMIDIPortsSelect = 0x0001 diff --git a/Lib/plat-mac/Carbon/Resources.py b/Lib/plat-mac/Carbon/Resources.py index 8030396..2cd8761 100644 --- a/Lib/plat-mac/Carbon/Resources.py +++ b/Lib/plat-mac/Carbon/Resources.py @@ -8,7 +8,7 @@ resPreload = 4 resChanged = 2 mapReadOnly = 128 mapCompact = 64 -mapChanged = 32 +mapChanged = 32 resSysRefBit = 7 resSysHeapBit = 6 resPurgeableBit = 5 @@ -18,10 +18,10 @@ resPreloadBit = 2 resChangedBit = 1 mapReadOnlyBit = 7 mapCompactBit = 6 -mapChangedBit = 5 +mapChangedBit = 5 kResFileNotOpened = -1 -kSystemResFile = 0 +kSystemResFile = 0 kRsrcChainBelowSystemMap = 0 kRsrcChainBelowApplicationMap = 1 kRsrcChainAboveApplicationMap = 2 -kRsrcChainAboveAllMaps = 4 +kRsrcChainAboveAllMaps = 4 diff --git a/Lib/plat-mac/Carbon/Sound.py b/Lib/plat-mac/Carbon/Sound.py index ffe9efa..0e7b2fb 100644 --- a/Lib/plat-mac/Carbon/Sound.py +++ b/Lib/plat-mac/Carbon/Sound.py @@ -1,8 +1,8 @@ # Generated from 'Sound.h' def FOUR_CHAR_CODE(x): return x -soundListRsrc = FOUR_CHAR_CODE('snd ') -kSimpleBeepID = 1 +soundListRsrc = FOUR_CHAR_CODE('snd ') +kSimpleBeepID = 1 # rate48khz = (long)0xBB800000 # rate44khz = (long)0xAC440000 rate32khz = 0x7D000000 @@ -11,21 +11,21 @@ rate22khz = 0x56EE8BA3 rate16khz = 0x3E800000 rate11khz = 0x2B7745D1 rate11025hz = 0x2B110000 -rate8khz = 0x1F400000 -sampledSynth = 5 +rate8khz = 0x1F400000 +sampledSynth = 5 squareWaveSynth = 1 waveTableSynth = 3 MACE3snthID = 11 MACE6snthID = 13 -kMiddleC = 60 +kMiddleC = 60 kNoVolume = 0 -kFullVolume = 0x0100 +kFullVolume = 0x0100 stdQLength = 128 dataOffsetFlag = 0x8000 -kUseOptionalOutputDevice = -1 +kUseOptionalOutputDevice = -1 notCompressed = 0 fixedCompression = -1 -variableCompression = -2 +variableCompression = -2 twoToOne = 1 eightToThree = 2 threeToOne = 3 @@ -35,17 +35,17 @@ threeToOnePacketSize = 16 stateBlockSize = 64 leftOverBlockSize = 32 firstSoundFormat = 0x0001 -secondSoundFormat = 0x0002 +secondSoundFormat = 0x0002 dbBufferReady = 0x00000001 -dbLastBuffer = 0x00000004 +dbLastBuffer = 0x00000004 sysBeepDisable = 0x0000 sysBeepEnable = (1 << 0) -sysBeepSynchronous = (1 << 1) +sysBeepSynchronous = (1 << 1) unitTypeNoSelection = 0xFFFF unitTypeSeconds = 0x0000 stdSH = 0x00 extSH = 0xFF -cmpSH = 0xFE +cmpSH = 0xFE nullCmd = 0 quietCmd = 3 flushCmd = 4 @@ -84,7 +84,7 @@ continueCmd = 83 doubleBufferCmd = 84 getRateCmd = 85 sizeCmd = 90 -convertCmd = 91 +convertCmd = 91 waveInitChannelMask = 0x07 waveInitChannel0 = 0x04 waveInitChannel1 = 0x05 @@ -93,7 +93,7 @@ waveInitChannel3 = 0x07 initChan0 = waveInitChannel0 initChan1 = waveInitChannel1 initChan2 = waveInitChannel2 -initChan3 = waveInitChannel3 +initChan3 = waveInitChannel3 outsideCmpSH = 0 insideCmpSH = 1 aceSuccess = 0 @@ -102,7 +102,7 @@ aceNilBlock = 2 aceBadComp = 3 aceBadEncode = 4 aceBadDest = 5 -aceBadCmd = 6 +aceBadCmd = 6 initChanLeft = 0x0002 initChanRight = 0x0003 initNoInterp = 0x0004 @@ -114,7 +114,7 @@ initMACE6 = 0x0400 initPanMask = 0x0003 initSRateMask = 0x0030 initStereoMask = 0x00C0 -initCompMask = 0xFF00 +initCompMask = 0xFF00 siActiveChannels = FOUR_CHAR_CODE('chac') siActiveLevels = FOUR_CHAR_CODE('lmac') siAGCOnOff = FOUR_CHAR_CODE('agc ') @@ -200,11 +200,11 @@ siVoxStopInfo = FOUR_CHAR_CODE('voxs') siWideStereo = FOUR_CHAR_CODE('wide') siSupportedExtendedFlags = FOUR_CHAR_CODE('exfl') siRateConverterRollOffSlope = FOUR_CHAR_CODE('rcdb') -siOutputLatency = FOUR_CHAR_CODE('olte') +siOutputLatency = FOUR_CHAR_CODE('olte') siCloseDriver = FOUR_CHAR_CODE('clos') siInitializeDriver = FOUR_CHAR_CODE('init') siPauseRecording = FOUR_CHAR_CODE('paus') -siUserInterruptProc = FOUR_CHAR_CODE('user') +siUserInterruptProc = FOUR_CHAR_CODE('user') # kInvalidSource = (long)0xFFFFFFFF kNoSource = FOUR_CHAR_CODE('none') kCDSource = FOUR_CHAR_CODE('cd ') @@ -219,7 +219,7 @@ kModemSource = FOUR_CHAR_CODE('modm') kPCCardSource = FOUR_CHAR_CODE('pcm ') kZoomVideoSource = FOUR_CHAR_CODE('zvpc') kDVDSource = FOUR_CHAR_CODE('dvda') -kMicrophoneArray = FOUR_CHAR_CODE('mica') +kMicrophoneArray = FOUR_CHAR_CODE('mica') kNoSoundComponentType = FOUR_CHAR_CODE('****') kSoundComponentType = FOUR_CHAR_CODE('sift') kSoundComponentPPCType = FOUR_CHAR_CODE('nift') @@ -287,7 +287,7 @@ kOffsetBinary = k8BitOffsetBinaryFormat kTwosComplement = k16BitBigEndianFormat kLittleEndianFormat = k16BitLittleEndianFormat kMPEGLayer3Format = 0x6D730055 -kFullMPEGLay3Format = FOUR_CHAR_CODE('.mp3') +kFullMPEGLay3Format = FOUR_CHAR_CODE('.mp3') k16BitNativeEndianFormat = k16BitLittleEndianFormat k16BitNonNativeEndianFormat = k16BitBigEndianFormat k16BitNativeEndianFormat = k16BitBigEndianFormat @@ -323,8 +323,8 @@ kNonPagingMixer = (1 << 10) kSoundConverterMixer = (1 << 11) kPagingMixer = (1 << 12) kVMAwareMixer = (1 << 13) -kExtendedSoundData = (1 << 14) -kBestQuality = (1 << 0) +kExtendedSoundData = (1 << 14) +kBestQuality = (1 << 0) kInputMask = 0x000000FF kOutputMask = 0x0000FF00 kOutputShift = 8 @@ -337,7 +337,7 @@ kAudioTerminatorAtomType = 0 kAVDisplayHeadphoneRemove = 0 kAVDisplayHeadphoneInsert = 1 kAVDisplayPlainTalkRemove = 2 -kAVDisplayPlainTalkInsert = 3 +kAVDisplayPlainTalkInsert = 3 audioAllChannels = 0 audioLeftChannel = 1 audioRightChannel = 2 @@ -345,21 +345,21 @@ audioUnmuted = 0 audioMuted = 1 audioDoesMono = (1L << 0) audioDoesStereo = (1L << 1) -audioDoesIndependentChannels = (1L << 2) +audioDoesIndependentChannels = (1L << 2) siCDQuality = FOUR_CHAR_CODE('cd ') siBestQuality = FOUR_CHAR_CODE('best') siBetterQuality = FOUR_CHAR_CODE('betr') siGoodQuality = FOUR_CHAR_CODE('good') -siNoneQuality = FOUR_CHAR_CODE('none') +siNoneQuality = FOUR_CHAR_CODE('none') siDeviceIsConnected = 1 siDeviceNotConnected = 0 siDontKnowIfConnected = -1 siReadPermission = 0 -siWritePermission = 1 +siWritePermission = 1 kSoundConverterDidntFillBuffer = (1 << 0) -kSoundConverterHasLeftOverData = (1 << 1) +kSoundConverterHasLeftOverData = (1 << 1) kExtendedSoundSampleCountNotValid = 1L << 0 -kExtendedSoundBufferSizeValid = 1L << 1 +kExtendedSoundBufferSizeValid = 1L << 1 kScheduledSoundDoScheduled = 1 << 0 kScheduledSoundDoCallBack = 1 << 1 kScheduledSoundExtendedHdr = 1 << 2 diff --git a/Lib/plat-mac/Carbon/TextEdit.py b/Lib/plat-mac/Carbon/TextEdit.py index eb5fb92..176795a 100644 --- a/Lib/plat-mac/Carbon/TextEdit.py +++ b/Lib/plat-mac/Carbon/TextEdit.py @@ -7,26 +7,26 @@ teForceLeft = -2 teFlushDefault = 0 teCenter = 1 teFlushRight = -1 -teFlushLeft = -2 +teFlushLeft = -2 fontBit = 0 faceBit = 1 sizeBit = 2 clrBit = 3 addSizeBit = 4 -toggleBit = 5 +toggleBit = 5 doFont = 1 doFace = 2 doSize = 4 doColor = 8 doAll = 15 addSize = 16 -doToggle = 32 +doToggle = 32 EOLHook = 0 DRAWHook = 4 WIDTHHook = 8 HITTESTHook = 12 nWIDTHHook = 24 -TextWidthHook = 28 +TextWidthHook = 28 intEOLHook = 0 intDrawHook = 1 intWidthHook = 2 @@ -34,24 +34,24 @@ intHitTestHook = 3 intNWidthHook = 6 intTextWidthHook = 7 intInlineInputTSMTEPreUpdateHook = 8 -intInlineInputTSMTEPostUpdateHook = 9 +intInlineInputTSMTEPostUpdateHook = 9 teFAutoScroll = 0 teFTextBuffering = 1 teFOutlineHilite = 2 teFInlineInput = 3 teFUseWhiteBackground = 4 teFUseInlineInput = 5 -teFInlineInputAutoScroll = 6 -teFIdleWithEventLoopTimer = 7 +teFInlineInputAutoScroll = 6 +teFIdleWithEventLoopTimer = 7 teBitClear = 0 teBitSet = 1 -teBitTest = -1 +teBitTest = -1 teWordSelect = 4 teWordDrag = 8 teFromFind = 12 -teFromRecal = 16 +teFromRecal = 16 teFind = 0 teHighlight = 1 teDraw = -1 -teCaret = -2 -teFUseTextServices = 4 +teCaret = -2 +teFUseTextServices = 4 diff --git a/Lib/plat-mac/Carbon/Windows.py b/Lib/plat-mac/Carbon/Windows.py index af8eaf2..b09d537 100644 --- a/Lib/plat-mac/Carbon/Windows.py +++ b/Lib/plat-mac/Carbon/Windows.py @@ -44,7 +44,7 @@ kWindowStandardFloatingAttributes = (kWindowCloseBoxAttribute | kWindowCollapseB kWindowDefProcType = FOUR_CHAR_CODE('WDEF') kStandardWindowDefinition = 0 kRoundWindowDefinition = 1 -kFloatingWindowDefinition = 124 +kFloatingWindowDefinition = 124 kDocumentWindowVariantCode = 0 kModalDialogVariantCode = 1 kPlainDialogVariantCode = 2 @@ -109,7 +109,7 @@ kWindowFloatSideHorizZoomGrowProc = 1083 kWindowFloatSideFullZoomProc = 1085 kWindowFloatSideFullZoomGrowProc = 1087 kWindowSheetProc = 1088 -kWindowSheetAlertProc = 1120 +kWindowSheetAlertProc = 1120 kWindowSimpleProc = 1104 kWindowSimpleFrameProc = 1105 kWindowNoPosition = 0x0000 @@ -145,7 +145,7 @@ kWindowStructureRgn = 32 kWindowContentRgn = 33 kWindowUpdateRgn = 34 kWindowOpaqueRgn = 35 -kWindowGlobalPortRgn = 40 +kWindowGlobalPortRgn = 40 dialogKind = 2 userKind = 8 kDialogWindowKind = 2 @@ -163,7 +163,7 @@ inZoomOut = 8 inCollapseBox = 11 inProxyIcon = 12 inToolbarButton = 13 -inStructure = 15 +inStructure = 15 wNoHit = 0 wInContent = 1 wInDrag = 2 @@ -174,7 +174,7 @@ wInZoomOut = 6 wInCollapseBox = 9 wInProxyIcon = 10 wInToolbarButton = 11 -wInStructure = 13 +wInStructure = 13 kWindowMsgDraw = 0 kWindowMsgHitTest = 1 kWindowMsgCalculateShape = 2 @@ -189,8 +189,8 @@ kWindowMsgModified = 10 kWindowMsgDrawInCurrentPort = 11 kWindowMsgSetupProxyDragImage = 12 kWindowMsgStateChanged = 13 -kWindowMsgMeasureTitle = 14 -kWindowMsgGetGrowImageRegion = 19 +kWindowMsgMeasureTitle = 14 +kWindowMsgGetGrowImageRegion = 19 wDraw = 0 wHit = 1 wCalcRgns = 2 @@ -214,7 +214,7 @@ kWindowCanMeasureTitle = (1 << 11) kWindowWantsDisposeAtProcessDeath = (1 << 12) kWindowSupportsGetGrowImageRegion = (1 << 13) kWindowDefSupportsColorGrafPort = 0x40000002 -kWindowIsOpaque = (1 << 14) +kWindowIsOpaque = (1 << 14) kWindowSupportsSetGrowImageRegion = (1 << 13) deskPatID = 16 wContentColor = 0 @@ -228,10 +228,10 @@ kWindowDefinitionVersionTwo = 2 kWindowIsCollapsedState = (1 << 0L) kStoredWindowSystemTag = FOUR_CHAR_CODE('appl') kStoredBasicWindowDescriptionID = FOUR_CHAR_CODE('sbas') -kStoredWindowPascalTitleID = FOUR_CHAR_CODE('s255') +kStoredWindowPascalTitleID = FOUR_CHAR_CODE('s255') kWindowDefProcPtr = 0 kWindowDefObjectClass = 1 -kWindowDefProcID = 2 +kWindowDefProcID = 2 kWindowModalityNone = 0 kWindowModalitySystemModal = 1 kWindowModalityAppModal = 2 @@ -252,7 +252,7 @@ kWindowGroupContentsVisible = 1 << 2 kWindowPaintProcOptionsNone = 0 kScrollWindowNoOptions = 0 kScrollWindowInvalidate = (1L << 0) -kScrollWindowEraseToPortBackground = (1L << 1) +kScrollWindowEraseToPortBackground = (1L << 1) kWindowMenuIncludeRotate = 1 << 0 kWindowZoomTransitionEffect = 1 kWindowSheetTransitionEffect = 2 @@ -273,7 +273,7 @@ kWindowLatentVisibleFullScreen = 1 << 2 kWindowLatentVisibleAppHidden = 1 << 3 kWindowLatentVisibleCollapsedOwner = 1 << 4 kWindowLatentVisibleCollapsedGroup = 1 << 5 -kWindowPropertyPersistent = 0x00000001 +kWindowPropertyPersistent = 0x00000001 kWindowGroupAttrSelectable = kWindowGroupAttrSelectAsLayer kWindowGroupAttrPositionFixed = kWindowGroupAttrMoveTogether kWindowGroupAttrZOrderFixed = kWindowGroupAttrLayerTogether diff --git a/Lib/plat-mac/Carbon/__init__.py b/Lib/plat-mac/Carbon/__init__.py index d0cfec3..8018c18 100644 --- a/Lib/plat-mac/Carbon/__init__.py +++ b/Lib/plat-mac/Carbon/__init__.py @@ -1,4 +1,4 @@ # Filter out warnings about signed/unsigned constants import warnings warnings.filterwarnings("ignore", "", FutureWarning, ".*Controls") -warnings.filterwarnings("ignore", "", FutureWarning, ".*MacTextEditor")
\ No newline at end of file +warnings.filterwarnings("ignore", "", FutureWarning, ".*MacTextEditor") diff --git a/Lib/plat-mac/EasyDialogs.py b/Lib/plat-mac/EasyDialogs.py index 13df7f3..c622d30 100644 --- a/Lib/plat-mac/EasyDialogs.py +++ b/Lib/plat-mac/EasyDialogs.py @@ -373,22 +373,22 @@ ARGV_CMDLINE_DATA=14 ## MacOS.HandleEvent(ev) ## def _setmenu(control, items): - mhandle = control.GetControlData_Handle(Controls.kControlMenuPart, - Controls.kControlPopupButtonMenuHandleTag) - menu = Menu.as_Menu(mhandle) - for item in items: - if type(item) == type(()): - label = item[0] - else: - label = item - if label[-1] == '=' or label[-1] == ':': - label = label[:-1] - menu.AppendMenu(label) + mhandle = control.GetControlData_Handle(Controls.kControlMenuPart, + Controls.kControlPopupButtonMenuHandleTag) + menu = Menu.as_Menu(mhandle) + for item in items: + if type(item) == type(()): + label = item[0] + else: + label = item + if label[-1] == '=' or label[-1] == ':': + label = label[:-1] + menu.AppendMenu(label) ## mhandle, mid = menu.getpopupinfo() ## control.SetControlData_Handle(Controls.kControlMenuPart, ## Controls.kControlPopupButtonMenuHandleTag, mhandle) - control.SetControlMinimum(1) - control.SetControlMaximum(len(items)+1) + control.SetControlMinimum(1) + control.SetControlMaximum(len(items)+1) def _selectoption(d, optionlist, idx): if idx < 0 or idx >= len(optionlist): @@ -836,4 +836,3 @@ if __name__ == '__main__': test() except KeyboardInterrupt: Message("Operation Canceled.") - diff --git a/Lib/plat-mac/FrameWork.py b/Lib/plat-mac/FrameWork.py index 7242704..0a8c1b8 100644 --- a/Lib/plat-mac/FrameWork.py +++ b/Lib/plat-mac/FrameWork.py @@ -635,7 +635,7 @@ class Menu: if self._parent: self._parent.menu.DisableMenuItem(self._parent_item) if self.bar and self.bar.parent: - self.bar.parent.needmenubarredraw = 1 + self.bar.parent.needmenubarredraw = 1 class PopupMenu(Menu): def __init__(self, bar): diff --git a/Lib/plat-mac/MiniAEFrame.py b/Lib/plat-mac/MiniAEFrame.py index 3c5ed9a..98247cb 100644 --- a/Lib/plat-mac/MiniAEFrame.py +++ b/Lib/plat-mac/MiniAEFrame.py @@ -59,9 +59,9 @@ class MiniApplication: self.quitting = 1 def dooneevent(self, mask = everyEvent, timeout = 60*60): - got, event = Evt.WaitNextEvent(mask, timeout) - if got: - self.lowlevelhandler(event) + got, event = Evt.WaitNextEvent(mask, timeout) + if got: + self.lowlevelhandler(event) def lowlevelhandler(self, event): what, message, when, where, modifiers = event diff --git a/Lib/plat-mac/PixMapWrapper.py b/Lib/plat-mac/PixMapWrapper.py index a2d13fe..7edbac2 100644 --- a/Lib/plat-mac/PixMapWrapper.py +++ b/Lib/plat-mac/PixMapWrapper.py @@ -1,5 +1,5 @@ """PixMapWrapper - defines the PixMapWrapper class, which wraps an opaque -QuickDraw PixMap data structure in a handy Python class. Also provides +QuickDraw PixMap data structure in a handy Python class. Also provides methods to convert to/from pixel data (from, e.g., the img module) or a Python Imaging Library Image object. @@ -77,7 +77,7 @@ class PixMapWrapper: 2, 5, # cmpCount, cmpSize, 0, 0, 0) # planeBytes, pmTable, pmReserved self.__dict__['_pm'] = Qd.RawBitMap(self._header) - + def _stuff(self, element, bytes): offset = _pmElemOffset[element] fmt = _pmElemFormat[element] @@ -85,7 +85,7 @@ class PixMapWrapper: + struct.pack(fmt, bytes) \ + self._header[offset + struct.calcsize(fmt):] self.__dict__['_pm'] = None - + def _unstuff(self, element): offset = _pmElemOffset[element] fmt = _pmElemFormat[element] @@ -113,7 +113,7 @@ class PixMapWrapper: # any other pm attribute -- just stuff self._stuff(attr, val) else: - self.__dict__[attr] = val + self.__dict__[attr] = val def __getattr__(self, attr): if attr == 'rowBytes': @@ -133,9 +133,9 @@ class PixMapWrapper: # any other pm attribute -- just unstuff return self._unstuff(attr) else: - return self.__dict__[attr] + return self.__dict__[attr] + - def PixMap(self): "Return a QuickDraw PixMap corresponding to this data." if not self.__dict__['_pm']: @@ -143,7 +143,7 @@ class PixMapWrapper: return self.__dict__['_pm'] def blit(self, x1=0,y1=0,x2=None,y2=None, port=None): - """Draw this pixmap into the given (default current) grafport.""" + """Draw this pixmap into the given (default current) grafport.""" src = self.bounds dest = [x1,y1,x2,y2] if x2 == None: @@ -153,7 +153,7 @@ class PixMapWrapper: if not port: port = Qd.GetPort() Qd.CopyBits(self.PixMap(), port.GetPortBitMapForCopyBits(), src, tuple(dest), QuickDraw.srcCopy, None) - + def fromstring(self,s,width,height,format=imgformat.macrgb): """Stuff this pixmap with raw pixel data from a string. Supply width, height, and one of the imgformat specifiers.""" @@ -188,7 +188,7 @@ class PixMapWrapper: """Initialize this PixMap from a PIL Image object.""" # We need data in ARGB format; PIL can't currently do that, # but it can do RGBA, which we can use by inserting one null - # up frontpm = + # up frontpm = if im.mode != 'RGBA': im = im.convert('RGBA') data = chr(0) + im.tostring() self.fromstring(data, im.size[0], im.size[1]) @@ -212,4 +212,3 @@ def test(): pm.fromImage( Image.open(path) ) pm.blit(20,20) return pm - diff --git a/Lib/plat-mac/aepack.py b/Lib/plat-mac/aepack.py index 22dfd21..529a0a4 100644 --- a/Lib/plat-mac/aepack.py +++ b/Lib/plat-mac/aepack.py @@ -74,16 +74,16 @@ def packkey(ae, key, value): def pack(x, forcetype = None): """Pack a python object into an AE descriptor""" - + if forcetype: if type(x) is StringType: return AE.AECreateDesc(forcetype, x) else: return pack(x).AECoerceDesc(forcetype) - + if x == None: return AE.AECreateDesc('null', '') - + if isinstance(x, AEDescType): return x if isinstance(x, FSSType): @@ -128,11 +128,11 @@ def pack(x, forcetype = None): def unpack(desc, formodulename=""): """Unpack an AE descriptor to a python object""" t = desc.type - + if unpacker_coercions.has_key(t): desc = desc.AECoerceDesc(unpacker_coercions[t]) t = desc.type # This is a guess by Jack.... - + if t == typeAEList: l = [] for i in range(desc.AECountItems()): @@ -248,7 +248,7 @@ def unpack(desc, formodulename=""): record = desc.AECoerceDesc('reco') return mklogical(unpack(record, formodulename)) return mkunknown(desc.type, desc.data) - + def coerce(data, egdata): """Coerce a python object to another type using the AE coercers""" pdata = pack(data) @@ -311,10 +311,10 @@ def mklogical(dict): def mkstyledtext(dict): return aetypes.StyledText(dict['ksty'], dict['ktxt']) - + def mkaetext(dict): return aetypes.AEText(dict[keyAEScriptTag], dict[keyAEStyles], dict[keyAEText]) - + def mkinsertionloc(dict): return aetypes.InsertionLoc(dict[keyAEObject], dict[keyAEPosition]) @@ -355,7 +355,7 @@ def mkobjectfrommodule(dict, modulename): assert issubclass(classtype, ObjectSpecifier) newobj.__class__ = classtype return newobj - + def mktype(typecode, modulename=None): if modulename: module = __import__(modulename) diff --git a/Lib/plat-mac/aetools.py b/Lib/plat-mac/aetools.py index 347b523..79f3978 100644 --- a/Lib/plat-mac/aetools.py +++ b/Lib/plat-mac/aetools.py @@ -113,7 +113,7 @@ def keysubst(arguments, keydict): arguments[keydict[k]] = v elif k != '----' and k not in ok: raise TypeError, 'Unknown keyword argument: %s'%k - + def enumsubst(arguments, key, edict): """Substitute a single enum keyword argument, if it occurs""" if not arguments.has_key(key) or edict is None: @@ -124,7 +124,7 @@ def enumsubst(arguments, key, edict): arguments[key] = Enum(edict[v]) elif not v in ok: raise TypeError, 'Unknown enumerator: %s'%v - + def decodeerror(arguments): """Create the 'best' argument for a raise MacOS.Error""" errn = arguments['errn'] @@ -137,7 +137,7 @@ def decodeerror(arguments): err_a3 = arguments['erob'] else: err_a3 = None - + return (err_a1, err_a2, err_a3) class TalkTo: @@ -146,7 +146,7 @@ class TalkTo: _moduleName = None # Can be overridden by subclasses _elemdict = {} # Can be overridden by subclasses _propdict = {} # Can be overridden by subclasses - + __eventloop_initialized = 0 def __ensure_WMAvailable(klass): if klass.__eventloop_initialized: return 1 @@ -156,10 +156,10 @@ class TalkTo: Evt.WaitNextEvent(0,0) return 1 __ensure_WMAvailable = classmethod(__ensure_WMAvailable) - + def __init__(self, signature=None, start=0, timeout=0): """Create a communication channel with a particular application. - + Addressing the application is done by specifying either a 4-byte signature, an AEDesc or an object that will __aepack__ to an AEDesc. @@ -184,7 +184,7 @@ class TalkTo: self.send_timeout = AppleEvents.kAEDefaultTimeout if start: self._start() - + def _start(self): """Start the application, if it is not running yet""" try: @@ -199,19 +199,19 @@ class TalkTo: else: break time.sleep(1) - + def start(self): """Deprecated, used _start()""" self._start() - + def newevent(self, code, subcode, parameters = {}, attributes = {}): """Create a complete structure for an apple event""" - + event = AE.AECreateAppleEvent(code, subcode, self.target, AppleEvents.kAutoGenerateReturnID, AppleEvents.kAnyTransactionID) packevent(event, parameters, attributes) return event - + def sendevent(self, event): """Send a pre-created appleevent, await the reply and unpack it""" if not self.__ensure_WMAvailable(): @@ -220,11 +220,11 @@ class TalkTo: self.send_timeout) parameters, attributes = unpackevent(reply, self._moduleName) return reply, parameters, attributes - + def send(self, code, subcode, parameters = {}, attributes = {}): """Send an appleevent given code/subcode/pars/attrs and unpack the reply""" return self.sendevent(self.newevent(code, subcode, parameters, attributes)) - + # # The following events are somehow "standard" and don't seem to appear in any # suite... @@ -256,9 +256,9 @@ class TalkTo: if as: item.__class__ = as return item - + get = _get - + _argmap_set = { 'to' : 'data', } @@ -283,12 +283,12 @@ class TalkTo: # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] - + set = _set # Magic glue to allow suite-generated classes to function somewhat # like the "application" class in OSA. - + def __getattr__(self, name): if self._elemdict.has_key(name): cls = self._elemdict[name] @@ -297,7 +297,7 @@ class TalkTo: cls = self._propdict[name] return cls() raise AttributeError, name - + # Tiny Finder class, for local use only class _miniFinder(TalkTo): @@ -321,7 +321,7 @@ class _miniFinder(TalkTo): if _arguments.has_key('----'): return _arguments['----'] #pass - + _finder = _miniFinder('MACS') def _launch(appfile): @@ -332,12 +332,12 @@ def _launch(appfile): class _application_file(ComponentItem): """application file - An application's file on disk""" want = 'appf' - + _application_file._propdict = { } _application_file._elemdict = { } - + # Test program # XXXX Should test more, really... diff --git a/Lib/plat-mac/aetypes.py b/Lib/plat-mac/aetypes.py index b9386f3..c60b39c 100644 --- a/Lib/plat-mac/aetypes.py +++ b/Lib/plat-mac/aetypes.py @@ -12,7 +12,7 @@ import string def pack(*args, **kwargs): from aepack import pack return pack( *args, **kwargs) - + def nice(s): """'nice' representation of an object""" if type(s) is StringType: return repr(s) @@ -20,29 +20,29 @@ def nice(s): class Unknown: """An uninterpreted AE object""" - + def __init__(self, type, data): self.type = type self.data = data - + def __repr__(self): return "Unknown(%r, %r)" % (self.type, self.data) - + def __aepack__(self): return pack(self.data, self.type) class Enum: """An AE enumeration value""" - + def __init__(self, enum): self.enum = "%-4.4s" % str(enum) - + def __repr__(self): return "Enum(%r)" % (self.enum,) - + def __str__(self): return string.strip(self.enum) - + def __aepack__(self): return pack(self.enum, typeEnumeration) @@ -58,36 +58,36 @@ class InsertionLoc: def __init__(self, of, pos): self.of = of self.pos = pos - + def __repr__(self): return "InsertionLoc(%r, %r)" % (self.of, self.pos) - + def __aepack__(self): rec = {'kobj': self.of, 'kpos': self.pos} return pack(rec, forcetype='insl') - + # Convenience functions for dsp: def beginning(of): return InsertionLoc(of, Enum('bgng')) - + def end(of): return InsertionLoc(of, Enum('end ')) class Boolean: """An AE boolean value""" - + def __init__(self, bool): self.bool = (not not bool) - + def __repr__(self): return "Boolean(%r)" % (self.bool,) - + def __str__(self): if self.bool: return "True" else: return "False" - + def __aepack__(self): return pack(struct.pack('b', self.bool), 'bool') @@ -100,16 +100,16 @@ def mkboolean(bool): class Type: """An AE 4-char typename object""" - + def __init__(self, type): self.type = "%-4.4s" % str(type) - + def __repr__(self): return "Type(%r)" % (self.type,) - + def __str__(self): return string.strip(self.type) - + def __aepack__(self): return pack(self.type, typeType) @@ -123,16 +123,16 @@ def mktype(type): class Keyword: """An AE 4-char keyword object""" - + def __init__(self, keyword): self.keyword = "%-4.4s" % str(keyword) - + def __repr__(self): return "Keyword(%r)" % `self.keyword` - + def __str__(self): return string.strip(self.keyword) - + def __aepack__(self): return pack(self.keyword, typeKeyword) @@ -141,17 +141,17 @@ def IsKeyword(x): class Range: """An AE range object""" - + def __init__(self, start, stop): self.start = start self.stop = stop - + def __repr__(self): return "Range(%r, %r)" % (self.start, self.stop) - + def __str__(self): return "%s thru %s" % (nice(self.start), nice(self.stop)) - + def __aepack__(self): return pack({'star': self.start, 'stop': self.stop}, 'rang') @@ -160,18 +160,18 @@ def IsRange(x): class Comparison: """An AE Comparison""" - + def __init__(self, obj1, relo, obj2): self.obj1 = obj1 self.relo = "%-4.4s" % str(relo) self.obj2 = obj2 - + def __repr__(self): return "Comparison(%r, %r, %r)" % (self.obj1, self.relo, self.obj2) - + def __str__(self): return "%s %s %s" % (nice(self.obj1), string.strip(self.relo), nice(self.obj2)) - + def __aepack__(self): return pack({'obj1': self.obj1, 'relo': mkenum(self.relo), @@ -180,48 +180,48 @@ class Comparison: def IsComparison(x): return isinstance(x, Comparison) - + class NComparison(Comparison): # The class attribute 'relo' must be set in a subclass - + def __init__(self, obj1, obj2): Comparison.__init__(obj1, self.relo, obj2) class Ordinal: """An AE Ordinal""" - + def __init__(self, abso): # self.obj1 = obj1 self.abso = "%-4.4s" % str(abso) - + def __repr__(self): return "Ordinal(%r)" % (self.abso,) - + def __str__(self): return "%s" % (string.strip(self.abso)) - + def __aepack__(self): return pack(self.abso, 'abso') def IsOrdinal(x): return isinstance(x, Ordinal) - + class NOrdinal(Ordinal): # The class attribute 'abso' must be set in a subclass - + def __init__(self): Ordinal.__init__(self, self.abso) class Logical: """An AE logical expression object""" - + def __init__(self, logc, term): self.logc = "%-4.4s" % str(logc) self.term = term - + def __repr__(self): return "Logical(%r, %r)" % (self.logc, self.term) - + def __str__(self): if type(self.term) == ListType and len(self.term) == 2: return "%s %s %s" % (nice(self.term[0]), @@ -229,7 +229,7 @@ class Logical: nice(self.term[1])) else: return "%s(%s)" % (string.strip(self.logc), nice(self.term)) - + def __aepack__(self): return pack({'logc': mkenum(self.logc), 'term': self.term}, 'logi') @@ -238,17 +238,17 @@ def IsLogical(x): class StyledText: """An AE object respresenting text in a certain style""" - + def __init__(self, style, text): self.style = style self.text = text - + def __repr__(self): return "StyledText(%r, %r)" % (self.style, self.text) - + def __str__(self): return self.text - + def __aepack__(self): return pack({'ksty': self.style, 'ktxt': self.text}, 'STXT') @@ -257,18 +257,18 @@ def IsStyledText(x): class AEText: """An AE text object with style, script and language specified""" - + def __init__(self, script, style, text): self.script = script self.style = style self.text = text - + def __repr__(self): return "AEText(%r, %r, %r)" % (self.script, self.style, self.text) - + def __str__(self): return self.text - + def __aepack__(self): return pack({keyAEScriptTag: self.script, keyAEStyles: self.style, keyAEText: self.text}, typeAEText) @@ -278,18 +278,18 @@ def IsAEText(x): class IntlText: """A text object with script and language specified""" - + def __init__(self, script, language, text): self.script = script self.language = language self.text = text - + def __repr__(self): return "IntlText(%r, %r, %r)" % (self.script, self.language, self.text) - + def __str__(self): return self.text - + def __aepack__(self): return pack(struct.pack('hh', self.script, self.language)+self.text, typeIntlText) @@ -299,17 +299,17 @@ def IsIntlText(x): class IntlWritingCode: """An object representing script and language""" - + def __init__(self, script, language): self.script = script self.language = language - + def __repr__(self): return "IntlWritingCode(%r, %r)" % (self.script, self.language) - + def __str__(self): return "script system %d, language %d"%(self.script, self.language) - + def __aepack__(self): return pack(struct.pack('hh', self.script, self.language), typeIntlWritingCode) @@ -319,17 +319,17 @@ def IsIntlWritingCode(x): class QDPoint: """A point""" - + def __init__(self, v, h): self.v = v self.h = h - + def __repr__(self): return "QDPoint(%r, %r)" % (self.v, self.h) - + def __str__(self): return "(%d, %d)"%(self.v, self.h) - + def __aepack__(self): return pack(struct.pack('hh', self.v, self.h), typeQDPoint) @@ -339,19 +339,19 @@ def IsQDPoint(x): class QDRectangle: """A rectangle""" - + def __init__(self, v0, h0, v1, h1): self.v0 = v0 self.h0 = h0 self.v1 = v1 self.h1 = h1 - + def __repr__(self): return "QDRectangle(%r, %r, %r, %r)" % (self.v0, self.h0, self.v1, self.h1) - + def __str__(self): return "(%d, %d)-(%d, %d)"%(self.v0, self.h0, self.v1, self.h1) - + def __aepack__(self): return pack(struct.pack('hhhh', self.v0, self.h0, self.v1, self.h1), typeQDRectangle) @@ -361,18 +361,18 @@ def IsQDRectangle(x): class RGBColor: """An RGB color""" - + def __init__(self, r, g, b): self.r = r self.g = g self.b = b - + def __repr__(self): return "RGBColor(%r, %r, %r)" % (self.r, self.g, self.b) - + def __str__(self): return "0x%x red, 0x%x green, 0x%x blue"% (self.r, self.g, self.b) - + def __aepack__(self): return pack(struct.pack('hhh', self.r, self.g, self.b), typeRGBColor) @@ -381,36 +381,36 @@ def IsRGBColor(x): return isinstance(x, RGBColor) class ObjectSpecifier: - + """A class for constructing and manipulation AE object specifiers in python. - + An object specifier is actually a record with four fields: - + key type description --- ---- ----------- - + 'want' type 4-char class code of thing we want, e.g. word, paragraph or property - + 'form' enum how we specify which 'want' thing(s) we want, e.g. by index, by range, by name, or by property specifier - + 'seld' any which thing(s) we want, e.g. its index, its name, or its property specifier - + 'from' object the object in which it is contained, or null, meaning look for it in the application - + Note that we don't call this class plain "Object", since that name is likely to be used by the application. """ - + def __init__(self, want, form, seld, fr = None): self.want = want self.form = form self.seld = seld self.fr = fr - + def __repr__(self): s = "ObjectSpecifier(%r, %r, %r" % (self.want, self.form, self.seld) if self.fr: @@ -418,7 +418,7 @@ class ObjectSpecifier: else: s = s + ")" return s - + def __aepack__(self): return pack({'want': mktype(self.want), 'form': mkenum(self.form), @@ -441,7 +441,7 @@ class Property(ObjectSpecifier): return "Property(%r, %r)" % (self.seld.type, self.fr) else: return "Property(%r)" % (self.seld.type,) - + def __str__(self): if self.fr: return "Property %s of %s" % (str(self.seld), str(self.fr)) @@ -460,7 +460,7 @@ class NProperty(ObjectSpecifier): #except: # self.want = 'prop' self.want = 'prop' - ObjectSpecifier.__init__(self, self.want, 'prop', + ObjectSpecifier.__init__(self, self.want, 'prop', mktype(self.which), fr) def __repr__(self): @@ -470,7 +470,7 @@ class NProperty(ObjectSpecifier): if self.want != 'prop': rv = rv + ", want=%r" % (self.want,) return rv + ")" - + def __str__(self): if self.fr: return "Property %s of %s" % (str(self.seld), str(self.fr)) @@ -479,7 +479,7 @@ class NProperty(ObjectSpecifier): class SelectableItem(ObjectSpecifier): - + def __init__(self, want, seld, fr = None): t = type(seld) if t == StringType: @@ -506,12 +506,12 @@ class ComponentItem(SelectableItem): _elemdict = {} def __init__(self, which, fr = None): SelectableItem.__init__(self, self.want, which, fr) - + def __repr__(self): if not self.fr: return "%s(%r)" % (self.__class__.__name__, self.seld) return "%s(%r, %r)" % (self.__class__.__name__, self.seld, self.fr) - + def __str__(self): seld = self.seld if type(seld) == StringType: @@ -528,7 +528,7 @@ class ComponentItem(SelectableItem): s = "%s %s" % (self.__class__.__name__, ss) if self.fr: s = s + " of %s" % str(self.fr) return s - + def __getattr__(self, name): if self._elemdict.has_key(name): cls = self._elemdict[name] @@ -537,19 +537,19 @@ class ComponentItem(SelectableItem): cls = self._propdict[name] return cls(self) raise AttributeError, name - - + + class DelayedComponentItem: def __init__(self, compclass, fr): self.compclass = compclass self.fr = fr - + def __call__(self, which): return self.compclass(which, self.fr) - + def __repr__(self): return "%s(???, %r)" % (self.__class__.__name__, self.fr) - + def __str__(self): return "selector for element %s of %s"%(self.__class__.__name__, str(self.fr)) @@ -566,4 +566,3 @@ exec template % ("Window", 'cwin') exec template % ("Document", 'docu') exec template % ("File", 'file') exec template % ("InsertionPoint", 'cins') - diff --git a/Lib/plat-mac/applesingle.py b/Lib/plat-mac/applesingle.py index adbce0c..7bbe8af 100644 --- a/Lib/plat-mac/applesingle.py +++ b/Lib/plat-mac/applesingle.py @@ -78,7 +78,7 @@ class AppleSingle(object): self.datafork = data elif restype == AS_RESOURCEFORK: self.resourcefork = data - + def tofile(self, path, resonly=False): outfile = open(path, 'wb') data = False @@ -99,15 +99,15 @@ class AppleSingle(object): fp = MacOS.openrf(path, '*wb') fp.write(self.resourcefork) fp.close() - + def decode(infile, outpath, resonly=False, verbose=False): """decode(infile, outpath [, resonly=False, verbose=False]) Creates a decoded file from an AppleSingle encoded file. - If resonly is True, then it will create a regular file at + If resonly is True, then it will create a regular file at outpath containing only the resource fork from infile. Otherwise it will create an AppleDouble file at outpath - with the data and resource forks from infile. On platforms + with the data and resource forks from infile. On platforms without the MacOS module, it will create inpath and inpath+'.rsrc' with the data and resource forks respectively. @@ -121,7 +121,7 @@ def decode(infile, outpath, resonly=False, verbose=False): as = AppleSingle(infile, verbose=verbose) as.tofile(outpath, resonly=resonly) - + def _test(): if len(sys.argv) < 3 or sys.argv[1] == '-r' and len(sys.argv) != 4: print 'Usage: applesingle.py [-r] applesinglefile decodedfile' @@ -132,6 +132,6 @@ def _test(): else: resonly = False decode(sys.argv[1], sys.argv[2], resonly=resonly) - + if __name__ == '__main__': _test() diff --git a/Lib/plat-mac/appletrawmain.py b/Lib/plat-mac/appletrawmain.py index 88259c1..1be9187 100644 --- a/Lib/plat-mac/appletrawmain.py +++ b/Lib/plat-mac/appletrawmain.py @@ -23,7 +23,7 @@ else: _dir = os.path.split(sys.argv[0])[0] # # Add the Resources directory to the path. This is where files installed -# by BuildApplet.py with the --extra option show up, and if those files are +# by BuildApplet.py with the --extra option show up, and if those files are # modules this sys.path modification is necessary to be able to import them. # sys.path.insert(0, _dir) diff --git a/Lib/plat-mac/bgenlocations.py b/Lib/plat-mac/bgenlocations.py index 19e1f02..e7fa354 100644 --- a/Lib/plat-mac/bgenlocations.py +++ b/Lib/plat-mac/bgenlocations.py @@ -31,13 +31,13 @@ TOOLBOXDIR="/Users/jack/src/python/Lib/plat-mac/Carbon" # Creator for C files: CREATOR="CWIE" -# The previous definitions can be overriden by creating a module -# bgenlocationscustomize.py and putting it in site-packages (or anywere else +# The previous definitions can be overriden by creating a module +# bgenlocationscustomize.py and putting it in site-packages (or anywere else # on sys.path, actually) try: - from bgenlocationscustomize import * + from bgenlocationscustomize import * except ImportError: - pass + pass if not os.path.exists(BGENDIR): raise Error, "Please fix bgenlocations.py, BGENDIR does not exist: %s" % BGENDIR @@ -45,7 +45,7 @@ if not os.path.exists(INCLUDEDIR): raise Error, "Please fix bgenlocations.py, INCLUDEDIR does not exist: %s" % INCLUDEDIR if not os.path.exists(TOOLBOXDIR): raise Error, "Please fix bgenlocations.py, TOOLBOXDIR does not exist: %s" % TOOLBOXDIR - + # Sigh, due to the way these are used make sure they end with : or /. if BGENDIR[-1] != os.sep: BGENDIR = BGENDIR + os.sep @@ -53,4 +53,3 @@ if INCLUDEDIR[-1] != os.sep: INCLUDEDIR = INCLUDEDIR + os.sep if TOOLBOXDIR[-1] != os.sep: TOOLBOXDIR = TOOLBOXDIR + os.sep - diff --git a/Lib/plat-mac/buildtools.py b/Lib/plat-mac/buildtools.py index 365772a..17e4076 100644 --- a/Lib/plat-mac/buildtools.py +++ b/Lib/plat-mac/buildtools.py @@ -58,10 +58,10 @@ def findtemplate(template=None): raise BuildError, "Template %r not found on sys.path" % (template,) file = file.as_pathname() return file - -def process(template, filename, destname, copy_codefragment=0, + +def process(template, filename, destname, copy_codefragment=0, rsrcname=None, others=[], raw=0, progress="default"): - + if progress == "default": progress = EasyDialogs.ProgressBar("Processing %s..."%os.path.split(filename)[1], 120) progress.label("Compiling...") @@ -72,7 +72,7 @@ def process(template, filename, destname, copy_codefragment=0, raise BuildError, "BuildApplet could destroy your sourcefile on OSX, please rename: %s" % filename # Read the source and compile it # (there's no point overwriting the destination if it has a syntax error) - + fp = open(filename, 'rU') text = fp.read() fp.close() @@ -82,17 +82,17 @@ def process(template, filename, destname, copy_codefragment=0, raise BuildError, "Syntax error in script %s: %s" % (filename, arg) except EOFError: raise BuildError, "End-of-file in script %s" % (filename,) - + # Set the destination file name. Note that basename # does contain the whole filepath, only a .py is stripped. - + if string.lower(filename[-3:]) == ".py": basename = filename[:-3] if MacOS.runtimemodel != 'macho' and not destname: destname = basename else: basename = filename - + if not destname: if MacOS.runtimemodel == 'macho': destname = basename + '.app' @@ -100,16 +100,16 @@ def process(template, filename, destname, copy_codefragment=0, destname = basename + '.applet' if not rsrcname: rsrcname = basename + '.rsrc' - + # Try removing the output file. This fails in MachO, but it should # do any harm. try: os.remove(destname) except os.error: pass - process_common(template, progress, code, rsrcname, destname, 0, + process_common(template, progress, code, rsrcname, destname, 0, copy_codefragment, raw, others, filename) - + def update(template, filename, output): if MacOS.runtimemodel == 'macho': @@ -120,7 +120,7 @@ def update(template, filename, output): progress = None if not output: output = filename + ' (updated)' - + # Try removing the output file try: os.remove(output) @@ -129,7 +129,7 @@ def update(template, filename, output): process_common(template, progress, None, filename, output, 1, 1) -def process_common(template, progress, code, rsrcname, destname, is_update, +def process_common(template, progress, code, rsrcname, destname, is_update, copy_codefragment, raw=0, others=[], filename=None): if MacOS.runtimemodel == 'macho': return process_common_macho(template, progress, code, rsrcname, destname, @@ -139,12 +139,12 @@ def process_common(template, progress, code, rsrcname, destname, is_update, # Create FSSpecs for the various files template_fsr, d1, d2 = Carbon.File.FSResolveAliasFile(template, 1) template = template_fsr.as_pathname() - + # Copy data (not resources, yet) from the template if progress: progress.label("Copy data fork...") progress.set(10) - + if copy_codefragment: tmpl = open(template, "rb") dest = open(destname, "wb") @@ -155,9 +155,9 @@ def process_common(template, progress, code, rsrcname, destname, is_update, tmpl.close() del dest del tmpl - + # Open the output resource fork - + if progress: progress.label("Copy resources...") progress.set(20) @@ -167,7 +167,7 @@ def process_common(template, progress, code, rsrcname, destname, is_update, destdir, destfile = os.path.split(destname) Res.FSCreateResourceFile(destdir, unicode(destfile), RESOURCE_FORK_NAME) output = Res.FSOpenResourceFile(destname, RESOURCE_FORK_NAME, WRITE) - + # Copy the resources from the target specific resource template, if any typesfound, ownertype = [], None try: @@ -183,27 +183,27 @@ def process_common(template, progress, code, rsrcname, destname, is_update, skip_oldfile = [] typesfound, ownertype = copyres(input, output, skip_oldfile, 0, progress) Res.CloseResFile(input) - + # Check which resource-types we should not copy from the template skiptypes = [] if 'vers' in typesfound: skiptypes.append('vers') if 'SIZE' in typesfound: skiptypes.append('SIZE') - if 'BNDL' in typesfound: skiptypes = skiptypes + ['BNDL', 'FREF', 'icl4', + if 'BNDL' in typesfound: skiptypes = skiptypes + ['BNDL', 'FREF', 'icl4', 'icl8', 'ics4', 'ics8', 'ICN#', 'ics#'] if not copy_codefragment: skiptypes.append('cfrg') ## skipowner = (ownertype <> None) - + # Copy the resources from the template - + input = Res.FSOpenResourceFile(template, RESOURCE_FORK_NAME, READ) dummy, tmplowner = copyres(input, output, skiptypes, 1, progress) - + Res.CloseResFile(input) ## if ownertype == None: ## raise BuildError, "No owner resource found in either resource file or template" # Make sure we're manipulating the output resource file now - + Res.UseResFile(output) if ownertype == None: @@ -213,27 +213,27 @@ def process_common(template, progress, code, rsrcname, destname, is_update, newres = Res.Resource('\0') newres.AddResource(DEFAULT_APPLET_CREATOR, 0, "Owner resource") ownertype = DEFAULT_APPLET_CREATOR - + if code: # Delete any existing 'PYC ' resource named __main__ - + try: res = Res.Get1NamedResource(RESTYPE, RESNAME) res.RemoveResource() except Res.Error: pass - + # Create the raw data for the resource from the code object if progress: progress.label("Write PYC resource...") progress.set(120) - + data = marshal.dumps(code) del code data = (MAGIC + '\0\0\0\0') + data - + # Create the resource and write it - + id = 0 while id < 128: id = Res.Unique1ID(RESTYPE) @@ -244,11 +244,11 @@ def process_common(template, progress, code, rsrcname, destname, is_update, res.SetResAttrs(attrs) res.WriteResource() res.ReleaseResource() - + # Close the output file - + Res.CloseResFile(output) - + # Now set the creator, type and bundle bit of the destination. # Done with FSSpec's, FSRef FInfo isn't good enough yet (2.3a1+) dest_fss = Carbon.File.FSSpec(destname) @@ -258,13 +258,13 @@ def process_common(template, progress, code, rsrcname, destname, is_update, dest_finfo.Flags = dest_finfo.Flags | Carbon.Files.kHasBundle | Carbon.Files.kIsShared dest_finfo.Flags = dest_finfo.Flags & ~Carbon.Files.kHasBeenInited dest_fss.FSpSetFInfo(dest_finfo) - + macostools.touched(destname) if progress: progress.label("Done.") progress.inc(0) -def process_common_macho(template, progress, code, rsrcname, destname, is_update, +def process_common_macho(template, progress, code, rsrcname, destname, is_update, raw=0, others=[], filename=None): # Check that we have a filename if filename is None: @@ -304,7 +304,7 @@ def process_common_macho(template, progress, code, rsrcname, destname, is_update builder.name = shortname if rsrcname: realrsrcname = macresource.resource_pathname(rsrcname) - builder.files.append((realrsrcname, + builder.files.append((realrsrcname, os.path.join('Contents/Resources', os.path.basename(rsrcname)))) for o in others: if type(o) == str: @@ -320,10 +320,10 @@ def process_common_macho(template, progress, code, rsrcname, destname, is_update builder.argv_emulation = 1 builder.setup() builder.build() - if progress: + if progress: progress.label('Done.') progress.inc(0) - + ## macostools.touched(dest_fss) # Copy resources between two resource file descriptors. @@ -406,7 +406,7 @@ def copyapptree(srctree, dsttree, exceptlist=[], progress=None): progress.label('Copy '+this) progress.inc(0) shutil.copy2(srcpath, dstpath) - + def writepycfile(codeobject, cfile): import marshal fc = open(cfile, 'wb') @@ -417,4 +417,3 @@ def writepycfile(codeobject, cfile): fc.seek(0, 0) fc.write(MAGIC) fc.close() - diff --git a/Lib/plat-mac/cfmfile.py b/Lib/plat-mac/cfmfile.py index 317046a..fd1a3e8 100644 --- a/Lib/plat-mac/cfmfile.py +++ b/Lib/plat-mac/cfmfile.py @@ -18,19 +18,19 @@ error = "cfm.error" BUFSIZE = 0x80000 def mergecfmfiles(srclist, dst, architecture = 'fat'): - """Merge all files in srclist into a new file dst. - + """Merge all files in srclist into a new file dst. + If architecture is given, only code fragments of that type will be used: "pwpc" for PPC, "m68k" for cfm68k. This does not work for "classic" 68k code, since it does not use code fragments to begin with. If architecture is None, all fragments will be used, enabling FAT binaries. """ - + srclist = list(srclist) for i in range(len(srclist)): srclist[i] = Carbon.File.pathname(srclist[i]) dst = Carbon.File.pathname(dst) - + dstfile = open(dst, "wb") rf = Res.FSpOpenResFile(dst, 3) try: @@ -43,9 +43,9 @@ def mergecfmfiles(srclist, dst, architecture = 'fat'): if frag.architecture == 'm68k' and architecture == 'pwpc': continue dstcfrg.append(frag) - + frag.copydata(dstfile) - + cfrgres = Res.Resource(dstcfrg.build()) Res.UseResFile(rf) cfrgres.AddResource('cfrg', 0, "") @@ -55,7 +55,7 @@ def mergecfmfiles(srclist, dst, architecture = 'fat'): class CfrgResource: - + def __init__(self, path = None): self.version = 1 self.fragments = [] @@ -74,43 +74,43 @@ class CfrgResource: Res.UseResFile(currentresref) self.parse(data) if self.version <> 1: - raise error, "unknown 'cfrg' resource format" - + raise error, "unknown 'cfrg' resource format" + def parse(self, data): - (res1, res2, self.version, - res3, res4, res5, res6, + (res1, res2, self.version, + res3, res4, res5, res6, self.memberCount) = struct.unpack("8l", data[:32]) data = data[32:] while data: frag = FragmentDescriptor(self.path, data) data = data[frag.memberSize:] self.fragments.append(frag) - + def build(self): self.memberCount = len(self.fragments) data = struct.pack("8l", 0, 0, self.version, 0, 0, 0, 0, self.memberCount) for frag in self.fragments: data = data + frag.build() return data - + def append(self, frag): self.fragments.append(frag) class FragmentDescriptor: - + def __init__(self, path, data = None): self.path = path if data is not None: self.parse(data) - + def parse(self, data): self.architecture = data[:4] - ( self.updatelevel, - self.currentVersion, - self.oldDefVersion, + ( self.updatelevel, + self.currentVersion, + self.oldDefVersion, self.stacksize, - self.applibdir, + self.applibdir, self.fragtype, self.where, self.offset, @@ -119,15 +119,15 @@ class FragmentDescriptor: self.memberSize,) = struct.unpack("4lhBB4lh", data[4:42]) pname = data[42:self.memberSize] self.name = pname[1:1+ord(pname[0])] - + def build(self): data = self.architecture data = data + struct.pack("4lhBB4l", - self.updatelevel, - self.currentVersion, - self.oldDefVersion, + self.updatelevel, + self.currentVersion, + self.oldDefVersion, self.stacksize, - self.applibdir, + self.applibdir, self.fragtype, self.where, self.offset, @@ -141,7 +141,7 @@ class FragmentDescriptor: data = data + self.name data = data + '\000' * (self.memberSize - len(data)) return data - + def getfragment(self): if self.where <> 1: raise error, "can't read fragment, unsupported location" @@ -153,7 +153,7 @@ class FragmentDescriptor: frag = f.read() f.close() return frag - + def copydata(self, outfile): if self.where <> 1: raise error, "can't read fragment, unsupported location" @@ -161,17 +161,17 @@ class FragmentDescriptor: if self.length == 0: infile.seek(0, 2) self.length = infile.tell() - + # Position input file and record new offset from output file infile.seek(self.offset) - + # pad to 16 byte boundaries offset = outfile.tell() if offset % 16: offset = offset + 16 - (offset % 16) outfile.seek(offset) self.offset = offset - + l = self.length while l: if l > BUFSIZE: @@ -181,4 +181,3 @@ class FragmentDescriptor: outfile.write(infile.read(l)) l = 0 infile.close() - diff --git a/Lib/plat-mac/findertools.py b/Lib/plat-mac/findertools.py index b3223bd..54b1bde 100644 --- a/Lib/plat-mac/findertools.py +++ b/Lib/plat-mac/findertools.py @@ -34,22 +34,22 @@ def _getfinder(): global _finder_talker if not _finder_talker: _finder_talker = Finder.Finder() - _finder_talker.send_flags = ( _finder_talker.send_flags | + _finder_talker.send_flags = ( _finder_talker.send_flags | AppleEvents.kAECanInteract | AppleEvents.kAECanSwitchLayer) return _finder_talker - + def launch(file): """Open a file thru the finder. Specify file by name or fsspec""" finder = _getfinder() fss = Carbon.File.FSSpec(file) return finder.open(fss) - + def Print(file): """Print a file thru the finder. Specify file by name or fsspec""" finder = _getfinder() fss = Carbon.File.FSSpec(file) return finder._print(fss) - + def copy(src, dstdir): """Copy a file to a folder""" finder = _getfinder() @@ -73,17 +73,17 @@ def move(src, dstdir): src_fss = Carbon.File.FSSpec(src) dst_fss = Carbon.File.FSSpec(dstdir) return finder.move(src_fss, to=dst_fss) - + def sleep(): """Put the mac to sleep""" finder = _getfinder() finder.sleep() - + def shutdown(): """Shut the mac down""" finder = _getfinder() finder.shut_down() - + def restart(): """Restart the mac""" finder = _getfinder() @@ -100,16 +100,16 @@ def reveal(file): fsr = Carbon.File.FSRef(file) file_alias = fsr.FSNewAliasMinimal() return finder.reveal(file_alias) - + def select(file): """select a file in the finder. Specify file by name, fsref or fsspec.""" finder = _getfinder() fsr = Carbon.File.FSRef(file) file_alias = fsr.FSNewAliasMinimal() return finder.select(file_alias) - + def update(file): - """Update the display of the specified object(s) to match + """Update the display of the specified object(s) to match their on-disk representation. Specify file by name, fsref or fsspec.""" finder = _getfinder() fsr = Carbon.File.FSRef(file) @@ -129,7 +129,7 @@ def comment(object, comment=None): return _getcomment(object_alias) else: return _setcomment(object_alias, comment) - + def _setcomment(object_alias, comment): finder = _getfinder() args = {} @@ -219,11 +219,11 @@ def isactiveprocess(processname): if n == processname: return 1 return 0 - + def processinfo(processname): """Return an object with all process properties as attributes for processname. MacOS9""" p = _process() - + if processname == "Finder": p.partition = None p.used = None @@ -238,7 +238,7 @@ def processinfo(processname): p.accepthighlevel = _processproperty(processname, 'revt') #Is the process high-level event aware (accepts open application, open document, print document, and quit)? p.hasscripting = _processproperty(processname, 'hscr') #Does the process have a scripting terminology, i.e., can it be scripted? return p - + def _processproperty(processname, property): """return the partition size and memory used for processname""" finder = _getfinder() @@ -256,7 +256,7 @@ def _processproperty(processname, property): #--------------------------------------------------- # Mess around with Finder windows. - + def openwindow(object): """Open a Finder window for object, Specify object by name or fsspec.""" finder = _getfinder() @@ -271,7 +271,7 @@ def openwindow(object): _reply, args, attrs = finder.send(_code, _subcode, args, attrs) if args.has_key('errn'): raise Error, aetools.decodeerror(args) - + def closewindow(object): """Close a Finder window for folder, Specify by path.""" finder = _getfinder() @@ -295,7 +295,7 @@ def location(object, pos=None): if not pos: return _getlocation(object_alias) return _setlocation(object_alias, pos) - + def _setlocation(object_alias, (x, y)): """_setlocation: Set the location of the icon for the object.""" finder = _getfinder() @@ -309,7 +309,7 @@ def _setlocation(object_alias, (x, y)): if args.has_key('errn'): raise Error, aetools.decodeerror(args) return (x,y) - + def _getlocation(object_alias): """_getlocation: get the location of the icon for the object.""" finder = _getfinder() @@ -334,7 +334,7 @@ def label(object, index=None): if index < 0 or index > 7: index = 0 return _setlabel(object_alias, index) - + def _getlabel(object_alias): """label: Get the label for the object.""" finder = _getfinder() @@ -378,7 +378,7 @@ def windowview(folder, view=None): if view == None: return _getwindowview(folder_alias) return _setwindowview(folder_alias, view) - + def _setwindowview(folder_alias, view=0): """set the windowview""" attrs = {} @@ -390,13 +390,13 @@ def _setwindowview(folder_alias, view=0): else: _v = aetypes.Type('iimg') finder = _getfinder() - aeobj_0 = aetypes.ObjectSpecifier(want = aetypes.Type('cfol'), + aeobj_0 = aetypes.ObjectSpecifier(want = aetypes.Type('cfol'), form = 'alis', seld = folder_alias, fr=None) - aeobj_1 = aetypes.ObjectSpecifier(want = aetypes.Type('prop'), + aeobj_1 = aetypes.ObjectSpecifier(want = aetypes.Type('prop'), form = 'prop', seld = aetypes.Type('cwnd'), fr=aeobj_0) - aeobj_2 = aetypes.ObjectSpecifier(want = aetypes.Type('prop'), + aeobj_2 = aetypes.ObjectSpecifier(want = aetypes.Type('prop'), form = 'prop', seld = aetypes.Type('pvew'), fr=aeobj_1) - aeobj_3 = aetypes.ObjectSpecifier(want = aetypes.Type('prop'), + aeobj_3 = aetypes.ObjectSpecifier(want = aetypes.Type('prop'), form = 'prop', seld = _v, fr=None) _code = 'core' _subcode = 'setd' @@ -437,7 +437,7 @@ def windowsize(folder, size=None): if not size: return _getwindowsize(folder_alias) return _setwindowsize(folder_alias, size) - + def _setwindowsize(folder_alias, (w, h)): """Set the size of a Finder window for folder to (w, h)""" finder = _getfinder() @@ -448,9 +448,9 @@ def _setwindowsize(folder_alias, (w, h)): aevar00 = [w, h] aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), form="alis", seld=folder_alias, fr=None) - aeobj_1 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), + aeobj_1 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('cwnd'), fr=aeobj_0) - aeobj_2 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), + aeobj_2 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('ptsz'), fr=aeobj_1) args['----'] = aeobj_2 args["data"] = aevar00 @@ -458,17 +458,17 @@ def _setwindowsize(folder_alias, (w, h)): if args.has_key('errn'): raise Error, aetools.decodeerror(args) return (w, h) - + def _getwindowsize(folder_alias): """Set the size of a Finder window for folder to (w, h)""" finder = _getfinder() args = {} attrs = {} - aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), + aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), form="alis", seld=folder_alias, fr=None) - aeobj_1 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), + aeobj_1 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('cwnd'), fr=aeobj_0) - aeobj_2 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), + aeobj_2 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('posn'), fr=aeobj_1) args['----'] = aeobj_2 _reply, args, attrs = finder.send('core', 'getd', args, attrs) @@ -488,17 +488,17 @@ def windowposition(folder, pos=None): # pos might be a QDPoint object as returned by _getwindowposition pos = (pos.h, pos.v) return _setwindowposition(folder_alias, pos) - + def _setwindowposition(folder_alias, (x, y)): """Set the size of a Finder window for folder to (w, h).""" finder = _getfinder() args = {} attrs = {} - aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), + aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), form="alis", seld=folder_alias, fr=None) - aeobj_1 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), + aeobj_1 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('cwnd'), fr=aeobj_0) - aeobj_2 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), + aeobj_2 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('posn'), fr=aeobj_1) args['----'] = aeobj_2 args["data"] = [x, y] @@ -513,11 +513,11 @@ def _getwindowposition(folder_alias): finder = _getfinder() args = {} attrs = {} - aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), + aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), form="alis", seld=folder_alias, fr=None) - aeobj_1 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), + aeobj_1 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('cwnd'), fr=aeobj_0) - aeobj_2 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), + aeobj_2 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('ptsz'), fr=aeobj_1) args['----'] = aeobj_2 _reply, args, attrs = finder.send('core', 'getd', args, attrs) @@ -536,15 +536,15 @@ def icon(object, icondata=None): if icondata == None: return _geticon(object_alias) return _seticon(object_alias, icondata) - + def _geticon(object_alias): """get the icondata for object. Binary data of some sort.""" finder = _getfinder() args = {} attrs = {} - aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('cobj'), + aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('cobj'), form="alis", seld=object_alias, fr=None) - aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), + aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('iimg'), fr=aeobj_00) args['----'] = aeobj_01 _reply, args, attrs = finder.send("core", "getd", args, attrs) @@ -558,9 +558,9 @@ def _seticon(object_alias, icondata): finder = _getfinder() args = {} attrs = {} - aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('cobj'), + aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('cobj'), form="alis", seld=object_alias, fr=None) - aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), + aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('iimg'), fr=aeobj_00) args['----'] = aeobj_01 args["data"] = icondata @@ -573,7 +573,7 @@ def _seticon(object_alias, icondata): #--------------------------------------------------- # Volumes and servers. - + def mountvolume(volume, server=None, username=None, password=None): """mount a volume, local or on a server on AppleTalk. Note: mounting a ASIP server requires a different operation. @@ -598,7 +598,7 @@ def mountvolume(volume, server=None, username=None, password=None): def unmountvolume(volume): """unmount a volume that's on the desktop""" putaway(volume) - + def putaway(object): """puth the object away, whereever it came from.""" finder = _getfinder() @@ -675,7 +675,7 @@ def filesharing(): if args['----'] == 1: status = 0 return status - + def movetotrash(path): """move the object to the trash""" fss = Carbon.File.FSSpec(path) @@ -766,7 +766,7 @@ def _test2(): # set the soundvolume in a simple way print '\tSystem beep volume' for i in range(0, 7): - volumelevel(i) + volumelevel(i) MacOS.SysBeep() # Finder's windows, file location, file attributes @@ -805,7 +805,7 @@ def _test2(): print '\t', comment(f) # print the Finder comment this file has s = 'This is a comment no one reads!' comment(f, s) # set the Finder comment - + def _test3(): print 'MacOS9 or better specific functions' # processes @@ -813,7 +813,7 @@ def _test3(): print 'Return a list of current active processes:' for p in pr: print '\t', p - + # get attributes of the first process in the list print 'Attributes of the first process in the list:' pinfo = processinfo(pr[0][0]) @@ -829,4 +829,3 @@ if __name__ == '__main__': _test() _test2() _test3() - diff --git a/Lib/plat-mac/gensuitemodule.py b/Lib/plat-mac/gensuitemodule.py index ab3c070..87132c5 100644 --- a/Lib/plat-mac/gensuitemodule.py +++ b/Lib/plat-mac/gensuitemodule.py @@ -31,7 +31,7 @@ DEFAULT_USER_PACKAGEFOLDER=distutils.sysconfig.get_python_lib() def usage(): sys.stderr.write("Usage: %s [opts] application-or-resource-file\n" % sys.argv[0]) sys.stderr.write("""Options: ---output pkgdir Pathname of the output package (short: -o) +--output pkgdir Pathname of the output package (short: -o) --resource Parse resource file in stead of launching application (-r) --base package Use another base package in stead of default StdSuites (-b) --edit old=new Edit suite names, use empty new to skip a suite (-e) @@ -49,7 +49,7 @@ def main(): opts, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS) except getopt.GetoptError: usage() - + process_func = processfile basepkgname = 'StdSuites' output = None @@ -57,7 +57,7 @@ def main(): creatorsignature = None dump = None verbose = None - + for o, a in opts: if o in ('-r', '--resource'): process_func = processfile_fromresource @@ -79,19 +79,19 @@ def main(): dump = sys.stdout if o in ('-v', '--verbose'): verbose = sys.stderr - - + + if output and len(args) > 1: sys.stderr.write("%s: cannot specify --output with multiple inputs\n" % sys.argv[0]) sys.exit(1) - + for filename in args: - process_func(filename, output=output, basepkgname=basepkgname, + process_func(filename, output=output, basepkgname=basepkgname, edit_modnames=edit_modnames, creatorsignature=creatorsignature, dump=dump, verbose=verbose) else: main_interactive() - + def main_interactive(interact=0, basepkgname='StdSuites'): if interact: # Ask for save-filename for each module @@ -119,7 +119,7 @@ def main_interactive(interact=0, basepkgname='StdSuites'): print "Retry, manually parsing resources" processfile_fromresource(filename, edit_modnames=edit_modnames, basepkgname=basepkgname, verbose=sys.stderr) - + def is_scriptable(application): """Return true if the application is scriptable""" if os.path.isdir(application): @@ -141,7 +141,7 @@ def is_scriptable(application): UseResFile(currf) return n_terminology > 0 -def processfile_fromresource(fullname, output=None, basepkgname=None, +def processfile_fromresource(fullname, output=None, basepkgname=None, edit_modnames=None, creatorsignature=None, dump=None, verbose=None): """Process all resources in a single file""" if not is_scriptable(fullname) and verbose: @@ -159,7 +159,7 @@ def processfile_fromresource(fullname, output=None, basepkgname=None, for i in range(Count1Resources('aeut')): res = Get1IndResource('aeut', 1+i) resources.append(res) - if verbose: + if verbose: print >>verbose, "\nLISTING aete+aeut RESOURCES IN", repr(fullname) aetelist = [] for res in resources: @@ -176,11 +176,11 @@ def processfile_fromresource(fullname, output=None, basepkgname=None, UseResFile(cur) if dump: dumpaetelist(aetelist, dump) - compileaetelist(aetelist, fullname, output=output, + compileaetelist(aetelist, fullname, output=output, basepkgname=basepkgname, edit_modnames=edit_modnames, creatorsignature=creatorsignature, verbose=verbose) -def processfile(fullname, output=None, basepkgname=None, +def processfile(fullname, output=None, basepkgname=None, edit_modnames=None, creatorsignature=None, dump=None, verbose=None): """Ask an application for its terminology and process that""" @@ -204,7 +204,7 @@ def processfile(fullname, output=None, basepkgname=None, if verbose: print >>verbose, "Launched", fullname raw = aetools.unpack(aedescobj) - if not raw: + if not raw: if verbose: print >>verbose, 'Unpack returned empty value:', raw return @@ -218,9 +218,9 @@ def processfile(fullname, output=None, basepkgname=None, dumpaetelist([aete], dump) return compileaete(aete, None, fullname, output=output, basepkgname=basepkgname, - creatorsignature=creatorsignature, edit_modnames=edit_modnames, + creatorsignature=creatorsignature, edit_modnames=edit_modnames, verbose=verbose) - + def getappterminology(fullname, verbose=None): """Get application terminology by sending an AppleEvent""" # First check that we actually can send AppleEvents @@ -251,19 +251,19 @@ def getappterminology(fullname, verbose=None): #reply2 = talker.send("ascr", "gdut") # Now pick the bits out of the return that we need. return reply[1]['----'], cr - -def compileaetelist(aetelist, fullname, output=None, basepkgname=None, + +def compileaetelist(aetelist, fullname, output=None, basepkgname=None, edit_modnames=None, creatorsignature=None, verbose=None): for aete, resinfo in aetelist: - compileaete(aete, resinfo, fullname, output=output, + compileaete(aete, resinfo, fullname, output=output, basepkgname=basepkgname, edit_modnames=edit_modnames, creatorsignature=creatorsignature, verbose=verbose) def dumpaetelist(aetelist, output): import pprint pprint.pprint(aetelist, output) - + def decode(data, verbose=None): """Decode a resource into a python data structure""" f = StringIO.StringIO(data) @@ -427,7 +427,7 @@ getaete = [ (getlist, "suites", getsuite) ] -def compileaete(aete, resinfo, fname, output=None, basepkgname=None, +def compileaete(aete, resinfo, fname, output=None, basepkgname=None, edit_modnames=None, creatorsignature=None, verbose=None): """Generate code for a full aete resource. fname passed for doc purposes""" [version, language, script, suites] = aete @@ -500,7 +500,7 @@ def compileaete(aete, resinfo, fname, output=None, basepkgname=None, fp.write("}\n\n") for code, modname in suitelist: fp.write("from %s import *\n"%modname) - + # Generate property dicts and element dicts for all types declared in this module fp.write("\ndef getbaseclasses(v):\n") fp.write(" if not getattr(v, '_propdict', None):\n") @@ -534,7 +534,7 @@ def compileaete(aete, resinfo, fname, output=None, basepkgname=None, application_class = v fp.write("}\n") - + if suitelist: fp.write("\n\nclass %s(%s_Events"%(packagename, suitelist[0][1])) for code, modname in suitelist[1:]: @@ -554,22 +554,22 @@ class SuiteCompiler: self.edit_modnames = edit_modnames self.output = output self.verbose = verbose - + # Set by precompilesuite self.pathname = None self.modname = None - + # Set by compilesuite self.fp = None self.basemodule = None self.enumsneeded = {} - + def precompilesuite(self): """Parse a single suite without generating the output. This step is needed so we can resolve recursive references by suites to enums/comps/etc declared in other suites""" [name, desc, code, level, version, events, classes, comps, enums] = self.suite - + modname = identify(name) if len(modname) > 28: modname = modname[:27] @@ -586,9 +586,9 @@ class SuiteCompiler: self.pathname = None if not self.pathname: return None, None, None - + self.modname = os.path.splitext(os.path.split(self.pathname)[1])[0] - + if self.basepackage and self.basepackage._code_to_module.has_key(code): # We are an extension of a baseclass (usually an application extending # Standard_Suite or so). Import everything from our base module @@ -596,11 +596,11 @@ class SuiteCompiler: else: # We are not an extension. basemodule = None - + self.enumsneeded = {} for event in events: self.findenumsinevent(event) - + objc = ObjectCompiler(None, self.modname, basemodule, interact=(self.edit_modnames is None), verbose=self.verbose) for cls in classes: @@ -611,16 +611,16 @@ class SuiteCompiler: objc.compilecomparison(comp) for enum in enums: objc.compileenumeration(enum) - + for enum in self.enumsneeded.keys(): objc.checkforenum(enum) - + objc.dumpindex() - + precompinfo = objc.getprecompinfo(self.modname) - + return code, self.modname, precompinfo - + def compilesuite(self, major, minor, language, script, fname, precompinfo): """Generate code for a single suite""" [name, desc, code, level, version, events, classes, comps, enums] = self.suite @@ -637,22 +637,22 @@ class SuiteCompiler: # This is a synonym, the other one is better return 1 return 0 - + events.sort() classes.sort(class_sorter) comps.sort() enums.sort() - + self.fp = fp = open(self.pathname, 'w') MacOS.SetCreatorAndType(self.pathname, 'Pyth', 'TEXT') - + fp.write('"""Suite %s: %s\n' % (ascii(name), ascii(desc))) fp.write("Level %d, version %d\n\n" % (level, version)) fp.write("Generated from %s\n"%ascii(fname)) fp.write("AETE/AEUT resource version %d/%d, language %d, script %d\n" % \ (major, minor, language, script)) fp.write('"""\n\n') - + fp.write('import aetools\n') fp.write('import MacOS\n\n') fp.write("_code = %r\n\n"% (code,)) @@ -670,14 +670,14 @@ class SuiteCompiler: basemodule = None self.basemodule = basemodule self.compileclassheader() - + self.enumsneeded = {} if events: for event in events: self.compileevent(event) else: fp.write(" pass\n\n") - + objc = ObjectCompiler(fp, self.modname, basemodule, precompinfo, interact=(self.edit_modnames is None), verbose=self.verbose) for cls in classes: @@ -688,12 +688,12 @@ class SuiteCompiler: objc.compilecomparison(comp) for enum in enums: objc.compileenumeration(enum) - + for enum in self.enumsneeded.keys(): objc.checkforenum(enum) - + objc.dumpindex() - + def compileclassheader(self): """Generate class boilerplate""" classname = '%s_Events'%self.modname @@ -703,7 +703,7 @@ class SuiteCompiler: self.fp.write("class %s(%s):\n\n"%(classname, baseclassname)) else: self.fp.write("class %s:\n\n"%classname) - + def compileevent(self, event): """Generate code for a single event""" [name, desc, code, subcode, returns, accepts, arguments] = event @@ -717,13 +717,13 @@ class SuiteCompiler: for a in arguments: fp.write(" %r : %r,\n"%(identify(a[0]), a[1])) fp.write(" }\n\n") - + # # Generate function header # has_arg = (not is_null(accepts)) opt_arg = (has_arg and is_optional(accepts)) - + fp.write(" def %s(self, "%funcname) if has_arg: if not opt_arg: @@ -803,7 +803,7 @@ class SuiteCompiler: fp.write(" # XXXX Should do enum remapping here...\n") fp.write(" return _arguments['----']\n") fp.write("\n") - + def findenumsinevent(self, event): """Find all enums for a single event""" [name, desc, code, subcode, returns, accepts, arguments] = event @@ -812,7 +812,7 @@ class SuiteCompiler: ename = a[2][0] if ename <> '****': self.enumsneeded[ename] = 1 - + # # This class stores the code<->name translations for a single module. It is used # to keep the information while we're compiling the module, but we also keep these objects @@ -821,7 +821,7 @@ class SuiteCompiler: # hand. # class CodeNameMapper: - + def __init__(self, interact=1, verbose=None): self.code2name = { "property" : {}, @@ -839,21 +839,21 @@ class CodeNameMapper: self.star_imported = 0 self.can_interact = interact self.verbose = verbose - + def addnamecode(self, type, name, code): self.name2code[type][name] = code if not self.code2name[type].has_key(code): self.code2name[type][code] = name - + def hasname(self, name): for dict in self.name2code.values(): if dict.has_key(name): return True return False - + def hascode(self, type, code): return self.code2name[type].has_key(code) - + def findcodename(self, type, code): if not self.hascode(type, code): return None, None, None @@ -863,10 +863,10 @@ class CodeNameMapper: else: qualname = name return name, qualname, self.modulename - + def getall(self, type): return self.code2name[type].items() - + def addmodule(self, module, name, star_imported): self.modulename = name self.star_imported = star_imported @@ -878,14 +878,14 @@ class CodeNameMapper: self.addnamecode('enum', '_Enum_'+identify(code), code) for code, name in module._compdeclarations.items(): self.addnamecode('comparison', name, code) - + def prepareforexport(self, name=None): if not self.modulename: self.modulename = name return self - + class ObjectCompiler: - def __init__(self, fp, modname, basesuite, othernamemappers=None, interact=1, + def __init__(self, fp, modname, basesuite, othernamemappers=None, interact=1, verbose=None): self.fp = fp self.verbose = verbose @@ -901,7 +901,7 @@ class ObjectCompiler: basemapper = CodeNameMapper(self.can_interact, self.verbose) basemapper.addmodule(basesuite, '', 1) self.namemappers.append(basemapper) - + def getprecompinfo(self, modname): list = [] for mapper in self.namemappers: @@ -909,7 +909,7 @@ class ObjectCompiler: if emapper: list.append(emapper) return list - + def findcodename(self, type, code): while 1: # First try: check whether we already know about this code. @@ -935,7 +935,7 @@ class ObjectCompiler: mapper = CodeNameMapper(self.can_interact, self.verbose) mapper.addmodule(m, m.__name__, 0) self.namemappers.append(mapper) - + def hasname(self, name): for mapper in self.othernamemappers: if mapper.hasname(name) and mapper.modulename != self.modulename: @@ -943,7 +943,7 @@ class ObjectCompiler: print >>self.verbose, "Duplicate Python identifier:", name, self.modulename, mapper.modulename return True return False - + def askdefinitionmodule(self, type, code): if not self.can_interact: if self.verbose: @@ -958,7 +958,7 @@ class ObjectCompiler: m = __import__(modname) self.fp.write("import %s\n"%modname) return m - + def compileclass(self, cls): [name, code, desc, properties, elements] = cls pname = identify(name) @@ -980,7 +980,7 @@ class ObjectCompiler: elements.sort() for elem in elements: self.compileelement(elem) - + def compileproperty(self, prop, is_application_class=False): [name, code, what] = prop if code == 'c@#!': @@ -1003,7 +1003,7 @@ class ObjectCompiler: self.namemappers[0].addnamecode('property', pname, code) if is_application_class and self.fp: self.fp.write("%s = _Prop_%s()\n" % (pname, pname)) - + def compileelement(self, elem): [code, keyform] = elem if self.fp: @@ -1056,10 +1056,10 @@ class ObjectCompiler: self.fp.write("# XXXX %s element %r not found!!\n"%(cname, ecode)) else: elist.append((name, ename)) - + plist.sort() elist.sort() - + if self.fp: self.fp.write("%s._privpropdict = {\n"%cname) for n in plist: @@ -1069,7 +1069,7 @@ class ObjectCompiler: for n, fulln in elist: self.fp.write(" '%s' : %s,\n"%(n, fulln)) self.fp.write("}\n") - + def compilecomparison(self, comp): [name, code, comment] = comp iname = identify(name) @@ -1077,7 +1077,7 @@ class ObjectCompiler: if self.fp: self.fp.write("class %s(aetools.NComparison):\n" % iname) self.fp.write(' """%s - %s """\n' % (ascii(name), ascii(comment))) - + def compileenumeration(self, enum): [code, items] = enum name = "_Enum_%s" % identify(code) @@ -1088,11 +1088,11 @@ class ObjectCompiler: self.fp.write("}\n\n") self.namemappers[0].addnamecode('enum', name, code) return code - + def compileenumerator(self, item): [name, code, desc] = item self.fp.write(" %r : %r,\t# %s\n" % (identify(name), code, ascii(desc))) - + def checkforenum(self, enum): """This enum code is used by an event. Make sure it's available""" name, fullname, module = self.findcodename('enum', enum) @@ -1103,33 +1103,33 @@ class ObjectCompiler: if module: if self.fp: self.fp.write("from %s import %s\n"%(module, name)) - + def dumpindex(self): if not self.fp: return self.fp.write("\n#\n# Indices of types declared in this module\n#\n") - + self.fp.write("_classdeclarations = {\n") classlist = self.namemappers[0].getall('class') classlist.sort() for k, v in classlist: self.fp.write(" %r : %s,\n" % (k, v)) self.fp.write("}\n") - + self.fp.write("\n_propdeclarations = {\n") proplist = self.namemappers[0].getall('property') proplist.sort() for k, v in proplist: self.fp.write(" %r : _Prop_%s,\n" % (k, v)) self.fp.write("}\n") - + self.fp.write("\n_compdeclarations = {\n") complist = self.namemappers[0].getall('comparison') complist.sort() for k, v in complist: self.fp.write(" %r : %s,\n" % (k, v)) self.fp.write("}\n") - + self.fp.write("\n_enumdeclarations = {\n") enumlist = self.namemappers[0].getall('enum') enumlist.sort() @@ -1140,16 +1140,16 @@ class ObjectCompiler: def compiledata(data): [type, description, flags] = data return "%r -- %r %s" % (type, description, compiledataflags(flags)) - + def is_null(data): return data[0] == 'null' - + def is_optional(data): return (data[2] & 0x8000) - + def is_enum(data): return (data[2] & 0x2000) - + def getdatadoc(data): [type, descr, flags] = data if descr: @@ -1170,7 +1170,7 @@ def compiledataflags(flags): else: bits.append(repr(i)) return '[%s]' % string.join(bits) - + def ascii(str): """Return a string with all non-ascii characters hex-encoded""" if type(str) != type(''): @@ -1182,7 +1182,7 @@ def ascii(str): else: rv = rv + '\\' + 'x%02.2x' % ord(c) return rv - + def identify(str): """Turn any string into an identifier: - replace space by _ diff --git a/Lib/plat-mac/ic.py b/Lib/plat-mac/ic.py index 3236805..6575336 100644 --- a/Lib/plat-mac/ic.py +++ b/Lib/plat-mac/ic.py @@ -38,7 +38,7 @@ class ICOpaqueData: return "ICOpaqueData(%r)"%(self.data,) _ICOpaqueDataType=type(ICOpaqueData('')) - + def _decode_default(data, key): if len(data) == 0: return data @@ -46,8 +46,8 @@ def _decode_default(data, key): # Assume Pstring return data[1:] return ICOpaqueData(data) - - + + def _decode_multistr(data, key): numstr = ord(data[0]) << 8 | ord(data[1]) rv = [] @@ -58,54 +58,54 @@ def _decode_multistr(data, key): rv.append(str) ptr = ptr + strlen + 1 return rv - + def _decode_fontrecord(data, key): size = ord(data[0]) << 8 | ord(data[1]) face = ord(data[2]) namelen = ord(data[4]) return size, face, data[5:5+namelen] - + def _decode_boolean(data, key): return ord(data[0]) - + def _decode_text(data, key): return data - + def _decode_charset(data, key): return data[:256], data[256:] - + def _decode_appspec(data, key): namelen = ord(data[4]) return data[0:4], data[5:5+namelen] def _code_default(data, key): return chr(len(data)) + data - + def _code_multistr(data, key): numstr = len(data) rv = chr((numstr>>8) & 0xff) + chr(numstr & 0xff) for i in data: rv = rv + _code_default(i) return rv - + def _code_fontrecord(data, key): size, face, name = data return chr((size>>8) & 0xff) + chr(size & 0xff) + chr(face & 0xff) + \ chr(0) + _code_default(name) - + def _code_boolean(data, key): print 'XXXX boolean:', repr(data) return chr(data) - + def _code_text(data, key): return data - + def _code_charset(data, key): return data[0] + data[1] - + def _code_appspec(data, key): return data[0] + _code_default(data[1]) - + _decoder_table = { "ArchieAll" : (_decode_multistr , _code_multistr), "UMichAll" : (_decode_multistr , _code_multistr), @@ -118,7 +118,7 @@ _decoder_table = { "Plan" : (_decode_text , _code_text), "MailHeaders" : (_decode_text , _code_text), "NewsHeaders" : (_decode_text , _code_text), -# "Mapping" +# "Mapping" "CharacterSet" : (_decode_charset , _code_charset), "Helper\245" : (_decode_appspec , _code_appspec), # "Services" : (_decode_services, ????), @@ -156,7 +156,7 @@ def _code(data, key): else: coder = _code_default return coder(data, key) - + class IC: def __init__(self, signature='Pyth', ic=None): if ic: @@ -166,7 +166,7 @@ class IC: if hasattr(self.ic, 'ICFindConfigFile'): self.ic.ICFindConfigFile() self.h = Res.Resource('') - + def keys(self): rv = [] self.ic.ICBegin(icReadOnlyPerm) @@ -175,32 +175,32 @@ class IC: rv.append(self.ic.ICGetIndPref(i+1)) self.ic.ICEnd() return rv - + def has_key(self, key): return self.__contains__(key) - + def __contains__(self, key): try: dummy = self.ic.ICFindPrefHandle(key, self.h) except icglue.error: return 0 return 1 - + def __getitem__(self, key): attr = self.ic.ICFindPrefHandle(key, self.h) return _decode(self.h.data, key) - + def __setitem__(self, key, value): value = _code(value, key) self.ic.ICSetPref(key, ICattr_no_change, value) - + def launchurl(self, url, hint=""): # Work around a bug in ICLaunchURL: file:/foo does # not work but file:///foo does. if url[:6] == 'file:/' and url[6] != '/': url = 'file:///' + url[6:] self.ic.ICLaunchURL(hint, url, 0, len(url)) - + def parseurl(self, data, start=None, end=None, hint=""): if start == None: selStart = 0 @@ -211,21 +211,21 @@ class IC: selEnd = end selStart, selEnd = self.ic.ICParseURL(hint, data, selStart, selEnd, self.h) return self.h.data, selStart, selEnd - + def mapfile(self, file): if type(file) != type(''): file = file.as_tuple()[2] return self.ic.ICMapFilename(file) - + def maptypecreator(self, type, creator, filename=""): return self.ic.ICMapTypeCreator(type, creator, filename) - + def settypecreator(self, file): file = Carbon.File.pathname(file) record = self.mapfile(os.path.split(file)[1]) MacOS.SetCreatorAndType(file, record[2], record[1]) macostools.touched(fss) - + # Convenience routines _dft_ic = None @@ -233,27 +233,27 @@ def launchurl(url, hint=""): global _dft_ic if _dft_ic == None: _dft_ic = IC() return _dft_ic.launchurl(url, hint) - + def parseurl(data, start=None, end=None, hint=""): global _dft_ic if _dft_ic == None: _dft_ic = IC() return _dft_ic.parseurl(data, start, end, hint) - + def mapfile(filename): global _dft_ic if _dft_ic == None: _dft_ic = IC() return _dft_ic.mapfile(filename) - + def maptypecreator(type, creator, filename=""): global _dft_ic if _dft_ic == None: _dft_ic = IC() return _dft_ic.maptypecreator(type, creator, filename) - + def settypecreator(file): global _dft_ic if _dft_ic == None: _dft_ic = IC() return _dft_ic.settypecreator(file) - + def _test(): ic = IC() for k in ic.keys(): @@ -263,7 +263,6 @@ def _test(): v = '????' print k, '\t', v sys.exit(1) - + if __name__ == '__main__': _test() - diff --git a/Lib/plat-mac/icopen.py b/Lib/plat-mac/icopen.py index 99e866e..eea6083 100644 --- a/Lib/plat-mac/icopen.py +++ b/Lib/plat-mac/icopen.py @@ -42,18 +42,18 @@ import __builtin__ _builtin_open = globals().get('_builtin_open', __builtin__.open) def _open_with_typer(*args): - file = _builtin_open(*args) - filename = args[0] - mode = 'r' - if args[1:]: - mode = args[1] - if mode[0] == 'w': - from ic import error, settypecreator - try: - settypecreator(filename) - except error: - pass - return file + file = _builtin_open(*args) + filename = args[0] + mode = 'r' + if args[1:]: + mode = args[1] + if mode[0] == 'w': + from ic import error, settypecreator + try: + settypecreator(filename) + except error: + pass + return file __builtin__.open = _open_with_typer diff --git a/Lib/plat-mac/lib-scriptpackages/CodeWarrior/CodeWarrior_suite.py b/Lib/plat-mac/lib-scriptpackages/CodeWarrior/CodeWarrior_suite.py index 033703c..0fd562b 100644 --- a/Lib/plat-mac/lib-scriptpackages/CodeWarrior/CodeWarrior_suite.py +++ b/Lib/plat-mac/lib-scriptpackages/CodeWarrior/CodeWarrior_suite.py @@ -580,44 +580,44 @@ text_document._privelemdict = { 'text' : Standard_Suite.text, } _Enum_DKND = { - 'project' : 'PRJD', # a project document - 'editor_document' : 'EDIT', # an editor document - 'message' : 'MSSG', # a message document - 'file_compare' : 'COMP', # a file compare document - 'catalog_document' : 'CTLG', # a browser catalog - 'class_browser' : 'BROW', # a class browser document - 'single_class_browser' : '1BRW', # a single class browser document - 'symbol_browser' : 'SYMB', # a symbol browser document - 'class_hierarchy' : 'HIER', # a class hierarchy document - 'single_class_hierarchy' : '1HIR', # a single class hierarchy document - 'project_inspector' : 'INSP', # a project inspector - 'ToolServer_worksheet' : 'TOOL', # the ToolServer worksheet - 'build_progress_document' : 'PRGS', # the build progress window + 'project' : 'PRJD', # a project document + 'editor_document' : 'EDIT', # an editor document + 'message' : 'MSSG', # a message document + 'file_compare' : 'COMP', # a file compare document + 'catalog_document' : 'CTLG', # a browser catalog + 'class_browser' : 'BROW', # a class browser document + 'single_class_browser' : '1BRW', # a single class browser document + 'symbol_browser' : 'SYMB', # a symbol browser document + 'class_hierarchy' : 'HIER', # a class hierarchy document + 'single_class_hierarchy' : '1HIR', # a single class hierarchy document + 'project_inspector' : 'INSP', # a project inspector + 'ToolServer_worksheet' : 'TOOL', # the ToolServer worksheet + 'build_progress_document' : 'PRGS', # the build progress window } _Enum_FTYP = { - 'library_file' : 'LIBF', # a library file - 'project_file' : 'PRJF', # a project file - 'resource_file' : 'RESF', # a resource file - 'text_file' : 'TXTF', # a text file - 'unknown_file' : 'UNKN', # unknown file type + 'library_file' : 'LIBF', # a library file + 'project_file' : 'PRJF', # a project file + 'resource_file' : 'RESF', # a resource file + 'text_file' : 'TXTF', # a text file + 'unknown_file' : 'UNKN', # unknown file type } _Enum_Inte = { - 'never_interact' : 'eNvr', # never allow user interactions - 'interact_with_self' : 'eInS', # allow user interaction only when an AppleEvent is sent from within CodeWarrior - 'interact_with_local' : 'eInL', # allow user interaction when AppleEvents are sent from applications on the same machine (default) - 'interact_with_all' : 'eInA', # allow user interaction from both local and remote AppleEvents + 'never_interact' : 'eNvr', # never allow user interactions + 'interact_with_self' : 'eInS', # allow user interaction only when an AppleEvent is sent from within CodeWarrior + 'interact_with_local' : 'eInL', # allow user interaction when AppleEvents are sent from applications on the same machine (default) + 'interact_with_all' : 'eInA', # allow user interaction from both local and remote AppleEvents } _Enum_PERM = { - 'read_write' : 'RdWr', # the file is open with read/write permission - 'read_only' : 'Read', # the file is open with read/only permission - 'checked_out_read_write' : 'CkRW', # the file is checked out with read/write permission - 'checked_out_read_only' : 'CkRO', # the file is checked out with read/only permission - 'checked_out_read_modify' : 'CkRM', # the file is checked out with read/modify permission - 'locked' : 'Lock', # the file is locked on disk - 'none' : 'LNNO', # the file is new + 'read_write' : 'RdWr', # the file is open with read/write permission + 'read_only' : 'Read', # the file is open with read/only permission + 'checked_out_read_write' : 'CkRW', # the file is checked out with read/write permission + 'checked_out_read_only' : 'CkRO', # the file is checked out with read/only permission + 'checked_out_read_modify' : 'CkRM', # the file is checked out with read/modify permission + 'locked' : 'Lock', # the file is locked on disk + 'none' : 'LNNO', # the file is new } diff --git a/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Metrowerks_Shell_Suite.py b/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Metrowerks_Shell_Suite.py index 3beb089..909cdc0 100644 --- a/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Metrowerks_Shell_Suite.py +++ b/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Metrowerks_Shell_Suite.py @@ -2025,110 +2025,110 @@ Font._privpropdict = { Font._privelemdict = { } _Enum_Acce = { - 'public' : 'Publ', # - 'protected' : 'Prot', # - 'private' : 'Priv', # + 'public' : 'Publ', # + 'protected' : 'Prot', # + 'private' : 'Priv', # } _Enum_BXbr = { - 'Always_Build' : 'BXb1', # Always build the target before running. - 'Ask_Build' : 'BXb2', # Ask before building the target when running. - 'Never_Build' : 'BXb3', # Never before building the target before running. + 'Always_Build' : 'BXb1', # Always build the target before running. + 'Ask_Build' : 'BXb2', # Ask before building the target when running. + 'Never_Build' : 'BXb3', # Never before building the target before running. } _Enum_DbSA = { - 'No_Action' : 'DSA1', # Don\xd5t do anything to non-debug windows - 'Hide_Windows' : 'DSA2', # Hide non-debugging windows - 'Collapse_Windows' : 'DSA3', # Collapse non-debugging windows - 'Close_Windows' : 'DSA4', # Close non-debugging windows + 'No_Action' : 'DSA1', # Don\xd5t do anything to non-debug windows + 'Hide_Windows' : 'DSA2', # Hide non-debugging windows + 'Collapse_Windows' : 'DSA3', # Collapse non-debugging windows + 'Close_Windows' : 'DSA4', # Close non-debugging windows } _Enum_DgBL = { - 'Always' : 'DgB0', # Always build before debugging. - 'Never' : 'DgB1', # Never build before debugging. - 'Ask' : 'DgB2', # Ask about building before debugging. + 'Always' : 'DgB0', # Always build before debugging. + 'Never' : 'DgB1', # Never build before debugging. + 'Ask' : 'DgB2', # Ask about building before debugging. } _Enum_ErrT = { - 'information' : 'ErIn', # - 'compiler_warning' : 'ErCW', # - 'compiler_error' : 'ErCE', # - 'definition' : 'ErDf', # - 'linker_warning' : 'ErLW', # - 'linker_error' : 'ErLE', # - 'find_result' : 'ErFn', # - 'generic_error' : 'ErGn', # + 'information' : 'ErIn', # + 'compiler_warning' : 'ErCW', # + 'compiler_error' : 'ErCE', # + 'definition' : 'ErDf', # + 'linker_warning' : 'ErLW', # + 'linker_error' : 'ErLE', # + 'find_result' : 'ErFn', # + 'generic_error' : 'ErGn', # } _Enum_Inte = { - 'never_interact' : 'eNvr', # Never allow user interactions - 'interact_with_self' : 'eInS', # Allow user interaction only when an AppleEvent is sent from within CodeWarrior - 'interact_with_local' : 'eInL', # Allow user interaction when AppleEvents are sent from applications on the same machine (default) - 'interact_with_all' : 'eInA', # Allow user interaction from both local and remote AppleEvents + 'never_interact' : 'eNvr', # Never allow user interactions + 'interact_with_self' : 'eInS', # Allow user interaction only when an AppleEvent is sent from within CodeWarrior + 'interact_with_local' : 'eInL', # Allow user interaction when AppleEvents are sent from applications on the same machine (default) + 'interact_with_all' : 'eInA', # Allow user interaction from both local and remote AppleEvents } _Enum_Lang = { - 'C' : 'LC ', # - 'C_2b__2b_' : 'LC++', # - 'Pascal' : 'LP ', # - 'Object_Pascal' : 'LP++', # - 'Java' : 'LJav', # - 'Assembler' : 'LAsm', # - 'Unknown' : 'L? ', # + 'C' : 'LC ', # + 'C_2b__2b_' : 'LC++', # + 'Pascal' : 'LP ', # + 'Object_Pascal' : 'LP++', # + 'Java' : 'LJav', # + 'Assembler' : 'LAsm', # + 'Unknown' : 'L? ', # } _Enum_PPrm = { - 'absolute' : 'Abso', # An absolute path name, including volume name. - 'project_relative' : 'PRel', # A path relative to the current project\xd5s folder. - 'shell_relative' : 'SRel', # A path relative to the CodeWarrior\xaa folder. - 'system_relative' : 'YRel', # A path relative to the system folder - 'root_relative' : 'RRel', # + 'absolute' : 'Abso', # An absolute path name, including volume name. + 'project_relative' : 'PRel', # A path relative to the current project\xd5s folder. + 'shell_relative' : 'SRel', # A path relative to the CodeWarrior\xaa folder. + 'system_relative' : 'YRel', # A path relative to the system folder + 'root_relative' : 'RRel', # } _Enum_PXdg = { - 'Diagnose_None' : 'PXd1', # No Plugin Diagnostics. - 'Diagnose_Errors' : 'PXd2', # Plugin Diagnostics for errors only. - 'Diagnose_All' : 'PXd3', # Plugin Diagnostics for everything. + 'Diagnose_None' : 'PXd1', # No Plugin Diagnostics. + 'Diagnose_Errors' : 'PXd2', # Plugin Diagnostics for errors only. + 'Diagnose_All' : 'PXd3', # Plugin Diagnostics for everything. } _Enum_PthF = { - 'Generic_Path' : 'PFGn', # - 'MacOS_Path' : 'PFMc', # MacOS path using colon as separator - 'Windows_Path' : 'PFWn', # Windows path using backslash as separator - 'Unix_Path' : 'PFUx', # Unix path using slash as separator + 'Generic_Path' : 'PFGn', # + 'MacOS_Path' : 'PFMc', # MacOS path using colon as separator + 'Windows_Path' : 'PFWn', # Windows path using backslash as separator + 'Unix_Path' : 'PFUx', # Unix path using slash as separator } _Enum_RefP = { - 'Think_Reference' : 'DanR', # - 'QuickView' : 'ALTV', # + 'Think_Reference' : 'DanR', # + 'QuickView' : 'ALTV', # } _Enum_STKd = { - 'Absolute_Path' : 'STK0', # The \xd2path\xd3 property is an absolute path to the location of the source tree. - 'Registry_Key' : 'STK1', # The \xd2path\xd3 property is the name of a registry key that contains the path to the root. - 'Environment_Variable' : 'STK2', # The \xd2path\xd3 property is the name of an environment variable that contains the path to the root. + 'Absolute_Path' : 'STK0', # The \xd2path\xd3 property is an absolute path to the location of the source tree. + 'Registry_Key' : 'STK1', # The \xd2path\xd3 property is the name of a registry key that contains the path to the root. + 'Environment_Variable' : 'STK2', # The \xd2path\xd3 property is the name of an environment variable that contains the path to the root. } _Enum_SrcT = { - 'source' : 'FTxt', # A source file (.c, .cp, .p, etc). - 'unknown' : 'FUnk', # An unknown file type. + 'source' : 'FTxt', # A source file (.c, .cp, .p, etc). + 'unknown' : 'FUnk', # An unknown file type. } _Enum_TmpB = { - 'User_Specified' : 'Usrs', # Use user specified symbols when setting temporary breakpoints on program launch. - 'Default' : 'Dflt', # Use system default symbols when setting temporary breakpoints on program launch. + 'User_Specified' : 'Usrs', # Use user specified symbols when setting temporary breakpoints on program launch. + 'Default' : 'Dflt', # Use system default symbols when setting temporary breakpoints on program launch. } _Enum_TxtF = { - 'MacOS' : 'TxF0', # MacOS text format - 'DOS' : 'TxF1', # DOS text format - 'Unix' : 'TxF2', # Unix text format + 'MacOS' : 'TxF0', # MacOS text format + 'DOS' : 'TxF1', # DOS text format + 'Unix' : 'TxF2', # Unix text format } _Enum_savo = { - 'yes' : 'yes ', # Save changes - 'no' : 'no ', # Do not save changes - 'ask' : 'ask ', # Ask the user whether to save + 'yes' : 'yes ', # Save changes + 'no' : 'no ', # Do not save changes + 'ask' : 'ask ', # Ask the user whether to save } diff --git a/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Required.py b/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Required.py index a2c0de8..b0749e8 100644 --- a/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Required.py +++ b/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Required.py @@ -40,8 +40,8 @@ class Required_Events(Required_Suite_Events): return _arguments['----'] _Enum_Conv = { - 'yes' : 'yes ', # Convert the project if necessary on open - 'no' : 'no ', # Do not convert the project if needed on open + 'yes' : 'yes ', # Convert the project if necessary on open + 'no' : 'no ', # Do not convert the project if needed on open } diff --git a/Lib/plat-mac/lib-scriptpackages/CodeWarrior/__init__.py b/Lib/plat-mac/lib-scriptpackages/CodeWarrior/__init__.py index 43ae404..5ef7ca9 100644 --- a/Lib/plat-mac/lib-scriptpackages/CodeWarrior/__init__.py +++ b/Lib/plat-mac/lib-scriptpackages/CodeWarrior/__init__.py @@ -187,4 +187,3 @@ class CodeWarrior(CodeWarrior_suite_Events, _signature = 'CWIE' _moduleName = 'CodeWarrior' - diff --git a/Lib/plat-mac/lib-scriptpackages/Explorer/Required_Suite.py b/Lib/plat-mac/lib-scriptpackages/Explorer/Required_Suite.py index e023acd..0a985d1 100644 --- a/Lib/plat-mac/lib-scriptpackages/Explorer/Required_Suite.py +++ b/Lib/plat-mac/lib-scriptpackages/Explorer/Required_Suite.py @@ -73,7 +73,7 @@ class Required_Suite_Events(Required_Suite_Events): return _arguments['----'] def run(self, _no_object=None, _attributes={}, **_arguments): - """run: + """run: Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'aevt' diff --git a/Lib/plat-mac/lib-scriptpackages/Explorer/Standard_Suite.py b/Lib/plat-mac/lib-scriptpackages/Explorer/Standard_Suite.py index af68e25..7ead98a 100644 --- a/Lib/plat-mac/lib-scriptpackages/Explorer/Standard_Suite.py +++ b/Lib/plat-mac/lib-scriptpackages/Explorer/Standard_Suite.py @@ -17,7 +17,7 @@ class Standard_Suite_Events: } def get(self, _object, _attributes={}, **_arguments): - """get: + """get: Required argument: an AE object reference Keyword argument as: undocumented, typecode 'type' Keyword argument _attributes: AppleEvent attribute dictionary diff --git a/Lib/plat-mac/lib-scriptpackages/Explorer/Web_Browser_Suite.py b/Lib/plat-mac/lib-scriptpackages/Explorer/Web_Browser_Suite.py index a05d795..ff808eb 100644 --- a/Lib/plat-mac/lib-scriptpackages/Explorer/Web_Browser_Suite.py +++ b/Lib/plat-mac/lib-scriptpackages/Explorer/Web_Browser_Suite.py @@ -84,7 +84,7 @@ class Web_Browser_Suite_Events: """GetWindowInfo: Returns a window info record (URL/Title) for the specified window. Required argument: Window Identifier of the window Keyword argument _attributes: AppleEvent attribute dictionary - Returns: + Returns: """ _code = 'WWW!' _subcode = 'WNFO' diff --git a/Lib/plat-mac/lib-scriptpackages/Finder/Enumerations.py b/Lib/plat-mac/lib-scriptpackages/Finder/Enumerations.py index 38336cc..558d7ff 100644 --- a/Lib/plat-mac/lib-scriptpackages/Finder/Enumerations.py +++ b/Lib/plat-mac/lib-scriptpackages/Finder/Enumerations.py @@ -16,106 +16,106 @@ class Enumerations_Events(Type_Names_Suite_Events): pass _Enum_earr = { - 'not_arranged' : 'narr', # - 'snap_to_grid' : 'grda', # - 'arranged_by_name' : 'nama', # - 'arranged_by_modification_date' : 'mdta', # - 'arranged_by_creation_date' : 'cdta', # - 'arranged_by_size' : 'siza', # - 'arranged_by_kind' : 'kina', # - 'arranged_by_label' : 'laba', # + 'not_arranged' : 'narr', # + 'snap_to_grid' : 'grda', # + 'arranged_by_name' : 'nama', # + 'arranged_by_modification_date' : 'mdta', # + 'arranged_by_creation_date' : 'cdta', # + 'arranged_by_size' : 'siza', # + 'arranged_by_kind' : 'kina', # + 'arranged_by_label' : 'laba', # } _Enum_ecvw = { - 'icon_view' : 'icnv', # - 'list_view' : 'lsvw', # - 'column_view' : 'clvw', # + 'icon_view' : 'icnv', # + 'list_view' : 'lsvw', # + 'column_view' : 'clvw', # } _Enum_edfm = { - 'Mac_OS_format' : 'dfhf', # - 'Mac_OS_Extended_format' : 'dfh+', # - 'UFS_format' : 'dfuf', # - 'NFS_format' : 'dfnf', # - 'audio_format' : 'dfau', # - 'ProDOS_format' : 'dfpr', # - 'MS_2d_DOS_format' : 'dfms', # - 'ISO_9660_format' : 'df96', # - 'High_Sierra_format' : 'dfhs', # - 'QuickTake_format' : 'dfqt', # - 'Apple_Photo_format' : 'dfph', # - 'AppleShare_format' : 'dfas', # - 'UDF_format' : 'dfud', # - 'WebDAV_format' : 'dfwd', # - 'FTP_format' : 'dfft', # - 'Packet_2d_written_UDF_format' : 'dfpu', # - 'unknown_format' : 'df??', # + 'Mac_OS_format' : 'dfhf', # + 'Mac_OS_Extended_format' : 'dfh+', # + 'UFS_format' : 'dfuf', # + 'NFS_format' : 'dfnf', # + 'audio_format' : 'dfau', # + 'ProDOS_format' : 'dfpr', # + 'MS_2d_DOS_format' : 'dfms', # + 'ISO_9660_format' : 'df96', # + 'High_Sierra_format' : 'dfhs', # + 'QuickTake_format' : 'dfqt', # + 'Apple_Photo_format' : 'dfph', # + 'AppleShare_format' : 'dfas', # + 'UDF_format' : 'dfud', # + 'WebDAV_format' : 'dfwd', # + 'FTP_format' : 'dfft', # + 'Packet_2d_written_UDF_format' : 'dfpu', # + 'unknown_format' : 'df??', # } _Enum_elsv = { - 'name_column' : 'elsn', # - 'modification_date_column' : 'elsm', # - 'creation_date_column' : 'elsc', # - 'size_column' : 'elss', # - 'kind_column' : 'elsk', # - 'label_column' : 'elsl', # - 'version_column' : 'elsv', # - 'comment_column' : 'elsC', # + 'name_column' : 'elsn', # + 'modification_date_column' : 'elsm', # + 'creation_date_column' : 'elsc', # + 'size_column' : 'elss', # + 'kind_column' : 'elsk', # + 'label_column' : 'elsl', # + 'version_column' : 'elsv', # + 'comment_column' : 'elsC', # } _Enum_ipnl = { - 'General_Information_panel' : 'gpnl', # - 'Sharing_panel' : 'spnl', # - 'Memory_panel' : 'mpnl', # - 'Preview_panel' : 'vpnl', # - 'Application_panel' : 'apnl', # - 'Languages_panel' : 'pklg', # - 'Plugins_panel' : 'pkpg', # - 'Name__26__Extension_panel' : 'npnl', # - 'Comments_panel' : 'cpnl', # - 'Content_Index_panel' : 'cinl', # + 'General_Information_panel' : 'gpnl', # + 'Sharing_panel' : 'spnl', # + 'Memory_panel' : 'mpnl', # + 'Preview_panel' : 'vpnl', # + 'Application_panel' : 'apnl', # + 'Languages_panel' : 'pklg', # + 'Plugins_panel' : 'pkpg', # + 'Name__26__Extension_panel' : 'npnl', # + 'Comments_panel' : 'cpnl', # + 'Content_Index_panel' : 'cinl', # } _Enum_isiz = { - 'mini' : 'miic', # - 'small' : 'smic', # - 'large' : 'lgic', # + 'mini' : 'miic', # + 'small' : 'smic', # + 'large' : 'lgic', # } _Enum_lvic = { - 'small_icon' : 'smic', # - 'large_icon' : 'lgic', # + 'small_icon' : 'smic', # + 'large_icon' : 'lgic', # } _Enum_priv = { - 'read_only' : 'read', # - 'read_write' : 'rdwr', # - 'write_only' : 'writ', # - 'none' : 'none', # + 'read_only' : 'read', # + 'read_write' : 'rdwr', # + 'write_only' : 'writ', # + 'none' : 'none', # } _Enum_sodr = { - 'normal' : 'snrm', # - 'reversed' : 'srvs', # + 'normal' : 'snrm', # + 'reversed' : 'srvs', # } _Enum_vwby = { - 'conflicts' : 'cflc', # - 'existing_items' : 'exsi', # - 'small_icon' : 'smic', # - 'icon' : 'iimg', # - 'name' : 'pnam', # - 'modification_date' : 'asmo', # - 'size' : 'ptsz', # - 'kind' : 'kind', # - 'comment' : 'comt', # - 'label' : 'labi', # - 'version' : 'vers', # - 'creation_date' : 'ascd', # - 'small_button' : 'smbu', # - 'large_button' : 'lgbu', # - 'grid' : 'grid', # - 'all' : 'kyal', # + 'conflicts' : 'cflc', # + 'existing_items' : 'exsi', # + 'small_icon' : 'smic', # + 'icon' : 'iimg', # + 'name' : 'pnam', # + 'modification_date' : 'asmo', # + 'size' : 'ptsz', # + 'kind' : 'kind', # + 'comment' : 'comt', # + 'label' : 'labi', # + 'version' : 'vers', # + 'creation_date' : 'ascd', # + 'small_button' : 'smbu', # + 'large_button' : 'lgbu', # + 'grid' : 'grid', # + 'all' : 'kyal', # } diff --git a/Lib/plat-mac/lib-scriptpackages/Netscape/Mozilla_suite.py b/Lib/plat-mac/lib-scriptpackages/Netscape/Mozilla_suite.py index a40510e..f4aea73 100644 --- a/Lib/plat-mac/lib-scriptpackages/Netscape/Mozilla_suite.py +++ b/Lib/plat-mac/lib-scriptpackages/Netscape/Mozilla_suite.py @@ -224,29 +224,29 @@ class Mozilla_suite_Events: return _arguments['----'] _Enum_comp = { - 'Navigator' : 'navg', # The Navigator component - 'InBox' : 'inbx', # The InBox component - 'Newsgroups' : 'colb', # The Newsgroups component - 'Composer' : 'cpsr', # The Page Composer component - 'Conference' : 'conf', # The Conference Component - 'Calendar' : 'cald', # The Calendar Component + 'Navigator' : 'navg', # The Navigator component + 'InBox' : 'inbx', # The InBox component + 'Newsgroups' : 'colb', # The Newsgroups component + 'Composer' : 'cpsr', # The Page Composer component + 'Conference' : 'conf', # The Conference Component + 'Calendar' : 'cald', # The Calendar Component } _Enum_dire = { - 'again' : 'agai', # Again (reload) - 'home' : 'home', # Home - 'backward' : 'prev', # Previous page - 'forward' : 'next', # Next page + 'again' : 'agai', # Again (reload) + 'home' : 'home', # Home + 'backward' : 'prev', # Previous page + 'forward' : 'next', # Next page } _Enum_ncmd = { - 'Get_new_mail' : '\x00\x00\x04W', # - 'Send_queued_messages' : '\x00\x00\x04X', # - 'Read_newsgroups' : '\x00\x00\x04\x04', # - 'Show_Inbox' : '\x00\x00\x04\x05', # - 'Show_Bookmarks_window' : '\x00\x00\x04\x06', # - 'Show_History_window' : '\x00\x00\x04\x07', # - 'Show_Address_Book_window' : '\x00\x00\x04\t', # + 'Get_new_mail' : '\x00\x00\x04W', # + 'Send_queued_messages' : '\x00\x00\x04X', # + 'Read_newsgroups' : '\x00\x00\x04\x04', # + 'Show_Inbox' : '\x00\x00\x04\x05', # + 'Show_Bookmarks_window' : '\x00\x00\x04\x06', # + 'Show_History_window' : '\x00\x00\x04\x07', # + 'Show_Address_Book_window' : '\x00\x00\x04\t', # } diff --git a/Lib/plat-mac/lib-scriptpackages/Netscape/PowerPlant.py b/Lib/plat-mac/lib-scriptpackages/Netscape/PowerPlant.py index 30fe566..7767305 100644 --- a/Lib/plat-mac/lib-scriptpackages/Netscape/PowerPlant.py +++ b/Lib/plat-mac/lib-scriptpackages/Netscape/PowerPlant.py @@ -1,4 +1,4 @@ -"""Suite PowerPlant: +"""Suite PowerPlant: Level 0, version 0 Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 @@ -62,10 +62,10 @@ class PowerPlant_Events: return _arguments['----'] _Enum_dbac = { - 'DoNothing' : '\x00\x00\x00\x00', # No debugging action is taken. - 'PostAlert' : '\x00\x00\x00\x01', # Post an alert. - 'LowLevelDebugger' : '\x00\x00\x00\x02', # Break into the low level debugger (MacsBug). - 'SourceDebugger' : '\x00\x00\x00\x03', # Break into the source level debugger (if source debugger is executing). + 'DoNothing' : '\x00\x00\x00\x00', # No debugging action is taken. + 'PostAlert' : '\x00\x00\x00\x01', # Post an alert. + 'LowLevelDebugger' : '\x00\x00\x00\x02', # Break into the low level debugger (MacsBug). + 'SourceDebugger' : '\x00\x00\x00\x03', # Break into the source level debugger (if source debugger is executing). } diff --git a/Lib/plat-mac/lib-scriptpackages/Netscape/Required_suite.py b/Lib/plat-mac/lib-scriptpackages/Netscape/Required_suite.py index 5352bb1..b5c4110 100644 --- a/Lib/plat-mac/lib-scriptpackages/Netscape/Required_suite.py +++ b/Lib/plat-mac/lib-scriptpackages/Netscape/Required_suite.py @@ -1,4 +1,4 @@ -"""Suite Required suite: +"""Suite Required suite: Level 0, version 0 Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 diff --git a/Lib/plat-mac/lib-scriptpackages/Netscape/Standard_URL_suite.py b/Lib/plat-mac/lib-scriptpackages/Netscape/Standard_URL_suite.py index 94847aa..de4a01c 100644 --- a/Lib/plat-mac/lib-scriptpackages/Netscape/Standard_URL_suite.py +++ b/Lib/plat-mac/lib-scriptpackages/Netscape/Standard_URL_suite.py @@ -22,8 +22,8 @@ class Standard_URL_suite_Events: def GetURL(self, _object, _attributes={}, **_arguments): """GetURL: Loads the URL (optionally to disk) - Required argument: The url - Keyword argument to: file the URL should be loaded into + Required argument: The url + Keyword argument to: file the URL should be loaded into Keyword argument inside: Window the URL should be loaded to Keyword argument from_: Referrer, to be sent with the HTTP request Keyword argument _attributes: AppleEvent attribute dictionary diff --git a/Lib/plat-mac/lib-scriptpackages/Netscape/Text.py b/Lib/plat-mac/lib-scriptpackages/Netscape/Text.py index 4515d4b..2360d94 100644 --- a/Lib/plat-mac/lib-scriptpackages/Netscape/Text.py +++ b/Lib/plat-mac/lib-scriptpackages/Netscape/Text.py @@ -1,4 +1,4 @@ -"""Suite Text: +"""Suite Text: Level 0, version 0 Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 diff --git a/Lib/plat-mac/lib-scriptpackages/Netscape/WorldWideWeb_suite.py b/Lib/plat-mac/lib-scriptpackages/Netscape/WorldWideWeb_suite.py index 152c24a..06cbfa7 100644 --- a/Lib/plat-mac/lib-scriptpackages/Netscape/WorldWideWeb_suite.py +++ b/Lib/plat-mac/lib-scriptpackages/Netscape/WorldWideWeb_suite.py @@ -1,4 +1,4 @@ -"""Suite WorldWideWeb suite, as defined in Spyglass spec.: +"""Suite WorldWideWeb suite, as defined in Spyglass spec.: Level 1, version 1 Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 @@ -317,7 +317,7 @@ class WorldWideWeb_suite_Events: def unregister_protocol(self, _object=None, _attributes={}, **_arguments): """unregister protocol: reverses the effects of \xd2register protocol\xd3 - Required argument: Application sig. + Required argument: Application sig. Keyword argument for_protocol: protocol prefix. If none, unregister for all protocols Keyword argument _attributes: AppleEvent attribute dictionary Returns: TRUE if successful diff --git a/Lib/plat-mac/lib-scriptpackages/StdSuites/AppleScript_Suite.py b/Lib/plat-mac/lib-scriptpackages/StdSuites/AppleScript_Suite.py index 251fd77..574043d 100644 --- a/Lib/plat-mac/lib-scriptpackages/StdSuites/AppleScript_Suite.py +++ b/Lib/plat-mac/lib-scriptpackages/StdSuites/AppleScript_Suite.py @@ -1995,64 +1995,64 @@ zones._privpropdict = { zones._privelemdict = { } _Enum_boov = { - 'true' : 'true', # the true boolean value - 'false' : 'fals', # the false boolean value + 'true' : 'true', # the true boolean value + 'false' : 'fals', # the false boolean value } _Enum_cons = { - 'case' : 'case', # case - 'diacriticals' : 'diac', # diacriticals - 'white_space' : 'whit', # white space - 'hyphens' : 'hyph', # hyphens - 'expansion' : 'expa', # expansion - 'punctuation' : 'punc', # punctuation - 'application_responses' : 'rmte', # remote event replies + 'case' : 'case', # case + 'diacriticals' : 'diac', # diacriticals + 'white_space' : 'whit', # white space + 'hyphens' : 'hyph', # hyphens + 'expansion' : 'expa', # expansion + 'punctuation' : 'punc', # punctuation + 'application_responses' : 'rmte', # remote event replies } _Enum_eMds = { - 'option_down' : 'Kopt', # - 'command_down' : 'Kcmd', # - 'control_down' : 'Kctl', # - 'shift_down' : 'Ksft', # - 'caps_lock_down' : 'Kclk', # + 'option_down' : 'Kopt', # + 'command_down' : 'Kcmd', # + 'control_down' : 'Kctl', # + 'shift_down' : 'Ksft', # + 'caps_lock_down' : 'Kclk', # } _Enum_ekst = { - 'escape_key' : 'ks5\x00', # - 'delete_key' : 'ks3\x00', # - 'tab_key' : 'ks0\x00', # - 'return_key' : 'ks$\x00', # - 'clear_key' : 'ksG\x00', # - 'enter_key' : 'ksL\x00', # - 'up_arrow_key' : 'ks~\x00', # - 'down_arrow_key' : 'ks}\x00', # - 'left_arrow_key' : 'ks{\x00', # - 'right_arrow_key' : 'ks|\x00', # - 'help_key' : 'ksr\x00', # - 'home_key' : 'kss\x00', # - 'page_up_key' : 'kst\x00', # - 'page_down_key' : 'ksy\x00', # - 'forward_del_key' : 'ksu\x00', # - 'end_key' : 'ksw\x00', # - 'F1_key' : 'ksz\x00', # - 'F2_key' : 'ksx\x00', # - 'F3_key' : 'ksc\x00', # - 'F4_key' : 'ksv\x00', # - 'F5_key' : 'ks`\x00', # - 'F6_key' : 'ksa\x00', # - 'F7_key' : 'ksb\x00', # - 'F8_key' : 'ksd\x00', # - 'F9_key' : 'kse\x00', # - 'F10_key' : 'ksm\x00', # - 'F11_key' : 'ksg\x00', # - 'F12_key' : 'kso\x00', # - 'F13_key' : 'ksi\x00', # - 'F14_key' : 'ksk\x00', # - 'F15_key' : 'ksq\x00', # + 'escape_key' : 'ks5\x00', # + 'delete_key' : 'ks3\x00', # + 'tab_key' : 'ks0\x00', # + 'return_key' : 'ks$\x00', # + 'clear_key' : 'ksG\x00', # + 'enter_key' : 'ksL\x00', # + 'up_arrow_key' : 'ks~\x00', # + 'down_arrow_key' : 'ks}\x00', # + 'left_arrow_key' : 'ks{\x00', # + 'right_arrow_key' : 'ks|\x00', # + 'help_key' : 'ksr\x00', # + 'home_key' : 'kss\x00', # + 'page_up_key' : 'kst\x00', # + 'page_down_key' : 'ksy\x00', # + 'forward_del_key' : 'ksu\x00', # + 'end_key' : 'ksw\x00', # + 'F1_key' : 'ksz\x00', # + 'F2_key' : 'ksx\x00', # + 'F3_key' : 'ksc\x00', # + 'F4_key' : 'ksv\x00', # + 'F5_key' : 'ks`\x00', # + 'F6_key' : 'ksa\x00', # + 'F7_key' : 'ksb\x00', # + 'F8_key' : 'ksd\x00', # + 'F9_key' : 'kse\x00', # + 'F10_key' : 'ksm\x00', # + 'F11_key' : 'ksg\x00', # + 'F12_key' : 'kso\x00', # + 'F13_key' : 'ksi\x00', # + 'F14_key' : 'ksk\x00', # + 'F15_key' : 'ksq\x00', # } _Enum_misc = { - 'current_application' : 'cura', # the current application + 'current_application' : 'cura', # the current application } diff --git a/Lib/plat-mac/lib-scriptpackages/StdSuites/Macintosh_Connectivity_Clas.py b/Lib/plat-mac/lib-scriptpackages/StdSuites/Macintosh_Connectivity_Clas.py index 5fa06dd..99fe5e3 100644 --- a/Lib/plat-mac/lib-scriptpackages/StdSuites/Macintosh_Connectivity_Clas.py +++ b/Lib/plat-mac/lib-scriptpackages/StdSuites/Macintosh_Connectivity_Clas.py @@ -253,74 +253,74 @@ USB_address._privpropdict = { USB_address._privelemdict = { } _Enum_econ = { - 'ADB' : 'eadb', # - 'printer_port' : 'ecpp', # - 'modem_port' : 'ecmp', # - 'modem_printer_port' : 'empp', # - 'LocalTalk' : 'eclt', # - 'Ethernet' : 'ecen', # - 'Token_Ring' : 'etok', # - 'SCSI' : 'ecsc', # - 'USB' : 'ecus', # - 'FireWire' : 'ecfw', # - 'infrared' : 'ecir', # - 'PC_card' : 'ecpc', # - 'PCI_bus' : 'ecpi', # - 'NuBus' : 'enub', # - 'PDS_slot' : 'ecpd', # - 'Comm_slot' : 'eccm', # - 'monitor_out' : 'ecmn', # - 'video_out' : 'ecvo', # - 'video_in' : 'ecvi', # - 'audio_out' : 'ecao', # - 'audio_line_in' : 'ecai', # - 'audio_line_out' : 'ecal', # - 'microphone' : 'ecmi', # + 'ADB' : 'eadb', # + 'printer_port' : 'ecpp', # + 'modem_port' : 'ecmp', # + 'modem_printer_port' : 'empp', # + 'LocalTalk' : 'eclt', # + 'Ethernet' : 'ecen', # + 'Token_Ring' : 'etok', # + 'SCSI' : 'ecsc', # + 'USB' : 'ecus', # + 'FireWire' : 'ecfw', # + 'infrared' : 'ecir', # + 'PC_card' : 'ecpc', # + 'PCI_bus' : 'ecpi', # + 'NuBus' : 'enub', # + 'PDS_slot' : 'ecpd', # + 'Comm_slot' : 'eccm', # + 'monitor_out' : 'ecmn', # + 'video_out' : 'ecvo', # + 'video_in' : 'ecvi', # + 'audio_out' : 'ecao', # + 'audio_line_in' : 'ecai', # + 'audio_line_out' : 'ecal', # + 'microphone' : 'ecmi', # } _Enum_edvt = { - 'hard_disk_drive' : 'ehd ', # - 'floppy_disk_drive' : 'efd ', # - 'CD_ROM_drive' : 'ecd ', # - 'DVD_drive' : 'edvd', # - 'storage_device' : 'edst', # - 'keyboard' : 'ekbd', # - 'mouse' : 'emou', # - 'trackball' : 'etrk', # - 'trackpad' : 'edtp', # - 'pointing_device' : 'edpd', # - 'video_monitor' : 'edvm', # - 'LCD_display' : 'edlc', # - 'display' : 'edds', # - 'modem' : 'edmm', # - 'PC_card' : 'ecpc', # - 'PCI_card' : 'edpi', # - 'NuBus_card' : 'ednb', # - 'printer' : 'edpr', # - 'speakers' : 'edsp', # - 'microphone' : 'ecmi', # + 'hard_disk_drive' : 'ehd ', # + 'floppy_disk_drive' : 'efd ', # + 'CD_ROM_drive' : 'ecd ', # + 'DVD_drive' : 'edvd', # + 'storage_device' : 'edst', # + 'keyboard' : 'ekbd', # + 'mouse' : 'emou', # + 'trackball' : 'etrk', # + 'trackpad' : 'edtp', # + 'pointing_device' : 'edpd', # + 'video_monitor' : 'edvm', # + 'LCD_display' : 'edlc', # + 'display' : 'edds', # + 'modem' : 'edmm', # + 'PC_card' : 'ecpc', # + 'PCI_card' : 'edpi', # + 'NuBus_card' : 'ednb', # + 'printer' : 'edpr', # + 'speakers' : 'edsp', # + 'microphone' : 'ecmi', # } _Enum_epro = { - 'serial' : 'epsr', # - 'AppleTalk' : 'epat', # - 'IP' : 'epip', # - 'SCSI' : 'ecsc', # - 'ADB' : 'eadb', # - 'FireWire' : 'ecfw', # - 'IrDA' : 'epir', # - 'IRTalk' : 'epit', # - 'USB' : 'ecus', # - 'PC_card' : 'ecpc', # - 'PCI_bus' : 'ecpi', # - 'NuBus' : 'enub', # - 'bus' : 'ebus', # - 'Macintosh_video' : 'epmv', # - 'SVGA' : 'epsg', # - 'S_video' : 'epsv', # - 'analog_audio' : 'epau', # - 'digital_audio' : 'epda', # - 'PostScript' : 'epps', # + 'serial' : 'epsr', # + 'AppleTalk' : 'epat', # + 'IP' : 'epip', # + 'SCSI' : 'ecsc', # + 'ADB' : 'eadb', # + 'FireWire' : 'ecfw', # + 'IrDA' : 'epir', # + 'IRTalk' : 'epit', # + 'USB' : 'ecus', # + 'PC_card' : 'ecpc', # + 'PCI_bus' : 'ecpi', # + 'NuBus' : 'enub', # + 'bus' : 'ebus', # + 'Macintosh_video' : 'epmv', # + 'SVGA' : 'epsg', # + 'S_video' : 'epsv', # + 'analog_audio' : 'epau', # + 'digital_audio' : 'epda', # + 'PostScript' : 'epps', # } diff --git a/Lib/plat-mac/lib-scriptpackages/StdSuites/QuickDraw_Graphics_Suite.py b/Lib/plat-mac/lib-scriptpackages/StdSuites/QuickDraw_Graphics_Suite.py index f4b59f5..11747f9 100644 --- a/Lib/plat-mac/lib-scriptpackages/StdSuites/QuickDraw_Graphics_Suite.py +++ b/Lib/plat-mac/lib-scriptpackages/StdSuites/QuickDraw_Graphics_Suite.py @@ -327,28 +327,28 @@ graphic_line._privpropdict = { graphic_line._privelemdict = { } _Enum_arro = { - 'no_arrow' : 'arno', # No arrow on line - 'arrow_at_start' : 'arst', # Arrow at start of line - 'arrow_at_end' : 'aren', # Arrow at end of line - 'arrow_at_both_ends' : 'arbo', # Arrow at both the start and the end of the line + 'no_arrow' : 'arno', # No arrow on line + 'arrow_at_start' : 'arst', # Arrow at start of line + 'arrow_at_end' : 'aren', # Arrow at end of line + 'arrow_at_both_ends' : 'arbo', # Arrow at both the start and the end of the line } _Enum_tran = { - 'copy_pixels' : 'cpy ', # - 'not_copy_pixels' : 'ncpy', # - 'or_pixels' : 'or ', # - 'not_or_pixels' : 'ntor', # - 'bic_pixels' : 'bic ', # - 'not_bic_pixels' : 'nbic', # - 'xor_pixels' : 'xor ', # - 'not_xor_pixels' : 'nxor', # - 'add_over_pixels' : 'addo', # - 'add_pin_pixels' : 'addp', # - 'sub_over_pixels' : 'subo', # - 'sub_pin_pixels' : 'subp', # - 'ad_max_pixels' : 'admx', # - 'ad_min_pixels' : 'admn', # - 'blend_pixels' : 'blnd', # + 'copy_pixels' : 'cpy ', # + 'not_copy_pixels' : 'ncpy', # + 'or_pixels' : 'or ', # + 'not_or_pixels' : 'ntor', # + 'bic_pixels' : 'bic ', # + 'not_bic_pixels' : 'nbic', # + 'xor_pixels' : 'xor ', # + 'not_xor_pixels' : 'nxor', # + 'add_over_pixels' : 'addo', # + 'add_pin_pixels' : 'addp', # + 'sub_over_pixels' : 'subo', # + 'sub_pin_pixels' : 'subp', # + 'ad_max_pixels' : 'admx', # + 'ad_min_pixels' : 'admn', # + 'blend_pixels' : 'blnd', # } diff --git a/Lib/plat-mac/lib-scriptpackages/StdSuites/Standard_Suite.py b/Lib/plat-mac/lib-scriptpackages/StdSuites/Standard_Suite.py index de6d5e5..86681f5 100644 --- a/Lib/plat-mac/lib-scriptpackages/StdSuites/Standard_Suite.py +++ b/Lib/plat-mac/lib-scriptpackages/StdSuites/Standard_Suite.py @@ -656,33 +656,33 @@ class _b2_(aetools.NComparison): class _b3_(aetools.NComparison): """\xb3 - Greater than or equal to """ _Enum_kfrm = { - 'index' : 'indx', # keyform designating indexed access - 'named' : 'name', # keyform designating named access - 'id' : 'ID ', # keyform designating access by unique identifier + 'index' : 'indx', # keyform designating indexed access + 'named' : 'name', # keyform designating named access + 'id' : 'ID ', # keyform designating access by unique identifier } _Enum_savo = { - 'yes' : 'yes ', # Save objects now - 'no' : 'no ', # Do not save objects - 'ask' : 'ask ', # Ask the user whether to save + 'yes' : 'yes ', # Save objects now + 'no' : 'no ', # Do not save objects + 'ask' : 'ask ', # Ask the user whether to save } _Enum_styl = { - 'plain' : 'plan', # Plain - 'bold' : 'bold', # Bold - 'italic' : 'ital', # Italic - 'outline' : 'outl', # Outline - 'shadow' : 'shad', # Shadow - 'underline' : 'undl', # Underline - 'superscript' : 'spsc', # Superscript - 'subscript' : 'sbsc', # Subscript - 'strikethrough' : 'strk', # Strikethrough - 'small_caps' : 'smcp', # Small caps - 'all_caps' : 'alcp', # All capital letters - 'all_lowercase' : 'lowc', # Lowercase - 'condensed' : 'cond', # Condensed - 'expanded' : 'pexp', # Expanded - 'hidden' : 'hidn', # Hidden + 'plain' : 'plan', # Plain + 'bold' : 'bold', # Bold + 'italic' : 'ital', # Italic + 'outline' : 'outl', # Outline + 'shadow' : 'shad', # Shadow + 'underline' : 'undl', # Underline + 'superscript' : 'spsc', # Superscript + 'subscript' : 'sbsc', # Subscript + 'strikethrough' : 'strk', # Strikethrough + 'small_caps' : 'smcp', # Small caps + 'all_caps' : 'alcp', # All capital letters + 'all_lowercase' : 'lowc', # Lowercase + 'condensed' : 'cond', # Condensed + 'expanded' : 'pexp', # Expanded + 'hidden' : 'hidn', # Hidden } diff --git a/Lib/plat-mac/lib-scriptpackages/StdSuites/Table_Suite.py b/Lib/plat-mac/lib-scriptpackages/StdSuites/Table_Suite.py index bb929b8..afa01a0 100644 --- a/Lib/plat-mac/lib-scriptpackages/StdSuites/Table_Suite.py +++ b/Lib/plat-mac/lib-scriptpackages/StdSuites/Table_Suite.py @@ -74,9 +74,9 @@ tables._privpropdict = { tables._privelemdict = { } _Enum_prtn = { - 'read_only' : 'nmod', # Can\xd5t change values or formulas - 'formulas_protected' : 'fpro', # Can changes values but not formulas - 'read_2f_write' : 'modf', # Can change values and formulas + 'read_only' : 'nmod', # Can\xd5t change values or formulas + 'formulas_protected' : 'fpro', # Can changes values but not formulas + 'read_2f_write' : 'modf', # Can change values and formulas } diff --git a/Lib/plat-mac/lib-scriptpackages/StdSuites/Text_Suite.py b/Lib/plat-mac/lib-scriptpackages/StdSuites/Text_Suite.py index 4edb7f4..1845f4d 100644 --- a/Lib/plat-mac/lib-scriptpackages/StdSuites/Text_Suite.py +++ b/Lib/plat-mac/lib-scriptpackages/StdSuites/Text_Suite.py @@ -162,28 +162,28 @@ text_style_info._privpropdict = { text_style_info._privelemdict = { } _Enum_just = { - 'left' : 'left', # Align with left margin - 'right' : 'rght', # Align with right margin - 'center' : 'cent', # Align with center - 'full' : 'full', # Align with both left and right margins + 'left' : 'left', # Align with left margin + 'right' : 'rght', # Align with right margin + 'center' : 'cent', # Align with center + 'full' : 'full', # Align with both left and right margins } _Enum_styl = { - 'plain' : 'plan', # Plain - 'bold' : 'bold', # Bold - 'italic' : 'ital', # Italic - 'outline' : 'outl', # Outline - 'shadow' : 'shad', # Shadow - 'underline' : 'undl', # Underline - 'superscript' : 'spsc', # Superscript - 'subscript' : 'sbsc', # Subscript - 'strikethrough' : 'strk', # Strikethrough - 'small_caps' : 'smcp', # Small caps - 'all_caps' : 'alcp', # All capital letters - 'all_lowercase' : 'lowc', # Lowercase - 'condensed' : 'cond', # Condensed - 'expanded' : 'pexp', # Expanded - 'hidden' : 'hidn', # Hidden + 'plain' : 'plan', # Plain + 'bold' : 'bold', # Bold + 'italic' : 'ital', # Italic + 'outline' : 'outl', # Outline + 'shadow' : 'shad', # Shadow + 'underline' : 'undl', # Underline + 'superscript' : 'spsc', # Superscript + 'subscript' : 'sbsc', # Subscript + 'strikethrough' : 'strk', # Strikethrough + 'small_caps' : 'smcp', # Small caps + 'all_caps' : 'alcp', # All capital letters + 'all_lowercase' : 'lowc', # Lowercase + 'condensed' : 'cond', # Condensed + 'expanded' : 'pexp', # Expanded + 'hidden' : 'hidn', # Hidden } diff --git a/Lib/plat-mac/lib-scriptpackages/StdSuites/__init__.py b/Lib/plat-mac/lib-scriptpackages/StdSuites/__init__.py index f648517..b80e3ba 100644 --- a/Lib/plat-mac/lib-scriptpackages/StdSuites/__init__.py +++ b/Lib/plat-mac/lib-scriptpackages/StdSuites/__init__.py @@ -469,4 +469,3 @@ class StdSuites(Text_Suite_Events, _signature = 'ascr' _moduleName = 'StdSuites' - diff --git a/Lib/plat-mac/lib-scriptpackages/SystemEvents/Disk_Folder_File_Suite.py b/Lib/plat-mac/lib-scriptpackages/SystemEvents/Disk_Folder_File_Suite.py index b9e6b34..a9ac3dd 100644 --- a/Lib/plat-mac/lib-scriptpackages/SystemEvents/Disk_Folder_File_Suite.py +++ b/Lib/plat-mac/lib-scriptpackages/SystemEvents/Disk_Folder_File_Suite.py @@ -313,21 +313,21 @@ file._privelemdict = { 'item' : item, } _Enum_edfm = { - 'MS_2d_DOS_format' : 'dfms', # MS-DOS format - 'Apple_Photo_format' : 'dfph', # Apple Photo format - 'ISO_9660_format' : 'df96', # ISO 9660 format - 'QuickTake_format' : 'dfqt', # QuickTake format - 'AppleShare_format' : 'dfas', # AppleShare format - 'High_Sierra_format' : 'dfhs', # High Sierra format - 'Mac_OS_Extended_format' : 'dfh+', # Mac OS Extended format - 'UDF_format' : 'dfud', # UDF format - 'unknown_format' : 'df??', # unknown format - 'audio_format' : 'dfau', # audio format - 'Mac_OS_format' : 'dfhf', # Mac OS format - 'UFS_format' : 'dfuf', # UFS format - 'NFS_format' : 'dfnf', # NFS format - 'ProDOS_format' : 'dfpr', # ProDOS format - 'WebDAV_format' : 'dfwd', # WebDAV format + 'MS_2d_DOS_format' : 'dfms', # MS-DOS format + 'Apple_Photo_format' : 'dfph', # Apple Photo format + 'ISO_9660_format' : 'df96', # ISO 9660 format + 'QuickTake_format' : 'dfqt', # QuickTake format + 'AppleShare_format' : 'dfas', # AppleShare format + 'High_Sierra_format' : 'dfhs', # High Sierra format + 'Mac_OS_Extended_format' : 'dfh+', # Mac OS Extended format + 'UDF_format' : 'dfud', # UDF format + 'unknown_format' : 'df??', # unknown format + 'audio_format' : 'dfau', # audio format + 'Mac_OS_format' : 'dfhf', # Mac OS format + 'UFS_format' : 'dfuf', # UFS format + 'NFS_format' : 'dfnf', # NFS format + 'ProDOS_format' : 'dfpr', # ProDOS format + 'WebDAV_format' : 'dfwd', # WebDAV format } diff --git a/Lib/plat-mac/lib-scriptpackages/SystemEvents/Folder_Actions_Suite.py b/Lib/plat-mac/lib-scriptpackages/SystemEvents/Folder_Actions_Suite.py index 22cf935..c2c7e5e 100644 --- a/Lib/plat-mac/lib-scriptpackages/SystemEvents/Folder_Actions_Suite.py +++ b/Lib/plat-mac/lib-scriptpackages/SystemEvents/Folder_Actions_Suite.py @@ -252,11 +252,11 @@ script._privpropdict = { script._privelemdict = { } _Enum_actn = { - 'items_added' : 'fget', # items added - 'items_removed' : 'flos', # items removed - 'window_closed' : 'fclo', # window closed - 'window_moved' : 'fsiz', # window moved - 'window_opened' : 'fopn', # window opened + 'items_added' : 'fget', # items added + 'items_removed' : 'flos', # items removed + 'window_closed' : 'fclo', # window closed + 'window_moved' : 'fsiz', # window moved + 'window_opened' : 'fopn', # window opened } diff --git a/Lib/plat-mac/lib-scriptpackages/SystemEvents/Standard_Suite.py b/Lib/plat-mac/lib-scriptpackages/SystemEvents/Standard_Suite.py index c9f6d44..f20ef84 100644 --- a/Lib/plat-mac/lib-scriptpackages/SystemEvents/Standard_Suite.py +++ b/Lib/plat-mac/lib-scriptpackages/SystemEvents/Standard_Suite.py @@ -524,9 +524,9 @@ class _b2_(aetools.NComparison): class _b3_(aetools.NComparison): """\xb3 - Greater than or equal to """ _Enum_savo = { - 'ask' : 'ask ', # Ask the user whether or not to save the file. - 'yes' : 'yes ', # Save the file. - 'no' : 'no ', # Do not save the file. + 'ask' : 'ask ', # Ask the user whether or not to save the file. + 'yes' : 'yes ', # Save the file. + 'no' : 'no ', # Do not save the file. } diff --git a/Lib/plat-mac/lib-scriptpackages/Terminal/Standard_Suite.py b/Lib/plat-mac/lib-scriptpackages/Terminal/Standard_Suite.py index 673a31a..035290f 100644 --- a/Lib/plat-mac/lib-scriptpackages/Terminal/Standard_Suite.py +++ b/Lib/plat-mac/lib-scriptpackages/Terminal/Standard_Suite.py @@ -524,9 +524,9 @@ class _b2_(aetools.NComparison): class _b3_(aetools.NComparison): """\xb3 - Greater than or equal to """ _Enum_savo = { - 'ask' : 'ask ', # Ask the user whether or not to save the file. - 'yes' : 'yes ', # Save the file. - 'no' : 'no ', # Do not save the file. + 'ask' : 'ask ', # Ask the user whether or not to save the file. + 'yes' : 'yes ', # Save the file. + 'no' : 'no ', # Do not save the file. } diff --git a/Lib/plat-mac/lib-scriptpackages/_builtinSuites/__init__.py b/Lib/plat-mac/lib-scriptpackages/_builtinSuites/__init__.py index ac3c0ba..2c722d9 100644 --- a/Lib/plat-mac/lib-scriptpackages/_builtinSuites/__init__.py +++ b/Lib/plat-mac/lib-scriptpackages/_builtinSuites/__init__.py @@ -9,20 +9,19 @@ import builtin_Suite _code_to_module = { - 'reqd' : builtin_Suite, - 'core' : builtin_Suite, + 'reqd' : builtin_Suite, + 'core' : builtin_Suite, } _code_to_fullname = { - 'reqd' : ('_builtinSuites.builtin_Suite', 'builtin_Suite'), - 'core' : ('_builtinSuites.builtin_Suite', 'builtin_Suite'), + 'reqd' : ('_builtinSuites.builtin_Suite', 'builtin_Suite'), + 'core' : ('_builtinSuites.builtin_Suite', 'builtin_Suite'), } from builtin_Suite import * class _builtinSuites(builtin_Suite_Events, - aetools.TalkTo): - _signature = 'ascr' - + aetools.TalkTo): + _signature = 'ascr' diff --git a/Lib/plat-mac/lib-scriptpackages/_builtinSuites/builtin_Suite.py b/Lib/plat-mac/lib-scriptpackages/_builtinSuites/builtin_Suite.py index 117eedd..318250f 100644 --- a/Lib/plat-mac/lib-scriptpackages/_builtinSuites/builtin_Suite.py +++ b/Lib/plat-mac/lib-scriptpackages/_builtinSuites/builtin_Suite.py @@ -9,118 +9,118 @@ _code = 'aevt' class builtin_Suite_Events: - def open(self, _object, _attributes={}, **_arguments): - """open: Open the specified object(s) - Required argument: list of objects to open - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'odoc' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def run(self, _no_object=None, _attributes={}, **_arguments): - """run: Run an application. Most applications will open an empty, untitled window. - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'oapp' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def reopen(self, _no_object=None, _attributes={}, **_arguments): - """reopen: Reactivate a running application. Some applications will open a new untitled window if no window is open. - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'rapp' - - if _arguments: raise TypeError, 'No optional args expected' - if _no_object != None: raise TypeError, 'No direct arg expected' - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def _print(self, _object, _attributes={}, **_arguments): - """print: Print the specified object(s) - Required argument: list of objects to print - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'pdoc' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_quit = { - 'saving' : 'savo', - } - - def quit(self, _no_object=None, _attributes={}, **_arguments): - """quit: Quit an application - Keyword argument saving: specifies whether to save currently open documents - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'quit' - - aetools.keysubst(_arguments, self._argmap_quit) - if _no_object != None: raise TypeError, 'No direct arg expected' - - aetools.enumsubst(_arguments, 'savo', _Enum_savo) - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - _argmap_close = { - 'saving' : 'savo', - 'saving_in' : 'kfil', - } + def open(self, _object, _attributes={}, **_arguments): + """open: Open the specified object(s) + Required argument: list of objects to open + Keyword argument _attributes: AppleEvent attribute dictionary + """ + _code = 'aevt' + _subcode = 'odoc' + + if _arguments: raise TypeError, 'No optional args expected' + _arguments['----'] = _object + + + _reply, _arguments, _attributes = self.send(_code, _subcode, + _arguments, _attributes) + if _arguments.get('errn', 0): + raise aetools.Error, aetools.decodeerror(_arguments) + # XXXX Optionally decode result + if _arguments.has_key('----'): + return _arguments['----'] + + def run(self, _no_object=None, _attributes={}, **_arguments): + """run: Run an application. Most applications will open an empty, untitled window. + Keyword argument _attributes: AppleEvent attribute dictionary + """ + _code = 'aevt' + _subcode = 'oapp' + + if _arguments: raise TypeError, 'No optional args expected' + if _no_object != None: raise TypeError, 'No direct arg expected' + + + _reply, _arguments, _attributes = self.send(_code, _subcode, + _arguments, _attributes) + if _arguments.get('errn', 0): + raise aetools.Error, aetools.decodeerror(_arguments) + # XXXX Optionally decode result + if _arguments.has_key('----'): + return _arguments['----'] + + def reopen(self, _no_object=None, _attributes={}, **_arguments): + """reopen: Reactivate a running application. Some applications will open a new untitled window if no window is open. + Keyword argument _attributes: AppleEvent attribute dictionary + """ + _code = 'aevt' + _subcode = 'rapp' + + if _arguments: raise TypeError, 'No optional args expected' + if _no_object != None: raise TypeError, 'No direct arg expected' + + + _reply, _arguments, _attributes = self.send(_code, _subcode, + _arguments, _attributes) + if _arguments.get('errn', 0): + raise aetools.Error, aetools.decodeerror(_arguments) + # XXXX Optionally decode result + if _arguments.has_key('----'): + return _arguments['----'] + + def _print(self, _object, _attributes={}, **_arguments): + """print: Print the specified object(s) + Required argument: list of objects to print + Keyword argument _attributes: AppleEvent attribute dictionary + """ + _code = 'aevt' + _subcode = 'pdoc' + + if _arguments: raise TypeError, 'No optional args expected' + _arguments['----'] = _object + + + _reply, _arguments, _attributes = self.send(_code, _subcode, + _arguments, _attributes) + if _arguments.get('errn', 0): + raise aetools.Error, aetools.decodeerror(_arguments) + # XXXX Optionally decode result + if _arguments.has_key('----'): + return _arguments['----'] + + _argmap_quit = { + 'saving' : 'savo', + } + + def quit(self, _no_object=None, _attributes={}, **_arguments): + """quit: Quit an application + Keyword argument saving: specifies whether to save currently open documents + Keyword argument _attributes: AppleEvent attribute dictionary + """ + _code = 'aevt' + _subcode = 'quit' + + aetools.keysubst(_arguments, self._argmap_quit) + if _no_object != None: raise TypeError, 'No direct arg expected' + + aetools.enumsubst(_arguments, 'savo', _Enum_savo) + + _reply, _arguments, _attributes = self.send(_code, _subcode, + _arguments, _attributes) + if _arguments.get('errn', 0): + raise aetools.Error, aetools.decodeerror(_arguments) + # XXXX Optionally decode result + if _arguments.has_key('----'): + return _arguments['----'] + + _argmap_close = { + 'saving' : 'savo', + 'saving_in' : 'kfil', + } _Enum_savo = { - 'yes' : 'yes ', # Save objects now - 'no' : 'no ', # Do not save objects - 'ask' : 'ask ', # Ask the user whether to save + 'yes' : 'yes ', # Save objects now + 'no' : 'no ', # Do not save objects + 'ask' : 'ask ', # Ask the user whether to save } # @@ -136,5 +136,5 @@ _compdeclarations = { } _enumdeclarations = { - 'savo' : _Enum_savo, + 'savo' : _Enum_savo, } diff --git a/Lib/plat-mac/macfs.py b/Lib/plat-mac/macfs.py index 11dbbeb..73815ae 100644 --- a/Lib/plat-mac/macfs.py +++ b/Lib/plat-mac/macfs.py @@ -9,7 +9,7 @@ import warnings warnings.warn("macfs is deprecated, use Carbon.File, Carbon.Folder or EasyDialogs", DeprecationWarning, stacklevel=2) - + # First step: ensure we also emulate the MACFS module, which contained # all the constants @@ -38,7 +38,7 @@ if time.gmtime(0)[0] == 1970: t = t + 0x10000000L return (0, int(t), 0) else: - def _utc2time(utc): + def _utc2time(utc): t = utc[1] if t < 0: t = t + 0x100000000L @@ -58,26 +58,26 @@ error = Carbon.File.Error class FSSpec(Carbon.File.FSSpec): def as_fsref(self): return FSRef(self) - + def NewAlias(self, src=None): return Alias(Carbon.File.NewAlias(src, self)) - + def GetCreatorType(self): finfo = self.FSpGetFInfo() return finfo.Creator, finfo.Type - + def SetCreatorType(self, ctor, tp): finfo = self.FSpGetFInfo() finfo.Creator = ctor finfo.Type = tp self.FSpSetFInfo(finfo) - + def GetFInfo(self): return self.FSpGetFInfo() - + def SetFInfo(self, info): return self.FSpSetFInfo(info) - + def GetDates(self): catInfoFlags = kFSCatInfoCreateDate|kFSCatInfoContentMod|kFSCatInfoBackupDate catinfo, d1, d2, d3 = FSRef(self).FSGetCatalogInfo(catInfoFlags) @@ -85,7 +85,7 @@ class FSSpec(Carbon.File.FSSpec): mdate = catinfo.contentModDate bdate = catinfo.backupDate return _utc2time(cdate), _utc2time(mdate), _utc2time(bdate) - + def SetDates(self, cdate, mdate, bdate): catInfoFlags = kFSCatInfoCreateDate|kFSCatInfoContentMod|kFSCatInfoBackupDate catinfo = Carbon.File.FSCatalogInfo( @@ -93,23 +93,23 @@ class FSSpec(Carbon.File.FSSpec): contentModDate = _time2utc(mdate), backupDate = _time2utc(bdate)) FSRef(self).FSSetCatalogInfo(catInfoFlags, catinfo) - + class FSRef(Carbon.File.FSRef): def as_fsspec(self): return FSSpec(self) - + class Alias(Carbon.File.Alias): def GetInfo(self, index): return self.GetAliasInfo(index) - + def Update(self, *args): pass # print "Alias.Update not yet implemented" - + def Resolve(self, src=None): fss, changed = self.ResolveAlias(src) return FSSpec(fss), changed - + from Carbon.File import FInfo # Backward-compatible type names: @@ -122,19 +122,19 @@ FInfoType = FInfo def ResolveAliasFile(fss, chain=1): fss, isdir, isalias = Carbon.File.ResolveAliasFile(fss, chain) return FSSpec(fss), isdir, isalias - + def RawFSSpec(data): return FSSpec(rawdata=data) - + def RawAlias(data): return Alias(rawdata=data) - + def FindApplication(*args): raise NotImplementedError, "FindApplication no longer implemented" - + def NewAliasMinimalFromFullPath(path): return Alias(Carbon.File.NewAliasMinimalFromFullPath(path, '', '')) - + # Another global function: from Carbon.Folder import FindFolder @@ -148,7 +148,7 @@ def StandardGetFile(*typelist): """Ask for an input file, optionally specifying 4-char file types that are allowable""" return PromptGetFile('', *typelist) - + def PromptGetFile(prompt, *typelist): """Ask for an input file giving the user a prompt message. Optionally you can specifying 4-char file types that are allowable""" @@ -157,7 +157,7 @@ def PromptGetFile(prompt, *typelist): DeprecationWarning, stacklevel=2) if not typelist: typelist = None - fss = EasyDialogs.AskFileForOpen(message=prompt, wanted=FSSpec, + fss = EasyDialogs.AskFileForOpen(message=prompt, wanted=FSSpec, typeList=typelist, defaultLocation=_handleSetFolder()) return fss, not fss is None @@ -167,10 +167,10 @@ def StandardPutFile(prompt, default=None): import EasyDialogs warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", DeprecationWarning, stacklevel=2) - fss = EasyDialogs.AskFileForSave(wanted=FSSpec, message=prompt, + fss = EasyDialogs.AskFileForSave(wanted=FSSpec, message=prompt, savedFileName=default, defaultLocation=_handleSetFolder()) return fss, not fss is None - + def SetFolder(folder): global _curfolder warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", @@ -181,18 +181,18 @@ def SetFolder(folder): rv = None _curfolder = folder return rv - + def _handleSetFolder(): global _curfolder rv = _curfolder _curfolder = None return rv - + def GetDirectory(prompt=None): """Ask the user to select a folder. Optionally you can give a prompt.""" import EasyDialogs warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", DeprecationWarning, stacklevel=2) - fss = EasyDialogs.AskFolder(message=prompt, wanted=FSSpec, + fss = EasyDialogs.AskFolder(message=prompt, wanted=FSSpec, defaultLocation=_handleSetFolder()) return fss, not fss is None diff --git a/Lib/plat-mac/macostools.py b/Lib/plat-mac/macostools.py index 3644e7e..06bc92f 100644 --- a/Lib/plat-mac/macostools.py +++ b/Lib/plat-mac/macostools.py @@ -41,18 +41,18 @@ def mkalias(src, dst, relative=None): alias = File.FSNewAlias(relativefsr, srcfsr) else: alias = srcfsr.FSNewAliasMinimal() - - dstfsr, dstfss = Res.FSCreateResourceFile(dstdirfsr, unicode(dstname), + + dstfsr, dstfss = Res.FSCreateResourceFile(dstdirfsr, unicode(dstname), File.FSGetResourceForkName()) h = Res.FSOpenResourceFile(dstfsr, File.FSGetResourceForkName(), 3) resource = Res.Resource(alias.data) resource.AddResource('alis', 0, '') Res.CloseResFile(h) - + dstfinfo = dstfss.FSpGetFInfo() dstfinfo.Flags = dstfinfo.Flags|0x8000 # Alias flag dstfss.FSpSetFInfo(dstfinfo) - + def mkdirs(dst): """Make directories leading to 'dst' if they don't exist yet""" if dst == '' or os.path.exists(dst): @@ -62,7 +62,7 @@ def mkdirs(dst): head = head + ':' mkdirs(head) os.mkdir(dst, 0777) - + def touched(dst): """Tell the finder a file has changed. No-op on MacOSX.""" if sys.platform != 'mac': return @@ -80,7 +80,7 @@ def touched(dst): dir_fss.SetDates(crdate, now, bkdate) except macfs.error: pass - + def touched_ae(dst): """Tell the finder a file has changed""" pardir = os.path.split(dst)[0] @@ -89,14 +89,14 @@ def touched_ae(dst): import Finder f = Finder.Finder() f.update(File.FSRef(pardir)) - + def copy(src, dst, createpath=0, copydates=1, forcetype=None): """Copy a file, including finder info, resource fork, etc""" src = File.pathname(src) dst = File.pathname(dst) if createpath: mkdirs(os.path.split(dst)[0]) - + ifp = open(src, 'rb') ofp = open(dst, 'wb') d = ifp.read(BUFSIZ) @@ -105,7 +105,7 @@ def copy(src, dst, createpath=0, copydates=1, forcetype=None): d = ifp.read(BUFSIZ) ifp.close() ofp.close() - + ifp = openrf(src, '*rb') ofp = openrf(dst, '*wb') d = ifp.read(BUFSIZ) @@ -114,7 +114,7 @@ def copy(src, dst, createpath=0, copydates=1, forcetype=None): d = ifp.read(BUFSIZ) ifp.close() ofp.close() - + srcfss = File.FSSpec(src) dstfss = File.FSSpec(dst) sf = srcfss.FSpGetFInfo() @@ -130,7 +130,7 @@ def copy(src, dst, createpath=0, copydates=1, forcetype=None): catinfo, _, _, _ = srcfsr.FSGetCatalogInfo(Files.kFSCatInfoAllDates) dstfsr.FSSetCatalogInfo(Files.kFSCatInfoAllDates, catinfo) touched(dstfss) - + def copytree(src, dst, copydates=1): """Copy a complete file tree to a new destination""" if os.path.isdir(src): diff --git a/Lib/plat-mac/macresource.py b/Lib/plat-mac/macresource.py index e4c3f62..f68ecdc 100644 --- a/Lib/plat-mac/macresource.py +++ b/Lib/plat-mac/macresource.py @@ -15,12 +15,12 @@ def need(restype, resid, filename=None, modname=None): is available we are done. If it is not available we look for a file filename (default: modname with .rsrc appended) either in the same folder as where modname was loaded from, or otherwise across sys.path. - + Returns the refno of the resource file opened (or None)""" if modname is None and filename is None: raise ArgumentError, "Either filename or modname argument (or both) must be given" - + if type(resid) is type(1): try: h = Res.GetResource(restype, resid) @@ -35,14 +35,14 @@ def need(restype, resid, filename=None, modname=None): pass else: return None - + # Construct a filename if we don't have one if not filename: if '.' in modname: filename = modname.split('.')[-1] + '.rsrc' else: filename = modname + '.rsrc' - + # Now create a list of folders to search searchdirs = [] if modname == '__main__': @@ -53,7 +53,7 @@ def need(restype, resid, filename=None, modname=None): if hasattr(mod, '__file__'): searchdirs = [os.path.dirname(mod.__file__)] searchdirs.extend(sys.path) - + # And look for the file for dir in searchdirs: pathname = os.path.join(dir, filename) @@ -61,16 +61,16 @@ def need(restype, resid, filename=None, modname=None): break else: raise ResourceFileNotFoundError, filename - + refno = open_pathname(pathname) - + # And check that the resource exists now if type(resid) is type(1): h = Res.GetResource(restype, resid) else: h = Res.GetNamedResource(restype, resid) return refno - + def open_pathname(pathname, verbose=0): """Open a resource file given by pathname, possibly decoding an AppleSingle file""" @@ -95,7 +95,7 @@ def open_pathname(pathname, verbose=0): else: raise return refno - + def resource_pathname(pathname, verbose=0): """Return the pathname for a resource file (either DF or RF based). If the pathname given already refers to such a file simply return it, @@ -121,12 +121,12 @@ def resource_pathname(pathname, verbose=0): else: raise return pathname - + def open_error_resource(): """Open the resource file containing the error code to error message mapping.""" need('Estr', 1, filename="errors.rsrc", modname=__name__) - + def _decode(pathname, verbose=0): # Decode an AppleSingle resource file, return the new pathname. newpathname = pathname + '.df.rsrc' diff --git a/Lib/plat-mac/pimp.py b/Lib/plat-mac/pimp.py index 39bc693..67fab76 100644 --- a/Lib/plat-mac/pimp.py +++ b/Lib/plat-mac/pimp.py @@ -1,6 +1,6 @@ """Package Install Manager for Python. -This is currently a MacOSX-only strawman implementation. +This is currently a MacOSX-only strawman implementation. Despite other rumours the name stands for "Packman IMPlementation". Tools to allow easy installation of packages. The idea is that there is @@ -27,7 +27,7 @@ import tempfile import shutil import time -__all__ = ["PimpPreferences", "PimpDatabase", "PimpPackage", "main", +__all__ = ["PimpPreferences", "PimpDatabase", "PimpPackage", "main", "PIMP_VERSION", "main"] _scriptExc_NotInstalled = "pimp._scriptExc_NotInstalled" @@ -52,12 +52,12 @@ def getDefaultDatabase(experimental=False): status = "exp" else: status = "prod" - + major, minor, micro, state, extra = sys.version_info pyvers = '%d.%d' % (major, minor) if state != 'final': pyvers = pyvers + '%s%d' % (state, extra) - + longplatform = distutils.util.get_platform() osname, release, machine = longplatform.split('-') # For some platforms we may want to differentiate between @@ -94,7 +94,7 @@ def getDefaultDatabase(experimental=False): def _cmd(output, dir, *cmditems): """Internal routine to run a shell command in a given directory.""" - + cmd = ("cd \"%s\"; " % dir) + " ".join(cmditems) if output: output.write("+ %s\n" % cmd) @@ -112,22 +112,22 @@ def _cmd(output, dir, *cmditems): class PimpDownloader: """Abstract base class - Downloader for archives""" - + def __init__(self, argument, dir="", watcher=None): self.argument = argument self._dir = dir self._watcher = watcher - + def download(self, url, filename, output=None): return None - + def update(self, str): if self._watcher: return self._watcher.update(str) return True - + class PimpCurlDownloader(PimpDownloader): def download(self, url, filename, output=None): @@ -138,7 +138,7 @@ class PimpCurlDownloader(PimpDownloader): url) self.update("Downloading %s: finished" % url) return (not exitstatus) - + class PimpUrllibDownloader(PimpDownloader): def download(self, url, filename, output=None): @@ -150,13 +150,13 @@ class PimpUrllibDownloader(PimpDownloader): length = long(download.headers['content-length']) else: length = -1 - + data = download.read(4096) #read 4K at a time dlsize = 0 lasttime = 0 while keepgoing: dlsize = dlsize + len(data) - if len(data) == 0: + if len(data) == 0: #this is our exit condition break output.write(data) @@ -171,12 +171,12 @@ class PimpUrllibDownloader(PimpDownloader): if keepgoing: self.update("Downloading %s: finished" % url) return keepgoing - + class PimpUnpacker: """Abstract base class - Unpacker for archives""" - + _can_rename = False - + def __init__(self, argument, dir="", renames=[], @@ -187,30 +187,30 @@ class PimpUnpacker: self._dir = dir self._renames = renames self._watcher = watcher - + def unpack(self, archive, output=None, package=None): return None - + def update(self, str): if self._watcher: return self._watcher.update(str) return True - + class PimpCommandUnpacker(PimpUnpacker): """Unpack archives by calling a Unix utility""" - + _can_rename = False - + def unpack(self, archive, output=None, package=None): cmd = self.argument % archive if _cmd(output, self._dir, cmd): return "unpack command failed" - + class PimpTarUnpacker(PimpUnpacker): """Unpack tarfiles using the builtin tarfile module""" - + _can_rename = True - + def unpack(self, archive, output=None, package=None): tf = tarfile.open(archive, "r") members = tf.getmembers() @@ -253,7 +253,7 @@ class PimpTarUnpacker(PimpUnpacker): names = package.filterExpectedSkips(names) if names: return "Not all files were unpacked: %s" % " ".join(names) - + ARCHIVE_FORMATS = [ (".tar.Z", PimpTarUnpacker, None), (".taz", PimpTarUnpacker, None), @@ -266,8 +266,8 @@ ARCHIVE_FORMATS = [ class PimpPreferences: """Container for per-user preferences, such as the database to use and where to install packages.""" - - def __init__(self, + + def __init__(self, flavorOrder=None, downloadDir=None, buildDir=None, @@ -287,10 +287,10 @@ class PimpPreferences: self.buildDir = buildDir self.pimpDatabase = pimpDatabase self.watcher = None - + def setWatcher(self, watcher): self.watcher = watcher - + def setInstallDir(self, installDir=None): if installDir: # Installing to non-standard location. @@ -303,14 +303,14 @@ class PimpPreferences: installDir = DEFAULT_INSTALLDIR self.installLocations = [] self.installDir = installDir - + def isUserInstall(self): return self.installDir != DEFAULT_INSTALLDIR def check(self): """Check that the preferences make sense: directories exist and are writable, the install directory is on sys.path, etc.""" - + rv = "" RWX_OK = os.R_OK|os.W_OK|os.X_OK if not os.path.exists(self.downloadDir): @@ -337,7 +337,7 @@ class PimpPreferences: else: rv += "Warning: Install directory \"%s\" is not on sys.path\n" % self.installDir return rv - + def compareFlavors(self, left, right): """Compare two flavor strings. This is part of your preferences because whether the user prefers installing from source or binary is.""" @@ -348,13 +348,13 @@ class PimpPreferences: if right in self.flavorOrder: return 1 return cmp(left, right) - + class PimpDatabase: """Class representing a pimp database. It can actually contain information from multiple databases through inclusion, but the toplevel database is considered the master, as its maintainer is "responsible" for the contents.""" - + def __init__(self, prefs): self._packages = [] self.preferences = prefs @@ -363,23 +363,23 @@ class PimpDatabase: self._version = "" self._maintainer = "" self._description = "" - + # Accessor functions def url(self): return self._url def version(self): return self._version def maintainer(self): return self._maintainer def description(self): return self._description - + def close(self): """Clean up""" self._packages = [] self.preferences = None - + def appendURL(self, url, included=0): """Append packages from the database with the given URL. Only the first database should specify included=0, so the global information (maintainer, description) get stored.""" - + if url in self._urllist: return self._urllist.append(url) @@ -396,7 +396,7 @@ class PimpDatabase: if not self._version: sys.stderr.write("Warning: database has no Version information\n") elif self._version > PIMP_VERSION: - sys.stderr.write("Warning: database version %s newer than pimp version %s\n" + sys.stderr.write("Warning: database version %s newer than pimp version %s\n" % (self._version, PIMP_VERSION)) self._maintainer = plistdata.get('Maintainer', '') self._description = plistdata.get('Description', '').strip() @@ -405,12 +405,12 @@ class PimpDatabase: others = plistdata.get('Include', []) for url in others: self.appendURL(url, included=1) - + def _appendPackages(self, packages): """Given a list of dictionaries containing package descriptions create the PimpPackage objects and append them to our internal storage.""" - + for p in packages: p = dict(p) flavor = p.get('Flavor') @@ -421,27 +421,27 @@ class PimpDatabase: else: pkg = PimpPackage(self, dict(p)) self._packages.append(pkg) - + def list(self): """Return a list of all PimpPackage objects in the database.""" - + return self._packages - + def listnames(self): """Return a list of names of all packages in the database.""" - + rv = [] for pkg in self._packages: rv.append(pkg.fullname()) rv.sort() return rv - + def dump(self, pathOrFile): """Dump the contents of the database to an XML .plist file. - + The file can be passed as either a file object or a pathname. All data, including included databases, is dumped.""" - + packages = [] for pkg in self._packages: packages.append(pkg.dump()) @@ -453,15 +453,15 @@ class PimpDatabase: } plist = plistlib.Plist(**plistdata) plist.write(pathOrFile) - + def find(self, ident): """Find a package. The package can be specified by name or as a dictionary with name, version and flavor entries. - + Only name is obligatory. If there are multiple matches the best one (higher version number, flavors ordered according to users' preference) is returned.""" - + if type(ident) == str: # Remove ( and ) for pseudo-packages if ident[0] == '(' and ident[-1] == ')': @@ -491,7 +491,7 @@ class PimpDatabase: if not found or found < p: found = p return found - + ALLOWED_KEYS = [ "Name", "Version", @@ -511,7 +511,7 @@ ALLOWED_KEYS = [ class PimpPackage: """Class representing a single package.""" - + def __init__(self, db, plistdata): self._db = db name = plistdata["Name"] @@ -519,10 +519,10 @@ class PimpPackage: if not k in ALLOWED_KEYS: sys.stderr.write("Warning: %s: unknown key %s\n" % (name, k)) self._dict = plistdata - + def __getitem__(self, key): return self._dict[key] - + def name(self): return self._dict['Name'] def version(self): return self._dict.get('Version') def flavor(self): return self._dict.get('Flavor') @@ -531,13 +531,13 @@ class PimpPackage: def homepage(self): return self._dict.get('Home-page') def downloadURL(self): return self._dict.get('Download-URL') def systemwideOnly(self): return self._dict.get('Systemwide-only') - + def fullname(self): """Return the full name "name-version-flavor" of a package. - + If the package is a pseudo-package, something that cannot be installed through pimp, return the name in (parentheses).""" - + rv = self._dict['Name'] if self._dict.has_key('Version'): rv = rv + '-%s' % self._dict['Version'] @@ -547,14 +547,14 @@ class PimpPackage: # Pseudo-package, show in parentheses rv = '(%s)' % rv return rv - + def dump(self): """Return a dict object containing the information on the package.""" return self._dict - + def __cmp__(self, other): """Compare two packages, where the "better" package sorts lower.""" - + if not isinstance(other, PimpPackage): return cmp(id(self), id(other)) if self.name() != other.name(): @@ -562,15 +562,15 @@ class PimpPackage: if self.version() != other.version(): return -cmp(self.version(), other.version()) return self._db.preferences.compareFlavors(self.flavor(), other.flavor()) - + def installed(self): """Test wheter the package is installed. - + Returns two values: a status indicator which is one of "yes", "no", "old" (an older version is installed) or "bad" (something went wrong during the install test) and a human readable string which may contain more details.""" - + namespace = { "NotInstalled": _scriptExc_NotInstalled, "OldInstalled": _scriptExc_OldInstalled, @@ -602,16 +602,16 @@ class PimpPackage: sys.stderr.write("-------------------------------------\n") return "bad", "Package install test got exception" return "yes", "" - + def prerequisites(self): """Return a list of prerequisites for this package. - + The list contains 2-tuples, of which the first item is either a PimpPackage object or None, and the second is a descriptive string. The first item can be None if this package depends on something that isn't pimp-installable, in which case the descriptive string should tell the user what to do.""" - + rv = [] if not self._dict.get('Download-URL'): # For pseudo-packages that are already installed we don't @@ -619,7 +619,7 @@ class PimpPackage: status, _ = self.installed() if status == "yes": return [] - return [(None, + return [(None, "%s: This package cannot be installed automatically (no Download-URL field)" % self.fullname())] if self.systemwideOnly() and self._db.preferences.isUserInstall(): @@ -645,28 +645,28 @@ class PimpPackage: descr = pkg.shortdescription() rv.append((pkg, descr)) return rv - - + + def downloadPackageOnly(self, output=None): """Download a single package, if needed. - + An MD5 signature is used to determine whether download is needed, and to test that we actually downloaded what we expected. If output is given it is a file-like object that will receive a log of what happens. - + If anything unforeseen happened the method returns an error message string. """ - + scheme, loc, path, query, frag = urlparse.urlsplit(self._dict['Download-URL']) path = urllib.url2pathname(path) filename = os.path.split(path)[1] - self.archiveFilename = os.path.join(self._db.preferences.downloadDir, filename) + self.archiveFilename = os.path.join(self._db.preferences.downloadDir, filename) if not self._archiveOK(): if scheme == 'manual': return "Please download package manually and save as %s" % self.archiveFilename - downloader = PimpUrllibDownloader(None, self._db.preferences.downloadDir, + downloader = PimpUrllibDownloader(None, self._db.preferences.downloadDir, watcher=self._db.preferences.watcher) if not downloader.download(self._dict['Download-URL'], self.archiveFilename, output): @@ -675,10 +675,10 @@ class PimpPackage: return "archive not found after download" if not self._archiveOK(): return "archive does not have correct MD5 checksum" - + def _archiveOK(self): """Test an archive. It should exist and the MD5 checksum should be correct.""" - + if not os.path.exists(self.archiveFilename): return 0 if not self._dict.get('MD5Sum'): @@ -687,10 +687,10 @@ class PimpPackage: data = open(self.archiveFilename, 'rb').read() checksum = md5.new(data).hexdigest() return checksum == self._dict['MD5Sum'] - + def unpackPackageOnly(self, output=None): """Unpack a downloaded package archive.""" - + filename = os.path.split(self.archiveFilename)[1] for ext, unpackerClass, arg in ARCHIVE_FORMATS: if filename[-len(ext):] == ext: @@ -698,43 +698,43 @@ class PimpPackage: else: return "unknown extension for archive file: %s" % filename self.basename = filename[:-len(ext)] - unpacker = unpackerClass(arg, dir=self._db.preferences.buildDir, + unpacker = unpackerClass(arg, dir=self._db.preferences.buildDir, watcher=self._db.preferences.watcher) rv = unpacker.unpack(self.archiveFilename, output=output) if rv: return rv - + def installPackageOnly(self, output=None): """Default install method, to be overridden by subclasses""" return "%s: This package needs to be installed manually (no support for flavor=\"%s\")" \ % (self.fullname(), self._dict.get(flavor, "")) - + def installSinglePackage(self, output=None): """Download, unpack and install a single package. - + If output is given it should be a file-like object and it will receive a log of what happened.""" - + if not self._dict.get('Download-URL'): return "%s: This package needs to be installed manually (no Download-URL field)" % self.fullname() msg = self.downloadPackageOnly(output) if msg: return "%s: download: %s" % (self.fullname(), msg) - + msg = self.unpackPackageOnly(output) if msg: return "%s: unpack: %s" % (self.fullname(), msg) - + return self.installPackageOnly(output) - + def beforeInstall(self): """Bookkeeping before installation: remember what we have in site-packages""" self._old_contents = os.listdir(self._db.preferences.installDir) - + def afterInstall(self): """Bookkeeping after installation: interpret any new .pth files that have appeared""" - + new_contents = os.listdir(self._db.preferences.installDir) for fn in new_contents: if fn in self._old_contents: @@ -757,7 +757,7 @@ class PimpPackage: line = os.path.join(self._db.preferences.installDir, line) line = os.path.realpath(line) if not line in sys.path: - sys.path.append(line) + sys.path.append(line) def filterExpectedSkips(self, names): """Return a list that contains only unpexpected skips""" @@ -780,21 +780,21 @@ class PimpPackage_binary(PimpPackage): def unpackPackageOnly(self, output=None): """We don't unpack binary packages until installing""" pass - + def installPackageOnly(self, output=None): """Install a single source package. - + If output is given it should be a file-like object and it will receive a log of what happened.""" - + if self._dict.has_key('Install-command'): return "%s: Binary package cannot have Install-command" % self.fullname() - + if self._dict.has_key('Pre-install-command'): if _cmd(output, self._buildDirname, self._dict['Pre-install-command']): return "pre-install %s: running \"%s\" failed" % \ (self.fullname(), self._dict['Pre-install-command']) - + self.beforeInstall() # Install by unpacking @@ -805,7 +805,7 @@ class PimpPackage_binary(PimpPackage): else: return "%s: unknown extension for archive file: %s" % (self.fullname(), filename) self.basename = filename[:-len(ext)] - + install_renames = [] for k, newloc in self._db.preferences.installLocations: if not newloc: @@ -815,22 +815,22 @@ class PimpPackage_binary(PimpPackage): else: return "%s: Don't know installLocation %s" % (self.fullname(), k) install_renames.append((oldloc, newloc)) - + unpacker = unpackerClass(arg, dir="/", renames=install_renames) rv = unpacker.unpack(self.archiveFilename, output=output, package=self) if rv: return rv - + self.afterInstall() - + if self._dict.has_key('Post-install-command'): if _cmd(output, self._buildDirname, self._dict['Post-install-command']): return "%s: post-install: running \"%s\" failed" % \ (self.fullname(), self._dict['Post-install-command']) return None - - + + class PimpPackage_source(PimpPackage): def unpackPackageOnly(self, output=None): @@ -844,15 +844,15 @@ class PimpPackage_source(PimpPackage): def installPackageOnly(self, output=None): """Install a single source package. - + If output is given it should be a file-like object and it will receive a log of what happened.""" - + if self._dict.has_key('Pre-install-command'): if _cmd(output, self._buildDirname, self._dict['Pre-install-command']): return "pre-install %s: running \"%s\" failed" % \ (self.fullname(), self._dict['Pre-install-command']) - + self.beforeInstall() installcmd = self._dict.get('Install-command') if installcmd and self._install_renames: @@ -882,45 +882,45 @@ class PimpPackage_source(PimpPackage): rv = None shutil.rmtree(unwanted_install_dir) return rv - + self.afterInstall() - + if self._dict.has_key('Post-install-command'): if _cmd(output, self._buildDirname, self._dict['Post-install-command']): return "post-install %s: running \"%s\" failed" % \ (self.fullname(), self._dict['Post-install-command']) return None - - + + class PimpInstaller: """Installer engine: computes dependencies and installs packages in the right order.""" - + def __init__(self, db): self._todo = [] self._db = db self._curtodo = [] self._curmessages = [] - + def __contains__(self, package): return package in self._todo - + def _addPackages(self, packages): for package in packages: if not package in self._todo: self._todo.append(package) - + def _prepareInstall(self, package, force=0, recursive=1): """Internal routine, recursive engine for prepareInstall. - + Test whether the package is installed and (if not installed or if force==1) prepend it to the temporary todo list and call ourselves recursively on all prerequisites.""" - + if not force: status, message = package.installed() if status == "yes": - return + return if package in self._todo or package in self._curtodo: return self._curtodo.insert(0, package) @@ -932,17 +932,17 @@ class PimpInstaller: self._prepareInstall(pkg, False, recursive) else: self._curmessages.append("Problem with dependency: %s" % descr) - + def prepareInstall(self, package, force=0, recursive=1): """Prepare installation of a package. - + If the package is already installed and force is false nothing is done. If recursive is true prerequisites are installed first. - + Returns a list of packages (to be passed to install) and a list of messages of any problems encountered. """ - + self._curtodo = [] self._curmessages = [] self._prepareInstall(package, force, recursive) @@ -950,10 +950,10 @@ class PimpInstaller: self._curtodo = [] self._curmessages = [] return rv - + def install(self, packages, output): """Install a list of packages.""" - + self._addPackages(packages) status = [] for pkg in self._todo: @@ -961,12 +961,12 @@ class PimpInstaller: if msg: status.append(msg) return status - - - + + + def _run(mode, verbose, force, args, prefargs, watcher): """Engine for the main program""" - + prefs = PimpPreferences(**prefargs) if watcher: prefs.setWatcher(watcher) @@ -975,7 +975,7 @@ def _run(mode, verbose, force, args, prefargs, watcher): sys.stdout.write(rv) db = PimpDatabase(prefs) db.appendURL(prefs.pimpDatabase) - + if mode == 'dump': db.dump(sys.stdout) elif mode =='list': @@ -1050,7 +1050,7 @@ def _run(mode, verbose, force, args, prefargs, watcher): def main(): """Minimal commandline tool to drive pimp.""" - + import getopt def _help(): print "Usage: pimp [options] -s [package ...] List installed status" @@ -1065,12 +1065,12 @@ def main(): print " (default: %s)" % DEFAULT_INSTALLDIR print " -u url URL for database" sys.exit(1) - + class _Watcher: def update(self, msg): sys.stderr.write(msg + '\r') return 1 - + try: opts, args = getopt.getopt(sys.argv[1:], "slifvdD:Vu:") except getopt.GetoptError: @@ -1133,8 +1133,6 @@ if __name__ != 'pimp_update': (pimp_update.PIMP_VERSION, PIMP_VERSION)) else: from pimp_update import * - + if __name__ == '__main__': main() - - diff --git a/Lib/plat-mac/videoreader.py b/Lib/plat-mac/videoreader.py index 646c726..f16228b 100644 --- a/Lib/plat-mac/videoreader.py +++ b/Lib/plat-mac/videoreader.py @@ -34,19 +34,19 @@ class VideoFormat: self.__width = width self.__height = height self.__format = format - + def getname(self): return self.__name - + def getdescr(self): return self.__descr - + def getsize(self): return self.__width, self.__height - + def getformat(self): return self.__format - + class _Reader: def __init__(self, path): fd = Qt.OpenMovieFile(path, 0) @@ -66,8 +66,8 @@ class _Reader: self.audiodescr = _audiodescr(handle.data) self.audiotimescale = self.audiomedia.GetMediaTimeScale() del handle - - try: + + try: self.videotrack = self.movie.GetMovieIndTrackType(1, QuickTime.VisualMediaCharacteristic, QuickTime.movieTrackCharacteristic) self.videomedia = self.videotrack.GetTrackMedia() @@ -81,14 +81,14 @@ class _Reader: self.videocurtime = None self.audiocurtime = None - + def __del__(self): self.audiomedia = None self.audiotrack = None self.videomedia = None self.videotrack = None self.movie = None - + def _initgworld(self): old_port, old_dev = Qdoffs.GetGWorld() try: @@ -108,34 +108,34 @@ class _Reader: # XXXX framerate finally: Qdoffs.SetGWorld(old_port, old_dev) - + def _gettrackduration_ms(self, track): tracktime = track.GetTrackDuration() return self._movietime_to_ms(tracktime) - + def _movietime_to_ms(self, time): value, d1, d2 = Qt.ConvertTimeScale((time, self.movietimescale, None), 1000) return value - + def _videotime_to_ms(self, time): value, d1, d2 = Qt.ConvertTimeScale((time, self.videotimescale, None), 1000) return value - + def _audiotime_to_ms(self, time): value, d1, d2 = Qt.ConvertTimeScale((time, self.audiotimescale, None), 1000) return value - + def _videotime_to_movietime(self, time): value, d1, d2 = Qt.ConvertTimeScale((time, self.videotimescale, None), self.movietimescale) return value - + def HasAudio(self): return not self.audiotrack is None - + def HasVideo(self): return not self.videotrack is None - + def GetAudioDuration(self): if not self.audiotrack: return 0 @@ -145,7 +145,7 @@ class _Reader: if not self.videotrack: return 0 return self._gettrackduration_ms(self.videotrack) - + def GetAudioFormat(self): if not self.audiodescr: return None, None, None, None, None @@ -172,20 +172,20 @@ class _Reader: encoding = 'linear-signed' else: encoding = 'quicktime-coding-%s'%self.audiodescr['dataFormat'] -## return audio.format.AudioFormatLinear('quicktime_audio', 'QuickTime Audio Format', +## return audio.format.AudioFormatLinear('quicktime_audio', 'QuickTime Audio Format', ## channels, encoding, blocksize=blocksize, fpb=fpb, bps=bps) return channels, encoding, blocksize, fpb, bps - + def GetAudioFrameRate(self): if not self.audiodescr: return None return int(self.audiodescr['sampleRate']) - + def GetVideoFormat(self): width = self.videodescr['width'] height = self.videodescr['height'] return VideoFormat('dummy_format', 'Dummy Video Format', width, height, macrgb) - + def GetVideoFrameRate(self): tv = self.videocurtime if tv == None: @@ -194,7 +194,7 @@ class _Reader: tv, dur = self.videomedia.GetMediaNextInterestingTime(flags, tv, 1.0) dur = self._videotime_to_ms(dur) return int((1000.0/dur)+0.5) - + def ReadAudio(self, nframes, time=None): if not time is None: self.audiocurtime = time @@ -210,7 +210,7 @@ class _Reader: self.audiomedia.GetMediaSample(h, 0, tv, desc_h, nframes) self.audiocurtime = actualtime + actualcount*sampleduration return self._audiotime_to_ms(actualtime), h.data - + def ReadVideo(self, time=None): if not time is None: self.videocurtime = time @@ -226,7 +226,7 @@ class _Reader: self.movie.SetMovieTimeValue(moviecurtime) self.movie.MoviesTask(0) return self._videotime_to_ms(self.videocurtime), self._getpixmapcontent() - + def _getpixmapcontent(self): """Shuffle the offscreen PixMap data, because it may have funny stride values""" rowbytes = Qdoffs.GetPixRowBytes(self.pixmap) @@ -281,12 +281,11 @@ def _test(): wrt.write(data) timestamp, data = rdr.ReadVideo() MacOS.SetCreatorAndType(pname, 'ogle', 'JPEG') - if num > 20: + if num > 20: print 'stopping at 20 frames so your disk does not fill up:-)' break print 'Total frames:', num - + if __name__ == '__main__': _test() sys.exit(1) - diff --git a/Lib/plat-netbsd1/IN.py b/Lib/plat-netbsd1/IN.py index 020f8e2..474c51e 100644 --- a/Lib/plat-netbsd1/IN.py +++ b/Lib/plat-netbsd1/IN.py @@ -54,4 +54,3 @@ IPCTL_DIRECTEDBCAST = 6 IPCTL_ALLOWSRCRT = 7 IPCTL_MAXID = 8 def in_nullhost(x): return ((x).s_addr == INADDR_ANY) - diff --git a/Lib/plat-os2emx/_emx_link.py b/Lib/plat-os2emx/_emx_link.py index 04648e2..422c2bb 100644 --- a/Lib/plat-os2emx/_emx_link.py +++ b/Lib/plat-os2emx/_emx_link.py @@ -2,7 +2,7 @@ # Written by Andrew I MacIntyre, December 2002. -"""_emx_link.py is a simplistic emulation of the Unix link(2) library routine +"""_emx_link.py is a simplistic emulation of the Unix link(2) library routine for creating so-called hard links. It is intended to be imported into the os module in place of the unimplemented (on OS/2) Posix link() function (os.link()). diff --git a/Lib/plat-os2emx/grp.py b/Lib/plat-os2emx/grp.py index d05ad27..fceb4c9 100644 --- a/Lib/plat-os2emx/grp.py +++ b/Lib/plat-os2emx/grp.py @@ -4,10 +4,10 @@ # written by Andrew MacIntyre, April 2001. # updated July 2003, adding field accessor support -# note that this implementation checks whether ":" or ";" as used as +# note that this implementation checks whether ":" or ";" as used as # the field separator character. -"""Replacement for grp standard extension module, intended for use on +"""Replacement for grp standard extension module, intended for use on OS/2 and similar systems which don't normally have an /etc/group file. The standard Unix group database is an ASCII text file with 4 fields per @@ -17,16 +17,16 @@ record (line), separated by a colon: - group id (integer) - group members (comma delimited list of userids, with no spaces) -Note that members are only included in the group file for groups that +Note that members are only included in the group file for groups that aren't their primary groups. (see the section 8.2 of the Python Library Reference) -This implementation differs from the standard Unix implementation by -allowing use of the platform's native path separator character - ';' on OS/2, -DOS and MS-Windows - as the field separator in addition to the Unix +This implementation differs from the standard Unix implementation by +allowing use of the platform's native path separator character - ';' on OS/2, +DOS and MS-Windows - as the field separator in addition to the Unix standard ":". -The module looks for the group database at the following locations +The module looks for the group database at the following locations (in order first to last): - ${ETC_GROUP} (or %ETC_GROUP%) - ${ETC}/group (or %ETC%/group) diff --git a/Lib/plat-os2emx/pwd.py b/Lib/plat-os2emx/pwd.py index 1036fce..95d766a 100644 --- a/Lib/plat-os2emx/pwd.py +++ b/Lib/plat-os2emx/pwd.py @@ -4,14 +4,14 @@ # written by Andrew MacIntyre, April 2001. # updated July 2003, adding field accessor support -# note that this implementation checks whether ":" or ";" as used as +# note that this implementation checks whether ":" or ";" as used as # the field separator character. Path conversions are are applied when # the database uses ":" as the field separator character. -"""Replacement for pwd standard extension module, intended for use on +"""Replacement for pwd standard extension module, intended for use on OS/2 and similar systems which don't normally have an /etc/passwd file. -The standard Unix password database is an ASCII text file with 7 fields +The standard Unix password database is an ASCII text file with 7 fields per record (line), separated by a colon: - user name (string) - password (encrypted string, or "*" or "") @@ -23,13 +23,13 @@ per record (line), separated by a colon: (see the section 8.1 of the Python Library Reference) -This implementation differs from the standard Unix implementation by -allowing use of the platform's native path separator character - ';' on OS/2, -DOS and MS-Windows - as the field separator in addition to the Unix -standard ":". Additionally, when ":" is the separator path conversions +This implementation differs from the standard Unix implementation by +allowing use of the platform's native path separator character - ';' on OS/2, +DOS and MS-Windows - as the field separator in addition to the Unix +standard ":". Additionally, when ":" is the separator path conversions are applied to deal with any munging of the drive letter reference. -The module looks for the password database at the following locations +The module looks for the password database at the following locations (in order first to last): - ${ETC_PASSWD} (or %ETC_PASSWD%) - ${ETC}/passwd (or %ETC%/passwd) @@ -94,8 +94,8 @@ def __unixpathconv(path): # decide what field separator we can try to use - Unix standard, with # the platform's path separator as an option. No special field conversion -# handler is required when using the platform's path separator as field -# separator, but are required for the home directory and shell fields when +# handler is required when using the platform's path separator as field +# separator, but are required for the home directory and shell fields when # using the standard Unix (":") field separator. __field_sep = {':': __unixpathconv} if os.pathsep: diff --git a/Lib/plat-riscos/rourl2path.py b/Lib/plat-riscos/rourl2path.py index 494e394..7642b9f 100644 --- a/Lib/plat-riscos/rourl2path.py +++ b/Lib/plat-riscos/rourl2path.py @@ -25,7 +25,7 @@ def url2pathname(url): if '$' in components: del components[0] else: - components[0] = '$' + components[0] = '$' # Remove . and embedded .. i = 0 while i < len(components): diff --git a/Lib/plat-sunos5/IN.py b/Lib/plat-sunos5/IN.py index 7e26187..867b9eb 100755 --- a/Lib/plat-sunos5/IN.py +++ b/Lib/plat-sunos5/IN.py @@ -836,7 +836,7 @@ TS_PSTART = 0x0800 TS_RESUME = 0x1000 TS_CREATE = 0x2000 TS_ALLSTART = \ - (TS_CSTART|TS_UNPAUSE|TS_XSTART|TS_PSTART|TS_RESUME|TS_CREATE) + (TS_CSTART|TS_UNPAUSE|TS_XSTART|TS_PSTART|TS_RESUME|TS_CREATE) def CPR_VSTOPPED(t): return \ def THREAD_TRANSITION(tp): return thread_transition(tp); @@ -1014,13 +1014,13 @@ AT_BLKSIZE = 0x1000 AT_NBLOCKS = 0x2000 AT_VCODE = 0x4000 AT_ALL = (AT_TYPE|AT_MODE|AT_UID|AT_GID|AT_FSID|AT_NODEID|\ - AT_NLINK|AT_SIZE|AT_ATIME|AT_MTIME|AT_CTIME|\ - AT_RDEV|AT_BLKSIZE|AT_NBLOCKS|AT_VCODE) + AT_NLINK|AT_SIZE|AT_ATIME|AT_MTIME|AT_CTIME|\ + AT_RDEV|AT_BLKSIZE|AT_NBLOCKS|AT_VCODE) AT_STAT = (AT_MODE|AT_UID|AT_GID|AT_FSID|AT_NODEID|AT_NLINK|\ - AT_SIZE|AT_ATIME|AT_MTIME|AT_CTIME|AT_RDEV) + AT_SIZE|AT_ATIME|AT_MTIME|AT_CTIME|AT_RDEV) AT_TIMES = (AT_ATIME|AT_MTIME|AT_CTIME) AT_NOSET = (AT_NLINK|AT_RDEV|AT_FSID|AT_NODEID|AT_TYPE|\ - AT_BLKSIZE|AT_NBLOCKS|AT_VCODE) + AT_BLKSIZE|AT_NBLOCKS|AT_VCODE) VSUID = 04000 VSGID = 02000 VSVTX = 01000 diff --git a/Lib/plat-sunos5/STROPTS.py b/Lib/plat-sunos5/STROPTS.py index 19173bb..e95db93 100644 --- a/Lib/plat-sunos5/STROPTS.py +++ b/Lib/plat-sunos5/STROPTS.py @@ -833,7 +833,7 @@ TS_PSTART = 0x0800 TS_RESUME = 0x1000 TS_CREATE = 0x2000 TS_ALLSTART = \ - (TS_CSTART|TS_UNPAUSE|TS_XSTART|TS_PSTART|TS_RESUME|TS_CREATE) + (TS_CSTART|TS_UNPAUSE|TS_XSTART|TS_PSTART|TS_RESUME|TS_CREATE) def CPR_VSTOPPED(t): return \ def THREAD_TRANSITION(tp): return thread_transition(tp); @@ -1393,13 +1393,13 @@ AT_BLKSIZE = 0x1000 AT_NBLOCKS = 0x2000 AT_VCODE = 0x4000 AT_ALL = (AT_TYPE|AT_MODE|AT_UID|AT_GID|AT_FSID|AT_NODEID|\ - AT_NLINK|AT_SIZE|AT_ATIME|AT_MTIME|AT_CTIME|\ - AT_RDEV|AT_BLKSIZE|AT_NBLOCKS|AT_VCODE) + AT_NLINK|AT_SIZE|AT_ATIME|AT_MTIME|AT_CTIME|\ + AT_RDEV|AT_BLKSIZE|AT_NBLOCKS|AT_VCODE) AT_STAT = (AT_MODE|AT_UID|AT_GID|AT_FSID|AT_NODEID|AT_NLINK|\ - AT_SIZE|AT_ATIME|AT_MTIME|AT_CTIME|AT_RDEV) + AT_SIZE|AT_ATIME|AT_MTIME|AT_CTIME|AT_RDEV) AT_TIMES = (AT_ATIME|AT_MTIME|AT_CTIME) AT_NOSET = (AT_NLINK|AT_RDEV|AT_FSID|AT_NODEID|AT_TYPE|\ - AT_BLKSIZE|AT_NBLOCKS|AT_VCODE) + AT_BLKSIZE|AT_NBLOCKS|AT_VCODE) VSUID = 04000 VSGID = 02000 VSVTX = 01000 @@ -1682,14 +1682,14 @@ DDI_PROP_TYPE_INT = 0x0100 DDI_PROP_TYPE_STRING = 0x0200 DDI_PROP_TYPE_BYTE = 0x0400 DDI_PROP_TYPE_COMPOSITE = 0x0800 -DDI_PROP_TYPE_ANY = (DDI_PROP_TYPE_INT | \ - DDI_PROP_TYPE_STRING | \ - DDI_PROP_TYPE_BYTE | \ - DDI_PROP_TYPE_COMPOSITE) -DDI_PROP_TYPE_MASK = (DDI_PROP_TYPE_INT | \ - DDI_PROP_TYPE_STRING | \ - DDI_PROP_TYPE_BYTE | \ - DDI_PROP_TYPE_COMPOSITE) +DDI_PROP_TYPE_ANY = (DDI_PROP_TYPE_INT | \ + DDI_PROP_TYPE_STRING | \ + DDI_PROP_TYPE_BYTE | \ + DDI_PROP_TYPE_COMPOSITE) +DDI_PROP_TYPE_MASK = (DDI_PROP_TYPE_INT | \ + DDI_PROP_TYPE_STRING | \ + DDI_PROP_TYPE_BYTE | \ + DDI_PROP_TYPE_COMPOSITE) DDI_RELATIVE_ADDRESSING = "relative-addressing" DDI_GENERIC_ADDRESSING = "generic-addressing" @@ -1704,7 +1704,7 @@ DEVMAP_MAPPING_INVALID = 0x01 DEVMAP_ALLOW_REMAP = 0x02 DEVMAP_USE_PAGESIZE = 0x04 DEVMAP_SETUP_FLAGS = \ - (DEVMAP_MAPPING_INVALID | DEVMAP_ALLOW_REMAP | DEVMAP_USE_PAGESIZE) + (DEVMAP_MAPPING_INVALID | DEVMAP_ALLOW_REMAP | DEVMAP_USE_PAGESIZE) DEVMAP_SETUP_DONE = 0x100 DEVMAP_LOCK_INITED = 0x200 DEVMAP_FAULTING = 0x400 diff --git a/Lib/plat-sunos5/SUNAUDIODEV.py b/Lib/plat-sunos5/SUNAUDIODEV.py index a81a2ab..632139f 100755 --- a/Lib/plat-sunos5/SUNAUDIODEV.py +++ b/Lib/plat-sunos5/SUNAUDIODEV.py @@ -6,21 +6,21 @@ # Encoding types, for fields i_encoding and o_encoding -ENCODING_NONE = 0 # no encoding assigned -ENCODING_ULAW = 1 # u-law encoding -ENCODING_ALAW = 2 # A-law encoding -ENCODING_LINEAR = 3 # Linear PCM encoding +ENCODING_NONE = 0 # no encoding assigned +ENCODING_ULAW = 1 # u-law encoding +ENCODING_ALAW = 2 # A-law encoding +ENCODING_LINEAR = 3 # Linear PCM encoding # Gain ranges for i_gain, o_gain and monitor_gain -MIN_GAIN = 0 # minimum gain value -MAX_GAIN = 255 # maximum gain value +MIN_GAIN = 0 # minimum gain value +MAX_GAIN = 255 # maximum gain value # Balance values for i_balance and o_balance -LEFT_BALANCE = 0 # left channel only -MID_BALANCE = 32 # equal left/right channel -RIGHT_BALANCE = 64 # right channel only +LEFT_BALANCE = 0 # left channel only +MID_BALANCE = 32 # equal left/right channel +RIGHT_BALANCE = 64 # right channel only BALANCE_SHIFT = 3 # Port names for i_port and o_port @@ -30,11 +30,11 @@ PORT_B = 2 PORT_C = 3 PORT_D = 4 -SPEAKER = 0x01 # output to built-in speaker -HEADPHONE = 0x02 # output to headphone jack -LINE_OUT = 0x04 # output to line out +SPEAKER = 0x01 # output to built-in speaker +HEADPHONE = 0x02 # output to headphone jack +LINE_OUT = 0x04 # output to line out -MICROPHONE = 0x01 # input from microphone -LINE_IN = 0x02 # input from line in +MICROPHONE = 0x01 # input from microphone +LINE_IN = 0x02 # input from line in CD = 0x04 # input from on-board CD inputs INTERNAL_CD_IN = CD # input from internal CDROM diff --git a/Lib/plat-sunos5/TYPES.py b/Lib/plat-sunos5/TYPES.py index e7106dd..e8e4a00 100644 --- a/Lib/plat-sunos5/TYPES.py +++ b/Lib/plat-sunos5/TYPES.py @@ -311,4 +311,3 @@ FD_SETSIZE = 1024 _NBBY = 8 NBBY = _NBBY def FD_ZERO(p): return bzero((p), sizeof (*(p))) - diff --git a/Lib/plat-unixware7/IN.py b/Lib/plat-unixware7/IN.py index 3f97606..d66ae97 100644 --- a/Lib/plat-unixware7/IN.py +++ b/Lib/plat-unixware7/IN.py @@ -172,11 +172,11 @@ SHUT_RDWR = 2 # Included from sys/netconfig.h # Included from sys/cdefs.h -def __P(protos): return protos +def __P(protos): return protos def __STRING(x): return #x -def __P(protos): return () +def __P(protos): return () def __STRING(x): return "x" @@ -485,7 +485,7 @@ def ATOMIC_INT_INCR(atomic_intp): return _ATOMIC_INT_INCR(atomic_intp) def ATOMIC_INT_DECR(atomic_intp): return _ATOMIC_INT_DECR(atomic_intp) -def FSPIN_INIT(lp): return +def FSPIN_INIT(lp): return def FSPIN_LOCK(l): return DISABLE() @@ -493,15 +493,15 @@ def FSPIN_TRYLOCK(l): return (DISABLE(), B_TRUE) def FSPIN_UNLOCK(l): return ENABLE() -def LOCK_DEINIT(lp): return +def LOCK_DEINIT(lp): return -def LOCK_DEALLOC(lp): return +def LOCK_DEALLOC(lp): return def LOCK_OWNED(lp): return (B_TRUE) -def RW_DEINIT(lp): return +def RW_DEINIT(lp): return -def RW_DEALLOC(lp): return +def RW_DEALLOC(lp): return def RW_OWNED(lp): return (B_TRUE) @@ -517,7 +517,7 @@ def RW_RDLOCK_PLMIN(lockp): return LOCK_PLMIN(lockp) def RW_WRLOCK_PLMIN(lockp): return LOCK_PLMIN(lockp) -def LOCK_DEINIT(l): return +def LOCK_DEINIT(l): return def LOCK_PLMIN(lockp): return LOCK((lockp), PLMIN) @@ -537,9 +537,9 @@ def FSPIN_OWNED(l): return (B_TRUE) CR_MLDREAL = 0x00000001 CR_RDUMP = 0x00000002 -def crhold(credp): return crholdn((credp), 1) +def crhold(credp): return crholdn((credp), 1) -def crfree(credp): return crfreen((credp), 1) +def crfree(credp): return crfreen((credp), 1) # Included from sys/strmdep.h @@ -823,11 +823,11 @@ INADDR_MAX_LOCAL_GROUP = 0xe00000ff # Included from sys/inline.h IP_HIER_BASE = (20) -def ASSERT_LOCK(x): return +def ASSERT_LOCK(x): return -def ASSERT_WRLOCK(x): return +def ASSERT_WRLOCK(x): return -def ASSERT_UNLOCK(x): return +def ASSERT_UNLOCK(x): return def CANPUT(q): return canput((q)) diff --git a/Lib/posixpath.py b/Lib/posixpath.py index 223517e..a344a07 100644 --- a/Lib/posixpath.py +++ b/Lib/posixpath.py @@ -420,7 +420,7 @@ symbolic links encountered in the path.""" def _resolve_link(path): """Internal helper function. Takes a path and follows symlinks - until we either arrive at something that isn't a symlink, or + until we either arrive at something that isn't a symlink, or encounter a path we've seen before (meaning that there's a loop). """ paths_seen = [] diff --git a/Lib/test/test_codecencodings_cn.py b/Lib/test/test_codecencodings_cn.py index 6d71218..0638f4f 100644 --- a/Lib/test/test_codecencodings_cn.py +++ b/Lib/test/test_codecencodings_cn.py @@ -27,8 +27,8 @@ class Test_GBK(test_multibytecodec_support.TestBase, unittest.TestCase): tstring = test_multibytecodec_support.load_teststring('gbk') codectests = ( # invalid bytes - ("abc\x80\x80\xc1\xc4", "strict", None), - ("abc\xc8", "strict", None), + ("abc\x80\x80\xc1\xc4", "strict", None), + ("abc\xc8", "strict", None), ("abc\x80\x80\xc1\xc4", "replace", u"abc\ufffd\u804a"), ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\u804a\ufffd"), ("abc\x80\x80\xc1\xc4", "ignore", u"abc\u804a"), diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py index 6f001de..ba6f94d 100644 --- a/Lib/test/test_site.py +++ b/Lib/test/test_site.py @@ -110,12 +110,12 @@ class PthFile(object): """Create a .pth file with a comment, blank lines, an ``import <self.imported>``, a line with self.good_dirname, and a line with self.bad_dirname. - + Creation of the directory for self.good_dir_path (based off of self.good_dirname) is also performed. Make sure to call self.cleanup() to undo anything done by this method. - + """ FILE = open(self.file_path, 'wU') try: diff --git a/Lib/test/test_transformer.py b/Lib/test/test_transformer.py index 2b0f1e8..6a8c98a 100644 --- a/Lib/test/test_transformer.py +++ b/Lib/test/test_transformer.py @@ -4,29 +4,29 @@ from compiler import transformer, ast from compiler import compile class Tests(unittest.TestCase): - - def testMultipleLHS(self): - """ Test multiple targets on the left hand side. """ - - snippets = ['a, b = 1, 2', - '(a, b) = 1, 2', - '((a, b), c) = (1, 2), 3'] - for s in snippets: - a = transformer.parse(s) - assert isinstance(a, ast.Module) - child1 = a.getChildNodes()[0] - assert isinstance(child1, ast.Stmt) - child2 = child1.getChildNodes()[0] - assert isinstance(child2, ast.Assign) - - # This actually tests the compiler, but it's a way to assure the ast - # is correct - c = compile(s, '<string>', 'single') - vals = {} - exec c in vals - assert vals['a'] == 1 - assert vals['b'] == 2 + def testMultipleLHS(self): + """ Test multiple targets on the left hand side. """ + + snippets = ['a, b = 1, 2', + '(a, b) = 1, 2', + '((a, b), c) = (1, 2), 3'] + + for s in snippets: + a = transformer.parse(s) + assert isinstance(a, ast.Module) + child1 = a.getChildNodes()[0] + assert isinstance(child1, ast.Stmt) + child2 = child1.getChildNodes()[0] + assert isinstance(child2, ast.Assign) + + # This actually tests the compiler, but it's a way to assure the ast + # is correct + c = compile(s, '<string>', 'single') + vals = {} + exec c in vals + assert vals['a'] == 1 + assert vals['b'] == 2 def test_main(): test_support.run_unittest( diff --git a/Lib/urllib.py b/Lib/urllib.py index f472d42..2969ef0 100644 --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -1223,7 +1223,7 @@ if sys.platform == 'darwin': def getproxies(): return getproxies_environment() or getproxies_internetconfig() - + elif os.name == 'nt': def getproxies_registry(): """Return a dictionary of scheme -> proxy server URL mappings. diff --git a/Lib/xml/sax/_exceptions.py b/Lib/xml/sax/_exceptions.py index 628e80d..fdd614a 100644 --- a/Lib/xml/sax/_exceptions.py +++ b/Lib/xml/sax/_exceptions.py @@ -93,10 +93,10 @@ class SAXParseException(SAXException): sysid = "<unknown>" linenum = self.getLineNumber() if linenum is None: - linenum = "?" + linenum = "?" colnum = self.getColumnNumber() if colnum is None: - colnum = "?" + colnum = "?" return "%s:%s:%s: %s" % (sysid, linenum, colnum, self._msg) |