mirror of
				https://github.com/iiab/iiab.git
				synced 2025-03-09 15:40:17 +00:00 
			
		
		
		
	Merge branch 'register-map' of https://github.com/georgejhunt/iiab into register-map
This commit is contained in:
		
						commit
						3ca7b266cc
					
				
					 1 changed files with 7 additions and 5 deletions
				
			
		| 
						 | 
					@ -54,7 +54,6 @@ def main():
 | 
				
			||||||
   # For installed regions, check that a menu def exists, and it's on home page
 | 
					   # For installed regions, check that a menu def exists, and it's on home page
 | 
				
			||||||
   for fname in installed_maps:
 | 
					   for fname in installed_maps:
 | 
				
			||||||
      region = extract_region_from_filename(fname)
 | 
					      region = extract_region_from_filename(fname)
 | 
				
			||||||
      print('checking for %s region'%region)
 | 
					 | 
				
			||||||
      if region == 'maplist': # it is the splash page, display only if no others
 | 
					      if region == 'maplist': # it is the splash page, display only if no others
 | 
				
			||||||
         menu_ref = 'en-map_test'
 | 
					         menu_ref = 'en-map_test'
 | 
				
			||||||
         item = { "perma_ref" : "en-map_test" }
 | 
					         item = { "perma_ref" : "en-map_test" }
 | 
				
			||||||
| 
						 | 
					@ -128,6 +127,7 @@ def write_vector_map_idx(installed_maps):
 | 
				
			||||||
      region = extract_region_from_filename(fname)
 | 
					      region = extract_region_from_filename(fname)
 | 
				
			||||||
      if map == 'maplist': continue # not a real region
 | 
					      if map == 'maplist': continue # not a real region
 | 
				
			||||||
      map_dict = map_catalog['regions'].get(region,'')
 | 
					      map_dict = map_catalog['regions'].get(region,'')
 | 
				
			||||||
 | 
					      print('check for %s in %s'%(region,map_dict))
 | 
				
			||||||
      if map_dict == '': continue
 | 
					      if map_dict == '': continue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      # Create the idx file in format required bo js-menu system
 | 
					      # Create the idx file in format required bo js-menu system
 | 
				
			||||||
| 
						 | 
					@ -192,11 +192,13 @@ def fetch_menu_json_value(key):
 | 
				
			||||||
      return data.get(key,'')
 | 
					      return data.get(key,'')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def extract_region_from_filename(fname):
 | 
					def extract_region_from_filename(fname):
 | 
				
			||||||
   nibble = re.search(r"^.._osm_..._(.*)_[0-9]{4}",fname)
 | 
					   # find the index of the date
 | 
				
			||||||
   if not nibble:
 | 
					   nibble = re.search(r"\d{4}-\d{2}-\d{2}",fname)
 | 
				
			||||||
 | 
					   if nibble:
 | 
				
			||||||
 | 
					      fname = fname[:nibble.start()-1]
 | 
				
			||||||
 | 
					      return fname
 | 
				
			||||||
 | 
					   else:
 | 
				
			||||||
      return("maplist")
 | 
					      return("maplist")
 | 
				
			||||||
   resp = nibble.group(1)
 | 
					 | 
				
			||||||
   return(resp)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
if __name__ == '__main__':
 | 
					if __name__ == '__main__':
 | 
				
			||||||
   if console_installed:
 | 
					   if console_installed:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue