From 4b93158da2747cad9227ed5c06c8e8e7b4cbfb9e Mon Sep 17 00:00:00 2001 From: Felix Ruess Date: Wed, 11 Jun 2014 10:32:32 +0200 Subject: [PATCH] [tools] cleanup whitespaces --- sw/tools/airframe_editor/airframe_editor.py | 14 ++++----- sw/tools/airframe_editor/paparazzi.py | 2 +- sw/tools/process_exif/process_exif.py | 34 ++++++++++----------- sw/tools/stm32loader/stm32loader.py | 6 ++-- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/sw/tools/airframe_editor/airframe_editor.py b/sw/tools/airframe_editor/airframe_editor.py index 2d7417dc1d6..403412da66e 100755 --- a/sw/tools/airframe_editor/airframe_editor.py +++ b/sw/tools/airframe_editor/airframe_editor.py @@ -44,7 +44,7 @@ def update_combo(self, combo, c_list): def find_firmwares(self, widget): list_of_firmwares = paparazzi.get_list_of_firmwares() self.update_combo(self.firmwares_combo, list_of_firmwares) - + def find_modules(self, widget): list_of_modules = paparazzi.get_list_of_modules() self.update_combo(self.modules_combo, list_of_modules) @@ -117,7 +117,7 @@ def select(self, widget): # Constructor Functions def fill_tree_from_airframe(self): - + # create a TreeStore with one string column to use as the model self.treestore = gtk.TreeStore(str, object) @@ -134,9 +134,9 @@ def fill_tree_from_airframe(self): self.tvcolumn.pack_start(self.cell, True) self.tvcolumn.add_attribute(self.cell, 'text', 0) self.treeview.set_reorderable(True) - + def fill_datagrid_from_section(self): - + # create a TreeStore with one string column to use as the model self.gridstore = gtk.ListStore(str, str, str, str, str) @@ -233,7 +233,7 @@ def __init__(self): self.btnExit.set_tooltip_text("Close application") self.btnOpen = gtk.Button("Open") - self.btnOpen.connect("clicked", self.open) + self.btnOpen.connect("clicked", self.open) self.btnRun = gtk.Button("Reorganize XML") self.btnRun.connect("clicked", self.reorganize_xml) @@ -271,7 +271,7 @@ def __init__(self): self.boards_combo = gtk.combo_box_entry_new_text() self.find_boards(self.boards_combo) - + self.firmwarebar = gtk.HBox() self.firmwarebar.pack_start(self.btnFirmwares) @@ -327,7 +327,7 @@ def __init__(self): self.load_airframe_xml() - ##### Bottom + ##### Bottom self.searchbar = gtk.HBox() diff --git a/sw/tools/airframe_editor/paparazzi.py b/sw/tools/airframe_editor/paparazzi.py index aa9dc657a3a..772a6d8c4b3 100755 --- a/sw/tools/airframe_editor/paparazzi.py +++ b/sw/tools/airframe_editor/paparazzi.py @@ -36,7 +36,7 @@ def get_list_of_files(directory, extension): def get_list_of_modules(): return get_list_of_files( modules_dir, ".xml") - + def get_list_of_firmwares(): return get_list_of_files( firmwares_dir, ".makefile") diff --git a/sw/tools/process_exif/process_exif.py b/sw/tools/process_exif/process_exif.py index 93942455049..31088f5097a 100644 --- a/sw/tools/process_exif/process_exif.py +++ b/sw/tools/process_exif/process_exif.py @@ -32,10 +32,10 @@ def RadOfDeg( deg ): return (deg / M_PI) * 180. -# converts UTM coords to lat/long. Equations from USGS Bulletin 1532 -# East Longitudes are positive, West longitudes are negative. +# converts UTM coords to lat/long. Equations from USGS Bulletin 1532 +# East Longitudes are positive, West longitudes are negative. # North latitudes are positive, South latitudes are negative -# Lat and Long are in decimal degrees. +# Lat and Long are in decimal degrees. # Written by Chuck Gantz- chuck.gantz@globalstar.com # ( I had some code here to use GDAL and which looked much simpler, but couldn't get that to work ) @@ -46,33 +46,33 @@ def UTMtoLL( northing, easting, utm_zone ): a = 6378137; # WGS-84 eccSquared = 0.00669438; # WGS-84 e1 = (1-math.sqrt(1-eccSquared))/(1+math.sqrt(1-eccSquared)); - + x = easting - 500000.0; # remove 500,000 meter offset for longitude y = northing; - + is_northern = northing < 0 if ( not is_northern ): y -= 10000000.0 # remove 10,000,000 meter offset used for southern hemisphere - + LongOrigin = (utm_zone - 1)*6 - 180 + 3; # +3 puts origin in middle of zone - + eccPrimeSquared = (eccSquared)/(1-eccSquared); - + M = y / k0; mu = M/(a*(1-eccSquared/4-3*eccSquared*eccSquared/64-5*eccSquared*eccSquared*eccSquared/256)); phi1Rad = mu + (3*e1/2-27*e1*e1*e1/32)*math.sin(2*mu) + (21*e1*e1/16-55*e1*e1*e1*e1/32)*math.sin(4*mu) +(151*e1*e1*e1/96)*math.sin(6*mu); phi1 = RadOfDeg(phi1Rad); - + N1 = a/math.sqrt(1-eccSquared*math.sin(phi1Rad)*math.sin(phi1Rad)); T1 = math.tan(phi1Rad)*math.tan(phi1Rad); C1 = eccPrimeSquared*math.cos(phi1Rad)*math.cos(phi1Rad); R1 = a*(1-eccSquared)/math.pow(1-eccSquared*math.sin(phi1Rad)*math.sin(phi1Rad), 1.5); D = x/(N1*k0); - + Lat = phi1Rad - (N1*math.tan(phi1Rad)/R1)*(D*D/2-(5+3*T1+10*C1-4*C1*C1-9*eccPrimeSquared)*D*D*D*D/24+(61+90*T1+298*C1+45*T1*T1-252*eccPrimeSquared-3*C1*C1)*D*D*D*D*D*D/720); Lat = RadOfDeg(Lat) - + Long = (D-(1+2*T1+C1)*D*D*D/6+(5-2*C1+28*T1-3*C1*C1+8*eccPrimeSquared+24*T1*T1)*D*D*D*D*D/120)/math.cos(phi1Rad) Long = LongOrigin + RadOfDeg(Long) @@ -136,29 +136,29 @@ def UTMtoLL( northing, easting, utm_zone ): # Check that there as many photos and pick the indicated one. # (this assumes the photos were taken correctly without a hiccup) - # It would never be able to check this anyway, since the camera could stall or + # It would never be able to check this anyway, since the camera could stall or # not interpret the pulse? Leading to an incorrect GPS coordinate. if len( photos ) < photonr: print "Photo data %d found, but ran out of photos in directory"%(photonr) - continue + continue - # I've seen log files with -1 as DC_SHOT number due to an int8 I think. This should be + # I've seen log files with -1 as DC_SHOT number due to an int8 I think. This should be # fixed now, but just in case someone runs this on old data. if (photonr < 0): print "Negative photonr found." continue - # Pick out photo, open it through exiv2, + # Pick out photo, open it through exiv2, photoname = photos[ photonr - 1 ] photo = GExiv2.Metadata( photoname ) - + photo.set_gps_info(lat, lon, alt) photo.save_file() print "Photo %s and photonr %d merged. Lat/Lon/Alt: %f, %f, %f"%(photoname, photonr, lat, lon, alt) except ValueError as e: - print "Cannot read line: %s"%(line) + print "Cannot read line: %s"%(line) print "Value error(%s)"%(e) continue diff --git a/sw/tools/stm32loader/stm32loader.py b/sw/tools/stm32loader/stm32loader.py index 67e3b6f6257..fe64de11f2e 100755 --- a/sw/tools/stm32loader/stm32loader.py +++ b/sw/tools/stm32loader/stm32loader.py @@ -257,7 +257,7 @@ def readMemory(self, addr, lng): if usepbar: widgets = ['Reading: ', Percentage(),', ', ETA(), ' ', Bar()] pbar = ProgressBar(widgets=widgets,maxval=lng, term_width=79).start() - + while lng > 256: if usepbar: pbar.update(pbar.maxval-lng) @@ -279,7 +279,7 @@ def writeMemory(self, addr, data): if usepbar: widgets = ['Writing: ', Percentage(),' ', ETA(), ' ', Bar()] pbar = ProgressBar(widgets=widgets, maxval=lng, term_width=79).start() - + offs = 0 while lng > 256: if usepbar: @@ -324,7 +324,7 @@ def usage(): if __name__ == "__main__": - + # Import Psyco if available try: import psyco