src/Builder4/DialogSaveModule.bjs
[app.Builder.js] / src / Builder4 / DialogSaveModule.bjs
1 {
2  "name" : "DialogSaveModule",
3  "parent" : "",
4  "title" : "",
5  "path" : "/home/alan/gitlive/app.Builder.js/src/Builder4/DialogSaveModule.bjs",
6  "permname" : "",
7  "modOrder" : "",
8  "items" : [
9   {
10    "listeners" : {
11     "delete_event" : " (self, event) => {\n    this.el.response(Gtk.ResponseType.CANCEL);\n    return true;\n}"
12    },
13    "default_width" : 400,
14    "# Project.Project project" : "",
15    "xtype" : "Dialog",
16    "default_height" : 200,
17    "$ modal" : true,
18    "# JsRender.Node data" : "",
19    "|   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",
20    "$ xns" : "Gtk",
21    "items" : [
22     {
23      "xtype" : "HBox",
24      "$ pack" : " get_content_area().add\n\n",
25      "$ xns" : "Gtk",
26      "items" : [
27       {
28        "label" : "Name",
29        "* pack" : "add",
30        "xtype" : "Label",
31        "$ xns" : "Gtk"
32       },
33       {
34        "id" : "name",
35        "* pack" : "add",
36        "xtype" : "Entry",
37        "$ xns" : "Gtk"
38       }
39      ]
40     },
41     {
42      "label" : "Cancel",
43      "* pack" : "add_action_widget,0",
44      "xtype" : "Button",
45      "$ xns" : "Gtk"
46     },
47     {
48      "label" : "OK",
49      "* pack" : "add_action_widget,1",
50      "xtype" : "Button",
51      "$ xns" : "Gtk"
52     }
53    ]
54   }
55  ]
56 }