• 大小: 6.6MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-11-02
  • 语言: Python
  • 标签: Python  ArcGIS  add_in  

资源简介

ArcGIS 10.1 将 Python 引入到创作 Desktop 加载项的语言列表中,为用户提供了一种简单地扩展 desktop 功能的解决方案。要简化 Python 加载项的开发,必须下载并使用 Python 加载项向导 来声明自定义的类型。该向导将生成加载项正常工作所必需的所有文件。addin_assistant.zip

资源截图

代码片段和文件信息

import os
import re
import zipfile

current_path = os.path.dirname(os.path.abspath(__file__))

out_zip_name = os.path.join(current_path 
                            os.path.basename(current_path) + “.esriaddin“)

BACKUP_FILE_PATTERN = re.compile(“.*_addin_[0-9]+[.]py$“ re.IGNORECASE)

def looks_like_a_backup(filename):
    return bool(BACKUP_FILE_PATTERN.match(filename))

with zipfile.ZipFile(out_zip_name ‘w‘ zipfile.ZIP_DEFLATED) as zip_file:
    for filename in (‘config.xml‘ ‘README.txt‘ ‘makeaddin.py‘):
        zip_file.write(os.path.join(current_path filename) filename)
    dirs_to_add = [‘Images‘ ‘Install‘]
    for directory in dirs_to_add:
        for (path dirs files) in os.walk(os.path.join(current_path
                                                        directory)):
            archive_path = os.path.relpath(path current_path)
            found_file = False
            for file in (f for f in files if not looks_like_a_backup(f)):
                archive_file = os.path.join(archive_path file)
                print archive_file
                zip_file.write(os.path.join(path file) archive_file)
                found_file = True
            if not found_file:
                zip_file.writestr(os.path.join(archive_path
                                               ‘placeholder.txt‘)
                                  “(Empty directory)“)

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-06-12 01:38  addin_assistant\
     目录           0  2013-06-12 01:42  addin_assistant\bin\
     文件      376200  2013-06-12 01:55  addin_assistant\bin\addin_assistant.exe
     文件        2560  2012-07-26 10:46  addin_assistant\bin\api-ms-win-core-apiquery-l1-1-0.dll
     文件        3584  2012-07-26 10:42  addin_assistant\bin\api-ms-win-core-console-l1-1-0.dll
     文件        2560  2012-07-26 10:46  addin_assistant\bin\api-ms-win-core-delayload-l1-1-1.dll
     文件        3072  2012-07-26 10:46  addin_assistant\bin\api-ms-win-core-errorhandling-l1-1-1.dll
     文件        4608  2012-07-26 10:46  addin_assistant\bin\api-ms-win-core-file-l1-2-0.dll
     文件        2560  2012-07-26 10:46  addin_assistant\bin\api-ms-win-core-handle-l1-1-0.dll
     文件        3584  2012-07-26 10:46  addin_assistant\bin\api-ms-win-core-heap-obsolete-l1-1-0.dll
     文件        3072  2012-07-26 10:46  addin_assistant\bin\api-ms-win-core-interlocked-l1-2-0.dll
     文件        3584  2012-07-26 10:46  addin_assistant\bin\api-ms-win-core-libraryloader-l1-1-1.dll
     文件        4096  2012-07-26 10:46  addin_assistant\bin\api-ms-win-core-localization-l1-2-0.dll
     文件        3072  2012-07-26 10:46  addin_assistant\bin\api-ms-win-core-localization-private-l1-1-0.dll
     文件        3584  2012-07-26 10:46  addin_assistant\bin\api-ms-win-core-processenvironment-l1-2-0.dll
     文件        4608  2012-07-26 10:46  addin_assistant\bin\api-ms-win-core-processthreads-l1-1-1.dll
     文件        2560  2012-07-26 10:46  addin_assistant\bin\api-ms-win-core-profile-l1-1-0.dll
     文件        3584  2012-07-26 10:46  addin_assistant\bin\api-ms-win-core-registry-l1-1-0.dll
     文件        4096  2012-07-26 10:46  addin_assistant\bin\api-ms-win-core-synch-l1-2-0.dll
     文件        3584  2012-07-26 10:46  addin_assistant\bin\api-ms-win-core-sysinfo-l1-2-0.dll
     文件        2560  2012-07-26 10:46  addin_assistant\bin\api-ms-win-core-wow64-l1-1-0.dll
     文件        6144  2012-07-26 10:46  addin_assistant\bin\api-ms-win-security-base-l1-2-0.dll
     文件       59904  2012-04-11 14:31  addin_assistant\bin\bz2.pyd
     文件        3584  2011-12-09 07:43  addin_assistant\bin\clr.pyd
     文件      207872  2012-04-03 03:49  addin_assistant\bin\ESRISignAddIn.exe
     目录           0  2013-06-12 01:38  addin_assistant\bin\images\
     文件      325638  2013-06-12 01:30  addin_assistant\bin\images\AddInDesktop.ico
     文件        3540  2013-06-12 01:30  addin_assistant\bin\images\AddInDesktop48.png
     文件        5422  2013-06-12 01:30  addin_assistant\bin\images\AddInDesktop64.png
     文件     5190913  2013-06-12 01:35  addin_assistant\bin\library.zip
     文件       66560  2012-07-26 11:19  addin_assistant\bin\MPR.dll
............此处省略29个文件信息

评论

共有 条评论