def __init__(self, parentWidget): QWidget.__init__(self, parentWidget) self.formatManager = FormatManager() self.formatManager.loadFormats() self.editView = StylableTextEdit(self, self.formatManager) self.editView.navigate.connect(self.navigate) self.editView.objectSelectionChanged.connect( self.objectSelectionChanged) toolbar = QWidget(self) layout = QHBoxLayout() layout.setContentsMargins(0, 0, 0, 0) toolbar.setLayout(layout) self.actionsSelector = ActionSelector(self) layout.addWidget(self.actionsSelector) self.textFormatSelector = TextStyleSelector(self) self.textFormatSelector.styleChanged.connect( self.editView.applyTextFormat) self.editView.updateCharFormat.connect( self.textFormatSelector.setCurrentStyle) layout.addWidget(self.textFormatSelector) self.styleSelector = BlockStyleSelector(self) self.styleSelector.styleChanged.connect(self.editView.applyBlockStyle) self.styleSelector.indentLess.connect(self.editView.indentLess) self.styleSelector.indentMore.connect(self.editView.indentMore) self.styleSelector.insertTable.connect(self.insertTable) self.editView.updateBlockFormat.connect( self.styleSelector.setCurrentStyle) layout.addWidget(self.styleSelector) searchMarker = self.formatManager.getFormat( ('searchMarker', None, None)) self.findWidget = FindWidget(self, searchMarker.getCharFormat(), self.editView) self.findWidget.hide() self.editMathWidget = MathEditWidget(self) self.editMathWidget.apply.connect(self.applyMathFormula) self.editMathWidget.hide() #horizontalSpacer = QSpacerItem(0, 0) # 40, 20) # , QSizePolicy.Expanding, QSizePolicy.Minimum) #layout.addItem(horizontalSpacer) hLayout = QVBoxLayout(self) hLayout.setContentsMargins(0, 0, 0, 0) hLayout.addWidget(toolbar) hLayout.addWidget(self.findWidget) hLayout.addWidget(self.editView) hLayout.addWidget(self.editMathWidget) # The toolbar should take the minimum space and the edit view the remaining space hLayout.setStretch(0, 0) hLayout.setStretch(1, 0) hLayout.setStretch(2, 1) hLayout.setStretch(3, 0.1)
def __init__(self, npDef, settings): self.type = npDef['type'] self.name = npDef['name'] self.rootPath = self.name self.client = dropbox.client.DropboxClient(settings.getDropboxToken()) self.formatManager = FormatManager() self.formatManager.loadFormats() # TODO: Only required once
def __init__(self, npDef): self.type = npDef['type'] self.name = npDef['name'] self.rootPath = npDef['path'] self.formatManager = FormatManager() self.formatManager.loadFormats() # TODO: Only required once self.db = NotepadDB() self.db.openDatabase(self)