Skip to content

Commit 2e7cc42

Browse files
Merge pull request #172 from nxt-dev/weekendUX_patch
UX Patches
2 parents 5352250 + 22a6dff commit 2e7cc42

File tree

8 files changed

+42
-15
lines changed

8 files changed

+42
-15
lines changed

nxt_editor/actions.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,8 +1778,7 @@ def __init__(self, main_window):
17781778
self.overlay_message_action.setChecked(state)
17791779

17801780
def toggle_dbl_click_msg():
1781-
old = self.overlay_message_action.isChecked()
1782-
new = not old
1781+
new = self.overlay_message_action.isChecked()
17831782
user_dir.user_prefs[user_dir.USER_PREF.SHOW_DBL_CLICK_MSG] = new
17841783
self.main_window.code_editor.overlay_widget.update()
17851784

nxt_editor/dockwidgets/hotkey_editor.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,9 @@ def keyPressEvent(self, event):
434434
key = modifier_key_map[key]
435435
keySequence = QtGui.QKeySequence(key)
436436
text = keySequence.toString()
437-
438-
self.setText(text.encode())
437+
if not isinstance(text, str):
438+
text = text.decode()
439+
self.setText(text)
439440
return
440441
else:
441442
if event_modifiers & QtCore.Qt.ShiftModifier:

nxt_editor/dockwidgets/property_editor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ def revert_inst_path(self):
958958
cur_inst_path = self.stage_model.get_node_instance_path(self.node_path,
959959
comp_layer,
960960
expand=False)
961-
if cur_inst_path:
961+
if cur_inst_path is not None:
962962
self.stage_model.revert_node_instance(self.node_path)
963963
self.instance_field.blockSignals(False)
964964

nxt_editor/dockwidgets/widget_builder.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -864,8 +864,11 @@ def selection_widget(self, node_path, title):
864864
attr_name=self.INPUT_LIST_ATTR,
865865
layer=None,
866866
data_state=DATA_STATE.CACHED)
867-
items = ast.literal_eval(input_value) if input_value else []
868-
867+
if (not isinstance(input_value, str) and
868+
isinstance(input_value, Iterable)):
869+
items = input_value
870+
else:
871+
items = []
869872
# selector dialog
870873
screen = QtWidgets.QApplication.desktop().screenNumber(
871874
QtWidgets.QApplication.desktop().cursor().pos())

nxt_editor/main_window.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,16 @@ def __init__(self, filepath=None, parent=None, start_rpc=True):
261261
# Should this be a signal? Like Startup done, now you can refresh?
262262
self.splash_screen.finish(self)
263263
self.in_startup = False
264+
t = QtCore.QTimer()
265+
t.setInterval(256)
266+
267+
def failure_check():
268+
if self.view:
269+
self.view.failure_check()
270+
t.stop()
271+
t.timeout.connect(failure_check)
272+
t.start()
273+
264274
app = QtWidgets.QApplication.instance()
265275
app.aboutToQuit.connect(self.shutdown_rpc_server)
266276

nxt_editor/node_graphics_item.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,10 @@ def draw_title(self, painter, lod=1.):
335335
painter.setPen(QtCore.Qt.NoPen)
336336
bg = painter.background()
337337
bgm = painter.backgroundMode()
338+
if self.error_item:
339+
self.scene().removeItem(self.error_item)
340+
self.error_item.deleteLater()
341+
self.error_item = None
338342
if self.is_real:
339343
painter.setBackgroundMode(QtCore.Qt.OpaqueMode)
340344
else:
@@ -471,11 +475,6 @@ def draw_title(self, painter, lod=1.):
471475
error_item.setParentItem(self)
472476
error_item.setZValue(50)
473477
self.error_item = error_item
474-
else:
475-
if self.error_item:
476-
self.scene().removeItem(self.error_item)
477-
self.error_item.deleteLater()
478-
self.error_item = None
479478

480479
# draw collapse state arrow
481480
for arrow in self.collapse_arrows:
@@ -1151,11 +1150,12 @@ def boundingRect(self):
11511150
return QtCore.QRectF(-10, -10, 10, 10)
11521151

11531152
def paint(self, painter, option, widget):
1154-
painter.setRenderHints(QtGui.QPainter.Antialiasing | QtGui.QPainter.TextAntialiasing)
1153+
painter.setRenderHints(QtGui.QPainter.Antialiasing |
1154+
QtGui.QPainter.TextAntialiasing)
11551155
painter.setPen(QtCore.Qt.NoPen)
11561156
painter.setBrush(colors.ERROR)
11571157
painter.drawEllipse(0, 0, 20, 20)
11581158
painter.setPen(QtCore.Qt.black)
11591159
painter.setFont(self.font())
1160-
painter.setCompositionMode(QtGui.QPainter.CompositionMode_SourceOut)
1161-
painter.drawText(QtCore.QRectF(0.6, 0.1, 20, 20), QtCore.Qt.AlignCenter, self.text)
1160+
painter.drawText(QtCore.QRectF(0.6, 0.1, 20, 20), QtCore.Qt.AlignCenter,
1161+
self.text)

nxt_editor/stage_model.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,6 +1521,10 @@ def set_node_instance(self, node_path, instance_path, layer=None):
15211521
if expanded_inst_path in ancestors:
15221522
logger.error('Can not instance an ancestor!')
15231523
return
1524+
dependants = self.comp_layer.get_node_dirties(node_path)
1525+
if expanded_inst_path in dependants:
1526+
logger.error('Can not instance a dependant node!')
1527+
return
15241528
cmd = SetNodeInstance(node_path=node_path,
15251529
instance_path=instance_path, model=self,
15261530
layer_path=layer_path)

nxt_editor/stage_view.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from nxt_editor.node_graphics_item import (NodeGraphicsItem, NodeGraphicsPlug,
1616
_pyside_version)
1717
from nxt_editor.connection_graphics_item import AttrConnectionGraphic
18+
from nxt_editor.dialogs import NxtWarningDialog
1819
from nxt_editor.commands import *
1920
from .user_dir import USER_PREF, user_prefs
2021

@@ -128,6 +129,7 @@ def __init__(self, model, parent=None):
128129
self.model.data_state_changed.connect(self.update_resolved)
129130
self.model.layer_color_changed.connect(self.update_view)
130131
self.model.comp_layer_changed.connect(self.update_view)
132+
self.model.comp_layer_changed.connect(self.failure_check)
131133
self.model.nodes_changed.connect(self.handle_nodes_changed)
132134
self.model.attrs_changed.connect(self.handle_attrs_changed)
133135
self.model.node_moved.connect(self.handle_node_move)
@@ -222,6 +224,14 @@ def implicit_connections(self):
222224
if self.model:
223225
return self.model.implicit_connections
224226

227+
def failure_check(self, *args):
228+
if self.model.comp_layer.failure and not self.main_window.in_startup:
229+
info = ('There was a critical error when building the comp.\n'
230+
'Please check your output window for more details as to\n'
231+
'what nodes failed and possibly why.')
232+
NxtWarningDialog.show_message('Bad Comp!', info,
233+
details=self.model.comp_layer.failure)
234+
225235
def update_view(self, dirty=()):
226236
"""Clears and re-draws graphics items. If the dirty list is empty all
227237
nodes are condisered dirty and re-drawn.

0 commit comments

Comments
 (0)