Skip to content

Commit

Permalink
trim trailing spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
heldersepu committed Dec 23, 2011
1 parent f4f3749 commit ea5b375
Show file tree
Hide file tree
Showing 19 changed files with 54 additions and 56 deletions.
4 changes: 2 additions & 2 deletions download.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

def dl_callback(*args, **kwargs):
if not args[0]:
sys.stdout.write('\b=*')
sys.stdout.write('\b=*')

def download(lat, lng, lat_range, lng_range, max_zl, min_zl, layer):
for zl in range(max_zl, min_zl - 1, -1):
Expand All @@ -36,7 +36,7 @@ def download_coordpath(gpxfile, max_zl, min_zl, layer, arround=2):
coords = load_gpx_coords(gpxfile)
for zl in range(max_zl, min_zl - 1, -1):
sys.stdout.write("\nDownloading zl %d \t" % zl)
downloader.query_coordpath(coords, zl, arround, layer, dl_callback, conf=mConf)
downloader.query_coordpath(coords, zl, arround, layer, dl_callback, conf=mConf)
downloader.wait_all()

if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions gmapcatcher/mapArgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def print_help(self):
print ' '
print ' --latrange= Latitude Range to get (default = %f)' % self.lat_range
print ' --lngrange= Longitude Range to get (default = %f)' % self.lng_range
print ' --height= Height in Km (will override latrange)'
print ' --width= Width in Km (will override lngrange)'
print ' --height= Height in Km (will override latrange)'
print ' --width= Width in Km (will override lngrange)'
print ' '
print ' --max-zoom= Maximum Zoom (default = %d)' % self.max_zl
print ' --min-zoom= Minimum Zoom (default = %d)' % self.min_zl
Expand Down
1 change: 0 additions & 1 deletion gmapcatcher/mapConf.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ def read_config(keyOption, defaultValue, castFunction):
self.match_func = read_config('match_func', ENTRY_SUB_MENU[0], str)
## Show the name/description of the marker in the map
self.show_marker_name = read_config('show_marker_name', 0, int)
print

