thane98 / paragon

Toolkit for editing various FE games.
GNU General Public License v3.0
54 stars 17 forks source link

Add Completer Support to Conversation #60

Closed SinsofSloth closed 3 years ago

SinsofSloth commented 3 years ago

Currently displays a popup list of only commands. Do you think it would be good to add a list of other data (i.e. character names and emotions)?

thane98 commented 3 years ago

This looks great and should definitely be an addition with the new/rewritten dialogue system. I can merge what you have here, but it'll have to be moved into the rewritten version once that's ready. I'll try to a branch up with the rewrite soon so that this isn't an issue with every PR.

Completion for emotions may be possible since that's static data. Character names would also be possible, but it would require some extra work since the names can change if the user adds/removes entries from the FaceData module.

SinsofSloth commented 3 years ago

Personally, Qt's completer is rather lacking. For future reference: Qscintilla could be used instead, once things stabilize. Only PyQt supports it, but you could just write a wrapper for an implementation of the UI and call it. It has good features like so, which is definitely looks far more appealing than Qt's autocompleter.

thane98 commented 3 years ago

Yeah, I've used QScintilla before - it's a good option if you're on PyQt.

I'd like to stay on PySide2 for now since that's where the Qt Company's resources are for Python. That also leaves the option of upgrading to PySide6 in the future.

SinsofSloth commented 3 years ago

Alrighty. As for emotions and names, it would be rather bothersome if the popup showed up when writing text. Can I propose an idea to change emotions, and possibly names, to be prefixed with a special character that way it won't be troublesome for the enduser? Possibly 2 different prefixes besides $, so it won't bloat the popup menu with misc items.

Alternatively, there could be a conditional to restrict the popup to only when there's a command in a line. It won't show a full list of emotions/character when the space key is pressed because the completer has no prefix to search for though. I could just watch for some keys like the space key and trigger the popup menu. Problem is then, the first problem will occur: bloating the menu with misc data. It should be possible to dynamically change the list, but idk how performance will be. I'll prob just make dummy lists and give it a test later.

thane98 commented 3 years ago

I'm not sure about adding prefixes to emotions and names for completion alone. I'd rather not add new symbols for the user to learn / manage if they aren't important for parsing. We can experiment with it if the other options aren't practical though.

The rewritten dialogue system has some changes that may make this easier. For example, all commands with parameters include parentheses now, so there's no need to manage spaces vs parentheses.

It's been a while since I've used QCompleter, but the pattern for when to suggest character names shouldn't be that complicated since only two commands use them. So if you get "$SetSpeaker(" then character names should be suggested. Emotions could be done similarly, but I see how that can get more difficult.