[GRASS-SVN] r47455 - grass-addons/grass7/gui/wxpython/wx.wms

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Aug 4 16:08:31 EDT 2011


Author: sudeepsingh
Date: 2011-08-04 13:08:31 -0700 (Thu, 04 Aug 2011)
New Revision: 47455

Removed:
   grass-addons/grass7/gui/wxpython/wx.wms/map.png
Modified:
   grass-addons/grass7/gui/wxpython/wx.wms/ServersList.xml
   grass-addons/grass7/gui/wxpython/wx.wms/TODO
   grass-addons/grass7/gui/wxpython/wx.wms/addserver.py
   grass-addons/grass7/gui/wxpython/wx.wms/wmsmenu.py
Log:
Closing of add server bug fixed, TODO file updated

Modified: grass-addons/grass7/gui/wxpython/wx.wms/ServersList.xml
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.wms/ServersList.xml	2011-08-04 20:06:40 UTC (rev 47454)
+++ grass-addons/grass7/gui/wxpython/wx.wms/ServersList.xml	2011-08-04 20:08:31 UTC (rev 47455)
@@ -1,78 +1,68 @@
 <serverinfo>
- <server id="cd">
+ <server id="123">
   <servername>
-   cd
+   123
   </servername>
   <serverurl>
-   cswd
+   123
   </serverurl>
   <username>
+   123
   </username>
   <password>
+   123
   </password>
  </server>
- <server id="āšņ ēčžģ1">
+ <server id="asd">
   <servername>
-   āšņ ēčžģ1
+   asd
   </servername>
   <serverurl>
-   12
+   asd
   </serverurl>
   <username>
+   asd
   </username>
   <password>
+   asd
   </password>
  </server>
- <server id="ڝڍڑڭڏڧڲ">
+ <server id="āšņ ēčžģ12">
   <servername>
-   ڝڍڑڭڏڧڲ
+   āšņ ēčžģ12
   </servername>
   <serverurl>
-   asdasd
+   asd12
   </serverurl>
   <username>
   </username>
   <password>
   </password>
  </server>
- <server id="āšņ ēčžģ">
+ <server id="ڝڍڑڭڏڧڲ">
   <servername>
-   āšņ ēčžģ
+   ڝڍڑڭڏڧڲ
   </servername>
   <serverurl>
-   asd
+   asdasd
   </serverurl>
   <username>
   </username>
   <password>
   </password>
  </server>
- <server id="qw">
+ <server id="āšņ ēčžģ">
   <servername>
-   qw
+   āšņ ēčžģ
   </servername>
   <serverurl>
-   qw1
+   asd
   </serverurl>
   <username>
   </username>
   <password>
   </password>
  </server>
- <server id="a3">
-  <servername>
-   a3
-  </servername>
-  <serverurl>
-   b3
-  </serverurl>
-  <username>
-   c3
-  </username>
-  <password>
-   d3
-  </password>
- </server>
  <server id="GISNetServer">
   <servername>
    GISNetServer
@@ -87,18 +77,4 @@
    password
   </password>
  </server>
- <server id="a2">
-  <servername>
-   a2
-  </servername>
-  <serverurl>
-   b2
-  </serverurl>
-  <username>
-   c2
-  </username>
-  <password>
-   d2
-  </password>
- </server>
 </serverinfo>

Modified: grass-addons/grass7/gui/wxpython/wx.wms/TODO
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.wms/TODO	2011-08-04 20:06:40 UTC (rev 47454)
+++ grass-addons/grass7/gui/wxpython/wx.wms/TODO	2011-08-04 20:08:31 UTC (rev 47455)
@@ -4,8 +4,23 @@
 ڝڍڑڭڏڧڲڝڍڑڭڏڧڲ
 Arabic String or any right indented string doesnt work quite well with the current version. 
 
-2.On closing add server window, main window also closes. To be fixed. 
+2.Resizing not being done properly
 
 3.Coding Standards of wxgui programming not followed exactly till now. Code to be modified soon for that. 
+
+4.UserName Password not checked if they are required by a particular server or not, currently hard coded. 
+
+5.Layers fetched are not being displayed hierarchly, bug known, to be fixed. 
+
+
 More to be added...
 
+
+
+
+
+Things done
+
+1.[Fixed]Username checked for delimeter presence
+2.[Fixed]On closing add server window, main window also closes.
+3.[Fixed]In addserver.py when pressing the quit button or closing it, main wmsmenu window closes, and it gives an error of maximum recurssion depth reached error. 

Modified: grass-addons/grass7/gui/wxpython/wx.wms/addserver.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.wms/addserver.py	2011-08-04 20:06:40 UTC (rev 47454)
+++ grass-addons/grass7/gui/wxpython/wx.wms/addserver.py	2011-08-04 20:08:31 UTC (rev 47455)
@@ -3,6 +3,7 @@
 # generated by wxGlade 0.6.3 on Thu Jul 14 06:22:35 2011
 
 import wx
+from wx.lib.pubsub import Publisher
 from BeautifulSoup import BeautifulSoup, Tag, NavigableString, BeautifulStoneSoup
 from ServerInfoAPIs import addServerInfo, removeServerInfo, updateServerInfo, initServerInfoBase, getAllRows
 from LoadConfig import loadConfigFile
@@ -54,7 +55,7 @@
         if( not loadConfigFile(self)):
             print 'Config File Error, Unable to start application...'
             self.Close()
-
+        
         self.soup = initServerInfoBase('ServersList.xml')
         self.Bind(wx.EVT_CLOSE, self.OnQuit)
         self.__populate_URL_List(self.ServerList)
@@ -159,6 +160,10 @@
     def OnSave(self, event): # wxGlade: ServerAdd.<event_handler>
         #print "Event handler `OnSave' not implemented"
         newServerName = unicode(self.ServerNameText.GetValue())
