Exemplo n.º 1
0
def releaseInfo():
    import release

    uname = platform.uname()
    uname = list(uname)
    uname[1] = hex(hash(uname[1]))

    info = """Release: MCEdit-{0}\n{1}
Platform: {2}, Name: {3}, Version{4}, Arch: {5}
Platform:{6}, Processor: {7}, 
uname: {8}
""".format(
        release.release,
        datetime.now(),
        sys.platform,
        os.name,
        platform.version(),
        platform.architecture(),
        platform.platform(),
        platform.processor(),
        uname,
    )
    try:
        from OpenGL import GL

        info += "Version: {0}\n".format(GL.glGetString(GL.GL_VERSION))
        info += "Vendor: {0}\nRenderer: {1}\n".format(GL.glGetString(GL.GL_VENDOR), GL.glGetString(GL.GL_RENDERER))
        from albow import root

        info += "Frames: {0}\n".format(root.get_root().frames)

    finally:
        return info
Exemplo n.º 2
0
    def __init__(self, *args):
        self.rotation = 0

        EditorTool.__init__(self, *args)
        self.previewRenderer = None
        self.panel = None

        self.optionsPanel = CloneToolOptions(self)

        self.destPoint = None

        self.snapCloneKey = 0
        self.root = get_root()
Exemplo n.º 3
0
    def __init__(self, *args):
        self.rotation = 0

        EditorTool.__init__(self, *args)
        self.previewRenderer = None
        self.panel = None

        self.optionsPanel = CloneToolOptions(self)

        self.destPoint = None

        self.snapCloneKey = 0
        self.root = get_root()
Exemplo n.º 4
0
 def __init__(self, *args):
     """
     Called on starting mcedit.
     Creates some basic variables.
     """
     CloneTool.__init__(self, *args)
     self.optionsPanel = BrushToolOptions(self)
     self.recentFillBlocks = []
     self.recentReplaceBlocks = []
     self.draggedPositions = []
     self.pickBlockKey = False
     self.lineToolKey = False
     self.lastPosition = None
     self.root = get_root()
Exemplo n.º 5
0
 def __init__(self, *args):
     """
     Called on starting mcedit.
     Creates some basic variables.
     """
     CloneTool.__init__(self, *args)
     self.optionsPanel = BrushToolOptions(self)
     self.recentFillBlocks = []
     self.recentReplaceBlocks = []
     self.draggedPositions = []
     self.pickBlockKey = False
     self.lineToolKey = False
     self.lastPosition = None
     self.root = get_root()
Exemplo n.º 6
0
def releaseInfo():
    import release

    uname = platform.uname()
    uname = list(uname)
    uname[1] = hex(hash(uname[1]))

    info = """Release: MCEdit-{0}\n{1}
Platform: {2}, Name: {3}, Version{4}, Arch: {5}
Platform:{6}, Processor: {7},
uname: {8}
""".format(release.release, datetime.now(), sys.platform, os.name,
           platform.version(), platform.architecture(), platform.platform(),
           platform.processor(), uname)
    try:
        from OpenGL import GL
        info += "Version: {0}\n".format(GL.glGetString(GL.GL_VERSION))
        info += "Vendor: {0}\nRenderer: {1}\n".format(
            GL.glGetString(GL.GL_VENDOR), GL.glGetString(GL.GL_RENDERER))
        from albow import root
        info += "Frames: {0}\n".format(root.get_root().frames)

    finally:
        return info
Exemplo n.º 7
0
 def __init__(self, *args, **kw):
     EditorTool.__init__(self, *args, **kw)
     self.optionsPanel = FillToolOptions(self)
     self.pickBlockKey = 0
     self.root = get_root()
Exemplo n.º 8
0
 def __init__(self, *args, **kw):
     EditorTool.__init__(self, *args, **kw)
     self.optionsPanel = FillToolOptions(self)
     self.pickBlockKey = 0
     self.root = get_root()
