Fix #7250 - better handling of adding properties
[roobuilder] / src / Builder4 / DialogSaveTemplate.bjs
1 {
2  "build_module" : "builder",
3  "items" : [
4   {
5    "# JsRender.Node data" : "",
6    "# Palete.Palete palete" : "",
7    "$ modal" : true,
8    "$ xns" : "Gtk",
9    "default_height" : 200,
10    "default_width" : 400,
11    "items" : [
12     {
13      "$ pack" : [
14       " get_content_area().add",
15       "",
16       ""
17      ],
18      "$ xns" : "Gtk",
19      "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
20      "items" : [
21       {
22        "$ xns" : "Gtk",
23        "* pack" : "add",
24        "label" : "Name",
25        "xtype" : "Label"
26       },
27       {
28        "$ xns" : "Gtk",
29        "* pack" : "add",
30        "id" : "name",
31        "xtype" : "Entry"
32       }
33      ],
34      "xtype" : "Box"
35     },
36     {
37      "$ xns" : "Gtk",
38      "* pack" : "add_action_widget,0",
39      "label" : "Cancel",
40      "xtype" : "Button"
41     },
42     {
43      "$ xns" : "Gtk",
44      "* pack" : "add_action_widget,1",
45      "label" : "OK",
46      "xtype" : "Button"
47     }
48    ],
49    "listeners" : {
50     "delete_event" : [
51      " (self, event) => {",
52      "   this.el.response(Gtk.ResponseType.CANCEL);",
53      "    return true;",
54      " ",
55      "}"
56     ]
57    },
58    "xtype" : "Dialog",
59    "|    void show" : [
60     " (Gtk.Window parent, Palete.Palete palete, JsRender.Node data) {",
61     " ",
62     "    ",
63     "        this.el.set_transient_for(parent);",
64     "        this.el.modal = true;",
65     "        ",
66     "          this.name.el.set_text(\"\");",
67     "        this.el.show_all();",
68     "         var   name = \"\";",
69     "        while (true) {",
70     "            var response_id = this.el.run();",
71     "            if (response_id < 1) {",
72     "                this.el.hide();",
73     "                 return;",
74     "            }",
75     "            ",
76     "            name = _this.name.el.get_text();",
77     "            if (name.length < 1) {",
78     "                Xcls_StandardErrorDialog.singleton().show(",
79     "                     _this.el,",
80     "                    \"You must give the template a name. \"",
81     "                );",
82     "                continue;",
83     "            }",
84     "            if (!Regex.match_simple (\"^[A-Za-z][A-Za-z0-9. ]+$\", name) )",
85     "            {",
86     "                Xcls_StandardErrorDialog.singleton().show(",
87     "                     _this.el,",
88     "                    \"Template Name must contain only letters dots\"",
89     "                );",
90     "                continue;",
91     "            }",
92     "            break;",
93     "        }",
94     "        palete.saveTemplate(name, data);",
95     "        ",
96     "        // now we save it..",
97     "        this.el.hide();",
98     "        ",
99     "         ",
100     "  ",
101     "   ",
102     "}",
103     ""
104    ]
105   }
106  ],
107  "modOrder" : "",
108  "name" : "DialogSaveTemplate",
109  "parent" : "",
110  "path" : "/home/alan/gitlive/roobuilder/src/Builder4/DialogSaveTemplate.bjs",
111  "permname" : "",
112  "title" : ""
113 }