def fillexpressiontype(self, res, idx):
     if not res:
         return
     value, w, error = res
     if error:
         value = error
     self.SetStringItem(idx, ExpressionsList.COL_TYPE, PyStudioUtils.get_unicodevalue(value))        
 def fillexpressionvalue(self, res, idx):
     if not res:
         return
     value, w, error = res
     if error:
         value = error
     self.SetStringItem(idx, ExpressionsList.COL_VALUE, PyStudioUtils.get_unicodevalue(value))        
     self.SetColumnWidth(ExpressionsList.COL_VALUE, wx.LIST_AUTOSIZE)
 def fillexpressiontype(self, res, idx):
     if not res:
         return
     value, w, error = res
     if error:
         value = error
     self.SetStringItem(idx, ExpressionsList.COL_TYPE,
                        PyStudioUtils.get_unicodevalue(value))
    def expand_item(self, item, variables, froot=False, fskip_expansion_check=False):
        if not self.ItemHasChildren(item):
            return

        if not froot and not fskip_expansion_check and self.IsExpanded(item):
            return

        if self.get_numberofchildren(item) > 0:
            return

        (expr, is_valid) = self.GetPyData(item)

        variables_with_expr = []
        for expression in variables:
            if hasattr(expression, "get") and expression.get("expr", None) == expr:
                variables_with_expr.append(expression)
        if variables_with_expr == []:
            return

        first_variable_with_expr = variables_with_expr[0]
        if first_variable_with_expr is None:
            return

        if "error" in first_variable_with_expr:
            return

        if first_variable_with_expr["n_subnodes"] == 0:
            self.SetItemHasChildren(item, False)
            return

        #
        # Create a list of the subitems.
        # The list is indexed by name or directory key.
        # In case of a list, no sorting is needed.
        #
        for subnode in first_variable_with_expr["subnodes"]:
            _name = unicode(subnode["name"])
            if not re.match(self.FilterExpr, _name):
                continue
            _type = unicode(subnode["type"])
            _value = PyStudioUtils.get_unicodevalue(subnode["repr"])

            child = self.AppendItem(item, _name)
            self.SetItemText(child, u' ' + _value, VariablesList.COL_VALUE)
            self.SetItemText(child, u' ' + _type, VariablesList.COL_TYPE)
            self.SetItemPyData(child, (subnode["expr"], subnode["fvalid"]))
            self.SetItemHasChildren(child, (subnode["n_subnodes"] > 0))
            # Add some bitmaps depending on the object type
            if subnode["type"] in ('type', 'module'):
                self.SetItemImage(child, self._imgmap[VariablesList.IMG_CLASS])
            elif subnode["type"] in ('function', 'builtin_function_or_method',
                                     'instancemethod'):
                self.SetItemImage(child, self._imgmap[VariablesList.IMG_FUNCT])
            else:
                self.SetItemImage(child, self._imgmap[VariablesList.IMG_VAR])

        self.Expand(item)
 def fillexpressionvalue(self, res, idx):
     if not res:
         return
     value, w, error = res
     if error:
         value = error
     self.SetStringItem(idx, ExpressionsList.COL_VALUE,
                        PyStudioUtils.get_unicodevalue(value))
     self.SetColumnWidth(ExpressionsList.COL_VALUE, wx.LIST_AUTOSIZE)
Beispiel #6
0
    def _issysexit(self, variables):
        if not variables:
            wx.CallAfter(self._unhandledexception)
            return
        variables_with_expr = []
        for expression in variables:
            if hasattr(expression, "get"):
                variables_with_expr.append(expression)
        if variables_with_expr == []:
            wx.CallAfter(self._unhandledexception)
            return

        first_variable_with_expr = variables_with_expr[0]
        if first_variable_with_expr is None:
            wx.CallAfter(self._unhandledexception)
            return

        if "error" in first_variable_with_expr:
            wx.CallAfter(self._unhandledexception)
            return

        if first_variable_with_expr["n_subnodes"] == 0:
            wx.CallAfter(self._unhandledexception)
            return

        #
        # Create a list of the subitems.
        # The list is indexed by name or directory key.
        # In case of a list, no sorting is needed.
        #
        for subnode in first_variable_with_expr["subnodes"]:
            _name = unicode(subnode["name"])
            _type = unicode(subnode["type"])
            _value = PyStudioUtils.get_unicodevalue(subnode["repr"])
            if _name == u"type" and _value.find(u"SystemExit") != -1:
                RpdbDebugger().unhandledexception = False
                RpdbDebugger().do_go()
                return

        wx.CallAfter(self._unhandledexception)
    def expand_item(self,
                    item,
                    variables,
                    froot=False,
                    fskip_expansion_check=False):
        if not self.ItemHasChildren(item):
            return

        if not froot and not fskip_expansion_check and self.IsExpanded(item):
            return

        if self.get_numberofchildren(item) > 0:
            return

        (expr, is_valid) = self.GetPyData(item)

        variables_with_expr = []
        for expression in variables:
            if hasattr(expression, "get") and expression.get("expr",
                                                             None) == expr:
                variables_with_expr.append(expression)
        if variables_with_expr == []:
            return

        first_variable_with_expr = variables_with_expr[0]
        if first_variable_with_expr is None:
            return

        if "error" in first_variable_with_expr:
            return

        if first_variable_with_expr["n_subnodes"] == 0:
            self.SetItemHasChildren(item, False)
            return

        #
        # Create a list of the subitems.
        # The list is indexed by name or directory key.
        # In case of a list, no sorting is needed.
        #
        for subnode in first_variable_with_expr["subnodes"]:
            _name = unicode(subnode["name"])
            if not re.match(self.FilterExpr, _name):
                continue
            _type = unicode(subnode["type"])
            _value = PyStudioUtils.get_unicodevalue(subnode["repr"])

            child = self.AppendItem(item, _name)
            self.SetItemText(child, u' ' + _value, VariablesList.COL_VALUE)
            self.SetItemText(child, u' ' + _type, VariablesList.COL_TYPE)
            self.SetItemPyData(child, (subnode["expr"], subnode["fvalid"]))
            self.SetItemHasChildren(child, (subnode["n_subnodes"] > 0))
            # Add some bitmaps depending on the object type
            if subnode["type"] in ('type', 'module'):
                self.SetItemImage(child, self._imgmap[VariablesList.IMG_CLASS])
            elif subnode["type"] in ('function', 'builtin_function_or_method',
                                     'instancemethod'):
                self.SetItemImage(child, self._imgmap[VariablesList.IMG_FUNCT])
            else:
                self.SetItemImage(child, self._imgmap[VariablesList.IMG_VAR])

        self.Expand(item)