Commit a9f2250792782a33421b9c9918b42c1e58713b67

Authored by Paulo Henrique Junqueira Amorim
1 parent 00447668

ADD: Session to control project status

Showing 1 changed file with 10 additions and 51 deletions   Show diff stats
invesalius/session.py
1 -#--------------------------------------------------------------------------  
2 -# Software: InVesalius - Software de Reconstrucao 3D de Imagens Medicas  
3 -# Copyright: (C) 2001 Centro de Pesquisas Renato Archer  
4 -# Homepage: http://www.softwarepublico.gov.br  
5 -# Contact: invesalius@cti.gov.br  
6 -# License: GNU - GPL 2 (LICENSE.txt/LICENCA.txt)  
7 -#--------------------------------------------------------------------------  
8 -# Este programa e software livre; voce pode redistribui-lo e/ou  
9 -# modifica-lo sob os termos da Licenca Publica Geral GNU, conforme  
10 -# publicada pela Free Software Foundation; de acordo com a versao 2  
11 -# da Licenca.  
12 -#  
13 -# Este programa eh distribuido na expectativa de ser util, mas SEM  
14 -# QUALQUER GARANTIA; sem mesmo a garantia implicita de  
15 -# COMERCIALIZACAO ou de ADEQUACAO A QUALQUER PROPOSITO EM  
16 -# PARTICULAR. Consulte a Licenca Publica Geral GNU para obter mais  
17 -# detalhes.  
18 -#--------------------------------------------------------------------------  
19 -  
20 -  
21 -  
22 -class Session(object)  
23 - def __init__(self):  
24 - self.project_state = const.PROJ_FREE  
25 - # const.PROJ_FREE  
26 - # const.PROJ_OPEN  
27 - # const.PROJ_CHANGE  
28 - self.language = const.DEFAULT_LANG # en  
29 - self.imagedata_reformat = const.DEFAULT_REFORMAT # 1  
30 - self.layout = const.DEFAULT_LAYOUT #  
31 - # const.LAYOUT_RAPID_PROTOTYPING,  
32 - # const.LAYOUT_RADIOLOGY,  
33 - # const.LAYOUT_NEURO_NAVIGATOR,  
34 - # const.LAYOUT_ODONTOLOGY  
35 -  
36 -  
37 -  
38 -  
39 -# USE PICKLE / PLIST !!!!!!  
40 -# external - possibly inside controller  
41 -# def SetFileName(self, filename)  
42 -# # try to load config file from home/.invesalius  
43 -# load = self.Load(filename)  
44 -# if load:  
45 -# config = InVesaliusConfig  
46 -  
47 -# def Load(self, filename):  
48 -# # TODO: which file representation?  
49 -# # config?  
50 -# # plist?  
51 -# pass 1 +import constants as const
  2 +from utils import Singleton
  3 +
  4 +class Session(object):
  5 + # Only one project will be initialized per time. Therefore, we use
  6 + # Singleton design pattern for implementing it
  7 + __metaclass__= Singleton
  8 +
  9 + def __init__(self):
  10 + self.project_status = const.NEW_PROJECT
52 \ No newline at end of file 11 \ No newline at end of file