コード例 #1
0
    def _fillTable(self):
        self._createTableView()
        self.icepap_values = self._manager.getDriverConfiguration(self._driver.icepapsystem_name, self._driver.addr)
        row = 0
        current = False

        for row in range(self.ui.tableWidget.rowCount()):
            name = unicode(self.ui.tableWidget.item(row,0).text())

            if name == "NAME":
                name = unicode("IPAPNAME")

            stored_value = self._driver.current_cfg.getParameter(name, True)
            if stored_value is None:
                stored_value = ""
            
            icepap_value = self.icepap_values.getParameter(name, True)
            if icepap_value is None:
                icepap_value = ""
            color = stored_value != icepap_value
                               
            self._addItemToTable(row, 1, stored_value, color)
            self._addItemToTable(row, 2, icepap_value, color)
        

        if current:
            MessageDialogs.showWarningMessage(self, "Driver conflict", "Warning!!\nCurrent values (IN, IB, II) have changed!!\n")
コード例 #2
0
 def btnTest_on_click(self):
     serial = self.ui.rbSerial.isChecked()
     dst = str(self.ui.txtHost.text())
     if serial:
         dst = self.ui.cbSerial.currentText()
     if self._ipapctrl.testConnection(serial, dst):
         self.addToLog("Connection OK")
     else:
         self.addToLog("Connection error")
         MessageDialogs.showWarningMessage(self, "Connection error",
                                           "Icepap not reachable.")
コード例 #3
0
 def saveButton_on_click(self):
     name = unicode(self.ui.txtName.text())
     desc = unicode(self.ui.txtDescription.toPlainText())
     if name == "" or not self.selectedCfg:
         MessageDialogs.showWarningMessage(self,
                                           "Store historic configuration",
                                           "Fill all required data.")
         return
     #now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
     if MessageDialogs.showYesNoMessage(self,
                                        "Store historic configuration",
                                        "Save configuration information?"):
         self.selectedCfg[1].name = name
         self.selectedCfg[1].description = desc
コード例 #4
0
 def saveButton_on_click(self):
     name = str(self.ui.txtName.text())
     desc = str(self.ui.txtDescription.toPlainText())
     if name == "":
         MessageDialogs.showWarningMessage(self, "Driver template",
                                           "Fill all required data.")
     else:
         if self._templateList.has_key(name):
             MessageDialogs.showWarningMessage(
                 self, "Driver template", "Choose another template name.")
         elif MessageDialogs.showYesNoMessage(
                 self, "Store template configuration",
                 "Save current configuration ?"):
             self._manager.saveDriverTemplate(name, desc,
                                              self._driver.currentCfg)
             self.close()
コード例 #5
0
 def deleteButton_on_click(self):
     if MessageDialogs.showYesNoMessage(self, "Historic configuration",
                                        "Delete selected configuration ?"):
         self.icepap_driver.deleteHistoricCfg(self.selectedCfg[1])
         self.fillData(self.icepap_driver)
     self.ui.txtName.setText("")
     self.ui.txtDescription.clear()
     self.ui.deleteButton.setEnabled(False)
コード例 #6
0
 def closeButton_on_click(self):
     if not os.path.exists(self._config.config_filename):
         if os.access(self._config.base_folder, os.W_OK):
             print "Creating new config file..."
             open(self._config.config_filename, 'a').close()
     if os.access(self._config.config_filename, os.W_OK):
         if self.checkPreferences():
             self._config.saveConfig()
             self.close()
         else:
             MessageDialogs.showWarningMessage(
                 self, "Preferences", "Check configuration parameters")
     else:
         MessageDialogs.showWarningMessage(
             self, "Preferences",
             "You must run IcePAPCMS as superuser to change the configuration parameters, or use a local config file."
         )
コード例 #7
0
 def deleteButton_on_click(self):
     if MessageDialogs.showYesNoMessage(self, "Historic configuration",
                                        "Delete selected configuration ?"):
         self._manager.deleteDriverTemplate(self.templatename)
     self.ui.txtName.setText("")
     self.ui.txtDescription.clear()
     self._fillTable()
     self.selecteddate = ""
     for row in range(self.ui.tableWidgetCfg.rowCount()):
         self.ui.tableWidgetCfg.item(row, 1).setText("")
     self.ui.loadButton.setEnabled(False)
     self.ui.deleteButton.setEnabled(False)
コード例 #8
0
ファイル: ipapconsole.py プロジェクト: guifrecuni/IcepapCMS
    def btnConnect_on_click(self):
        try:
            addr = str(self.ui.txtHost.text())
            if addr == '':
                MessageDialogs.showErrorMessage(
                    None, 'Host connection',
                    'Please, write a host name to connect to.')
                return
            if addr.find(":") >= 0:
                aux = addr.split(':')
                host = aux[0]
                port = aux[1]
            else:
                host = addr
                port = "5000"

            if hasattr(self._config, '_options'):
                ipapcontroller = IcepapController()
                if not ipapcontroller.host_in_same_subnet(host):
                    MessageDialogs.showInformationMessage(
                        None, "Host connection",
                        "It is not allowed to connect to %s. (Check subnet)" %
                        host)
                    return
            else:
                # JUST RUNNING AS A STAND-ALONE
                pass
            self.prompt = str(host) + " > "
            log_folder = None
            if self.debug:
                log_folder = self.log_folder
            self.ipap = EthIcePAP(host, port, log_path=log_folder)
            self.ipap.connect()
            #try:
            #    rsp = self.ipap.sendWriteReadCommand("?_help")
            #    self.writeConsole(rsp)
            #except:
            #    MessageDialogs.showWarningMessage(None,"Command error", "The ?_help command is not supported at "+addr)
            self.ui.btnDisconnect.setDisabled(False)
            self.ui.btnConnect.setDisabled(True)
            self.ui.console.setDisabled(False)
            self.ui.console.setFocus()
            self.ui.console.clear()
            self.writeConsole("Connected to Icepap :  " + addr)
            self.ui.console.setPrompt(self.prompt)
            self.writePrompt()
        except Exception, e:
            MessageDialogs.showErrorMessage(
                None, "Connection error",
                "Error connecting to " + addr + "\n" + str(e))
コード例 #9
0
 def closeButton_on_click(self):
     if self.checkPreferences():
         self._config.saveConfig()
         self.close()
     else:
         MessageDialogs.showWarningMessage(self, "Preferences", "Check configuration parameters")