Exemplo n.º 9
0
def json_crash_report():
    exc_class, exc_value, exc_tb = sys.exc_info()

    report = {}
    # We don't handle requests, so repurpose the request fields for release info.
    request = report['request'] = {}
    request['controller'] = release.release

    exception = report['exception'] = {}
    exception['backtrace'] = get_backtrace()
    exception['exception_class'] = exc_class.__name__
    if isinstance(exc_class, UnicodeError):
        exception['message'] = exc_class.__name__
    else:
        try:
            exception['message'] = sanitize(str(exc_value))
        except:
            exception['message'] = ""

    exception['occurred_at'] = datetime.now().isoformat()

    try:
        os.getcwdu().encode('ascii')
        ascii_cwd = True
    except UnicodeEncodeError:
        ascii_cwd = False

    app_env = report['application_environment'] = {}
    app_env['application_root_directory'] = "ASCII" if ascii_cwd else "Unicode"
    app_env['framework'] = 'mcedit'
    app_env['language'] = 'python'
    app_env['language_version'] = sys.version

    env = app_env['env'] = collections.OrderedDict()

    env['OS_NAME'] = os.name,
    env['OS_VERSION'] = platform.version()
    env['OS_ARCH'] = platform.architecture()
    env['OS_PLATFORM'] = platform.platform()
    env['OS_CPU'] = platform.processor()

    env['FS_ENCODING'] = sys.getfilesystemencoding()

    if 'LANG' in os.environ:
        env['LANG'] = os.environ['LANG']

    try:
        from albow import root
        env['FRAMES'] = str(root.get_root().frames)
    except:
        log.info("Can't get frame count")

    try:
        from OpenGL import GL
        env['GL_VERSION'] = GL.glGetString(GL.GL_VERSION)
    except:
        log.info("Can't get GL_VERSION")

    try:
        from OpenGL import GL
        env['GL_VENDOR'] = GL.glGetString(GL.GL_VENDOR)
    except:
        log.info("Can't get GL_VENDOR")


    try:
        from OpenGL import GL
        env['GL_RENDERER'] = GL.glGetString(GL.GL_RENDERER)
    except:
        log.info("Can't get GL_RENDERER")

    return json.dumps(report)
Exemplo n.º 10
0
def json_crash_report():
    """
    fields = arguments[1] || new Object();
        fields.api_key = this.options.APIKey;
        fields.environment = this.options.environment;
        fields.client = "javascript";
        fields.revision = this.options.revision;
        fields.class_name = error.type || error.name;
        if (!error.name && (matches = error.message.match(/^(Uncaught )?(\w+): (.+)/))) {
          fields.class_name = matches[2];
          fields.message = matches[3];
        } else {
          fields.message = error.message;
        }
        if ((_ref5 = fields.class_name) == null) {
          fields.class_name = 'Error';
        }
        fields.backtraces = buildBacktrace(error.stack);
        fields.capture_method = error.mode;
        fields.occurred_at = ISODateString(new Date());
        fields.schema = window.location.protocol.replace(/:$/, '');
        fields.host = window.location.hostname;
        if (window.location.port.length > 0) {
          fields.port = window.location.port;
        }
        fields.path = window.location.pathname;
        fields.query = window.location.search;
        if (window.location.hash !== '') {
          fields.fragment = window.location.hash;
        }
        fields.user_agent = navigator.userAgent;
        fields.screen_width = screen.width;
        fields.screen_height = screen.height;
        fields.window_width = window.innerWidth;
        fields.window_height = window.innerHeight;
        fields.color_depth = screen.colorDepth;
    :return:
    :rtype:
    """
    exc_class, exc_value, exc_tb = sys.exc_info()

    fields = {}
    fields['revision'] = release.commit
    fields['build'] = release.release

    fields['client'] = 'MCEdit Client(?)'

    fields['backtraces'] = [{
        "name":"Crashed Thread",
        "faulted": True,
        "backtrace": get_backtrace(),
    }]

    fields['class_name'] = exc_class.__name__
    if isinstance(exc_value, UnicodeError):
        fields['message'] = exc_class.__name__
    else:
        try:
            fields['message'] = sanitize(str(exc_value))
        except:
            fields['message'] = "unknown"

    fields['occurred_at'] = datetime.now().isoformat()

    try:
        os.getcwdu().encode('ascii')
        ascii_cwd = True
    except UnicodeEncodeError:
        ascii_cwd = False

    fields['environment'] = "development"
    fields['application_root_directory'] = "ASCII" if ascii_cwd else "Unicode"
    fields['language_version'] = sys.version

    fields['api_key'] = "6ea52b17-ac76-4fd8-8db4-2d7303473ca2"
    fields['OS_NAME'] = os.name
    fields['OS_VERSION'] = platform.version()
    fields['OS_ARCH'] = platform.architecture()
    fields['OS_PLATFORM'] = platform.platform()
    fields['OS_CPU'] = platform.processor()

    fields['FS_ENCODING'] = sys.getfilesystemencoding()

    if 'LANG' in os.environ:
        fields['LANG'] = os.environ['LANG']

    try:
        from albow import root
        fields['FRAMES'] = str(root.get_root().frames)
    except:
        log.info("Can't get frame count")

    try:
        from OpenGL import GL
        fields['GL_VERSION'] = GL.glGetString(GL.GL_VERSION)
    except:
        log.info("Can't get GL_VERSION")

    try:
        from OpenGL import GL
        fields['GL_VENDOR'] = GL.glGetString(GL.GL_VENDOR)
    except:
        log.info("Can't get GL_VENDOR")


    try:
        from OpenGL import GL
        fields['GL_RENDERER'] = GL.glGetString(GL.GL_RENDERER)
    except:
        log.info("Can't get GL_RENDERER")

    return json.dumps(fields)
