Пример #1
0
    def OnButton_xmlUserButton(self, evt):
        '''xml 用户数据库处理'''
        wildcard = "xml (*.xml)|*.xml"

        try:
            Dir=unicode(os.getcwd(), self.textencoding)
        except:
            Dir=os.getcwd()

        dlg = wx.FileDialog(
            self, message="Choose a xml file",
            defaultDir=Dir, 
            defaultFile="",
            wildcard=wildcard,
            style=wx.OPEN
            )
        
        if dlg.ShowModal() == wx.ID_OK:
            path = dlg.GetPath()
            self.mainStatusBar.SetLabel(path)
            self.userControlPanelString=path    
        dlg.Destroy()  
        
        self.users=xmlUserControl(self.userControlPanelString)
        if self.users.userDataInit()== userControlErrValue["OK"]:
            self.Config.setContrlMedia("xml")  
            self.Config.setControlMediaPath(self.userControlPanelString)
            self.Config.saveServerConfig()
        else:
            uiDebug("serverManager userDataInit error")
            
        uiDebug("serverManager OnButton_xmlUserButton()")
Пример #2
0
    def readConfig(self,file):
        '''读取服务器端配置文件'''
        self.Config=serverConfig(file)
        self.ControlMedia=self.Config.getControlMedia() 
        self.ControlMediaPath=self.Config.getControlMediaPath()        
        self.language=self.Config.getLanguage()
        self.userControlPanelString=self.ControlMediaPath
        
        #界面多语处理
        if self.language=="Chinese":
            self.updateLanguage(wx.LANGUAGE_CHINESE_SIMPLIFIED)
            self.setString()
            self.languageComboBox.SetSelection(0)
        elif self.language=="English":
            self.updateLanguage(wx.LANGUAGE_ENGLISH)
            self.setString()
            self.languageComboBox.SetSelection(1)
        else:
            self.updateLanguage(wx.LANGUAGE_CHINESE_SIMPLIFIED)
            self.setString()
            self.languageComboBox.SetSelection(0)
        
        #服务器配置
        if self.ControlMedia == mediaValue["txt"]:
            #txt文件保留用户信息
            self.textUserRadioButton.SetValue(True)
            self.mysqlUserButton.Disable()
            self.textUserButton.Enable()
            self.xmlUserButton.Disable()
            self.users=txtUserControl(self.ControlMediaPath)
            
        elif self.ControlMedia == mediaValue["xml"]:
            #xml文件保留用户信息
            self.xmlUserRadioButton.SetValue(True)
            self.mysqlUserButton.Disable()
            self.textUserButton.Disable()
            self.xmlUserButton.Enable()
            self.users=xmlUserControl(self.ControlMediaPath)
            
        elif self.ControlMedia == mediaValue["mysql"]:
            #mysql数据库保留用户信息   
            self.mysqlUserRadioButton.SetValue(True)    
            self.mysqlUserButton.Enable()
            self.textUserButton.Disable()
            self.xmlUserButton.Disable()

        #设置状态栏
        self.mainStatusBar.SetLabel(self.ControlMediaPath)
        try:     
            self.users.userDataInit()
        except:
            self.users=None
            self.mainStatusBar.SetLabel("")
            self.userControlPanelString=""