Example #1
0
 def filePathBrowseClicked(self):
     title = "Select Marker File..."
     file_filter = lib.get_file_filter()
     start_dir = lib.get_start_directory(self.getFilePath())
     result = QtWidgets.QFileDialog.getOpenFileName(self, title, start_dir,
                                                    file_filter)
     if result is not None:
         file_path = result[0]
         self.setFilePath(file_path)
     return
    def test_file_path(self):
        values = (
            ('match_mover', 'loadmarker.rz2'),
            ('uvtrack', 'test_v1.uv'),
            ('uvtrack', 'test_v3.uv'),
            ('uvtrack', 'test_v4.uv'),
        )
        for dir_name, file_name in values:
            path = self.get_data_path(dir_name, file_name)

            valid = lib_fileutils.is_valid_file_path(path)
            assert valid is True

            fmt = lib_fileutils.get_file_path_format(path)
            assert fmt is not None

            file_info = lib_fileutils.get_file_info(path)
            assert isinstance(file_info, interface.FileInfo)

            file_info_data = lib_fileutils.get_file_info_strings(path)
            assert isinstance(file_info_data, dict)
            assert len(file_info_data) == 11
            keys = file_info_data.keys()
            assert 'fmt' in keys
            assert 'fmt_name' in keys
            assert 'num_points' in keys
            assert 'point_names' in keys
            assert 'start_frame' in keys
            assert 'end_frame' in keys
            assert 'frame_range' in keys
            assert 'lens_dist' in keys
            assert 'lens_undist' in keys
            assert 'positions' in keys
            assert 'has_camera_fov' in keys

            start_dir = lib_utils.get_start_directory(path)
            assert os.path.isdir(start_dir) is True
        return