Exemplo n.º 11
0
    def __init__old(self, blockInfo, materials, *a, **kw):
        self.root = get_root()
        self.allowWildcards = False
        Dialog.__init__(self, *a, **kw)
        panelWidth = 518

        self.click_outside_response = 0
        self.materials = materials
        self.anySubtype = blockInfo.wildcard

        self.matchingBlocks = materials.allBlocks

        try:
            self.selectedBlockIndex = self.matchingBlocks.index(blockInfo)
        except ValueError:
            self.selectedBlockIndex = 0
            for i, b in enumerate(self.matchingBlocks):
                if blockInfo.ID == b.ID and blockInfo.blockData == b.blockData:
                    self.selectedBlockIndex = i
                    break

        lbl = Label("Search")
        # lbl.rect.topleft = (0,0)

        fld = TextFieldWrapped(300)
        # fld.rect.topleft = (100, 10)
        # fld.centery = lbl.centery
        # fld.left = lbl.right

        fld.change_action = self.textEntered
        fld.enter_action = self.ok
        fld.escape_action = self.cancel

        self.awesomeField = fld

        searchRow = Row((lbl, fld))

        def formatBlockName(x):
            block = self.matchingBlocks[x]
            r = "{name}".format(name=block.name)
            if block.aka:
                r += " [{0}]".format(block.aka)

            return r

        def formatBlockID(x):
            block = self.matchingBlocks[x]
            ident = "({id}:{data})".format(id=block.ID, data=block.blockData)
            return ident

        tableview = TableView(columns=[
            TableColumn(" ", 24, "l", lambda x: ""),
            TableColumn("Name", 415, "l", formatBlockName),
            TableColumn("ID", 45, "l", formatBlockID)
        ])
        tableicons = [
            blockview.BlockView(materials)
            for i in xrange(tableview.rows.num_rows())
        ]
        for t in tableicons:
            t.size = (16, 16)
            t.margin = 0
        icons = Column(tableicons, spacing=2)

        # tableview.margin = 5
        tableview.num_rows = lambda: len(self.matchingBlocks)
        tableview.row_data = lambda x: (self.matchingBlocks[x], x, x)
        tableview.row_is_selected = lambda x: x == self.selectedBlockIndex
        tableview.click_row = self.selectTableRow
        draw_table_cell = tableview.draw_table_cell

        def draw_block_table_cell(surf, i, data, cell_rect, column):
            if isinstance(data, Block):

                tableicons[i - tableview.rows.scroll].blockInfo = data
            else:
                draw_table_cell(surf, i, data, cell_rect, column)

        tableview.draw_table_cell = draw_block_table_cell
        tableview.width = panelWidth
        tableview.anchor = "lrbt"
        # self.add(tableview)
        self.tableview = tableview
        tableWidget = Widget()
        tableWidget.add(tableview)
        tableWidget.shrink_wrap()

        def wdraw(*args):
            for t in tableicons:
                t.blockInfo = materials.Air

        tableWidget.draw = wdraw
        self.blockButton = blockView = thumbview.BlockThumbView(
            materials, self.blockInfo)

        blockView.centerx = self.centerx
        blockView.top = tableview.bottom

        # self.add(blockview)

        but = Button("OK")
        but.action = self.ok
        but.top = blockView.bottom
        but.centerx = self.centerx
        but.align = "c"
        but.height = 30

        if self.allowWildcards:
            # self.add(but)
            anyRow = CheckBoxLabel(
                "Any Subtype",
                ref=AttrRef(self, 'anySubtype'),
                tooltipText=
                "Replace blocks with any data value. Only useful for Replace operations."
            )
            col = Column((searchRow, tableWidget, anyRow, blockView, but))
        else:
            col = Column((searchRow, tableWidget, blockView, but))
        col.anchor = "wh"
        self.anchor = "wh"

        panel = GLBackground()
        panel.bg_color = [i / 255. for i in self.bg_color]
        panel.anchor = "tlbr"
        self.add(panel)

        self.add(col)
        self.add(icons)
        icons.topleft = tableWidget.topleft
        icons.top += tableWidget.margin + 30
        icons.left += tableWidget.margin + 4

        self.shrink_wrap()
        panel.size = self.size

        try:
            self.tableview.rows.scroll_to_item(self.selectedBlockIndex)
        except:
            pass
