45 |
45 |
46 class QProcess(QProcessPyQt): |
46 class QProcess(QProcessPyQt): |
47 """ |
47 """ |
48 Class transforming the call arguments in case of gnome-terminal. |
48 Class transforming the call arguments in case of gnome-terminal. |
49 """ |
49 """ |
50 def start(self, cmd, args=[], mode=QProcessPyQt.ReadWrite): |
50 def start(self, cmd, args=None, mode=QProcessPyQt.ReadWrite): |
51 """ |
51 """ |
52 Public method to start the given program (cmd) in a new process, if |
52 Public method to start the given program (cmd) in a new process, if |
53 none is already running, passing the command line arguments in args. |
53 none is already running, passing the command line arguments in args. |
54 |
54 |
55 @param cmd start the given program cmd (string) |
55 @param cmd start the given program cmd (string) |
56 @keyparam args list of parameters (list of strings) |
56 @keyparam args list of parameters (list of strings) |
57 @keyparam mode access mode (QIODevice.OpenMode) |
57 @keyparam mode access mode (QIODevice.OpenMode) |
58 """ |
58 """ |
|
59 if args is None: |
|
60 args = [] |
|
61 |
59 if cmd.endswith(('gnome-terminal', 'konsole', 'xfce4-terminal', |
62 if cmd.endswith(('gnome-terminal', 'konsole', 'xfce4-terminal', |
60 'mate-terminal')): |
63 'mate-terminal')): |
61 if '-e' in args: |
64 if '-e' in args: |
62 index = args.index('-e') + 1 |
65 index = args.index('-e') + 1 |
63 cargs = ' '.join(args[index:]) |
66 cargs = ' '.join(args[index:]) |
64 args[index:] = [cargs] |
67 args[index:] = [cargs] |
65 |
68 |
66 super(QProcess, self).start(cmd, args, mode) |
69 super(QProcess, self).start(cmd, args, mode) |
67 |
70 |
68 @staticmethod |
71 @staticmethod |
69 def startDetached(cmd, args=[], path=''): |
72 def startDetached(cmd, args=None, path=''): |
70 """ |
73 """ |
71 Public static method to start the given program (cmd) in a new process, |
74 Public static method to start the given program (cmd) in a new process, |
72 if none is already running, passing the command line arguments in args. |
75 if none is already running, passing the command line arguments in args. |
73 |
76 |
74 @param cmd start the given program cmd (string) |
77 @param cmd start the given program cmd (string) |
75 @keyparam args list of parameters (list of strings) |
78 @keyparam args list of parameters (list of strings) |
76 @keyparam path new working directory (string) |
79 @keyparam path new working directory (string) |
77 @return tuple of successful start and process id (boolean, integer) |
80 @return tuple of successful start and process id (boolean, integer) |
78 """ |
81 """ |
|
82 if args is None: |
|
83 args = [] |
|
84 |
79 if cmd.endswith(('gnome-terminal', 'konsole', 'xfce4-terminal', |
85 if cmd.endswith(('gnome-terminal', 'konsole', 'xfce4-terminal', |
80 'mate-terminal')): |
86 'mate-terminal')): |
81 if '-e' in args: |
87 if '-e' in args: |
82 index = args.index('-e') + 1 |
88 index = args.index('-e') + 1 |
83 cargs = ' '.join(args[index:]) |
89 cargs = ' '.join(args[index:]) |
498 |
504 |
499 dlg = FormSelectionDialog() |
505 dlg = FormSelectionDialog() |
500 if dlg.exec_() == QDialog.Accepted: |
506 if dlg.exec_() == QDialog.Accepted: |
501 template = dlg.getTemplateText() |
507 template = dlg.getTemplateText() |
502 |
508 |
503 filter = self.tr( |
509 fileFilters = self.tr( |
504 "Chameleon Templates (*.pt);;" |
510 "Chameleon Templates (*.pt);;" |
505 "Chameleon Text Templates (*.txt);;" |
511 "Chameleon Text Templates (*.txt);;" |
506 "Mako Templates (*.mako);;" |
512 "Mako Templates (*.mako);;" |
507 "Mako Templates (*.mak);;" |
513 "Mako Templates (*.mak);;" |
508 "HTML Files (*.html);;" |
514 "HTML Files (*.html);;" |