doc/doxygen/html/nodelist_8py-source.html
author nico
Mon, 04 Jun 2007 17:59:50 +0200
changeset 207 b6572d0336c3
permissions -rw-r--r--
First doxygen implementation
207
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
     1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
     2
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
     3
<title>CanFestival: /home/epimerde/documents/tc11/CanFestival-3/objdictgen/nodelist.py Source File</title>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
     4
<link href="doxygen.css" rel="stylesheet" type="text/css">
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
     5
<link href="tabs.css" rel="stylesheet" type="text/css">
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
     6
</head><body>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
     7
<!-- Generated by Doxygen 1.5.1 -->
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
     8
<div class="tabs">
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
     9
  <ul>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    10
    <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    11
    <li><a href="namespaces.html"><span>Namespaces</span></a></li>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    12
    <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    13
    <li id="current"><a href="files.html"><span>Files</span></a></li>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    14
  </ul></div>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    15
<div class="tabs">
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    16
  <ul>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    17
    <li><a href="files.html"><span>File&nbsp;List</span></a></li>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    18
    <li><a href="globals.html"><span>Globals</span></a></li>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    19
  </ul></div>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    20
<h1>/home/epimerde/documents/tc11/CanFestival-3/objdictgen/nodelist.py</h1><a href="nodelist_8py.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a><a class="code" href="namespacenodelist.html">00001</a> <span class="comment">#!/usr/bin/env python</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    21
<a name="l00002"></a>00002 <span class="comment"># -*- coding: utf-8 -*-</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    22
<a name="l00003"></a>00003 
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    23
<a name="l00004"></a>00004 <span class="comment">#This file is part of CanFestival, a library implementing CanOpen Stack. </span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    24
<a name="l00005"></a>00005 <span class="comment">#</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    25
<a name="l00006"></a>00006 <span class="comment">#Copyright (C): Edouard TISSERANT, Francis DUPIN and Laurent BESSARD</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    26
<a name="l00007"></a>00007 <span class="comment">#</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    27
<a name="l00008"></a>00008 <span class="comment">#See COPYING file for copyrights details.</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    28
<a name="l00009"></a>00009 <span class="comment">#</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    29
<a name="l00010"></a>00010 <span class="comment">#This library is free software; you can redistribute it and/or</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    30
<a name="l00011"></a>00011 <span class="comment">#modify it under the terms of the GNU Lesser General Public</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    31
<a name="l00012"></a>00012 <span class="comment">#License as published by the Free Software Foundation; either</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    32
<a name="l00013"></a>00013 <span class="comment">#version 2.1 of the License, or (at your option) any later version.</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    33
<a name="l00014"></a>00014 <span class="comment">#</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    34
<a name="l00015"></a>00015 <span class="comment">#This library is distributed in the hope that it will be useful,</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    35
<a name="l00016"></a>00016 <span class="comment">#but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    36
<a name="l00017"></a>00017 <span class="comment">#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    37
<a name="l00018"></a>00018 <span class="comment">#Lesser General Public License for more details.</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    38
<a name="l00019"></a>00019 <span class="comment">#</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    39
<a name="l00020"></a>00020 <span class="comment">#You should have received a copy of the GNU Lesser General Public</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    40
<a name="l00021"></a>00021 <span class="comment">#License along with this library; if not, write to the Free Software</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    41
<a name="l00022"></a>00022 <span class="comment">#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    42
<a name="l00023"></a>00023 
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    43
<a name="l00024"></a>00024 <span class="keyword">from</span> gnosis.xml.pickle <span class="keyword">import</span> *
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    44
<a name="l00025"></a>00025 <span class="keyword">from</span> gnosis.xml.pickle.util <span class="keyword">import</span> setParanoia
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    45
<a name="l00026"></a>00026 setParanoia(0)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    46
<a name="l00027"></a>00027 
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    47
<a name="l00028"></a>00028 <span class="keyword">from</span> node <span class="keyword">import</span> *
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    48
<a name="l00029"></a>00029 <span class="keyword">import</span> eds_utils
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    49
<a name="l00030"></a>00030 <span class="keyword">import</span> os, shutil
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    50
<a name="l00031"></a>00031 
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    51
<a name="l00032"></a>00032 <span class="comment">#-------------------------------------------------------------------------------</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    52
<a name="l00033"></a>00033 <span class="comment">#                          Definition of NodeList Object</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    53
<a name="l00034"></a>00034 <span class="comment">#-------------------------------------------------------------------------------</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    54
<a name="l00035"></a>00035 
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    55
<a name="l00036"></a>00036 <span class="stringliteral">"""</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    56
<a name="l00037"></a>00037 <span class="stringliteral">Class recording a node list for a CANOpen network.</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    57
<a name="l00038"></a>00038 <span class="stringliteral">"""</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    58
<a name="l00039"></a>00039 
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    59
<a name="l00040"></a><a class="code" href="classnodelist_1_1NodeList.html">00040</a> <span class="keyword">class </span><a class="code" href="classnodelist_1_1NodeList.html">NodeList</a>:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    60
<a name="l00041"></a>00041     
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    61
<a name="l00042"></a><a class="code" href="classnodelist_1_1NodeList.html#c6e80d9c4b17421a74aae47e39e22ffb">00042</a>     <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#c6e80d9c4b17421a74aae47e39e22ffb">__init__</a>(self, manager):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    62
<a name="l00043"></a><a class="code" href="classnodelist_1_1NodeList.html#b2f15765f2bd7a7bc5038102e491e87c">00043</a>         self.<a class="code" href="classnodelist_1_1NodeList.html#b2f15765f2bd7a7bc5038102e491e87c">Root</a>Root = <span class="stringliteral">""</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    63
<a name="l00044"></a><a class="code" href="classnodelist_1_1NodeList.html#629a8a12f02ae1f7d02d0ef7bb0afcbf">00044</a>         self.<a class="code" href="classnodelist_1_1NodeList.html#629a8a12f02ae1f7d02d0ef7bb0afcbf">Manager</a>Manager = manager
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    64
<a name="l00045"></a><a class="code" href="classnodelist_1_1NodeList.html#267d8efe86849209ff37f59598efcceb">00045</a>         self.<a class="code" href="classnodelist_1_1NodeList.html#267d8efe86849209ff37f59598efcceb">NetworkName</a>NetworkName = <span class="stringliteral">""</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    65
<a name="l00046"></a><a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">00046</a>         self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes = {}
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    66
<a name="l00047"></a><a class="code" href="classnodelist_1_1NodeList.html#eb7afd07a98f688686ccc351404978d3">00047</a>         self.<a class="code" href="classnodelist_1_1NodeList.html#eb7afd07a98f688686ccc351404978d3">EDSNodes</a>EDSNodes = {}
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    67
<a name="l00048"></a><a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">00048</a>         self.<a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">CurrentSelected</a>CurrentSelected = <span class="keywordtype">None</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    68
<a name="l00049"></a>00049     
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    69
<a name="l00050"></a><a class="code" href="classnodelist_1_1NodeList.html#f251a2599ab39f05f72debe9194ef730">00050</a>     <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#f251a2599ab39f05f72debe9194ef730">GetNetworkName</a>(self):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    70
<a name="l00051"></a>00051         <span class="keywordflow">return</span> self.<a class="code" href="classnodelist_1_1NodeList.html#267d8efe86849209ff37f59598efcceb">NetworkName</a>NetworkName
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    71
<a name="l00052"></a>00052     
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    72
<a name="l00053"></a><a class="code" href="classnodelist_1_1NodeList.html#9d82bcfef0a88d2c9135cf5a8e2ff047">00053</a>     <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#9d82bcfef0a88d2c9135cf5a8e2ff047">SetNetworkName</a>(self, name):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    73
<a name="l00054"></a>00054         self.<a class="code" href="classnodelist_1_1NodeList.html#267d8efe86849209ff37f59598efcceb">NetworkName</a>NetworkName = name
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    74
<a name="l00055"></a>00055     
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    75
<a name="l00056"></a><a class="code" href="classnodelist_1_1NodeList.html#1b2aa331c3a0f257629450ffbb658714">00056</a>     <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#1b2aa331c3a0f257629450ffbb658714">GetManager</a>(self):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    76
<a name="l00057"></a>00057         <span class="keywordflow">return</span> self.<a class="code" href="classnodelist_1_1NodeList.html#629a8a12f02ae1f7d02d0ef7bb0afcbf">Manager</a>Manager
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    77
<a name="l00058"></a>00058     
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    78
<a name="l00059"></a><a class="code" href="classnodelist_1_1NodeList.html#5660c96280f53eb22d49ae3ef87857b5">00059</a>     <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#5660c96280f53eb22d49ae3ef87857b5">GetRoot</a>(self):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    79
<a name="l00060"></a>00060         <span class="keywordflow">return</span> self.<a class="code" href="classnodelist_1_1NodeList.html#b2f15765f2bd7a7bc5038102e491e87c">Root</a>Root
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    80
<a name="l00061"></a>00061     
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    81
<a name="l00062"></a><a class="code" href="classnodelist_1_1NodeList.html#88204b493bfb5af7a4106f79ce65e377">00062</a>     <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#88204b493bfb5af7a4106f79ce65e377">GetSlaveNumber</a>(self):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    82
<a name="l00063"></a>00063         <span class="keywordflow">return</span> len(self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    83
<a name="l00064"></a>00064     
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    84
<a name="l00065"></a><a class="code" href="classnodelist_1_1NodeList.html#ae2a228b04ac23eced9749346e06cf09">00065</a>     <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#ae2a228b04ac23eced9749346e06cf09">GetSlaveNames</a>(self):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    85
<a name="l00066"></a>00066         nodes = self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes.keys()
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    86
<a name="l00067"></a>00067         nodes.sort()
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    87
<a name="l00068"></a>00068         <span class="keywordflow">return</span> [<span class="stringliteral">"0x%2.2X %s"</span>%(idx, self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes[idx][<span class="stringliteral">"Name"</span>]) <span class="keywordflow">for</span> idx <span class="keywordflow">in</span> nodes]
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    88
<a name="l00069"></a>00069     
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    89
<a name="l00070"></a><a class="code" href="classnodelist_1_1NodeList.html#e95b562c7c695ea8c2a3dee38b7c4ef2">00070</a>     <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#e95b562c7c695ea8c2a3dee38b7c4ef2">GetSlaveIDs</a>(self):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    90
<a name="l00071"></a>00071         nodes = self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes.keys()
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    91
<a name="l00072"></a>00072         nodes.sort()
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    92
<a name="l00073"></a>00073         <span class="keywordflow">return</span> nodes
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    93
<a name="l00074"></a>00074         
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    94
<a name="l00075"></a><a class="code" href="classnodelist_1_1NodeList.html#007fad3e7173fb04f35df65d93690c19">00075</a>     <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#007fad3e7173fb04f35df65d93690c19">SetCurrentSelected</a>(self, selected):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    95
<a name="l00076"></a>00076         self.<a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">CurrentSelected</a>CurrentSelected = selected
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    96
<a name="l00077"></a>00077         
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    97
<a name="l00078"></a><a class="code" href="classnodelist_1_1NodeList.html#31139aa84f679ccd6b60c0d2e291cead">00078</a>     <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#31139aa84f679ccd6b60c0d2e291cead">GetCurrentSelected</a>(self):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    98
<a name="l00079"></a>00079         <span class="keywordflow">return</span> self.<a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">CurrentSelected</a>CurrentSelected
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
    99
<a name="l00080"></a>00080             
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   100
<a name="l00081"></a><a class="code" href="classnodelist_1_1NodeList.html#e0c626e2b7b68c2497f77b822b6fa88f">00081</a>     <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#e0c626e2b7b68c2497f77b822b6fa88f">LoadProject</a>(self, root):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   101
<a name="l00082"></a>00082         self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes = {}
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   102
<a name="l00083"></a>00083         self.<a class="code" href="classnodelist_1_1NodeList.html#eb7afd07a98f688686ccc351404978d3">EDSNodes</a>EDSNodes = {}
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   103
<a name="l00084"></a>00084         
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   104
<a name="l00085"></a>00085         self.<a class="code" href="classnodelist_1_1NodeList.html#b2f15765f2bd7a7bc5038102e491e87c">Root</a>Root = root
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   105
<a name="l00086"></a>00086         <span class="keywordflow">if</span> <span class="keywordflow">not</span> os.path.exists(self.<a class="code" href="classnodelist_1_1NodeList.html#b2f15765f2bd7a7bc5038102e491e87c">Root</a>Root):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   106
<a name="l00087"></a>00087             <span class="keywordflow">return</span> <span class="stringliteral">"\"%s\" folder doesn't exist"</span>%self.<a class="code" href="classnodelist_1_1NodeList.html#b2f15765f2bd7a7bc5038102e491e87c">Root</a>Root
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   107
<a name="l00088"></a>00088         
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   108
<a name="l00089"></a><a class="code" href="classnodelist_1_1NodeList.html#85d003455c6b3c98bec4e8602acd3fe0">00089</a>         self.<a class="code" href="classnodelist_1_1NodeList.html#85d003455c6b3c98bec4e8602acd3fe0">EDSFolder</a>EDSFolder = os.path.join(self.<a class="code" href="classnodelist_1_1NodeList.html#b2f15765f2bd7a7bc5038102e491e87c">Root</a>Root, <span class="stringliteral">"eds"</span>)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   109
<a name="l00090"></a>00090         <span class="keywordflow">if</span> <span class="keywordflow">not</span> os.path.exists(self.<a class="code" href="classnodelist_1_1NodeList.html#85d003455c6b3c98bec4e8602acd3fe0">EDSFolder</a>EDSFolder):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   110
<a name="l00091"></a>00091             <span class="keywordflow">return</span> <span class="stringliteral">"\"%s\" folder doesn't contain a \"eds\" folder"</span>%self.<a class="code" href="classnodelist_1_1NodeList.html#b2f15765f2bd7a7bc5038102e491e87c">Root</a>Root
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   111
<a name="l00092"></a>00092         
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   112
<a name="l00093"></a>00093         files = os.listdir(self.<a class="code" href="classnodelist_1_1NodeList.html#85d003455c6b3c98bec4e8602acd3fe0">EDSFolder</a>EDSFolder)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   113
<a name="l00094"></a>00094         <span class="keywordflow">for</span> file <span class="keywordflow">in</span> files:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   114
<a name="l00095"></a>00095             result = self.<a class="code" href="classnodelist_1_1NodeList.html#88cdff50bbef6974b09880f5dd772a26">LoadEDS</a>LoadEDS(file)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   115
<a name="l00096"></a>00096             <span class="keywordflow">if</span> result != <span class="keywordtype">None</span>:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   116
<a name="l00097"></a>00097                 <span class="keywordflow">return</span> result
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   117
<a name="l00098"></a>00098                 
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   118
<a name="l00099"></a>00099         result = self.<a class="code" href="classnodelist_1_1NodeList.html#ff252235b084983f34a6f1455e1ee2a2">LoadMasterNode</a>LoadMasterNode()
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   119
<a name="l00100"></a>00100         <span class="keywordflow">if</span> result != <span class="keywordtype">None</span>:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   120
<a name="l00101"></a>00101             <span class="keywordflow">return</span> result
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   121
<a name="l00102"></a>00102             
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   122
<a name="l00103"></a>00103         result = self.<a class="code" href="classnodelist_1_1NodeList.html#d0b1264363626cc954199e3fa572620a">LoadSlaveNodes</a>LoadSlaveNodes()
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   123
<a name="l00104"></a>00104         <span class="keywordflow">if</span> result != <span class="keywordtype">None</span>:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   124
<a name="l00105"></a>00105             <span class="keywordflow">return</span> result
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   125
<a name="l00106"></a>00106     
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   126
<a name="l00107"></a><a class="code" href="classnodelist_1_1NodeList.html#b90b33e930a1d08ad4bb81f912c30a68">00107</a>     <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#b90b33e930a1d08ad4bb81f912c30a68">SaveProject</a>(self):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   127
<a name="l00108"></a>00108         result = self.<a class="code" href="classnodelist_1_1NodeList.html#d297a4f5ea828c7a56592ffa23ed9913">SaveMasterNode</a>SaveMasterNode()
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   128
<a name="l00109"></a>00109         <span class="keywordflow">if</span> result != <span class="keywordtype">None</span>:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   129
<a name="l00110"></a>00110             <span class="keywordflow">return</span> result
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   130
<a name="l00111"></a>00111             
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   131
<a name="l00112"></a>00112         result = self.<a class="code" href="classnodelist_1_1NodeList.html#b68284c7742c05364af484bbc0b162e6">SaveNodeList</a>SaveNodeList()
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   132
<a name="l00113"></a>00113         <span class="keywordflow">if</span> result != <span class="keywordtype">None</span>:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   133
<a name="l00114"></a>00114             <span class="keywordflow">return</span> result
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   134
<a name="l00115"></a>00115     
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   135
<a name="l00116"></a><a class="code" href="classnodelist_1_1NodeList.html#2bf9abf09b0dd06a8801b9e23f6387cb">00116</a>     <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#2bf9abf09b0dd06a8801b9e23f6387cb">ImportEDSFile</a>(self, edspath):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   136
<a name="l00117"></a>00117         dir, file = os.path.split(edspath)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   137
<a name="l00118"></a>00118         eds = os.path.join(self.<a class="code" href="classnodelist_1_1NodeList.html#85d003455c6b3c98bec4e8602acd3fe0">EDSFolder</a>EDSFolder, file)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   138
<a name="l00119"></a>00119         <span class="keywordflow">if</span> os.path.isfile(eds):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   139
<a name="l00120"></a>00120             <span class="keywordflow">return</span> <span class="stringliteral">"EDS file already imported"</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   140
<a name="l00121"></a>00121         <span class="keywordflow">else</span>:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   141
<a name="l00122"></a>00122             shutil.copy(edspath, self.<a class="code" href="classnodelist_1_1NodeList.html#85d003455c6b3c98bec4e8602acd3fe0">EDSFolder</a>EDSFolder)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   142
<a name="l00123"></a>00123             <span class="keywordflow">return</span> self.<a class="code" href="classnodelist_1_1NodeList.html#88cdff50bbef6974b09880f5dd772a26">LoadEDS</a>LoadEDS(file)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   143
<a name="l00124"></a>00124     
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   144
<a name="l00125"></a><a class="code" href="classnodelist_1_1NodeList.html#88cdff50bbef6974b09880f5dd772a26">00125</a>     <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#88cdff50bbef6974b09880f5dd772a26">LoadEDS</a>(self, eds):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   145
<a name="l00126"></a>00126         edspath = os.path.join(self.<a class="code" href="classnodelist_1_1NodeList.html#85d003455c6b3c98bec4e8602acd3fe0">EDSFolder</a>EDSFolder, eds)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   146
<a name="l00127"></a>00127         node = eds_utils.GenerateNode(edspath, self.<a class="code" href="classnodelist_1_1NodeList.html#629a8a12f02ae1f7d02d0ef7bb0afcbf">Manager</a>Manager.ScriptDirectory)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   147
<a name="l00128"></a>00128         <span class="keywordflow">if</span> isinstance(node, Node):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   148
<a name="l00129"></a>00129             self.<a class="code" href="classnodelist_1_1NodeList.html#eb7afd07a98f688686ccc351404978d3">EDSNodes</a>EDSNodes[eds] = node
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   149
<a name="l00130"></a>00130             <span class="keywordflow">return</span> <span class="keywordtype">None</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   150
<a name="l00131"></a>00131         <span class="keywordflow">else</span>:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   151
<a name="l00132"></a>00132             <span class="keywordflow">return</span> node
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   152
<a name="l00133"></a>00133     
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   153
<a name="l00134"></a><a class="code" href="classnodelist_1_1NodeList.html#4eec8b1c1d88c4806f470f8afcc53e10">00134</a>     <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#4eec8b1c1d88c4806f470f8afcc53e10">AddSlaveNode</a>(self, nodeName, nodeID, eds):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   154
<a name="l00135"></a>00135         <span class="keywordflow">if</span> eds <span class="keywordflow">in</span> self.<a class="code" href="classnodelist_1_1NodeList.html#eb7afd07a98f688686ccc351404978d3">EDSNodes</a>EDSNodes.keys():
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   155
<a name="l00136"></a>00136             slave = {<span class="stringliteral">"Name"</span> : nodeName, <span class="stringliteral">"EDS"</span> : eds, <span class="stringliteral">"Node"</span> : self.<a class="code" href="classnodelist_1_1NodeList.html#eb7afd07a98f688686ccc351404978d3">EDSNodes</a>EDSNodes[eds]}
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   156
<a name="l00137"></a>00137             self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes[nodeID] = slave
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   157
<a name="l00138"></a>00138             <span class="keywordflow">return</span> <span class="keywordtype">None</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   158
<a name="l00139"></a>00139         <span class="keywordflow">else</span>:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   159
<a name="l00140"></a>00140             <span class="keywordflow">return</span> <span class="stringliteral">"\"%s\" EDS file is not available"</span>%eds
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   160
<a name="l00141"></a>00141     
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   161
<a name="l00142"></a><a class="code" href="classnodelist_1_1NodeList.html#4a54d5c47f48af8060e1b7e0a8a52f6d">00142</a>     <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#4a54d5c47f48af8060e1b7e0a8a52f6d">RemoveSlaveNode</a>(self, index):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   162
<a name="l00143"></a>00143         <span class="keywordflow">if</span> index <span class="keywordflow">in</span> self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes.keys():
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   163
<a name="l00144"></a>00144             self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes.pop(index)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   164
<a name="l00145"></a>00145             <span class="keywordflow">return</span> <span class="keywordtype">None</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   165
<a name="l00146"></a>00146         <span class="keywordflow">else</span>:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   166
<a name="l00147"></a>00147             <span class="keywordflow">return</span> <span class="stringliteral">"Node with \"0x%2.2X\" ID doesn't exist"</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   167
<a name="l00148"></a>00148     
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   168
<a name="l00149"></a><a class="code" href="classnodelist_1_1NodeList.html#ff252235b084983f34a6f1455e1ee2a2">00149</a>     <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#ff252235b084983f34a6f1455e1ee2a2">LoadMasterNode</a>(self):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   169
<a name="l00150"></a>00150         masterpath = os.path.join(self.<a class="code" href="classnodelist_1_1NodeList.html#b2f15765f2bd7a7bc5038102e491e87c">Root</a>Root, <span class="stringliteral">"master.od"</span>)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   170
<a name="l00151"></a>00151         <span class="keywordflow">if</span> os.path.isfile(masterpath):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   171
<a name="l00152"></a>00152             self.<a class="code" href="classnodelist_1_1NodeList.html#629a8a12f02ae1f7d02d0ef7bb0afcbf">Manager</a>Manager.OpenFileInCurrent(masterpath)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   172
<a name="l00153"></a>00153         <span class="keywordflow">else</span>:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   173
<a name="l00154"></a>00154             self.<a class="code" href="classnodelist_1_1NodeList.html#629a8a12f02ae1f7d02d0ef7bb0afcbf">Manager</a>Manager.CreateNewNode(<span class="stringliteral">"MasterNode"</span>, 0x00, <span class="stringliteral">"master"</span>, <span class="stringliteral">""</span>, <span class="stringliteral">"None"</span>, <span class="stringliteral">""</span>, <span class="stringliteral">"heartbeat"</span>, [<span class="stringliteral">"DS302"</span>])
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   174
<a name="l00155"></a>00155         <span class="keywordflow">return</span> <span class="keywordtype">None</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   175
<a name="l00156"></a>00156     
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   176
<a name="l00157"></a><a class="code" href="classnodelist_1_1NodeList.html#d297a4f5ea828c7a56592ffa23ed9913">00157</a>     <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#d297a4f5ea828c7a56592ffa23ed9913">SaveMasterNode</a>(self):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   177
<a name="l00158"></a>00158         masterpath = os.path.join(self.<a class="code" href="classnodelist_1_1NodeList.html#b2f15765f2bd7a7bc5038102e491e87c">Root</a>Root, <span class="stringliteral">"master.od"</span>)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   178
<a name="l00159"></a>00159         <span class="keywordflow">if</span> self.<a class="code" href="classnodelist_1_1NodeList.html#629a8a12f02ae1f7d02d0ef7bb0afcbf">Manager</a>Manager.SaveCurrentInFile(masterpath):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   179
<a name="l00160"></a>00160             <span class="keywordflow">return</span> <span class="keywordtype">None</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   180
<a name="l00161"></a>00161         <span class="keywordflow">else</span>:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   181
<a name="l00162"></a>00162             <span class="keywordflow">return</span> <span class="stringliteral">"Fail to save Master Node"</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   182
<a name="l00163"></a>00163     
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   183
<a name="l00164"></a><a class="code" href="classnodelist_1_1NodeList.html#d0b1264363626cc954199e3fa572620a">00164</a>     <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#d0b1264363626cc954199e3fa572620a">LoadSlaveNodes</a>(self):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   184
<a name="l00165"></a>00165         cpjpath = os.path.join(self.<a class="code" href="classnodelist_1_1NodeList.html#b2f15765f2bd7a7bc5038102e491e87c">Root</a>Root, <span class="stringliteral">"nodelist.cpj"</span>)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   185
<a name="l00166"></a>00166         <span class="keywordflow">if</span> os.path.isfile(cpjpath):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   186
<a name="l00167"></a>00167             <span class="keywordflow">try</span>:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   187
<a name="l00168"></a>00168                 networks = eds_utils.ParseCPJFile(cpjpath)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   188
<a name="l00169"></a>00169                 <span class="keywordflow">if</span> len(networks) &gt; 0:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   189
<a name="l00170"></a>00170                     self.<a class="code" href="classnodelist_1_1NodeList.html#267d8efe86849209ff37f59598efcceb">NetworkName</a>NetworkName = networks[0][<span class="stringliteral">"Name"</span>]
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   190
<a name="l00171"></a>00171                     <span class="keywordflow">for</span> nodeid, node <span class="keywordflow">in</span> networks[0][<span class="stringliteral">"Nodes"</span>].items():
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   191
<a name="l00172"></a>00172                         <span class="keywordflow">if</span> node[<span class="stringliteral">"Present"</span>] == 1:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   192
<a name="l00173"></a>00173                             result = self.<a class="code" href="classnodelist_1_1NodeList.html#4eec8b1c1d88c4806f470f8afcc53e10">AddSlaveNode</a>AddSlaveNode(node[<span class="stringliteral">"Name"</span>], nodeid, node[<span class="stringliteral">"DCFName"</span>])
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   193
<a name="l00174"></a>00174                             <span class="keywordflow">if</span> result != <span class="keywordtype">None</span>:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   194
<a name="l00175"></a>00175                                 <span class="keywordflow">return</span> result
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   195
<a name="l00176"></a>00176             <span class="keywordflow">except</span> SyntaxError, message:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   196
<a name="l00177"></a>00177                 <span class="keywordflow">return</span> <span class="stringliteral">"Unable to load CPJ file\n%s"</span>%message
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   197
<a name="l00178"></a>00178         <span class="keywordflow">return</span> <span class="keywordtype">None</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   198
<a name="l00179"></a>00179     
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   199
<a name="l00180"></a><a class="code" href="classnodelist_1_1NodeList.html#b68284c7742c05364af484bbc0b162e6">00180</a>     <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#b68284c7742c05364af484bbc0b162e6">SaveNodeList</a>(self):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   200
<a name="l00181"></a>00181         cpjpath = os.path.join(self.<a class="code" href="classnodelist_1_1NodeList.html#b2f15765f2bd7a7bc5038102e491e87c">Root</a>Root, <span class="stringliteral">"nodelist.cpj"</span>)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   201
<a name="l00182"></a>00182         content = eds_utils.GenerateCPJContent(self)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   202
<a name="l00183"></a>00183         file = open(cpjpath, <span class="stringliteral">"w"</span>)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   203
<a name="l00184"></a>00184         file.write(content)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   204
<a name="l00185"></a>00185         file.close()
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   205
<a name="l00186"></a>00186     
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   206
<a name="l00187"></a><a class="code" href="classnodelist_1_1NodeList.html#305f512d69651d134aaa585e4aed94b8">00187</a>     <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#305f512d69651d134aaa585e4aed94b8">GetSlaveNodeEntry</a>(self, nodeid, index, subindex = None):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   207
<a name="l00188"></a>00188         <span class="keywordflow">if</span> nodeid <span class="keywordflow">in</span> self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes.keys():
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   208
<a name="l00189"></a>00189             self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes[nodeid][<span class="stringliteral">"Node"</span>].SetNodeID(nodeid)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   209
<a name="l00190"></a>00190             <span class="keywordflow">return</span> self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes[nodeid][<span class="stringliteral">"Node"</span>].GetEntry(index, subindex)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   210
<a name="l00191"></a>00191         <span class="keywordflow">else</span>:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   211
<a name="l00192"></a>00192             <span class="keywordflow">return</span> <span class="stringliteral">"Node 0x%2.2X doesn't exist"</span>%nodeid
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   212
<a name="l00193"></a>00193 
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   213
<a name="l00194"></a><a class="code" href="classnodelist_1_1NodeList.html#d3fd973b32423384bc36ddb0cb54c632">00194</a>     <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#d3fd973b32423384bc36ddb0cb54c632">GetMasterNodeEntry</a>(self, index, subindex = None):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   214
<a name="l00195"></a>00195         <span class="keywordflow">return</span> self.<a class="code" href="classnodelist_1_1NodeList.html#629a8a12f02ae1f7d02d0ef7bb0afcbf">Manager</a>Manager.GetCurrentEntry(index, subindex)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   215
<a name="l00196"></a>00196         
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   216
<a name="l00197"></a><a class="code" href="classnodelist_1_1NodeList.html#cc92822b3c2879ac7df9d0b2f39d4647">00197</a>     <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#cc92822b3c2879ac7df9d0b2f39d4647">SetMasterNodeEntry</a>(self, index, subindex = None, value = None):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   217
<a name="l00198"></a>00198         self.<a class="code" href="classnodelist_1_1NodeList.html#629a8a12f02ae1f7d02d0ef7bb0afcbf">Manager</a>Manager.SetCurrentEntry(index, subindex, value)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   218
<a name="l00199"></a>00199     
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   219
<a name="l00200"></a><a class="code" href="classnodelist_1_1NodeList.html#f8812726aa6302532b6c13a2719b1258">00200</a>     <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#f8812726aa6302532b6c13a2719b1258">GetOrderNumber</a>(self, nodeid):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   220
<a name="l00201"></a>00201         nodeindexes = self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes.keys()
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   221
<a name="l00202"></a>00202         nodeindexes.sort()
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   222
<a name="l00203"></a>00203         <span class="keywordflow">return</span> nodeindexes.index(nodeid) + 1
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   223
<a name="l00204"></a>00204     
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   224
<a name="l00205"></a><a class="code" href="classnodelist_1_1NodeList.html#abd3493e147587b88b12e4a6ac7f54e0">00205</a>     <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#abd3493e147587b88b12e4a6ac7f54e0">GetNodeByOrder</a>(self, order):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   225
<a name="l00206"></a>00206         <span class="keywordflow">if</span> order &gt; 0:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   226
<a name="l00207"></a>00207             nodeindexes = self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes.keys()
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   227
<a name="l00208"></a>00208             nodeindexes.sort()
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   228
<a name="l00209"></a>00209             <span class="keywordflow">print</span> nodeindexes
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   229
<a name="l00210"></a>00210             <span class="keywordflow">if</span> order &lt;= len(nodeindexes):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   230
<a name="l00211"></a>00211                 <span class="keywordflow">return</span> self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes[nodeindexes[order - 1]][<span class="stringliteral">"Node"</span>]
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   231
<a name="l00212"></a>00212         <span class="keywordflow">return</span> <span class="keywordtype">None</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   232
<a name="l00213"></a>00213     
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   233
<a name="l00214"></a><a class="code" href="classnodelist_1_1NodeList.html#c44eb93f2e274ab9e3f47380d71d4aef">00214</a>     <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#c44eb93f2e274ab9e3f47380d71d4aef">IsCurrentEntry</a>(self, index):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   234
<a name="l00215"></a>00215         <span class="keywordflow">if</span> self.<a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">CurrentSelected</a>CurrentSelected != <span class="keywordtype">None</span>:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   235
<a name="l00216"></a>00216             <span class="keywordflow">if</span> self.<a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">CurrentSelected</a>CurrentSelected == 0:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   236
<a name="l00217"></a>00217                 <span class="keywordflow">return</span> self.<a class="code" href="classnodelist_1_1NodeList.html#629a8a12f02ae1f7d02d0ef7bb0afcbf">Manager</a>Manager.IsCurrentEntry(index)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   237
<a name="l00218"></a>00218             <span class="keywordflow">else</span>:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   238
<a name="l00219"></a>00219                 node = self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes[self.<a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">CurrentSelected</a>CurrentSelected][<span class="stringliteral">"Node"</span>]
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   239
<a name="l00220"></a>00220                 <span class="keywordflow">if</span> node:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   240
<a name="l00221"></a>00221                     <span class="keywordflow">return</span> node.IsEntry(index)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   241
<a name="l00222"></a>00222         <span class="keywordflow">return</span> <span class="keyword">False</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   242
<a name="l00223"></a>00223     
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   243
<a name="l00224"></a><a class="code" href="classnodelist_1_1NodeList.html#04ede866c9b3431700c7ff4dd87fc67c">00224</a>     <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#04ede866c9b3431700c7ff4dd87fc67c">GetEntryInfos</a>(self, index):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   244
<a name="l00225"></a>00225         <span class="keywordflow">if</span> self.<a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">CurrentSelected</a>CurrentSelected != <span class="keywordtype">None</span>:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   245
<a name="l00226"></a>00226             <span class="keywordflow">if</span> self.<a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">CurrentSelected</a>CurrentSelected == 0:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   246
<a name="l00227"></a>00227                 <span class="keywordflow">return</span> self.<a class="code" href="classnodelist_1_1NodeList.html#629a8a12f02ae1f7d02d0ef7bb0afcbf">Manager</a>Manager.GetEntryInfos(index)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   247
<a name="l00228"></a>00228             <span class="keywordflow">else</span>:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   248
<a name="l00229"></a>00229                 node = self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes[self.<a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">CurrentSelected</a>CurrentSelected][<span class="stringliteral">"Node"</span>]
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   249
<a name="l00230"></a>00230                 <span class="keywordflow">if</span> node:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   250
<a name="l00231"></a>00231                     <span class="keywordflow">return</span> node.GetEntryInfos(index)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   251
<a name="l00232"></a>00232         <span class="keywordflow">return</span> <span class="keywordtype">None</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   252
<a name="l00233"></a>00233 
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   253
<a name="l00234"></a><a class="code" href="classnodelist_1_1NodeList.html#e98e03e88809cf1dec3c4dc3c8921c99">00234</a>     <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#e98e03e88809cf1dec3c4dc3c8921c99">GetCurrentValidIndexes</a>(self, min, max):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   254
<a name="l00235"></a>00235         <span class="keywordflow">if</span> self.<a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">CurrentSelected</a>CurrentSelected != <span class="keywordtype">None</span>:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   255
<a name="l00236"></a>00236             <span class="keywordflow">if</span> self.<a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">CurrentSelected</a>CurrentSelected == 0:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   256
<a name="l00237"></a>00237                 <span class="keywordflow">return</span> self.<a class="code" href="classnodelist_1_1NodeList.html#629a8a12f02ae1f7d02d0ef7bb0afcbf">Manager</a>Manager.GetCurrentValidIndexes(min, max)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   257
<a name="l00238"></a>00238             <span class="keywordflow">else</span>:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   258
<a name="l00239"></a>00239                 node = self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes[self.<a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">CurrentSelected</a>CurrentSelected][<span class="stringliteral">"Node"</span>]
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   259
<a name="l00240"></a>00240                 <span class="keywordflow">if</span> node:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   260
<a name="l00241"></a>00241                     validindexes = []
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   261
<a name="l00242"></a>00242                     <span class="keywordflow">for</span> index <span class="keywordflow">in</span> node.GetIndexes():
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   262
<a name="l00243"></a>00243                         <span class="keywordflow">if</span> min &lt;= index &lt;= max:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   263
<a name="l00244"></a>00244                             validindexes.append((node.GetEntryName(index), index))
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   264
<a name="l00245"></a>00245                     <span class="keywordflow">return</span> validindexes
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   265
<a name="l00246"></a>00246                 <span class="keywordflow">else</span>:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   266
<a name="l00247"></a>00247                     <span class="keywordflow">print</span> <span class="stringliteral">"Can't find node"</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   267
<a name="l00248"></a>00248         <span class="keywordflow">return</span> []
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   268
<a name="l00249"></a>00249     
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   269
<a name="l00250"></a><a class="code" href="classnodelist_1_1NodeList.html#005f913bbbfe322fde2aaef4a1521843">00250</a>     <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#005f913bbbfe322fde2aaef4a1521843">GetCurrentEntryValues</a>(self, index):
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   270
<a name="l00251"></a>00251         <span class="keywordflow">if</span> self.<a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">CurrentSelected</a>CurrentSelected != <span class="keywordtype">None</span>:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   271
<a name="l00252"></a>00252             node = self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes[self.<a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">CurrentSelected</a>CurrentSelected][<span class="stringliteral">"Node"</span>]
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   272
<a name="l00253"></a>00253             <span class="keywordflow">if</span> node:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   273
<a name="l00254"></a>00254                 <span class="keywordflow">return</span> self.<a class="code" href="classnodelist_1_1NodeList.html#629a8a12f02ae1f7d02d0ef7bb0afcbf">Manager</a>Manager.GetNodeEntryValues(node, index)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   274
<a name="l00255"></a>00255             <span class="keywordflow">else</span>:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   275
<a name="l00256"></a>00256                 <span class="keywordflow">print</span> <span class="stringliteral">"Can't find node"</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   276
<a name="l00257"></a>00257         <span class="keywordflow">return</span> [], []
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   277
<a name="l00258"></a>00258     
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   278
<a name="l00259"></a>00259 <span class="keywordflow">if</span> __name__ == <span class="stringliteral">"__main__"</span>:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   279
<a name="l00260"></a>00260     <span class="keyword">from</span> nodemanager <span class="keyword">import</span> *
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   280
<a name="l00261"></a>00261     <span class="keyword">import</span> os, sys, shutil
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   281
<a name="l00262"></a>00262     
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   282
<a name="l00263"></a>00263     manager = NodeManager(sys.path[0])
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   283
<a name="l00264"></a>00264     
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   284
<a name="l00265"></a>00265     nodelist = NodeList(manager)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   285
<a name="l00266"></a>00266     
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   286
<a name="l00267"></a>00267     result = nodelist.LoadProject(<span class="stringliteral">"/home/laurent/test_nodelist"</span>)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   287
<a name="l00268"></a>00268     <span class="keywordflow">if</span> result != <span class="keywordtype">None</span>:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   288
<a name="l00269"></a>00269         <span class="keywordflow">print</span> result
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   289
<a name="l00270"></a>00270     <span class="keywordflow">else</span>:
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   290
<a name="l00271"></a>00271         <span class="keywordflow">print</span> <span class="stringliteral">"MasterNode :"</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   291
<a name="l00272"></a>00272         manager.CurrentNode.Print()
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   292
<a name="l00273"></a>00273         <span class="keywordflow">print</span> 
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   293
<a name="l00274"></a>00274         <span class="keywordflow">for</span> nodeid, node <span class="keywordflow">in</span> nodelist.SlaveNodes.items():
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   294
<a name="l00275"></a>00275             <span class="keywordflow">print</span> <span class="stringliteral">"SlaveNode name=%s id=0x%2.2X :"</span>%(node[<span class="stringliteral">"Name"</span>], nodeid)
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   295
<a name="l00276"></a>00276             node[<span class="stringliteral">"Node"</span>].Print()
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   296
<a name="l00277"></a>00277             <span class="keywordflow">print</span>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   297
<a name="l00278"></a>00278 
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   298
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Mon Jun 4 16:29:06 2007 for CanFestival by&nbsp;
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   299
<a href="http://www.doxygen.org/index.html">
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   300
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   301
</body>
b6572d0336c3 First doxygen implementation
nico
parents:
diff changeset
   302
</html>