Exemplo n.º 12
0
    def __init__old(self, blockInfo, materials, *a, **kw):
        self.root = get_root()
        self.allowWildcards = False
        Dialog.__init__(self, *a, **kw)
        panelWidth = 518

        self.click_outside_response = 0
        self.materials = materials
        self.anySubtype = blockInfo.wildcard

        self.matchingBlocks = materials.allBlocks

        try:
            self.selectedBlockIndex = self.matchingBlocks.index(blockInfo)
        except ValueError:
            self.selectedBlockIndex = 0
            for i, b in enumerate(self.matchingBlocks):
                if blockInfo.ID == b.ID and blockInfo.blockData == b.blockData:
                    self.selectedBlockIndex = i
                    break

        lbl = Label("Search")
        # lbl.rect.topleft = (0,0)

        fld = TextFieldWrapped(300)
        # fld.rect.topleft = (100, 10)
        # fld.centery = lbl.centery
        # fld.left = lbl.right

        fld.change_action = self.textEntered
        fld.enter_action = self.ok
        fld.escape_action = self.cancel

        self.awesomeField = fld

        searchRow = Row((lbl, fld))

        def formatBlockName(x):
            block = self.matchingBlocks[x]
            r = "{name}".format(name=block.name)
            if block.aka:
                r += " [{0}]".format(block.aka)

            return r

        def formatBlockID(x):
            block = self.matchingBlocks[x]
            ident = "({id}:{data})".format(id=block.ID, data=block.blockData)
            return ident

        tableview = TableView(columns=[TableColumn(" ", 24, "l", lambda x: ""),
                                       TableColumn("Name", 415, "l", formatBlockName),
                                       TableColumn("ID", 45, "l", formatBlockID)
                                       ])
        tableicons = [blockview.BlockView(materials) for i in range(tableview.rows.num_rows())]
        for t in tableicons:
            t.size = (16, 16)
            t.margin = 0
        icons = Column(tableicons, spacing=2)

        # tableview.margin = 5
        tableview.num_rows = lambda: len(self.matchingBlocks)
        tableview.row_data = lambda x: (self.matchingBlocks[x], x, x)
        tableview.row_is_selected = lambda x: x == self.selectedBlockIndex
        tableview.click_row = self.selectTableRow
        draw_table_cell = tableview.draw_table_cell

        def draw_block_table_cell(surf, i, data, cell_rect, column):
            if isinstance(data, Block):

                tableicons[i - tableview.rows.scroll].blockInfo = data
            else:
                draw_table_cell(surf, i, data, cell_rect, column)

        tableview.draw_table_cell = draw_block_table_cell
        tableview.width = panelWidth
        tableview.anchor = "lrbt"
        # self.add(tableview)
        self.tableview = tableview
        tableWidget = Widget()
        tableWidget.add(tableview)
        tableWidget.shrink_wrap()

        def wdraw(*args):
            for t in tableicons:
                t.blockInfo = materials.Air

        tableWidget.draw = wdraw
        self.blockButton = blockView = thumbview.BlockThumbView(materials, self.blockInfo)

        blockView.centerx = self.centerx
        blockView.top = tableview.bottom

        # self.add(blockview)

        but = Button("OK")
        but.action = self.ok
        but.top = blockView.bottom
        but.centerx = self.centerx
        but.align = "c"
        but.height = 30

        if self.allowWildcards:
            # self.add(but)
            anyRow = CheckBoxLabel("Any Subtype", ref=AttrRef(self, 'anySubtype'),
                                   tooltipText="Replace blocks with any data value. Only useful for Replace operations.")
            col = Column((searchRow, tableWidget, anyRow, blockView, but))
        else:
            col = Column((searchRow, tableWidget, blockView, but))
        col.anchor = "wh"
        self.anchor = "wh"

        panel = GLBackground()
        panel.bg_color = [i / 255. for i in self.bg_color]
        panel.anchor = "tlbr"
        self.add(panel)

        self.add(col)
        self.add(icons)
        icons.topleft = tableWidget.topleft
        icons.top += tableWidget.margin + 30
        icons.left += tableWidget.margin + 4

        self.shrink_wrap()
        panel.size = self.size

        try:
            self.tableview.rows.scroll_to_item(self.selectedBlockIndex)
        except:
            pass
