File: State.py

package info (click to toggle)
forg 0.5.1-7
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny, squeeze, wheezy
  • size: 536 kB
  • ctags: 738
  • sloc: python: 5,407; xml: 85; makefile: 64
file content (66 lines) | stat: -rw-r--r-- 2,187 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# State.py
# $Id: State.py,v 1.2 2001/07/11 22:43:09 s2mdalle Exp $
# Written by David Allen <mda@idatar.com>
#
# Saves state information about a particular GopherResource.
# This is a bit overkill, but it was easier than putting the information
# in a tuple and then having to worry about which index gets to which item
# in the tuple.  Easier just to call methods like getResource()  :)
#
# This is just a souped up structure.  No calculation is done, just accessors
# and mutators are provided to bundle several different data items together
# under one object.
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
############################################################################
class State:
    verbose = None
    
    def __init__(self, response, resource, widget):
        self.response = response
        self.resource = resource
        self.widget   = widget
        return None
    
    def __str__(self):
        return "%s" % self.resource.toURL()
    
    def __repr__(self):
        return self.__str__()

    # Accessors
    
    def getResponse(self):
        return self.response
    
    def getResource(self):
        return self.resource
    
    def getWidget(self):
        return self.widget

    # Mutators
    
    def setResponse(self, resp):
        self.response = resp
        return self.getResponse()
    
    def setResource(self, res):
        self.resource = res
        return self.getResource()
    
    def setWidget(self, widget):
        self.widget = widget
        return self.getWidget()