コード例 #1
0
ファイル: widgets.py プロジェクト: ojss/AUVSI-TAS-System
    def updateTarget(self, target):
        lat, lon = decimal_to_minsec(target.lat, target.lon)
        self.target_type.text = target.type
        self.shape.text = target.shape
        self.shape_color.text = target.shape_color
        self.text.text = target.text
        self.text_color.text = target.text_color
        self.target_orientation.text = str(target.orientation)
        self.desc.text = target.desc
        self.lat.text = '{minsec_lat} ({dec_lat})'.format(minsec_lat=lat,
                                                          dec_lat=str(
                                                              target.lat))
        self.lon.text = '{minsec_lon} ({dec_lon})'.format(minsec_lon=lon,
                                                          dec_lon=str(
                                                              target.lon))
        self.crop_name.text = target.crop_name
        self.crop_path.text = target.crop_path

        self.target_type.readonly = target.committed
        self.shape.readonly = target.committed
        self.shape_color.readonly = target.committed
        self.text.readonly = target.committed
        self.text_color.readonly = target.committed
        self.target_orientation.readonly = target.committed
        self.desc.readonly = target.committed
コード例 #2
0
ファイル: widgets.py プロジェクト: ojss/AUVSI-TAS-System
    def updateTargetLocation(self, lat, lon):
        """Update the location pressed by the user."""

        minsec_lat, minsec_lon = decimal_to_minsec(lat, lon)

        self.target_coords_degrees.text = u'Lat: {}    Lon: {}'.format(
            minsec_lat, minsec_lon)
        self.target_coords_fp.text = u'Lat: {}    Lon: {}'.format(lat, lon)
コード例 #3
0
ファイル: widgets.py プロジェクト: ojss/AUVSI-TAS-System
    def updateLocationOnMap(self, lat, lon):
        """Update the location pressed by the user."""

        minsec_lat, minsec_lon = decimal_to_minsec(lat, lon)

        self.tc_degrees.text = u'Lat: {}    Lon: {}'.format(
            minsec_lat, minsec_lon)
        self.tc_fp.text = u'Lat: {}    Lon: {}'.format(lat, lon)
コード例 #4
0
    def saveTargetsFile(self, path, format):
        log.msg('Writing targets to {path}'.format(path=path))

        dir_path, name = os.path.split(path)

        try:
            with open(path, 'w') as f:
                index = 1

                for target in self.final_targets:
                    try:
                        target_index = target.commit_index if format == 'interop' else index
                        new_crop_name = 'T{index}.jpg'.format(index=target_index)
                        new_crop_path = os.path.join(dir_path, new_crop_name)
                        shutil.copyfile(target.crop_path, new_crop_path)

                        if format == 'interop':
                            lat, lon = str(target.lat), str(target.lon)
                            target_type = self.translateTargetType(target.type)
                            shape = self.translateShape(target.shape)
                            shape_color = self.translateColor(target.shape_color)
                            text_color = self.translateColor(target.text_color)
                        else:
                            lat, lon = decimal_to_minsec(target.lat, target.lon)
                            target_type = target.type
                            shape = target.shape
                            shape_color = target.shape_color
                            text_color = target.text_color

                        if target.adlc:
                            desc = 'Automatic detection'
                        else:
                            desc = target.desc

                        line = '%02d\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' % (
                            target_index,
                            target_type,
                            lat,
                            lon,
                            target.orientation,
                            shape,
                            shape_color,
                            target.text,
                            text_color,
                            new_crop_name,
                            desc
                        )
                        f.write(line)

                        index += 1

                    except Exception as e:
                        log.err(e, 'Cannot write target information')

        except Exception as e:
            log.err(e, 'Cannot export target file')
コード例 #5
0
ファイル: widgets.py プロジェクト: ojss/AUVSI-TAS-System
    def __init__(self, crop_path, target_shape, bg_color, orient, char,
                 char_color, latitude, longitude, *params, **kwds):
        super(Target, self).__init__(*params, **kwds)
        self.target_image.source = crop_path
        self.targt_shape.theTxt.text = target_shape
        self.bg_color.theTxt.text = bg_color
        self.orient.theTxt.text = str(orient)
        self.char.theTxt.text = char
        self.char_color.theTxt.text = char_color

        minsec_lat, minsec_lon = decimal_to_minsec(latitude, longitude)

        self.latitude.theTxt.text = '{0:.7f}'.format(latitude)
        self.latitude_deg.theTxt.text = minsec_lat
        self.longitude.theTxt.text = '{0:.7f}'.format(longitude)
        self.longitude_deg.theTxt.text = minsec_lon
コード例 #6
0
    def __init__(self, app=None, target=None, **kwargs):
        super(CommitPopup, self).__init__(**kwargs)
        self.register_event_type('on_answer')
        self._app = app
        self._target = target
        self._answered = False
        self.target_image.source = target.crop_path
        self.target_image.parent.rotation = 0 #-target.yaw
        self.text = 'Type: {target_type}\n'.format(target_type=target.type)
        self.text += 'Shape: {shape}\n'.format(shape=target.shape)
        self.text += 'Shape color: {shape_color}\n'.format(shape_color=target.shape_color)
        self.text += 'Text: {text}\n'.format(text=target.text)
        self.text += 'Text color: {text_color}\n'.format(text_color=target.text_color)
        self.text += 'Orientation: {orientation}\n'.format(orientation=target.orientation)
        self.text += 'Description: {desc}\n'.format(desc=target.desc)

        lat, lon = decimal_to_minsec(target.lat, target.lon)
        self.text += 'Latitude: {lat}\n'.format(lat=lat)
        self.text += 'Longitude: {lon}\n'.format(lon=lon)
コード例 #7
0
ファイル: widgets.py プロジェクト: ojss/AUVSI-TAS-System
    def updateTargetLocation(self, lat, lon):
        minsec_lat, minsec_lon = decimal_to_minsec(lat, lon)

        self.target_coords_degrees.text = u'Lat: {}    Lon: {}'.format(
            minsec_lat, minsec_lon)
        self.target_coords_fp.text = u'Lat: {}    Lon: {}'.format(lat, lon)
コード例 #8
0
ファイル: widgets.py プロジェクト: ojss/AUVSI-TAS-System
 def updateTargetLocation(self, lat, lon):
     minsec_lat, minsec_lon = decimal_to_minsec(lat, lon)