Example #1
0
 def submit_data(self, event):
     ret, frame = self.capture.read()
     if ret:
         self.timer.Stop()
         self.capture.release()
         self._db = DB()
         last_id = self._db.insertImage(self._front_img, self._back_img,
                                        self._side_img)
         rec_window = EditForm(self, 'Rec window', id=int(last_id[0]))
         rec_window.Show()
         self.Hide()
Example #2
0
def edit_command(command_id):
    form = EditForm()
    commands = mongo.db.commands
    cmd_to_update = mongo.db.commands.find_one({'_id': ObjectId(command_id)})
    distros = mongo.db.distros.find()
    if request.method == 'GET':
        return render_template('edit_command.html',
                               form=AddCommandForm(),
                               cmd_to_update=cmd_to_update,
                               distros=distros)
    else:
        if form.validate():
            if form.form_submit:
                commands.update({'_id': ObjectId(command_id)}, {
                    'app_name': form.form_name.data,
                    'app_distro': request.form.get('app_distro'),
                    'app_url': form.form_url.data,
                    'app_instruction': form.form_instruction.data,
                    'app_command': form.form_command.data
                })
                flash('Command updated', 'info')
                form = SimpleSearch()
                choices = [('', 'select distro')]
                for distro in mongo.db.distros.find():
                    choices.append((f"{distro['distro_name']}",
                                    f"{distro['distro_name']}"))
                form.search_distro.choices = choices
                return render_template('find_command.html',
                                       form=form,
                                       results=mongo.db.commands.find(
                                           {'_id': ObjectId(command_id)}),
                                       distros=mongo.db.distros.find(),
                                       commands=mongo.db.commands.find())
        else:
            flash("ReCAPTCHA missing!", "warning")
            return redirect(request.referrer)
Example #3
0
 def insertData(self, event):
     _id = event.GetEventObject().id
     rec_window = EditForm('Rec window', id=_id)
     rec_window.Show()