コード例 #1
0
ファイル: render_widget.py プロジェクト: Tinkerforge/brickv
    def init_shaders(self):
        program = QOpenGLShaderProgram(self)
        if not program.addShaderFromSourceFile(QOpenGLShader.Vertex, get_resources_path("shader.vert")):
            return None

        if not program.addShaderFromSourceFile(QOpenGLShader.Fragment, get_resources_path("shader.frag")):
            return None

        if not program.link():
            return None

        if not program.bind():
            return None

        return program
コード例 #2
0
ファイル: render_widget.py プロジェクト: Tinkerforge/brickv
def load_texture(material):
    # Note that the QImage is mirrored vertically to account for the fact that OpenGL and QImage use opposite directions for the y axis.
    # (https://doc.qt.io/qt-5/qopengltexture.html#details)
    texture = QOpenGLTexture(QImage(get_resources_path(material['diffuse_map'])).mirrored())
    texture.setMinificationFilter(QOpenGLTexture.Nearest)
    texture.setMagnificationFilter(QOpenGLTexture.Nearest)
    texture.setWrapMode(QOpenGLTexture.ClampToEdge)
    return texture
コード例 #3
0
    def __init__(self, parent=None):
        super().__init__(get_resources_path(os.path.join('plugin_system', 'plugins', 'imu_v2', 'imu_v2.obj')), parent)

        self.save_orientation_flag = False
        self.has_save_orientation = False

        self.reference_orientation = QQuaternion()
        self.rotation = QQuaternion()
コード例 #4
0
ファイル: setup_dialog.py プロジェクト: Tinkerforge/brickv
 def highlight_debug_tab(self):
     """
         SIGNAL function:
         Highlight the debug tab when an error occurs.
     """
     if not self.tab_debug_warning and self.tab_widget.currentIndex() != self.tab_widget.indexOf(self.tab_debug):
         self.tab_debug_warning = True
         self.tab_set(self.tab_widget.indexOf(self.tab_debug), QColor(255, 0, 0),
                      get_resources_path("warning-icon-16.png"))
コード例 #5
0
ファイル: urlopen.py プロジェクト: fk0815/brickv
def urlopen(*args, **kwargs):
    if 'context' in kwargs:
        raise ValueError("Don't pass an SSL context to this function, as it creates a custom one.")

    cert_path = get_resources_path('CertChain.crt', warn_on_missing_file=True)
    context = ssl.create_default_context()
    context.load_verify_locations(cert_path)

    return urllib.request.urlopen(*args, **kwargs, context=context)
コード例 #6
0
 def highlight_debug_tab(self):
     """
         SIGNAL function:
         Highlight the debug tab when an error occurs.
     """
     if not self.tab_debug_warning and self.tab_widget.currentWidget().objectName() != self.tab_debug.objectName():
         self.tab_debug_warning = True
         self.tab_set(self.tab_widget.indexOf(self.tab_debug), QColor(255, 0, 0),
                      os.path.join(get_resources_path(), "warning-icon.png"))
コード例 #7
0
ファイル: setup_dialog.py プロジェクト: daniz185/brickv
 def highlight_debug_tab(self):
     """
         SIGNAL function:
         Highlight the debug tab when an error occurs.
     """
     if not self.tab_debug_warning and self.tab_widget.currentIndex() != self.tab_widget.indexOf(self.tab_debug):
         self.tab_debug_warning = True
         self.tab_set(self.tab_widget.indexOf(self.tab_debug), QColor(255, 0, 0),
                      get_resources_path("warning-icon-16.png"))
コード例 #8
0
def load_texture(material):
    # Note that the QImage is mirrored vertically to account for the fact that OpenGL and QImage use opposite directions for the y axis.
    # (https://doc.qt.io/qt-5/qopengltexture.html#details)
    texture = QOpenGLTexture(
        QImage(get_resources_path(material['diffuse_map'])).mirrored())
    texture.setMinificationFilter(QOpenGLTexture.Nearest)
    texture.setMagnificationFilter(QOpenGLTexture.Nearest)
    texture.setWrapMode(QOpenGLTexture.ClampToEdge)
    return texture
