diff --git a/nxt_editor/actions.py b/nxt_editor/actions.py index 5b9c8e9..c1f7c72 100644 --- a/nxt_editor/actions.py +++ b/nxt_editor/actions.py @@ -1372,8 +1372,23 @@ def toggle_tooltip(): tt_state = user_dir.user_prefs.get(user_dir.USER_PREF.NODE_TOOLTIPS, True) self.tooltip_action.setChecked(tt_state) + + # Toggle node tooltips + def toggle_frame_all_on_new(): + pref_key = user_dir.USER_PREF.FRAME_ALL_ON_NEW + frame_all_on_new_state = self.frame_all_on_new_action.isChecked() + user_dir.user_prefs[pref_key] = frame_all_on_new_state + + self.frame_all_on_new_action = NxtAction('Frame all nodes on open', parent=self) + self.frame_all_on_new_action.setAutoRepeat(False) + self.frame_all_on_new_action.setCheckable(True) + state = user_dir.user_prefs.get(user_dir.USER_PREF.FRAME_ALL_ON_NEW, False) + self.frame_all_on_new_action.setChecked(state) + self.frame_all_on_new_action.toggled.connect(toggle_frame_all_on_new) + self.action_display_order = [self.tooltip_action, self.frame_all_action, + self.frame_all_on_new_action, self.frame_selection_action, self.hide_attrs_action, self.disp_local_attrs_action, diff --git a/nxt_editor/integration/blender/__init__.py b/nxt_editor/integration/blender/__init__.py index 09f83bb..77ff675 100644 --- a/nxt_editor/integration/blender/__init__.py +++ b/nxt_editor/integration/blender/__init__.py @@ -56,7 +56,7 @@ def launch_nxt(cls): self = __NXT_INTEGRATION__ if self.instance: self.instance.show() - return + return self if not self.nxt_qapp: self.nxt_qapp = nxt_editor._new_qapp() nxt_win = nxt_editor.show_new_editor(start_rpc=False) diff --git a/nxt_editor/main_window.py b/nxt_editor/main_window.py index 3dbb666..51e2fda 100644 --- a/nxt_editor/main_window.py +++ b/nxt_editor/main_window.py @@ -46,6 +46,7 @@ class MainWindow(QtWidgets.QMainWindow): """The main window of the nxt UI. Includes the menu bar, tool bar, and dock widgets.""" + startup_done = QtCore.Signal() tab_changed = QtCore.Signal() close_signal = QtCore.Signal() new_log_signal = QtCore.Signal(logging.LogRecord) @@ -341,8 +342,13 @@ def event(self, event): if event.type() == QtCore.QEvent.WindowDeactivate: self._held_keys = [] self.zoom_keys_down = False + return super(MainWindow, self).event(event) + def resizeEvent(self, event): + super(MainWindow, self).resizeEvent(event) + + @staticmethod def set_waiting_cursor(state=True): if state: @@ -479,6 +485,8 @@ def new_tab(self, initial_stage=None, update=True): self.update_grid_action() self.update() # TODO: Make this better self.set_waiting_cursor(False) + if not self.in_startup and user_dir.user_prefs.get(user_dir.USER_PREF.FRAME_ALL_ON_NEW, False): + self.view_actions.frame_all_action.trigger() @staticmethod def ding(): @@ -1092,6 +1100,7 @@ def __init__(self, parent=None): 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.view_actions.frame_all_on_new_action) self.view_opt_menu.addAction(self.layer_actions.lay_manger_table_action) self.view_opt_menu.addAction(self.ce_actions.overlay_message_action) diff --git a/nxt_editor/user_dir.py b/nxt_editor/user_dir.py index 82ee6af..c0fe934 100644 --- a/nxt_editor/user_dir.py +++ b/nxt_editor/user_dir.py @@ -74,6 +74,7 @@ class USER_PREF(): SHOW_DBL_CLICK_MSG = 'show_double_click_message' SHOW_CE_DATA_STATE = 'show_code_editor_data_state' DING = 'ding' + FRAME_ALL_ON_NEW = 'frame_all_on_new' class EDITOR_CACHE():