MCPcopy Create free account
hub / github.com/Image-Py/imagepy / getpath

Function getpath

imagepy/IPy.py:122–139  ·  view source on GitHub ↗

Get the defaultpath of the ImagePy

(title, filt, k, para=None)

Source from the content-addressed store, hash-verified

120 return dic[rst]
121
122def getpath(title, filt, k, para=None):
123 """Get the defaultpath of the ImagePy"""
124 from .core import manager
125 dpath = manager.ConfigManager.get('defaultpath')
126 if dpath ==None:
127 dpath = root_dir # './'
128 dic = {'open':wx.FD_OPEN, 'save':wx.FD_SAVE}
129 dialog = wx.FileDialog(curapp, title, dpath, '', filt, dic[k])
130 rst = dialog.ShowModal()
131 path = None
132 if rst == wx.ID_OK:
133 path = dialog.GetPath()
134 dpath = osp.split(path)[0]
135 manager.ConfigManager.set('defaultpath', dpath)
136 if para!=None:para['path'] = path
137 dialog.Destroy()
138
139 return rst == wx.ID_OK if para!=None else path
140
141def getdir(title, filt, para=None):
142 from .core import manager

Callers

nothing calls this directly

Calls 2

getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected