• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python module_locator.module_path函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中module_locator.module_path函数的典型用法代码示例。如果您正苦于以下问题:Python module_path函数的具体用法?Python module_path怎么用?Python module_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了module_path函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: run_kmgdgis3D

def run_kmgdgis3D():
    time.sleep(3)
    exe = os.path.join(module_path().replace('\\script', '\\bin'), 'kmgdgis3D.exe')
    if hasattr(sys, "frozen"):
        exe = os.path.join(module_path(), 'kmgdgis3D.exe')
    log('launching [%s]...' % exe)
    p = Popen(exe)
开发者ID:kamijawa,项目名称:kmgdgis3D,代码行数:7,代码来源:proxy.py


示例2: modify_config_js

def modify_config_js():
    path = os.path.join(module_path(), '..', 'data', 'www', 'js', 'config.js')
    l = []
    with open(path) as f:
        for i in f.readlines():
            if len(i.strip())>14 and i.strip()[:14] == 'var g_app_root':
                root = os.path.join(module_path(), '..','data', 'www')
                root = root.replace('\\','/')
                g_app_root = 'var g_app_root = "file:///' + root + '";\r\n'
                l.append(g_app_root)
            elif len(i.strip())>20 and i.strip()[:20] == 'var g_local_tile_url':
                g_local_tile_path = 'var g_local_tile_url = "%s";\r\n' % gConfig['map_local_tiles_url']
                l.append(g_local_tile_path)
            elif "var g_default_basemap" in i:
                if len(gConfig['map_local_tiles_url'])>0:
                    l.append("var g_default_basemap = 'basemap_esrilocal';\r\n")
                else:
                    l.append("var g_default_basemap = 'basemap_googlesat';\r\n")
            elif "'basemap_esrilocal':'本地地图'," in i:
                if len(gConfig['map_local_tiles_url'])>0:
                    l.append("\t'basemap_esrilocal':'本地地图',\r\n")
                else:
                    l.append("\t//'basemap_esrilocal':'本地地图',\r\n")
            else:
                l.append(i)
                
    s = ''
    for i in l:
        s += dec(i) 
    #print(s)
    with open(path, 'w') as f:
        f.write(enc(s))
开发者ID:kamijawa,项目名称:kmgdgis3D,代码行数:32,代码来源:proxy.py


示例3: Arc2GeoJsonTunnel

def Arc2GeoJsonTunnel(name):
    path = os.path.join(module_path(), JSON_DIR, 'arcjson_tunnel_%s.json' % name)
    arcjson = None
    if os.path.exists(path):
        with open(path) as f:
            arcjson = json.loads(f.read())
    if arcjson:
        offsetx, offsety = CalcOffset(name)
        obj = {}
        obj['type'] = 'FeatureCollection'
        obj['features'] = []
        for feature in arcjson['features']:
            for path in feature['geometry']['paths']:
                o = {}
                o['type'] = 'Feature'
                o['properties'] = {}
                o['geometry'] = {}
                o['geometry']['type'] = 'LineString'
                o['geometry']['coordinates'] = []
                for point in path:
                    lng, lat = ToGeographic(point[0] + offsetx, point[1] + offsety)
                    o['geometry']['coordinates'].append([lng, lat])
                obj['features'].append(o)
        
        path = '%s/geojson_tunnel_%s.json' % (JSON_DIR, name)
        with open(path, 'w') as f:
            f.write(json.dumps(obj, ensure_ascii=True, indent=4) + '\n')
开发者ID:kamijawa,项目名称:kmgdgis3D,代码行数:27,代码来源:dwg2geojson.py


示例4: show_help

 def show_help(self):
     """ Purpose: This is called when the user selects the 'Help Text' menubar option. It opens the README.html file
                  in their default browser. If the file doesn't exist it opens the github readme page instead.
     """
     # Grab the directory where the script is running.
     readme = module_path()
     # Determine our OS, attach the README.html file to the path, and open that file.
     if sys.platform.startswith('darwin'):
         readme += "/README.html"
         if os.path.isfile(readme):
             subprocess.call(('open', readme))
         else:
             try:
                 webbrowser.open('https://github.com/nprintz/jaide')
             except webbrowser.Error:
                 pass
     elif os.name == 'nt':
         readme += "\\README.html"
         if os.path.isfile(readme):
             os.startfile(readme)  # this works on windows, not sure why pylint shows an error. 
         else: 
             try:
                 webbrowser.open('https://github.com/nprintz/jaide')
             except webbrowser.Error:
                 pass
     elif os.name == 'posix':
         readme += "/README.html"
         if os.path.isfile(readme):
             subprocess.call(('xdg-open', readme))
         else: 
             try:
                 webbrowser.open('https://github.com/nprintz/jaide')
             except webbrowser.Error:
                 pass
