From: tkawata Date: Sat, 17 Mar 2012 09:08:01 +0000 (+0900) Subject: Alpha1 development in progress. X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=37b95fc46c45a75fe16b97994960e8695ba773b4;p=dennco%2Fdennco.git Alpha1 development in progress. - Added sample container file under Samples/Samples with Sample1_SampleCells By specifying the directory on the QtDennco application, the sample container will be launched with UI. - Fixed several found critical bugs. --- diff --git a/Samples/HTML/Sample1.html b/Samples/HTML/Sample1.html deleted file mode 100644 index d822e67..0000000 --- a/Samples/HTML/Sample1.html +++ /dev/null @@ -1,215 +0,0 @@ - - - Denco - - - -

dennco Project. Sample

- -

Cell Code Class Definitions

- -
-
-
Code class:
-
SampleScript1
-
API TYPE:
-
TKJSBasicCell
-
- -
-        
-        function doTick(time)   
-        {
-            print("JavaScript doTick called. time:" + time); 
-            var val = 0;
-            var len = 0;
-            for (var key in this.cell.receptors) {
-                print("JS script... key:" + key + "  value:" + this.cell.receptors[key]);
-                val += this.cell.receptors[key] + 5;
-                len++;
-            }
-            val = val / len;
-        
-            this.cell.setAxonValue(val);
-        
-        }
-        
-        
-
-
- -
-
-
Code class2:
-
SampleScript2
-
API TYPE2:
-
TKJSBasicCell
-
- -
-                
-        var positiveInputs;
-        var negativeInputs;
-            
-        var maxValue = 100.0;
-        var minValue = -100.0;
-            
-        function doTick(time)   
-        {
-            print("JavaScript doTick called. time:" + time); 
-            var pval = 0;
-            var nval = 0;
-            var len = 0;
-            var key;
-            for (key in this.positiveInputs) {
-                print("Positive input:" + key + "  value:" + this.cell.receptors[key]);
-                pval += this.cell.receptors[key];
-                len++;
-            }
-            pval = pval / len;
-            len = 0;
-            for (key in this.negativeInputs) {
-                print("Negative input:" + key + "  value:" + this.cell.receptors[key]);
-                nval += this.cell.receptors[key];
-                len++;
-            }
-            nval = nval / len;
-                
-            var t = this.cell.getAxonValue();
-            if (t > maxValue) t = maxValue;
-            else if (t < minValue) t = minValue;
-            
-            this.cell.axonValue = t;
-                
-        }
-                
-        
-
-
- - -

Cells (Neurons)

- - -
-
-
Cell Name:
-
cell1-1
-
Code class:
-
SampleScript1
-
Init Script:
-
-
-            
-    // init code here    
-                
-
-
Connections:
-
- cell2-1 - cell2-2 -
-
-
- - - -
- Cell name : cell1-2
- Code class :
SampleScript1 -
-            
-    // init code here    
-        
- Connections: - -
- - - -
- Cell name : cell1-3
- Code class :
SampleScript1 -
-            
-    // init code here    
-        
- -
- - - -
- Cell name : cell2-1
- Code class :
SampleScript2 -
-                
-                positiveInputs = {FQN("/sample.html#cell1-1"), FQN("sample2.html#cell1-2")};
-                negativeInputs = {FQN("../sample3.html#cell1-3")}    
-            
- Connections: - -
- - - -
- Cell name : cell2-2
- Code class :
SampleScript2 -
-                
-    positiveInputs = {FQN("cell1-3")};
-    negativeInputs = {FQN("../cell1-1"), FQN("cell1-2")}    
-            
- Connections: - -
- - - -
- Cell name : cell3-1
- Code class :
SampleScript2 -
-        
-    positiveInputs = {FQN("cell2-1")};
-    negativeInputs = {FQN("cell2-2")}    
-            
-
- - - - diff --git a/Samples/Samples/Sample1_SimpleCells/Container/cells.xhtml b/Samples/Samples/Sample1_SimpleCells/Container/cells.xhtml new file mode 100644 index 0000000..937ffbb --- /dev/null +++ b/Samples/Samples/Sample1_SimpleCells/Container/cells.xhtml @@ -0,0 +1,109 @@ + + + +Dennco - test1 + + + + +

Sample1 - simple cells

+ + + +
 
+
+
+ + + + +
 
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
+
+
+
+ + +
 
