示例#1
0
 def setUbuntuFont(self, ptSize):
     """Set Ubuntu font."""
     QFontDatabase.addApplicationFont(":/fonts/Ubuntu-B.ttf")
     QFontDatabase.addApplicationFont(":/fonts/Ubuntu-BI.ttf")
     QFontDatabase.addApplicationFont(":/fonts/Ubuntu-C.ttf")
     QFontDatabase.addApplicationFont(":/fonts/Ubuntu-L.ttf")
     QFontDatabase.addApplicationFont(":/fonts/Ubuntu-LI.ttf")
     QFontDatabase.addApplicationFont(":/fonts/Ubuntu-M.ttf")
     QFontDatabase.addApplicationFont(":/fonts/Ubuntu-MI.ttf")
     QFontDatabase.addApplicationFont(":/fonts/Ubuntu-R.ttf")
     QFontDatabase.addApplicationFont(":/fonts/Ubuntu-RI.ttf")
     ufont = QFont("Ubuntu", ptSize, 1)
     QApplication.setFont(ufont)
     QSWATUtils.loginfo('Ubuntu {0} point font set'.format(ptSize))
示例#2
0
文件: environ.py 项目: skylning/Roam
    def init(self, logo, title, **kwargs):
        from qgis.core import QgsApplication
        from qgis.PyQt.QtWidgets import QApplication
        from qgis.PyQt.QtGui import QFont, QIcon
        from qgis.PyQt.QtCore import QLocale, QTranslator
        try:
            import qgis.PyQt.QtSql
        except ImportError:
            pass

        # In python3 we need to convert to a bytes object (or should
        # QgsApplication accept a QString instead of const char* ?)
        try:
            argvb = list(map(os.fsencode, sys.argv))
        except AttributeError:
            argvb = sys.argv

        self.app = QgsApplication(argvb, True)
        QgsApplication.setPrefixPath(self.prefixpath, True)
        QgsApplication.initQgis()

        locale = QLocale.system().name()
        self.translationFile = os.path.join(self.i18npath,
                                            '{0}.qm'.format(locale))
        translator = QTranslator()
        translator.load(self.translationFile, "i18n")
        self.app.installTranslator(translator)

        QApplication.setStyle("Plastique")
        QApplication.setFont(QFont('Segoe UI'))
        QApplication.setWindowIcon(QIcon(logo))
        QApplication.setApplicationName(title)

        import roam.editorwidgets.core
        if "register_widgets" not in kwargs:
            register_widgets = True
        else:
            register_widgets = False

        if register_widgets:
            roam.editorwidgets.core.registerallwidgets()
        import roam.qgisfunctions
        return self
示例#3
0
 def setUbuntuFont(self):
     """Set Ubuntu font size 10 as default."""
     QFontDatabase.addApplicationFont(":/fonts/Ubuntu-R.ttf")
     ufont = QFont("Ubuntu", 10, 1)
     QApplication.setFont(ufont)