當前位置: 首頁>>代碼示例>>Python>>正文


Python template.Template方法代碼示例

本文整理匯總了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) 
開發者ID:wxGlade,項目名稱:wxGlade,代碼行數:24,代碼來源:main.py

示例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) 
開發者ID:wxGlade,項目名稱:wxGlade,代碼行數:15,代碼來源:main.py

示例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 
開發者ID:wxGlade,項目名稱:wxGlade,代碼行數:13,代碼來源:main.py


注:本文中的template.Template方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。