def initGui(self):
        # Create Graphical User Interface
        icon = QIcon()
        icon.addPixmap(QPixmap(os.path.dirname(__file__) + "/icon.png"),
                       QIcon.Normal, QIcon.Off)
        self.setWindowIcon(icon)
        self.setWindowModality(Qt.WindowModal)
        self.setWindowFlags(Qt.Window
                            | Qt.WindowSystemMenuHint
                            | Qt.WindowMinimizeButtonHint
                            | Qt.WindowMaximizeButtonHint
                            | Qt.WindowCloseButtonHint)

        self.resize(520, 520)

        self.label = QLabel(self)
        self.label.setGeometry(QRect(10, 20, 500, 20))
        font = QFont()
        font.setPointSize(14)
        font.setUnderline(True)
        self.label.setFont(font)
        self.label.setAlignment(Qt.AlignCenter)
        self.label_2 = QLabel(self)
        self.label_2.setGeometry(QRect(10, 70, 500, 16))
        self.label_3 = QLabel(self)
        self.label_3.setGeometry(QRect(10, 90, 500, 16))
        self.label_4 = QLabel(self)
        self.label_4.setGeometry(QRect(10, 110, 500, 16))
        self.pushButton = QPushButton(self)
        self.pushButton.setGeometry(QRect(50, 150, 121, 24))
        self.comboBox = QComboBox(self)
        self.comboBox.setGeometry(QRect(240, 150, 121, 24))
        self.comboBox.addItem("Paso Malla 25m")
        self.comboBox.addItem("Paso Malla 200m")
        self.comboBox.addItem("Paso Malla 500m")
        self.comboBox.addItem("Paso Malla 1.000m")
        self.bt_view_map = QPushButton(self)
        self.bt_view_map.setGeometry(QRect(370, 150, 121, 24))
        self.profile_jpg = QLabel(self)
        self.profile_jpg.setGeometry(QRect(20, 200, 480, 180))

        self.message_box = QTextEdit(self)
        self.message_box.setGeometry(QRect(10, 400, 500, 111))
        self.label.setText("KML / GPX TO 3D")
        self.label_2.setText(
            "Convert a GPX file without elevation, in a GPX and KML with elevation. It's only for Spain."
        )
        self.label_3.setText(
            "Convierte un GPX sin elevación, en un GPX y KML con elevación.")
        self.label_4.setText(
            "Es solo para España ya que utiliza el servicio WCS del Instituto Geografico Nacional"
        )
        self.pushButton.setText("File / Fichero")
        self.bt_view_map.setText("Map / Mapa")

        self.pushButton.clicked.connect(self.select_file)
        self.bt_view_map.clicked.connect(
            lambda: see_map(self.Output_KML_File).exec_())
Beispiel #2
0
    def std_font_to_qfont(font):  # pylint: disable=too-many-branches
        """
        Converts STD font to QFont
        """
        name = font.font_name

        style_name = None

        # we need to sometimes strip 'Italic' or 'Bold' suffixes from the font name stored in the ESRI object
        # in order to match against actual font families
        keep_scanning = True
        while name not in QFontDatabase().families() and keep_scanning:
            keep_scanning = False
            if name.lower().endswith(' italic'):
                name = name[:-len(' italic')]
                keep_scanning = True
            elif name.lower().endswith(' bold'):
                name = name[:-len(' bold')]
                keep_scanning = True
            elif name.lower().endswith(' black'):
                name = name[:-len(' black')]
                style_name = 'Black'

        res = QFont(name)
        res.setWeight(font.weight)
        if font.weight > 400:
            res.setBold(True)

        if font.italic:
            res.setItalic(True)

        # pretty annoying, but because qgis relies on style strings, we need to convert the raw bools to style names if possible...
        if res.italic() and not res.bold():
            styles = QFontDatabase().styles(res.family())
            for s in styles:
                if s.lower() in ['oblique', 'italic']:
                    res.setStyleName(s)
                    break
        elif res.italic() and res.bold():
            styles = QFontDatabase().styles(res.family())
            for s in styles:
                if ('oblique' in s.lower()
                        or 'italic' in s.lower()) and 'bold' in s.lower():
                    res.setStyleName(s)
                    break
        elif res.bold():
            styles = QFontDatabase().styles(res.family())
            for s in styles:
                if s.lower() == 'bold':
                    res.setStyleName(s)
                    break

        if style_name is not None and style_name in QFontDatabase().styles(
                res.family()):
            res.setStyleName(style_name)

        if font.underline:
            res.setUnderline(True)
        if font.strikethrough:
            res.setStrikeOut(True)

        res.setPointSizeF(font.size)
        return res