def __init__(self): super(PreferencesEditor, self).__init__() self.setObjectName('PythonEditorPreferences') self.layout = QtWidgets.QVBoxLayout(self) self.setWindowTitle('Python Editor Preferences') self.build_layout() self.connect_signals()
def build_layout(self): """ Create the layout. """ layout = QtWidgets.QVBoxLayout(self) layout.setContentsMargins(0, 0, 0, 0) # self.setup_menu() self.menubar = menubar.MenuBar(self) left_widget = QtWidgets.QWidget() left_layout = QtWidgets.QVBoxLayout(left_widget) path_edit = QtWidgets.QLineEdit() path_edit.textChanged.connect(self.update_tree) self.path_edit = path_edit splitter = QtWidgets.QSplitter(QtCore.Qt.Horizontal) self.splitter = splitter self.xpanded = False self.setLayout(layout) self.tool_button = QtWidgets.QToolButton() self.tool_button.setText('<') self.tool_button.clicked.connect(self.xpand) self.tool_button.setMaximumWidth(20) layout.addWidget(splitter) browse = browser.FileTree(NUKE_DIR) self.browser = browse left_layout.addWidget(self.path_edit) left_layout.addWidget(self.browser) self.tabs = edittabs.EditTabs() widgets = [left_widget, self.tool_button, self.tabs] for w in widgets: splitter.addWidget(w) splitter.setSizes([200, 10, 800]) self.install_features() self.check_modified_tabs() if self.tabs.count() == 0: self.tabs.new_tab()
def build_layout(self): """ Create the layout. """ layout = QtWidgets.QVBoxLayout(self) layout.setContentsMargins(0, 0, 0, 0) # self.setup_menu() self.read_only = True self.menubar = menubar.MenuBar(self) left_widget = QtWidgets.QWidget() left_layout = QtWidgets.QVBoxLayout(left_widget) path_edit = QtWidgets.QLineEdit() path_edit.textChanged.connect(self.update_tree) self.path_edit = path_edit splitter = QtWidgets.QSplitter(QtCore.Qt.Horizontal) self.splitter = splitter self.xpanded = False self.setLayout(layout) self.tool_button = QtWidgets.QToolButton() self.tool_button.setText('<') self.tool_button.clicked.connect(self.xpand) self.tool_button.setMaximumWidth(20) layout.addWidget(splitter) browse = browser.FileTree(NUKE_DIR) self.browser = browse left_layout.addWidget(self.path_edit) left_layout.addWidget(self.browser) self.editor = editor.Editor(handle_shortcuts=True) self.editor.path = 'C:/Users/tsalx/Desktop/temp_editor_save.py' widgets = [left_widget, self.tool_button, self.editor] for w in widgets: splitter.addWidget(w) splitter.setSizes([200, 10, 800]) self.browser.path_signal.connect(self.read) self.editor.textChanged.connect(self.write) self.editor.modificationChanged.connect(self.handle_changed)
def __init__(self, path): QtWidgets.QDialog.__init__(self) self.setWindowTitle('Nuke Mini Browser') self._layout = QtWidgets.QVBoxLayout() self.setLayout(self._layout) self.resize(400, 320) self.file_tree = FileTree(path) self._layout.addWidget(self.file_tree)
def __init__(self, knobs): super(PyKnobs, self).__init__() self.knobs = knobs self._knob = knobs[0] self.layout = QtWidgets.QVBoxLayout(self) self.knobChooser = QtWidgets.QComboBox() self.knobChooser.addItems([k.name() for k in knobs]) self.editor = PyKnobEdit(self._knob) self.layout.addWidget(self.knobChooser) self.layout.addWidget(self.editor) self.knobChooser.currentIndexChanged.connect(self.updateKnob)
def __init__(self, parent=None): super(PythonEditor, self).__init__(parent=parent) self.setObjectName('PythonEditor') self._parent = parent if parent is not None: self.setParent(parent) layout = QtWidgets.QVBoxLayout(self) layout.setObjectName('PythonEditor_MainLayout') layout.setContentsMargins(0, 0, 0, 0) self.tabeditor = tabs.TabEditor(self) self.editor = self.tabeditor.editor self.terminal = terminal.Terminal() splitter = QtWidgets.QSplitter(QtCore.Qt.Vertical) splitter.setObjectName('PythonEditor_MainVerticalSplitter') splitter.addWidget(self.terminal) splitter.addWidget(self.tabeditor) layout.addWidget(splitter) self.splitter = splitter act = actions.Actions( pythoneditor=self, editor=self.editor, tabeditor=self.tabeditor, terminal=self.terminal, ) sch = shortcuts.ShortcutHandler( editor=self.editor, tabeditor=self.tabeditor, terminal=self.terminal, ) self.menubar = menubar.MenuBar(self) SE = shortcuteditor.ShortcutEditor self.shortcuteditor = SE(editor=self.editor, tabeditor=self.tabeditor, terminal=self.terminal) PE = preferences.PreferencesEditor self.preferenceseditor = PE() # Loading the AutosaveManager will also load # all the contents of the autosave into tabs. AM = autosavexml.AutoSaveManager self.filehandler = AM(self.tabeditor)
def construct_ui(self): layout = QtWidgets.QVBoxLayout(self) layout.setObjectName('PythonEditor_MainLayout') layout.setContentsMargins(0, 0, 0, 0) self.tabeditor = tabs.TabEditor(self) self.editor = self.tabeditor.editor self.terminal = terminal.Terminal() self.menubar = menubar.MenuBar(self) splitter = QtWidgets.QSplitter(QtCore.Qt.Vertical) splitter.setObjectName('PythonEditor_MainVerticalSplitter') splitter.addWidget(self.terminal) splitter.addWidget(self.tabeditor) layout.addWidget(splitter)
def __init__(self, parent=None): super(TabEditor, self).__init__(parent) if parent is not None: self.setParent(parent) self.setLayout(QtWidgets.QVBoxLayout(self)) self.layout().setContentsMargins(0, 0, 0, 0) self.tab_widget = QtWidgets.QWidget() twl = QtWidgets.QHBoxLayout(self.tab_widget) self.tab_widget_layout = twl self.tab_widget_layout.setContentsMargins(0, 0, 0, 0) self.tabs = Tabs() self.tab_widget_layout.addWidget(self.tabs) # add corner buttons tb = QtWidgets.QToolButton() self.tab_list_button = tb tb.setArrowType(QtCore.Qt.DownArrow) tb.setToolTip('Click for a list of tabs.') tb.setAutoRaise(True) tb.setFixedSize(24, 24) self.tab_list_button.clicked.connect(self.show_tab_menu) nb = QtWidgets.QToolButton() self.new_tab_button = nb nb.setToolTip('Click to add a new tab.') nb.setText('+') nb.setAutoRaise(True) self.new_tab_button.clicked.connect(self.new_tab) for button in [self.new_tab_button, self.tab_list_button]: self.tab_widget_layout.addWidget(button) self.editor = editor.Editor(handle_shortcuts=False) for widget in self.tab_widget, self.editor: self.layout().addWidget(widget) # Give the autosave a chance to load all # tabs before connecting signals between # tabs and editor. QtCore.QTimer.singleShot(0, self.connect_signals)