diff --git a/nxt_editor/__init__.py b/nxt_editor/__init__.py index a9d778a..720a9c5 100644 --- a/nxt_editor/__init__.py +++ b/nxt_editor/__init__.py @@ -107,6 +107,9 @@ def launch_editor(paths=None, start_rpc=True): app = _new_qapp() instance = show_new_editor(paths, start_rpc) app.setActiveWindow(instance) + idle_detector = QtCore.QTimer() + idle_detector.timeout.connect(instance.startup_done.emit) + idle_detector.start() if not existing: app.exec_() return instance 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..a5ff2a4 100644 --- a/nxt_editor/integration/blender/__init__.py +++ b/nxt_editor/integration/blender/__init__.py @@ -76,6 +76,9 @@ def unregister_nxt(): nxt_win.show() atexit.register(nxt_win.close) self.instance = nxt_win + idle_detector = QtCore.QTimer() + idle_detector.timeout.connect(nxt_win.startup_done.emit) + idle_detector.start() return self def quit_nxt(self): diff --git a/nxt_editor/integration/maya/plug-ins/nxt_maya.py b/nxt_editor/integration/maya/plug-ins/nxt_maya.py index c42ee49..2ec4e64 100644 --- a/nxt_editor/integration/maya/plug-ins/nxt_maya.py +++ b/nxt_editor/integration/maya/plug-ins/nxt_maya.py @@ -146,6 +146,9 @@ def remove_callback(): nxt_win.close_signal.connect(remove_callback) nxt_win.show() __NXT_INSTANCE__ = nxt_win + idle_detector = QtCore.QTimer() + idle_detector.timeout.connect(nxt_win.startup_done.emit) + idle_detector.start() # PLUGIN BOILERPLATE # diff --git a/nxt_editor/main_window.py b/nxt_editor/main_window.py index 3dbb666..b0500d8 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) @@ -273,6 +274,8 @@ def failure_check(): app = QtWidgets.QApplication.instance() app.aboutToQuit.connect(self.shutdown_rpc_server) + if user_dir.user_prefs.get(user_dir.USER_PREF.FRAME_ALL_ON_NEW, False): + self.startup_done.connect(self.view_actions.frame_all_action.trigger) # RPC def startup_rpc_server(self, join=True): @@ -343,6 +346,10 @@ def event(self, event): 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 +486,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 +1101,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():