[PATCH] Adding LFUN for removing LyX modules

Jean-Marc Lasgouttes lasgouttes at lyx.org
Fri Oct 22 08:52:03 UTC 2021


Le 22/10/2021 à 01:39, Yuriy Skalko a écrit :
>> I like this idea! What if layout-module-remove is used on a module that
>> a different module depends on? e.g., AMS Theorems (Extended) depends on
>> AMS Theorems. If I have both added and I try to remove AMS Theorems,
>> what happens? Do we need a layoutModuleCanBeRemoved helper function?
>> Actually there must already be some code because "delete" is greyed out
>> if I do this in the GUI.
>>
>> Scott
> 
> You are right, module dependencies were not taken into account in first 
> version of the patch. Here is the updated patch that forbids removing 
> modules that have dependents.

Note that it is best to move the test for removing the module in 
getStatus, so that the function is disabled. With that, it would become 
possible in the frontend to use that code.
I do not like to have duplicated (and possibly different) logic in those 
places. The solution might be to have a temporary module list in 
GuiDocument and call the methods of this this instance to handle the 
dialogs (the code uses the widgets as data structure now).

JMarc


More information about the lyx-devel mailing list