Skip to content

Commit 7497c28

Browse files
authored
Merge pull request #197 from nxt-dev/dev
Release editor-v3.10.0
2 parents 8fe2925 + 4b1044b commit 7497c28

File tree

5 files changed

+47
-11
lines changed

5 files changed

+47
-11
lines changed

nxt_editor/actions.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,19 @@ def find_and_open():
375375
self.find_and_open_action.setShortcutContext(context)
376376
self.available_without_model.append(self.find_and_open_action)
377377

378+
def clear_logs():
379+
rich = self.main_window.output_log.rich_output_textedit
380+
raw = self.main_window.output_log.raw_output_textedit
381+
rich.clear()
382+
raw.clear()
383+
384+
self.clear_logs_action = NxtAction(text='Clear All Logs',
385+
parent=self)
386+
self.clear_logs_action.setWhatsThis('Clear all the text from all of the output logs (raw and rich).')
387+
self.clear_logs_action.triggered.connect(clear_logs)
388+
self.clear_logs_action.setShortcutContext(context)
389+
self.available_without_model.append(self.clear_logs_action)
390+
378391
self.action_display_order = [self.find_node_action,
379392
self.new_graph_action,
380393
self.open_file_action, self.undo_action,
@@ -387,6 +400,7 @@ def find_and_open():
387400
self.output_log_action,
388401
self.hotkey_editor_action,
389402
self.workflow_tools_action,
403+
self.clear_logs_action,
390404
self.close_action]
391405

392406

@@ -1777,6 +1791,17 @@ def __init__(self, main_window):
17771791
True)
17781792
self.overlay_message_action.setChecked(state)
17791793

1794+
self.show_data_state_action = NxtAction('Code Editor Data State Overlay',
1795+
parent=self)
1796+
self.show_data_state_action.setWhatsThis('When on this pref will enable a simple HUD on the top right of '
1797+
'the code editor. The HUD will update to display the current data '
1798+
'state (raw, resolved, cached).')
1799+
self.show_data_state_action.setAutoRepeat(False)
1800+
self.show_data_state_action.setCheckable(True)
1801+
state = user_dir.user_prefs.get(user_dir.USER_PREF.SHOW_CE_DATA_STATE,
1802+
True)
1803+
self.show_data_state_action.setChecked(state)
1804+
17801805
def toggle_dbl_click_msg():
17811806
new = self.overlay_message_action.isChecked()
17821807
user_dir.user_prefs[user_dir.USER_PREF.SHOW_DBL_CLICK_MSG] = new
@@ -1790,6 +1815,7 @@ def toggle_dbl_click_msg():
17901815
self.font_bigger, self.font_smaller,
17911816
self.font_size_revert,
17921817
self.overlay_message_action,
1818+
self.show_data_state_action,
17931819
self.new_line, self.indent_line,
17941820
self.unindent_line,
17951821
self.run_line_global_action,

nxt_editor/dockwidgets/code_editor.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,11 +1295,13 @@ def paintEvent(self, event):
12951295
model = code_editor.stage_model
12961296
self.data_state = code_editor.actual_display_state
12971297
painter.setPen(QtCore.Qt.white)
1298-
# Draw top right data state text
1299-
offset = font_metrics.boundingRect(self.data_state).width()
1300-
offset += painter.font().pointSize() * 1.5
1301-
painter.drawText(self.rect().right() - offset,
1302-
painter.font().pointSize() * 1.5, self.data_state)
1298+
# Draw top right data state text to HUD
1299+
show_data_state = self._parent.ce_actions.show_data_state_action.isChecked()
1300+
if show_data_state:
1301+
offset = font_metrics.boundingRect(self.data_state).width()
1302+
offset += painter.font().pointSize() * 1.5
1303+
painter.drawText(self.rect().right() - offset,
1304+
painter.font().pointSize() * 1.5, self.data_state)
13031305
# Draw center message text
13041306
show_msg = self._parent.ce_actions.overlay_message_action.isChecked()
13051307
if show_msg:

