Builder4/DialogSaveModule.bjs.RP6JMX
authorAlan Knowles <alan@roojs.com>
Thu, 11 Sep 2014 07:19:55 +0000 (15:19 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 11 Sep 2014 07:19:55 +0000 (15:19 +0800)
Builder4/DialogSaveModule.bjs
Builder4/DialogSaveModule.js.BYBKMX
Builder4/DialogSaveModule.js
Builder4/DialogSaveModule.vala.KXSJMX
Builder4/DialogSaveModule.vala

Builder4/DialogSaveModule.bjs
Builder4/DialogSaveModule.js
Builder4/DialogSaveModule.vala

index 1c48672..78e440c 100644 (file)
                 "delete_event" : " (self, event) => {\n    this.el.response(Gtk.ResponseType.CANCEL);\n    return true;\n}"
             },
             "default_width" : 400,
-            "|  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                (Gtk.Window) _this.el,\n                \"You must give the template a name. \"\n            );\n            continue;\n        }\n        if (!Regex.match_simple (\"^[A-Za-z.]+$\", name) || \n            !Regex.match_simple (\"^[A-Za-z.]+$\", name) )\n        {\n            StandardErrorDialog.show(\n                (Gtk.Window) _this.el,\n\n                \"Template Nane 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",
             "# 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                (Gtk.Window) _this.el,\n                \"You must give the template a name. \"\n            );\n            continue;\n        }\n        if (!Regex.match_simple (\"^[A-Za-z.]+$\", name) || \n            !Regex.match_simple (\"^[A-Za-z.]+$\", name) )\n        {\n            StandardErrorDialog.signleton().show(\n                 _this.el,\n\n                \"Template Nane 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" : [
                 {
                     "items" : [
                         {
                             "label" : "Name",
-                            "* pack" : "add",
                             "xtype" : "Label",
+                            "* pack" : "add",
                             "$ xns" : "Gtk"
                         },
                         {
                             "id" : "name",
-                            "* pack" : "add",
                             "xtype" : "Entry",
+                            "* pack" : "add",
                             "$ xns" : "Gtk"
                         }
                     ]
                 },
                 {
                     "label" : "Cancel",
-                    "* pack" : "add_action_widget,0",
                     "xtype" : "Button",
+                    "* pack" : "add_action_widget,0",
                     "$ xns" : "Gtk"
                 },
                 {
                     "label" : "OK",
-                    "* pack" : "add_action_widget,1",
                     "xtype" : "Button",
+                    "* pack" : "add_action_widget,1",
                     "$ xns" : "Gtk"
                 }
             ]
index 65a6c42..2211589 100644 (file)
@@ -11,6 +11,11 @@ console = imports.console;
 XObject = imports.XObject.XObject;
 DialogSaveModule=new XObject({
     default_width : 400,
+    project : "",
+    xtype : "Dialog",
+    default_height : 200,
+    modal : TRUE,
+    data : "",
     show : (Gtk.Window parent, Project.Project project, JsRender.Node data) {
      
          
@@ -40,8 +45,8 @@ DialogSaveModule=new XObject({
             if (!Regex.match_simple ("^[A-Za-z.]+$", name) || 
                 !Regex.match_simple ("^[A-Za-z.]+$", name) )
             {
-                StandardErrorDialog.show(
-                    (Gtk.Window) _this.el,
+                StandardErrorDialog.signleton().show(
+                     _this.el,
     
                     "Template Nane must contain only letters dots"
                 );
@@ -61,11 +66,6 @@ DialogSaveModule=new XObject({
         
         
     },
-    project : "",
-    xtype : "Dialog",
-    default_height : 200,
-    modal : TRUE,
-    data : "",
     xns : Gtk,
     listeners : {
        delete_event : (self, event) => {
index e1c9d90..aa14b0b 100644 (file)
@@ -48,7 +48,7 @@ public class DialogSaveModule : Object
     }
 
     // user defined functions 
-    public  string show (Gtk.Window parent, Project.Project project, JsRender.Node data) {
+    public   string show (Gtk.Window parent, Project.Project project, JsRender.Node data) {
      
          
         this.el.set_transient_for(parent);
@@ -77,8 +77,8 @@ public class DialogSaveModule : Object
             if (!Regex.match_simple ("^[A-Za-z.]+$", name) || 
                 !Regex.match_simple ("^[A-Za-z.]+$", name) )
             {
-                StandardErrorDialog.show(
-                    (Gtk.Window) _this.el,
+                StandardErrorDialog.signleton().show(
+                     _this.el,
     
                     "Template Nane must contain only letters dots"
                 );