[GRASS-SVN] r47841 - grass-addons/grass7/gui/wxpython/wx.wms
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Aug 22 17:18:25 EDT 2011
Author: sudeepsingh
Date: 2011-08-22 14:18:25 -0700 (Mon, 22 Aug 2011)
New Revision: 47841
Modified:
grass-addons/grass7/gui/wxpython/wx.wms/addserver.py
grass-addons/grass7/gui/wxpython/wx.wms/parse.py
grass-addons/grass7/gui/wxpython/wx.wms/wmsmenu.py
Log:
EPSG Codes availablity shown, name, title, attirbutes of layers now shown as a part of description
Modified: grass-addons/grass7/gui/wxpython/wx.wms/addserver.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.wms/addserver.py 2011-08-22 19:54:06 UTC (rev 47840)
+++ grass-addons/grass7/gui/wxpython/wx.wms/addserver.py 2011-08-22 21:18:25 UTC (rev 47841)
@@ -25,10 +25,12 @@
import os
import popen2
import uuid
+from urllib2 import Request, urlopen, URLError, HTTPError
from grass.script import core as grass
from wx.lib.pubsub import Publisher
from BeautifulSoup import BeautifulSoup, Tag, NavigableString, BeautifulStoneSoup
from ServerInfoAPIs import addServerInfo, removeServerInfo, updateServerInfo, initServerInfoBase, getAllRows
+from parse import parsexml, isServiceException, populateLayerTree, isValidResponse
from LoadConfig import loadConfigFile
@@ -93,9 +95,6 @@
self.Bind(wx.EVT_CLOSE, self.OnQuit)
self.__populate_URL_List(self.ServerList)
Publisher().subscribe(self.OnWMSMenuClose, ("WMS_Menu_Close"))
- Publisher().subscribe(self.OnPopupSaveRequest, ("PopupSaveRequest"))
- Publisher().subscribe(self.OnPopupNotSaveRequest, ("PopupNotSaveRequest"))
- Publisher().subscribe(self.OnPopupCancelRequest, ("PopupCancelRequest"))
self.editOn = False
self.selectedUid = None
self.selectedServer = None
@@ -217,7 +216,7 @@
serverData = ServerData()
#self.ServerList.Append(newServerName+" "+newUrl)
- url = newUrl.split()
+ #url = newUrl.split()
#if(len(newUrl) != 0 and len(newServerName) != 0 and len(newUserName) !=0 and len(newPassword) != 0 ):
if(len(newUrl) != 0 and len(newServerName) != 0):
if(self.selectedServer is not None):
@@ -233,6 +232,22 @@
#del self.servers[self.selectedUid]
if(not newUrl.startswith('http://')):
newUrl = 'http://'+newUrl
+
+ validUrl, message = self.validateUrl(newUrl)
+ if(not validUrl):
+ message = "Unable to validate URL ("+message+")"
+ self.ShowMessage(message, 'Warning')
+ grass.warning(message)
+ else:
+ message = "Url validated ("+message+")"
+
+
+
+ StatusBar_fields = [message]
+ self.StatusBar.SetStatusText(StatusBar_fields[0], 0)
+
+ print message
+
serverData.servername = newServerName
serverData.url = newUrl
serverData.username = newUserName
@@ -381,6 +396,25 @@
return
else:
if(removeServerInfo(self.soup, self.selectedUid)):
+ if(not self.saveXMLData()):
+ uid = self.selectedUid
+ servername = self.servers[uid].servername
+ url = self.servers[uid].url
+ username = self.servers[uid].username
+ password = self.servers[uid].password
+ if(addServerInfo(self.soup, self.soup.serverinfo, uid, servername, url, username, password)):
+ message = 'Unable to write data in file, Changes reverted, Remove unsuccessful'
+ grass.warning(message)
+ StatusBar_fields = [message]
+ self.StatusBar.SetStatusText(StatusBar_fields[0], 0)
+ return
+ else:
+ message = 'Unable to write data in file, Unable to revert changes, Remove unsuccessful'
+ grass.warning(message)
+ StatusBar_fields = [message]
+ self.StatusBar.SetStatusText(StatusBar_fields[0], 0)
+ return
+
message = "Remove Successful"
StatusBar_fields = [message]
self.StatusBar.SetStatusText(StatusBar_fields[0], 0)
@@ -391,6 +425,19 @@
self.ServerList.SetSelection(0)
if(len(self.servers) == 0):
self.ServerList.Clear()
+
+ del self.servers[self.selectedUid]
+ self.selectedUid = None
+ self.__update_URL_List()
+ self.selectedServer = None
+ self.ServerNameText.Clear()
+ self.PasswordText.Clear()
+ self.URLText.Clear()
+ self.UsernameText.Clear()
+ #print self.servers
+
+ msg = self.servers
+ Publisher().sendMessage(("update.serverList"), msg)
else:
message = "Remove Unsuccessful"
self.ShowMessage(message, 'Warning')
@@ -401,18 +448,7 @@
return
#print self.servers
- del self.servers[self.selectedUid]
- self.selectedUid = None
- self.__update_URL_List()
- self.selectedServer = None
- self.ServerNameText.Clear()
- self.PasswordText.Clear()
- self.URLText.Clear()
- self.UsernameText.Clear()
- #print self.servers
- self.saveXMLData()
- msg = self.servers
- Publisher().sendMessage(("update.serverList"), msg)
+
#print "Event handler `OnRemove' not implemented"
self.editOn = False
@@ -444,7 +480,14 @@
if(self.checkIfModified(event) == wx.ID_CANCEL):
return
#patch1e
- self.saveXMLData()
+ if(not self.saveXMLData()):
+ message = 'Unable to write in file, Exiting Application'
+ grass.message(message)
+ print message
+ StatusBar_fields = [message]
+ self.StatusBar.SetStatusText(StatusBar_fields[0], 0)
+
+
msg = self.servers
Publisher().sendMessage(("Add_Server_Frame_Closed"), msg)
self.Destroy()
@@ -464,10 +507,12 @@
#patch1e
print '-------------------------------------------------------------------> OnServerList'
#print self.ServerList.CurrentSelection
- url = self.ServerList.GetValue()
+ info = self.ServerList.GetValue()
+ if(len(info) == 0):
+ return
print 'here'
- print url
- urlarr = url.split(self.name_url_delimiter)
+ print info
+ urlarr = info.split(self.name_url_delimiter)
print urlarr
#print self.servers
if(len(urlarr)==2):
@@ -520,6 +565,7 @@
def __populate_URL_List(self, ComboBox):
self.servers, self.map_servernameTouid = getAllRows(self.soup)
+ ComboBox.Append("")
for key, value in self.servers.items():
#string = '{0}{1}{2}'.format(value.servername,self.name_url_delimiter,value.url[0:self.urlLength])
#ComboBox.Append(string)
@@ -530,9 +576,10 @@
def __update_URL_List(self):
self.ServerList.Clear()
+ ComboBox = self.ServerList
+ ComboBox.Append("")
for key,value in self.servers.iteritems():
#name = v.servername+" "+v.url
- ComboBox = self.ServerList
#string = '{0}{1}{2}'.format(value.servername,self.name_url_delimiter,value.url[0:self.urlLength])
#ComboBox.Append(string)
ComboBox.Append(value.servername+self.name_url_delimiter+value.url[0:self.urlLength])
@@ -634,13 +681,39 @@
return True
+ def validateUrl(self,url):
+ message = 'Validating Url...'
+ StatusBar_fields = [message]
+ self.StatusBar.SetStatusText(StatusBar_fields[0], 0)
+ req = Request(url)
+ message = 'Successful'
+ try:
+ response = urlopen(req, None, self.timeoutValueSeconds)
+ xml = response.read()
+ if(not isValidResponse(xml)):
+ message = 'Invalid GetCapabilties response'
+ if(isServiceException(xml)):
+ message = 'Service Exception'
+ except HTTPError, e:
+ message = 'The server couldn\'t fulfill the request.'
+ except URLError, e:
+ message = 'Failed to reach a server.'
+ except ValueError, e:
+ message = 'Value error'
+ except Exception, e:
+ message = 'urlopen exception, unable to fetch data for getcapabilities'
+ message = str(e)
+ if(not message=='Successful'):
+ return False, message
+ else:
+ return True, message
def OnWMSMenuClose(self, msg):
self.Close()
self.Destroy()
return
-
+ '''
def OnPopupSaveRequest(self, msg):
self.OnSave(None)
self.saveXMLData()
@@ -659,6 +732,7 @@
def OnPopupCancelRequest(self, msg):
return
+ '''
# end of class ServerAdd
def AddServerFrame(parentWMS):
Modified: grass-addons/grass7/gui/wxpython/wx.wms/parse.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.wms/parse.py 2011-08-22 19:54:06 UTC (rev 47840)
+++ grass-addons/grass7/gui/wxpython/wx.wms/parse.py 2011-08-22 21:18:25 UTC (rev 47841)
@@ -27,6 +27,33 @@
from urllib2 import Request, urlopen, URLError, HTTPError
+class LayerData():
+ name = None
+ title = None
+ abstract = None
+ srs = None
+
+ def printLayerData(self,layerDataDict):
+ for key, value in layerDataDict.iteritems():
+ print key
+ print value.name.string
+ print value.title.string
+ print value.abstract.string
+ srss = value.srs
+ for srs in srss:
+ a = srs.string
+ a = a.split(':')
+ print a[0]+' '+a[1]
+ print '--------------------------------------------'
+ def appendLayerTree(self, layerDataDict, LayerTree, layerTreeRoot):
+ for key, value in layerDataDict.iteritems():
+ name = value.name.string
+ title = value.title.string
+ abstract = value.abstract.string
+ string = str(key)+"-"+name+":"+title+":"+abstract
+ LayerTree.AppendItem(layerTreeRoot, string)
+
+
def parsexml(xml):
xmltext = xml
@@ -48,6 +75,61 @@
a=f.read()
print a
#parsexml(a) '''
+
+
+def parsexml2(xml):
+ print 'c1'
+ layerDataDict={}
+ count = -1
+ xmltext = xml
+ soup = BeautifulSoup(xmltext)
+ layers = soup.findAll('layer')
+ namelist = []
+ for layer in layers:
+
+ soupname = BeautifulSoup(str(layer))
+ names = soupname.findAll('name')
+ titles = soupname.findAll('title')
+ abstracts = soupname.findAll('abstract')
+ srs = soupname.findAll('srs')
+ print 'c2'
+ print names
+ print titles
+ print abstracts
+ print srs
+ print 'a1'
+ if(len(names)>0):
+ count = count + 1
+ layerDataDict[count] = LayerData()
+ layerDataDict[count].name = unicode(names[0].string)
+ print layerDataDict[count].name
+ else:
+ continue
+ print 'a2'
+ if(len(titles)>0):
+ print 'b1'
+ layerDataDict[count].title = unicode(titles[0].string)
+ print 'b2'
+ else:
+ print 'b3'
+ layerDataDict[count].title = ''
+ print 'b4'
+ print 'a3'
+ if(len(abstracts)>0):
+ layerDataDict[count].abstract = unicode(abstracts[0].string)
+ else:
+ layerDataDict[count].abstract = ''
+ print 'a4'
+ if(len(srs)>0):
+ layerDataDict[count].srs = srs
+ else:
+ layerDataDict[count].srs = ''
+
+ print 'c3'
+ return layerDataDict
+
+
+
def isValidResponse(xml):
soup = BeautifulSoup(xml)
getCapabilities = soup.findAll('wmt_ms_capabilities')
Modified: grass-addons/grass7/gui/wxpython/wx.wms/wmsmenu.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.wms/wmsmenu.py 2011-08-22 19:54:06 UTC (rev 47840)
+++ grass-addons/grass7/gui/wxpython/wx.wms/wmsmenu.py 2011-08-22 21:18:25 UTC (rev 47841)
@@ -28,7 +28,7 @@
import imghdr
from wx.lib.pubsub import Publisher
from urllib2 import Request, urlopen, URLError, HTTPError
-from parse import parsexml, isServiceException, populateLayerTree, isValidResponse
+from parse import *
from WMSMapDisplay import NewImageFrame
from addserver import AddServerFrame
from ServerInfoAPIs import addServerInfo, removeServerInfo, updateServerInfo, initServerInfoBase, getAllRows
@@ -38,6 +38,57 @@
# begin wxGlade: extracode
# end wxGlade
+class LayerData():
+ name = None
+ title = None
+ abstract = None
+ srs = None
+
+ def printLayerData(self,layerDataDict):
+ for key, value in layerDataDict.iteritems():
+ print key
+ print value.name
+ print value.title
+ print value.abstract
+ srss = value.srs
+ for srs in srss:
+ a = srs.string
+ a = a.split(':')
+ print a[0]+' '+a[1]
+ print '--------------------------------------------'
+
+ def appendLayerTree(self, layerDataDict, LayerTree, layerTreeRoot):
+ for key, value in layerDataDict.iteritems():
+ name = value.name
+ title = value.title
+ abstract = value.abstract
+ string = str(key)+"-"+name+":"+title+":"+abstract
+ LayerTree.AppendItem(layerTreeRoot, string)
+
+ def setKeyToEPSGCodes(self, layerDataDict):
+ keytoepsgcodes = {}
+ for key, value in layerDataDict.iteritems():
+ srss = value.srs
+ l=[]
+ for srs in srss:
+ a = srs.string
+ a = a.split(':')
+ l = l+[a[1]]
+ print 'here'
+ print 'key = ' + str(key)
+ print l
+ print 'now'
+ keytoepsgcodes[str(key)] = l
+
+ print 'dict value now is '
+ print keytoepsgcodes
+ print 'dict printed'
+
+ print 'final dict'
+ print keytoepsgcodes
+ print 'final dcit printed'
+ return keytoepsgcodes
+
class Message():
pass
@@ -46,17 +97,19 @@
# begin wxGlade: wmsFrame.__init__
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
+ self.StatusBar = self.CreateStatusBar(1, 0)
self.URL = wx.StaticText(self, -1, "URL")
self.ServerList = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN|wx.CB_SIMPLE)
self.LayerTree = wx.TreeCtrl(self, -1, style=wx.TR_HAS_BUTTONS|wx.TR_NO_LINES|wx.TR_MULTIPLE|wx.TR_MULTIPLE|wx.TR_DEFAULT_STYLE|wx.SUNKEN_BORDER)
self.username = wx.StaticText(self, -1, "UserName")
self.usernameInput = wx.TextCtrl(self, -1, "", style=wx.TE_PROCESS_TAB)
+ self.EPSG = wx.StaticText(self, -1, "EPSG")
self.password = wx.StaticText(self, -1, "Password")
self.passwordInput = wx.TextCtrl(self, -1, "", style=wx.TE_PROCESS_TAB|wx.TE_PASSWORD)
+ self.epsgList = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN|wx.CB_SIMPLE|wx.CB_DROPDOWN)
self.GetCapabilities = wx.Button(self, -1, "GetCapabilities")
self.GetMaps = wx.Button(self, -1, "GetMaps")
self.addServer = wx.Button(self, -1, "Manage Servers")
- self.StatusBar = self.CreateStatusBar(1, 0)
self.__set_properties()
self.__do_layout()
@@ -92,7 +145,7 @@
Publisher().subscribe(self.onUpdateServerListmessage, ("update.serverList"))
Publisher().subscribe(self.onUpdateMapListmessage, ("update.map_servernameTouid"))
-
+ self.keyToEPSGCodes = {}
self.Bind(wx.EVT_CLOSE, self.OnQuit)
self.AddServerisClosed = True
self.layerName = ""
@@ -104,14 +157,14 @@
def __set_properties(self):
# begin wxGlade: wmsFrame.__set_properties
self.SetTitle("wmsFrame")
- self.LayerTree.SetMinSize((400, 250))
- self.usernameInput.SetMinSize((189, 27))
- self.passwordInput.SetMinSize((189, 27))
self.StatusBar.SetStatusWidths([-1])
# statusbar fields
StatusBar_fields = ["StatusBar"]
for i in range(len(StatusBar_fields)):
self.StatusBar.SetStatusText(StatusBar_fields[i], i)
+ self.LayerTree.SetMinSize((400, 250))
+ self.usernameInput.SetMinSize((189, 27))
+ self.passwordInput.SetMinSize((189, 27))
# end wxGlade
def __do_layout(self):
@@ -119,7 +172,7 @@
sizer_1 = wx.BoxSizer(wx.VERTICAL)
sizer_2 = wx.BoxSizer(wx.VERTICAL)
sizer_4 = wx.BoxSizer(wx.HORIZONTAL)
- grid_sizer_1 = wx.FlexGridSizer(2, 2, 1, 1)
+ grid_sizer_1 = wx.FlexGridSizer(2, 3, 1, 1)
sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
sizer_3.Add(self.URL, 0, 0, 0)
sizer_3.Add(self.ServerList, 0, 0, 0)
@@ -127,8 +180,10 @@
sizer_2.Add(self.LayerTree, 1, wx.EXPAND, 0)
grid_sizer_1.Add(self.username, 0, 0, 0)
grid_sizer_1.Add(self.usernameInput, 0, 0, 0)
+ grid_sizer_1.Add(self.EPSG, 0, 0, 0)
grid_sizer_1.Add(self.password, 0, 0, 0)
grid_sizer_1.Add(self.passwordInput, 0, 0, 0)
+ grid_sizer_1.Add(self.epsgList, 0, 0, 0)
sizer_2.Add(grid_sizer_1, 0, wx.EXPAND, 0)
sizer_4.Add(self.GetCapabilities, 0, 0, 0)
sizer_4.Add(self.GetMaps, 0, 0, 0)
@@ -139,43 +194,18 @@
sizer_1.Fit(self)
self.Layout()
# end wxGlade
- def __update_Url_List(self, ComboBox):
- ComboBox.Clear()
- for key, value in self.servers.items():
- #string = '{0}{1}{2}'.format(value.servername,self.name_url_delimiter,value.url[0:self.urlLength])
- #ComboBox.Append(string)
- ComboBox.Append(value.servername+self.name_url_delimiter+value.url[0:self.urlLength])
- #ComboBox.Append(value.servername+" "+self.name_url_delimiter+" "+value.url)
- #print self.servers
- return
-
-
-
-
- def __populate_Url_List(self, ComboBox):
- self.servers, self.map_servernameTouid = getAllRows(self.soup)
- for key, value in self.servers.items():
- #string = '{0}{1}{2}'.format(value.servername,self.name_url_delimiter,value.url[0:self.urlLength])
- #ComboBox.Append(string)
- ComboBox.Append(value.servername+self.name_url_delimiter+value.url[0:self.urlLength])
- #ComboBox.Append(value.servername+" "+self.name_url_delimiter+" "+value.url)
- #print self.servers
- return
-
- '''f = open('serverList.txt','r')
- lines = f.readlines()
- self.servers = {}
- for line in lines:
- row = line.split()
- print row
- if(len(row) == 4) :
- self.servers[row[0]] = row[1]
- name = row[0]+" "+row[1][7:45]
- ComboBox.Append(name)
- f.close()'''
- def OnGetCapabilities(self, event): # wxGlade: wmsFrame.<event_handler>
+ def OnGetCapabilities(self, event): # wxGlade: wmsFrame.<event_handler>
+ ''''f=open('check.xml','r')
+ xml=f.read()
+ f.close()
+ layerDataDict = parsexml2(xml)
+ ld = LayerData()
+ #ld.printLayerData(layerDataDict)
+ ld.appendLayerTree(layerDataDict, self.LayerTree, self.layerTreeRoot)
+ self.LayerTree.Expand(self.layerTreeRoot)
+ return'''
if(self.selectedURL == "No server selected"):
message = 'No Server selected'
self.ShowMessage(message, 'Warning')
@@ -221,8 +251,18 @@
#xml=f.read()
#f.close()
#self.statusbar.SetStatusText(xml)
- reslist = parsexml(xml)
- populateLayerTree(xml,self.LayerTree, self.layerTreeRoot)
+ #reslist = parsexml(xml)
+ #populateLayerTree(xml,self.LayerTree, self.layerTreeRoot)
+ print 'check1'
+ layerDataDict = parsexml2(xml)
+ print 'check2'
+ ld = LayerData()
+ print 'check3'
+ #ld.printLayerData(layerDataDict)
+ ld.appendLayerTree(layerDataDict, self.LayerTree, self.layerTreeRoot)
+ self.keyToEPSGCodes = ld.setKeyToEPSGCodes(layerDataDict)
+ print self.keyToEPSGCodes
+ print 'check4'
#for res in reslist:
# self.LayerTree.AppendItem(self.layerTreeRoot, res)
#self.Layers.SetValue(st)
@@ -386,16 +426,16 @@
#Sudeep's Code Ends
event.Skip()
'''
- def printDict(self,dict):
- for key in dict.keys():
- print "the key name is" + key + "and its value is"
+
def OnServerList(self, event): # wxGlade: wmsFrame.<event_handler>
print "Event handler `OnServerList' not implemented"
#Sudeep's Code Starts
print self.ServerList.CurrentSelection
- url = self.ServerList.GetValue()
- urlarr = url.split(self.name_url_delimiter)
+ info = self.ServerList.GetValue()
+ if(len(info) == 0):
+ return
+ urlarr = info.split(self.name_url_delimiter)
print "OnServerList:printing urlarr"
print urlarr
print urlarr[0]
@@ -431,23 +471,57 @@
#self.layerName = self.LayerTree.GetItemText(event.GetItem())
#print "Event handler `OnLayerTreeSelChanged' not implemented"
self.selectedLayerList = []
+ keys =[]
self.layerName = ""
print "Selected layers:"
for sellayer in self.LayerTree.GetSelections():
- layerName = self.LayerTree.GetItemText(sellayer)
+ layerNameString = self.LayerTree.GetItemText(sellayer)
+ print 'here'
+ print layerNameString
+ layerNameStringList = layerNameString.split(':')
+ print layerNameStringList
+ print len(layerNameStringList)
+ if(len(layerNameStringList)==0):
+ message = 'Unable to select layers'
+ self.ShowMessage(message, 'Warning')
+ grass.warning(message)
+ StatusBar_fields = [message]
+ self.StatusBar.SetStatusText(StatusBar_fields[0], 0)
+ return
+ layerName = layerNameStringList[0].split('-')[1]
+ key = layerNameStringList[0].split('-')[0]
+ print layerName
+ print 'done'
self.selectedLayerList += [layerName]
self.layerName += ","+layerName
-
+ keys += [key]
+
+
self.layerName = self.layerName[1:]
print self.layerName
+ self.epsgList.Clear()
+ print self.keyToEPSGCodes
+ for key in keys:
+ lEPSG = self.keyToEPSGCodes[key]
+ self.epsgList.AppendItems(lEPSG)
+
#print "Event handler `OnLayerTreeSelChanged' not implemented"
event.Skip()
+
+ def OnAddServer(self, event): # wxGlade: wmsFrame.<event_handler>
+ print 'before add server call'
+ self.AddServerisClosed = False
+ self.addServer.Disable()
+ AddServerFrame(self)
+ #print 'after add server call'
+ #print "Event handler `OnAddServer' not implemented"
+ #event.Skip()
+ return
+
def onAddServerFrameClose(self, msg):
self.AddServerisClosed = True
self.addServer.Enable()
- self.servers = msg.data
- self.__update_Url_List(self.ServerList)
#frame = self.GetParent()
#frame.Show()
@@ -468,16 +542,6 @@
self.printDict(self.map_servernameTouid)
#patch5e
- def OnAddServer(self, event): # wxGlade: wmsFrame.<event_handler>
- print 'before add server call'
- self.AddServerisClosed = False
- self.addServer.Disable()
- AddServerFrame(self)
- #print 'after add server call'
- #print "Event handler `OnAddServer' not implemented"
- #event.Skip()
- return
-
def OnQuit(self, event):
msg = ""
print 'in quit'
@@ -489,6 +553,46 @@
def ShowMessage(self, message, type = 'Warning'):
wx.MessageBox(message, type)
+ def __update_Url_List(self, ComboBox):
+ ComboBox.Clear()
+ ComboBox.Append("")
+ for key, value in self.servers.items():
+ #string = '{0}{1}{2}'.format(value.servername,self.name_url_delimiter,value.url[0:self.urlLength])
+ #ComboBox.Append(string)
+ ComboBox.Append(value.servername+self.name_url_delimiter+value.url[0:self.urlLength])
+ #ComboBox.Append(value.servername+" "+self.name_url_delimiter+" "+value.url)
+ #print self.servers
+ return
+
+ def __populate_Url_List(self, ComboBox):
+ self.servers, self.map_servernameTouid = getAllRows(self.soup)
+ ComboBox.Append("")
+ for key, value in self.servers.items():
+ #string = '{0}{1}{2}'.format(value.servername,self.name_url_delimiter,value.url[0:self.urlLength])
+ #ComboBox.Append(string)
+ ComboBox.Append(value.servername+self.name_url_delimiter+value.url[0:self.urlLength])
+ #ComboBox.Append(value.servername+" "+self.name_url_delimiter+" "+value.url)
+ #print self.servers
+ return
+
+
+ '''f = open('serverList.txt','r')
+ lines = f.readlines()
+ self.servers = {}
+ for line in lines:
+ row = line.split()
+ print row
+ if(len(row) == 4) :
+ self.servers[row[0]] = row[1]
+ name = row[0]+" "+row[1][7:45]
+ ComboBox.Append(name)
+ f.close()'''
+
+ def printDict(self,dict):
+ for key in dict.keys():
+ print "the key name is" + key + "and its value is"
+
+
# end of class wmsFrame
#Sudeep's Code Starts
More information about the grass-commit
mailing list