Insert GlyphDBEdit into a dock widget.
This commit is contained in:
parent
a9a3fc2bac
commit
12f40cfd53
1 changed files with 17 additions and 12 deletions
|
|
@ -25,6 +25,7 @@ from PyQt4.QtCore import (
|
||||||
from PyQt4.QtGui import (
|
from PyQt4.QtGui import (
|
||||||
qApp,
|
qApp,
|
||||||
QAction,
|
QAction,
|
||||||
|
QDockWidget,
|
||||||
QKeySequence,
|
QKeySequence,
|
||||||
QMainWindow,
|
QMainWindow,
|
||||||
QPushButton,
|
QPushButton,
|
||||||
|
|
@ -71,20 +72,27 @@ class MainWindow(QMainWindow):
|
||||||
layout.addWidget(self.glyphEdit)
|
layout.addWidget(self.glyphEdit)
|
||||||
|
|
||||||
self.createMenus()
|
self.createMenus()
|
||||||
|
self.createDockWidgets()
|
||||||
|
|
||||||
self.readSettings()
|
self.readSettings()
|
||||||
|
|
||||||
def createMenus(self):
|
def createMenus(self):
|
||||||
fileMenu = self.menuBar().addMenu('&File')
|
self.fileMenu = self.menuBar().addMenu('&File')
|
||||||
quit = QAction('Quit', self)
|
self.quitAction = QAction('Quit', self)
|
||||||
quit.setShortcut(QKeySequence.Quit)
|
self.quitAction.setShortcut(QKeySequence.Quit)
|
||||||
quit.triggered.connect(qApp.closeAllWindows)
|
self.quitAction.triggered.connect(qApp.closeAllWindows)
|
||||||
fileMenu.addAction(quit)
|
self.fileMenu.addAction(self.quitAction)
|
||||||
|
|
||||||
fileMenu = self.menuBar().addMenu('&Tools')
|
self.toolsMenu = self.menuBar().addMenu('&Tools')
|
||||||
glyphDBEdit = QAction('Edit glyph database', self)
|
|
||||||
glyphDBEdit.triggered.connect(self.showGlyphDBEdit)
|
def createDockWidgets(self):
|
||||||
fileMenu.addAction(glyphDBEdit)
|
dock = QDockWidget('Glyph database', self)
|
||||||
|
dock.setObjectName('Glyph database dock')
|
||||||
|
dock.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)
|
||||||
|
dock.setWidget(self.glyphDBEdit)
|
||||||
|
dock.hide()
|
||||||
|
self.toolsMenu.addAction(dock.toggleViewAction())
|
||||||
|
self.addDockWidget(Qt.RightDockWidgetArea, dock)
|
||||||
|
|
||||||
def sizeHint(self):
|
def sizeHint(self):
|
||||||
return QSize(800, 600)
|
return QSize(800, 600)
|
||||||
|
|
@ -116,9 +124,6 @@ class MainWindow(QMainWindow):
|
||||||
self.glyphEdit.text.clear()
|
self.glyphEdit.text.clear()
|
||||||
self.glyphEntered.emit(text, bold, italic)
|
self.glyphEntered.emit(text, bold, italic)
|
||||||
|
|
||||||
def showGlyphDBEdit(self):
|
|
||||||
self.glyphDBEdit.show()
|
|
||||||
|
|
||||||
def setDocumentTitle(self, title):
|
def setDocumentTitle(self, title):
|
||||||
if title:
|
if title:
|
||||||
full_title = '{} – {}'.format(title, self.BASE_TITLE)
|
full_title = '{} – {}'.format(title, self.BASE_TITLE)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue