Skip to content

Editor window

A ready-made main window with menus, file handling and the editor widget inside it.

nodeeditor.node_editor_window

A module containing the Main Window class

NodeEditorWindow

Bases: QMainWindow

The Main Window of NodeEditor.

Holds the file and edit menus, the actions behind them and the :class:~nodeeditor.node_editor_widget.NodeEditorWidget that draws the graph.

:Instance Attributes:

  • name_company - name of the company, used for permanent profile settings
  • name_product - name of this App, used for permanent profile settings

NodeEditorWidget_class class-attribute instance-attribute

NodeEditorWidget_class = NodeEditorWidget

Class representing NodeEditor's Main Window

initUI

initUI()

Set up this QMainWindow. Create :class:~nodeeditor.node_editor_widget.NodeEditorWidget, Actions and Menus

sizeHint

sizeHint()

The preferred size of the main window.

:return: the default window size :rtype: QSize

createStatusBar

createStatusBar()

Create Status bar and connect to Graphics View scenePosChanged event

createActions

createActions()

Create basic File and Edit actions

createMenus

createMenus()

Create Menus for File and Edit

createFileMenu

createFileMenu()

Create the File menu and fill it with the file actions

createEditMenu

createEditMenu()

Create the Edit menu and fill it with the edit and grouping actions

setTitle

setTitle()

Function responsible for setting window title

closeEvent

closeEvent(event)

Handle close event. Ask before we loose work

isModified

isModified()

Has current :class:~nodeeditor.node_scene.Scene been modified?

:return: True if current :class:~nodeeditor.node_scene.Scene has been modified :rtype: bool

getCurrentNodeEditorWidget

getCurrentNodeEditorWidget()

get current :class:~nodeeditor.node_editor_widget

:return: get current :class:~nodeeditor.node_editor_widget :rtype: :class:~nodeeditor.node_editor_widget

maybeSave

maybeSave()

If current Scene is modified, ask a dialog to save the changes. Used before closing window / mdi child document

:return: True if we can continue in the Close Event and shutdown. False if we should cancel :rtype: bool

onScenePosChanged

onScenePosChanged(x, y)

Handle event when cursor position changed on the Scene

:param x: new cursor x position :type x: :param y: new cursor y position :type y:

getFileDialogDirectory

getFileDialogDirectory()

Returns starting directory for QFileDialog file open/save

getFileDialogFilter

getFileDialogFilter()

Returns str standard file open/save filter for QFileDialog

onFileNew

onFileNew()

Hande File New operation

onFileOpen

onFileOpen()

Handle File Open operation

onFileSave

onFileSave()

Handle File Save operation

onFileSaveAs

onFileSaveAs()

Handle File Save As operation

onBeforeSaveAs

onBeforeSaveAs(current_nodeeditor, filename)

Event triggered after choosing filename and before actual fileSave(). We are passing current_nodeeditor because we will loose focus after asking with QFileDialog and therefore getCurrentNodeEditorWidget will return None

onEditUndo

onEditUndo()

Handle Edit Undo operation

onEditRedo

onEditRedo()

Handle Edit Redo operation

onEditDelete

onEditDelete()

Handle Delete Selected operation

onGroupSelected

onGroupSelected()

Group currently selected nodes (needs 2+). Shortcut G.

onUngroupSelected

onUngroupSelected()

Ungroup selected groups, keep nodes. Shortcut U / Shift+G.

onToggleCollapseSelected

onToggleCollapseSelected()

Collapse/expand selected groups. Shortcut C.

onEditCut

onEditCut()

Handle Edit Cut to clipboard operation

onEditCopy

onEditCopy()

Handle Edit Copy to clipboard operation

onEditPaste

onEditPaste()

Handle Edit Paste from clipboard operation

readSettings

readSettings()

Read the permanent profile settings for this app

writeSettings

writeSettings()

Write the permanent profile settings for this app