def show_gpstrackanalyzer(self, gpstrack): if self.gpstrackanalyzer_window: if gpstrack == self.gpstrackanalyzer_window.track: # Analyze the track that is already open: just bring the window # to front. util.force_show_window(self.gpstrackanalyzer_window) return else: # Analyze new track: Close the old window and create a new one. self.gpstrackanalyzer_window.Close() # We need to let wx process the destroy events before # re-creating the window, otherwise no events are handled in # the new child window (possibly an oddity in wxPython?) # # Waiting for EVT_WINDOW_DESTROY is not enough, unfortunately. # The 50 ms timer seems to solve the issue reliably, though. self.gpstrack_timer = wx.Timer(self) self.gpstrack_timer.Notify = \ lambda: self.show_gpstrackanalyzer(gpstrack) self.gpstrack_timer.StartOnce(50) return self.gpstrackanalyzer_window = frmGPSAnalyzer.GPSTrackAnalyzerFrame( self, gpstrack, self.heightfinder) self.gpstrackanalyzer_window.Show()
def on_manage_maps(self, evt): if self.manage_maps_window: util.force_show_window(self.manage_maps_window) else: self.manage_maps_window = frmMapManager.MapManagerFrame( self, self.filelist) self.manage_maps_window.Show()
def on_display_tool(self, evt): if not self.maptreectrl.GetSelection().IsOk(): util.Warn(self, _("No map selected!\n\n" + "Please select the map you want to display.")) return self.display_map(self.maptreectrl.GetSelection()) util.force_show_window(self.parent)
def on_item_activated(self, evt): # User double-clicked the item or pressed enter on it. container, drawable = self.maptreectrl.GetItemData(evt.Item) if not drawable: # If the item is not actually drawable, abort. return if drawable.GetType() == pymaplib.GeoDrawable.TYPE_GPSTRACK: self.overlay_map(evt.Item) else: self.display_map(evt.Item) util.force_show_window(self.parent)
def on_display_menu(self, evt): self.display_map(self.popup_item) util.force_show_window(self.parent)