コード例 #9
0
ファイル: setup_dialog.py プロジェクト: fscherwi/brickv
 def highlight_debug_tab(self):
     """
         SIGNAL function:
         Highlight the debug tab when an error occurs.
     """
     if not self.tab_debug_warning and self.tab_widget.currentWidget().objectName() != self.tab_debug.objectName():
         self.tab_debug_warning = True
         self.tab_set(self.tab_widget.indexOf(self.tab_debug), QColor(255, 0, 0),
                      os.path.join(get_resources_path(), "warning-icon.png"))
コード例 #10
0
    def init_shaders(self):
        program = QOpenGLShaderProgram(self)

        if not program.addShaderFromSourceFile(
                QOpenGLShader.Vertex, get_resources_path("shader.vert")):
            return None

        if not program.addShaderFromSourceFile(
                QOpenGLShader.Fragment, get_resources_path("shader.frag")):
            return None

        if not program.link():
            return None

        if not program.bind():
            return None

        return program
コード例 #11
0
def load_pixmap(path, apply_mask=False):
    if image_data != None:
        data = QByteArray.fromBase64(image_data[path][1])
        pixmap = QPixmap()
        pixmap.loadFromData(data, image_data[path][0])
    else:
        absolute_path = os.path.join(get_resources_path(), path)
        pixmap = QPixmap(absolute_path)

    return pixmap
コード例 #12
0
ファイル: load_pixmap.py プロジェクト: makerpc/brickv
def load_pixmap(path, apply_mask=False):
    if image_data != None:
        data = QByteArray.fromBase64(image_data[path][1])
        pixmap = QPixmap()
        pixmap.loadFromData(data, image_data[path][0])
    else:
        absolute_path = os.path.join(get_resources_path(), path)
        pixmap = QPixmap(absolute_path)

    return pixmap
コード例 #13
0
ファイル: imu_v2_3d_widget.py プロジェクト: fk0815/brickv
    def __init__(self, parent=None):
        super().__init__(
            get_resources_path(
                os.path.join('plugin_system', 'plugins', 'imu_v2',
                             'imu_v2.obj')), parent)

        self.save_orientation_flag = False
        self.has_save_orientation = False

        self.reference_orientation = QQuaternion()
        self.rotation = QQuaternion()
コード例 #14
0
ファイル: logger_setup.py プロジェクト: Loremipsum1988/brickv
    def txt_console_highlight_tab(self):
        """
            SIGNAL function:
            Highlight the console/message tab when an error occurs.
        """
        if not self.tab_console_warning and self.tab_widget.currentWidget().objectName() != self.tab_console.objectName():
            self.tab_console_warning = True
            from brickv.utils import get_resources_path
            from PyQt4.QtGui import QColor

            self.tab_set(self.tab_widget.indexOf(self.tab_console), QColor(255, 0, 0),
                         os.path.join(get_resources_path(), "dialog-warning.png"))
コード例 #15
0
def load_marker_file(name):
    try:
        # Don't warn if the file is missing, as it is expected when run from source.
        path = get_resources_path(name, warn_on_missing_file=False)

        if path is not None:
            with open(path, 'r') as f:
                return f.read().strip()
    except FileNotFoundError:
        pass

    return None
コード例 #16
0
    def txt_console_highlight_tab(self):
        """
            SIGNAL function:
            Highlight the console/message tab when an error occurs.
        """
        if not self.tab_console_warning and self.tab_widget.currentWidget(
        ).objectName() != self.tab_console.objectName():
            self.tab_console_warning = True
            from brickv.utils import get_resources_path
            from PyQt4.QtGui import QColor

            self.tab_set(
                self.tab_widget.indexOf(self.tab_console), QColor(255, 0, 0),
                os.path.join(get_resources_path(), "dialog-warning.png"))
コード例 #17
0
ファイル: load_pixmap.py プロジェクト: fk0815/brickv
def load_pixmap(path):
    absolute_path = get_resources_path(path)
    pixmap = QPixmap(absolute_path)

    return pixmap