Exemple #1
0
    def __init__(self, parent=None):
        super().__init__(parent)
        self.name = self.tr("Metrics Window")

        self.inputTextLabel = QLabel(self.tr("Default text:"), self)
        self.inputTextList = QListWidget(self)
        self.inputTextList.setDragDropMode(QAbstractItemView.InternalMove)
        self.addItemButton = QPushButton(self)
        self.addItemButton.setIcon(icons.i_plus())
        self.addItemButton.clicked.connect(self.addItem)
        self.removeItemButton = QPushButton(self)
        self.removeItemButton.setIcon(icons.i_minus())
        self.removeItemButton.clicked.connect(self.removeItem)

        buttonsLayout = QHBoxLayout()
        buttonsLayout.addWidget(self.addItemButton)
        buttonsLayout.addWidget(self.removeItemButton)
        spacer = QWidget()
        spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
        buttonsLayout.addWidget(spacer)

        layout = QVBoxLayout(self)
        layout.addWidget(self.inputTextLabel)
        layout.addWidget(self.inputTextList)
        layout.addLayout(buttonsLayout)
        self.setLayout(layout)

        self.readSettings()
Exemple #2
0
    def __init__(self, font, parent=None):
        super().__init__(parent, Qt.Window)
        self._autoDirection = True
        self._font = font
        self._font.groups.addObserver(self, "_groupsChanged", "Groups.Changed")
        self._font.info.addObserver(self, "_fontInfoChanged", "Info.Changed")

        groups = self._font.groups
        self.groupsListView = GroupListView(self)
        self.groupsListView.setList(sorted(groups.keys()))
        self.groupsListView.setHeaderLabels(["Name"])
        self.groupsListView.alignmentChanged.connect(self._alignmentChanged)
        # self.groupsListView.groupDeleted.connect(self._groupDeleted)
        self.groupsListView.currentItemChanged.connect(self._groupChanged)
        self.groupsListView.valueChanged.connect(self._groupRenamed)

        self.stackWidget = GlyphStackWidget(self)

        self.addGroupButton = QPushButton(self)
        self.addGroupButton.setIcon(icons.i_plus())
        self.addGroupButton.setToolTip(self.tr("Add group"))
        self.addGroupButton.clicked.connect(self._groupAdd)
        self.removeGroupButton = QPushButton(self)
        self.removeGroupButton.setIcon(icons.i_minus())
        self.removeGroupButton.setToolTip(self.tr("Remove group"))
        self.removeGroupButton.clicked.connect(self._groupDeleted)
        if not groups:
            self.removeGroupButton.setEnabled(False)

        self.alignLeftBox = QRadioButton(self.tr("Align left"), self)
        self.alignRightBox = QRadioButton(self.tr("Align right"), self)
        self.alignRightBox.toggled.connect(self._alignmentChanged)
        self.alignLeftBox.setChecked(True)

        self.groupCellView = GroupCellView(font, self)
        self.groupCellView.glyphsDropped.connect(self._glyphsDropped)
        self.groupCellView.selectionDeleted.connect(self._selectionDeleted)

        spacer = QWidget()
        spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)

        layout = QGridLayout(self)
        layout.addWidget(self.groupsListView, 0, 0, 5, 3)
        layout.addWidget(self.stackWidget, 0, 3, 5, 4)
        layout.addWidget(self.addGroupButton, 5, 0)
        layout.addWidget(self.removeGroupButton, 5, 1)
        layout.addWidget(spacer, 5, 2)
        layout.addWidget(self.alignLeftBox, 5, 3)
        layout.addWidget(self.alignRightBox, 5, 6)
        layout.addWidget(self.groupCellView, 6, 0, 4, 7)
        layout.setColumnStretch(4, 1)
        self.setLayout(layout)

        self.updateWindowTitle(font=self._font)
        self.readSettings()
