source: subversion/applications/routing/pyroute/dataStore.py

Last change on this file was 5746, checked in by ojw, 12 years ago

Move the events-handler into its own module

File size: 1.7 KB
Line 
1#!/usr/bin/python
2#-----------------------------------------------------------------------------
3# Global data table
4#
5# Usage:
6#   (library code for pyroute GUI, not for direct use)
7#
8# Types of data stored:
9#   * Options and settings
10#   * Data (e.g. current position)
11#   * Event-related data (e.g. position of last click)
12#
13# Not stored here:
14#   * Routes (internal within the routing module)
15#   * POIs and map data
16#
17# TODO:
18#   * Event handling code needs to be moved into a module
19#-----------------------------------------------------------------------------
20# Copyright 2007, Oliver White
21#
22# This program is free software: you can redistribute it and/or modify
23# it under the terms of the GNU General Public License as published by
24# the Free Software Foundation, either version 3 of the License, or
25# (at your option) any later version.
26#
27# This program is distributed in the hope that it will be useful,
28# but WITHOUT ANY WARRANTY; without even the implied warranty of
29# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
30# GNU General Public License for more details.
31#
32# You should have received a copy of the GNU General Public License
33# along with this program.  If not, see <http://www.gnu.org/licenses/>.
34#-----------------------------------------------------------------------------
35from base import pyrouteModule
36
37class DataStore(pyrouteModule):
38    def __init__(self, modules):
39        pyrouteModule.__init__(self,modules)
40        self.options = {}
41   
42    def getData(self,name,default=None):
43        return(self.options.get(name,default))
44   
45    def setData(self,name,value):
46        self.options[name] = value
Note: See TracBrowser for help on using the repository browser.