Skip to content

Commit

Permalink
My Year project as a BA3 student.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dollars committed May 19, 2013
0 parents commit 9666200
Show file tree
Hide file tree
Showing 37 changed files with 2,165 additions and 0 deletions.
76 changes: 76 additions & 0 deletions input/ferraraNetwork.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
1 -- 2;
2 -- 3;
2 -- 11;
2 -- 13;
3 -- 4;
4 -- 5;
4 -- 15;
5 -- 22;
5 -- 6;
6 -- 7;
6 -- 30;
7 -- 41;
7 -- 8;
8 -- 49;
8 -- 47;
8 -- 9;
9 -- 10;
10 -- 11;
10 -- 42;
12 -- 30;
12 -- 32;
12 -- 39;
12 -- 48;
13 -- 14;
13 -- 16;
14 -- 15;
14 -- 17;
15 -- 19;
16 -- 17;
16 -- 24;
17 -- 18;
17 -- 23;
18 -- 19;
19 -- 20;
19 -- 27;
20 -- 21;
20 -- 28;
21 -- 22;
21 -- 29;
22 -- 30;
23 -- 25;
24 -- 25;
24 -- 33;
25 -- 26;
26 -- 27;
26 -- 34;
27 -- 31;
28 -- 29;
28 -- 31;
29 -- 30;
29 -- 32;
31 -- 32;
31 -- 35;
32 -- 38;
33 -- 34;
33 -- 42;
34 -- 35;
34 -- 43;
35 -- 36;
35 -- 44;
36 -- 37;
36 -- 45;
37 -- 38;
37 -- 40;
38 -- 39;
39 -- 40;
39 -- 48;
40 -- 41;
40 -- 46;
41 -- 47;
41 -- 48;
42 -- 43;
43 -- 44;
44 -- 45;
45 -- 46;
46 -- 47;
6 changes: 6 additions & 0 deletions input/myNetwork.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
A -- B -- D -- E -- G -- I -- H -- C;
B -- C -- F -- H;
D -- F -- I;
F -- M -- O -- G -- J -- K;
M -- N -- O;
J -- L;
6 changes: 6 additions & 0 deletions input/myNetwork.dot~
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
A -- B -- D -- E -- G -- I -- H -- C;
B -- C -- F -- H;
D -- F -- I;
F -- M -- O -- G -- J -- K;
M -- N -- O;
J -- L;
7 changes: 7 additions & 0 deletions input/randomNetwork.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
A -- B -- D -- E -- G -- I -- H -- C;
B -- C -- F -- H;
D -- F -- I;
F -- M -- O -- G -- J -- K;
M -- N -- O;
C -- F -- I;
J -- L;
6 changes: 6 additions & 0 deletions input/testNetwork.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
A -- B -- C -- D -- E -- F -- G -- B;
C -- G;
D -- F -- L;
G -- H -- I -- J -- K -- L -- I;
E -- M -- H;
B -- J;
5 changes: 5 additions & 0 deletions input/testNetwork.dot~
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
A -- B -- C -- D -- E -- F -- G -- B;
C -- G;
D -- F -- L;
G -- H -- I -- J -- K -- L -- I;
E -- M -- H;
Empty file.
Binary file added src/graphical_interface/__init__.pyc
Binary file not shown.
65 changes: 65 additions & 0 deletions src/graphical_interface/graph_overview.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# -*-coding:Utf-8 -*
import wx
import random

class GraphOverview(wx.Frame):
def __init__(self, parent=None, id=-1, title=None):
wx.Frame.__init__(self, parent, id, title)
self.panel = wx.Panel(self, size=(500, 500))
self.panel.Bind(wx.EVT_PAINT, self.graph_overview)

self.Fit()

def graph_overview(self, event):
#LINES = PIPES, CIRCLE = NODES, RECTANGLE = VALVES
dc = wx.PaintDC(self.panel)
dotFilePath = "../../input/myNetwork.dot"
lecture = open(dotFilePath, "r")
x=5
y=5
r=5
for i in lecture:
dc.SetPen(wx.Pen('red', 1))
dc.SetBrush(wx.Brush('yellow'))

x=x+60
y=5
lineNodes = i[:-2].split(" ")
charA = lineNodes.pop(0)
dc.DrawText(charA, x, y)
dc.DrawCircle(x, y, r)
savex=x
savey=y
y=y+30

for pipeInfo, nodeID in zip(lineNodes[0::2], lineNodes[1::2]):
charB = nodeID
dc.SetPen(wx.Pen('red', 1))
dc.SetBrush(wx.Brush('yellow'))

dc.DrawCircle(x, y, r)
dc.DrawLine(savex, savey, x, y)
y=y+30

if pipeInfo[0] == "|":
dc.SetPen(wx.Pen('blue', 1))
dc.SetBrush(wx.Brush('green'))

rect = wx.Rect(savex, savey, 10, 10)
dc.DrawRoundedRectangleRect(rect, 1)
if pipeInfo[1] == "|" :
dc.SetPen(wx.Pen('blue', 1))
dc.SetBrush(wx.Brush('green'))

rect = wx.Rect(x, y-30, 10, 10)
dc.DrawRoundedRectangleRect(rect, 1)
dc.DrawText(charB, x, y-30)

lecture.close

app = wx.PySimpleApp()
frame1 = GraphOverview(title='Overview the sequences in myNetwork.dot')
frame1.Center()
frame1.Show()
app.MainLoop()

Binary file added src/graphical_interface/graph_overview.pyc
Binary file not shown.
Loading

0 comments on commit 9666200

Please sign in to comment.