def refresh_widgets(self):
     """
     Check through mainframe what the state of the application is
     and reset widgets. For exampe enable/disable widgets
     dependent on the availability of data. 
     """
     scenario = self.get_scenario()
     # print 'demand refresh_widgets',scenario.net
     is_refresh = False
     if self._scenario != scenario:
         del self._scenario
         del self._mapmatching
         self._scenario = scenario
         self._mapmatching = mapmatching.Mapmatching(
             'mapmatching', self._scenario)
         #self._mapmatching = self._demand.add_demandobject(ident = 'mapmatching', DemandClass = mapmatching.Mapmatching)
         is_refresh = True
Beispiel #2
0
    def refresh_widgets(self):
        """
        Check through mainframe what the state of the application is
        and reset widgets. For exampe enable/disable widgets
        dependent on the availability of data. 
        """
        print 'MapmatchingWxGui.refresh_widgets'
        scenario = self.get_scenario()
        is_refresh = False
        if self._scenario != scenario:
            del self._scenario
            del self._mapmatching
            self._scenario = scenario
            #self._mapmatching =  self._demand.add_demandobject(ident = 'mapmatching', DemandClass = mapmatching.Mapmatching)
            self._mapmatching = mapmatching.Mapmatching(
                'mapmatching', scenario)
            is_refresh = True

        if is_refresh | self._is_needs_refresh:
            self._is_needs_refresh = False
            print '  is_refresh', is_refresh, self._is_needs_refresh
            neteditor = self.get_neteditor()
            #canvas = self.get_canvas()
            drawing = self.get_drawing()  # canvas.get_drawing()

            # add or refresh facility drawing
            drawing.set_element('gpspointsdraws',
                                GpsPointsDrawings,
                                self._mapmatching.points,
                                layer=150)

            drawing.set_element('gpsroutesdraws',
                                GpsRoutesDrawings,
                                self._mapmatching.trips.get_routes(),
                                layer=149)

            # neteditor.get_toolbox().add_toolclass(AddZoneTool)# will check if tool is already there
            # neteditor.get_toolbox().add_toolclass(AddFacilityTool)
            neteditor.draw()

        self._canvas = self.get_canvas()