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


Python View.clear_all方法代码示例

本文整理汇总了Python中View.View.clear_all方法的典型用法代码示例。如果您正苦于以下问题:Python View.clear_all方法的具体用法?Python View.clear_all怎么用?Python View.clear_all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在View.View的用法示例。


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

示例1: FormCreator

# 需要导入模块: from View import View [as 别名]
# 或者: from View.View import clear_all [as 别名]

#.........这里部分代码省略.........
                    i = 3*"\t" + "<input type=\"{0}\" class=\"{1}\" name=\"{2}\" id=\"{2}\" value=\"{3}\" />\n"
                    html += i.format(r["typerect"], key, r["idtag"], r["value"])
            f.write(skeletal_data.format(page_title, css, html))

    @staticmethod
    def write_html_printpage(iname, filepath, rmap_data, json_data):
        """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):
开发者ID:sleibrock,项目名称:form-creator,代码行数:70,代码来源:FormCreator.py


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