Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions js/DataGridRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -534,5 +534,81 @@ var DataGridRenderer = {
return outputText;

},

//---------------------------------------
// Python LIST
//---------------------------------------

pythonlist: function (dataGrid, headerNames, headerTypes, indent, newLine) {
//inits...
// appending headers into datagrid as its not a Dictioary
dataGrid.splice(0,0,headerNames)
var commentLine = "//";
var commentLineEnd = "";
var outputText = "[";
var numRows = dataGrid.length;
var numColumns = headerNames.length;
//begin render loop
for (var i=0; i < numRows; i++) {
var row = dataGrid[i];

for (var j=0; j < numColumns; j++) {
if ((headerTypes[j] == "int")||(headerTypes[j] == "float")) {
var rowOutput = row[j] || "None";
} else {
var rowOutput = '"'+(row[j] || "")+'"';
};

outputText += (rowOutput );

if (j < (numColumns-1)) {outputText+=","};
};

if (i < (numRows-1)) {outputText += ","};
};
outputText += "]";

return outputText;
},

//---------------------------------------
// Python SET LIST
//---------------------------------------

pythonsetlist: function (dataGrid, headerNames, headerTypes, indent, newLine) {
// appending headers into datagrid as its not a Dictioary
dataGrid.splice(0,0,headerNames)
//inits...
var commentLine = "//";
var commentLineEnd = "";
var outputText = "[";
var numRows = dataGrid.length;
var numColumns = headerNames.length;

//begin render loop
for (var i=0; i < numRows; i++) {
var row = dataGrid[i];
outputText += "(";
for (var j=0; j < numColumns; j++) {
if ((headerTypes[j] == "int")||(headerTypes[j] == "float")) {
var rowOutput = row[j] || "None";
} else {
var rowOutput = '"'+(row[j] || "")+'"';
};

outputText += (rowOutput);

if (j < (numColumns-1)) {outputText+=","};
};
outputText += ")";
if (i < (numRows-1)) {outputText += ","+newLine};
};
outputText += "]";

return outputText;
},




}
7 changes: 5 additions & 2 deletions js/converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function DataConverter(nodeId) {
this.nodeId = nodeId;
this.node = $("#"+nodeId);

this.outputDataTypes = [
this.outputDataTypes = [
{"text":"Actionscript", "id":"as", "notes":""},
{"text":"ASP/VBScript", "id":"asp", "notes":""},
{"text":"HTML", "id":"html", "notes":""},
Expand All @@ -30,7 +30,10 @@ function DataConverter(nodeId) {
{"text":"Ruby", "id":"ruby", "notes":""},
{"text":"XML - Properties", "id":"xmlProperties", "notes":""},
{"text":"XML - Nodes", "id":"xml", "notes":""},
{"text":"XML - Illustrator", "id":"xmlIllustrator", "notes":""}];
{"text":"XML - Illustrator", "id":"xmlIllustrator", "notes":""},
{"text":"Python - List", "id":"pythonlist", "notes":""},
{"text":"Python - SET", "id":"pythonsetlist", "notes":""},
];
this.outputDataType = "json";

this.columnDelimiter = "\t";
Expand Down