def __init__(self): super(SQNodeScriptLuaEditor, self).__init__() layout = QtWidgets.QVBoxLayout(self) layout.setSpacing(0) layout.setContentsMargins(0, 0, 0, 0) self.codeBox = CodeEditor(self) self.codeBox.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) layout.addWidget(self.codeBox) self.codeBox.textChanged.connect(self.onTextChanged) self.firstTouched = False
def __init__(self, *args): super(CodeBoxEditorWidget, self).__init__(*args) self.setWindowFlags(Qt.Popup | Qt.Window) self.ui = CodeBoxForm() self.ui.setupUi(self) self.editor = None self.originalText = '' self.ui.buttonOK.clicked.connect(self.apply) self.ui.buttonCancel.clicked.connect(self.cancel) self.codeBox = CodeEditor(self.ui.containerContent) layout = QtGui.QVBoxLayout(self.ui.containerContent) layout.addWidget(self.codeBox) layout.setSpacing(0) layout.setMargin(0) self.setFocusProxy(self.codeBox) self.installEventFilter(self) self.codeBox.installEventFilter(self)
def __init__(self, *args): super(CodeBoxEditorWidget, self).__init__(*args) self.setWindowFlags(Qt.Window | Qt.FramelessWindowHint) self.setWindowModality(Qt.WindowModal) self.setWindowTitle('Code Edit') self.ui = CodeBoxForm() self.ui.setupUi(self) self.editor = None self.originalText = '' self.ui.buttonOK.clicked.connect(self.apply) self.ui.buttonCancel.clicked.connect(self.cancel) self.codeBox = CodeEditor(self.ui.containerContent) layout = QtWidgets.QVBoxLayout(self.ui.containerContent) layout.addWidget(self.codeBox) layout.setSpacing(0) layout.setContentsMargins(0, 0, 0, 0) self.setFocusProxy(self.codeBox) self.installEventFilter(self) self.codeBox.installEventFilter(self)
def onLoad(self): self.windowTitle = 'Effect System Editor' self.container = self.requestDocumentWindow( 'MockEffectEditor', title='Effect Editor', size=(500, 300), minSize=(500, 300), # allowDock = False ) self.tool = self.addToolBar('effect_editor', self.container.addToolBar()) self.addTool('effect_editor/save', label='Save', icon='save') self.addTool('effect_editor/----') self.addTool('effect_editor/remove_node', icon='remove') self.addTool('effect_editor/clone_node', icon='clone') self.addTool('effect_editor/add_system', label='+System') self.addTool('effect_editor/add_child', label='+Child') self.addTool('effect_editor/----') self.addTool('effect_editor/add_move', label='+Move') self.addTool('effect_editor/----') self.addTool('effect_editor/move_up', icon='arrow-up') self.addTool('effect_editor/move_down', icon='arrow-down') self.addTool('effect_editor/----') self.addTool('effect_editor/toggle_preview', icon='play', type='check') self.window = window = self.container.addWidgetFromFile( _getModulePath('EffectEditor.ui')) self.canvas = addWidgetWithLayout( MOAIEditCanvas(window.containerPreview)) window.setFocusProxy(self.canvas) self.tree = addWidgetWithLayout( EffectNodeTreeWidget(window.containerTree)) self.tree.module = self propLayout = QtGui.QVBoxLayout() window.containerEditor.setLayout(propLayout) propLayout.setSpacing(2) propLayout.setMargin(0) self.nodePropEditor = PropertyEditor(window.containerEditor) self.paramPropEditor = PropertyEditor(window.containerEditor) propLayout.addWidget(self.nodePropEditor) propLayout.addWidget(self.paramPropEditor) self.paramPropEditor.setVisible(False) window.containerScript.setVisible(False) self.codebox = codebox = addWidgetWithLayout( CodeEditor(window.containerScript)) settingData = jsonHelper.tryLoadJSON( self.getApp().findDataFile('script_settings.json')) # if settingData: # codebox.applySetting( settingData ) self.editingTarget = None #ShortCuts self.addShortcut(self.container, '+', self.addSystem) self.addShortcut(self.container, '=', self.promptAddChild) self.addShortcut(self.container, '-', self.removeNode) # self.addShortcut( self.container, ']', self.moveNodeUp ) # self.addShortcut( self.container, '[', self.moveNodeDown ) self.addShortcut(self.container, 'ctrl+D', self.cloneNode) self.addShortcut(self.container, 'f5', self.togglePreview) self.addShortcut(self.container, 'f4', self.restartPreview) #Signals self.nodePropEditor.propertyChanged.connect(self.onNodePropertyChanged) self.paramPropEditor.propertyChanged.connect( self.onParamPropertyChanged) self.codebox.textChanged.connect(self.onScriptChanged)