lyx_mirror/lib/lyx2lyx
Richard Heck d5d665482e This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.

By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.

So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i)  GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.

The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework. 

I've also updated the module documenation to accord with this change.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
..
generate_encoding_info.py rename generate_enconding_info.py to generate_encoding_info.py 2006-08-14 15:11:57 +00:00
lyx2lyx Wow. 2008-01-11 08:03:48 +00:00
lyx2lyx_lang.py Add "default" to language list. (fixes a crash). 2007-12-10 18:51:54 +00:00
lyx2lyx_version.py.in Convert all python files to utf-8. 2006-08-02 14:19:22 +00:00
lyx_0_06.py Add support for input encoding handling by lyx2lyx. 2006-08-07 14:10:41 +00:00
lyx_0_08.py Add support for input encoding handling by lyx2lyx. 2006-08-07 14:10:41 +00:00
lyx_0_10.py Add support for input encoding handling by lyx2lyx. 2006-08-07 14:10:41 +00:00
lyx_0_12.py Add support for input encoding handling by lyx2lyx. 2006-08-07 14:10:41 +00:00
lyx_1_0.py Add support for input encoding handling by lyx2lyx. 2006-08-07 14:10:41 +00:00
lyx_1_1_5.py string.join(lst) -> " ".join(lst) and not "".join(lst) 2006-08-02 16:13:01 +00:00
lyx_1_1_6_0.py Add support for input encoding handling by lyx2lyx. 2006-08-07 14:10:41 +00:00
lyx_1_1_6_3.py Add support for input encoding handling by lyx2lyx. 2006-08-07 14:10:41 +00:00
lyx_1_1.py Add support for input encoding handling by lyx2lyx. 2006-08-07 14:10:41 +00:00
lyx_1_2.py Remove calls to deprecated module string. 2006-08-02 15:45:44 +00:00
lyx_1_3.py Remove calls to deprecated module string. 2006-08-02 15:45:44 +00:00
lyx_1_4.py *** Support for generic sideways floats *** 2008-01-11 18:56:53 +00:00
lyx_1_5.py * lib/lyx2lyx/lyx_1_5.py: 2007-12-08 15:38:39 +00:00
lyx_1_6.py This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are. 2008-01-12 04:28:12 +00:00
LyX.py This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are. 2008-01-12 04:28:12 +00:00
Makefile.am Fix bug 518 (thanks to Jean Marc and Martin for the help) 2007-08-12 13:25:36 +00:00
parser_tools.py Avoid endless loops, e.g when an end_deeper is missing 2007-02-16 18:33:36 +00:00
profiling.py Convert all python files to utf-8. 2006-08-02 14:19:22 +00:00
test_parser_tools.py Start to consolidate the functions in parser tools. 2006-08-02 14:25:43 +00:00