本文整理汇总了Python中mfp.log.debug函数的典型用法代码示例。如果您正苦于以下问题:Python debug函数的具体用法?Python debug怎么用?Python debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _callback_wrapper
def _callback_wrapper(self, thunk):
try:
return thunk()
except Exception as e:
import traceback
log.debug("Exception in GUI operation:", e)
log.debug_traceback()
return False
示例2: command
def command(self, action, data):
if action == "buffer":
log.debug("scopeplot: got buffer info", data)
self.buf_info = data
self.shm_obj = None
elif action == "grab":
self._grab()
self.plot.invalidate()
return True
示例3: load_complete
def load_complete(self):
self.load_in_progress = False
if self.selected_patch is None and len(self.patches):
self.selected_patch = self.patches[0]
if self.selected_layer is None and self.selected_patch is not None:
self.layer_select(self.selected_patch.layers[0])
self.object_view.refresh()
self.layer_view.refresh()
log.debug("Patch GUI completed")
示例4: label_edit_finish
def label_edit_finish(self, widget, new_text, aborted=False):
if self.obj_id is None:
self.create(self.proc_type, None)
if self.obj_id is None:
log.debug("TextElement: could not create obj")
elif new_text != self.value:
self.value = new_text
self.label.set_markup(self.value)
MFPGUI().mfp.send(self.obj_id, 0, self.value)
self.update()
示例5: __init__
def __init__(self, init_type, init_args, patch, scope, name):
self.buffer = None
self.retrig_value = True
self.need_buffer_send = False
if init_args is not None:
log.debug("scope: Does not accept init args")
self.gui_params = dict(plot_type="scope")
Processor.__init__(self, 1, 1, init_type, init_args, patch, scope, name)
示例6: patch_close
def patch_close(self):
p = self.selected_patch
if p and p.deletable:
self.patch_select_next()
self.patches.remove(p)
p.delete()
else:
log.debug("Cannot close window. Close UI via plugin host Edit button")
if not len(self.patches):
self.quit()
示例7: grab_handler
def grab_handler(stage, event):
try:
if not self.embed.has_focus():
self.embed.grab_focus()
return self.input_mgr.handle_event(stage, event)
except Exception, e:
import traceback
log.error("Error handling UI event", event)
log.debug(e)
traceback.print_exc()
return False
示例8: set_scope
def set_scope(self, obj_id, scope_name):
from .mfp_app import MFPApp
obj = MFPApp().recall(obj_id)
if obj is None or isinstance(obj, MFPApp):
log.debug("Cannot find object for %s to set scope to %s" % (obj_id, scope_name))
return
scope = obj.patch.scopes.get(scope_name)
if scope is None:
scope = obj.patch.add_scope(scope_name)
obj.assign(obj.patch, scope, obj.name)
示例9: layer_scope_edited
def layer_scope_edited(layer, new_value):
from mfp import log
if isinstance(layer, Layer):
p = self.selected_patch
if not p.has_scope(new_value):
log.debug("Adding scope", new_value, "to patch", self.selected_patch)
MFPCommand().add_scope(self.selected_patch.obj_id, new_value)
layer.scope = new_value
self.selected_patch.send_params()
for obj in self.objects:
if obj.obj_id is not None and obj.layer == layer:
MFPCommand().set_scope(obj.obj_id, new_value)
self.refresh(obj)
return True
示例10: obj_selected
def obj_selected(obj):
self._select(obj)
if isinstance(obj, PatchElement):
self.layer_select(obj.layer)
elif isinstance(obj, PatchInfo):
self.layer_select(obj.layers[0])
elif isinstance(obj, tuple):
scope = obj[0]
patch = obj[1]
if isinstance(patch, PatchInfo):
for l in patch.layers:
if l.scope == scope:
self.layer_select(l)
return
self.layer_select(patch.layers[0])
else:
log.debug("[obj_selected] Got tuple", obj)
self.layer_select(patch.layer)
示例11: autoplace_noselection
def autoplace_noselection(self):
width, height = self.window.stage.get_size()
spacing = self.NONE_SPACING
cols = int(width / spacing)
rows = int(height / spacing)
if self.placement > rows * cols:
self.placement = 0
log.debug(self.placement, width, cols, height, rows)
x = self.X_OFF + (self.placement % cols) * spacing
y = self.Y_OFF + int(self.placement / cols) * spacing
self._set_autoplace(x, y)
self.placement += 1
return True
示例12: trigger
def trigger(self):
if isinstance(self.inlets[0], BufferInfo):
self.buffer = self.inlets[0]
if self.gui_created:
MFPApp().gui_command.command(self.obj_id, "buffer", self.buffer)
else:
self.need_buffer_send = True
elif self.inlets[0] is True:
pass
elif self.inlets[0] is False:
if self.gui_created:
self.grab()
if self.buffer is None:
log.debug("scope: got input from buffer, but no bufferinfo.. requesting")
self.outlets[0] = MethodCall("bufinfo")
if self.gui_created and self.need_buffer_send:
self.need_buffer_send = False
MFPApp().gui_command.command(self.obj_id, "buffer", self.buffer)
示例13: open_context
def open_context(self, node_id, context_id, owner_pid, samplerate):
from .dsp_object import DSPContext
from .mfp_app import MFPApp
try:
ctxt_name = open("/proc/%d/cmdline" % owner_pid, "r").read().split("\x00")[0]
log.debug("open_context: new context, name=%s" % ctxt_name)
except:
ctxt_name = ""
if MFPApp().samplerate != samplerate:
log.debug("open_context: samplerate changing from %d to %d" %
(MFPApp().samplerate, samplerate))
MFPApp().samplerate = samplerate
if DSPContext.create(node_id, context_id, ctxt_name):
return True
else:
return False
示例14: _grab
def _grab(self):
def offset(channel):
return channel * self.buf_info.size * self.FLOAT_SIZE
if self.buf_info is None:
return None
if self.shm_obj is None:
self.shm_obj = SharedMemory(self.buf_info.buf_id)
self.data = []
try:
for c in range(self.buf_info.channels):
os.lseek(self.shm_obj.fd, offset(c), os.SEEK_SET)
slc = os.read(self.shm_obj.fd, int(self.buf_info.size * self.FLOAT_SIZE))
self.data.append(list(numpy.fromstring(slc, dtype=numpy.float32)))
self.set_bounds(0, None, len(self.data[0])*1000/self.samplerate, None)
except Exception as e:
log.debug("scopeplot: error grabbing data", e)
import traceback
traceback.print_exc()
return None
示例15: label_edit_finish
def label_edit_finish(self, *args):
t = self.label.get_text()
if t != self.label_text:
parts = t.split(' ', 1)
self.obj_type = parts[0]
if len(parts) > 1:
self.obj_args = parts[1]
log.debug("PlotElement: type=%s, args=%s" % (self.obj_type, self.obj_args))
self.proc_type = self.obj_type
self.create(self.proc_type, self.obj_args)
if self.obj_id is None:
log.debug("PlotElement: could not create", self.obj_type, self.obj_args)
else:
self.send_params()
self.draw_ports()
# FIXME set label to non-editing style
self.update()