开发者ID:fmcphail,项目名称:jaide,代码行数:34,代码来源:jgui.py


示例5: Activated

    def Activated(self):
        import os
        try:
            from . import module_locator
        except:
            import module_locator
        try:
            from CadQuery.CQGui import ImportCQ
        except:
            from CQGui import ImportCQ

        module_base_path = module_locator.module_path()

        import cadquery
        from PySide import QtGui, QtCore

        msg = QtGui.QApplication.translate(
            "cqCodeWidget",
            "CadQuery " + cadquery.__version__ + "\r\n"
            "CadQuery is a parametric scripting API "
            "for creating and traversing CAD models\r\n"
            "Author: David Cowden\r\n"
            "License: Apache-2.0\r\n"
            "Website: https://github.com/dcowden/cadquery\r\n",
            None)
        FreeCAD.Console.PrintMessage(msg)

        #Getting the main window will allow us to start setting things up the way we want
        mw = FreeCADGui.getMainWindow()

        dockWidgets = mw.findChildren(QtGui.QDockWidget)

        for widget in dockWidgets:
            if widget.objectName() == "Report view":
                widget.setVisible(True)
开发者ID:jmwright,项目名称:cadquery-freecad-module,代码行数:35,代码来源:InitGui.py


示例6: show_examples

 def show_examples(self):
     """ Purpose: This method opens the example folder for the user, or open the github page for the example folder. 
     """
     # Grab the directory that the script is running from. 
     examples = module_path()
     # Determin our OS, attach the README.html file to the path, and open that file.
     if sys.platform.startswith('darwin'):
         examples += "/examples/"
         if os.path.isdir(examples):
             subprocess.call(('open', examples))
         else:
             try:
                 webbrowser.open('https://github.com/nprintz/jaide/examples')
             except webbrowser.Error:
                 pass
     elif os.name == 'nt':
         examples += "\\examples\\"
         if os.path.isdir(examples):
             os.startfile(examples)  # this works on windows, not sure why pylint shows an error. 
         else: 
             try:
                 webbrowser.open('https://github.com/nprintz/jaide/examples')
             except webbrowser.Error:
                 pass
     elif os.name == 'posix':
         examples += "/examples/"
         if os.path.isdir(examples):
             subprocess.call(('xdg-open', examples))
         else: 
             try:
                 webbrowser.open('https://github.com/nprintz/jaide/examples')
             except webbrowser.Error:
                 pass
开发者ID:fmcphail,项目名称:jaide,代码行数:33,代码来源:jgui.py


示例7: Activated

    def Activated(self):
        FreeCAD.Console.PrintMessage(self.exFile + "\r\n")

        #So we can open the "Open File" dialog
        mw = FreeCADGui.getMainWindow()

        #Start off defaulting to the Examples directory
        module_base_path = module_locator.module_path()
        exs_dir_path = os.path.join(module_base_path, 'Examples')

        #We need to close any file that's already open in the editor window
        CadQueryCloseScript().Activated()

        #Append this script's directory to sys.path
        sys.path.append(os.path.dirname(exs_dir_path))

        #We've created a library that FreeCAD can use as well to open CQ files
        ImportCQ.open(os.path.join(exs_dir_path, self.exFile))

        docname = os.path.splitext(os.path.basename(self.exFile))[0]
        FreeCAD.newDocument(docname)

        #Execute the script
        CadQueryExecuteScript().Activated()

        #Get a nice view of our model
        FreeCADGui.activeDocument().activeView().viewAxometric()
        FreeCADGui.SendMsgToActiveView("ViewFit")
开发者ID:abdullahtahiriyo,项目名称:cadquery-freecad-module,代码行数:28,代码来源:Command.py


示例8: get_backlinks

def get_backlinks(onion_url):
    """ Call backlink tester and return the number of backlinks. """
    my_path = module_locator.module_path()
    backlink_tool = my_path + "/backlinkers.py"
    args = ["python", backlink_tool, "-c", onion_url]  # TODO: use the new backlinker spider instead?
    proc = subprocess.Popen(args, stdout=subprocess.PIPE)
    count = int(proc.communicate()[0])
    return count
开发者ID:DeveloperVox,项目名称:ahmia,代码行数:8,代码来源:gather_backlinks_data.py


示例9: Activated

    def Activated(self):
        module_base_path = module_locator.module_path()
        templ_dir_path = os.path.join(module_base_path, 'Templates')

        # Use the library that FreeCAD can use as well to open CQ files
        ImportCQ.open(os.path.join(templ_dir_path, 'script_template.py'))

        FreeCAD.Console.PrintMessage("Please save this template file as another name before creating any others.\r\n")
