Esempio n. 1
0
    def __init__(self, text, exc_info, fatal, report):
        super(ErrorDialog, self).__init__()
        self.setupUi(self)
        self.setModal(True)
        self.exc_info = exc_info
        self.shouldReport = report

        exc_type, exc_value, exc_tb = exc_info

        self.errorDescriptionLabel.setText(text)
        tbText = "".join(traceback.format_exception(exc_type, exc_value, exc_tb))

        contextInfo = qglcontext.getContextInfo() or ""

        from mcedit2 import __version__
        tbText = "MCEdit version: %s\n" \
                 "Python version: %s\n" \
                 "Platform: %s\n" \
                 "System version: %s\n" \
                 "Processor: %s\n" \
                 "\n" \
                 "%s\n" \
                 "------\n\n" \
                 "%s\n\n" \
                 "%s" % (__version__, sys.version, sys.platform,
                         platform.platform(), platform.processor(),
                         contextInfo, text, tbText)
        self.errorText = tbText

        self.tracebackView.setText(tbText)

        self.restartMCEditLabel.setVisible(fatal)

        self.restartMCEditButton.setVisible(fatal)
        self.restartMCEditButton.clicked.connect(self.restartMCEdit)

        self.quitMCEditButton.setVisible(fatal)
        self.quitMCEditButton.clicked.connect(self.quitMCEdit)

        self.continueButton.clicked.connect(self.continueMCEdit)

        self.debugButton.setEnabled(isSrcCheckout())
        self.debugButton.clicked.connect(self.debugPdb)

        self.reportingLabelStack.setVisible(self.shouldReport)
        self.reportErrorCheckbox.setVisible(self.shouldReport)
        self.reportErrorCheckbox.toggled.connect(self.reportErrorToggled)
        self.reportErrorCheckbox.setChecked(ReportErrorSetting.value() and self.shouldReport)

        try:
            import Pastebin
        except ImportError:
            self.copyToPastebinButton.setVisible(False)
            self.pastebinURLBox.setVisible(False)
        else:
            self.copyToPastebinButton.setVisible(True)
            self.pastebinURLBox.setVisible(True)

            self.copyToPastebinButton.clicked.connect(self.copyToPastebin)
Esempio n. 2
0
def compile_ui():
    from mcedit2.util import resources
    if not resources.isSrcCheckout():
        return

    src = resources.getSrcFolder()
    uiDir = os.path.join(src, "mcedit2", "ui")

    from pysideuic import compileUiDir

    compileUiDir(uiDir, recurse=True)
Esempio n. 3
0
def compile_ui():
    from mcedit2.util import resources
    if not resources.isSrcCheckout():
        return

    src = resources.getSrcFolder()
    uiDir = os.path.join(src, "mcedit2", "ui")

    from pysideuic import compileUiDir

    log.info("Compiling .ui files...")
    compileUiDir(uiDir, recurse=True)
    log.info("Done.")
Esempio n. 4
0
    def __init__(self, text, exc_info, fatal):
        super(ErrorDialog, self).__init__()
        self.setupUi(self)
        self.setModal(True)
        self.exc_info = exc_info

        exc_type, exc_value, exc_tb = exc_info

        self.errorDescriptionLabel.setText(text)
        tbText = "".join(
            traceback.format_exception(exc_type, exc_value, exc_tb))

        contextInfo = qglcontext.getContextInfo() or ""

        from mcedit2 import __version__
        tbText = "MCEdit version: %s\n" \
                 "Python version: %s\n" \
                 "Platform: %s\n" \
                 "System version: %s\n" \
                 "Processor: %s\n" \
                 "\n" \
                 "%s\n" \
                 "------\n\n" \
                 "%s\n\n" \
                 "%s" % (__version__, sys.version, sys.platform,
                         platform.platform(), platform.processor(),
                         contextInfo, text, tbText)
        self.errorText = tbText

        self.tracebackView.setText(tbText)

        self.restartMCEditLabel.setVisible(fatal)

        self.restartMCEditButton.setVisible(fatal)
        self.restartMCEditButton.clicked.connect(self.restartMCEdit)

        self.quitMCEditButton.setVisible(fatal)
        self.quitMCEditButton.clicked.connect(self.quitMCEdit)

        self.debugButton.setEnabled(isSrcCheckout())
        self.debugButton.clicked.connect(self.debugPdb)

        try:
            import Pastebin
        except ImportError:
            self.copyToPastebinButton.setVisible(False)
        else:
            self.copyToPastebinButton.setVisible(True)
            self.copyToPastebinButton.clicked.connect(self.copyToPastebin)

        self.pastebinURLBox.setVisible(False)
Esempio n. 5
0
def getUserFilesDirectory():
    # On Linux, the FS encoding is given by the current locale
    # Linux filenames are defined to be bytestrings.

    # We handle filenames internally as 'unicode', so decode 'sys.argv[0]'
    # If a linux filename cannot be decoded with the current locale, ignore it.
    # If this filename is the script filename, you lose.

    if resources.isSrcCheckout():
        # Source checkouts don't use the same folder as regular installs.
        dataDir = os.path.join(os.path.dirname(resources.getSrcFolder()), "MCEdit 2 Files")
    else:
        dataDir = os.path.expanduser(u"~/.mcedit2")

    if not os.path.exists(dataDir):
        os.makedirs(dataDir)

    return dataDir
Esempio n. 6
0
def getUserFilesDirectory():
    # On Linux, the FS encoding is given by the current locale
    # Linux filenames are defined to be bytestrings.

    # We handle filenames internally as 'unicode', so decode 'sys.argv[0]'
    # If a linux filename cannot be decoded with the current locale, ignore it.
    # If this filename is the script filename, you lose.

    if resources.isSrcCheckout():
        # Source checkouts don't use the same folder as regular installs.
        dataDir = os.path.join(os.path.dirname(resources.getSrcFolder()),
                               "MCEdit 2 Files")
    else:
        dataDir = os.path.expanduser(u"~/.mcedit2")

    if not os.path.exists(dataDir):
        os.makedirs(dataDir)

    return dataDir
Esempio n. 7
0
def getUserFilesDirectory():

    # TODO if sys.getattr('frozen', False):
    # TODO os.getenv('RESOURCEPATH') or sys.getattr('_MEIPASS'), etc etc...

    # On OS X, the FS encoding is always UTF-8
    # OS X filenames are defined to be UTF-8 encoded.
    # We internally handle filenames as unicode.

    if resources.isSrcCheckout():
        # Source checkouts don't use the same folder as regular installs.
        dataDir = os.path.join(os.path.dirname(resources.getSrcFolder()), "MCEdit User Data")
    else:
        dataDir = os.path.expanduser(u"~/Documents/MCEdit 2 Files")

    if not os.path.exists(dataDir):
        os.makedirs(dataDir)

    return dataDir
Esempio n. 8
0
def getUserFilesDirectory():

    # TODO if sys.getattr('frozen', False):
    # TODO os.getenv('RESOURCEPATH') or sys.getattr('_MEIPASS'), etc etc...

    # On OS X, the FS encoding is always UTF-8
    # OS X filenames are defined to be UTF-8 encoded.
    # We internally handle filenames as unicode.

    if resources.isSrcCheckout():
        # Source checkouts don't use the same folder as regular installs.
        dataDir = os.path.join(os.path.dirname(resources.getSrcFolder()),
                               "MCEdit 2 Files")
    else:
        dataDir = os.path.expanduser(u"~/Documents/MCEdit 2 Files")

    if not os.path.exists(dataDir):
        os.makedirs(dataDir)

    return dataDir