def finished(self):
        CONF.train_conf["l_data_path"] = self.l_data_path_te.text()
        CONF.train_conf["l_save_path"] = self.l_save_path_te.text()
        if self.model_sel_h.isChecked():
            CONF.train_conf["model_sel"] = 1
        elif self.model_sel_m.isChecked():
            CONF.train_conf["model_sel"] = 2
        else:
            CONF.train_conf["model_sel"] = 3
        if self.dev_sel_c.isChecked():
            CONF.train_conf["gpu"] = False
        else:
            CONF.train_conf["gpu"] = True
        CONF.train_conf["gpu_dev"] = [int(dev) for dev in self.dev_value.text().split(',')]

        CONF.train_conf["remote"] = self.remote_sel.isChecked()
        CONF.train_conf["r_ip"] = self.ip_value.text()
        CONF.train_conf["r_port"] = int(self.port_value.text())
        CONF.train_conf["r_data_path"] = self.r_data_path.text()
        CONF.train_conf["r_pro_path"] = self.r_pro_path.text()

        CONF.train_conf["senior"] = self.senior_sel.isChecked()
        CONF.train_conf["s_lr"] = float(self.lr_value.text())
        CONF.train_conf["s_iter"] = int(self.iter_value.text())
        CONF.train_conf["s_batch"] = int(self.batch_size.text())
        CONF.train_conf["s_refresh"] = int(self.refresh_time.currentText())
        CONF.save()
        self.accept()
Exemplo n.º 2
0
    def POST(self):
        originParams = web.input()
        options = (("dbname", "string", "1-50"), )

        if not os.path.exists("log"):
            os.mkdir("log")
        if not os.path.exists(os.path.join("static", "attachment")):
            os.mkdir(os.path.join("static", "attachment"))
        if not os.path.exists(os.path.join("static", "tmp")):
            os.mkdir(os.path.join("static", "tmp"))
        if not os.path.exists("data"):
            os.mkdir("data")
        if not os.path.exists(os.path.join("data", "database")):
            os.mkdir(os.path.join("data", "database"))

        try:
            params = formatParam(originParams, options)
        except ParamError as error:
            raise web.internalerror("Parameter error, {0}.".format(error))

        try:
            CONF.db.name = str(params.dbname)
        except WIPError as error:
            raise web.internalerror("Configure file parse error.")

        try:
            Database.create()
        except DBError as error:
            raise web.internalerror("Databae creating error," + str(error))

        CONF.isinstall = True
        CONF.save()

        return jsonSuccess()
Exemplo n.º 3
0
    def POST(self):
        originParams = web.input()

        options = (("nmappath", "string", "1-200"), )
        try:
            params = formatParam(originParams, options)
        except ParamError as error:
            raise web.internalerror("Parameter error, {0}.".format(error))

        CONF.nmap = None if str(params.nmappath) == "nmap" else str(
            params.nmappath)
        CONF.save()

        return jsonSuccess()
Exemplo n.º 4
0
    def POST(self):
        originParams = web.input()

        options = (
            ("nmappath","string","1-200"),
        )
        try:
            params = formatParam(originParams, options)
        except ParamError as error:
            raise web.internalerror("Parameter error, {0}.".format(error))

        CONF.nmap = None if str(params.nmappath)=="nmap" else str(params.nmappath)
        CONF.save()

        return jsonSuccess()
Exemplo n.º 5
0
    def POST(self):
        web.header('Content-Type', 'application/json')
        originParams = web.input()

        options = (("database", "string", "1-50"), )
        try:
            params = formatParam(originParams, options)
        except ParamError as error:
            raise web.internalerror("Parameter error, {0}.".format(error))

        oldDB = CONF.db.name
        CONF.db.name = str(params.database)
        dblist = os.listdir(os.path.join("data", "database"))
        if params.database not in dblist:
            try:
                Database.create()
            except DBError as error:
                CONF.db.name = oldDB
                raise web.internalerror("Databae creating error," + str(error))
        CONF.save()

        return jsonSuccess()
Exemplo n.º 6
0
    def POST(self):
        originParams = web.input()
        options = (
            ("dbname","string","1-50"),
        )

        if not os.path.exists("log"):
            os.mkdir("log")
        if not os.path.exists(os.path.join("static","attachment")):
            os.mkdir(os.path.join("static","attachment"))
        if not os.path.exists(os.path.join("static","tmp")):
            os.mkdir(os.path.join("static","tmp"))
        if not os.path.exists("data"):
            os.mkdir("data")
        if not os.path.exists(os.path.join("data","database")):
            os.mkdir(os.path.join("data","database"))

        try:
            params = formatParam(originParams, options)
        except ParamError as error:
            raise web.internalerror("Parameter error, {0}.".format(error))

        try:
            CONF.db.name = str(params.dbname)
        except WIPError as error:
            raise web.internalerror("Configure file parse error.")

        try:
            Database.create()
        except DBError as error:
            raise web.internalerror("Databae creating error,"+str(error))

        CONF.isinstall = True
        CONF.save()

        return jsonSuccess()
Exemplo n.º 7
0
    def POST(self):
        web.header('Content-Type', 'application/json')
        originParams = web.input()

        options = (
            ("database","string","1-50"),
        )
        try:
            params = formatParam(originParams, options)
        except ParamError as error:
            raise web.internalerror("Parameter error, {0}.".format(error))

        oldDB = CONF.db.name
        CONF.db.name = str(params.database)
        dblist = os.listdir(os.path.join("data","database"))
        if params.database not in dblist:
            try:
                Database.create()
            except DBError as error:
                CONF.db.name = oldDB
                raise web.internalerror("Databae creating error,"+str(error))
        CONF.save()

        return jsonSuccess()
Exemplo n.º 8
0
 def finished(self):
     CONF.anno_conf["img_path"] = self.img_path_te.text()
     CONF.anno_conf["save_path"] = self.save_path_te.text()
     CONF.anno_conf["labels"] = self.label_list_te.toPlainText()
     CONF.save()
     self.accept()