コード例 #1
0
    def show_update_info(info: dict):
        print(info)

        html_url = info.get('html_url', '')
        content = [
            f'New v{info.get("version")} (Now v{VERSION})',
            info.get('name', ''),
            html_url,
        ]
        title = 'Update available, download now?'

        msg = QMessageBox()
        msg.setIcon(QMessageBox.Information)

        msg.setText(title)
        msg.setInformativeText('\n\n'.join(content))
        msg.setWindowTitle(title)
        msg.setDetailedText(info.get('desc', ''))
        msg.setStandardButtons(QMessageBox.Yes | QMessageBox.No)

        btn_ret = msg.exec_()

        if btn_ret == QMessageBox.Yes:
            print('Yes clicked.')
            open_url(html_url)
        elif btn_ret == QMessageBox.Ok:
            print('Ok clicked.')
        elif btn_ret == QMessageBox.No:
            print('No clicked.')
        elif btn_ret == QMessageBox.Cancel:
            print('Cancel')
コード例 #2
0
ファイル: utils.py プロジェクト: Lucas-Me/GePlu
def save_file(master, file, delimiter=';'):
    pathname = master.folder.text()
    extension = pathname[pathname.index('.'):]

    try:
        if extension == ".xlsx":
            with pd.ExcelWriter(pathname) as writer:
                file.to_excel(writer,
                              "Dados Brutos",
                              engine='openpyxl',
                              na_rep="NaN",
                              float_format="%.2f")

        else:
            decimal = ',' if master.separador == '.' else '.'
            with open(pathname, 'wb') as writer:
                file.to_csv(writer,
                            sep=master.separador,
                            na_rep="NaN",
                            float_format="%.2f",
                            decimal=decimal)

    except PermissionError as Err:
        x = QMessageBox(QMessageBox.Critical,
                        "Erro de Acesso",
                        "Não foi possível salvar seu arquivo.",
                        buttons=QMessageBox.Ok,
                        parent=master)
        x.setInformativeText(
            "O arquivo que voce está tentando sobrescrever já está aberto em outro programa."
        )
        x.setDetailedText(str(Err))
        x.exec()
        raise PermissionError
コード例 #3
0
    def showCritcalErrorDialog(self: Any,
                               error: str = '',
                               details: str = '') -> QMessageBox:
        import traceback
        messagebox = QMessageBox(self)
        messagebox.setWindowTitle(
            'Critical Error' if self else getTitleString('Critical Error'))
        messagebox.setText(f'''
            <p><strong>\
                Something unexpected happened. {'Detailed error message:' if error else ''}\
            </strong></p>
            {f'<p><code>{error}</code></p>' if error else ''}
            <p><small>
                Please check if this is a known issue or create a report \
                detailing the conditions of this error here:<br>
                <a href="{w3modmanager.URL_ISSUES}" style="text-decoration:none;">
                    {removeUrlScheme(w3modmanager.URL_ISSUES)}
                </a>
            </small></p>
            ''')
        if error:
            messagebox.setDetailedText(
                details if details else traceback.format_exc())
        messagebox.setIconPixmap(messagebox.windowIcon().pixmap(
            messagebox.windowIcon().actualSize(QSize(64, 64))))
        messagebox.layout().setContentsMargins(5, 5, 5, 5)

        messagebox.setModal(True)
        messagebox.open()
        return messagebox
コード例 #4
0
def detailedErrorMessage(parent: Optional[QWidget], message: str, detailedInformation: str) -> None:
    message_box = QMessageBox(QMessageBox.Critical,
                              QApplication.applicationName(),
                              message,
                              QMessageBox.Ok,
                              parent)
    message_box.setDetailedText(detailedInformation)
    message_box.exec()
コード例 #5
0
ファイル: window.py プロジェクト: Baloby/baloviewer-pyside6
 def message_box_error(self, title, text, error=None):
     message = QMessageBox(self, title, text)
     message.setIcon(QMessageBox.Warning)
     message.setWindowTitle(title)
     message.setText(text)
     if error is not None:
         message.setDetailedText(str(error))
     message.exec_()
