Changes between Version 2 and Version 3 of DevNotes/Projects/categories


Ignore:
Timestamp:
Aug 28, 2012 9:04:40 AM (12 years ago)
Author:
kieranrcampbell
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • DevNotes/Projects/categories

    v2 v3  
    44Categories in Sansview is a new project to categorise the SANS models for easy selection from the GUI. In the fitpanel brought up are two listboxes - on containing relevant categories, the other containing the models belonging to the selected category.  
    55 
    6 Categories of a given model can be modified and the model shown/hidden from the UI using the Category Manager. This can be accessed via View -> CategoryManager. A model can also belong to multiple categories. 
     6Categories of a given model can be modified and the model shown/hidden from the UI using the Category Manager. This can be accessed via View => CategoryManager. A model can also belong to multiple categories. 
    77 
    88== Architecture == 
    99 
     10Categories are stored in a dictionary that links categories to model names. 
     11The setup script was modified to scan the Sansview installation to find all 
     12installed models. The categorisation is stored in a python defaultdict linking 
     13each category name to a list of models. These are then serialized to file using 
     14the python library cPickle which provides fast data access and reading for a 
     15python data structure. 
     16 
     17There are three different data containers needed for smooth operator of the 
     18category model - master category dict, by model dict and model enabled dict. 
     19The first of these, master category dict is a defaultdict linking each cate- 
     20gory name (a string) to a python list of tuples, the first entry being the model 
     21name, and the second entry being whether the model has enabled or not by 
     22the user in the UI. Obviously the entire informational content of the category 
     23mechanism is stored here. 
     24 
     25The other two data structures exist to provide fast access in the opposite 
     26direction. Say, for example, we want to find all the categories a given model is 
     27in. We would need to trawl through the dictionary picking out all the (key, value) 
     28pairs corresponding to a particular model. Instead we use by model dict whose 
     29keys are the model name and whose values are lists of categories that contain 
     30a certain model. The same applies to finding whether a model is enabled. We 
     31have model enabed dict whose keys are model names and whose values are 
     32bools corresponding to whether the model should be shown in the GUI or not. 
     33 
     34Two methods exist to generate the structures from each other. regenerate master dict 
     35will create master category dict from by model dict and model enabled dict. 
     36regenerate model dict will create by model dict and model enabled dict 
     37from master category dict. These methods are implemented in different places 
     38depending on the exact usage. A good place to start is with the methods 
     39and docs in CategoryManager. They’re also implemented in basepage.py and 
     40CategoryInstaller. 
     41 
     42 
    1043== Other Documents ==