Logo Search packages:      
Sourcecode: nagstamon version File versions  Download package

def Nagstamon::nagstamonGUI::EditServer::OK (   self,
  widget 
)

    settings dialog got OK-ed

Definition at line 2058 of file nagstamonGUI.py.

02058                         :
        """
            settings dialog got OK-ed
        """
        # put changed data into new server, which will get into the servers dictionary after the old
        # one has been deleted
        new_server = nagstamonConfig.Server()
        
        for i in ["input_entry_", "input_checkbutton_", "input_radiobutton_", "input_spinbutton_", "input_filechooser_"]:
            for j in self.glade.get_widget_prefix(i):
                # some hazard, every widget has other methods to get its content
                # so we try them all, one of them should work
                try:
                    new_server.__dict__[j.get_name().split(i)[1]] = j.get_text()
                except:
                    pass
                try:
                    new_server.__dict__[j.get_name().split(i)[1]] = j.get_active()
                except:
                    pass
                try:
                    new_server.__dict__[j.get_name().split(i)[1]] = int(j.get_value())
                except:
                    pass
        
        # check if there is already a server named like the new one
        if new_server.name in self.conf.servers and new_server.name != self.server:
            self.output.ErrorDialog("A server named " + new_server.name + " already exists.")
        else:
            # delete old server configuration entry
            self.conf.servers.pop(self.server)
            try:
                # stop thread
                self.servers[self.server].thread.Stop()
            except:
                pass
            # delete server from servers dictionary
            self.servers.pop(self.server)
    
            # put in new one
            self.conf.servers[new_server.name] = new_server
            # create new server thread
            self.servers[new_server.name] = nagstamonActions.CreateServer(new_server, self.conf)
            
            if str(self.conf.servers[new_server.name].enabled) == "True":  
                # start new thread (should go to nagstamonActions)
                self.servers[new_server.name].thread = nagstamonActions.RefreshLoopOneServer(server=self.servers[new_server.name], output=self.output, conf=self.conf)
                self.servers[new_server.name].thread.start()   
            
            # fill settings dialog treeview
            self.settingsdialog.FillTreeView()
            # destroy dialog
            self.dialog.destroy()
            
      
    def Cancel(self, widget):


Generated by  Doxygen 1.6.0   Back to index