3 # Copyright (C) 2010-2013 CEA/DEN
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License.
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 In this file : all functions that do a system call,
21 like open a browser or an editor, or call a git command
26 from . import printcolors
28 def show_in_editor(editor, filePath, logger):
29 '''open filePath using editor.
31 :param editor str: The editor to use.
32 :param filePath str: The path to the file to open.
34 # default editor is vi
35 if editor is None or len(editor) == 0:
38 if '%s' not in editor:
42 # launch cmd using subprocess.Popen
43 cmd = editor % filePath
44 logger.write('Launched command:\n' + cmd + '\n', 5)
45 p = subprocess.Popen(cmd, shell=True)
48 logger.write(printcolors.printcError(_("Unable to edit file %s\n")