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
Improve "Show available fonts" dialog #1075
Conversation
This is the first installment fo an improved dialog for showing available fonts. So far this parses the results to a number of dictionaries and lists but doesn't do anything with it. TODO: Properly parse the details of a font family TODO: Create a new custom widget: - show all font families as a table - each table row can be expanded to show more details about the family TODO: Search/Filter - An additional text input allows for incremental filtering for font families QUESTION: Do we need to show config files and font dirs?
This is the preparation for a usable presentation to be done in a next step. The available font families are parsed into a dictionary, which can be used to populate the data model of a to-be-determined visualization widget.
This PR and in particular the filter would fix issue #420 |
Oh yes, I had completely forgotten about that open issue. In order to proceed we need
I haven't done anything with Qt's model-view-controller paradigm, and I don't know which UI interface would be suitable. It has to be something that allows unfolding a details section like in QTreeView. I think this would be my first try:
(BTW the screenshot and the initial PR incorrectly merges the third level styles, presumably having the last one overwrite all the others.) |
Displaying the log output lets the user inspect the raw material if they want to. In addition it makes the waiting time for the results feel more "natural". The results are displayed in the second tab which is automatically opened when the job has completed. TODO: So far this still uses a Log() for the result display, which is completely inappropriate.
This commit fixes an issue with parsing and attaching multiple styles. Additionally it fleshes out the routine to display the fonts in hierarchical order. So far this is done into the old Log widget but the logic behind the "tree building" should be portable to any new approach using the model-view structure.
These hat previously been overlooked (case in point for the need for this improvement ;-) )
I've improved (ehm, fixed) the parsing and mapping of font families, weights and styles into a dictionary and provided a preliminary reporting. Additionally I've added a tab widget to have access to the original LilyPond output and the other provided information: Next steps (but I'm afraid I have to turn to other things first):
|
This dialog will become a little bit more sophisticated, and I think it shouldn't be squeezed in the engrave.lytools module
I would like this to be tested now, especially with regard to the hierarchy and display of the font tree. I've now changed the presentation from the hijacked Log window to a proper tree view:
|
TODO: Provide method to manually update
This is just an intermediate linting step
In repsonse to wish #1077 this makes the toplevel entries consistently behave only as an index with the family name. All details go to child entries, even if there is only one name.
Previously a filter was also applied to child elements, effectively hiding style entries that don't carry the family name anymore.
I've tested it and it looks great! System fonts are grouped and listed correctly. |
Thanks. I will have a look into it and see if I can fix that too. Apart from that things have even more improved by now, and I think we're soon ready to merge:
Note that you can use regular expressions in the line edit. Specifically useful are the begin/end characters |
This partially reverts commit 37ae63e. The modifications to logwidget.py had been committed erroneously
The "Music font repository" is a local directory where the user can save their notation fonts. If that is set all fonts can be directly installed without having to look up the directory with the "Install..." button. With the "Auto install" option this will be done whenever the font dialog is opened, so any new LilyPond installation can automatically be provided with the notation fonts.
Update the existing page for "Paths" Preferences
This doesn't properly work yet and is only committed in order to make it possible to test the issue. As explained in a comment to #1169 the user guide is displayed *behind* the dialog (or even the application window), or probably the other way round: the dialog insists on remaining at the front.
Have one global MusicFontRepo object (if the path is given in the preferences).
4a9b0fb
to
1ed5b76
Compare
This replaces Pull Request #949 with proper implementations (and more) # Add fileMode argument to __init__ While not changing the default this allows setting the filemode upon instantiation. # Add mustExist validagion If set to True the file must exist. As long as the path set in the lineEdit doesn't exist the text is colored, and when trying to leave the widget while it points to a non-existent path it is instead reset to its previous value. # Add editingFinished signal Signal is emitted when the editing has finished. Treats the lineEdit and the dialog as one entity: When the lineEdit loses focus because the button has been clicked the signal is *not* emitted.
Streamline the creation process of the dialog and its subwidgets. Review responsibilities (store/do stuff where it belongs)
Base The Document Fonts dialog on QDialog instead of widgets.dialog.Dialog. Streamline the dialog creation, make more stuff available through methods, reduce dependencies between objects.
This fixes the issue with the Help button described in #1169 (comment)
Referring to the main dialog through subwidgets' self.window() method instead of keeping a manual reference (self._dialog) ensures proper destruction of all objects upon closing of the dialog. This fixes the main issue in #1169, the exception in app.aboutToQuit.
This was a workaround to a side-effect from #1169 that isn't necessary anymore.
The cleaning up was not only necessary as part of the workaround but also to ensure current jobs are canceled when the preview restarts prematurely (due to the rather new handling in the job queue).
A (semi-)transparent "waiting" animation that can be attached to arbitrary QWidgets.
as provided by Abraham Lee
e78cf07
to
444a790
Compare
With the exception of the manual page I think I'm now through with what I want to have included in the merge - anything else may go to the future wishlist ... This screencast shows:
|
Superseded by #1173 |
Closes #420
Closes #1077
This PR is not ready to be merged but I would like to get some feedback. I want more functionality, but actually the code would be a significant improvement already now.
[EDIT:] I've removed the "WIP" from the title and consider the PR ready by now.
The output of the
LilyPond=>Show Available Fonts...
command is practically unusable when more than a few fonts are available on a system. It is totally overwhelming, and the structure is hard to understand. Therefore I wanted to have an improved presentation of the data.In its initial state the PR doesn't simply print out the LilyPond output but parses it to a number of dictionaries. The most important one is the
families
dictionary with entries for each font family. For now an ordered and structured list is printed to the same log window as was previously in that dialog. The "filter" line edit is still non-functional.To be done:
The code could be merged without these additional features, after removing the non-functional filter edit.