From 09d9718d693b00d9bc6f86242b6ad5c0d75385d2 Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Mon, 3 Aug 2020 12:50:11 -0400 Subject: [PATCH] move rToolStartup to a separate file and add typed constants. --- base.py | 62 +------------------------------ cli.py | 3 +- examples/tools.prez | 18 +++++++++ tool_startup.py | 90 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 111 insertions(+), 62 deletions(-) create mode 100644 examples/tools.prez create mode 100644 tool_startup.py diff --git a/base.py b/base.py index 5fc8973..974a958 100644 --- a/base.py +++ b/base.py @@ -11,7 +11,7 @@ from constants import * __all__ = ["rObject", "rText", "rTextBlock", "rTextForLETextBox2", "rAlertString", "rErrorString", "rComment", "rPString", "rCString", "rWString", "rC1InputString", "rStringList", - "rTwoRects", "rRectList", "rToolStartup"] + "rTwoRects", "rRectList"] #define KeyEquiv array[1]{ char; char; _mybase_ word; _mybase_ word; } @@ -473,63 +473,3 @@ class rRectList(rObject): if self.rects: rv += "\n" rv += "\t}" return rv; - - -class rToolStartup(rObject): - """ - mode: 320 or 640 - tools: tool number or (tool number, version) - """ - rName = "rToolStartup" - rType = 0x8013 - - def __init__(self, *tools, mode=640, **kwargs): - super().__init__(**kwargs) - - self.mode = 640 - self.tools = tools - - if mode not in (320,640): raise ValueError("Bad mode: {}".format(mode)) - for x in tools: - if type(x) == int: continue - if type(x) == tuple and len(x) == 2: - a,b = x - if type(a) == int and type(b) == int: continue - raise ValueError("Bad tool: {}".format(x)) - - - - def __bytes__(self): - bb = struct.pack("