+        if(newServerName.count(self.name_url_delimiter)>0):
+                print "Warning: UserName cannot consist of "+self.name_url_delimiter
+                print "Please give another username, save failed..."
+                return
         print newServerName
         print 'check12'
         if(self.servers.has_key(newServerName)):
@@ -186,17 +191,24 @@
             if(update):
                 if(updateServerInfo(self.soup, self.soup.serverinfo, newServerName, newUrl, newUserName, newPassword)):
                     print 'update save successful'
+                    self.saveXMLData()
+                    msg = self.servers
+                    Publisher().sendMessage(("update.serverList"), msg)
                 else:
                     print 'update save not successful'
             else:    
                 if(addServerInfo(self.soup, self.soup.serverinfo, newServerName, newUrl, newUserName, newPassword)):
                     print 'soup save successfully'
+                    self.saveXMLData()
+                    msg = self.servers
+                    Publisher().sendMessage(("update.serverList"), msg)
                 else:
                     print "False returned by addServerInfo, save not successful"
-            
+            '''
             f = open('serverList.txt','a')
             f.write(newServerName+" "+newUrl+ " "+newUserName+" "+newPassword+"\n")
             f.close()
+            '''
             self.selectedURL = newUrl
             print self.selectedURL
             print self.servers
@@ -221,6 +233,9 @@
             self.URLText.Clear()
             self.UsernameText.Clear()
             print self.servers
+            self.saveXMLData()
+            msg = self.servers
+            Publisher().sendMessage(("update.serverList"), msg)
         else:
             print 'No server selected'
         #print "Event handler `OnRemove' not implemented"
@@ -234,13 +249,21 @@
         self.URLText.Clear()
         self.UsernameText.Clear()
         event.Skip()
-
-    def OnQuit(self, event): # wxGlade: ServerAdd.<event_handler>
-        print 'onQuit pressed'
+        
+    def saveXMLData(self):
         xml = self.soup.prettify()
         f = open('ServersList.xml','w')
         f.write(xml)
         f.close()
+        
+    def OnQuit(self, event): # wxGlade: ServerAdd.<event_handler>
+        print 'onQuit pressed'
+        self.saveXMLData()
+        msg = self.servers
+        Publisher().sendMessage(("update.serverList"), msg)
+        self.Destroy()
+        #exit()
+        #self.Close()
         '''out = open('serverList.txt','w')
         for k,v in self.servers.iteritems():
             out.write(v.servername+" "+v.url+" "+v.username+" "+v.password+"\n")
@@ -268,12 +291,11 @@
             print "Wrong format of URL selected"
             
         #self.ServerNameText.SetValue(self.servers)
-        print "Event handler `OnServerList' not implemented"
         event.Skip()
 
 # end of class ServerAdd
 
-def AddServerFrame():
+def AddServerFrame(parentWMS):
     app = wx.PySimpleApp(0)
     wx.InitAllImageHandlers()
     frame_2 = ServerAdd(None, -1, "")

Deleted: grass-addons/grass7/gui/wxpython/wx.wms/map.png
===================================================================
(Binary files differ)

Modified: grass-addons/grass7/gui/wxpython/wx.wms/wmsmenu.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.wms/wmsmenu.py	2011-08-04 20:06:40 UTC (rev 47454)
+++ grass-addons/grass7/gui/wxpython/wx.wms/wmsmenu.py	2011-08-04 20:08:31 UTC (rev 47455)
@@ -4,6 +4,7 @@
 
 import wx
 from wxPython.wx import *
+from wx.lib.pubsub import Publisher
 from urllib2 import Request, urlopen, URLError, HTTPError
 from parse import parsexml, isServiceException, populateLayerTree
 from WMSMapDisplay import NewImageFrame
@@ -56,8 +57,8 @@
         self.__populate_Url_List(self.ServerList)
         self.selectedURL="No server selected"
         self.layerTreeRoot = self.LayerTree.AddRoot("Layers")
+        Publisher().subscribe(self.updateServerList, ("update.serverList"))
         
-        
         #items = ["a", "b", "c"]
         #itemId = self.LayerTree.AppendItem(self.layerTreeRoot, "item")
         #self.LayerTree.AppendItem(itemId, "inside")
@@ -95,9 +96,13 @@
         sizer_1.Fit(self)
         self.Layout()
         # end wxGlade
-    def update_Url_List(self, name):
-        ComboBox = self.ServerList
-        ComboBox.Append(name)
+    def __update_Url_List(self, ComboBox):
+        ComboBox.Clear()
+        for key, value in self.servers.items():
+            ComboBox.Append(value.servername+self.name_url_delimiter+value.url)
+            #ComboBox.Append(value.servername+" "+self.name_url_delimiter+" "+value.url)
+        print self.servers
+        return
         
    
 
@@ -280,11 +285,25 @@
         #print "Event handler `OnLayerTreeSelChanged' not implemented"
         event.Skip()
 
+    def updateServerList(self, msg):
+        """
+        Shows the frame and shows the message sent in the
+        text control
+        """
+        print 'yoyo'
+        self.servers = msg.data
+        self.__update_Url_List(self.ServerList)
+        print 'yoyo'
+        #frame = self.GetParent()
+        #frame.Show()
+        
     def OnAddServer(self, event): # wxGlade: wmsFrame.<event_handler>
-        AddServerFrame()
+        print 'before add server call'
+        AddServerFrame(self)
+        #print 'after add server call'
         #print "Event handler `OnAddServer' not implemented"
-        event.Skip()
-
+        #event.Skip()
+        return 
 # end of class wmsFrame
 
 #Sudeep's Code Starts



More information about the grass-commit mailing list