コード例 #6
0
def error_msg(error_message):
    message = QMessageBox()
    message.setText(
        "There was a problem processing your file. Please click more details for more information."
    )
    message.setInformativeText(error_message)
    message.setWindowTitle("Error processing file")
    message.setDetailedText(error_message)
    message.setStandardButtons(QMessageBox.Ok)
    QApplication.setOverrideCursor(QCursor(Qt.ArrowCursor))
    message.exec_()
コード例 #7
0
ファイル: utils.py プロジェクト: Lucas-Me/GePlu
def read_file(master, nrows=None, header=None):
    extension = master.fileformat
    pathname = master.path.text()

    try:
        if extension == ".xlsx":
            data_df = pd.read_excel(pathname,
                                    header=header,
                                    engine="openpyxl",
                                    nrows=nrows,
                                    dtype='str')

        #elif self.filefomart == ".ods":
        #data_df = utils.open_odf(self, 14).to_numpy()
        else:
            data_df = pd.read_csv(pathname,
                                  sep=master.separador,
                                  nrows=nrows,
                                  dtype='str',
                                  header=header,
                                  keep_default_na=False)

    except PermissionError as Err:
        x = QMessageBox(QMessageBox.Critical,
                        "Erro de Acesso",
                        "Não foi possível salvar seu arquivo.",
                        buttons=QMessageBox.Ok,
                        parent=master)
        x.setInformativeText(
            "O arquivo que voce está tentando sobrescrever já está aberto em outro programa."
        )
        x.setDetailedText(str(Err))
        x.exec()
        raise PermissionError

    except pd.errors.ParserError as Err:
        x = QMessageBox(
            QMessageBox.Critical,
            "Erro de Acesso",
            "Não foi possível ler o arquivo com o delimitador especificado.",
            buttons=QMessageBox.Ok,
            parent=master)
        x.setInformativeText(
            "Por favor, tente utilizar um outro tipo de delimitador para os seus dados."
        )
        x.setDetailedText(str(Err))
        x.exec()
        raise pd.errors.ParserError

    return data_df
コード例 #8
0
def open_url(url: str):
    try:
        # QDesktopServices.openUrl(QUrl(url))
        pass
    except Exception as e:
        msg = QMessageBox()
        msg.setIcon(QMessageBox.Critical)

        title = 'Network error: No connection'
        msg.setText(title)
        msg.setInformativeText('Please check your network connection.')
        msg.setWindowTitle(title)
        msg.setDetailedText(e)
        msg.setStandardButtons(QMessageBox.Yes | QMessageBox.No)

        msg.exec_()
コード例 #9
0
from PySide6.QtCore import QCoreApplication, QLibraryInfo, QSize, QTimer, Qt
from PySide6.QtGui import (QMatrix4x4, QOpenGLContext, QSurfaceFormat, QWindow)
from PySide6.QtOpenGL import (QOpenGLBuffer, QOpenGLShader,
                              QOpenGLShaderProgram, QOpenGLVertexArrayObject)
from PySide6.QtWidgets import (QApplication, QHBoxLayout, QMessageBox,
                               QPlainTextEdit, QWidget)
from PySide6.support import VoidPtr
try:
    from OpenGL import GL
except ImportError:
    app = QApplication(sys.argv)
    messageBox = QMessageBox(
        QMessageBox.Critical, "ContextInfo",
        "PyOpenGL must be installed to run this example.", QMessageBox.Close)
    messageBox.setDetailedText(
        "Run:\npip install PyOpenGL PyOpenGL_accelerate")
    messageBox.exec_()
    sys.exit(1)

vertexShaderSource110 = dedent("""
    // version 110
    attribute highp vec4 posAttr;
    attribute lowp vec4 colAttr;
    varying lowp vec4 col;
    uniform highp mat4 matrix;
    void main() {
       col = colAttr;
       gl_Position = matrix * posAttr;
    }
    """)