当前位置: 首页>>代码示例>>Python>>正文


Python api.raise_to_debug函数代码示例

本文整理汇总了Python中traitsui.api.raise_to_debug函数的典型用法代码示例。如果您正苦于以下问题:Python raise_to_debug函数的具体用法?Python raise_to_debug怎么用?Python raise_to_debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了raise_to_debug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: update_object

    def update_object(self, event):
        """ Handles the user selecting a new value from the combo box.
        """
        self._no_enum_update += 1
        try:
            new_value = self.mapping[event.GetString()]
            if new_value == self.value and self.factory.is_grid_cell:
                # If the enum editor is in a grid cell and the value did not
                # change, we want the enum editor to go away, reverting back to
                # the normal cell appearance. This is for 2 reasons:
                #  1. it looks nicer
                #  2. if the grid id suddenly closed, wx freaks & causes a
                #     segfault

                grid = self.control.Parent.Parent
                grid.EnableEditing(False)
                grid.EnableEditing(True)

            self.value = new_value

        except:
            from traitsui.api import raise_to_debug

            raise_to_debug()

        self._no_enum_update -= 1
开发者ID:gdsylzj,项目名称:traitsui,代码行数:26,代码来源:enum_editor.py

示例2: _perform

    def _perform(self, action):
        method_name = action.action
        info = self._menu_context['info']
        handler = self._menu_context['handler']
        object = self._menu_context['object']
        selection = self._menu_context['selection']
        self._menu_context['action'] = action

        if method_name.find('.') >= 0:
            if method_name.find('(') < 0:
                method_name += '()'
            try:
                eval(method_name, globals(), self._menu_context)
            except:
                from traitsui.api import raise_to_debug
                raise_to_debug()
            return

        method = getattr(handler, method_name, None)
        if method is not None:
            method(info, selection)
            return

        if action.on_perform is not None:
            action.on_perform(selection)

        action.perform(selection)
开发者ID:jonathanrocher,项目名称:traitsui,代码行数:27,代码来源:editor.py

示例3: can_add_to_menu

    def can_add_to_menu(self, action):
        """ Returns whether the action should be defined in the user interface.
        """
        if action.defined_when != '':

            try:
                if not eval(
                        action.defined_when,
                        globals(),
                        self._menu_context):
                    return False
            except:
                from traitsui.api import raise_to_debug
                raise_to_debug()

        if action.visible_when != '':
            try:
                if not eval(
                        action.visible_when,
                        globals(),
                        self._menu_context):
                    return False
            except:
                from traitsui.api import raise_to_debug
                raise_to_debug()

        return True
开发者ID:jonathanrocher,项目名称:traitsui,代码行数:27,代码来源:editor.py

示例4: redo

 def redo(self):
     """ Re-does the change.
     """
     try:
         setattr(self.object, self.name, self.new_value)
     except Exception:
         from traitsui.api import raise_to_debug
         raise_to_debug()
开发者ID:bergtholdt,项目名称:traitsui,代码行数:8,代码来源:undo.py

示例5: get_raw_value

 def get_raw_value(self, object):
     """ Gets the unformatted value of the column for a specified object.
     """
     try:
         return xgetattr(self.get_object(object), self.name)
     except Exception as e:
         from traitsui.api import raise_to_debug
         raise_to_debug()
         return None
开发者ID:bergtholdt,项目名称:traitsui,代码行数:9,代码来源:table_column.py

示例6: update_object_on_scroll

 def update_object_on_scroll(self, pos):
     """ Handles the user changing the current slider value.
     """
     value = self._convert_from_slider(pos)
     self.control.text.setText(self.format % value)
     try:
         self.value = value
     except Exception as exc:
         from traitsui.api import raise_to_debug
         raise_to_debug()
开发者ID:bergtholdt,项目名称:traitsui,代码行数:10,代码来源:range_editor.py

示例7: update_object

 def update_object(self, text):
     """ Handles the user selecting a new value from the combo box.
     """
     if self._no_enum_update == 0:
         self._no_enum_update += 1
         try:
             self.value = self.mapping[six.text_type(text)]
         except Exception:
             from traitsui.api import raise_to_debug
             raise_to_debug()
         self._no_enum_update -= 1
