resources/RooUsage.txt
[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  "build_module" : "builder",
9  "items" : [
10   {
11    "@ void buttonPressed" : "(string btn)",
12    "id" : "ProjectSettings",
13    "| 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     var js = _this.project;\n    _this.database_DBTYPE.el.set_text(     js.get_string_member(\"DBTYPE\") );\n    _this.database_DBNAME.el.set_text(    js.get_string_member(\"DBNAME\") );\n    _this.database_DBUSERNAME.el.set_text(    js.get_string_member(\"DBUSERNAME\") );\n    _this.database_DBPASSWORD.el.set_text(    js.get_string_member(\"DBPASSWORD\") );\n    //this.el.show_all();\n}\n",
14    "# Project.Project project" : "",
15    "xtype" : "Box",
16    "| 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    var js = _this.project.json_project_data;\n    js.set_string_member(\"DBTYPE\", _this.database_DBTYPE.el.get_text());\n   js.set_string_member(\"DBNAME\", _this.database_DBNAME.el.get_text());\n    js.set_string_member(\"DBUSERNAME\", _this.database_DBUSERNAME.el.get_text());\n    js.set_string_member(\"DBPASSWORD\", _this.database_DBPASSWORD.el.get_text());\n//    _this.project.set_string_member(\"DBHOST\", _this.DBTYPE.el.get_text());    \n    \n    // need to re-init the database \n    \n    _this.project.initRooDatabase();\n     \n    \n}",
17    "$ xns" : "Gtk",
18    "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
19    "border_width" : 5,
20    "$ homogeneous" : false,
21    "items" : [
22     {
23      "* pack" : "pack_start,false,false,0",
24      "xtype" : "Box",
25      "gboolean expand" : false,
26      "$ xns" : "Gtk",
27      "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
28      "$ homogeneous" : true,
29      "gboolean vexpand" : false,
30      "items" : [
31       {
32        "listeners" : {
33         "button_press_event" : "() => {\n    _this.save();\n          \n    _this.buttonPressed(\"apply\");\n        return false;\n}"
34        },
35        "label" : "Apply",
36        "* pack" : "add",
37        "xtype" : "Button",
38        "$ xns" : "Gtk"
39       },
40       {
41        "listeners" : {
42         "button_press_event" : "() => {\n       _this.save();\n          \n    _this.buttonPressed(\"save\");\n        return false;\n}"
43        },
44        "label" : "Save",
45        "* pack" : "add",
46        "xtype" : "Button",
47        "$ xns" : "Gtk"
48       }
49      ]
50     },
51     {
52      "* pack" : "pack_end,true,true,0",
53      "xtype" : "Notebook",
54      "$ xns" : "Gtk",
55      "items" : [
56       {
57        "id" : "label_global",
58        "xtype" : "Label",
59        "* pack" : false,
60        "$ xns" : "Gtk",
61        "utf8 label" : "Global"
62       },
63       {
64        "id" : "label_database",
65        "* pack" : false,
66        "xtype" : "Label",
67        "$ xns" : "Gtk",
68        "utf8 label" : "Database"
69       },
70       {
71        "* pack" : "append_page,_this.label_global.el",
72        "xtype" : "Box",
73        "gboolean homogeneous" : false,
74        "$ xns" : "Gtk",
75        "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
76        "items" : [
77         {
78          "label" : "filename",
79          "id" : "path",
80          "xalign" : 0,
81          "* pack" : "pack_start,false,false,0",
82          "xtype" : "Label",
83          "gint margin" : 3,
84          "$ xns" : "Gtk"
85         },
86         {
87          "* pack" : "pack_start,false,false,0",
88          "xtype" : "Box",
89          "gboolean expand" : false,
90          "$ xns" : "Gtk",
91          "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
92          "$ homogeneous" : false,
93          "items" : [
94           {
95            "label" : "HTML template file",
96            "xtype" : "Label",
97            "* pack" : "pack_start,false,false,0",
98            "gint margin" : 3,
99            "$ xns" : "Gtk"
100           },
101           {
102            "id" : "base_template",
103            "xtype" : "Entry",
104            "* pack" : "add",
105            "$ xns" : "Gtk"
106           }
107          ]
108         },
109         {
110          "* pack" : "pack_start,false,false,0",
111          "xtype" : "Box",
112          "gboolean expand" : false,
113          "$ xns" : "Gtk",
114          "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
115          "$ homogeneous" : false,
116          "items" : [
117           {
118            "label" : "root URL",
119            "xtype" : "Label",
120            "* pack" : "pack_start,false,false,0",
121            "gint margin" : 3,
122            "$ xns" : "Gtk"
123           },
124           {
125            "id" : "rootURL",
126            "xtype" : "Entry",
127            "* pack" : "add",
128            "$ xns" : "Gtk"
129           }
130          ]
131         },
132         {
133          "label" : "HTML To insert at end of <HEAD>",
134          "xtype" : "Label",
135          "* pack" : "pack_start,false,false,0",
136          "$ xns" : "Gtk"
137         },
138         {
139          "* pack" : "pack_start,true,true,0",
140          "xtype" : "ScrolledWindow",
141          "$ xns" : "Gtk",
142          "items" : [
143           {
144            "listeners" : {
145             "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}"
146            },
147            "id" : "view",
148            "* init" : " \n    var description =   Pango.FontDescription.from_string(\"monospace\");\n    description.set_size(9000);\n    this.el.override_font(description);",
149            "xtype" : "View",
150            "* pack" : "add",
151            "$ xns" : "GtkSource"
152           }
153          ]
154         }
155        ]
156       },
157       {
158        "* pack" : "append_page,_this.label_database.el",
159        "xtype" : "Box",
160        "gboolean homogeneous" : false,
161        "$ xns" : "Gtk",
162        "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
163        "items" : [
164         {
165          "label" : "Type (eg. MySQL or PostgreSQL)",
166          "xalign" : 0,
167          "* pack" : "pack_start,false,false,0",
168          "xtype" : "Label",
169          "$ xns" : "Gtk"
170         },
171         {
172          "listeners" : {
173           "key_press_event" : "(ev) => {\n\n    if (ev.keyval == Gdk.Key.Tab) {\n        _this.database_DBNAME.el.grab_focus();\n        return true;\n    }\n\n\n    return false;\n}\n"
174          },
175          "id" : "database_DBTYPE",
176          "* pack" : "pack_start,false,false,0",
177          "xtype" : "Entry",
178          "$ xns" : "Gtk"
179         },
180         {
181          "label" : "Name",
182          "xalign" : 0,
183          "* pack" : "pack_start,false,false,0",
184          "xtype" : "Label",
185          "$ xns" : "Gtk"
186         },
187         {
188          "listeners" : {
189           "key_press_event" : "(ev) => {\n\n    if (ev.keyval == Gdk.Key.Tab) {\n        _this.database_DBUSERNAME.el.grab_focus();\n        return true;\n    }\n\n\n    return false;\n}\n"
190          },
191          "id" : "database_DBNAME",
192          "xtype" : "Entry",
193          "* pack" : "pack_start,false,false,0",
194          "$ xns" : "Gtk"
195         },
196         {
197          "label" : "Username",
198          "xalign" : 0,
199          "* pack" : "pack_start,false,false,0",
200          "xtype" : "Label",
201          "$ xns" : "Gtk"
202         },
203         {
204          "listeners" : {
205           "key_press_event" : "(ev) => {\n\n    if (ev.keyval == Gdk.Key.Tab) {\n        _this.database_DBPASSWORD.el.grab_focus();\n        return true;\n    }\n\n\n    return false;\n}\n"
206          },
207          "id" : "database_DBUSERNAME",
208          "* pack" : "pack_start,false,false,0",
209          "xtype" : "Entry",
210          "$ xns" : "Gtk"
211         },
212         {
213          "label" : "Password",
214          "xalign" : 0,
215          "* pack" : "pack_start,false,false,0",
216          "xtype" : "Label",
217          "$ xns" : "Gtk"
218         },
219         {
220          "id" : "database_DBPASSWORD",
221          "xtype" : "Entry",
222          "* pack" : "pack_start,false,false,0",
223          "$ xns" : "Gtk"
224         },
225         {
226          "listeners" : {
227           "clicked" : "() => {\n\n\n  _this.database_ERROR.el.label    = \"\";\n    Gda.Connection cnc;\n    try {\n        // assumes localhost...\n         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   //} catch (Gda.ConnectionError ce) { \n   //   _this.database_ERROR.el.label = ce.message;        \n   } catch(Gda.ConnectionError ue) {\n      _this.database_ERROR.el.label = ue.message;\n        return;\n   }  catch(Gda.ConfigError ue) {\n      _this.database_ERROR.el.label = ue.message;\n        return;\n   }\n  _this.database_ERROR.el.label = \"Connection Succeeded\";\n   cnc.close();\n}"
228          },
229          "* pack" : "pack_start,false,false,0",
230          "xtype" : "Button",
231          "$ xns" : "Gtk",
232          "utf8 label" : "Check Connection"
233         },
234         {
235          "label" : " ",
236          "id" : "database_ERROR",
237          "xalign" : 0,
238          "* pack" : "pack_start,false,false,0",
239          "xtype" : "Label",
240          "gint margin" : 3,
241          "$ xns" : "Gtk"
242         }
243        ]
244       }
245      ]
246     }
247    ]
248   }
249  ]
250 }