Skip to content

Commit

Permalink
Cleanup the TracklogManager module
Browse files Browse the repository at this point in the history
  • Loading branch information
M4rtinK committed Jan 2, 2022
1 parent d5ad192 commit 0b101fe
Showing 1 changed file with 0 additions and 45 deletions.
45 changes: 0 additions & 45 deletions modules/mod_tracklogManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,56 +30,11 @@ class TracklogManager(RanaModule):

def __init__(self, *args, **kwargs):
RanaModule.__init__(self, *args, **kwargs)
self.scrollDict = {}
self.currentNumItems = 0
self.LTModule = None

def firstTime(self):
self.LTModule = self.m.get('loadTracklogs', None)

def handleMessage(self, message, messageType, args):

if message == 'getElevation':
self.log.info("getting elevation info for active tracklog")
activeTracklog = self.LTModule.get_active_tracklog()
# generate a list of (lat,lon) tuples
latLonList = map(lambda x: (x.latitude, x.longitude), activeTracklog.trackpointsList[0])
# look-up elevation data using Geonames asynchronously
online = self.m.get("onlineServices", None)
if online:
online.elevFromGeonamesBatchAsync(latLonList, self._handleElevationLookupResults,
'geonamesBatchResults', activeTracklog)


elif message == 'loadTrackProfile':
# get the data needed for drawing the dynamic route profile in the osd
track = self.LTModule.get_active_tracklog()
self.m.get('showOSD', None).routeProfileData = track.perElevList

elif message == 'unLoadTrackProfile':
self.m.get('showOSD', None).routeProfileData = None

elif message == 'askDeleteActiveTracklog':
ask = self.m.get('askMenu', None)
path = self.LTModule.get_active_tracklog_path()
question = "do you really want to delete:|%s|?" % path
yesAction = "tracklogManager:deleteActiveTracklog|set:menu:tracklogManager#tracklogManager"
noAction = "set:menu:tracklogManager#tracklogInfo"
ask.setupAskYesNo(question, yesAction, noAction)

elif message == 'deleteActiveTracklog':
path = self.LTModule.get_active_tracklog_path()
if path:
self.deleteTracklog(path)
self.set('activeTracklogPath', None)

elif message == 'setActiveTracklogToCurrentCat':
path = self.LTModule.get_active_tracklog_path()
currentCategory = self.get('currentTracCat', None)
if currentCategory:
self.log.info("changing category for:\n%s\nto %s" % path, currentCategory)
self.LTModule.setTracklogPathCategory(path, currentCategory)

def deleteTracklog(self, path):
# delete a tracklog
self.log.info("deleting tracklog:%s", path)
Expand Down

0 comments on commit 0b101fe

Please sign in to comment.