def create_callable(self, name, action):
def callable(event):
# check if this is for whole project or file/directory
if 'item' in name.lower(): # for one single item - file/directory
if not self.datafile:
return
full_cmd = action.format(path=self.datafile.source)
else: # for whole project - root file/directory
full_cmd = action.format(path=self.model.suite.source)
# RideLogMessage(name + " clicked: " + fullCmd).publish()
if full_cmd.lower().startswith('http'):
wx.LaunchDefaultBrowser(full_cmd)
else:
try:
subprocess.Popen(full_cmd)
except OSError as error:
s = "This is the error we got trying to execute {executor_name} executable file:\n" \
"\"{error}\"\n\n" \
"Probably this file in not in your PATH. Try to reinstall {executor_name}.\n" \
"Do you want to open download page?".format(error=error.strerror, executor_name=self.MENU_NAME)
dlg = wx.MessageDialog(parent=self.frame, caption="Hmm, something went wrong...", message=s,
style=wx.YES_NO | wx.CENTER | wx.ICON_INFORMATION)
if dlg.ShowModal() == wx.ID_YES:
wx.LaunchDefaultBrowser(self.SVN_INSTALLATION_URL)
dlg.Destroy()
return callable
TortoiseSVNPlugin.py 文件源码
python
阅读 22
收藏 0
点赞 0
评论 0
评论列表
文章目录