Attribute changed old-javascript
[app.Builder.js] / old-javascript / Builder4 / DialogSaveModule.bjs
diff --git a/old-javascript/Builder4/DialogSaveModule.bjs b/old-javascript/Builder4/DialogSaveModule.bjs
new file mode 100644 (file)
index 0000000..4a32f13
--- /dev/null
@@ -0,0 +1,56 @@
+{
+    "name" : "DialogSaveModule",
+    "parent" : "",
+    "title" : "",
+    "path" : "/home/alan/gitlive/app.Builder.js/Builder4/DialogSaveModule.bjs",
+    "permname" : "",
+    "modOrder" : "",
+    "items" : [
+        {
+            "listeners" : {
+                "delete_event" : " (self, event) => {\n    this.el.response(Gtk.ResponseType.CANCEL);\n    return true;\n}"
+            },
+            "default_width" : 400,
+            "# Project.Project project" : "",
+            "xtype" : "Dialog",
+            "default_height" : 200,
+            "$ modal" : true,
+            "# JsRender.Node data" : "",
+            "|   string show" : " (Gtk.Window parent, Project.Project project, JsRender.Node data) {\n \n     \n    this.el.set_transient_for(parent);\n    this.el.modal = true;\n    \n    this.data = data;\n    this.project = project;\n    this.name.el.set_text(\"\");\n    this.el.show_all();\n     var   name = \"\";\n    while (true) {\n        var response_id = this.el.run();\n        if (response_id < 1) {\n            this.el.hide();\n             return \"\";\n        }\n        \n        name = _this.name.el.get_text();\n        if (name.length < 1) {\n            StandardErrorDialog.singleton().show(\n                 _this.el,\n                \"You must give the template a name. \"\n            );\n            continue;\n        }\n        if (!Regex.match_simple (\"^[A-Za-z][A-Za-z0-9.]+$\", name) )\n        {\n            StandardErrorDialog.singleton().show(\n                 _this.el,\n                \"Template Name must contain only letters dots\"\n            );\n            continue;\n        }\n        break;\n    }\n    var f = project.newFile(name);\n    f.tree =  _this.data.deepClone();\n    f.save();\n    \n    // now we save it..\n    this.el.hide();\n    \n    return name;\n    \n    \n    \n}\n",
+            "$ xns" : "Gtk",
+            "items" : [
+                {
+                    "xtype" : "HBox",
+                    "$ pack" : " get_content_area().add\n\n",
+                    "$ xns" : "Gtk",
+                    "items" : [
+                        {
+                            "label" : "Name",
+                            "xtype" : "Label",
+                            "* pack" : "add",
+                            "$ xns" : "Gtk"
+                        },
+                        {
+                            "id" : "name",
+                            "xtype" : "Entry",
+                            "* pack" : "add",
+                            "$ xns" : "Gtk"
+                        }
+                    ]
+                },
+                {
+                    "label" : "Cancel",
+                    "xtype" : "Button",
+                    "* pack" : "add_action_widget,0",
+                    "$ xns" : "Gtk"
+                },
+                {
+                    "label" : "OK",
+                    "xtype" : "Button",
+                    "* pack" : "add_action_widget,1",
+                    "$ xns" : "Gtk"
+                }
+            ]
+        }
+    ]
+}
\ No newline at end of file