py_canoe.core.measurement.Measurement

Source code in src\py_canoe\core\measurement.py
56
57
58
59
60
61
62
63
64
65
66
67
68
def __init__(self, app, enable_events: bool = True):
    # Use the Application's Measurement object directly - do NOT create a
    # separate Dispatch wrapper. A separate Dispatch creates a different COM
    # proxy that races with the Application's internal proxy, causing
    # "Server Busy" dialogs during concurrent operations.
    self.com_object = app.com_object.Measurement
    self._enable_events = enable_events
    if enable_events:
        self.measurement_events: MeasurementEvents = win32com.client.WithEvents(self.com_object, MeasurementEvents)
        self.measurement_events.APP_COM_OBJ = app.com_object
    else:
        self.measurement_events = MeasurementEvents()
        self.measurement_events.APP_COM_OBJ = app.com_object