- disabled a skip_quotes method in ToolShell.FCShell class so I can now use quotes to enclose file paths with spaces inside
This commit is contained in:
@@ -28,7 +28,7 @@ CHANGELOG for FlatCAM beta
|
|||||||
- in SVG parser modified some imports to be one on each line
|
- in SVG parser modified some imports to be one on each line
|
||||||
- fixed the Tcl Command BBox (leftovers from recent global changes)
|
- fixed the Tcl Command BBox (leftovers from recent global changes)
|
||||||
- fixed some typos in strings reported by @pcb-hobbyst on FlatCAM forum
|
- fixed some typos in strings reported by @pcb-hobbyst on FlatCAM forum
|
||||||
|
- disabled a skip_quotes method in ToolShell.FCShell class so I can now use quotes to enclose file paths with spaces inside
|
||||||
|
|
||||||
27.04.2020
|
27.04.2020
|
||||||
|
|
||||||
|
|||||||
@@ -2694,8 +2694,7 @@ class _ExpandableTextEdit(QTextEdit):
|
|||||||
if line_count <= 1:
|
if line_count <= 1:
|
||||||
self.historyPrev.emit()
|
self.historyPrev.emit()
|
||||||
return
|
return
|
||||||
elif event.matches(QKeySequence.MoveToNextPage) or \
|
elif event.matches(QKeySequence.MoveToNextPage) or event.matches(QKeySequence.MoveToPreviousPage):
|
||||||
event.matches(QKeySequence.MoveToPreviousPage):
|
|
||||||
return self._termWidget.browser().keyPressEvent(event)
|
return self._termWidget.browser().keyPressEvent(event)
|
||||||
|
|
||||||
tc = self.textCursor()
|
tc = self.textCursor()
|
||||||
|
|||||||
@@ -107,25 +107,25 @@ class TermWidget(QWidget):
|
|||||||
mtype = text[:idx+1].upper()
|
mtype = text[:idx+1].upper()
|
||||||
mtype = mtype.replace('_NOTCL', '')
|
mtype = mtype.replace('_NOTCL', '')
|
||||||
body = text[idx+1:]
|
body = text[idx+1:]
|
||||||
if style == 'in':
|
if style.lower() == 'in':
|
||||||
text = '<span style="font-weight: bold;">%s</span>' % text
|
text = '<span style="font-weight: bold;">%s</span>' % text
|
||||||
elif style == 'err':
|
elif style.lower() == 'err':
|
||||||
text = '<span style="font-weight: bold; color: red;">%s</span>'\
|
text = '<span style="font-weight: bold; color: red;">%s</span>'\
|
||||||
'<span style="font-weight: bold;">%s</span>'\
|
'<span style="font-weight: bold;">%s</span>'\
|
||||||
% (mtype, body)
|
% (mtype, body)
|
||||||
elif style == 'warning':
|
elif style.lower() == 'warning':
|
||||||
# text = '<span style="font-weight: bold; color: #f4b642;">%s</span>' % text
|
# text = '<span style="font-weight: bold; color: #f4b642;">%s</span>' % text
|
||||||
text = '<span style="font-weight: bold; color: #f4b642;">%s</span>' \
|
text = '<span style="font-weight: bold; color: #f4b642;">%s</span>' \
|
||||||
'<span style="font-weight: bold;">%s</span>' \
|
'<span style="font-weight: bold;">%s</span>' \
|
||||||
% (mtype, body)
|
% (mtype, body)
|
||||||
elif style == 'success':
|
elif style.lower() == 'success':
|
||||||
# text = '<span style="font-weight: bold; color: #15b300;">%s</span>' % text
|
# text = '<span style="font-weight: bold; color: #15b300;">%s</span>' % text
|
||||||
text = '<span style="font-weight: bold; color: #15b300;">%s</span>' \
|
text = '<span style="font-weight: bold; color: #15b300;">%s</span>' \
|
||||||
'<span style="font-weight: bold;">%s</span>' \
|
'<span style="font-weight: bold;">%s</span>' \
|
||||||
% (mtype, body)
|
% (mtype, body)
|
||||||
elif style == 'selected':
|
elif style.lower() == 'selected':
|
||||||
text = ''
|
text = ''
|
||||||
elif style == 'raw':
|
elif style.lower() == 'raw':
|
||||||
text = text
|
text = text
|
||||||
else:
|
else:
|
||||||
# without span <br/> is ignored!!!
|
# without span <br/> is ignored!!!
|
||||||
@@ -226,7 +226,7 @@ class TermWidget(QWidget):
|
|||||||
|
|
||||||
def is_command_complete(self, text):
|
def is_command_complete(self, text):
|
||||||
"""
|
"""
|
||||||
Executed by _ExpandableTextEdit. Reimplement this function in the child classes.
|
Executed by _ExpandableTextEdit. Re-implement this function in the child classes.
|
||||||
"""
|
"""
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -344,19 +344,23 @@ class FCShell(TermWidget):
|
|||||||
''')
|
''')
|
||||||
|
|
||||||
def is_command_complete(self, text):
|
def is_command_complete(self, text):
|
||||||
|
|
||||||
def skipQuotes(txt):
|
def skipQuotes(txt):
|
||||||
quote = txt[0]
|
quote = txt[0]
|
||||||
text_val = txt[1:]
|
text_val = txt[1:]
|
||||||
endIndex = str(text_val).index(quote)
|
endIndex = str(text_val).index(quote)
|
||||||
return text[endIndex:]
|
return text[endIndex:]
|
||||||
|
|
||||||
while text:
|
# I'm disabling this because I need to be able to load paths that have spaces by
|
||||||
if text[0] in ('"', "'"):
|
# enclosing them in quotes --- Marius Stanciu
|
||||||
try:
|
# while text:
|
||||||
text = skipQuotes(text)
|
# if text[0] in ('"', "'"):
|
||||||
except ValueError:
|
# try:
|
||||||
return False
|
# text = skipQuotes(text)
|
||||||
text = text[1:]
|
# except ValueError:
|
||||||
|
# return False
|
||||||
|
# text = text[1:]
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def child_exec_command(self, text):
|
def child_exec_command(self, text):
|
||||||
|
|||||||
@@ -53,9 +53,9 @@ class TclCommandOpenExcellon(TclCommandSignaled):
|
|||||||
|
|
||||||
filename = args.pop('filename')
|
filename = args.pop('filename')
|
||||||
|
|
||||||
if ' ' in filename:
|
# if ' ' in filename:
|
||||||
return "The absolute path to the project file contain spaces which is not allowed.\n" \
|
# return "The absolute path to the project file contain spaces which is not allowed.\n" \
|
||||||
"Please enclose the path within quotes."
|
# "Please enclose the path within quotes."
|
||||||
|
|
||||||
args['plot'] = False
|
args['plot'] = False
|
||||||
args['from_tcl'] = True
|
args['from_tcl'] = True
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ class TclCommandOpenGCode(TclCommandSignaled):
|
|||||||
args['plot'] = False
|
args['plot'] = False
|
||||||
args['from_tcl'] = True
|
args['from_tcl'] = True
|
||||||
filename = args["filename"]
|
filename = args["filename"]
|
||||||
if ' ' in filename:
|
# if ' ' in filename:
|
||||||
return "The absolute path to the project file contain spaces which is not allowed.\n" \
|
# return "The absolute path to the project file contain spaces which is not allowed.\n" \
|
||||||
"Please enclose the path within quotes."
|
# "Please enclose the path within quotes."
|
||||||
|
|
||||||
self.app.open_gcode(filename, **args)
|
self.app.open_gcode(filename, **args)
|
||||||
|
|||||||
@@ -55,10 +55,6 @@ class TclCommandOpenGerber(TclCommandSignaled):
|
|||||||
|
|
||||||
filename = args.pop('filename')
|
filename = args.pop('filename')
|
||||||
|
|
||||||
if ' ' in filename:
|
|
||||||
return "The absolute path to the project file contain spaces which is not allowed.\n" \
|
|
||||||
"Please enclose the path within quotes."
|
|
||||||
|
|
||||||
if 'outname' in args:
|
if 'outname' in args:
|
||||||
outname = args['outname']
|
outname = args['outname']
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -49,8 +49,8 @@ class TclCommandOpenProject(TclCommandSignaled):
|
|||||||
:return: None or exception
|
:return: None or exception
|
||||||
"""
|
"""
|
||||||
filename = args['filename']
|
filename = args['filename']
|
||||||
if ' ' in filename:
|
# if ' ' in filename:
|
||||||
return "The absolute path to the project file contain spaces which is not allowed.\n" \
|
# return "The absolute path to the project file contain spaces which is not allowed.\n" \
|
||||||
"Please enclose the path within quotes."
|
# "Please enclose the path within quotes."
|
||||||
|
|
||||||
self.app.open_project(filename, cli=True, plot=False, from_tcl=True)
|
self.app.open_project(filename, cli=True, plot=False, from_tcl=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user