Skip to content

Commit

Permalink
Merge pull request #173 from nxt-dev/dev
Browse files Browse the repository at this point in the history
Release editor-v3.8.0
  • Loading branch information
ImLucasBrown authored Feb 21, 2021
2 parents 0d0cb7d + 1df5c3c commit b9bb55f
Show file tree
Hide file tree
Showing 11 changed files with 85 additions and 22 deletions.
17 changes: 17 additions & 0 deletions nxt_editor/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1767,12 +1767,29 @@ def __init__(self, main_window):
self.run_line_global_action.setAutoRepeat(False)
self.run_line_global_action.setShortcutContext(context)
self.run_line_global_action.setShortcut('Ctrl+Shift+Return')
self.run_line_global_action.setShortcutContext(context)

self.overlay_message_action = NxtAction('Show Double Click Message',
parent=self)
self.overlay_message_action.setAutoRepeat(False)
self.overlay_message_action.setCheckable(True)
state = user_dir.user_prefs.get(user_dir.USER_PREF.SHOW_DBL_CLICK_MSG,
True)
self.overlay_message_action.setChecked(state)

def toggle_dbl_click_msg():
new = self.overlay_message_action.isChecked()
user_dir.user_prefs[user_dir.USER_PREF.SHOW_DBL_CLICK_MSG] = new
self.main_window.code_editor.overlay_widget.update()

self.overlay_message_action.toggled.connect(toggle_dbl_click_msg)

