本文整理汇总了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
示例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)
示例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
示例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()
示例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
示例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()
示例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
示例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 ]
示例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 ]
示例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)
示例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)
示例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 ]
示例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
示例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)
示例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 )