- added a new function called by shortcut key combo CTRL+G when the current widget in Plot Area is an Code Editor. It will jump to the specified line in the text.
This commit is contained in:
parent
84cd2143c3
commit
c79f74c1bf
|
@ -3271,8 +3271,7 @@ class App(QtCore.QObject):
|
||||||
|
|
||||||
self.ui.plot_tab_area.setTabText(0, "EDITOR Area")
|
self.ui.plot_tab_area.setTabText(0, "EDITOR Area")
|
||||||
self.ui.plot_tab_area.protectTab(0)
|
self.ui.plot_tab_area.protectTab(0)
|
||||||
self.inform.emit('[WARNING_NOTCL] %s' %
|
self.inform.emit('[WARNING_NOTCL] %s' % _("Editor is activated ..."))
|
||||||
_("Editor is activated ..."))
|
|
||||||
|
|
||||||
self.should_we_save = True
|
self.should_we_save = True
|
||||||
|
|
||||||
|
@ -9918,9 +9917,34 @@ class App(QtCore.QObject):
|
||||||
self.toggle_codeeditor = False
|
self.toggle_codeeditor = False
|
||||||
|
|
||||||
def on_code_editor_close(self):
|
def on_code_editor_close(self):
|
||||||
print("closed")
|
|
||||||
self.toggle_codeeditor = False
|
self.toggle_codeeditor = False
|
||||||
|
|
||||||
|
def goto_text_line(self):
|
||||||
|
"""
|
||||||
|
Will scroll a text to the specified text line.
|
||||||
|
|
||||||
|
:return: None
|
||||||
|
"""
|
||||||
|
dia_box = Dialog_box(title=_("Go to Line ..."),
|
||||||
|
label=_("Line:"),
|
||||||
|
icon=QtGui.QIcon(self.resource_location + '/jump_to16.png'),
|
||||||
|
initial_text='')
|
||||||
|
try:
|
||||||
|
line = int(dia_box.location) - 1
|
||||||
|
except (ValueError, TypeError):
|
||||||
|
line = 0
|
||||||
|
|
||||||
|
if dia_box.ok:
|
||||||
|
# make sure to move first the cursor at the end so after finding the line the line will be positioned
|
||||||
|
# at the top of the window
|
||||||
|
self.ui.plot_tab_area.currentWidget().code_editor.moveCursor(QTextCursor.End)
|
||||||
|
# get the document() of the TextEditor
|
||||||
|
doc = self.ui.plot_tab_area.currentWidget().code_editor.document()
|
||||||
|
# create a Text Cursor based on the searched line
|
||||||
|
cursor = QTextCursor(doc.findBlockByLineNumber(line))
|
||||||
|
# set cursor of the code editor with the cursor at the searcehd line
|
||||||
|
self.ui.plot_tab_area.currentWidget().code_editor.setTextCursor(cursor)
|
||||||
|
|
||||||
def on_filenewscript(self, silent=False, name=None, text=None):
|
def on_filenewscript(self, silent=False, name=None, text=None):
|
||||||
"""
|
"""
|
||||||
Will create a new script file and open it in the Code Editor
|
Will create a new script file and open it in the Code Editor
|
||||||
|
@ -9931,8 +9955,7 @@ class App(QtCore.QObject):
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
if silent is False:
|
if silent is False:
|
||||||
self.inform.emit('[success] %s' %
|
self.inform.emit('[success] %s' % _("New TCL script file created in Code Editor."))
|
||||||
_("New TCL script file created in Code Editor."))
|
|
||||||
|
|
||||||
# delete the absolute and relative position and messages in the infobar
|
# delete the absolute and relative position and messages in the infobar
|
||||||
self.ui.position_label.setText("")
|
self.ui.position_label.setText("")
|
||||||
|
@ -10035,8 +10058,7 @@ class App(QtCore.QObject):
|
||||||
self.shell._sysShell.exec_command(cmd_line_shellfile_content, no_echo=True)
|
self.shell._sysShell.exec_command(cmd_line_shellfile_content, no_echo=True)
|
||||||
|
|
||||||
if silent is False:
|
if silent is False:
|
||||||
self.inform.emit('[success] %s' %
|
self.inform.emit('[success] %s' % _("TCL script file opened in Code Editor and executed."))
|
||||||
_("TCL script file opened in Code Editor and executed."))
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.debug("App.on_filerunscript() -> %s" % str(e))
|
log.debug("App.on_filerunscript() -> %s" % str(e))
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
|
@ -14,6 +14,7 @@ CAD program, and create G-Code for Isolation routing.
|
||||||
- the Apply button text in Preferences is now made red when changes were made and require to be applied
|
- the Apply button text in Preferences is now made red when changes were made and require to be applied
|
||||||
- the Gerber UI is built only once now so the process is lighter on CPU
|
- the Gerber UI is built only once now so the process is lighter on CPU
|
||||||
- the Gerber apertures marking shapes storage is now built only once because the more are built the more sluggish is the interface
|
- the Gerber apertures marking shapes storage is now built only once because the more are built the more sluggish is the interface
|
||||||
|
- added a new function called by shortcut key combo CTRL+G when the current widget in Plot Area is an Code Editor. It will jump to the specified line in the text.
|
||||||
|
|
||||||
28.12.2019
|
28.12.2019
|
||||||
|
|
||||||
|
|
|
@ -2723,7 +2723,11 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
|
||||||
|
|
||||||
# Open Gerber file
|
# Open Gerber file
|
||||||
if key == QtCore.Qt.Key_G:
|
if key == QtCore.Qt.Key_G:
|
||||||
self.app.on_fileopengerber()
|
widget_name = self.plot_tab_area.currentWidget().objectName()
|
||||||
|
if 'editor' in widget_name.lower():
|
||||||
|
self.app.goto_text_line()
|
||||||
|
else:
|
||||||
|
self.app.on_fileopengerber()
|
||||||
|
|
||||||
# Distance Tool
|
# Distance Tool
|
||||||
if key == QtCore.Qt.Key_M:
|
if key == QtCore.Qt.Key_M:
|
||||||
|
|
Loading…
Reference in New Issue