- update in Code Highlighter to highlight the X and Y chars
- updated the Document and Script objects Beginner/Advanced selection labels to the same as the rest of the app objects
This commit is contained in:
@@ -13,6 +13,8 @@ CHANGELOG for FlatCAM beta
|
|||||||
- some refactoring
|
- some refactoring
|
||||||
- in a FCColorEntry GUI element, setting a color in the Color dialog will trigger the editingFinished signal therefore propagating the changes
|
- in a FCColorEntry GUI element, setting a color in the Color dialog will trigger the editingFinished signal therefore propagating the changes
|
||||||
- Milling Tool fixes: milling tool dia after edit fix and milling slots fix
|
- Milling Tool fixes: milling tool dia after edit fix and milling slots fix
|
||||||
|
- update in Code Highlighter to highlight the X and Y chars
|
||||||
|
- updated the Document and Script objects Beginner/Advanced selection labels to the same as the rest of the app objects
|
||||||
|
|
||||||
26.02.2021
|
26.02.2021
|
||||||
|
|
||||||
|
|||||||
@@ -4347,6 +4347,8 @@ class FCTextAreaLineNumber(QtWidgets.QFrame):
|
|||||||
number = QtGui.QTextCharFormat()
|
number = QtGui.QTextCharFormat()
|
||||||
string = QtGui.QTextCharFormat()
|
string = QtGui.QTextCharFormat()
|
||||||
singleQuotedString = QtGui.QTextCharFormat()
|
singleQuotedString = QtGui.QTextCharFormat()
|
||||||
|
x_chars = QtGui.QTextCharFormat()
|
||||||
|
y_chars = QtGui.QTextCharFormat()
|
||||||
|
|
||||||
comment = QtGui.QTextCharFormat()
|
comment = QtGui.QTextCharFormat()
|
||||||
# comment
|
# comment
|
||||||
@@ -4483,6 +4485,24 @@ class FCTextAreaLineNumber(QtWidgets.QFrame):
|
|||||||
singleQuotedString.setForeground(brush)
|
singleQuotedString.setForeground(brush)
|
||||||
rule = (pattern, singleQuotedString)
|
rule = (pattern, singleQuotedString)
|
||||||
self.highlightingRules.append(rule)
|
self.highlightingRules.append(rule)
|
||||||
|
|
||||||
|
# X coordinate
|
||||||
|
brush = QtGui.QBrush(Qt.darkBlue, Qt.SolidPattern)
|
||||||
|
pattern = QtCore.QRegExp("X")
|
||||||
|
pattern.setMinimal(True)
|
||||||
|
x_chars.setFontWeight(QtGui.QFont.Bold)
|
||||||
|
x_chars.setForeground(brush)
|
||||||
|
rule = (pattern, x_chars)
|
||||||
|
self.highlightingRules.append(rule)
|
||||||
|
|
||||||
|
# Y coordinate
|
||||||
|
brush = QtGui.QBrush(Qt.darkBlue, Qt.SolidPattern)
|
||||||
|
pattern = QtCore.QRegExp("Y")
|
||||||
|
pattern.setMinimal(True)
|
||||||
|
y_chars.setFontWeight(QtGui.QFont.Bold)
|
||||||
|
y_chars.setForeground(brush)
|
||||||
|
rule = (pattern, y_chars)
|
||||||
|
self.highlightingRules.append(rule)
|
||||||
else:
|
else:
|
||||||
self.highlightingRules = highlight_rules
|
self.highlightingRules = highlight_rules
|
||||||
|
|
||||||
|
|||||||
@@ -66,10 +66,8 @@ class DocumentObject(FlatCAMObj):
|
|||||||
self.to_form()
|
self.to_form()
|
||||||
|
|
||||||
# Show/Hide Advanced Options
|
# Show/Hide Advanced Options
|
||||||
if self.app.defaults["global_app_level"] == 'b':
|
app_mode = self.app.defaults["global_app_level"]
|
||||||
self.ui.level.setText('<span style="color:green;"><b>%s</b></span>' % _("Beginner"))
|
self.change_level(app_mode)
|
||||||
else:
|
|
||||||
self.ui.level.setText('<span style="color:red;"><b>%s</b></span>' % _("Advanced"))
|
|
||||||
|
|
||||||
self.document_editor_tab = AppTextEditor(app=self.app)
|
self.document_editor_tab = AppTextEditor(app=self.app)
|
||||||
stylesheet = """
|
stylesheet = """
|
||||||
@@ -91,6 +89,8 @@ class DocumentObject(FlatCAMObj):
|
|||||||
# ######################################################################
|
# ######################################################################
|
||||||
# ######################## SIGNALS #####################################
|
# ######################## SIGNALS #####################################
|
||||||
# ######################################################################
|
# ######################################################################
|
||||||
|
self.ui.level.toggled.connect(self.on_level_changed)
|
||||||
|
|
||||||
self.document_editor_tab.buttonOpen.clicked.disconnect()
|
self.document_editor_tab.buttonOpen.clicked.disconnect()
|
||||||
self.document_editor_tab.buttonOpen.clicked.connect(lambda: self.document_editor_tab.handleOpen(filt=flt))
|
self.document_editor_tab.buttonOpen.clicked.connect(lambda: self.document_editor_tab.handleOpen(filt=flt))
|
||||||
self.document_editor_tab.buttonSave.clicked.disconnect()
|
self.document_editor_tab.buttonSave.clicked.disconnect()
|
||||||
@@ -172,6 +172,39 @@ class DocumentObject(FlatCAMObj):
|
|||||||
# Switch plot_area to CNCJob tab
|
# Switch plot_area to CNCJob tab
|
||||||
self.app.ui.plot_tab_area.setCurrentWidget(self.document_editor_tab)
|
self.app.ui.plot_tab_area.setCurrentWidget(self.document_editor_tab)
|
||||||
|
|
||||||
|
def change_level(self, level):
|
||||||
|
"""
|
||||||
|
|
||||||
|
:param level: application level: either 'b' or 'a'
|
||||||
|
:type level: str
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
|
||||||
|
if level == 'a':
|
||||||
|
self.ui.level.setChecked(True)
|
||||||
|
else:
|
||||||
|
self.ui.level.setChecked(False)
|
||||||
|
self.on_level_changed(self.ui.level.isChecked())
|
||||||
|
|
||||||
|
def on_level_changed(self, checked):
|
||||||
|
if not checked:
|
||||||
|
self.ui.level.setText('%s' % _('Beginner'))
|
||||||
|
self.ui.level.setStyleSheet("""
|
||||||
|
QToolButton
|
||||||
|
{
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
""")
|
||||||
|
|
||||||
|
else:
|
||||||
|
self.ui.level.setText('%s' % _('Advanced'))
|
||||||
|
self.ui.level.setStyleSheet("""
|
||||||
|
QToolButton
|
||||||
|
{
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
""")
|
||||||
|
|
||||||
def on_autocomplete_changed(self, state):
|
def on_autocomplete_changed(self, state):
|
||||||
if state:
|
if state:
|
||||||
self.document_editor_tab.code_editor.completer_enable = True
|
self.document_editor_tab.code_editor.completer_enable = True
|
||||||
|
|||||||
@@ -77,10 +77,8 @@ class ScriptObject(FlatCAMObj):
|
|||||||
self.to_form()
|
self.to_form()
|
||||||
|
|
||||||
# Show/Hide Advanced Options
|
# Show/Hide Advanced Options
|
||||||
if self.app.defaults["global_app_level"] == 'b':
|
app_mode = self.app.defaults["global_app_level"]
|
||||||
self.ui.level.setText('<span style="color:green;"><b>%s</b></span>' % _("Beginner"))
|
self.change_level(app_mode)
|
||||||
else:
|
|
||||||
self.ui.level.setText('<span style="color:red;"><b>%s</b></span>' % _("Advanced"))
|
|
||||||
|
|
||||||
self.script_editor_tab = AppTextEditor(app=self.app, plain_text=True, parent=self.app.ui)
|
self.script_editor_tab = AppTextEditor(app=self.app, plain_text=True, parent=self.app.ui)
|
||||||
|
|
||||||
@@ -112,6 +110,12 @@ class ScriptObject(FlatCAMObj):
|
|||||||
self.app.ui.plot_tab_area.setCurrentWidget(self.script_editor_tab)
|
self.app.ui.plot_tab_area.setCurrentWidget(self.script_editor_tab)
|
||||||
|
|
||||||
flt = "FlatCAM Scripts (*.FlatScript);;All Files (*.*)"
|
flt = "FlatCAM Scripts (*.FlatScript);;All Files (*.*)"
|
||||||
|
|
||||||
|
# #############################################################################
|
||||||
|
# ############################ SIGNALS ########################################
|
||||||
|
# #############################################################################
|
||||||
|
self.ui.level.toggled.connect(self.on_level_changed)
|
||||||
|
|
||||||
self.script_editor_tab.buttonOpen.clicked.disconnect()
|
self.script_editor_tab.buttonOpen.clicked.disconnect()
|
||||||
self.script_editor_tab.buttonOpen.clicked.connect(lambda: self.script_editor_tab.handleOpen(filt=flt))
|
self.script_editor_tab.buttonOpen.clicked.connect(lambda: self.script_editor_tab.handleOpen(filt=flt))
|
||||||
self.script_editor_tab.buttonSave.clicked.disconnect()
|
self.script_editor_tab.buttonSave.clicked.disconnect()
|
||||||
@@ -157,6 +161,39 @@ class ScriptObject(FlatCAMObj):
|
|||||||
self.script_editor_tab.setObjectName(self.options['name'])
|
self.script_editor_tab.setObjectName(self.options['name'])
|
||||||
self.app.ui.plot_tab_area.setCurrentWidget(self.script_editor_tab)
|
self.app.ui.plot_tab_area.setCurrentWidget(self.script_editor_tab)
|
||||||
|
|
||||||
|
def change_level(self, level):
|
||||||
|
"""
|
||||||
|
|
||||||
|
:param level: application level: either 'b' or 'a'
|
||||||
|
:type level: str
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
|
||||||
|
if level == 'a':
|
||||||
|
self.ui.level.setChecked(True)
|
||||||
|
else:
|
||||||
|
self.ui.level.setChecked(False)
|
||||||
|
self.on_level_changed(self.ui.level.isChecked())
|
||||||
|
|
||||||
|
def on_level_changed(self, checked):
|
||||||
|
if not checked:
|
||||||
|
self.ui.level.setText('%s' % _('Beginner'))
|
||||||
|
self.ui.level.setStyleSheet("""
|
||||||
|
QToolButton
|
||||||
|
{
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
""")
|
||||||
|
|
||||||
|
else:
|
||||||
|
self.ui.level.setText('%s' % _('Advanced'))
|
||||||
|
self.ui.level.setStyleSheet("""
|
||||||
|
QToolButton
|
||||||
|
{
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
""")
|
||||||
|
|
||||||
def parse_file(self, filename):
|
def parse_file(self, filename):
|
||||||
"""
|
"""
|
||||||
Will set an attribute of the object, self.source_file, with the parsed data.
|
Will set an attribute of the object, self.source_file, with the parsed data.
|
||||||
|
|||||||
Reference in New Issue
Block a user