Skip to content

Commit

Permalink
[svinfo] pep8 and header
Browse files Browse the repository at this point in the history
  • Loading branch information
dewagter committed Oct 6, 2016
1 parent 1aefb4f commit 7267c2e
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 21 deletions.
1 change: 1 addition & 0 deletions conf/airframes/TUDELFT/tudelft_control_panel.xml
Expand Up @@ -55,6 +55,7 @@
<arg flag="4242" />
<arg flag="4252" />
</program>
<program name="SVInfo" command="sw/ground_segment/python/svinfo/svinfo.py"/>
</section>

<section name="sessions">
Expand Down
18 changes: 18 additions & 0 deletions sw/ground_segment/python/svinfo/svinfo.py
@@ -1,4 +1,22 @@
#!/usr/bin/env python
#
# Copyright (C) 2016 TUDelft
#
# This file is part of paparazzi.
#
# paparazzi is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# paparazzi is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with paparazzi. If not, see <http://www.gnu.org/licenses/>.
#

import wx
import svinfoviewer
Expand Down
61 changes: 40 additions & 21 deletions sw/ground_segment/python/svinfo/svinfoviewer.py
@@ -1,3 +1,22 @@
#
# Copyright (C) 2016 TUDelft
#
# This file is part of paparazzi.
#
# paparazzi is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# paparazzi is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with paparazzi. If not, see <http://www.gnu.org/licenses/>.
#

import wx

import sys
Expand Down Expand Up @@ -69,23 +88,23 @@ def OnPaint(self, e):
bar = self.h-w-th-th


dc = wx.PaintDC(self)
brush = wx.Brush("white")
dc.SetBackground(brush)
dc.Clear()
dc = wx.PaintDC(self)
brush = wx.Brush("white")
dc.SetBackground(brush)
dc.Clear()

# Background
dc.SetBrush(wx.Brush(wx.Colour(0,0,0), wx.TRANSPARENT))
dc.DrawCircle(w/2,w/2,w/2-1)
dc.DrawCircle(w/2,w/2,w/4-1)
dc.DrawCircle(w/2,w/2,1)
font = wx.Font(11, wx.ROMAN, wx.BOLD, wx.NORMAL)
dc.SetBrush(wx.Brush(wx.Colour(0,0,0), wx.TRANSPARENT))
dc.DrawCircle(w/2,w/2,w/2-1)
dc.DrawCircle(w/2,w/2,w/4-1)
dc.DrawCircle(w/2,w/2,1)
font = wx.Font(11, wx.ROMAN, wx.BOLD, wx.NORMAL)
dc.SetFont(font)

dc.DrawText("N",w/2+tdx,2)
dc.DrawText("S",w/2+tdx,w-17)
dc.DrawText("E",w-15,w/2+tdy)
dc.DrawText("W",2,w/2+tdy)
dc.DrawText("N",w/2+tdx,2)
dc.DrawText("S",w/2+tdx,w-17)
dc.DrawText("E",w-15,w/2+tdy)
dc.DrawText("W",2,w/2+tdy)

# SV
for chn in self.sv:
Expand All @@ -101,18 +120,18 @@ def OnPaint(self, e):
y = float(w)/2.0 - math.cos(az) * el
x = float(w)/2.0 + math.sin(az) * el

dc.SetBrush(wx.Brush(c, wx.SOLID))
dc.DrawCircle(int(x),int(y),s)
font = wx.Font(8, wx.ROMAN, wx.NORMAL, wx.NORMAL)
dc.SetFont(font)
dc.SetBrush(wx.Brush(c, wx.SOLID))
dc.DrawCircle(int(x),int(y),s)

font = wx.Font(8, wx.ROMAN, wx.NORMAL, wx.NORMAL)
dc.SetFont(font)
dc.DrawText(str(sv.SVID),x+tdx,y+tdy)

bh = float(bar-th-th) * float(sv.CNO) / 55.0
dc.DrawRectangle(w/CHANNEL*chn+5 * (1-used),self.h-th-bh,w/CHANNEL-2 - 10 * (1-used),bh)
dc.DrawText(str(chn),w/CHANNEL*chn,self.h-th)
dc.DrawText(str(sv.CNO),w/CHANNEL*chn,self.h-bar)


def __init__(self):

Expand All @@ -121,7 +140,7 @@ def __init__(self):

wx.Frame.__init__(self, id=-1, parent=None, name=u'SVInfoFrame',
size=wx.Size(self.w, self.h), title=u'SV Info')
self.Bind(wx.EVT_PAINT, self.OnPaint)
self.Bind(wx.EVT_PAINT, self.OnPaint)
self.Bind(wx.EVT_SIZE, self.OnSize)
self.Bind(wx.EVT_CLOSE, self.OnClose)

Expand Down

0 comments on commit 7267c2e

Please sign in to comment.