22 wxPython, OGL を用いたコンポーネント図形表示画面 28 import wx.lib.colourdb
30 import RtmLineUtil
as lu
35 from RtmDialog
import *
44 SELECTED_COLOR =
"LIGHT BLUE" 45 UNLOADED_COLOR =
"black" 46 INACTIVE_COLOR =
"blue" 47 ACTIVE_COLOR =
"green" 54 VIRTUAL_COLOR =
"WHITE" 66 strDEL_SELECT =
"Delete Selected Item" 67 strREFRESH =
"Refresh" 68 strOPEN =
"Open System" 69 strSAVE =
"Save System" 70 strSAVE_AS =
"Save System As" 71 strDEL_SYS =
"Current System is Deleted when OPEN.\nDelete It?" 79 strDELITEM =
"Delete Item" 82 strASM_CONNECT =
"Connect" 83 strASM_DELETE =
"Delete" 86 strASKMESSAGE =
"Old Connection Information was found.\nDelete it and reconnect?" 90 strSAVE_AS_TITLE =
"Save file as ..." 92 strOPEN_TITLE =
"Open a file" 96 """ドラッグ&ドロップ:コンポーネントのツリー画面からテキストデータを受け取るクラス""" 98 """クラスの初期化(TextDropTargetの作成)
[引数]
parent -- 親クラス
log -- ログ出力用クラス(wx.LogMessageのラッパー)
[戻り値]
void
102 log -- ログ出力用クラス(wx.LogMessageのラッパー)
[戻り値]
void
107 wx.TextDropTarget.__init__(self)
112 """ドロップ機能のイベントハンドラ 別ウィンドウからのドロップ操作で文字列を受け取る
[引数]
x -- マウスカーソルのx座標
y -- マウスカーソルのy座標
text -- ドロップされた文字列(現時点はコンポーネント名)
[戻り値]
void
113 別ウィンドウからのドロップ操作で文字列を受け取る
[引数]
x -- マウスカーソルのx座標
y -- マウスカーソルのy座標
text -- ドロップされた文字列(現時点はコンポーネント名)
[戻り値]
void
118 text -- ドロップされた文字列(現時点はコンポーネント名)
[戻り値]
void
123 self.
log.WriteText(
"(%d, %d)\n%s\n" % (x, y, text))
124 canvas = self.
parent.diagram.GetCanvas()
125 dc = wx.ClientDC(self.
parent)
130 if text
not in self.
parent.rtc_dict.keys():
133 ref = self.
parent.frame.myDict.GetObjRefToFullpath(text)
134 kind = self.
parent.frame.myDict.GetKindToFullpath(text)
135 if ref !=
None and kind ==
'rtc':
137 self.
parent.rtc_list.append(text)
138 self.
parent.rtc_dict[text].refresh()
141 print "error: Drag Item does not obj-ref!" 146 """ドラッグ通知?イベントハンドラ マウスカーソルがターゲット上に来たら呼び出される
[引数]
x -- マウスカーソルのx座標
y -- マウスカーソルのy座標
d -- SHIFT or CONTROL 押下時のフラグ
[戻り値]
wxDragResult -- ドラッグの状態を(システムに?)通知する
147 マウスカーソルがターゲット上に来たら呼び出される
[引数]
x -- マウスカーソルのx座標
y -- マウスカーソルのy座標
d -- SHIFT or CONTROL 押下時のフラグ
[戻り値]
wxDragResult -- ドラッグの状態を(システムに?)通知する
152 d -- SHIFT or CONTROL 押下時のフラグ 155 wxDragResult -- ドラッグの状態を(システムに?)通知する 161 """メモリDC(BufferedDC)を設定、取得する関数
[引数]
canvas -- キャンバス
[戻り値]
dc -- BufferedDC
169 cdc = wx.ClientDC(canvas)
170 canvas.PrepareDC(cdc)
171 bufSize = wx.Size(1000, 1000)
172 dc = wx.BufferedDC(cdc, bufSize)
174 dc.SetBackground(wx.Brush(canvas.GetBackgroundColour()))
179 """コンポーネントの状態で図形の色を変更する関数
[引数]
shape -- 図形(Shape)オブジェクト
colorFlag -- コンポーネントの状態を示す文字列
select, unloaded, inactive, active, error, virtual
[戻り値]
void
182 shape -- 図形(Shape)オブジェクト colorFlag -- コンポーネントの状態を示す文字列
select, unloaded, inactive, active, error, virtual
[戻り値]
void
183 colorFlag -- コンポーネントの状態を示す文字列 select, unloaded, inactive, active, error, virtual
[戻り値]
void
184 select, unloaded, inactive, active, error, virtual 189 if colorFlag ==
'select':
190 shape.SetBrush(wx.Brush(wx.NamedColor(SELECTED_COLOR)))
191 elif colorFlag ==
'unloaded':
192 shape.SetBrush(wx.Brush(wx.NamedColor(UNLOADED_COLOR)))
193 elif colorFlag ==
'inactive':
194 shape.SetBrush(wx.Brush(wx.NamedColor(INACTIVE_COLOR)))
195 elif colorFlag ==
'active':
196 shape.SetBrush(wx.Brush(wx.NamedColor(ACTIVE_COLOR)))
197 elif colorFlag ==
'error':
198 shape.SetBrush(wx.Brush(wx.NamedColor(ERROR_COLOR)))
199 elif colorFlag ==
'virtual':
200 shape.SetBrush(wx.Brush(wx.NamedColor(VIRTUAL_COLOR)))
202 shape.SetBrush(wx.Brush(colorFlag))
208 """CompositeShapeのラッパークラス""" 210 """クラスの初期化(CompositeShapeの作成)
[引数]
parent -- 親クラスを指定
[戻り値]
void
213 parent -- 親クラスを指定
[戻り値]
void
218 ogl.CompositeShape.__init__(self)
223 """2点間の線を描画するラッパークラス""" 225 """クラスの初期化(LineShapeの作成)
[引数]
parent -- 親クラスを指定
canvas -- ShapeCanvasオブジェクトを指定。
[戻り値]
void
228 parent -- 親クラスを指定 canvas -- ShapeCanvasオブジェクトを指定。
[戻り値]
void
229 canvas -- ShapeCanvasオブジェクトを指定。 234 ogl.LineShape.__init__(self)
236 self.SetCanvas(canvas)
237 self.SetPen(wx.Pen(wx.BLUE, 1))
239 self.MakeLineControlPoints(2)
240 diagram = canvas.GetDiagram()
241 diagram.AddShape(self)
244 """開始、終了座標を指定し線を作成する
[引数]
startX -- 線を描画開始するx座標
startY -- 線を描画開始するy座標
endX -- 線を描画終了するx座標
endY -- 線を描画終了するy座標
[戻り値]
void
247 startX -- 線を描画開始するx座標 248 startY -- 線を描画開始するy座標 255 self.SetEnds(startX, startY, endX, endY)
259 """四角形を描画するラッパークラス""" 261 """クラスの初期化(Rectangle作成)
[引数]
parent -- 親クラスを指定
width -- 四角形の幅
height -- 四角形の高さ
[戻り値]
void
264 parent -- 親クラスを指定 width -- 四角形の幅
height -- 四角形の高さ
[戻り値]
void
265 width -- 四角形の幅 height -- 四角形の高さ
[戻り値]
void
271 ogl.RectangleShape.__init__(self,width, height)
279 """インポート図形(polygon)描画用クラス""" 281 """クラスの初期化(PolygonShapeの作成)
[引数]
parent -- 親クラスを指定
points -- タプルで連続した(x,y)座標(wxPoints型)を指定
[戻り値]
void
284 parent -- 親クラスを指定 points -- タプルで連続した(x,y)座標(wxPoints型)を指定
[戻り値]
void
285 points -- タプルで連続した(x,y)座標(wxPoints型)を指定
[戻り値]
void
290 ogl.PolygonShape.__init__(self)
294 self.CalculatePolygonCentre()
297 """インポート図形(polygon)の再描画(座標再指定)
[引数]
points -- タプルで連続した(x,y)座標(wxPoints型)を指定
[戻り値]
void
300 points -- タプルで連続した(x,y)座標(wxPoints型)を指定
[戻り値]
void
306 self.UpdateOriginalPoints()
307 self.CalculatePolygonCentre()
311 """アウトポート図形(polygon)描画用クラス""" 313 """クラスの初期化(PolygonShapeの作成)
[引数]
parent -- 親クラスを指定
points -- タプルで連続した(x,y)座標(wxPoints型)を指定
[戻り値]
void
316 parent -- 親クラスを指定 points -- タプルで連続した(x,y)座標(wxPoints型)を指定
[戻り値]
void
317 points -- タプルで連続した(x,y)座標(wxPoints型)を指定
[戻り値]
void
322 ogl.PolygonShape.__init__(self)
326 self.CalculatePolygonCentre()
329 """アウトポート図形(polygon)の再描画(座標再指定)
[引数]
points -- タプルで連続した(x,y)座標(wxPoints型)を指定
[戻り値]
void
332 points -- タプルで連続した(x,y)座標(wxPoints型)を指定
[戻り値]
void
338 self.UpdateOriginalPoints()
339 self.CalculatePolygonCentre()
344 def __init__(self, parent, pos_x, pos_y, width, height):
345 """クラスの初期化(EllipseShapeの作成)
[引数]
parent -- 親クラスを指定
pos_x -- 描画するx座標
pos_y -- 描画するy座標
width -- 楕円の幅
height -- 楕円の高さ
[戻り値]
void
348 parent -- 親クラスを指定 pos_x -- 描画するx座標
pos_y -- 描画するy座標
width -- 楕円の幅
height -- 楕円の高さ
[戻り値]
void
351 width -- 楕円の幅 height -- 楕円の高さ
[戻り値]
void
357 ogl.EllipseShape.__init__(self, width, height)
365 self.SetPen(wx.Pen(wx.BLACK, 1))
366 self.SetBrush(wx.Brush(
'red'))
372 """クラスの初期化(TextShapeの作成)
[引数]
parent -- 親クラスを指定する
width -- テキスト描画エリアの幅
height -- テキスト描画エリアの高さ
[戻り値]
void
375 parent -- 親クラスを指定する width -- テキスト描画エリアの幅
height -- テキスト描画エリアの高さ
[戻り値]
void
376 width -- テキスト描画エリアの幅 height -- テキスト描画エリアの高さ
[戻り値]
void
377 height -- テキスト描画エリアの高さ 382 ogl.TextShape.__init__(self,width, height)
387 """ツールチップ(バルーンヘルプ)図形を生成するクラス""" 389 """クラスの初期化(ツールチップの作成)
[引数]
parent -- 親クラスを指定する
pt -- ツールチップを表示する座標(x,y)のタプルで指定
dc -- 描画するデバイス・コンテキストを指定
[戻り値]
void
392 parent -- 親クラスを指定する pt -- ツールチップを表示する座標(x,y)のタプルで指定
dc -- 描画するデバイス・コンテキストを指定
[戻り値]
void
393 pt -- ツールチップを表示する座標(x,y)のタプルで指定 dc -- 描画するデバイス・コンテキストを指定
[戻り値]
void
394 dc -- 描画するデバイス・コンテキストを指定
[戻り値]
void
406 if parent.tag ==
'in':
407 string1 = parent.inport[
'name']
408 string2 = parent.inport[
'port_type']
410 string1 = parent.outport[
'name']
411 string2 = parent.outport[
'port_type']
412 atr =
'%s\n%s'%(string1, string2)
414 tmp = max(len(string1), len(string2))
416 charW = dc.GetCharWidth()
417 charH = dc.GetCharHeight()
422 self.
body.AddText(atr)
424 self.
body.FormatText(dc,atr,0)
425 self.
body.SetDraggable(
False,
False)
429 self.
body.SetPen(wx.Pen(wx.RED, 1))
430 self.
body.SetBrush(wx.Brush(wx.NamedColor(BACK_COLOR)))
433 """ツールチップ図形をキャンバス、DC上から削除
[引数]
dc -- 描画されているデバイス・コンテキストを指定
[戻り値]
void
436 dc -- 描画されているデバイス・コンテキストを指定
[戻り値]
void
441 canvas = self.
body.GetCanvas()
443 self.
body.RemoveFromCanvas(canvas)
447 """線の移動用の円を生成するクラス""" 449 """クラスの初期化(円を作成)
[引数]
parent -- 親クラスを指定する
tag -- 識別子(連番,線との関係を表すフラグ)を指定
※連番は、線を格納する配列の添え字と連係している
pos_x -- 表示するx座標を指定
pos_y -- 表示するy座標を指定
[戻り値]
void
452 parent -- 親クラスを指定する tag -- 識別子(連番,線との関係を表すフラグ)を指定
※連番は、線を格納する配列の添え字と連係している
pos_x -- 表示するx座標を指定
pos_y -- 表示するy座標を指定
[戻り値]
void
453 tag -- 識別子(連番,線との関係を表すフラグ)を指定 ※連番は、線を格納する配列の添え字と連係している
pos_x -- 表示するx座標を指定
pos_y -- 表示するy座標を指定
[戻り値]
void
454 ※連番は、線を格納する配列の添え字と連係している pos_x -- 表示するx座標を指定
pos_y -- 表示するy座標を指定
[戻り値]
void
455 pos_x -- 表示するx座標を指定 pos_y -- 表示するy座標を指定
[戻り値]
void
456 pos_y -- 表示するy座標を指定
[戻り値]
void
479 """円をキャンバス、DC上から削除
[引数]
dc -- 描画するデバイス・コンテキストを指定
[戻り値]
void
482 dc -- 描画するデバイス・コンテキストを指定
[戻り値]
void
487 canvas = self.
body.GetCanvas()
489 self.
body.RemoveFromCanvas(canvas)
495 dc -- 描画するデバイス・コンテキストを指定 d_x -- x座標の相対移動量 (endPoint.x - startPoint.x の値)
d_y -- y座標の相対移動量 (endPoint.y - startPoint.y の値)
[戻り値]
void
496 d_x -- x座標の相対移動量 (endPoint.x - startPoint.x の値) d_y -- y座標の相対移動量 (endPoint.y - startPoint.y の値)
[戻り値]
void
497 d_y -- y座標の相対移動量 (endPoint.y - startPoint.y の値)
[戻り値]
void
502 canvas = self.
body.GetCanvas()
506 oval_id = oval_tag[0]
512 if oval_tag[1] ==
'oval_width_pos':
520 line.lines[oval_id].Move(dc, self.
pos_x, self.
pos_y)
521 x1,y1,x2,y2 = line.lines[oval_id].GetEnds()
522 line.changeCoordT(oval_id, (x1, y1), (x2, y2) )
527 for x
in range(1,len(line.oval_dict)+1):
528 tag = line.oval_dict[x].
getTag()
529 if oval_id != tag[0]:
530 line_pos_0 = line.coordT[x]
531 line_pos_1 = line.coordT[x+1]
533 if tag[1] ==
'oval_width_pos':
534 hight = line_pos_0[1] - line_pos_1[1]
535 pos_y = line_pos_1[1] + (hight/2)
536 pos_x = line_pos_0[0]
538 width = line_pos_0[0] - line_pos_1[0]
539 pos_x = line_pos_1[0] + (width/2)
540 pos_y = line_pos_1[1]
542 line.oval_dict[x].body.Move(dc, pos_x, pos_y)
545 """タグの取得
[引数]
なし
[戻り値]
tag -- 識別子(連番,線との関係を表すフラグ)を返却
※連番は、線を格納する配列の添え字と連係している
551 tag -- 識別子(連番,線との関係を表すフラグ)を返却 ※連番は、線を格納する配列の添え字と連係している
552 ※連番は、線を格納する配列の添え字と連係している 563 canvas -- 描画するキャンバスを指定 parent -- 親クラスを指定する
[戻り値]
void
564 parent -- 親クラスを指定する
[戻り値]
void
578 self.
idx =
'L' + `canvas.line_idx`
587 """リフレッシュ処理 線及び移動用の円を非選択状態にする
[引数]
なし
[戻り値]
void
588 線及び移動用の円を非選択状態にする
[引数]
なし
[戻り値]
void
596 canvas = self.body.GetCanvas()
597 dc = wx.ClientDC(canvas)
602 """線および移動用の円をキャンバス、DC上から削除する
[引数]
dc -- 描画されているデバイス・コンテキストを指定
canvas -- 描画されているキャンバスを指定
[戻り値]
void
605 dc -- 描画されているデバイス・コンテキストを指定 canvas -- 描画されているキャンバスを指定
[戻り値]
void
606 canvas -- 描画されているキャンバスを指定
[戻り値]
void
611 for x
in range(len(self.
lines)):
612 self.
lines[x].Unlink()
613 self.
lines[x].Erase(dc)
614 self.
lines[x].DeleteControlPoints()
615 self.
lines[x].RemoveFromCanvas(canvas)
621 """線の削除 関連するInport/Outportの情報(色、unsubscribe)の更新処理を呼び出す
[引数]
dc -- 描画するデバイス・コンテキストを指定
[戻り値]
void
622 関連するInport/Outportの情報(色、unsubscribe)の更新処理を呼び出す 625 dc -- 描画するデバイス・コンテキストを指定
[戻り値]
void
631 if len(self.
g_inp.line_idx) == 1:
634 if len(self.
g_outp.line_idx) == 1:
636 canvas = self.
lines[0].GetCanvas()
640 if self.
g_inp !=
None:
663 for cnt
in range(num-1):
670 for x
in range(len(self.
lines)):
673 evthandler2.SetShape(self.
lines[x])
674 evthandler2.SetPreviousHandler(self.
lines[x].GetEventHandler())
675 self.
lines[x].SetEventHandler(evthandler2)
690 lineUtil = lu.LineUtil(self, self.
g_inp, self.
g_outp, startX, startY, endX, endY)
691 self.
coordT = lineUtil.drawLine()
702 """線の開始点を再設定(開始点の移動)
[引数]
dc -- 描画するデバイス・コンテキストを指定
movex -- 開始点x座標の相対移動量
movey -- 開始点y座標の相対移動量
[戻り値]
void
705 dc -- 描画するデバイス・コンテキストを指定 movex -- 開始点x座標の相対移動量
movey -- 開始点y座標の相対移動量
[戻り値]
void
706 movex -- 開始点x座標の相対移動量 707 movey -- 開始点y座標の相対移動量 712 canvas = self.
lines[0].GetCanvas()
714 for x
in range(len(self.
lines)):
715 self.
lines[x].Erase(dc)
716 self.
lines[x].RemoveFromCanvas(canvas)
725 for x
in range(len(self.
lines)):
726 self.
lines[x].Show(
True)
729 """線の終了点を再設定(終了点の移動)
[引数]
dc -- 描画するデバイス・コンテキストを指定
movex -- 終了点x座標の相対移動量
movey -- 終了点y座標の相対移動量
[戻り値]
void
732 dc -- 描画するデバイス・コンテキストを指定 movex -- 終了点x座標の相対移動量
movey -- 終了点y座標の相対移動量
[戻り値]
void
733 movex -- 終了点x座標の相対移動量 734 movey -- 終了点y座標の相対移動量 739 canvas = self.
lines[0].GetCanvas()
741 for x
in range(len(self.
lines)):
742 self.
lines[x].Erase(dc)
743 self.
lines[x].RemoveFromCanvas(canvas)
752 for x
in range(len(self.
lines)):
753 self.
lines[x].Show(
True)
756 """線の選択処理(色の変更)
[引数]
なし
[戻り値]
void
764 for x
in range(len(self.
lines)):
765 self.
lines[x].SetBrush(wx.Brush(wx.NamedColor(SELECTED_COLOR)))
766 self.
lines[x].SetPen(wx.Pen(SELECTED_COLOR, 1))
767 self.
lines[x].Flash()
770 """線の選択解除処理(色の変更、移動用の円を削除)
[引数]
なし
[戻り値]
void
778 for x
in range(len(self.
lines)):
779 self.
lines[x].SetPen(wx.Pen(INACTIVE_COLOR, 1))
780 self.
lines[x].SetBrush(wx.Brush(wx.NamedColor(INACTIVE_COLOR)))
781 self.
lines[x].Flash()
786 """移動処理のダミールーチン
[引数]
dc -- DCを指定
movex -- 移動時の相対距離
movey -- 移動時の相対距離
[戻り値]
void
789 dc -- DCを指定 movex -- 移動時の相対距離
movey -- 移動時の相対距離
[戻り値]
void
800 線を引く2つのポートをあらかじめ指定し本メソッドを呼び出す。 801 canvas.lineTo, canvas.lineFrom にポートを設定しておく。 804 canvas -- 線を描画するキャンバスを指定 dc -- 線を描画するDCを指定
[戻り値]
void
805 dc -- 線を描画するDCを指定
[戻り値]
void
811 ref = canvas.lineTo.parent.ns_dict.GetObjRefToFullpath(canvas.lineTo.parent.fullpath)
814 if canvas.lineFrom.parent.tag ==
'in':
815 self.g_inp = canvas.lineFrom.parent
816 self.g_outp = canvas.lineTo.parent
818 self.g_inp = canvas.lineTo.parent
819 self.g_outp = canvas.lineFrom.parent
821 self.setPoints(self.g_inp.body.GetX(), self.g_inp.body.GetY(), self.g_outp.body.GetX(), self.g_outp.body.GetY())
822 for x
in range(len(self.lines)):
823 evthandler2 = MyEvtHandlerLine()
824 evthandler2.SetShape(self.lines[x])
825 evthandler2.SetPreviousHandler(self.lines[x].GetEventHandler())
826 self.lines[x].SetEventHandler(evthandler2)
829 canvas.line[self.idx] = self
830 self.g_inp.connect(self.idx)
831 canvas.line_idx = canvas.line_idx + 1
832 for x
in range(len(self.lines)):
833 self.lines[x].Show(
True)
835 self.g_inp.body.Move(dc, self.g_inp.body.GetX(), self.g_inp.body.GetY())
836 self.g_outp.body.Move(dc, self.g_outp.body.GetX(), self.g_outp.body.GetY())
841 """線移動時に移動した線の座標を再設定
[引数]
id -- 座標を再設定する開始インデックス(添え字)
new_p1 -- 新しい座標(x,y)の開始点をタプルで指定
new_p2 -- 新しい座標(x,y)の終了点をタプルで指定
[戻り値]
void
844 id -- 座標を再設定する開始インデックス(添え字) new_p1 -- 新しい座標(x,y)の開始点をタプルで指定
new_p2 -- 新しい座標(x,y)の終了点をタプルで指定
[戻り値]
void
845 new_p1 -- 新しい座標(x,y)の開始点をタプルで指定 new_p2 -- 新しい座標(x,y)の終了点をタプルで指定
[戻り値]
void
846 new_p2 -- 新しい座標(x,y)の終了点をタプルで指定
[戻り値]
void
852 self.
coordT[id+1] = new_p2
855 for cnt
in range(num-1):
862 dc -- 描画するデバイス・コンテキストを指定 pos_new -- 移動後の座標リスト
[戻り値]
void
863 pos_new -- 移動後の座標リスト
[戻り値]
void
870 max_num = len(pos_new)
875 for cnt
in range(max_num-1):
880 """インポート図形を作成するクラス""" 881 def __init__(self, parent, ns_dict, fullpath, inp, pos_x, pos_y):
882 """クラスの初期化(インポート図形の作成)
[引数]
parent -- 親クラスを指定する
ns_data -- コンポーネントのディクショナリー
inp -- インポートのディクショナリー(in_list[n])
pos_x -- インポート図形のx座標
pos_y -- インポート図形のy座標
[戻り値]
void
885 parent -- 親クラスを指定する ns_data -- コンポーネントのディクショナリー
inp -- インポートのディクショナリー(in_list[n])
pos_x -- インポート図形のx座標
pos_y -- インポート図形のy座標
[戻り値]
void
886 ns_data -- コンポーネントのディクショナリー 887 inp -- インポートのディクショナリー(in_list[n]) 894 ogl.Shape.__init__(self)
912 """x,y座標もしくはpositionを取得する
[引数]
name -- 取得したい値のフラグを指定する
フラグ: 915 name -- 取得したい値のフラグを指定する フラグ: 916 フラグ:'x', 'y', 'position' 925 elif name ==
'position' :
931 """インポート図形をキャンバス、DC上から削除する
[引数]
dc -- 描画するデバイス・コンテキストを指定
rot -- 線の削除可否を指定する。(回転処理等で使用)
0:線を削除 / 1:線を削除しない
[戻り値]
void
934 dc -- 描画するデバイス・コンテキストを指定 rot -- 線の削除可否を指定する。(回転処理等で使用)
0:線を削除 / 1:線を削除しない
[戻り値]
void
935 rot -- 線の削除可否を指定する。(回転処理等で使用) 0:線を削除 / 1:線を削除しない
[戻り値]
void
941 canvas = self.
body.GetCanvas()
943 self.
body.RemoveFromCanvas(canvas)
947 line_list = copy.deepcopy(self.
line_idx)
948 for idx
in line_list:
950 if idx
in canvas.line.keys():
955 """インポート図形を生成する
[引数]
なし
[戻り値]
void
969 self.
parent.parent.MyAddShape(
970 self.
body, self.
x+POLYGON_SIZE/2-1, self.
y+POLYGON_SIZE/2-1, wx.Pen(OUTLINE_COLOR, 1), wx.Brush(self.
color, wx.SOLID),
"" , 1)
974 インポートに割り付けられている線も同時に移動させる
[引数]
dc -- 描画するデバイス・コンテキストを指定
movex -- x座標の相対移動量を指定
movey -- y座標の相対移動量を指定
[戻り値]
void
977 dc -- 描画するデバイス・コンテキストを指定 movex -- x座標の相対移動量を指定
movey -- y座標の相対移動量を指定
[戻り値]
void
978 movex -- x座標の相対移動量を指定 movey -- y座標の相対移動量を指定
[戻り値]
void
979 movey -- y座標の相対移動量を指定
[戻り値]
void
984 canvas = self.
body.GetCanvas()
988 self.
x = self.
body.GetX() + movex
989 self.
y = self.
body.GetY() + movey
990 self.
body.Move(dc, self.
x, self.
y)
994 canvas.line[line_index].setStartPoint(dc, movex, movey)
997 """インポートに割り付けた線のインデックスを削除する
[引数]
idx -- 線のインデックス
[戻り値]
void
1010 """インポートを選択状態にする
[引数]
なし
[戻り値]
void
1018 self.
body.SetBrush(wx.Brush(wx.NamedColor(SELECTED_COLOR)))
1022 """インポートを非選択状態にする
[引数]
なし
[戻り値]
void
1030 self.
body.SetBrush(wx.Brush(wx.NamedColor(self.
color)))
1037 x -- サイズ変更後のx座標を指定 y -- サイズ変更後のy座標を指定
ratioW -- サイズ変更を行うWidthのサイズ比率
ratioH -- サイズ変更を行うHeightのサイズ比率
[戻り値]
void
1038 y -- サイズ変更後のy座標を指定 ratioW -- サイズ変更を行うWidthのサイズ比率
ratioH -- サイズ変更を行うHeightのサイズ比率
[戻り値]
void
1039 ratioW -- サイズ変更を行うWidthのサイズ比率 1040 ratioH -- サイズ変更を行うHeightのサイズ比率 1045 movex = x - self.
body.GetX()
1046 movey = y - self.
body.GetY()
1050 if self.
parent.xy_swap == 1:
1059 canvas = self.
body.GetCanvas()
1060 dc = wx.ClientDC(canvas)
1061 canvas.PrepareDC(dc)
1062 brush = self.
body.GetBrush()
1065 self.
body.RemoveFromCanvas(canvas)
1070 self.
parent.parent.MyAddShape(
1071 self.
body, self.
x , self.
y,
1072 wx.Pen(OUTLINE_COLOR, 1), brush,
"" , 1)
1076 canvas.line[line_index].setStartPoint(dc, movex, movey)
1079 """コネクト処理(線のインデックスを格納)
[引数]
line_idx -- インポートに接続する線のインデックス
[戻り値]
成否フラグ -- 0:エラー(オブジェクトリファレンス無し) / 1:成功
1082 line_idx -- インポートに接続する線のインデックス 1085 成否フラグ -- 0:エラー(オブジェクトリファレンス無し) / 1:成功 1095 """ディスコネクト処理(線のインデックスを削除)
[引数]
line_idx -- インポートに接続している線のインデックス
[戻り値]
成否フラグ -- 0:エラー / 1:成功
1098 line_idx -- インポートに接続している線のインデックス 1101 成否フラグ -- 0:エラー / 1:成功 1111 現在のpositionを見て図形の向きを決定する 各頂点は(x,y)のタプル形式
[引数]
なし
[戻り値]
void
1155 """アウトポート図形を作成するクラス""" 1156 def __init__(self, parent, ns_dict, fullpath, outp, pos_x, pos_y) :
1157 """クラスの初期化(アウトポート図形の作成)
[引数]
parent -- 親クラスを指定する
ns_data -- コンポーネントのディクショナリー
inp -- インポートのディクショナリー(in_list[n])
pos_x -- インポート図形のx座標
pos_y -- インポート図形のy座標
[戻り値]
void
1160 parent -- 親クラスを指定する ns_data -- コンポーネントのディクショナリー
inp -- インポートのディクショナリー(in_list[n])
pos_x -- インポート図形のx座標
pos_y -- インポート図形のy座標
[戻り値]
void
1161 ns_data -- コンポーネントのディクショナリー 1162 inp -- インポートのディクショナリー(in_list[n]) 1163 pos_x -- インポート図形のx座標 1164 pos_y -- インポート図形のy座標 1169 ogl.Shape.__init__(self)
1189 """リフレッシュ処理 現在の接続状況(Inportのオブジェクトリファレンスが存在するか?)を
チェックし、接続状態を継続もしくはunsubscribeを実行する
[引数]
なし
[戻り値]
void
1190 現在の接続状況(Inportのオブジェクトリファレンスが存在するか?)を チェックし、接続状態を継続もしくはunsubscribeを実行する
[引数]
なし
[戻り値]
void
1191 チェックし、接続状態を継続もしくはunsubscribeを実行する
[引数]
なし
[戻り値]
void
1199 canvas = self.
body.GetCanvas()
1200 if canvas.viewMode ==
True:
1203 dc = wx.ClientDC(canvas)
1204 canvas.PrepareDC(dc)
1210 for inp
in self.
parent.in_list :
1211 if inp[
'name'] == canvas.line[idx].g_inp.inport[
'name']:
1212 canvas.line[idx].g_inp.inport = inp
1215 ref = canvas.line[idx].g_inp.inport[
'ref']
1216 ref = ref._narrow(RTM.InPort)
1218 except_mess(
'inport object-ref failure:%s\n'%inp[
'name'])
1222 ref = ref._narrow(RTM.OutPort)
1223 rslt = ref.unsubscribe(self.
uuid[idx])
1224 print "refresh:unsubscribe:",rslt
1226 print 'unsubscribe failure: rslt=',rslt
1231 """x,y座標もしくはpositionを取得する
[引数]
name -- 取得したい値のフラグを指定する
フラグ: 1234 name -- 取得したい値のフラグを指定する フラグ: 1235 フラグ:'x', 'y', 'position' 1244 elif name ==
'position' :
1250 """アウトポート図形を削除する
[引数]
dc -- 描画するデバイス・コンテキストを指定
rot -- 線の削除可否を指定する。(回転処理等で使用)
0:線を削除 / 1:線を削除しない
[戻り値]
void
1253 dc -- 描画するデバイス・コンテキストを指定 rot -- 線の削除可否を指定する。(回転処理等で使用)
0:線を削除 / 1:線を削除しない
[戻り値]
void
1254 rot -- 線の削除可否を指定する。(回転処理等で使用) 0:線を削除 / 1:線を削除しない
[戻り値]
void
1260 canvas = self.
body.GetCanvas()
1262 self.
body.RemoveFromCanvas(canvas)
1266 line_list = copy.deepcopy(self.
line_idx)
1267 for idx
in line_list:
1269 if idx
in canvas.line.keys():
1270 del canvas.line[idx]
1274 """アウトポート図形を作成する
[引数]
なし
[戻り値]
void
1288 self.
parent.parent.MyAddShape(
1289 self.
body, self.
x+POLYGON_SIZE/2-1, self.
y+POLYGON_SIZE/2-1, wx.Pen(OUTLINE_COLOR, 1), wx.Brush(self.
color, wx.SOLID),
"",1)
1293 アウトポートに割り付けられている線も同時に移動させる
[引数]
dc -- 描画するデバイス・コンテキストを指定
movex -- x座標の相対移動量を指定
movey -- y座標の相対移動量を指定
[戻り値]
void
1296 dc -- 描画するデバイス・コンテキストを指定 movex -- x座標の相対移動量を指定
movey -- y座標の相対移動量を指定
[戻り値]
void
1297 movex -- x座標の相対移動量を指定 movey -- y座標の相対移動量を指定
[戻り値]
void
1298 movey -- y座標の相対移動量を指定
[戻り値]
void
1303 canvas = self.
body.GetCanvas()
1304 canvas.PrepareDC(dc)
1306 self.
x = self.
body.GetX() + movex
1307 self.
y = self.
body.GetY() + movey
1309 self.
body.Move(dc, self.
x, self.
y)
1314 canvas.line[line_index].setEndPoint(dc, self.
body,movex, movey)
1318 """アウトポートに割り付けた線のインデックスを削除する
[引数]
idx -- 線のインデックス
[戻り値]
void
1331 """アウトポートを選択状態にする
[引数]
なし
[戻り値]
void
1339 self.
body.SetBrush(wx.Brush(wx.NamedColor(SELECTED_COLOR)))
1343 """アウトポートを非選択状態にする
[引数]
なし
[戻り値]
void
1351 self.
body.SetBrush(wx.Brush(wx.NamedColor(self.
color)))
1358 x -- サイズ変更後のx座標を指定 y -- サイズ変更後のy座標を指定
ratioW -- 変更を行うWidthのサイズ比率
ratioH -- 変更を行うHeightのサイズ比率
[戻り値]
void
1359 y -- サイズ変更後のy座標を指定 ratioW -- 変更を行うWidthのサイズ比率
ratioH -- 変更を行うHeightのサイズ比率
[戻り値]
void
1360 ratioW -- 変更を行うWidthのサイズ比率 1361 ratioH -- 変更を行うHeightのサイズ比率 1366 movex = x - self.
body.GetX()
1367 movey = y - self.
body.GetY()
1371 if self.
parent.xy_swap == 1:
1379 canvas = self.
body.GetCanvas()
1380 dc = wx.ClientDC(canvas)
1381 canvas.PrepareDC(dc)
1382 brush = self.
body.GetBrush()
1385 self.
body.RemoveFromCanvas(canvas)
1390 self.
parent.parent.MyAddShape(
1391 self.
body, self.
x , self.
y,
1392 wx.Pen(OUTLINE_COLOR, 1), brush,
"" , 1)
1396 canvas.line[line_index].setEndPoint(dc, self.
body,movex, movey)
1399 """コネクト処理(subscribeを発行)
[引数]
line_idx -- インポートに接続する線のインデックス
subscription_type -- サブスクリプション・タイプを指定(現在未使用)
[戻り値]
成否フラグ -- 0:エラー(オブジェクトリファレンス無し,subscribe失敗) / 1:成功
1402 line_idx -- インポートに接続する線のインデックス 1403 subscription_type -- サブスクリプション・タイプを指定(現在未使用)
[戻り値]
成否フラグ -- 0:エラー(オブジェクトリファレンス無し,subscribe失敗) / 1:成功
1406 成否フラグ -- 0:エラー(オブジェクトリファレンス無し,subscribe失敗) / 1:成功 1408 canvas = self.
body.GetCanvas()
1415 ref = ref._narrow(RTM.OutPort)
1421 inp_ref = canvas.line[line_idx].g_inp.inport[
'ref']
1423 inp_ref = inp_ref._narrow(RTM.InPort)
1429 subscription_list = []
1431 subscription_list = ref._get_subscriptions()
1432 if subscription_list ==
None:
1433 print "get subscriptions failure: return value is None." 1439 connect_num = self.
checkConnect(inp_ref, subscription_list)
1441 if canvas.viewMode ==
False:
1442 if connect_num == -1:
1444 canvas.line[line_idx].subscription_type = subscription_type
1445 canvas.line[line_idx].profile = RTM.SubscriptionProfile(subscription_type,
"",
None,
None,
False,[])
1446 canvas.line[line_idx].profile.out_port = ref
1447 canvas.line[line_idx].profile.in_port = inp_ref
1448 rslt, canvas.line[line_idx].profile = ref.subscribe(canvas.line[line_idx].profile)
1449 self.
uuid[line_idx] = canvas.line[line_idx].profile.id
1452 print "subscribe failure!" 1455 print "connect2 subscribe :",self.
uuid[line_idx]
1459 self.
uuid[line_idx] = subscription_list[connect_num].id
1463 """コネクト処理(線のインデックスを格納、subscribeを発行)
[引数]
line_idx -- インポートに接続する線のインデックス
subscription_type -- サブスクリプション・タイプを指定(現在未使用)
[戻り値]
成否フラグ -- 0:エラー(オブジェクトリファレンス無し,subscribe失敗) / 1:成功
1466 line_idx -- インポートに接続する線のインデックス 1467 subscription_type -- サブスクリプション・タイプを指定(現在未使用)
[戻り値]
成否フラグ -- 0:エラー(オブジェクトリファレンス無し,subscribe失敗) / 1:成功
1470 成否フラグ -- 0:エラー(オブジェクトリファレンス無し,subscribe失敗) / 1:成功 1472 canvas = self.
body.GetCanvas()
1479 ref = ref._narrow(RTM.OutPort)
1489 inp_ref = canvas.line[line_idx].g_inp.inport[
'ref']
1491 inp_ref = inp_ref._narrow(RTM.InPort)
1497 subscription_list = []
1499 subscription_list = ref._get_subscriptions()
1500 if subscription_list ==
None:
1501 print "get subscriptions failure: return value is None." 1507 canvas.line[line_idx].subscription_type = subscription_type
1508 canvas.line[line_idx].profile = RTM.SubscriptionProfile(subscription_type,
"",
None,
None,
False,[])
1511 connect_num = self.
checkConnect(inp_ref, subscription_list)
1517 if canvas.viewMode ==
False:
1518 if connect_num == -1:
1520 canvas.line[line_idx].profile.out_port = ref
1521 canvas.line[line_idx].profile.in_port = inp_ref
1522 (rslt, canvas.line[line_idx].profile) = ref.subscribe(canvas.line[line_idx].profile)
1524 print "subscribe failuer! :rslt=",rslt
1525 self.
uuid[line_idx] = canvas.line[line_idx].profile.id
1526 print "connect subscribe :",self.
uuid[line_idx]
1528 err_mess =
'subscribe failure! :' 1533 self.
uuid[line_idx] = subscription_list[connect_num].id
1536 print "subsrcibe-rslt:",rslt
1544 """ディスコネクト処理(線のインデックスを削除、unsubscribeを発行)
[引数]
line_idx -- アウトポートに接続している線のインデックス
[戻り値]
成否フラグ -- 0:エラー / 1:成功
1547 line_idx -- アウトポートに接続している線のインデックス 1550 成否フラグ -- 0:エラー / 1:成功 1555 canvas = self.
body.GetCanvas()
1561 ref = ref._narrow(RTM.OutPort)
1563 inp_obj = canvas.line[line_idx].g_inp.inport[
'ref']
1566 subscription_list = []
1567 subscription_list = ref._get_subscriptions()
1568 if subscription_list ==
None:
1569 print "get subscriptions failure: return value is None." 1572 connect_num = self.
checkConnect(inp_obj, subscription_list)
1578 err_mess =
'outport disconnect failure:' 1586 if ref !=
None and canvas.viewMode ==
False and connect_num != -1:
1588 print "unsubscribe :",self.
uuid[line_idx]
1589 rslt = ref.unsubscribe(self.
uuid[line_idx])
1591 print 'unsubscribe failure: rslt=',rslt
1593 err_mess =
'unsubscribe failure:' 1605 """再接続処理 オブジェクト上だけに存在する接続情報(subscribe)を検索し線を引く
[引数]
なし
[戻り値]
void
1606 オブジェクト上だけに存在する接続情報(subscribe)を検索し線を引く 1618 canvas = self.
body.GetCanvas()
1619 dc = wx.ClientDC(canvas)
1620 canvas.PrepareDC(dc)
1624 ref = ref._narrow(RTM.OutPort)
1626 err_mess =
'outport obj-ref failure:' 1631 subscription_list = []
1632 subscr_list_tmp = []
1634 subscription_list = ref._get_subscriptions()
1635 subscr_list_tmp = copy.deepcopy(subscription_list)
1636 if subscription_list ==
None:
1637 print "get subscriptions failure: return value is None." 1644 line = canvas.line[line_idx]
1645 (ret2,subscr_list_tmp) = self.
checkConnect2(line,subscr_list_tmp)
1647 rtc_list = self.
parent.parent.rtc_list
1648 rtc_dict = self.
parent.parent.rtc_dict
1653 for subscr
in subscr_list_tmp:
1654 inp_ref = subscr.in_port
1655 for fullname
in rtc_list:
1656 in_list = rtc_dict[fullname].in_list
1657 in_dict = rtc_dict[fullname].in_dict
1660 if inp[
'name']
in in_dict.keys():
1661 ref = in_dict[inp[
'name']].inport[
'ref']
1662 if inp_ref._is_equivalent(ref):
1663 print "_is_equivalent is OK!!!" 1664 ret_name.append( inp[
'name'] )
1665 ret_obj.append( in_dict[inp[
'name']] )
1666 ret_ref.append(inp_ref)
1668 for num
in range(len(ret_name)):
1669 canvas.lineFrom = self.
body 1670 canvas.lineTo = ret_obj[num].body
1672 line.setLine2port(canvas, dc)
1676 connect_num = self.
checkConnect(ret_ref[num], subscription_list)
1678 self.
uuid[line.idx] = subscription_list[connect_num].id
1680 canvas.lineFrom =
None 1681 canvas.lineTo =
None 1686 """古い接続情報があるかチェックする 画面上の線以外の接続がオブジェクト上にあるかチェックする
[引数]
なし
[戻り値]
ret --- True:ある / False:ない
1687 画面上の線以外の接続がオブジェクト上にあるかチェックする
[引数]
なし
[戻り値]
ret --- True:ある / False:ない
1693 ret --- True:ある / False:ない 1696 canvas = self.
body.GetCanvas()
1699 ref = ref._narrow(RTM.OutPort)
1701 err_mess =
'outport obj-ref failure:' 1706 subscription_list = []
1708 subscription_list = ref._get_subscriptions()
1709 if subscription_list ==
None:
1710 print "get subscriptions failure: return value is None." 1717 line = canvas.line[line_idx]
1718 (ret2,subscription_list) = self.
checkConnect2(line,subscription_list)
1719 if len(subscription_list) > 0:
1725 指定した接続先(inport)のリファレンスがあるかチェックする
[引数]
inp_obj --- インポートのオブジェクト・リファレンス
ref_list --- インポートのリファレンス・リスト
[戻り値]
ret_num --- subScription_list の添え字/ない場合は-1
1728 inp_obj --- インポートのオブジェクト・リファレンス 1729 ref_list --- インポートのリファレンス・リスト
[戻り値]
ret_num --- subScription_list の添え字/ない場合は-1
1732 ret_num --- subScription_list の添え字/ない場合は-1 1736 for subscr
in subscr_list:
1737 ref_inp = subscr.in_port
1738 if ref_inp._is_equivalent(inp_obj):
1739 print "checkConnect: _is_equivalent is OK!!!" 1742 ret_num = ret_num + 1
1749 チェック対象の接続があった場合は、リスト上から削除して返却する 古い情報があるか調べる為に呼ばれる
[引数]
line --- 線のオブジェクト
ref_list --- 接続先(inport)のオブジェクトリファレンス・リスト
[戻り値]
(ret, ref_list) --- ret 0:ない / 1:ある , ref_list: 残りのリファレンスリスト
1750 古い情報があるか調べる為に呼ばれる
[引数]
line --- 線のオブジェクト
ref_list --- 接続先(inport)のオブジェクトリファレンス・リスト
[戻り値]
(ret, ref_list) --- ret 0:ない / 1:ある , ref_list: 残りのリファレンスリスト
1753 line --- 線のオブジェクト ref_list --- 接続先(inport)のオブジェクトリファレンス・リスト
[戻り値]
(ret, ref_list) --- ret 0:ない / 1:ある , ref_list: 残りのリファレンスリスト
1754 ref_list --- 接続先(inport)のオブジェクトリファレンス・リスト
[戻り値]
(ret, ref_list) --- ret 0:ない / 1:ある , ref_list: 残りのリファレンスリスト
1757 (ret, ref_list) --- ret 0:ない / 1:ある , ref_list: 残りのリファレンスリスト 1760 inp_obj = line.g_inp.inport[
'ref']
1764 for subscr
in subscr_list:
1765 ref_inp = subscr.in_port
1766 if ref_inp._is_equivalent(inp_obj):
1772 del subscr_list[cnt]
1774 return (ret, subscr_list)
1777 """コンポーネント上の接続情報(subscribe)を削除する
[引数]
inp_list --- 接続先(subscriptionProfile)のリスト
[戻り値]
void
1780 inp_list --- 接続先(subscriptionProfile)のリスト
[戻り値]
void
1790 canvas = self.
body.GetCanvas()
1792 ref = ref._narrow(RTM.OutPort)
1794 for subscr
in subscr_list:
1795 inp = subscr.in_port
1799 uuid = subscr_list[connect_num].id
1801 if ref !=
None and canvas.viewMode ==
False:
1803 print "unsubscribe2 :",uuid
1804 rslt = ref.unsubscribe(uuid)
1806 print 'unsubscribe2 failure: rslt=',rslt
1808 err_mess =
'unsubscribe failure:' 1813 """再接続処理
[引数]
なし
[戻り値]
void
1825 canvas = self.
body.GetCanvas()
1828 ref = ref._narrow(RTM.OutPort)
1830 err_mess =
'outport obj-ref failure:' 1835 subscription_list = []
1836 subscr_list_tmp = []
1838 subscription_list = ref._get_subscriptions()
1839 subscr_list_tmp = copy.deepcopy(subscription_list)
1840 if subscription_list ==
None:
1841 print "get subscriptions failure: return value is None." 1848 line = canvas.line[line_idx]
1849 (ret,subscr_list_tmp) = self.
checkConnect2(line,subscr_list_tmp)
1851 self.
connect2(line_idx,line.subscription_type)
1854 inp_ref = canvas.line[line_idx].g_inp.inport[
'ref']
1855 connect_num = self.
checkConnect(inp_ref, subscription_list)
1856 self.
uuid[line_idx] = subscription_list[connect_num].id
1860 line = canvas.line[line_idx]
1861 (ret,subscr_list_tmp) = self.
checkConnect2(line,subscr_list_tmp)
1863 self.
connect2(line_idx,line.subscription_type)
1864 if len(subscr_list_tmp) > 0:
1870 現在のpositionを見て図形の向きを決定する 各頂点は(x,y)のタプル形式
[引数]
なし
[戻り値]
void
1910 """コンポーネント図形の本体を作成するクラス""" 1912 """クラスの初期化(コンポーネント図形の作成)
[引数]
parent -- 親クラスを指定する
fullpath -- コンポーネントのロングネーム
pos_x -- コンポーネント図形のx座標
pos_y -- コンポーネント図形のy座標
[戻り値]
void
1915 parent -- 親クラスを指定する fullpath -- コンポーネントのロングネーム
pos_x -- コンポーネント図形のx座標
pos_y -- コンポーネント図形のy座標
[戻り値]
void
1916 fullpath -- コンポーネントのロングネーム pos_x -- コンポーネント図形のx座標
pos_y -- コンポーネント図形のy座標
[戻り値]
void
1917 pos_x -- コンポーネント図形のx座標 1918 pos_y -- コンポーネント図形のy座標 1923 ogl.Shape.__init__(self)
1968 """古い接続情報(画面上に表示されていないsubscribe情報)をチェックする
[引数]
なし
[戻り値]
ret --- True:古い情報あり / False:古い情報なし
1974 ret --- True:古い情報あり / False:古い情報なし 1985 """再接続処理 コンポーネントのアウトポートの再接続処理を呼び出す
[引数]
なし
[戻り値]
void
1986 コンポーネントのアウトポートの再接続処理を呼び出す 1999 """ポート(Shape)のFlash(再描画?)を呼び出す 2000 コンポーネントの絵の下にポートの絵がもぐり込むケースの時に呼び出している。(回避策) 他に良い処理があれば、随時そちらに変更する
[引数]
なし
[戻り値]
void
2001 他に良い処理があれば、随時そちらに変更する
[引数]
なし
[戻り値]
void
2011 self.
in_dict[inp[
'name']].body.Flash()
2014 self.
out_dict[outp[
'name']].body.Flash()
2017 """コンポーネントのステータスをチェックする
[引数]
なし
[戻り値]
void
2027 canvas = self.
body.GetCanvas()
2029 if tmp == RTM.RTComponent.RTC_STARTING
or tmp == RTM.RTComponent.RTC_ACTIVE:
2031 elif tmp == RTM.RTComponent.RTC_READY
or tmp == RTM.RTComponent.RTC_STOPPING:
2033 elif tmp >= RTM.RTComponent.RTC_ABORTING :
2037 if canvas.viewMode ==
True and state !=
'unloaded':
2043 """コンポーネントにstart命令を発行
[引数]
なし
[戻り値]
void
2053 ref = ref._narrow(RTM.RTCBase)
2056 err_mess =
'rtc_start error:%s\n'%self.
fullpath 2062 self.
state =
'active' 2066 """コンポーネントにstop命令を発行
[引数]
なし
[戻り値]
void
2076 ref = ref._narrow(RTM.RTCBase)
2079 err_mess =
'rtc_stop error:%s\n'%self.
fullpath 2085 self.
state =
'inactive' 2089 """コンポーネントにreset命令を発行
[引数]
なし
[戻り値]
void
2099 ref = ref._narrow(RTM.RTCBase)
2102 err_mess =
'rtc_reset error:%s\n'%self.
fullpath 2110 """コンポーネントにkill命令を発行
[引数]
なし
[戻り値]
void
2120 ref = ref._narrow(RTM.RTCBase)
2123 err_mess =
'rtc_kill error:%s\n'%self.
fullpath 2129 self.
state =
'inactive' 2133 """コンポーネントにexit命令を発行
[引数]
なし
[戻り値]
void
2143 ref = ref._narrow(RTM.RTCBase)
2146 err_mess =
'rtc_exit error:%s\n'%self.
fullpath 2152 self.
state =
'unloaded' 2156 """ステータスによりコンポーネントの色を設定する
[引数]
state --- コンポーネントの状態を指定する
2159 state --- コンポーネントの状態を指定する 2160 'active','inactive','error',unloaded','virtual' 2165 if state ==
'unloaded':
2166 self.
state =
'unloaded' 2167 self.
color = UNLOADED_COLOR
2168 elif state ==
'active' :
2169 self.
state =
'active' 2170 self.
color = ACTIVE_COLOR
2171 elif state ==
'inactive':
2172 self.
state =
'inactive' 2173 self.
color = INACTIVE_COLOR
2174 elif state ==
'error' :
2175 self.
state =
'error' 2176 self.
color = ERROR_COLOR
2178 canvas = self.
parent.diagram.GetCanvas()
2179 dc = wx.ClientDC(canvas)
2180 canvas.PrepareDC(dc)
2181 if canvas.viewMode ==
True and self.
state !=
'unloaded':
2182 self.
state =
'virtual' 2183 self.
color = VIRTUAL_COLOR
2202 """リフレッシュ処理 コンポーネントのstateフラグで現在の状態(active,error,inactive等)を設定
[引数]
なし
[戻り値]
void
2203 コンポーネントのstateフラグで現在の状態(active,error,inactive等)を設定
[引数]
なし
[戻り値]
void
2211 old_state = self.
state 2212 canvas = self.
body.GetCanvas()
2213 dc = wx.ClientDC(canvas)
2214 canvas.PrepareDC(dc)
2217 ref = ref._narrow(RTM.RTCBase)
2218 tmp_port = ref._get_rtc_state()
2219 tmp_port = tmp_port._narrow(RTM.OutPort)
2220 tmp = tmp_port.get()
2223 print "refresh state:",tmp
2229 self.
state =
'unloaded' 2230 self.
color = UNLOADED_COLOR
2238 self.
out_dict[outp[
'name']].outport = outp
2241 self.
in_dict[inp[
'name']].inport = inp
2244 if tmp == RTM.RTComponent.RTC_STARTING
or tmp == RTM.RTComponent.RTC_ACTIVE:
2245 self.
state =
'active' 2246 self.
color = ACTIVE_COLOR
2247 elif tmp == RTM.RTComponent.RTC_STOPPING
or tmp == RTM.RTComponent.RTC_READY:
2248 self.
state =
'inactive' 2249 self.
color = INACTIVE_COLOR
2250 elif tmp >= RTM.RTComponent.RTC_ABORTING :
2251 self.
state =
'error' 2252 self.
color = ERROR_COLOR
2254 self.
state =
'unloaded' 2255 self.
color = UNLOADED_COLOR
2273 if old_lastrot ==
'LR':
2289 """コンポーネント図形を削除する インポート図形、アウトポート図形、関連する線も削除する
[引数]
dc -- 描画するデバイス・コンテキストを指定
rot -- 線の削除可否を指定する。(回転処理等で使用)
0:線を削除 / 1:線を削除しない
[戻り値]
void
2290 インポート図形、アウトポート図形、関連する線も削除する
[引数]
dc -- 描画するデバイス・コンテキストを指定
rot -- 線の削除可否を指定する。(回転処理等で使用)
0:線を削除 / 1:線を削除しない
[戻り値]
void
2293 dc -- 描画するデバイス・コンテキストを指定 rot -- 線の削除可否を指定する。(回転処理等で使用)
0:線を削除 / 1:線を削除しない
[戻り値]
void
2294 rot -- 線の削除可否を指定する。(回転処理等で使用) 0:線を削除 / 1:線を削除しない
[戻り値]
void
2301 canvas = self.
body.GetCanvas()
2303 self.
body.RemoveFromCanvas(canvas)
2308 self.
bmp.RemoveFromCanvas(canvas)
2312 self.
text.RemoveFromCanvas(canvas)
2327 rot -- 図形の回転処理を行うフラグ 2328 0:回転なし(座標を計算で求める) 1:回転あり(既存の座標を使用)
[戻り値]
void
2338 pos_x = self.
x + (BOX_WIDTH * self.
ratioW)/2
2339 pos_y = self.
y + self.
y_size/2
2345 canvas = self.
parent.diagram.GetCanvas()
2346 dc = wx.ClientDC(canvas)
2347 canvas.PrepareDC(dc)
2348 cnt = len(self.
name)
2349 charW = dc.GetCharWidth()
2350 charH = dc.GetCharHeight()
2351 tmpW = charW * (cnt*1.2)
2368 bitmap = wx.NullBitmap
2369 self.
bmp.SetSize(10,10,
False)
2371 self.
bmp.SetBitmap(bitmap)
2373 self.
parent.MyAddBmp( self.
bmp, pos_x, pos_y, wx.BLACK_PEN )
2377 self.
parent.MyAddShape(self.
baseBox, pos_x, pos_y, wx.BLACK_PEN, wx.Brush(self.
color, wx.SOLID),
"" ,0)