self.action_display_order = [self.copy_resolved_action,
self.localize_code_action,
self.revert_code_action,
self.font_bigger, self.font_smaller,
self.font_size_revert,
self.overlay_message_action,
self.new_line, self.indent_line,
self.unindent_line,
self.run_line_global_action,
Expand Down
12 changes: 7 additions & 5 deletions nxt_editor/dockwidgets/code_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from nxt_editor.dockwidgets.dock_widget_base import DockWidgetBase
from nxt_editor.pixmap_button import PixmapButton
from nxt_editor.label_edit import LabelEdit
from nxt_editor import colors
from nxt_editor import colors, user_dir
from nxt_editor.decorator_widgets import OpinionDots
from nxt import DATA_STATE, nxt_path
from nxt.nxt_node import INTERNAL_ATTRS
Expand Down Expand Up @@ -1301,10 +1301,12 @@ def paintEvent(self, event):
painter.drawText(self.rect().right() - offset,
painter.font().pointSize() * 1.5, self.data_state)
# Draw center message text
msg_offset = font_metrics.boundingRect(self.click_msg).width()
msg_offset += painter.font().pointSize()
painter.drawText(self.rect().center().x() - (msg_offset*.5),
self.rect().center().y(), self.click_msg)
show_msg = self._parent.ce_actions.overlay_message_action.isChecked()
if show_msg:
msg_offset = font_metrics.boundingRect(self.click_msg).width()
msg_offset += painter.font().pointSize()
painter.drawText(self.rect().center().x() - (msg_offset*.5),
self.rect().center().y(), self.click_msg)
painter.setCompositionMode(QtGui.QPainter.CompositionMode_Darken)
path = QtGui.QPainterPath()
path.addRoundedRect(QtCore.QRectF(self.rect()), 9, 9)
Expand Down
5 changes: 3 additions & 2 deletions nxt_editor/dockwidgets/hotkey_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,9 @@ def keyPressEvent(self, event):
key = modifier_key_map[key]
keySequence = QtGui.QKeySequence(key)
text = keySequence.toString()

self.setText(text.encode())
if not isinstance(text, str):
text = text.decode()
self.setText(text)
return
else:
if event_modifiers & QtCore.Qt.ShiftModifier:
Expand Down
2 changes: 1 addition & 1 deletion nxt_editor/dockwidgets/property_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ def revert_inst_path(self):
cur_inst_path = self.stage_model.get_node_instance_path(self.node_path,
comp_layer,
expand=False)
if cur_inst_path:
if cur_inst_path is not None:
self.stage_model.revert_node_instance(self.node_path)
self.instance_field.blockSignals(False)

Expand Down
17 changes: 15 additions & 2 deletions nxt_editor/dockwidgets/widget_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,20 @@ def __init__(self, graph_model=None, title='Workflow Tools', parent=None,
self.scroll_layout.setSpacing(4)
self.scroll_layout.setAlignment(QtCore.Qt.AlignTop)
self.scroll_widget.setLayout(self.scroll_layout)
# Context menu
self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
self.customContextMenuRequested.connect(self.context_menu)

# update
self.update_window()

def context_menu(self):
menu = QtWidgets.QMenu(self)
refresh_action = menu.addAction('Refresh')
refresh_action.triggered.connect(self.update_window)
menu.addAction(self.main_window.execute_actions.wt_recomp_action)
menu.popup(QtGui.QCursor.pos())

def show(self):
super(WidgetBuilder, self).show()
self.update_window()
Expand Down Expand Up @@ -854,8 +864,11 @@ def selection_widget(self, node_path, title):
attr_name=self.INPUT_LIST_ATTR,
layer=None,
data_state=DATA_STATE.CACHED)
items = ast.literal_eval(input_value) if input_value else []

if (not isinstance(input_value, str) and
isinstance(input_value, Iterable)):
items = input_value
else:
items = []
# selector dialog
screen = QtWidgets.QApplication.desktop().screenNumber(
QtWidgets.QApplication.desktop().cursor().pos())
Expand Down
17 changes: 15 additions & 2 deletions nxt_editor/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,16 @@ def __init__(self, filepath=None, parent=None, start_rpc=True):
# Should this be a signal? Like Startup done, now you can refresh?
self.splash_screen.finish(self)
self.in_startup = False
t = QtCore.QTimer()
t.setInterval(256)

def failure_check():
if self.view:
self.view.failure_check()
t.stop()
t.timeout.connect(failure_check)
t.start()

app = QtWidgets.QApplication.instance()
app.aboutToQuit.connect(self.shutdown_rpc_server)

Expand Down Expand Up @@ -1075,8 +1085,11 @@ def __init__(self, parent=None):
self.view_menu.addSeparator()
self.view_menu.addAction(self.view_actions.implicit_action)
self.view_menu.addAction(self.view_actions.grid_action)
self.view_menu.addAction(self.view_actions.tooltip_action)
self.view_menu.addAction(self.layer_actions.lay_manger_table_action)
self.view_opt_menu = self.view_menu.addMenu('Options')
self.view_opt_menu.setTearOffEnabled(True)
self.view_opt_menu.addAction(self.view_actions.tooltip_action)
self.view_opt_menu.addAction(self.layer_actions.lay_manger_table_action)
self.view_opt_menu.addAction(self.ce_actions.overlay_message_action)

# graph menu
self.graph_menu = self.addMenu('Graph')
Expand Down
16 changes: 8 additions & 8 deletions nxt_editor/node_graphics_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,10 @@ def draw_title(self, painter, lod=1.):
painter.setPen(QtCore.Qt.NoPen)
bg = painter.background()
bgm = painter.backgroundMode()
if self.error_item:
self.scene().removeItem(self.error_item)
self.error_item.deleteLater()
self.error_item = None
if self.is_real:
painter.setBackgroundMode(QtCore.Qt.OpaqueMode)
else:
Expand Down Expand Up @@ -471,11 +475,6 @@ def draw_title(self, painter, lod=1.):
error_item.setParentItem(self)
error_item.setZValue(50)
self.error_item = error_item
else:
if self.error_item:
self.scene().removeItem(self.error_item)
self.error_item.deleteLater()
self.error_item = None

# draw collapse state arrow
for arrow in self.collapse_arrows:
Expand Down Expand Up @@ -1151,11 +1150,12 @@ def boundingRect(self):
return QtCore.QRectF(-10, -10, 10, 10)

def paint(self, painter, option, widget):
painter.setRenderHints(QtGui.QPainter.Antialiasing | QtGui.QPainter.TextAntialiasing)
painter.setRenderHints(QtGui.QPainter.Antialiasing |
QtGui.QPainter.TextAntialiasing)
painter.setPen(QtCore.Qt.NoPen)
painter.setBrush(colors.ERROR)
painter.drawEllipse(0, 0, 20, 20)
painter.setPen(QtCore.Qt.black)
painter.setFont(self.font())
painter.setCompositionMode(QtGui.QPainter.CompositionMode_SourceOut)
painter.drawText(QtCore.QRectF(0.6, 0.1, 20, 20), QtCore.Qt.AlignCenter, self.text)
painter.drawText(QtCore.QRectF(0.6, 0.1, 20, 20), QtCore.Qt.AlignCenter,
self.text)
8 changes: 7 additions & 1 deletion nxt_editor/stage_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1320,6 +1320,8 @@ def get_node_source_layer(self, node_path, layer=None):
"""
layer = layer or self.comp_layer
node = layer.lookup(node_path)
if not node:
return
source_layer = self.stage.get_node_source_layer(node)
return source_layer

Expand Down Expand Up @@ -1519,6 +1521,10 @@ def set_node_instance(self, node_path, instance_path, layer=None):
if expanded_inst_path in ancestors:
logger.error('Can not instance an ancestor!')
return
dependants = self.comp_layer.get_node_dirties(node_path)
if expanded_inst_path in dependants:
logger.error('Can not instance a dependant node!')
return
cmd = SetNodeInstance(node_path=node_path,
instance_path=instance_path, model=self,
layer_path=layer_path)
Expand Down Expand Up @@ -1631,7 +1637,7 @@ def get_node_ancestor_enabled(self, node_path, layer=None):
layer = layer or self.comp_layer
ancestors = layer.ancestors(node_path)
for ancestor in ancestors:
if not get_node_enabled(ancestor):
if not self.get_node_enabled(ancestor, layer=layer):
return False
return True

Expand Down
10 changes: 10 additions & 0 deletions nxt_editor/stage_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from nxt_editor.node_graphics_item import (NodeGraphicsItem, NodeGraphicsPlug,
_pyside_version)
from nxt_editor.connection_graphics_item import AttrConnectionGraphic
from nxt_editor.dialogs import NxtWarningDialog
from nxt_editor.commands import *
from .user_dir import USER_PREF, user_prefs

Expand Down Expand Up @@ -128,6 +129,7 @@ def __init__(self, model, parent=None):
self.model.data_state_changed.connect(self.update_resolved)
self.model.layer_color_changed.connect(self.update_view)
self.model.comp_layer_changed.connect(self.update_view)
self.model.comp_layer_changed.connect(self.failure_check)
self.model.nodes_changed.connect(self.handle_nodes_changed)
self.model.attrs_changed.connect(self.handle_attrs_changed)
self.model.node_moved.connect(self.handle_node_move)
Expand Down Expand Up @@ -222,6 +224,14 @@ def implicit_connections(self):
if self.model:
return self.model.implicit_connections

def failure_check(self, *args):
if self.model.comp_layer.failure and not self.main_window.in_startup:
info = ('There was a critical error when building the comp.\n'
'Please check your output window for more details as to\n'
'what nodes failed and possibly why.')
NxtWarningDialog.show_message('Bad Comp!', info,
details=self.model.comp_layer.failure)

def update_view(self, dirty=()):
"""Clears and re-draws graphics items. If the dirty list is empty all
nodes are condisered dirty and re-drawn.
Expand Down
1 change: 1 addition & 0 deletions nxt_editor/user_dir.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class USER_PREF():
FPS = 'fps'
LOD = 'lod'
ANIMATION = 'animation'
SHOW_DBL_CLICK_MSG = 'show_double_click_message'


class EDITOR_CACHE():
Expand Down
2 changes: 1 addition & 1 deletion nxt_editor/version.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"EDITOR": {
"MAJOR": 3,
"MINOR": 7,
"MINOR": 8,
"PATCH": 0
}
}

0 comments on commit b9bb55f

Please sign in to comment.