예제 #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
 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;
    }
    """)