Changeset 2271


Ignore:
Timestamp:
11/09/10 19:45:14 (19 months ago)
Author:
tolteque
Message:

o LoPlug?

  • LLF -> process received command in _data_received() not in selection() which is reserved for selection in list.
  • RTB -> remove comments
Location:
trunk/loplug/plugins
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/loplug/plugins/lockon/llf_fc2.py

    r2270 r2271  
    2929class Llf( PGService): 
    3030   
    31   TOOGLE_LLF_FEATURE = CST_LOPLUG_COMMAND + "TOOGLE_LLF_FEATURE" 
     31  TOGGLE_LLF_FEATURE = CST_LOPLUG_COMMAND + "LlfToggleFeature" 
    3232   
    3333  REQUESTED_DATAS = [ "Lockon.LuaServer." + CST_LOPLUG_REQUEST + "Latitude" 
     
    9191  # @param serviceInstanceByItemId   service dictionnary to be filled 
    9292  def fillProviderInfo( self, providerCapabilities): 
    93     providerCapabilities.append( ProviderInfo( name           = self.tr("TOOGLE_LLF_FEATURE") 
    94                                              , id             = self.build_full_itemId( Llf.TOOGLE_LLF_FEATURE) 
    95                                              , description    = self.tr("Toogle the feature: Low Level Flight") 
     93    providerCapabilities.append( ProviderInfo( name           = Llf.TOGGLE_LLF_FEATURE 
     94                                             , id             = self.build_full_itemId( Llf.TOGGLE_LLF_FEATURE) 
     95                                             , description    = self.tr("Toggle the feature: Low Level Flight") 
    9696                                             , category       = CST_LOPLUG_CAPA_CMD 
    9797                                             , type           = CST_LOPLUG_TYPE_STRING 
     
    114114    if value: 
    115115      self.targetedAltitudeASFC = int( value) 
    116     self.__computeVerticalVelocityInfo__() 
    117116 
    118117    # Get meshServer (Used to get target altitude) according to the FC version used 
    119118    fcVersion = self.parentPlug.getFcVersion() 
    120     self.mesh = getMeshServer() 
     119    self.mesh = getMeshServer( fcVersion) 
    121120     
    122121     
     
    181180    self.samplingPeriod       = self.widgets["spx_LlfSamplingPeriod"].value() 
    182181    self.targetedAltitudeASFC = self.widgets["spx_LlftargetedAltitude"].value() 
    183     self.__computeVerticalVelocityInfo__() 
    184182#---------------------------------------------------------------- 
    185183  # Method invoked by the PGPluginClient parent on restart() 
     
    202200  # @param supInfo                   suplementary info 
    203201  def _data_requested( self, srcPlugId, itemId, period, supInfo): 
     202    print "[LLF] _data_requested() ->", srcPlugId, itemId, period, supInfo 
    204203    # Create entry for this itemId if it does not exist 
    205204    if not self.plugItemRequests.has_key( itemId): 
     
    224223          del self.plugItemRequests[itemId] 
    225224#---------------------------------------------------------------- 
    226   # A toogle occurs on the LLF feature 
     225  # A toggle occurs on the LLF feature 
    227226  # @param self                      instance class 
    228227  # @param srcPlugId                 Id of the plug sending the data 
    229228  # @param datas                     datas 
    230229  def selection( self, srcPlugId, datas): 
     230    print "As there is no list -> there is no selection !!! PROBLEM IN RECEIVING THAT ..." 
     231    pass 
    231232    if self.featureEnable: 
    232233      self.debug( "[LLF] feature disable" ) 
     
    256257  # @param szobj                     object 
    257258  def _data_received( self, destSvc, srcPlugId, szobj): 
    258 #    print "[LLF] data received, itemId: %s, value: %s" % ( szobj.data_id, szobj.text) 
     259    print "[LLF] data received, itemId: %s, value: %s" % ( szobj.data_id, szobj.text) 
    259260     
    260261    if szobj.data_id == "Lockon.LuaServer.AltitudeAmsl": 
     
    283284      self.__monitAltitude__( timeNow) 
    284285      self.timeNow = timeNow 
     286       
     287    elif szobj.data_id == self.build_full_itemId( Llf.TOGGLE_LLF_FEATURE): 
     288      if self.featureEnable: 
     289        print "[LLF] feature disable" 
     290        self.featureEnable = False 
     291      else: 
     292        print "[LLF] feature enable" 
     293        self.featureEnable = True 
     294      self.__sendData__( None, Llf.TOGGLE_LLF_FEATURE)   
     295       
    285296    else: 
    286297      raise ValueError("Unknown itemId %s" % szobj.data_id) 
     
    316327  def __sendData__( self, srcPlugId, itemId): 
    317328    objToSend = None 
    318     if itemId == Llf.TOOGLE_LLF_FEATURE: 
     329    if itemId == Llf.TOGGLE_LLF_FEATURE: 
    319330      if self.featureEnable: 
    320331        objToSend = SzText( from_id = self.parentPlug.get_name() 
    321                           , data_id = self.build_full_itemId( Llf.TOOGLE_LLF_FEATURE) 
    322                           , text    = str( "Switch LLF On") 
     332                          , data_id = self.build_full_itemId( Llf.TOGGLE_LLF_FEATURE) 
     333                          , text    = str( "LLF is On") 
    323334                          ) 
    324335      else: 
    325336        objToSend = SzText( from_id = self.parentPlug.get_name() 
    326                           , data_id = self.build_full_itemId( Llf.TOOGLE_LLF_FEATURE) 
    327                           , text    = str( "Switch LLF Off") 
     337                          , data_id = self.build_full_itemId( Llf.TOGGLE_LLF_FEATURE) 
     338                          , text    = str( "LLF is Off") 
    328339                          ) 
    329340     
    330341    if objToSend: 
    331       if not srcPlugId: 
    332         srcPlugId = self.plugItemRequests[itemId] 
    333       self.parentPlug.send_object( srcPlugId, PGPluginClient.OPCODE_DATA_VALUE, objToSend )   
    334  
    335  
     342      if srcPlugId: 
     343        self.parentPlug.send_object( [srcPlugId], PGPluginClient.OPCODE_DATA_VALUE, objToSend ) 
     344      else: 
     345        self.parentPlug.send_object( self.plugItemRequests[itemId], PGPluginClient.OPCODE_DATA_VALUE, objToSend )   
     346       
    336347#---------------------------------------------------------------- 
    337348  # Performe the altitude control for the feature 
     
    414425    for index in range( 0, nbrOfCheckPoint): 
    415426      radius = index * unitaryRadius 
    416       self.checkPointList.append( CheckPoint( index, radius, self.luaPointList[index]) 
     427      self.checkPointList.append( CheckPoint( index, radius, self.luaPointList[index])) 
    417428  
    418429    # Set target elevation for each point according the ground slop at this point 
     
    551562    else: 
    552563      sign = -1 
    553      
    554     return radius = math.sqrt( (radius_C**2) + (elevation_C**2)), sign 
     564    radius = math.sqrt( (radius_C**2) + (elevation_C**2)) 
     565    return radius, sign 
    555566       
    556567# ======================================================================================================== 
     
    653664  # Set the a coef for speed vector 
    654665  # @param self                   Instance class 
    655   def setSpeedVectorCoef( self, aCoefSpeed) 
     666  def setSpeedVectorCoef( self, aCoefSpeed): 
    656667    self.aCoefSpeed = aCoefSpeed 
    657668#---------------------------------------------------------------- 
    658669  # Returns the speed vector coef at this point 
    659670  # @param self                   Instance class 
    660   def getSpeedVectorCoef( self) 
     671  def getSpeedVectorCoef( self): 
    661672    return self.aCoefSpeed 
    662673       
  • trunk/loplug/plugins/lockon/rtb.py

    r2097 r2271  
    179179      airportClsId = airportInfo["clsId"].lower() 
    180180      self.widgets[airportClsId] = QCheckBox( QString( airportName)) 
    181       print airportInfo["side"] 
     181#      print airportInfo["side"] 
    182182      if airportInfo["side"] == "Blue": 
    183183        blueAirports_vBox.addWidget( self.widgets[airportClsId]) 
  • trunk/loplug/plugins/teamspeak/pgteamspeak.py

    r2043 r2271  
    284284  # So, here execute restart specific part. 
    285285  # @param self                      instance class 
    286   # @param srcPlugId                 Id of the requester plug (renderer) 
    287   # @param dataId                    identifier of the requested data 
    288   # @param period                    not used 
    289   # @param supInfo                   not used 
     286  # @param szDataRequest             serialized request 
    290287  def _data_requested( self, szDataRequest): 
    291288    # Create entry for this data if not yet done 
Note: See TracChangeset for help on using the changeset viewer.