예제 #1
0
def get_settings_api():
    logger.info(f"API/{request.method} request to /settings/")
    if request.method == 'GET':
        return jsonify(settings.get())
    elif request.method == 'POST':
        user_settings = settings.get()
        res = request.get_json()
        user_settings.update(res)
        settings.update_settings_file(user_settings)

        loop_args = {
            "loop_delay_seconds":
            int(user_settings["loop_delay_seconds"]),
            "loop_variation_percentage":
            int(user_settings["loop_variation_percentage"])
        }
        scraper_runner.updateDelay(**loop_args)
        return jsonify(user_settings)
예제 #2
0
	def save_gpb(self):

		o=settings.new_gpb_root()
		topmessage=self.topLevelItem(0)
		buildgpb.Builder( o, topmessage )

		if not o.IsInitialized() : 
			msgBox = QMessageBox()
			msgBox.setText("The GPB Object tree is incomplete. This is a bug, The file can not be saved")
			msgBox._exec()
			return


		filename = QFileDialog.getSaveFileName(self, "save gpb file", self.filename)
		if not filename : return
		self.filename=filename

		
		f=open(filename,"w")
		f.write( text_format.MessageToString(o))
		f.close()

		settings.update_settings_file(loadfile=filename)
예제 #3
0
	def open_gpb(self):
		filename = QFileDialog.getOpenFileName(self, "open gpb file", self.filename, "GPB files (*.gpb);;All files (*.*)")
		if not filename: return
		self.loadfile(filename)
		settings.update_settings_file(loadfile=filename)