Changes between Version 6 and Version 7 of Session2


Ignore:
Timestamp:
Oct 1, 2015, 2:02:56 PM (10 years ago)
Author:
Greg Couch
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Session2

    v6 v7  
    33== Background ==
    44
    5 From the user perspective, Chimera2 is an application with a suite of tools. In any given session, there may be some user data (e.g., molecules and volumes) and some active tools (e.g., Reply Log and Command Line). One of the required functionality of Chimera2 is to be able to save the current state of the session, and then resume the session in the same state at the future time. This sounds simple enough, but there are some details that need to be explicitly enumerated, as not everyone will agree what consists "the state of the session".
     5From the user perspective, Chimera2 is an application with a suite of tools. In any given session, there may be some user data (e.g., molecules and volumes) and some active tool GUIs (//e.g.//, Reply Log and Command Line). One of the required functionality of Chimera2 is to be able to save the current state of the session, and then resume the session in the same state at the future time. This sounds simple enough, but there are some details that need to be explicitly enumerated, as not everyone will agree what consists "the state of the session".
    66
    7 From the developer side, we can distinguish a couple different types of data.  Some data are the same for all sessions; for example, start-up preferences and the list of installed tools. Some data are different for different sessions; for example, the list of _active_ tools and the currently opened data files. Let's call the former "initial data" and the latter "session data". Chimera2's "state of the session" consists only of "session data".  This means that if the user (a) saves a session, and then (b) changes his start-up preference (e.g., background color) and it was not explicitly overridden in a session (e.g., by changing the background color), then (c) on resumption, the session will use the new background color. Clearly, this may be unexpected for the user.  We will need to define what data normally defined by "initial data" that should always be saved as "session data" so that these surprises are minimized.  (The answer is not "all of them" because clearly the list of installed tools may change, and additions and deletions cannot be ignored.)
     7From the developer side, we can distinguish a couple different types of data.  Some data are the same for all sessions; for example, start-up preferences and the list of installed tools. Some data are different for different sessions; for example, the list of active tool GUIs and the currently opened data files. Let's call the former "initial data" and the latter "session data". Chimera2's "state of the session" consists only of "session data".  This means that if the user (a) saves a session, and then (b) changes his start-up preference (//e.g.//, background color) and it was not explicitly overridden in a session (//e.g.//, by changing the background color), then (c) on resumption, the session will use the new background color. Clearly, this may be unexpected for the user.  We will need to define what data normally defined by "initial data" that should always be saved as "session data" so that these surprises are minimized.  (The answer is not "all of them" because clearly the list of installed tools may change, and additions and deletions cannot be ignored.)
    88
    99(Chimera2 data can be categorized as raw data, GUI data, and organizational data. Expound.)
     10
     11=== What is a Tool? ===
     12
     13The word tool is used in two different ways in Chimera2:
     141. A chunk of functionality (code) from the tool shed
     152. GUIs that the user can start via a menu
     16
     17In this document, tool, by itself, refers to the code.
    1018
    1119=== Data Types ===
     
    4856Session attributes:
    4957* open models
    50 * open tools
     58* open tool GUIs
    5159* running tasks
    5260* scenes
     
    5563* view (camera, lighting, clipping, etc.)
    5664* selections (TODO)
     65* tool non-GUI data
    5766
    5867Nested data:
    59 * Tool GUI state
     68* Tool GUI data
    6069* molecules: atoms/bonds/residues & graphical state
    6170* pseudobonds
     
    6473* atom/bond annotations
    6574
    66 Note that "tool" state may be in a session attribute rather than in the GUI instance.
     75The non-GUI state of a tool should be kept in a session attribute
     76or model rather than an instance of the tool's GUI class.
    6777
    6878=== Issues ===
    6979
     80* Can we provide a simple state API?
     81  * just hand off object
    7082* How to give dependencies for ordering session data?
    7183  * naive data with back references are circular
    7284  * may need to give before and after dependencies
     85  * how to handle dependencies between models?
    7386* What is the granularity?
    7487* Can we guarantee non-circular references?
    75 * Can we provide a "simple" API for tools?
    7688
    7789== Possible Solution ==
     
    8799* molecular data is in a model
    88100* session gets a model from its list of models
    89 * a tool may provide a new model that depends on molecular data and tool state
     101* a tool may provide a new model that depends on molecular data and tool non-GUI state
    90102* so some models will need to saved before others
    91 * so some tools may need to saved before associated model
    92 * does that mean that tools are saved first?
     103* some tool non-GUI state may need to saved before associated model
     104* does that mean that tool non-GUI state is saved first?
     105  * note that the tool GUI state is saved separately
    93106
    94107How the data is organized in the session does not match the order in which the data needs to be saved.
    95 
    96108
    97109=== The Solution ===
     
    107119=== Tool Classes ===
    108120
    109 * All classes exported by tools need to have a 'tool_info' attribute, a !ToolInfo instance
     121* All classes exported by tools need to have a 'tool_info' attribute, a !ToolInfo instance so the session code knows which tool is needed to reconstruct it
    110122* !ToolInfo needs the State version in addition to the tool version
    111123* When registering a tool's commands, it needs the !ToolInfo instance, just like starting a tool's GUI to be able set the the 'tool_info' attribute if there is no GUI
    112 * The tool's module needs a 'get_class' function to return the class associated with a name.
    113 * Tool classes might have an alternate initializer if attributes are not simple (like pickle)
     124* The tool's module needs a 'get_class' function to return the class associated with a name
     125  * for security and allows renaming
     126* Tool classes have an alternate initializer if attributes are not simple (like pickle)