本文整理汇总了Python中Debug.printi方法的典型用法代码示例。如果您正苦于以下问题:Python Debug.printi方法的具体用法?Python Debug.printi怎么用?Python Debug.printi使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Debug
的用法示例。
在下文中一共展示了Debug.printi方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _end_node_drag
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import printi [as 别名]
def _end_node_drag(self, coords):
"""
Performs actions to complete a node drag operation
Validates node location, and other associated object information and updates the cache
when a node drag is completed
:coords: The coordinates associated with this event
"""
if self._cache["item"] is None:
return
# Obtain the final points
x = coords[0]
y = coords[1]
item = self._cache["item"]
self._validate_node_position(coords)
container = self._manager.request(DataStore.DATATYPE.NODE, item)
container.x_coordinate = x
container.y_coordinate = y
self._manager.inform(DataStore.EVENT.NODE_EDIT, container.empty_container(), self._cache["item"])
Debug.printi("Node " + str(self._cache["item"]) + " has been moved", Debug.Level.INFO)
# Clean the cache
self._clear_cache(coords)
示例2: _add_new_wall_pic
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import printi [as 别名]
def _add_new_wall_pic(self, pic=None):
"""
Adds a new wall picture to the node definition
Launches a dialog, and validates and posts the entered information
to the repository for the creation of a new wall picture for the
node that is being edited
"""
# Display the dialogue
results = pic
if results is None:
results = NodePictureDialog(self)
results = results._entries
item_id = results["name"]
item = results
# Extract the return values
try:
self.add_new(item, item_id)
except DuplicateListHeapItemException:
Debug.printi("Unable to add duplicate picture", Debug.Level.ERROR)
return
except MaxItemLimitReachedException:
Debug.printi("Maximum number of pictures for this room reached", Debug.Level.ERROR)
return
示例3: _handle_mot
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import printi [as 别名]
def _handle_mot(self, m_event, event):
"""
Callback function to handle movement of the mouse
Function updates the mouse location status bar as well as setting cache values to the current location
of the mouse
:m_event: The specifier for the type of event that has been generated
:event: The tk provided event object
"""
event.x = int(self._canvas.canvasx(event.x))
event.y = int(self._canvas.canvasy(event.y))
self._status.set_text("Mouse X:" + str(event.x) + "\tMouse Y:" + str(event.y))
item = self._get_current_item((event.x, event.y))
if self._is_node(item):
Debug.printi("Node: " + str(item), Debug.Level.INFO)
if self._is_edge(item):
d_x = self._edge_bindings[item].x_start - self._edge_bindings[item].x_end
d_y = self._edge_bindings[item].y_start - self._edge_bindings[item].y_end
square = (d_x * d_x) + (d_y * d_y)
distance = int(math.sqrt(square))
Debug.printi("Edge: " + str(item) + " | Source: "
+ str(self._edge_bindings[item].item_start) + " | Target: "
+ str(self._edge_bindings[item].item_end) + " | Length: "
+ str(distance))
self._cache["x"] = event.x
self._cache["y"] = event.y
示例4: _selection_operation
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import printi [as 别名]
def _selection_operation(self, coords):
"""
Contextually create or edit a node
:param coords:
:return:
"""
# Determine the item ID
item = self._get_current_item(coords)
self._cache["item"] = item
true_coords = self._canvas_to_screen((self._cache["x"], self._cache["y"]))
if self._is_node(item):
Debug.printi("Node Selected : " + str(item) + " | Launching Editor", Debug.Level.INFO)
# Make request from object manager using the tag assigned
populator = self._manager.request(DataStore.DATATYPE.NODE, item)
updated_node = NodeDialog(self, true_coords[0] + 10, true_coords[1] + 10, populator=populator)
# post information to object manager, or let the dialog handle it, or whatever
self._manager.inform(DataStore.EVENT.NODE_EDIT, updated_node._entries, item)
return
if self._is_edge(item):
Debug.printi("Edge Selected : " + str(item) + " | Launching Editor", Debug.Level.INFO)
# Make a request from the object manager to populate the dialog
populator = self._manager.request(DataStore.DATATYPE.EDGE, item)
updated_edge = EdgeDialog(self, true_coords[0] + 10, true_coords[1] + 10, populator=populator)
# Make sure that information is posted to the object manager
self._manager.inform(DataStore.EVENT.EDGE_EDIT, updated_edge._entries, item)
return
if self._is_object(item):
self._edit_object(coords)
return
示例5: _load_control_file
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import printi [as 别名]
def _load_control_file(file_path):
try:
control_file = open(file_path)
Debug.printi("Control file " + file_path + " successfully loaded", Debug.Level.INFO)
return control_file
except IOError as e:
Debug.printi(e.message, Debug.Level.FATAL)
示例6: _delete_object
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import printi [as 别名]
def _delete_object(self, item):
if item not in self._object_listing:
Debug.printi("Object does not exist to delete", Debug.Level.ERROR)
return
del self._object_listing[item]
self._manager.inform(DataStore.EVENT.OBJECT_DELETE, data_id=item)
self._canvas.itemconfig(item, outline="red", fill="black", activeoutline="black", activefill="red")
示例7: validate
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import printi [as 别名]
def validate(event, data):
if DEBUG:
return True, ""
try:
return DataValidator().VALIDATE_MAP[event](data)
except KeyError as error:
Debug.printi(error.message, Debug.Level.FATAL)
示例8: _display_img
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import printi [as 别名]
def _display_img(self):
"""
Display a loaded image in a dialog
"""
if self._file_path is None:
Debug.printi("No picture has been loaded to preview", Debug.Level.ERROR)
return
photo = self._open_img(self._file_path)
ImageViewDialog(self._parent, self._file_name, photo)
示例9: _toggle_windowed
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import printi [as 别名]
def _toggle_windowed(self):
"""
Toggle the windowed flag
:return:
"""
self._win_var.set(0 if self._win_var.get() == 1 else 1)
val = self._entries["windowed"]
self._entries["windowed"] = not val
Debug.printi("Windowing toggled to " + (str(not val)), Debug.Level.INFO)
self._windowed.toggle()
示例10: _toggle_distortion
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import printi [as 别名]
def _toggle_distortion(self):
"""
Toggle the distortion flag
:return:
"""
self._distortion_var.set(0 if self._distortion_var.get() == 1 else 1)
val = self._entries["distortion"]
self._entries["distortion"] = not val
Debug.printi("Distortion toggled to " + (str(not val)), Debug.Level.INFO)
self._distortion.toggle()
示例11: _open_img
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import printi [as 别名]
def _open_img(self, img_name):
"""
Open an image from its location on disk
Retrieves an image in ImageTk form from a given file path
and loads it for application use
:img_name: The path/name (?) of the image to open
"""
try:
img = Image.open(img_name)
photo = ImageTk.PhotoImage(img)
return photo
except IOError:
Debug.printi("Unable to find image " + img_name, Debug.Level.ERROR)
示例12: dump_file
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import printi [as 别名]
def dump_file(self):
# Validate, abort if invalid
result, message = self._subject.export_finalize()
if result is False:
# throw error, return
tkMessageBox.showerror("Invalid Data", message)
return
# Obtain the file handle to print to
handle = tkFileDialog.asksaveasfile(mode='w', defaultextension=".xml")
if handle is None: # asksaveasfile return `None` if dialog closed with "cancel".
return
handle.write(self._xml_container.to_string())
handle.close() # `()` was missing.
Debug.printi("File " + handle.name + " has been saved")
示例13: _move_img
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import printi [as 别名]
def _move_img(self):
if self._auto_move is False:
return
# Else, move the image to the given folder that is in the same dir as this module
try:
src = self._file_path
dest = os.path.dirname(os.path.realpath(__file__)) +"/" + self._file_name
shutil.copy(src, dest)
Debug.printi("Moving file " + self._file_path + " to location "
+ os.path.dirname(os.path.realpath(__file__))
+ self._file_name, Debug.Level.INFO)
# eg. src and dest are the same file
except shutil.Error as e:
print('Error: %s' % e + " " +dest)
# eg. source or destination doesn't exist
except IOError as e:
print('Error: %s' % e.strerror +" "+ dest)
示例14: _load_mesh
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import printi [as 别名]
def _load_mesh(self):
"""
Open a file dialog to load a mesh filepath
:return:
"""
Debug.printi("Load Mesh called", Debug.Level.INFO)
types = \
[
("DirectX", "*.x")
]
dialog = tkFileDialog.Open(self, filetypes=types)
file_path = dialog.show()
file_path = self._move_img(file_path)
self._mesh.delete(0, END)
self._mesh.insert(0, str(file_path))
Debug.printi("Mesh Filepath:" + file_path, Debug.Level.INFO)
示例15: update
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import printi [as 别名]
def update(self):
Debug.printi("The state of the datastore has been updated", Debug.Level.INFO)
# Retrieve the update details from the datastore, and then dispatch the changes to
# the XML container
update_event = (self._subject._cache["EVENT"], self._subject._cache["ID"], self._subject._cache["DATA"])
if update_event[0] == "Delete All":
self._xml_container.create_skeleton(self._subject)
return
self._dispatch[update_event[0]](
self._extract_xml_id(update_event[0], update_event[2]),
update_event[2]
)
self._text_area.config(state=NORMAL)
self._text_area.delete(1.0, END)
self._text_area.insert(END, self._xml_container.to_string())
self._text_area.config(state=DISABLED)