Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pref to "Frame nodes on open" #227

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions nxt_editor/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion nxt_editor/integration/blender/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions nxt_editor/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A leftover from an old approach?

tab_changed = QtCore.Signal()
close_signal = QtCore.Signal()
new_log_signal = QtCore.Signal(logging.LogRecord)
Expand Down Expand Up @@ -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)


Comment on lines +345 to +351
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important or just leftovers?

@staticmethod
def set_waiting_cursor(state=True):
if state:
Expand Down Expand Up @@ -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():
Expand Down Expand Up @@ -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)

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 @@ -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():
Expand Down