本文整理汇总了Python中View.View.statistics方法的典型用法代码示例。如果您正苦于以下问题:Python View.statistics方法的具体用法?Python View.statistics怎么用?Python View.statistics使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类View.View
的用法示例。
在下文中一共展示了View.statistics方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: FormCreator
# 需要导入模块: from View import View [as 别名]
# 或者: from View.View import statistics [as 别名]
#.........这里部分代码省略.........
"""For future use in writing data to an HTML page (similar code as write_html_rmap)"""
# TODO: data test writing to an HTML print page
with open(join(Preferences.staticFolder, Preferences.SkeletonFile), "r") as f:
skeletal_data = f.read()
with open(filepath+".print.html", "w") as f:
css = ".sourceImage{z-index:-1;}\n"
html = "<img src=\"{0}\" class=\"sourceImage\" />\n".format(iname)
for key, r in rmap_data.items():
css += "."+key+"{position:absolute;top:"+str(r["y"]+10)+"px;left:"+str(r["x"]+10)+"px;}\n"
if r["typerect"] == "text" and r["idtag"].strip() != "":
print(r)
html += "<p class=\"{0}\">{1}</p>".format(key, json_data[r["idtag"]]["value"])
else:
# <input type"radio" checked> creates a checked radio
# we need json info if the field was selected
pass
f.write(skeletal_data.format("", css, html))
@staticmethod
def export_json(data):
"""Export JSON etc"""
return dumps(data, sort_keys=True, indent=4, separators=(',', ': '))
def on_close(self, event):
"""Close the image and remove excess data from the viewer"""
event.Skip()
self.img = ""
self.view.clear_all()
self.rmap_loaded = False
self.SetTitle("FormCreator " + Preferences.version)
def on_selection(self, event):
"""Apply the selection from listbox to the rectangle selected (if any)"""
event.Skip()
n = self.listitems[self.listbox.GetSelection()]
if self.view.image is not None:
self.view.applytype(n)
def filter(self, event):
"""Filter any bad rectangles from the buffer"""
event.Skip()
if self.view.image is not None:
self.view.filter_rects()
self.SetStatusText(Preferences.filterRects)
def cleanup(self, event):
"""Cleaning function"""
event.Skip()
if self.view.image is not None:
self.view.cleanup()
self.SetStatusText(Preferences.cleanRects)
def on_about(self, event):
"""Instruction dialog for the program"""
event.Skip()
dlg = wx.MessageDialog(self, "\n".join(Preferences.aboutAppInstructions), "About FormCreator", wx.OK)
dlg.ShowModal()
dlg.Destroy()
def on_stats(self, event):
"""Statistical count data for the current view"""
event.Skip()
if self.view.image is not None:
s, t, c, r, n = self.view.statistics()
dlg = wx.MessageDialog(self, Preferences.statisticalData.format(s, t, c, r, n), "Statistics", wx.OK)
dlg.ShowModal()
dlg.Destroy()
else:
self.SetStatusText(Preferences.noImageLoaded)
def on_exit(self, event):
"""Exit the program"""
event.Skip()
self.view.clear_all()
self.Close(True) # close program
def on_delete(self, event):
"""Delete selected rect"""
event.Skip()
if self.view.image is not None:
self.view.deleteselectedrect()
self.SetStatusText(Preferences.deletingRect)
def del_all(self, event):
"""Delete all rects"""
event.Skip()
if self.view.image is not None:
self.view.deleteallrects()
self.SetStatusText(Preferences.deletingAllRects)
def set_type(self, text):
"""Change the selection in the listbox"""
self.listbox.SetStringSelection(text)
def apply_name(self, event):
"""Apply the text to the rectangle"""
event.Skip()
if self.view.image is not None:
self.view.applyname(self.idtext.Value)
#end