Exemple #3
0
    def __init__(self, parent=None):
        super().__init__(parent)
        self.name = self.tr("Misc")

        self.markColorLabel = QLabel(self.tr("Default flag colors:"), self)
        self.markColorView = ListView(self)
        self.markColorView.setDragEnabled(True)
        # HACK: we need a model before declaring headers
        self.markColorView.setList([])
        self.markColorView.setHeaderLabels(
            (self.tr("Color"), self.tr("Name")))
        self.addItemButton = QPushButton(self)
        self.addItemButton.setIcon(icons.i_plus())
        self.addItemButton.clicked.connect(self.addItem)
        self.removeItemButton = QPushButton(self)
        self.removeItemButton.setIcon(icons.i_minus())
        self.removeItemButton.clicked.connect(self.removeItem)

        self.loadRecentFileBox = QCheckBox(
            self.tr("Load most recent file on start"), self)

        buttonsLayout = QHBoxLayout()
        buttonsLayout.setSizeConstraint(QHBoxLayout.SetMinimumSize)
        buttonsLayout.addWidget(self.addItemButton)
        buttonsLayout.addWidget(self.removeItemButton)
        spacer = QWidget()
        spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
        buttonsLayout.addWidget(spacer)

        layout = QVBoxLayout(self)
        layout.addWidget(self.markColorLabel)
        layout.addWidget(self.markColorView)
        layout.addLayout(buttonsLayout)
        layout.addWidget(self.loadRecentFileBox)
        self.setLayout(layout)

        self.readSettings()
Exemple #4
0
    def __init__(self, parent=None):
        super().__init__(parent)
        self.name = self.tr("Glyph sets")

        self.defaultGlyphSetBox = QCheckBox(self.tr("Default glyph set:"),
                                            self)
        self.defaultGlyphSetDrop = QComboBox(self)
        self.defaultGlyphSetBox.toggled.connect(self.toggleGlyphSetDrop)

        self.glyphSetList = QListWidget(self)
        self.glyphSetList.setSortingEnabled(True)
        self.glyphSetContents = QPlainTextEdit(self)
        self.glyphSetList.currentItemChanged.connect(
            self.updateGlyphSetContents)
        self.glyphSetList.itemChanged.connect(self.renameGlyphSet)
        self._cachedName = None
        splitter = QSplitter(self)
        splitter.addWidget(self.glyphSetList)
        splitter.addWidget(self.glyphSetContents)
        self.addGlyphSetButton = QPushButton(self)
        self.addGlyphSetButton.setIcon(icons.i_plus())
        self.addGlyphSetButton.clicked.connect(lambda: self.addGlyphSet())
        self.removeGlyphSetButton = QPushButton(self)
        self.removeGlyphSetButton.setIcon(icons.i_minus())
        self.removeGlyphSetButton.clicked.connect(self.removeGlyphSet)
        self.importButton = QPushButton(self.tr("Import"), self)
        importMenu = QMenu(self)
        importMenu.addAction(self.tr("Import from Current Font"),
                             self.importFromCurrentFont)
        self.importButton.setMenu(importMenu)
        self.glyphListBox = QCheckBox(self.tr("Glyph list path:"), self)
        self.glyphListEdit = QLineEdit(self)
        self.glyphListEdit.setReadOnly(True)
        self.glyphListButton = QPushButton(self.tr("Browse…"), self)
        self.glyphListButton.clicked.connect(self.getGlyphList)
        self.glyphListBox.toggled.connect(self.glyphListEdit.setEnabled)
        self.glyphListBox.toggled.connect(self.glyphListButton.setEnabled)

        buttonsLayout = QHBoxLayout()
        buttonsLayout.addWidget(self.addGlyphSetButton)
        buttonsLayout.addWidget(self.removeGlyphSetButton)
        spacer = QWidget()
        spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
        buttonsLayout.addWidget(spacer)
        buttonsLayout.addWidget(self.importButton)

        firstLayout = QGridLayout()
        l = 0
        firstLayout.addWidget(self.defaultGlyphSetBox, l, 0, 1, 2)
        firstLayout.addWidget(self.defaultGlyphSetDrop, l, 3, 1, 3)
        l += 1
        firstLayout.addWidget(splitter, l, 0, 1, 6)
        l += 1
        firstLayout.addLayout(buttonsLayout, l, 0, 1, 3)
        secondLayout = QHBoxLayout()
        secondLayout.addWidget(self.glyphListBox)
        secondLayout.addWidget(self.glyphListEdit)
        secondLayout.addWidget(self.glyphListButton)
        mainLayout = QVBoxLayout(self)
        mainLayout.addLayout(firstLayout)
        mainLayout.addLayout(secondLayout)
        self.setLayout(mainLayout)

        self.readSettings()