开发者ID:jmwright,项目名称:cadquery-freecad-module,代码行数:8,代码来源:Command.py


示例10: GetDeviceList

def GetDeviceList():
    ret = []
    path = os.path.join(module_path(), JSON_DIR)
    for i in os.listdir(path):
        p = os.path.join(path, i)
        if os.path.isfile(p) and 'arcjson_device_' in i:
            ret.append(i.replace('arcjson_device_', '').replace('.json', ''))
    return ret
开发者ID:kamijawa,项目名称:kmgdgis3D,代码行数:8,代码来源:dwg2geojson.py


示例11: save_popularity_data

def save_popularity_data(data, onion_id):
    """ Save the popularity data to """
    my_path = module_locator.module_path()
    document_dir = my_path.replace("/tools", "/popularity_stats/")
    document_dir = document_dir + datetime.datetime.now().strftime("%y-%m-%d")
    if not os.path.exists(document_dir):
        os.makedirs(document_dir)
    pretty_data = valid_pretty_json(data)
    text2file(pretty_data, document_dir + "/" + onion_id + ".json")
开发者ID:DeveloperVox,项目名称:ahmia,代码行数:9,代码来源:gather_backlinks_data.py


示例12: main

def main():
    """Main function."""
    my_path = module_locator.module_path()
    json_data_dir = my_path.replace("/tools", "/tor2web_stats/")
    onions_data = {}
    for filename in os.listdir(json_data_dir):
        if filename.endswith(".json"):
            json_file = json_data_dir + filename
            json_data = open(json_file)
            day_data = json.load(json_data)
            json_data.close()
            time_stamp = day_data["date"].encode("ascii", "ignore")
            for onion_data in day_data["hidden_services"]:
                onion = onion_data["id"].lower()
                access_count = int(onion_data["access_count"])
                try:
                    found = False
                    last_time_stamp = onions_data[onion]#[-1].keys()[0]
                    for o in onions_data[onion]:
                        if o.keys()[0] == time_stamp:
                            o[time_stamp] = o[time_stamp] + access_count
                            found = True
                            break
                    if not found:
                        onions_data[onion].append({time_stamp: access_count})
                except:
                    onions_data[onion] = []
                    onions_data[onion].append({time_stamp: access_count})
    static_log = my_path.replace("/tools", "/ahmia/static/log/onion_site_history/")
    onions = []

    # Filter banned domains, get the list first
    r = requests.get('https://127.0.0.1/banneddomains.txt', verify=False)
    text = r.text.encode('ascii')
    text = text.replace("http://", "")
    text = text.replace("https://", "")
    text = text.replace(".onion/", "")
    ban_list = text.split("\n")

    # Print to files
    for onion in onions_data.keys():
        data = onions_data[onion]
        # Only show those onions that have over 100 active days
        # Filter out banned domains
        if len(data) > 100 and not onion in ban_list:
            onions.append(onion)
        if not onion in ban_list:
            data = sorted(data, key=getKey)
            pretty = json.dumps(data, indent=4, ensure_ascii=False)
            file = open(static_log + onion + ".json", "w")
            file.write(pretty+"\n")
            file.close()
    onions.sort()
    pretty = json.dumps(onions, indent=4, sort_keys=True, ensure_ascii=False)
    file = open(static_log + "onions.json", "w")
    file.write(pretty+"\n")
    file.close()
开发者ID:DeveloperVox,项目名称:ahmia,代码行数:57,代码来源:read_tor2web_stats.py


示例13: init_tunnel_name_file

def init_tunnel_name_file():
    ret = {}
    d =  os.path.join(module_path(), DATA_DOCS_DIR)
    path = os.path.join(d, gConfig['xls_tunnel_main'])
    book = xlrd.open_workbook(path)
    sheet = book.sheet_by_name(u'隧道文件对应')
    row, col = find_boundary(sheet)
    for i in range(row+1):
        ret[sheet.cell_value(i,0)] = sheet.cell_value(i,1)
    return ret
开发者ID:kamijawa,项目名称:kmgdgis3D,代码行数:10,代码来源:proxy.py


示例14: loader

def loader(tor2web_nodes):
    """Load visited domains information from tor2web nodes."""
    my_path = module_locator.module_path()
    filename = my_path.replace("/tools", "/ahmia/static/log/")
    for node in tor2web_nodes:
        print "\n Trying download from the %s \n" % node
        md5list = get_md5list("abcd." + node)
        if md5list:
            filename = filename + node + "_md5filterlist.txt"
            text2file(md5list, filename)
开发者ID:AlexandreSousa,项目名称:ahmia,代码行数:10,代码来源:tor2web_filters.py


