Esempio n. 1
0
def main():

	from class_macro import Macros
	from widget_plugins import WidgetPlugins
	from widget_macro import WidgetMacros
	from class_plugins import Plugins

	plugin_id = request.shared_variables["plugin_id"]
	plugin = Plugins.get_by_id(plugin_id)

	macros = Macros()
	macros.name 		= "config"
	macros.class_name	= ""
	macros.timer_guid 	= ""
	macros.is_button_macros = "1"
	macros.on_board 	= "1"
	macros.description 	= "config macro"
	macros.plugin_guid = plugin.guid
	macros.save()

	plugin = Plugins.get_by_id(plugin_id)
	macros = plugin.get_macros()

	widget_macros = WidgetMacros()
	widget_macros.set_data(macros)
	widget_macros.render(self.datatable_macros)

	self.button_create_config.visible = "0"
	self.button_config.visible = "1"
Esempio n. 2
0
                    macros = Macros()
                    macros.name = child.name
                    macros.code = child.source
                    macros.class_name = child.class_name
                    macros.is_button_macros = child.is_button
                    macros.on_board = child.on_board

                    picture_name = ""
                    macros.macros_picture = ""
                    if child.macros_picture:
                        macros.macros_picture = picture_name = str(uuid4())
                        application.storage.write(
                            picture_name,
                            base64.b64decode(child.macros_picture))

                    macros.save()
                else:
                    self.growl.title = lang["error"]
                    self.growl.text = lang["xml_not_correctr_error"]
                    self.growl.visible = "1"

    if "op" in request.arguments and request.arguments.get("op") == "export":
        plugin = Plugins.get_by_id(session.get("plugin_id", ""))
        output = plugin.export()
        output_len = output.tell()
        output.seek(0)
        response.send_file(
            plugin.name.encode('utf8') + ".xml", output_len, output)

    if "formtext_pluginid" in request.arguments:
        args = request.arguments