You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
f"Explicitly requested present_method {self._present_method!r} is not available for {context_name}."
311
+
)
312
+
present_methods= [self._present_method]
305
313
306
-
# Select present_method
307
-
forpresent_methodincontext_class.present_methods:
308
-
assertpresent_methodin ("bitmap", "screen")
309
-
ifpresent_methodinpresent_methods:
310
-
break
311
-
else:
314
+
# Let the canvas select the method and provide the corresponding info object.
315
+
# Take care not to hold onto this dict, it may contain objects that we don't want to unnecessarily reference.
316
+
info=self._rc_get_present_info(present_methods)
317
+
ifinfoisNone:
318
+
method_message=f"Methods {set(present_methods)!r} are not supported."
319
+
iflen(present_methods) ==1:
320
+
method_message=f"Method {present_methods[0]!r} is not supported."
312
321
raiseTypeError(
313
-
f"Could not select present_method for context {context_name!r}: The methods {tuple(context_class.present_methods)!r} are not supported by the canvas backend {tuple(present_methods.keys())!r}."
322
+
f"Could not create {context_name!r} for {self.__class__.__name__!r}: {method_message}"
314
323
)
324
+
ifinfo.get("method") notinpresent_methods:
325
+
raiseRuntimeError(
326
+
f"Present info method field ({info.get('method')!r}) is not part of the available methods {set(present_methods)}."
327
+
)
328
+
self._present_method=info["method"]
315
329
316
-
# Select present_info, and shape it into what the contexts need.
317
-
present_info=present_methods[present_method]
318
-
assert"method"notinpresent_info, (
319
-
"the field 'method' is reserved in present_methods dicts"
0 commit comments