+
+
+
+ + + \ No newline at end of file diff --git a/Samples/Samples/Sample1_SimpleCells/Container/dstyle.css b/Samples/Samples/Sample1_SimpleCells/Container/dstyle.css new file mode 100644 index 0000000..b22eed2 --- /dev/null +++ b/Samples/Samples/Sample1_SimpleCells/Container/dstyle.css @@ -0,0 +1,51 @@ + +a[define] { + border-top: 1px solid gray; + text-indent: 1em; + display: block; + margin-top: 32px; + margin-bottom: 8px; +} + +a[define="cellcode"]:before { + content: "Definition of CellCode : " attr(name) " (type:" attr(type) ")" ; + font-size: large; + font-weight: bold; + display: inline; + white-space: pre; +} + + +a[define="cell"]:before { + content: "Definition of Cell : " attr(name) ; + font-size: large; + font-weight: bold; + display: inline; + white-space: pre; +} + +a[parameter="cellcode"]:before { + content: "CellCode : " attr(href) attr(type); + display: inline; +} + +a[parameter="cellcode"] { + text-indent: 1em; + display: block; +} + +a[parameter="connection"]:before { + content: "-> " attr(href) "(" attr(name) ")"; + display: inline; +} + +a[parameter="connection"] { + text-indent: 2em; + display: block; +} + +[parameter="script"] { + border: 1px solid gray; + background-color: #f0f0cc; + margin-left: 2em; +} diff --git a/Samples/Samples/Sample1_SimpleCells/property.xml b/Samples/Samples/Sample1_SimpleCells/property.xml new file mode 100644 index 0000000..e2adbbd --- /dev/null +++ b/Samples/Samples/Sample1_SimpleCells/property.xml @@ -0,0 +1,8 @@ + + +1.0 +/ui/index.html +no +no + + \ No newline at end of file diff --git a/Samples/Samples/Sample1_SimpleCells/ui/index.html b/Samples/Samples/Sample1_SimpleCells/ui/index.html new file mode 100644 index 0000000..ad7b963 --- /dev/null +++ b/Samples/Samples/Sample1_SimpleCells/ui/index.html @@ -0,0 +1,68 @@ + + +Dennco Sample1 + + + +

Sample1 - simple cells

+ + + + + + + + + + + + + + + + + + + + + + + + +
InputOutput summaryOutput Value
+IN1: + +

+IN2: + +

Value of AutoCounter
Value of DoublerCell1 (IN1 x 2)
Value of TotalVarCell1(IN1 + IN2)
Value of TotalVarCell2 -> DoublerCell2 (IN1+IN2 -> x2)
+ + + diff --git a/Source/DNEngine.cpp b/Source/DNEngine.cpp index d05b5ac..451f952 100644 --- a/Source/DNEngine.cpp +++ b/Source/DNEngine.cpp @@ -114,7 +114,23 @@ bool DNEngine::parseSettingFile(const char *contentRoot) { valid = true; DNXMLElement *element = xml->getRoot(); - if (element->name != "dennco") + if (!element) + { + valid = false; + std::string message = "Failed to load property.xml file"; + TKLog::printf("ERROR wile loading property.xml file.\n%s\n",message.c_str()); + if (dnGlobal()->updateErrorStatus(DNGlobal::ERROR)) + { + dnGlobal()->setMessage1("Initialization failed"); + dnGlobal()->setMessage2(message); + } + else + { + dnGlobal()->setMessage1("Initialization failed"); + } + } + + if (valid && element->name != "dennco") { valid = false; std::string message = "First element of property.xml should be "; diff --git a/Source/QtDennco/mainwindow.cpp b/Source/QtDennco/mainwindow.cpp index fd82695..8c5258f 100644 --- a/Source/QtDennco/mainwindow.cpp +++ b/Source/QtDennco/mainwindow.cpp @@ -51,6 +51,7 @@ MainWindow::MainWindow(QWidget *parent) : monofont.setStyleHint(QFont::Monospace); ui->console->setFont(monofont); TKLog::setDestination(this); + connect(this, SIGNAL(consoleUpdated()), this, SLOT(update()), Qt::AutoConnection); } MainWindow::~MainWindow() @@ -158,7 +159,7 @@ void MainWindow::attachWebInterface() QWebFrame *frame = page->mainFrame(); if (frame) { - frame->addToJavaScriptWindowObject("dennco", mWebInterface); + frame->addToJavaScriptWindowObject("engine", mWebInterface); connect(frame, SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(attachWebInterface())); } } @@ -202,7 +203,7 @@ void MainWindow::vprintf(const char *fmt, va_list ap) mPendingConsoleMessage.append(msg); mHasPendingConsoleMessage = true; mConsoleLock.unlock(); - update(); + emit consoleUpdated(); } void MainWindow::vDebugPrintf(const char *fmt, va_list ap) diff --git a/Source/QtDennco/mainwindow.h b/Source/QtDennco/mainwindow.h index 04887bb..132acdb 100644 --- a/Source/QtDennco/mainwindow.h +++ b/Source/QtDennco/mainwindow.h @@ -66,6 +66,9 @@ private: QString mPendingConsoleMessage; bool mHasPendingConsoleMessage; +signals: + void consoleUpdated(); + }; #endif // MAINWINDOW_H