py_canoe.core.ui.Ui

The UI object represents the user interface in CANoe.

Source code in src\py_canoe\core\ui.py
12
13
14
def __init__(self, app: 'Application'):
    self.app = app
    self.com_object = self.app.com_object.UI

write property

Returns a Write object that allows writing text to the user interface write window.

activate_desktop(desktop_name)

Activate a specific UI desktop window by name. Returns True if successful, False otherwise.

Source code in src\py_canoe\core\ui.py
29
30
31
32
33
34
35
36
37
def activate_desktop(self, desktop_name: str) -> bool:
    """Activate a specific UI desktop window by name. Returns True if successful, False otherwise."""
    try:
        self.com_object.ActivateDesktop(desktop_name)
        logger.info(f"UI Desktop '{desktop_name}' activated successfully")
        return True
    except Exception as e:
        logger.error(f"Error activating UI Desktop '{desktop_name}': {e}")
        return False

create_desktop(desktop_name)

Create a new UI desktop window with the specified name. Returns True if successful, False otherwise.

Source code in src\py_canoe\core\ui.py
39
40
41
42
43
44
45
46
47
48
49
50
51
def create_desktop(self, desktop_name: str) -> bool:
    """Create a new UI desktop window with the specified name. Returns True if successful, False otherwise."""
    try:
        if float(f"{self.app.version.major}.{self.app.version.minor}") >= 15.3:
            self.com_object.CreateDesktop(desktop_name)
            logger.info(f"UI Desktop '{desktop_name}' created successfully")
            return True
        else:
            logger.warning(f"Cannot create desktop '{desktop_name}': Requires CANoe version 15.3 or higher.")
            return False
    except Exception as e:
        logger.error(f"Error creating UI Desktop '{desktop_name}': {e}")
        return False

get_command_enabled(command)

Get the availability of a command on the user interface.

Source code in src\py_canoe\core\ui.py
16
17
18
def get_command_enabled(self, command: str) -> bool:
    """Get the availability of a command on the user interface."""
    return self.com_object.GetCommandEnabled(command)

open_baudrate_dialog()

Open the UI Baudrate Dialog. Returns True if successful, False otherwise.

Source code in src\py_canoe\core\ui.py
53
54
55
56
57
58
59
60
61
def open_baudrate_dialog(self) -> bool:
    """Open the UI Baudrate Dialog. Returns True if successful, False otherwise."""
    try:
        self.com_object.OpenBaudrateDialog()
        logger.info("UI Baudrate Dialog opened successfully")
        return True
    except Exception as e:
        logger.error(f"Error opening UI Baudrate Dialog: {e}")
        return False

set_command_enabled(command, enabled)

Set the availability of a command on the user interface.

Source code in src\py_canoe\core\ui.py
20
21
22
def set_command_enabled(self, command: str, enabled: bool) -> None:
    """Set the availability of a command on the user interface."""
    self.com_object.SetCommandEnabled(command, enabled)