skylarkdrones / pyqtlet

pyqtlet brings Leaflet maps to PyQt5.
Other
30 stars 8 forks source link

ubuntu has error when I add MapWidget. #21

Closed craigstar closed 5 years ago

craigstar commented 5 years ago

Environment is Ubuntu 14.04。It works well in MacOs.

My Code:

super().__init__()
self.mapWidget = MapWidget()
self.layout = QVBoxLayout()
self.layout.addWidget(self.mapWidget)
self.setLayout(self.layout)

Error:

QOpenGLShaderProgram: could not create shader program QOpenGLShader: could not create shader Could not link shader program: "" QOpenGLShaderProgram: could not create shader program QOpenGLShader: could not create shader QOpenGLShader: could not create shader shader compilation failed: "" QOpenGLShaderProgram::uniformLocation(matrix): shader program is not linked QOpenGLShaderProgram::uniformLocation(opacity): shader program is not linked

samhattangady commented 5 years ago

Hey, Thanks for reporting this. Can you add a copy of the full python program? Also share the version of PyQt that you are using.

I have not seen any OpenGL problems before though, so am not even sure where to start.

craigstar commented 5 years ago

This is my simple program, And I found the problem also occurs even when I replace MapWidget() with QWebEngineView(self). So this is a Qt problem I guess. Environment is Ubuntu 14.04.

import sys
from PyQt5.QtWidgets import QApplication, QVBoxLayout, QWidget
from PyQt5.QtCore import Qt
from pyqtlet import L, MapWidget

class MapWindow(QWidget):
    def __init__(self):
        # Setting up the widgets and layout
        super().__init__()
        self.mapWidget = MapWidget()
        self.layout = QVBoxLayout()
        self.layout.addWidget(self.mapWidget)
        self.setLayout(self.layout)
        self.show()

if __name__ == '__main__':
    app = QApplication(sys.argv)
    widget = MapWindow()
    sys.exit(app.exec_())

my GL related packages are:

pyopengl                  3.1.0                    pypi_0    pypi
pyopengl-accelerate       3.1.0                    pypi_0    pypi
pyqt                      5.9.2            py36h05f1152_2  
pyqtgraph                 0.10.0           py36h28b3542_3 
python                    3.6.8                h0371630_0  
craigstar commented 5 years ago

I found a solution. https://forum.qt.io/topic/81328/ubuntu-qopenglshaderprogram-shader-program-is-not-linked/2

This is not pyqtlet problem, It's qt's fault. By adding

import sys
if sys.platform.startswith( 'linux' ) :
    from OpenGL import GL

at the beginning of the app, the problem solved.

samhattangady commented 5 years ago

Alright great! Let me know how you're planning to use pyqtlet.

crayxt commented 5 years ago

@samhattangady seems like you should add pyopengl into requirements then

craigstar commented 5 years ago

@samhattangady I'm developing a GUI tool to project my trajectories onto a satellite map.

samhattangady commented 5 years ago

@crayxt, pyopengl is not a requirement to run any pyqtlet apps. If it is required, then it is a requirement in PyQt5.

Great thanks. I'll go ahead and close this issue.