Ejemplo n.º 1
0
 def fontChanged(self):
     currentfont = QtGui.QFont(self.currentPropertyAttrib[0],
                               self.currentPropertyAttrib[2])
     currentfont.setBold(self.currentPropertyAttrib[3])
     currentfont.setItalic(self.currentPropertyAttrib[4])
     font = QtWidgets.QFontDialog().getFont(currentfont, self)
     if font[1]:
         font = font[0]
         name = font.rawName()
         size = font.pointSize()
         bold = font.bold()
         italic = font.italic()
         if self.fontScopeBG.checkedButton().text() == 'All':
             for key, value in self.currentStyle.items():
                 value[0] = name
                 value[2] = size
                 value[3] = bold
                 value[4] = italic
                 self.currentStyle[key] = value
         else:
             self.currentPropertyAttrib[0] = name
             self.currentPropertyAttrib[2] = size
             self.currentPropertyAttrib[3] = bold
             self.currentPropertyAttrib[4] = italic
             self.currentStyle[self.currentPropertyName] = \
                 self.currentPropertyAttrib
Ejemplo n.º 2
0
 def _onDefaultFont(self):
     dlg = QtWidgets.QFontDialog(self)
     dlg.setMinimumSize(640, 480)
     dlg.setCurrentFont(self._editor_font)
     ret = dlg.exec_()
     if ret > 0:
         self._editor_font = dlg.selectedFont()
         self.do_set_font(self._editor_font)
Ejemplo n.º 3
0
    def set_font(self):
        value = config["FONT"]["value"]

        font = QtGui.QFont()
        font.fromString(value)

        font, ok = QtWidgets.QFontDialog().getFont(font)

        if ok:
            config["FONT"]["value"] = font.toString()
Ejemplo n.º 4
0
def fontDialog():
    font_ = QtWidgets.QFontDialog().getFont()
    if font_:
        QtWidgets.QApplication.setFont(font_[0])
        save_ = []
        save_.append(font_[0].family())
        save_.append(font_[0].pointSize())
        save_.append(font_[0].weight())
        save_.append(font_[0].italic())

        sett_ = FLSettings()
        sett_.writeEntry("application/font", save_)
Ejemplo n.º 5
0
    def chooseFont(self) -> None:
        """Open font selector."""

        font_ = QtWidgets.QFontDialog().getFont(
        )  # type: ignore[misc] # noqa: F821
        if font_:
            QtWidgets.QApplication.setFont(font_[0])
            save_ = [
                font_[0].family(), font_[0].pointSize(), font_[0].weight(),
                font_[0].italic()
            ]

            settings.config.set_value("application/font", save_)
Ejemplo n.º 6
0
    def __init__(self, parent=None):
        super(ImgWatermark, self).__init__(parent)
        self.parent = parent

        self.file_open = None
        self.file_save = None
        self.watermark = ''

        self.lb_water = QtWidgets.QLabel()
        self.cd = QtWidgets.QColorDialog(QtGui.QColor(100, 100, 200), self)
        self.fd = QtWidgets.QFontDialog()

        self._init_ui()
        # self.show()
        self._init_colorDialog()
Ejemplo n.º 7
0
 def fontChanged(self):
     currentfont = QtGui.QFont(self.currentPropertyAttrib[2],
                               self.currentPropertyAttrib[3])
     currentfont.setBold(self.currentPropertyAttrib[4])
     currentfont.setItalic(self.currentPropertyAttrib[5])
     font = QtWidgets.QFontDialog().getFont(currentfont, self)
     if font[1]:
         font = font[0]
         name = font.rawName()
         size = font.pointSize()
         bold = font.bold()
         italic = font.italic()
         self.currentPropertyAttrib[2] = name
         self.currentPropertyAttrib[3] = size
         self.currentPropertyAttrib[4] = bold
         self.currentPropertyAttrib[5] = italic