Exemplo n.º 13
0
def json_crash_report():
    exc_class, exc_value, exc_tb = sys.exc_info()

    report = {}
    # We don't handle requests, so repurpose the request fields for release info.
    request = report['request'] = {}
    request['controller'] = release.release

    exception = report['exception'] = {}
    exception['backtrace'] = get_backtrace()
    exception['exception_class'] = exc_class.__name__
    try:
        exception['message'] = sanitize(str(exc_value))
    except:
        exception['message'] = ""

    exception['occurred_at'] = datetime.now().isoformat()

    try:
        os.getcwdu().encode('ascii')
        ascii_cwd = True
    except UnicodeEncodeError:
        ascii_cwd = False

    app_env = report['application_environment'] = {}
    app_env['application_root_directory'] = "ASCII" if ascii_cwd else "Unicode"
    app_env['framework'] = 'mcedit'
    app_env['language'] = 'python'
    app_env['language_version'] = sys.version

    env = app_env['env'] = {}

    env['OS_NAME'] = os.name,
    env['OS_VERSION'] = platform.version()
    env['OS_ARCH'] = platform.architecture()
    env['OS_PLATFORM'] = platform.platform()
    env['OS_CPU'] = platform.processor()

    try:
        from albow import root
        env['FRAMES'] = str(root.get_root().frames)
    except:
        log.info("Can't get frame count")

    try:
        from OpenGL import GL
        env['GL_VERSION'] = GL.glGetString(GL.GL_VERSION)
    except:
        log.info("Can't get GL_VERSION")

    try:
        from OpenGL import GL
        env['GL_VENDOR'] = GL.glGetString(GL.GL_VENDOR)
    except:
        log.info("Can't get GL_VENDOR")

    try:
        from OpenGL import GL
        env['GL_RENDERER'] = GL.glGetString(GL.GL_RENDERER)
    except:
        log.info("Can't get GL_RENDERER")

    return json.dumps(report)