示例15: CalcOffset

def CalcOffset(name):
    offsetx, offsety = 0, 0
    path = os.path.join(module_path(), JSON_DIR, 'tunnel_boundry_%s.json' % name)
    boundry = None
    if os.path.exists(path):
        with open(path) as f:
            boundry = json.loads(f.read())
    if boundry:
        mercstartx, mercstarty = ToWebMercator(boundry['lnglat']['startx'], boundry['lnglat']['starty'])
        offsetx, offsety = mercstartx - boundry['dwg_mercator']['startx'], mercstarty - boundry['dwg_mercator']['starty']
    return offsetx, offsety    
开发者ID:kamijawa,项目名称:kmgdgis3D,代码行数:11,代码来源:dwg2geojson.py


示例16: GetADBExecutablePath

def GetADBExecutablePath():
    arr = []
    if '/' in gConfig['android']['sdk_root']:
        arr = gConfig['android']['sdk_root'].split('/')
    elif '\\' in gConfig['android']['sdk_root']:
        arr = gConfig['android']['sdk_root'].split('\\')
    adb = module_path()
    if len(arr)>0:
        adb = os.path.join(adb, *arr)
    adb = os.path.join(adb, 'platform-tools', 'adb.exe')
    return adb
开发者ID:kamijawa,项目名称:kmgdgis_mobile_synctool,代码行数:11,代码来源:proc.py


示例17: Cad2Geodatabase

def Cad2Geodatabase(dwgfile, reference_scale=2000):
    #import arcpy
    #from arcpy import env
    PRJWGS1984 = arcpy.SpatialReference("WGS 1984")
    PRJWEBMERCATOR = arcpy.SpatialReference("WGS 1984 Web Mercator (Auxiliary Sphere)")
    CreateTunnelGDB()
    ws = os.path.join(module_path(), WORKSPACE)
    if not os.path.exists(ws):
        os.mkdir(ws)
    env.workspace = ws
    
    input_cad_dataset = os.path.join(module_path(), DWG_DIR, dwgfile)
    out_tmp_gdb_path = os.path.join(ws, "tmp.gdb") 
    if not os.path.exists(out_tmp_gdb_path):
        arcpy.CreateFileGDB_management(ws, u"tmp.gdb")
    out_tmp_dataset_name = dwgfile.replace('.dwg', '')
    rs = str(reference_scale)
    #ws = '%s/tmp.gdb' % WORKSPACE
    DeleteExist(out_tmp_gdb_path, out_tmp_dataset_name)
    arcpy.CADToGeodatabase_conversion(input_cad_dataset, out_tmp_gdb_path, out_tmp_dataset_name, rs, PRJWEBMERCATOR)
开发者ID:kamijawa,项目名称:kmgdgis3D,代码行数:20,代码来源:dwg2geojson.py


示例18: main

def main():
    """Main function."""
    my_path = module_locator.module_path()
    access_file_path = my_path.replace("/tools", "/error/access.log")
    json_pretty = analyser(access_file_path)
    filename = my_path.replace("/tools", "/ahmia/static/log/access.json")
    text2file(json_pretty, filename)
    access_file_path = my_path.replace("/tools", "/error/hs_access.log")
    json_pretty = analyser(access_file_path)
    filename = my_path.replace("/tools", "/ahmia/static/log/hs_access.json")
    text2file(json_pretty, filename)
开发者ID:DeveloperVox,项目名称:ahmia,代码行数:11,代码来源:access_log_analyser.py


示例19: main

def main():
    """Main function."""
    my_path = module_locator.module_path()
    document_dir = my_path.replace("/tools", "/tor2web_stats/")
    timestamp = datetime.datetime.now().strftime("%y-%m-%d")
    timestamp = "_" + timestamp + "-"
    # Use Tor2web stats
    for filename in os.listdir(document_dir):
        if not filename.endswith(".json"):
            continue
        if timestamp in filename:
            analyser(document_dir+filename)
开发者ID:AlexandreSousa,项目名称:ahmia,代码行数:12,代码来源:use_popularity_data.py


示例20: ListExamples

    def ListExamples():
        import os
        import module_locator

        dirs = []

        # List all of the example files in an order that makes sense
        module_base_path = module_locator.module_path()
        exs_dir_path = os.path.join(module_base_path, 'Examples')
        dirs = os.listdir(exs_dir_path)
        dirs.sort()

        return dirs
开发者ID:sopak,项目名称:cadquery-freecad-module,代码行数:13,代码来源:InitGui.py



注:本文中的module_locator.module_path函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python module_mixins.NoConfigModuleMixin类代码示例发布时间:2022-05-27
下一篇:
Python mixins.SimpleVTKClassModuleBase类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap