本文整理汇总了Python中template.Template方法的典型用法代码示例。如果您正苦于以下问题:Python template.Template方法的具体用法?Python template.Template怎么用?Python template.Template使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类template
的用法示例。
在下文中一共展示了template.Template方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: save_app_as
# 需要导入模块: import template [as 别名]
# 或者: from template import Template [as 别名]
def save_app_as(self):
"saves a wxGlade project onto an xml file chosen by the user"
# both flags occurs several times
fn = wx.FileSelector( _("Save project as..."),
wildcard="wxGlade files (*.wxg)|*.wxg|wxGlade Template files (*.wgt) |*.wgt|"
"XML files (*.xml)|*.xml|All files|*",
flags=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT,
default_filename=common.root.filename or (self.cur_dir+os.sep+"wxglade.wxg"))
if not fn: return
# check for file extension and add default extension if missing
ext = os.path.splitext(fn)[1].lower()
if not ext:
fn = "%s.wxg" % fn
common.root.filename = fn
#remove the template flag so we can save the file.
common.root.properties["is_template"].set(False)
self.save_app()
self.cur_dir = os.path.dirname(fn)
self.file_history.AddFileToHistory(fn)
示例2: open_app
# 需要导入模块: import template [as 别名]
# 或者: from template import Template [as 别名]
def open_app(self, event=None):
"""loads a wxGlade project from an xml file
NOTE: this is very slow and needs optimisation efforts
NOTE2: the note above should not be True anymore :) """
if not self.ask_save():
return
default_path = os.path.dirname(common.root.filename or "") or self.cur_dir
infile = wx.FileSelector(_("Open file"),
wildcard="wxGlade files (*.wxg)|*.wxg|wxGlade Template files (*.wgt)|*.wgt|"
"XML files (*.xml)|*.xml|All files|*",
flags=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST, default_path=default_path)
if not infile: return
self._open(infile)
示例3: manage_templates
# 需要导入模块: import template [as 别名]
# 或者: from template import Template [as 别名]
def manage_templates(self):
to_edit = template.manage_templates()
if to_edit is not None and self.ask_save():
# edit the template
# TODO, you still need to save it manually...
self._open_app(to_edit, add_to_history=False)
wx.MessageBox( _("To save the changes to the template, edit the GUI as usual,\n"
"and then click File->Save As Template..."),
_("Information"), style=wx.OK|wx.ICON_INFORMATION )
####################################################################################################################
# user interface helpers