nxt_editor/dockwidgets/output_log.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,13 @@ def __init__(self, graph_model=None, parent=None):
200200
# Rich Output
201201
self.rich_output_textedit = OutputTextBrowser(self)
202202
self.log_filter_button = LogFilterButton()
203-
self.clear_button = QtWidgets.QPushButton('Clear Log')
204-
self.clear_button.pressed.connect(self.rich_output_textedit.clear)
203+
self.clear_rich_button = QtWidgets.QPushButton('Clear Log')
204+
self.clear_rich_button.pressed.connect(self.rich_output_textedit.clear)
205205

206206
self.buttons_layout = QtWidgets.QHBoxLayout()
207207
self.buttons_layout.addWidget(self.log_filter_button)
208208
self.buttons_layout.addStretch(stretch=1)
209-
self.buttons_layout.addWidget(self.clear_button)
209+
self.buttons_layout.addWidget(self.clear_rich_button)
210210

211211
self.rich_output_layout = QtWidgets.QVBoxLayout()
212212
self.rich_output_layout.setContentsMargins(0, 0, 0, 0)
@@ -224,6 +224,9 @@ def __init__(self, graph_model=None, parent=None):
224224
self.python_layout = QtWidgets.QHBoxLayout()
225225
self.python_layout.addWidget(QtWidgets.QLabel("Python: "))
226226
self.python_layout.addWidget(self.python_edit, stretch=1)
227+
self.clear_raw_button = QtWidgets.QPushButton('Clear Log')
228+
self.clear_raw_button.pressed.connect(self.raw_output_textedit.clear)
229+
self.python_layout.addWidget(self.clear_raw_button)
227230

228231
self.raw_output_layout = QtWidgets.QVBoxLayout()
229232
self.raw_output_layout.setContentsMargins(0, 0, 0, 0)
@@ -423,27 +426,31 @@ def closeEvent(self, event):
423426
class OutputTextEdit(QtWidgets.QTextEdit):
424427
def __init__(self, parent):
425428
super(OutputTextEdit, self).__init__(parent=parent)
429+
self._parent = parent
426430
self.setStyleSheet(self.parent().parent().styleSheet())
427431
self.setReadOnly(True)
428432
self.setFont(QtGui.QFont('Roboto Mono', 10))
429433

430434
def contextMenuEvent(self, event):
431435
menu = self.createStandardContextMenu()
432-
menu.addAction('Clear All', self.clear)
436+
menu.addAction('Clear', self.clear)
437+
menu.addAction(self._parent.parent().app_actions.clear_logs_action)
433438
menu.exec_(event.globalPos())
434439

435440

436441
class OutputTextBrowser(QtWidgets.QTextBrowser):
437442
def __init__(self, parent):
438443
super(OutputTextBrowser, self).__init__(parent=parent)
444+
self._parent = parent
439445
self.anchorClicked.connect(self.parent().link_clicked)
440446
self.setStyleSheet(self.parent().parent().styleSheet())
441447
self.setOpenLinks(False)
442448
self.setFont(QtGui.QFont('Roboto Mono', 10))
443449

444450
def contextMenuEvent(self, event):
445451
menu = self.createStandardContextMenu()
446-
menu.addAction('Clear All', self.clear)
452+
menu.addAction('Clear', self.clear)
453+
menu.addAction(self._parent.parent().app_actions.clear_logs_action)
447454
menu.exec_(event.globalPos())
448455

449456

nxt_editor/user_dir.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class USER_PREF():
7272
LOD = 'lod'
7373
ANIMATION = 'animation'
7474
SHOW_DBL_CLICK_MSG = 'show_double_click_message'
75+
SHOW_CE_DATA_STATE = 'show_code_editor_data_state'
7576

7677

7778
class EDITOR_CACHE():

nxt_editor/version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"EDITOR": {
33
"MAJOR": 3,
4-
"MINOR": 9,
4+
"MINOR": 10,
55
"PATCH": 0
66
}
77
}

0 commit comments

Comments
 (0)