This file is indexed.

/usr/share/bibus/SearcheTBlast.py is in bibus 1.5.2-4.

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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
## Copyright 2004,2005 Pierre Martineau <pmartino@users.sourceforge.net>
# This file is part of Bibus, a bibliographic database that can
# work together with OpenOffice.org to generate bibliographic indexes.
#
# Bibus 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.
#
# Bibus 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 Bibus; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
#
# generated by wxGlade 0.2 on Wed May 28 22:47:35 2003
# Then edited by hand
# DO NOT EDIT WITH wxGLADE'

import wx
import urllib,ClientForm, urllib2, xml.dom.minidom, Import.PubMedXML, time, BIB
import newProgressWin
tool = 'bibus'						# used to identify the software at ncbi in case of problem
email= 'm.errami@gmail.com' # used to identify the software at ncbi in case of problem

eTBlastHTTP = "http://invention.swmed.edu"

class SearcheTBlast(wx.Dialog):
	def __init__(self,db, *args, **kwds):

		kwds["style"] = wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL
		wx.Dialog.__init__(self, *args, **kwds)
		self.SearchList = [u'All Fields [ALL]', u'Text Words [TW]', u'Author [AU]', u'Title [TI]', u'Journal Title [TA]', u'Publication Date [DP]', u'Publication Type [PT]', u'Entrez Date [EDAT]', u'Pagination [PG]', u'Volume [VI]', u'Issue [IP]', u'Unique Identifiers [UID]', u'Personal Name as Subject [PS]', u'MeSH Terms [MH]', u'MeSH Date [MHDA]', u'MeSH Major Topic [MAJR]', u'MeSH Subheadings [SH]', u'Affiliation [AD]', u'EC/RN Number [RN]', u'Filter [FILTER]', u'Language [LA]', u'Secondary Source ID [SI] ', u'Subset [SB]', u'Substance Name [NM]']
		self.KeyList = ('[ALL]', '[TW]', '[AU]', '[TI]', '[TA]', '[DP]', '[PT]', '[EDAT]', '[PG]', '[VI]', '[IP]', '[UID]', '[PS]', '[MH]', '[MHDA]', '[MAJR]', '[SH]', '[AD]', '[RN]', '[FILTER]', '[LA]', '[SI]]', '[SB]', '[N]')
		self.SearchBool = ['AND','OR','NOT']
		self.db=db
		self.parent = args[0]
		# Top of the Dialog
		self.Mode = wx.RadioBox(self, -1, _("Mode"), choices=[_('Normal'), _('Expert')], majorDimension=0, style=wx.RA_SPECIFY_COLS)
		self.label_NumbRec= wx.StaticText(self, -1, _("Records with Z-Score >="))
		self.label_Paste= wx.StaticText(self, -1, _(" Paste your text below: "))
		self.label_Email= wx.StaticText(self, -1, _("Enter your email below (Optional):"))
		self.label_Cite= wx.StaticText(self, -1, _("eTBlast main page: http://invention.swmed.edu/etblast/index.shtml"))
		self.NumbRec = wx.SpinCtrl(self, -1, min=1, max=10000)
		self.NumbRec.SetValue(3)
		self.label_FirstRec = wx.StaticText(self, -1, _("Keep the best citations: "))
		self.FirstRec = wx.SpinCtrl(self, -1, "0", min=0, max=10000)
		self.FirstRec.SetValue(100)
		emailsize = wx.Size(400,20)
		self.Email = wx.TextCtrl(self, -1, u"",size = emailsize)
		#self.Email.SetValue(")
		self.static_line_1 = wx.StaticLine(self, -1)
		#
		#### TextCtrl to enter query in expert mode
		self.ExpertValue = wx.TextCtrl(self, -1, u"", style=wx.TE_MULTILINE)
		#### wx.Panel that enclose the grid
		self.PanelSearch = wx.TextCtrl(self, -1, u"", style=wx.TE_MULTILINE)
		#### Search grid
		#self.ScrollWin = wx.ScrolledWindow(self.PanelSearch,style=wx.TAB_TRAVERSAL)	# in order to be able to scroll the choices grid
		#self.ScrollWin.SetScrollRate(10,10)
		#self.SearchBoolKey=[]
		#self.SearchChoice=[]
		#self.SearchValue=[]
		#self.SearchBoolKey.append(wx.StaticText(self.ScrollWin, -1, u""))	# first line special since there is no bool choice
		#self.SearchChoice.append(wx.Choice(self.ScrollWin, -1, choices=self.SearchList))
		#self.SearchValue.append(wx.TextCtrl(self.ScrollWin, -1, u""))
		#for line in range(1,4):
		#	self.SearchBoolKey.append(wx.Choice(self.ScrollWin, -1, choices=self.SearchBool))
		#	self.SearchChoice.append(wx.Choice(self.ScrollWin, -1, choices=self.SearchList))
		#	self.SearchValue.append(wx.TextCtrl(self.ScrollWin, -1, u""))
		#### Button to add line
		#self.static_line_2 = wx.StaticLine(self.PanelSearch, -1)
		#self.button_Add = wx.Button(self.PanelSearch, -1, _("Add a line"))
		#self.static_line_3 = wx.StaticLine(self, -1)
		#
		self.button_Cancel = wx.Button(self, wx.ID_CANCEL, _("Cancel"))
		self.button_Search = wx.Button(self, wx.ID_OK, _("Search"))
		self.button_SearchClose = wx.Button(self, -1, _("Experts' papers"))
		self.button_Count = wx.Button(self, -1, _("Count"))

		self.timeOut = 600
		self.__set_properties()
		self.__do_layout()
		self.__set_event()
		self.SetDimensions(BIB.PUBMED_X, BIB.PUBMED_Y, BIB.PUBMED_WIDTH, BIB.PUBMED_HEIGHT)
		#self.CenterOnParent()

	def __set_properties(self):
		self.SetTitle(_("eTBlast search on PubMed"))
		self.Mode.SetSelection(0)
		self.Mode.Enable(False)
		self.button_SearchClose.Enable(False)
		self.button_Count.Enable(False)
		#self.SearchChoice[0].SetSelection(0)
		#for line in range(1,4):
		#	self.SearchChoice[line].SetSelection(0)
		#	self.SearchBoolKey[line].SetSelection(0)
		self.button_Search.SetDefault()
		self.PanelSearch.SetFocus()	# we give focus to the search box

	def __do_layout(self):
		sizer_1 = wx.BoxSizer(wx.VERTICAL)	# top sizer if the dialog window
		sizer_2 = wx.BoxSizer(wx.HORIZONTAL)	# for top of the dialog
		self.grid_sizer_1 = wx.FlexGridSizer(0, 3, vgap=0, hgap=0)	# main grid
		self.sizer = wx.BoxSizer(wx.VERTICAL) # sizer enclosing scrolled window + button 'Add line' = sizer of self.PanelSearch
		sizer_3 = wx.BoxSizer(wx.HORIZONTAL)	# for buttons (bottom)
		grid_sizer_2 = wx.GridSizer(2, 2, vgap=5, hgap=5)	# for spinButtons (number of record)
		#
		# Set top of the dialog
		# number of record
		grid_sizer_2.Add(self.label_NumbRec, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL,0)
		grid_sizer_2.Add(self.NumbRec,0,0,0)
		grid_sizer_2.Add(self.label_FirstRec, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL,0)
		grid_sizer_2.Add(self.FirstRec,0,0,0)
		sizer_2.Add(self.Mode,0,wx.ALIGN_RIGHT|wx.ALL,5)
		sizer_2.Add((10,0),1,0,0)
		sizer_2.Add(grid_sizer_2,0,wx.ALIGN_RIGHT,0)
		sizer_1.Add(sizer_2,0,wx.EXPAND,0)
		sizer_1.Add(self.static_line_1,0,wx.EXPAND,0)
		#
		# Set grid
		#for line in range(4):
		#	self.grid_sizer_1.Add(self.SearchBoolKey[line],0,0,0)
		#	self.grid_sizer_1.Add(self.SearchChoice[line],0,0,0)
		#	self.grid_sizer_1.Add(self.SearchValue[line],0,wx.EXPAND,0)
		self.grid_sizer_1.AddGrowableCol(2)
		#self.ScrollWin.SetSizer(self.grid_sizer_1)
		#self.grid_sizer_1.Fit(self.ScrollWin)
		#self.grid_sizer_1.SetSizeHints(self.ScrollWin)
		#self.ScrollWin.Layout()
		#self.sizer.Add(self.ScrollWin,1,wx.EXPAND,0)
		# Add line button
		#self.sizer.Add(self.static_line_2,0,wx.EXPAND,0)
		#self.sizer.Add(self.button_Add,0,wx.EXPAND,0)
		self.PanelSearch.SetSizerAndFit(self.sizer)
		sizer_1.Add(self.label_Paste, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL,0)
		sizer_1.Add(self.PanelSearch,1,wx.EXPAND,0)
		sizer_1.Add(self.label_Email,0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL,0)
		sizer_1.Add(self.Email,0, wx.ALIGN_CENTER|wx.ALIGN_CENTER_VERTICAL,0)
		sizer_1.Add(self.label_Cite,0, wx.ALIGN_CENTER|wx.ALIGN_CENTER_VERTICAL,0)
		#size = self.Email.getSize()
		#print size.getWidth(), size.getHeight()
		sizer_1.Add(self.ExpertValue,1,wx.EXPAND,0)
		sizer_1.Show(self.ExpertValue,False)	# Masked at startup
		#
		#sizer_1.Add(self.static_line_3,0,wx.EXPAND,0)
		#
		# Set Bottom Buttons
		sizer_3.Add(self.button_Cancel, 0, wx.ALL,5)
		sizer_3.Add(self.button_Search, 0, wx.ALL,5)
		sizer_3.Add(self.button_SearchClose, 0, wx.ALL,5)
		sizer_3.Add(self.button_Count, 0, wx.ALL,5)
		sizer_1.Add(sizer_3,0,wx.ALIGN_CENTER_HORIZONTAL,0)
		#
		self.SetAutoLayout(1)
		self.SetSizer(sizer_1)
		sizer_1.Fit(self)
		sizer_1.SetSizeHints(self)
		self.Layout()

	def __set_event(self):
		wx.EVT_BUTTON(self,wx.ID_OK,self.onSearch)
		wx.EVT_BUTTON(self,wx.ID_CANCEL,self.onCloseWindow)
		wx.EVT_CLOSE(self, self.onCloseWindow)
		#wx.EVT_BUTTON(self,self.button_Add.GetId(),self.addLine)
		wx.EVT_BUTTON(self,self.button_SearchClose.GetId(),self.onSearchClose)
		wx.EVT_BUTTON(self,self.button_Count.GetId(),self.onCount)
		wx.EVT_RADIOBOX(self,self.Mode.GetId(),self.onMode)

	def onMode(self,event):
		selection = self.Mode.GetStringSelection()
		if selection == _('Normal'):
			self.GetSizer().Show(self.ExpertValue,False)
			self.GetSizer().Show(self.PanelSearch,True)
		else:
			self.GetSizer().Show(self.PanelSearch,False)
			self.GetSizer().Show(self.ExpertValue,True)
			self.ExpertValue.SetValue(self.__makeSearch())	# set the expert value to the current Normal search
		self.Layout()

	#def addLine(self,event):
	#	self.SearchBoolKey.append(wx.Choice(self.ScrollWin, -1, choices=self.SearchBool))
	#	self.SearchChoice.append(wx.Choice(self.ScrollWin, -1, choices=self.SearchList))
	#	self.SearchValue.append(wx.TextCtrl(self.ScrollWin, -1, u""))
	#	self.grid_sizer_1.Add(self.SearchBoolKey[-1],0,0,0)
	#	self.grid_sizer_1.Add(self.SearchChoice[-1],0,0,0)
	#	self.grid_sizer_1.Add(self.SearchValue[-1],0,wx.EXPAND,0)
	#	self.grid_sizer_1.Fit(self.ScrollWin)
	#	self.PanelSearch.Layout()
	#	self.Layout()

	def onCloseWindow(self,event):
		BIB.PUBMED_WIDTH, BIB.PUBMED_HEIGHT = self.GetSizeTuple()
		BIB.PUBMED_X, BIB.PUBMED_Y = self.GetPositionTuple()
		BIB.PUBMED_NB = self.NumbRec.GetValue()
		self.Destroy()

	def onSearchClose(self,event):
		#self.onSearch(event)
		#self.onCloseWindow(event)
		dlg=wx.MessageDialog(self, _("Experts search is not available yet!"), caption = _("Information"), style = wx.OK | wx.CENTRE | wx.ICON_ERROR, pos = wx.DefaultPosition)

	def __makeSearch(self):
		"""Return the search corresponding to the choices in Normal mode"""
		line = 0
		search = u''
		#print "%s"%self.PanelSearch.GetValue()
		#try:
		#	while self.SearchValue[line].GetValue() == u'': line = line +1
		#	search="""%s%s""" %(self.SearchValue[line].GetValue().strip(),self.KeyList[self.SearchChoice[line].GetSelection()])
		#	line = line +1
		#	while True:
		#		if self.SearchValue[line].GetValue():
		#			search = """%s %s %s%s""" %(search,self.SearchBoolKey[line].GetStringSelection(),self.SearchValue[line].GetValue().strip(),self.KeyList[self.SearchChoice[line].GetSelection()])
		#		line = line +1
		#except IndexError: pass
		return search

	def __query_medline(self,rettype):
		if self.Mode.GetStringSelection() == _('Normal'):
			search = self.__makeSearch()
		else:
			search = self.ExpertValue.GetValue().strip()
		#
		#retstart = self.FirstRec.GetValue()
		retstart = 0
		retmax = self.NumbRec.GetValue()
		#
		#query = urllib.urlencode({'db':'pubmed','term':search,'retstart':retstart,'retmax':retmax,'usehistory':'y','rettype':rettype,'retmode':'xml','tool':tool,'email':email})
		#print query
		#return urllib.urlopen("http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi", query)

	def onSearch(self,event):
		msg= newProgressWin.newProgressWin("eTBlast request is on the way...","Initializing...")
		#try:
		retstart = 0
		retmax = self.NumbRec.GetValue()
		the_url='http://invention.swmed.edu/etblast/etblast.shtml'
		try:
			req = urllib2.Request(the_url)
			response = urllib2.urlopen(req)
		except urllib2.URLError:
			msg.Destroy()
			return
		forms = ClientForm.ParseResponse(response)
		response.close()
		form = forms[0]
		asciiSearchString = self.PanelSearch.GetValue().strip()
		asciiSearchString = asciiSearchString.encode('ascii', 'ignore')
		form["paragraph_area"] = asciiSearchString
		form["email"] = self.Email.GetValue()
		request2 = form.click() # urllib2.Request object
		try:
			response2 = urllib2.urlopen(request2)
		except urllib2.HTTPError, response2:
			msg.Destroy()
			return
		result_url=self.__eTBlastParse(response2)
		response2.close()
		#print "sleeping 60 sec"
		#res_example = urllib.urlopen(url_example)
		#print self.__getTitle(res_example)
		res_to_check = urllib.urlopen(result_url)
		response_result_title=self.__getTitle(res_to_check)
		res_to_check.close()
		isTitleOK = -2
		totalTime = 0
		timeOutTime = self.timeOut
		while isTitleOK < 0 :
			if totalTime>=60:
				totalTime = 0
			if timeOutTime<=0:
				msg.Destroy()
				self.__showTimeOut()
				return
			res_to_check = urllib.urlopen(result_url)
			response_result_title=self.__getTitle(res_to_check)
			isTitleOK = response_result_title.rfind('Results of the search')
			if isTitleOK < 0 :
				res_to_check.close()
				for i in range(5):
					time.sleep(1)
					timeOutTime=timeOutTime-1
					totalTime =totalTime+1
					if not msg.Update(totalTime*0.01,"Waiting for eTBlast Reply..."):
						msg.Destroy()
						return
			#print "retrying in 5 seconds =>",response_result_title
		if not msg.Update(0.7,"Fetching eTBlast Results..."):
			msg.Destroy()
			return
		#print "query terms before"
		query_terms=self.__parseResults(res_to_check)
		if not query_terms:
			msg.Destroy()
			wx.MessageBox(_("The search did not return any result."),_("eTBlast result"),parent=self)
			return
		#print "query terms after"
		if not msg.Update(0.8,"Sending request to Medline..."):
			msg.Destroy()
			return
		query = urllib.urlencode({'db':'pubmed','term':query_terms,'retstart':retstart,'retmax':retmax,'usehistory':'y','rettype':'uilist','retmode':'xml','tool':'bibus','email':'m.errami@gmail.com'})
		#print "query to send=",query
		#return " "
		f=urllib.urlopen("http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi", query)
		#print f.read()
		try:
			mydom = xml.dom.minidom.parse(f)
			#print 'Count=',mydom.getElementsByTagName('Count')[0].firstChild.data
			#if (not mydom.getElementsByTagName('ERROR')) and (mydom.getElementsByTagName('Count')[0].firstChild.data != '0'):
			webenv = mydom.getElementsByTagName('WebEnv')[0].firstChild.data
			querykey = mydom.getElementsByTagName('QueryKey')[0].firstChild.data
			retstart = 0
			retmax = self.FirstRec.GetValue()
			myquery = urllib.urlencode({'db':'pubmed','query_key':querykey,'retstart':retstart,'retmax':retmax,'retmode':'xml','rettype':'medline','tool':'bibus','email':'m.errami@gmail.com'})
			#print "myquery =",myquery
			#print "query=", query# ,'WebEnv':webenv
			# we don't want to quote WebEnv since it seems to cause problems (% for instance)
			#print "mouWebEnv=%s&%s" %(webenv,myquery)
			f = urllib.urlopen("http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi", "WebEnv=%s&%s" %(webenv,myquery))
			if not msg.Update(0.9,"Fetching Medline Results..."):
				msg.Destroy()
				return
			self.db.deleteOnline()	# clear last online search
			#print f.read()
			records = Import.PubMedXML.importRef(f)
			for CurRecord in records:
				#print "records"
				self.db.writeRefOnline(CurRecord)
			f.close()
			## update window list
			self.parent.keytree.SelectItem(self.parent.keytree.keyOnline)
			self.parent.updateList(self.db.getAllRefOnline(BIB.LIST_DISPLAY,BIB.LIST_ORDER,BIB.LIST_HOW,short=True))
			msg.Destroy()
			#self.__showError()
		except:
			self.__showError()
			msg.Destroy()
		#except:
		#	print "An error occured when trying to submit form to eTBlast"
		#	msg.Destroy()
			
	def __parseResults(self,doc):
		#etblast_avg=0.385
		#etblast_sd=0.152
		query =""
		nbRec=0 
		noFound = "bibusNoneFoundInParsingEtblast"
		tmpQuery= noFound
		for line in doc:
			if nbRec >=self.FirstRec.GetValue() + 1:
				break
			if line.rfind('pmid=')>-1 and line.rfind('&amp;user_id=')>-1 :
				#print line[line.rfind('pmid=')+5:line.rfind('&amp;user_id=')]
				tmpQuery = line[line.rfind('pmid=')+5:line.rfind('&amp;user_id=')]
				nbRec = nbRec+1
			if line.rfind('Score:') >-1 and line.rfind(tmpQuery)==-1:
				try:
					score = float(line[line.rfind('Z-score:')+8:line.rfind('</td></tr>')])
					#print "Score ok =", score
				except:
					#print "score set to 3"
					score = 3
				if score >= self.NumbRec.GetValue() and tmpQuery != noFound :
					query = query+tmpQuery+"[UID] OR "
		return query[0:query.rfind(' OR')]

	def __getTitle(self,doc):
		isTitle = -2
		for line in doc:
			isTitle = line.rfind('<title>')
			if isTitle >-1 :
				return line
		return "NOTITLE"

	def __eTBlastParse(self,myurl):
		#print "URLS IS TITLE IS ===",
		title = self.__getTitle(myurl)
		#print title
		#print "getURL", myurl.geturl()
		#print "getInfo", myurl.info()	# headers
		#print myurl.read()	# body
		fileToParse = myurl
		for line in fileToParse:
			#isFound = line.rfind('targetURL')
			isFound =line.rfind('targetURL="http://invention.swmed.edu/cgi-bin/etblast/processing_etblast_new.pl?user-id=')
			upBrack = line.rfind('"')
			lowBrack = line.find('"') +1
			if isFound >-1 :
				result_url=line[lowBrack:upBrack]
				#v =0
				#while v < 10:
				#	v += 1
				#	print "v=",v
				#print "sleeping for 10s"
				#time.sleep(1)
				#print "slept done"
				#print "URL for Result is: \n%s"%result_url
				usernb = result_url[(result_url.rfind('='))+1:len(line)]
				actual_result_url = "http://invention.swmed.edu/etblast/user/user-%s/results.html"%usernb
				#print "ACTUAL for Result is: \n%r"%actual_result_url
				return actual_result_url
		return " "
			#example_URL http://invention.swmed.edu/etblast/user/user-1133719983/results.html
			#if line.rfind("/cgi-bin/etblast/abstract_local?pmid=")!=-1:
			#print "rfind=>%s"%line.rfind('/cgi-bin/etblast/abstract_local?pmid=')
			#print "rfind=>%s"%line.rfind('/cgi-bin/etblast/abstract_local?pmid=')

	def onCount(self,event):
		f = self.__query_medline('count')
		#print f.read()
		mydom = xml.dom.minidom.parse(f)
		if not mydom.getElementsByTagName('ERROR'):
			self.__showCount(mydom.getElementsByTagName('Count')[0].firstChild.data)
		else:
			self.__showError()

	def __showError(self):
		dlg=wx.MessageDialog(self, _("Error during query"), caption = _("Error"), style = wx.OK | wx.CENTRE | wx.ICON_ERROR, pos = wx.DefaultPosition)
		try:
			dlg.ShowModal()
		finally:
			dlg.Destroy()
	def __showTimeOut(self):
		tOut = self.timeOut/60
		dlg=wx.MessageDialog(self, _("Time Out (%s min). No answer received. eTBLAST server might be down."%tOut), caption = _("Error"), style = wx.OK | wx.CENTRE | wx.ICON_ERROR, pos = wx.DefaultPosition)
		try:
			dlg.ShowModal()
		finally:
			dlg.Destroy()

	def __showCount(self,count):
		dlg=wx.MessageDialog(self, _("There is %s such records in Medline")%count, caption = u"", style = wx.OK | wx.CENTRE | wx.ICON_INFORMATION, pos = wx.DefaultPosition)
		try:
			dlg.ShowModal()
		finally:
			dlg.Destroy()

# end of class Search_model