Allow to add Views with more than one word with kivymd.add_view
function
#1728
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the problem
Currently when creating views via
kivymd.add_view
, only views with one word, e.g.NotificationScreen
, will be added correctly. When you try to add a view with the nameNotificationSettingsScreen
, all classes in the folders Model, Controller and View will be added. However, it won't be added in thescreens.py
(and no error / warning is thrown).Describe the algorithm of actions that leads to the problem
In the file
kivymd/tools/patterns/add_view.py
(line 158ff) there is a restriction for only allowing one word screens:Reproducing the problem
First create an kivymd MVC project. Then type in the following in commandline:
In the end, have a look into the
screens.py
, the imports are there, but not added in thescreens
dict.Screenshots of the problem
Here you can see, that NotificationSettingsScreen wasn't added to the
screens
dict inscreens.py
Description of Changes
I changed above code to allow multiple words:
Screenshots of the solution to the problem
Here you can see, that it is now added properly.
Code for testing new changes