This file is indexed.

/var/lib/gnumed/server/pycommon/gmGuiBroker.py is in gnumed-server 19.6-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
"""GNUMed GUI element brokerage

This module provides wrappers for the equivalent of global
variables needed for a gnumed GUI client interface

@author: Dr. Horst Herb
@version: 0.2
@copyright: GPL v2 or later
"""
#-----------------------------------------------------------
# $Source: /home/ncq/Projekte/cvs2git/vcs-mirror/gnumed/gnumed/client/pycommon/gmGuiBroker.py,v $
# $Id: gmGuiBroker.py,v 1.4 2004-06-20 15:44:28 ncq Exp $
__version__ = "$Revision: 1.4 $"
__author__ = "H.Herb <hherb@gnumed.net>, H.Berger <Hilmar.Berger@gmx.de>"
#===========================================================
if __name__ == '__main__':
	_ = lambda x:x

# FIXME !!! hack moved here from gmConf. This definitely must be replaced by some 
# structure getting data from the backend
# FIXME: hardcoded color/width !?! move to DB (?)
config = {'main.use_notebook':1, 'main.shadow.colour':(131, 129, 131), 'main.shadow.width':10}

#===========================================================
class GuiBroker:
	"Wrapper for global objects needed by GNUMmed GUI clients"

	#This class wraps all global gui objects (variables)for a gnumed
	#application. The static (at application level)dictionary
	#__objects can be accessed through the method addobject
	#and getobject.
	#So, if you need to access the main window frame, you would
	#query an instance of GuiBroker for it.

	__objects = {}
	__keycounter=0


	def __init__(self):
		pass


	def addobject(self, widget, key=None):
		"Add an object to the gnumed gui object dictionary"

		#An object can be anything (class, variable, widget)
		#The "key" is a key expression (number, text) that
		#allows you to retrieve the object.
		#Convention for keys is the widget or variable name
		#as a text string
		#If key is not passed as parameter, a unique serial
		#number is allocated as key and returned

		if not key:
		# create a new sequential key that doesn't exist yet
			key = GuiBroker.__keycounter + 1
			while GuiBroker.__objects.has_key(key):
				key +=1
		GuiBroker.__keycounter = key
		GuiBroker.__objects[key]=widget
		return key



	def getobject(self, key):
		"allows to retrieve a gnumed gui element; see addobject() regarding the key parameter"
		return GuiBroker.__objects[key]

	def has_key( self, key):
		return GuiBroker.__objects.has_key(key)



	def keylist(self):
		" returns a list of all keys; see documentation for the dictionary data type"
		return GuiBroker.__objects.keys()



	def valuelist(self):
		"returns a list of all values; see documentation for the dictionary data type"
		return GuiBroker.__objects.values()



	def itemlist(self):
		"returns a list of all key:value pairs; see documentation for the dictionary data type"
		return GuiBroker.__objects.items()



	def __getitem__(self, key):
		"Allows retrieving the value via value = instance[key]"
		return self.getobject(key)



	def __setitem__(self, key, object):
		"Allows access in the style of instance[key]=value"
		return self.addobject(object, key)

#===========================================================
# you can test this module by invoking it as main program
if __name__ == "__main__":
    print '>>> gmGuiBroker.GuiBroker test'
    test = GuiBroker()

    print '>>> test.addobject("something", 3)'
    var = test.addobject("something", 3)
    print var, "\n"

    print '>>> test.addobject("something else without a specified key")'
    var = test.addobject("something else without a specified key")
    print var, "\n"

    print '>>> test.addobject(test)'
    testreference = test.addobject(test)
    print testreference, "\n"

    print '>>> test.addobject(100, "hundred)'
    var = test.addobject(100, "hundred")
    print var, "\n"

    print ">>> test.keylist()"
    var = test.keylist()
    print var, "\n"

    print ">>> test.valuelist()"
    var = test.valuelist()
    print var, "\n"

    print ">>> test.itemlist()"
    var = test.itemlist()
    print var, "\n"

    print ">>> test[3]"
    var = test[3]
    print var, "\n"

    print ">>> test[testreference].getobject('hundred')"
    var = test[testreference].getobject('hundred')
    print var, "\n"

    print ">>> var = test[testreference]"
    var = test[testreference]
    print var, "\n"

    print ">>> var = var['hundred']"
    var = var['hundred']
    print var, "\n"

    print '>>> try: test.addobject["duplicate key", 3]'
    print '>>> except KeyError: print "Duplicate keys not allowed!"'
    try: test["duplicate key", 3]
    except KeyError: print "Duplicate keys not allowed!"

    print ">>> test['key']='value'"
    test['key']='value'
    print test['key']

#===========================================================
# $Log: gmGuiBroker.py,v $
# Revision 1.4  2004-06-20 15:44:28  ncq
# - we need to be more careful in pleasing epydoc
#
# Revision 1.3  2004/06/20 06:49:21  ihaywood
# changes required due to Epydoc's OCD
#
# Revision 1.2  2004/03/10 00:14:04  ncq
# - fix imports
#
# Revision 1.1  2004/02/25 09:30:13  ncq
# - moved here from python-common
#
# Revision 1.8  2003/11/17 10:56:36  sjtan
#
# synced and commiting.
#
# Revision 1.1  2003/10/23 06:02:39  sjtan
#
# manual edit areas modelled after r.terry's specs.
#
# Revision 1.7  2003/02/09 11:48:59  ncq
# - just some silly cvs keyword
#
# Revision 1.6  2003/02/09 09:41:57  sjtan
#
# clean up new code, make it less intrusive.
#
# Revision 1.5  2003/01/16 14:45:03  ncq
# - debianized
#
# Revision 1.4  2003/01/12 00:20:04  ncq
# - fixed __author__
#
# Revision 1.3  2003/01/12 00:17:44  ncq
# - fixed typo, added CVS keywords
#