开发者ID:enthought,项目名称:traitsui,代码行数:11,代码来源:enum_editor.py

示例8: editor_trait_modified

 def editor_trait_modified ( new ):
     # Need this to include 'user_object' in closure:
     user_object
     if key not in self._no_trait_update:
         self._no_trait_update[ key ] = None
         try:
             setattr( eval( user_ref ), user_name, new )
         except:
             from traitsui.api import raise_to_debug
             raise_to_debug()
         del self._no_trait_update[ key ]
开发者ID:FelixHartmann,项目名称:traitsui,代码行数:11,代码来源:editor.py

示例9: user_list_modified

 def user_list_modified ( event ):
     if isinstance( event, TraitListEvent ):
         if key not in self._no_trait_update:
             self._no_trait_update[ key ] = None
             n = event.index
             try:
                 getattr( self, editor_name )[
                     n: n + len(event.removed)] = event.added
             except:
                 from traitsui.api import raise_to_debug
                 raise_to_debug()
             del self._no_trait_update[ key ]
开发者ID:FelixHartmann,项目名称:traitsui,代码行数:12,代码来源:editor.py

示例10: _selected_changed

 def _selected_changed(self, new):
     if not self._no_update:
         if new is None:
             self._selected_row_changed(-1)
         else:
             try:
                 selected_row = self.value.index(new)
             except Exception:
                 from traitsui.api import raise_to_debug
                 raise_to_debug()
             else:
                 self._selected_row_changed(selected_row)
开发者ID:bergtholdt,项目名称:traitsui,代码行数:12,代码来源:tabular_editor.py

示例11: update_editor

 def update_editor(self):
     """ Updates the editor when the object trait changes externally to the
         editor.
     """
     if not self._locked:
         blocked = self.control.blockSignals(True)
         try:
             self.control.setValue(int(self.value))
         except Exception:
             from traitsui.api import raise_to_debug
             raise_to_debug()
         finally:
             self.control.blockSignals(blocked)
开发者ID:bergtholdt,项目名称:traitsui,代码行数:13,代码来源:range_editor.py

示例12: editor_list_modified

 def editor_list_modified ( event ):
     # Need this to include 'user_object' in closure:
     user_object
     if key not in self._no_trait_update:
         self._no_trait_update[ key ] = None
         n = event.index
         try:
             eval( user_value )[ n:
                 n + len( event.removed ) ] = event.added
         except:
             from traitsui.api import raise_to_debug
             raise_to_debug()
         del self._no_trait_update[ key ]
开发者ID:FelixHartmann,项目名称:traitsui,代码行数:13,代码来源:editor.py

示例13: eval_when

    def eval_when(self, when, result=True):
        """ Evaluates an expression in the UI's **context** and returns the
            result.
        """
        context = self._get_context(self.context)
        try:
            result = eval(when, globals(), context)
        except:
            from traitsui.api import raise_to_debug
            raise_to_debug()

        del context['ui']

        return result
开发者ID:jonathanrocher,项目名称:traitsui,代码行数:14,代码来源:ui.py

示例14: eval_when

 def eval_when(self, condition, object, trait):
     """ Evaluates a condition within a defined context, and sets a
     specified object trait based on the result, which is assumed to be a
     Boolean.
     """
     if condition != '':
         value = True
         try:
             if not eval(condition, globals(), self._menu_context):
                 value = False
         except:
             from traitsui.api import raise_to_debug
             raise_to_debug()
         setattr(object, trait, value)
开发者ID:jonathanrocher,项目名称:traitsui,代码行数:14,代码来源:editor.py

示例15: _evaluate_condition

    def _evaluate_condition ( self, conditions, trait ):
        """ Evaluates a list of (eval,editor) pairs and sets a specified trait
        on each editor to reflect the Boolean value of the expression.
        """
        context = self._get_context( self.context )
        for when, editor in conditions:
            value = True
            try:
                if not eval( when, globals(), context ):
                    value = False
            except:
                from traitsui.api import raise_to_debug
                raise_to_debug()

            setattr( editor, trait, value )
开发者ID:GaelVaroquaux,项目名称:traitsui,代码行数:15,代码来源:ui.py


注:本文中的traitsui.api.raise_to_debug函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。