Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support 10.0.18363.836: Has no IVirtualDesktopManagerInternal2 manager #39

Merged
merged 1 commit into from
Feb 19, 2024

Conversation

stdedos
Copy link
Contributor

@stdedos stdedos commented Feb 19, 2024

raise NotImplementedError on .name and .rename methods.

Fixes #37

Signed-off-by: Stavros Ntentos 133706+stdedos@users.noreply.github.com

…nager

`raise NotImplementedError` on `.name` and `.rename` methods.

Fixes mrob95#37

Signed-off-by: Stavros Ntentos <133706+stdedos@users.noreply.github.com>
@totaam
Copy link

totaam commented Feb 19, 2024

@stdedos
Copy link
Contributor Author

stdedos commented Feb 19, 2024

Sadly, @totaam, I do not have a more concrete response for you than "Whenever you'd call an instance of VirtualDesktop.name / VirtualDesktop.rename".

The code that you are highlighting only iterates (and returns) all the available monitors of the system. It should be a safe call.

Also note that the project sprinkles a lot of raise NotImplementedError. I'd exercise caution when calling its bindings - as if you are calling foreign+arcane code.


It might not interest you directly, but I have tried to prototype a safe_operation decorator.

def safe_operation(fallback_value=None, log_error=True):
    """
    A decorator to safely execute operations and handle exceptions.
    :param fallback_value: The value to return in case of an exception.
    :param log_error: Whether to log the error or not.
    """
    def decorator(func):
        @functools.wraps(func)
        def wrapper(*args, **kwargs):
            try:
                return func(*args, **kwargs)
            except Exception as e:
                if log_error:
                    logging.error(f"Error during {func.__name__}: {e}")
                return fallback_value
        return wrapper
    return decorator

I didn't have concrete goals for it, so it's on a YMMV-basis.


On a tangent from this MR, your Xpra-org/xpra@778067d is correct:
After (very recent) 93758d9, AFAIU the Xpra-org/xpra#4109 would've been a NotImplementedError instead (with some more details than they were at-the-time available).

I'd suggest re-packing XPRA after this is merged


Also note that I tried to be a little bit more audible for dangerous operations:

/~https://github.com/mrob95/pyvda/pull/39/files#diff-2cbc492a5de7be89fbdaa40dbe1611a0d002e3cec94b3ec4b1b7afa903e1a3a7R328-R329

But it's not like this is Java code; upstream might also not like it either.

@mrob95
Copy link
Owner

mrob95 commented Feb 19, 2024

lgtm, thanks 👍

@mrob95 mrob95 merged commit 412b782 into mrob95:master Feb 19, 2024
@mrob95
Copy link
Owner

mrob95 commented Feb 19, 2024

Released in 0.4.1

stdedos added a commit to stdedos/pyvda that referenced this pull request Feb 22, 2024
Signed-off-by: Stavros Ntentos <133706+stdedos@users.noreply.github.com>
mrob95 added a commit that referenced this pull request Feb 22, 2024
Fixup #39: `@property` doesn't have a `.__name__` property itself
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for 10.0.18363.836
3 participants