Ejemplo n.º 8
0
    def __init__(self, parent=None):
        QtWidgets.QWidget.__init__(self, parent)

        self.setWindowTitle("Preferências")
        self.tabsMenu = QtWidgets.QTabWidget()

        self.currentColorSchemeChanged.connect(
            self.onCurrentColorSchemeChanged)
        self.currentFontChanged.connect(self.onCurrentFontChanged)

        ##########################
        #
        # CORES
        #
        ##########################
        self.retrieveSettings()
        self.colorsTab = QtWidgets.QWidget()

        ## TOKENS
        self.changeKnownColor = QtWidgets.QPushButton("Palavras conhecidas")
        self.changeUnknownColor = QtWidgets.QPushButton(
            "Palavras desconhecidas")
        self.changeTagsColor = QtWidgets.QPushButton("Tags/Marcações")
        self.changeCommandsColor = QtWidgets.QPushButton("Comandos")

        self.changeKnownColor.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Expanding)
        self.changeUnknownColor.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                              QtWidgets.QSizePolicy.Expanding)
        self.changeTagsColor.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Expanding)
        self.changeCommandsColor.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                               QtWidgets.QSizePolicy.Expanding)

        self.changeKnownColor.clicked.connect(
            lambda: self.newColorSelectionMenu(GColorScheme.Known))
        self.changeUnknownColor.clicked.connect(
            lambda: self.newColorSelectionMenu(GColorScheme.Unknown))
        self.changeTagsColor.clicked.connect(
            lambda: self.newColorSelectionMenu(GColorScheme.Tags))
        self.changeCommandsColor.clicked.connect(
            lambda: self.newColorSelectionMenu(GColorScheme.Commands))

        self.changeKnownColor.setStyleSheet("text-align:left; padding:3px")
        self.changeUnknownColor.setStyleSheet("text-align:left; padding:3px")
        self.changeTagsColor.setStyleSheet("text-align:left; padding:3px")
        self.changeCommandsColor.setStyleSheet("text-align:left; padding:3px")

        colorsTokensLayout = QtWidgets.QVBoxLayout()
        colorsTokensLayout.addWidget(self.changeKnownColor)
        colorsTokensLayout.addWidget(self.changeUnknownColor)
        colorsTokensLayout.addWidget(self.changeTagsColor)
        colorsTokensLayout.addWidget(self.changeCommandsColor)

        colorsTokensGroup = QtWidgets.QGroupBox("Tokens")
        colorsTokensGroup.setLayout(colorsTokensLayout)

        ## MARCADORES

        self.utilizarCorInversaCheck = QtWidgets.QCheckBox(
            "Utilizar fonte na cor inversa do fundo")
        self.utilizarCorInversaCheck.setChecked(self.utilizarCorInversa)
        self.utilizarCorInversaCheck.stateChanged.connect(
            self.colorMarkerCheckBoxChanged)

        self.changeSubWordFontColor = QtWidgets.QPushButton(
            "Fonte das palavras para trocar")
        self.changeSubWordBackgroundColor = QtWidgets.QPushButton(
            "Fundo  das palavras para trocar")

        self.changeSubWordFontColor.setEnabled(not self.utilizarCorInversa)

        self.changeSubWordFontColor.setStyleSheet(
            "text-align:left; padding:3px")
        self.changeSubWordBackgroundColor.setStyleSheet(
            "text-align:left; padding:3px")

        self.changeSubWordFontColor.clicked.connect(
            lambda: self.newColorSelectionMenu(GColorScheme.SubWordFont))
        self.changeSubWordBackgroundColor.clicked.connect(
            lambda: self.newColorSelectionMenu(GColorScheme.SubWordBackground))

        colorsMarkersLayout = QtWidgets.QVBoxLayout()
        colorsMarkersLowerLayout = QtWidgets.QVBoxLayout()
        colorsMarkersLowerLayout.setContentsMargins(0, 0, 0, 0)
        colorsMarkersLowerLayout.addWidget(self.utilizarCorInversaCheck)
        colorsMarkersLowerLayout.addWidget(self.changeSubWordFontColor)

        colorsMarkersLayout.addWidget(self.changeSubWordBackgroundColor)
        colorsMarkersLayout.addLayout(colorsMarkersLowerLayout)

        colorsMarkersGroup = QtWidgets.QGroupBox("Marcadores")
        colorsMarkersGroup.setLayout(colorsMarkersLayout)

        ## LAYOUT PRINCIPAL MENU DE CORES
        colorsMainLayout = QtWidgets.QVBoxLayout()
        colorsUpperLayout = QtWidgets.QHBoxLayout()

        colorsUpperLayout.addWidget(colorsTokensGroup)
        colorsUpperLayout.addWidget(colorsMarkersGroup)

        colorsMainLayout.addLayout(colorsUpperLayout)

        self.updateButtons()

        self.colorsTab.setLayout(colorsMainLayout)

        ###############################
        #
        # FONTES
        #
        ###############################

        self.fontsTab = QtWidgets.QWidget()

        self.fontDialog = QtWidgets.QFontDialog()
        self.fontDialog.setModal(False)
        self.fontDialog.setOption(self.fontDialog.DontUseNativeDialog)
        self.fontDialog.setOption(self.fontDialog.NoButtons)

        self.fontDialog.setCurrentFont(self.currentFont)
        self.fontDialog.currentFontChanged.connect(
            lambda font: self.currentFontChanged.emit(font))

        fontsTabLayout = QtWidgets.QVBoxLayout()
        fontsTabLayout.addWidget(self.fontDialog)

        self.fontsTab.setLayout(fontsTabLayout)

        ###############################
        #
        # FINALIZAR
        #
        ###############################
        self.aplicar = QtWidgets.QPushButton("Aplicar")
        self.salvar = QtWidgets.QPushButton("Ok")
        self.cancelar = QtWidgets.QPushButton("Fechar")
        self.resetar = QtWidgets.QPushButton("Valores padrão")

        self.aplicar.setEnabled(False)

        self.aplicar.clicked.connect(self.onApplyButtonPressed)
        self.salvar.clicked.connect(self.onSaveButtonPressed)
        self.cancelar.clicked.connect(self.onCancelButtonPressed)
        self.resetar.clicked.connect(self.resetDefaultValues)

        exitLayout = QtWidgets.QHBoxLayout()
        exitLayout.addWidget(self.aplicar)
        #		exitLayout.addWidget(self.salvar)
        exitLayout.addWidget(self.cancelar)
        exitLayout.addWidget(self.resetar)

        exitGroup = QtWidgets.QGroupBox()
        exitGroup.setLayout(exitLayout)

        ###############################
        #
        # LAYOUT DAS TABS
        #
        ###############################
        self.tabsMenu.addTab(self.colorsTab, "Cores")
        self.tabsMenu.addTab(self.fontsTab, "Fontes")

        layout = QtWidgets.QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self.tabsMenu)
        layout.addWidget(exitGroup)
        self.setLayout(layout)