src/Builder4/ProjectSettings.bjs
[app.Builder.js] / src / Builder4 / ProjectSettings.bjs
1 {
2  "name" : "ProjectSettings",
3  "parent" : "",
4  "title" : "",
5  "path" : "/home/alan/gitlive/app.Builder.js/src/Builder4/ProjectSettings.bjs",
6  "permname" : "",
7  "modOrder" : "",
8  "items" : [
9   {
10    "@ void buttonPressed" : "(string btn)",
11    "id" : "ProjectSettings",
12    "| void show" : " (Project.Project project) {\n    _this.project = project;\n    _this.path.el.label = project.firstPath();\n    // get the active project.\n     var lm = Gtk.SourceLanguageManager.get_default();\n                \n    ((Gtk.SourceBuffer)(_this.view.el.get_buffer())) .set_language(\n    \n        lm.get_language(\"html\"));\n  \n    //print (project.fn);\n    //project.runhtml = project.runhtml || '';\n    _this.view.el.get_buffer().set_text(project.runhtml);\n    \n       \n    _this.rootURL.el.set_text( _this.project.rootURL );\n    _this.base_template.el.set_text(_this.project.base_template);    \n   \n    \n    //this.el.show_all();\n}\n",
13    "# Project.Project project" : "",
14    "xtype" : "VBox",
15    "| void save" : "()\n{\n   var buf =    _this.view.el.get_buffer();\n   Gtk.TextIter s;\n     Gtk.TextIter e;\n    buf.get_start_iter(out s);\n    buf.get_end_iter(out e);\n      _this.project.runhtml = buf.get_text(s,e,true);\n      \n    _this.project.rootURL = _this.rootURL.el.get_text();\n    _this.project.base_template = _this.base_template.el.get_text();    \n    \n    \n}",
16    "$ xns" : "Gtk",
17    "border_width" : 5,
18    "$ homogeneous" : false,
19    "items" : [
20     {
21      "* pack" : "pack_start,false,false,0",
22      "xtype" : "HBox",
23      "gboolean expand" : false,
24      "$ xns" : "Gtk",
25      "$ homogeneous" : true,
26      "gboolean vexpand" : false,
27      "items" : [
28       {
29        "listeners" : {
30         "button_press_event" : "() => {\n    _this.save();\n          \n    _this.buttonPressed(\"apply\");\n        return false;\n}"
31        },
32        "label" : "Apply",
33        "* pack" : "add",
34        "xtype" : "Button",
35        "$ xns" : "Gtk"
36       },
37       {
38        "listeners" : {
39         "button_press_event" : "() => {\n       _this.save();\n          \n    _this.buttonPressed(\"save\");\n        return false;\n}"
40        },
41        "label" : "Save",
42        "* pack" : "add",
43        "xtype" : "Button",
44        "$ xns" : "Gtk"
45       }
46      ]
47     },
48     {
49      "* pack" : "pack_end,true,true,0",
50      "xtype" : "Notebook",
51      "$ xns" : "Gtk",
52      "items" : [
53       {
54        "id" : "label_global",
55        "xtype" : "Label",
56        "* pack" : false,
57        "$ xns" : "Gtk",
58        "utf8 label" : "Global"
59       },
60       {
61        "id" : "label_database",
62        "* pack" : false,
63        "xtype" : "Label",
64        "$ xns" : "Gtk",
65        "utf8 label" : "Database"
66       },
67       {
68        "* pack" : "append_page,_this.label_global.el",
69        "xtype" : "VBox",
70        "gboolean homogeneous" : false,
71        "$ xns" : "Gtk",
72        "items" : [
73         {
74          "label" : "filename",
75          "id" : "path",
76          "xalign" : 0,
77          "* pack" : "pack_start,false,false,0",
78          "xtype" : "Label",
79          "gint margin" : 3,
80          "$ xns" : "Gtk"
81         },
82         {
83          "* pack" : "pack_start,false,false,0",
84          "xtype" : "HBox",
85          "gboolean expand" : false,
86          "$ xns" : "Gtk",
87          "$ homogeneous" : false,
88          "items" : [
89           {
90            "label" : "HTML template file",
91            "xtype" : "Label",
92            "* pack" : "pack_start,false,false,0",
93            "gint margin" : 3,
94            "$ xns" : "Gtk"
95           },
96           {
97            "id" : "base_template",
98            "xtype" : "Entry",
99            "* pack" : "add",
100            "$ xns" : "Gtk"
101           }
102          ]
103         },
104         {
105          "* pack" : "pack_start,false,false,0",
106          "xtype" : "HBox",
107          "gboolean expand" : false,
108          "$ xns" : "Gtk",
109          "$ homogeneous" : false,
110          "items" : [
111           {
112            "label" : "root URL",
113            "xtype" : "Label",
114            "* pack" : "pack_start,false,false,0",
115            "gint margin" : 3,
116            "$ xns" : "Gtk"
117           },
118           {
119            "id" : "rootURL",
120            "xtype" : "Entry",
121            "* pack" : "add",
122            "$ xns" : "Gtk"
123           }
124          ]
125         },
126         {
127          "label" : "HTML To insert at end of <HEAD>",
128          "xtype" : "Label",
129          "* pack" : "pack_start,false,false,0",
130          "$ xns" : "Gtk"
131         },
132         {
133          "* pack" : "pack_start,true,true,0",
134          "xtype" : "ScrolledWindow",
135          "$ xns" : "Gtk",
136          "items" : [
137           {
138            "listeners" : {
139             "key_release_event" : " ( event) =>{\n    if (event.keyval != 115) {\n        return false;\n         \n    }\n    if   ( (event.state & Gdk.ModifierType.CONTROL_MASK ) < 1 ) {\n        return false;\n    }\n     var buf =    this.el.get_buffer();\n    Gtk.TextIter s;\n    Gtk.TextIter e;\n    buf.get_start_iter(out s);\n    buf.get_end_iter(out e);\n    _this.project.runhtml = buf.get_text(s,e,true);\n    \n          \n    _this.buttonPressed(\"save\");\n     \n    return false;\n         \n}"
140            },
141            "id" : "view",
142            "* init" : " \n    var description =   Pango.FontDescription.from_string(\"monospace\");\n    description.set_size(9000);\n    this.el.override_font(description);",
143            "xtype" : "View",
144            "* pack" : "add",
145            "$ xns" : "GtkSource"
146           }
147          ]
148         }
149        ]
150       },
151       {
152        "* pack" : "append_page,_this.label_database.el",
153        "xtype" : "VBox",
154        "gboolean homogeneous" : false,
155        "$ xns" : "Gtk",
156        "items" : [
157         {
158          "label" : "Type (eg. MySQL or PostgreSQL)",
159          "xalign" : 0,
160          "* pack" : "pack_start,false,false,0",
161          "xtype" : "Label",
162          "$ xns" : "Gtk"
163         },
164         {
165          "id" : "database_DBTYPE",
166          "* pack" : "pack_start,false,false,0",
167          "xtype" : "Entry",
168          "$ xns" : "Gtk"
169         },
170         {
171          "label" : "Name",
172          "xalign" : 0,
173          "* pack" : "pack_start,false,false,0",
174          "xtype" : "Label",
175          "$ xns" : "Gtk"
176         },
177         {
178          "id" : "database_DBNAME",
179          "xtype" : "Entry",
180          "* pack" : "pack_start,false,false,0",
181          "$ xns" : "Gtk"
182         },
183         {
184          "label" : "Username",
185          "xalign" : 0,
186          "* pack" : "pack_start,false,false,0",
187          "xtype" : "Label",
188          "$ xns" : "Gtk"
189         },
190         {
191          "id" : "database_DBUSERNAME",
192          "* pack" : "pack_start,false,false,0",
193          "xtype" : "Entry",
194          "$ xns" : "Gtk"
195         },
196         {
197          "label" : "Password",
198          "xalign" : 0,
199          "* pack" : "pack_start,false,false,0",
200          "xtype" : "Label",
201          "$ xns" : "Gtk"
202         },
203         {
204          "id" : "database_DBPASSWORD",
205          "xtype" : "Entry",
206          "* pack" : "pack_start,false,false,0",
207          "$ xns" : "Gtk"
208         },
209         {
210          "listeners" : {
211           "clicked" : "() => {\n    _this.rootURL.el.get_text();\n    _this.project.base_template = _this.base_template.el.get_text();    \n    try {\n        // assumes localhost...\n         var cnc = Gda.Connection.open_from_string (\n\t\t\t_this.database_DBTYPE.el.get_text(),\n\t\t\t\"DB_NAME=\" + _this.database_DBNAME.el.get_text(), \n\t\t\t\"USERNAME=\" + _this.database_DBUSERNAME.el.get_text() + \n\t\t\t\";PASSWORD=\" + _this.database_DBPASSWORD.el.get_text(),\n\t\t\tGda.ConnectionOptions.NONE\n\t\t);\n\n}"
212          },
213          "* pack" : "pack_start,false,false,0",
214          "xtype" : "Button",
215          "$ xns" : "Gtk",
216          "utf8 label" : "Check Connection"
217         }
218        ]
219       }
220      ]
221     }
222    ]
223   }
224  ]
225 }