def GPSunceckbuttons(self):
     Utils.preferences().setSettings('actionGPS',self.actionT_GPS.isChecked())
     self.actionT_LonLat.setChecked(False)
     if Utils.haveGRASS_ != 0:
         self.actionT_Grass.setChecked(False)
     #TBD
     """
     if self.actionJoystick.isChecked():
         self.joy.stop()
         self.actionJoystick.setChecked(False)
     """    
     if self.actionT_HW.isChecked():
         self.hw.stop()
         self.actionT_HW.setChecked(False)
 def ResetPosition(self):
     #xprint 'reset position'
     head = self.head
     if head == str('Manual'):
         self.heads = self.HandlingSlider.value()
     if Utils.preferences().getSettings('actionLonLat'):
         self.fxvallon = self.SetPosition()[0]
         self.fxvallat = self.SetPosition()[1]
         if self.northeast.isChecked():
             (z, e, n) = LLtoUTM(ell, self.fxvallat, self.fxvallon)
             self.Nord.setText(str(n))
             self.east.setText(str(e))
             self.utmcode.setText(str(z))
         ossimxml =  Utils.makeActionTemplate(self.item, unicode(self.fxvallon), unicode(self.fxvallat), 
                                          self.ZoomSlider.value(), 0, 0, 
                                          0, self.RangeSlider.value())
         self.Lat.setText(unicode(self.fxvallat))
         self.Lon.setText(unicode(self.fxvallon))
         self.fireAction(ossimxml)
     if Utils.haveGRASS_ != 0:
         if self.actionGrass.isChecked():
             self.slvallon = self.getCenter()[0]
             self.slvallat = self.getCenter()[1]
             #xprint self.slvallon, self.slvallat
             if self.northeast.isChecked():
                 xy = getlonlat(self.slvallon,self.slvallat)
                 self.Nord.setText(xy[1])
                 self.east.setText(xy[0])
         ossimxml =  Utils.makeActionTemplate(self.item, unicode(self.slvallon), unicode(self.slvallat), 
                                          self.ZoomSlider.value(), 0, 0, 
                                          0, self.RangeSlider.value())
         self.Lat.setText(unicode(self.slvallat))
         self.Lon.setText(unicode(self.slvallon))
         self.fireAction(ossimxml)
     if Utils.preferences().getSettings('actionGPS'):
         #self.CrossClassLon = float(self.CrossClassLon)
         #self.CrossClassLat = float(self.CrossClassLat)
         coordsfile = apppath+'/lonlatfile'
         f = open(coordsfile, "r")
         lonlat = f.readline()
         lonlat = lonlat.split(' ')
         lon = lonlat[0]
         lat = lonlat[1]
         ossimxml =  Utils.makeActionTemplate(self.item, lon, lat, self.ZoomSlider.value(), self.heads, 
                                          self.PitchSlider.value(), self.RollSlider.value(),
                                          self.RangeSlider.value())
         self.Lat.setText(unicode(self.CrossClassLat))
         self.Lon.setText(unicode(self.CrossClassLon))
         self.fireAction(ossimxml)
 def onTActionBroadCast(self):
     checked = self.actionT_Broadcast.isChecked()
     print checked
     self.actionT_Broadcast.setChecked(checked)
     Utils.preferences().setSettings('actionBroadcast', checked )
     self.actionT_GPS.setChecked(False)
     self.actionT_LonLat.setChecked(False)
     if Utils.haveGRASS_ != 0:
         self.actionT_Grass.setChecked(False)
     #self.actionJoystick.setChecked(False)
     self.actionT_HW.setChecked(False) 
     if self.navwin:
         self.navwin.toogleBroadCast(self.actionT_Broadcast.isChecked())
     else:
         print 'nav win not created'       
 def getViewVal(self):
     #lon,lat,zoom,heads,pitch,roll,range = 0,0,0,0,0,0,0
     pitch = self.PitchSlider.value()
     roll = self.RollSlider.value()
     rng = self.RangeSlider.value()
     zoom = self.ZoomSlider.value()
     heads = self.head
     lon = self.Lon.text()
     lat = self.Lat.text()
     if heads == str('Manual'):
         heads = self.HandlingSlider.value()
     if Utils.preferences().getSettings('actionLonLat'): #self.actionLonLat.isChecked():
         lat = self.fxvallat
         lon = self.fxvallon
         if self.northeast.isChecked():
             (z, e, n) = LLtoUTM(ell, lat, lon)
             self.Nord.setText(str(n))
             self.east.setText(str(e))
             self.utmcode.setText(str(z))
     """
     TBMV: to grass and gps window
     if Utils.haveGRASS_ != 0:
         if Utils.preferences().getSettings('actionGrass'): #self.actionGrass.isChecked():
             lon = self.slvallon
             lat = self.slvallat
             if self.northeast.isChecked():
                 xy = getlonlat(lon,lat)
                 self.Nord.setText(xy[1])
                 self.east.setText(xy[0])
     if Utils.preferences().getSettings('actionGPS'): #self.actionGPS.isChecked():
         lon = self.GPSlon.text()
         lat = self.GPSlat.text()
     """    
     pos = [lon,lat,zoom,heads,pitch,roll,rng]
     return pos
 def sendFunction(self):
     if Utils.preferences().getSettings('actionLonLat'):
         pos = self.getViewVal()
         #xprint pos
         ossimxml =  Utils.makeActionTemplate(self.item, pos[0], pos[1], pos[2], pos[3], pos[4], pos[5], pos[6])
         self.fireAction(ossimxml)
         self.Lat.setText(unicode(pos[1]))
         self.Lon.setText(unicode(pos[0]))
    def onTActionLonLat(self):

        checked = not self.actionT_LonLat.isChecked()
        self.actionT_Broadcast.setChecked(checked)
        Utils.preferences().setSettings('actionLonLat', checked )
        
        if self.actionT_GPS.isChecked():
            self.gpsx.stop()
            self.actionT_GPS.setChecked(False)
        if Utils.haveGRASS_ != 0:
            self.actionT_Grass.setChecked(False)
        #if self.actionJoystick.isChecked():
        #    self.joy.stop()
        #    self.actionJoystick.setChecked(False)
        if self.actionT_HW.isChecked():
            self.hw.stop()
            self.actionT_HW.setChecked(False)
    def pan(self, action):
        step = float(self.SpeedSpinBox.value())
        mult = float(self.SpeedMultipler.value())
        step = step * (10 ** -mult)

        if Utils.preferences().getSettings('actionLonLat'):
            if action == 'inclat' :
                self.fxvallat += step
            if action == 'inclon' :
                self.fxvallon += step
            if action == 'declat' :
                self.fxvallat -= step
            if action == 'declon' :
                self.fxvallon -= step
            if action == 'inclatlon' :
                self.fxvallat += step
                self.fxvallon += step
            if action == 'declatlon' :
                self.fxvallat -= step
                self.fxvallon -= step
            if action == 'inclatdeclon' :
                self.fxvallat += step
                self.fxvallon -= step
            if action == 'declatinclon' :
                self.fxvallat -= step 
                self.fxvallon += step
        if Utils.haveGRASS_ != 0:
            if self.actionGrass.isChecked():
                if action == 'inclat' :
                    self.slvallat += step
                if action == 'inclon' :
                    self.slvallon += step
                if action == 'declat' :
                    self.slvallat -= step
                if action == 'declon' :
                    self.slvallon -= step
                if action == 'inclatlon' :
                    self.slvallat += step
                    self.slvallon += step
                if action == 'declatlon' :
                    self.slvallat -= step
                    self.slvallon -= step
                if action == 'inclatdeclon' :
                    self.slvallat += step
                    self.slvallon -= step
                if action == 'declatinclon' :
                    self.slvallat -= step 
                    self.slvallon += step
        pos = self.getViewVal()
        ossimxml =  Utils.makeActionTemplate(self.item, pos[0], pos[1], pos[2], pos[3], pos[4], pos[5], pos[6])
        self.fireAction(ossimxml)
        self.Lat.setText(unicode(pos[1]))
        self.Lon.setText(unicode(pos[0]))
 def fireAction(self, xml):
     result = Utils.fireAction(xml)
     if result < 0:
             if not Utils.preferences().getSettings('actionBroadcast'):#self.actionBroadcast.isChecked(): FIXME
                 self.CeckViewTypeState()
 def CeckViewTypeState(self):
     if not Utils.preferences().getSettings('actionLonLat'): #self.actionLonLat.isChecked():
         if Utils.haveGRASS_ !=0:
             if not Utils.preferences().getSettings('actionGrass'): #self.actionGrass.isChecked():
                 #self.worningmessage('check a view type')
                 x = 1