## Write the configuration to the default file
def save(self):
Expand Down
8 changes: 4 additions & 4 deletions gmapcatcher/mapDownloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def query_tile(self, coord, layer, callback,
ret += self.query_tile(coord, LAYER_SAT, callback,
online, force_update, conf)
elif MAP_SERVICES[layer]['ID'] == LAYER_HYB:
ret += self.query_tile(coord, layer -
ret += self.query_tile(coord, layer -
HYB_SAT_LAYER_OFFSETS[MAP_SERVICES[layer]['serviceName']],
callback, online, force_update, conf)
#print "query_tile(",coord,layer,callback,online,force_update,")"
Expand Down Expand Up @@ -238,7 +238,7 @@ def downThread():
dThread.start()

class MapQueue:

def __init__(self, iterable=None, maxlen=0):
self.stack = []
self.maxlen = maxlen
Expand Down Expand Up @@ -308,7 +308,7 @@ def get(self, block=True, timeout=None):

def get_nowait(self):
return self.get(False)

def put(self, item):
self.mainlock.acquire()
try :
Expand All @@ -324,4 +324,4 @@ def empty(self):
finally:
self.innerlock.release()
return ret

8 changes: 4 additions & 4 deletions gmapcatcher/mapPixbuf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

if not isfile(join(_prefix, 'missing.png')):
_prefix = '/usr/share/pixmaps/gmapcatcher'

def ico():
pix_ico = False
try:
Expand Down Expand Up @@ -63,19 +63,19 @@ def getImage(filename, intWidth=56, intHeight=56):
('\255\0\0\127' * wCo + '\0\0\255\127' *
wMe + '\255\0\0\127' * wCo) * hCo +
('\0\0\255\127' * intWidth) * hMe +
('\255\0\0\127' * wCo + '\0\0\255\127' *
('\255\0\0\127' * wCo + '\0\0\255\127' *
wMe + '\255\0\0\127' * wCo) * hCo,
gtk.gdk.COLORSPACE_RGB, True, 8, intWidth, intHeight,
intHeight * 4)
return pix_buf

def image_data_fs(filename):
return gtk.gdk.pixbuf_new_from_file(filename)

def image_data_direct(name):
if name == "missing":
return gtk.gdk.pixbuf_new_from_data(
('\0\0\0' + '\255\255\255' * 3) * (TILES_WIDTH / 4) +
('\0\0\0' + '\255\255\255' * 3) * (TILES_WIDTH / 4) +
(('\0\0\0' + '\255\255\255' * (TILES_WIDTH - 1)) +
('\255\255\255' * 3 * TILES_WIDTH)) * (TILES_HEIGHT / 4),
gtk.gdk.COLORSPACE_RGB, False, 8,
Expand Down
4 changes: 2 additions & 2 deletions gmapcatcher/mapServers/googleMaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def parse_start_page(layer, html, conf):
if layer == LAYER_HYB:
hybrid = 'Hybrid'

# List of patterns add more as needed
# List of patterns add more as needed
paList = [
'<div id=inlineTiles' + hybrid + ' dir=ltr>' +
'<img src="http://([a-z]{2,3})[0-9].google.com/(.+?)&'
Expand Down Expand Up @@ -96,7 +96,7 @@ def search_location(location):
encoding = "ASCII"
# List of patterns to look for the location name
paList = ["laddr:'([^']+)'",
"daddr:'([^']+)'",
"daddr:'([^']+)'",
'laddr:"([^"]+)"',
'daddr:"([^"]+)"']
for srtPattern in paList:
Expand Down
8 changes: 4 additions & 4 deletions gmapcatcher/mapServers/seznam.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""
A bit of theory:
Mapy.cz is a web service which provides very detailed coverage of Czech republic
and an average coverage of Europe. It is provided by company seznam.cz and
and an average coverage of Europe. It is provided by company seznam.cz and
is available on address mapy.cz or mapy.seznam.cz
('mapy' means maps, so I will use plural when talking about mapy.cz)
---------------------------------------------------------------------------------
Expand Down Expand Up @@ -77,7 +77,7 @@
The ratio 32 is probably used to allow for fine resolution of the internal (integer)
coordinates (1/32 meter).
The origin of the offsets is not known to me. I guess that it is connected with fact
The origin of the offsets is not known to me. I guess that it is connected with fact
that the internal coordinates are always 7 digit hexadecimal number (and not less).
The zone in UTM coordinates is hardwired to 33 (where Czech republic lies), it is not
Expand Down Expand Up @@ -145,10 +145,10 @@ def get_url_internal(counter, coord, layername):
y_max = 1 << (zoom + 1) #maximum value which should occur in this zoom level
#~ x_max = 1 << (zoom + 1) #maximum value which should occur in this zoom level
x = int( ( coord[0] - offsets_x[zoom] ) << (28 - zoom ))
#in computation of y, there is additional term -1, which helps to keep the center
#in computation of y, there is additional term -1, which helps to keep the center
#in the center when zooming. It is connected with fact that e.g. Google coordinate refers to the
#upper left corner of the tile, while in mapy.cz is lower left corner
y = int( (y_max - coord[1] - offsets_y[zoom] - 1) << (28 - zoom )) #
y = int( (y_max - coord[1] - offsets_y[zoom] - 1) << (28 - zoom )) #
return layer_url_template(layername) % (
counter + 1, zoom, x, y
)
Expand Down
2 changes: 1 addition & 1 deletion gmapcatcher/mapUpdate.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def finish(self):
"Update detected! \n" +
("A new version of %s is available \n\n" % NAME) +
("Your version is %s \n" % VERSION ) +
("Current version is %s" %
("Current version is %s" %
self.update.latest_version),
WEB_ADDRESS,
self.update.latest_installer
Expand Down
4 changes: 2 additions & 2 deletions gmapcatcher/mapUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def km_per_pixel(coord):
world_tiles = tiles_on_level(coord[2])
return 2*math.pi*R_EARTH/world_tiles/TILES_WIDTH * math.cos(coord[0]*math.pi/180.0)

## should return a tuple of (60 <= pixels <= 125, nice round number of m
## should return a tuple of (60 <= pixels <= 125, nice round number of m
# [% 1000 = 0 when nice round number of km])
def friendly_scale(zoomlevel):
km = sig_figs(km_per_pixel((0, 0, zoomlevel)), 4)
Expand Down Expand Up @@ -185,7 +185,7 @@ def altitude_to_zoom(altitude):
else:
zoom = int(math.log(int(altitude))/math.log(2))
return min(max(zoom, MAP_MIN_ZOOM_LEVEL + 2), MAP_MAX_ZOOM_LEVEL)

def subs_entity(match):
entity = match.group(3)
if match.group(1) == "#":
Expand Down
14 changes: 7 additions & 7 deletions gmapcatcher/pyGPSD/gpsView.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def redraw(self, satellites):
self.queue_draw()

class AISView:
"Encapsulate store and view objects for watching AIS data."
"Encapsulate store and view objects for watching AIS data."
AIS_ENTRIES = 10
DWELLTIME = 360
def __init__(self, deg_type):
Expand Down Expand Up @@ -286,7 +286,7 @@ def update(self, ais):
where = self.latlon(ais.lat, ais.lon)
self.store.prepend(
(ais.type, ais.name, "(%s navaid)" % ais.epfd, "", where, ais.aid_type))

class Base:
gpsfields = (
# First column
Expand All @@ -311,7 +311,7 @@ def __init__(self, deg_type):
self.conversions = unit_adjustments()
self.saved_mode = -1
self.ais_latch = False

self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.set_title("xgps")
self.window.connect("delete_event", self.delete_event)
Expand Down Expand Up @@ -420,7 +420,7 @@ def __init__(self, deg_type):
else:
colbase = 2
label = gtk.Label(Base.gpsfields[i][0] + ": ")
# Wacky way to force right alignment
# Wacky way to force right alignment
label.set_alignment(xalign=1, yalign=0.5)
datatable.attach(label, colbase, colbase+1, i % 7, i % 7 + 1)
entry = gtk.Entry()
Expand Down Expand Up @@ -558,13 +558,13 @@ def update_status(self, data):
def update_gpsdata(self, tpv):
"Update the GPS data fields."
for (hook, widget) in Base.gpsfields:
if hook: # Remove this guard when we have all hooks
if hook: # Remove this guard when we have all hooks
widget.set_text(hook(self, tpv))

def update_skyview(self, data):
"Update the satellite list and skyview."
satellites = data.satellites
for (i, satellite) in enumerate(satellites):
for (i, satellite) in enumerate(satellites):
self.set_satlist_field(i, 0, satellite.PRN)
self.set_satlist_field(i, 1, satellite.el)
self.set_satlist_field(i, 2, satellite.az)
Expand Down Expand Up @@ -612,7 +612,7 @@ def handle_response(self, source, condition):
self.ais_latch = True
self.uimanager.get_widget('/MenuBar/View/AIS').set_active(True)
self.aisbox.show()

return True

def handle_hangup(self, source, condition):
Expand Down
1 change: 0 additions & 1 deletion gmapcatcher/pyGPSD/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,3 @@ def deg_to_str(fmat, angle):
return "%3d° %02d' %.3f\"" % (deg, mins, sec)



4 changes: 2 additions & 2 deletions gmapcatcher/tileFStoMGMaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def convert_file(file, dirDestination):
if coord:
zoom = MAP_MAX_ZOOM_LEVEL - coord[2]
d = os.path.join(
dirDestination,
dirDestination,
'YahooMap_' + str(zoom)
)
if not os.path.exists(d):
Expand All @@ -56,7 +56,7 @@ def convert_file(file, dirDestination):
print destFile

## Do the conversion from the given source to the destination
def do_conversion(dirSource, dirDestination):
def do_conversion(dirSource, dirDestination):
if not os.path.exists(dirSource):
print "Directory not found: \n" + dirSource
return
Expand Down
2 changes: 1 addition & 1 deletion gmapcatcher/tileFStoOSM.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def convert_file(file, dirDestination):
os.rename(file, destFile)

## Do the conversion from the given source to the destination
def do_conversion(dirSource):
def do_conversion(dirSource):
if not os.path.exists(dirSource):
print "Directory not found: \n" + dirSource
return
Expand Down
14 changes: 7 additions & 7 deletions gmapcatcher/tilesRepoRMaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def __init__(self, url_dir, url_filenameformat):

self.url_dir = url_dir
self.url_filenameformat = url_filenameformat

self.dbconns = []
self.dbcurss = []
self.dbzooms = []
Expand Down Expand Up @@ -145,26 +145,26 @@ def dbconnection(self, layer):
self.dbconns.extend(None for i in range(len(self.dbconns), layer+1))
self.dbcurss.extend(None for i in range(len(self.dbcurss), layer+1))
self.dbzooms.extend(None for i in range(len(self.dbcurss), layer+1))

if self.dbconns[layer] is None:
#print "D:sqlite3.connect( url ): " + str(thread.get_ident())
createTable = False

dburl = os.path.join(self.url_dir, self.url_filenameformat % MAP_SERVICES[layer]['TextID'])
if(not os.path.isfile(dburl)):
createTable = True

conn = sqlite3.connect( dburl )
curs = conn.cursor()

self.dbconns[layer] = conn
self.dbcurss[layer] = curs

if createTable:
#process create table
curs.executescript( SQL_DATABASE_DDL )
conn.commit()

return self.dbconns[layer]

def dbcoursor(self, layer):
Expand Down
4 changes: 2 additions & 2 deletions gmapcatcher/widCredits.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ def __init__(self):
# add real names here! :-)
AUTHORS = ["Nan Wang", "Helder Sepulveda", "Maxim Razin",
"Mark Benjamin", "Standa Mitrega", "Johan Strombom",
"Alex Knott", "Kevin Lo", "Becky Thipavong", "Tomas Penicka"]
"Alex Knott", "Kevin Lo", "Becky Thipavong", "Tomas Penicka"]
DOCUMENTERS = ["Hans Kochsmeier", "F Engelbrecht"]

gtk.AboutDialog.__init__(self)
self.set_name(NAME)
self.set_version(VERSION)
Expand Down
6 changes: 3 additions & 3 deletions gmapcatcher/widMySettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ def save_checkbox(active_bool):
gtk.CheckButton(" Save View Params ")
self.save_at_close_button.set_active(active_bool)
return self.save_at_close_button
status = myFrame(" Location Status ",
status = myFrame(" Location Status ",
statuscombo(conf.status_location))
save = myFrame(" Close Settings ",
save = myFrame(" Close Settings ",
save_checkbox(conf.save_at_close))
hbox = gtk.HBox(False, 10)
hbox.pack_start(save)
hbox.pack_start(status)
return hbox


def custom_path(conf):
def repository_type_combo(repos_type_id):
Expand Down
4 changes: 2 additions & 2 deletions gmapcatcher/xmlUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def getText(nodelist):

def load_gpx_coords(gpxfile):
from xml.dom.minidom import parseString

try:
with open(gpxfile) as f:
fileString = unicode(f.read(), errors='ignore')
Expand All @@ -60,5 +60,5 @@ def load_gpx_coords(gpxfile):
else:
coords.append((elem_lat, elem_lon))
dom.unlink()

return coords
4 changes: 2 additions & 2 deletions installer/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
url = WEB_ADDRESS,
data_files = [('share/doc/mapcatcher', ['README', 'changelog']),
('share/applications', ['gmapcatcher.desktop']),
('share/man/man1',
('share/man/man1',
['man/mapcatcher.1.gz', 'man/mapdownloader.1.gz']),
('share/pixmaps', ['images/mapcatcher.png']),
('share/pixmaps/gmapcatcher',
map(lambda(thestr): "images/" + thestr, os.listdir('images')))
],
scripts = ['mapcatcher', 'mapdownloader'],
packages = ['gmapcatcher', 'gmapcatcher.mapServers',
packages = ['gmapcatcher', 'gmapcatcher.mapServers',
'gmapcatcher.pyGPSD', 'gmapcatcher.pyGPSD.nmea',
'gmapcatcher.pyGPSD.nmea.serial']
)
Expand Down
Loading

0 comments on commit ea5b375

Please sign in to comment.