示例#1
0
    def __init__(self, *args, **kwds):
        # begin wxGlade: ServerAdd.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.StatusBar = self.CreateStatusBar(1, 0)
        self.Servers = wx.StaticText(self, -1, "  Servers")
        self.ServerList = wx.ComboBox(self,
                                      -1,
                                      choices=[],
                                      style=wx.CB_DROPDOWN)
        self.static_line_1 = wx.StaticLine(self, -1)
        self.ServerName = wx.StaticText(self, -1, "  ServerName*")
        self.ServerNameText = wx.TextCtrl(self, -1, "")
        self.URL = wx.StaticText(self, -1, "  URL*")
        self.URLText = wx.TextCtrl(self, -1, "")
        self.Username = wx.StaticText(self, -1, "  Username")
        self.UsernameText = wx.TextCtrl(self, -1, "")
        self.Password = wx.StaticText(self, -1, "  Password")
        self.PasswordText = wx.TextCtrl(self, -1, "", style=wx.TE_PASSWORD)
        self.PasswordExplain = wx.StaticText(
            self, -1, "  Note: Password will be stored as a plain text")
        self.static_line_2 = wx.StaticLine(self, -1)
        self.Save = wx.Button(self, -1, "Save")
        self.Remove = wx.Button(self, -1, "Remove")
        self.AddNew = wx.Button(self, -1, "AddNew")
        self.Quit = wx.Button(self, -1, "Quit")

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_COMBOBOX, self.OnServerList, self.ServerList)
        self.Bind(wx.EVT_TEXT, self.OnText, self.ServerNameText)
        self.Bind(wx.EVT_TEXT, self.OnText, self.URLText)
        self.Bind(wx.EVT_TEXT, self.OnText, self.UsernameText)
        self.Bind(wx.EVT_TEXT, self.OnText, self.PasswordText)
        self.Bind(wx.EVT_BUTTON, self.OnSave, self.Save)
        self.Bind(wx.EVT_BUTTON, self.OnRemove, self.Remove)
        self.Bind(wx.EVT_BUTTON, self.OnAddNew, self.AddNew)
        self.Bind(wx.EVT_BUTTON, self.OnQuit, self.Quit)
        # end wxGlade

        #sudeep code starts
        if not loadConfigFile(self):
            grass.fatal_error(
                _('Configuration file error. Unable to start application.'))
            self.Close()

        self.soup, open = initServerInfoBase('ServersList.xml')
        if not open:
            return
        self.Bind(wx.EVT_CLOSE, self.OnQuit)
        self.__populate_URL_List(self.ServerList)
        Publisher().subscribe(self.OnWMSMenuClose, ("WMS_Menu_Close"))
        self.editOn = False
        self.selectedUid = None
        self.selectedServer = None
示例#2
0
    def __init__(self, *args, **kwds):
        # 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.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_TEXT_ENTER, self.OnServerListEnter, self.ServerList)
        self.Bind(wx.EVT_COMBOBOX, self.OnServerList, self.ServerList)
        self.Bind(wx.EVT_COMBOBOX, self.OnEPSGList, self.epsgList)
        self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnLayerTreeSelChanged,
                  self.LayerTree)
        self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnLayerTreeActivated,
                  self.LayerTree)
        self.Bind(wx.EVT_BUTTON, self.OnGetCapabilities, self.GetCapabilities)
        self.Bind(wx.EVT_BUTTON, self.OnGetMaps, self.GetMaps)
        self.Bind(wx.EVT_BUTTON, self.OnAddServer, self.addServer)
        # end wxGlade

        self.usernameInput.Disable()
        self.passwordInput.Disable()
        if not loadConfigFile(self):
            grass.fatal_error(
                "Config File Error, Unable to start application...")
            self.Close()
            return

        self.soup, open = initServerInfoBase("ServersList.xml")
        if not open:
            self.Close()
            return
        self.__populate_Url_List(self.ServerList)
        self.selectedURL = "No server selected"
        self.layerTreeRoot = self.LayerTree.AddRoot("Layers")
        Publisher().subscribe(self.onAddServerFrameClose,
                              ("Add_Server_Frame_Closed"))
        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 = ""
        self.layerDataDict1 = {}
        self.selectedEPSG = None