CyPopupInfo button tooltips

Leoreth

Blue Period
Moderator
Joined
Aug 23, 2009
Messages
37,060
Location
東京藝術大学
I've got a couple of questions regarding CyPopupInfo, i.e. the class you can use to launch arbitrary button popup/dialogs in Python.

1. Is the Python interface not included in the DLL source code? Its actual implementation CvPopupInfo appears to be, although there seems to be a gap with CyPopupInfo also handling things that in C++ belong to CvDLLWidgetData. Just want to make sure that I am not missing something I might have control over.

2. The actual thing I want to solve is including tooltips for the popup buttons. This is clearly possible because it's the same popup that is being used elsewhere, e.g. Events (but really all popups as far as I can tell), where you can set tooltips by defining a function in PythonHelp and implementing it in CvRandomEventsInterface.py. I dug into the code and it seems that on the C++ side, you can set a widget type for each button and use that to do all the usual widget stuff including tooltips. You cannot seem to do this via the Python API. Or is there a way, maybe some hack? I'd be fine with setting static string tooltips.

3. If the answers to 1+2 are both no (no way to add widget types to buttons via the Python API, no way to mod the existing Python API), do you think it is possible to write a new CyNicePopupInfo interface for Python whose API allows settings widget types for buttons? To me it seems like the DLL source offer you all the tools you need to do so, but given that Firaxis apparently did not choose to do so makes me wonder if there are any caveats/things to keep in mind.

For even more context, for the longest time I have been using XML defined events to implement some of my popups, and want to transition to doing them in Python, because that's not really what CvEventInfos and CvEventTriggerInfos are for and the whole thing is very cumbersome because the popup implementation was scattered across various XML files and Python entry points function.

The eventual goal is to write a new Python module that allows you to define and launch popups (hopefully) more intuitively all in one place, including handling the choice made by the player. That's where I realised that the only gap between the old and this new solution was that it didn't allow you to set tooltips and I would hate to lose that, because the additional explanations they can provide is often very useful.
 
Top Bottom