本文整理汇总了Python中Project.Project.save方法的典型用法代码示例。如果您正苦于以下问题:Python Project.save方法的具体用法?Python Project.save怎么用?Python Project.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project.Project
的用法示例。
在下文中一共展示了Project.save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: adminProjectsPost
# 需要导入模块: from Project import Project [as 别名]
# 或者: from Project.Project import save [as 别名]
def adminProjectsPost(handler, p_name):
handler.title('Project Management')
requirePriv(handler, 'Admin')
if Project.load(name = p_name):
ErrorBox.die('Add Project', "There is already a project named <b>%s</b>" % stripTags(p_name))
project = Project(p_name)
project.save()
delay(handler, SuccessBox("Added project <b>%s</b>" % stripTags(p_name), close = True))
Event.newProject(handler, project)
redirect('/')
示例2: MyFrame
# 需要导入模块: from Project import Project [as 别名]
# 或者: from Project.Project import save [as 别名]
class MyFrame(wx.Frame):
def __init__(self, *args, **kwds):
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.menubar = wx.MenuBar()
self.menu_file = wx.Menu()
self.menu_new = wx.MenuItem(self.menu_file, 101, "&New", "", wx.ITEM_NORMAL)
self.menu_file.AppendItem(self.menu_new)
self.menu_open = wx.MenuItem(self.menu_file, 102, "&Open", "", wx.ITEM_NORMAL)
self.menu_file.AppendItem(self.menu_open)
self.menu_save = wx.MenuItem(self.menu_file, 103, "&Save", "", wx.ITEM_NORMAL)
self.menu_file.AppendItem(self.menu_save)
self.menu_saveas = wx.MenuItem(self.menu_file, 104, "Save &As", "", wx.ITEM_NORMAL)
self.menu_file.AppendItem(self.menu_saveas)
self.menu_file.AppendSeparator()
self.menu_close = wx.MenuItem(self.menu_file, 105, "&Close", "", wx.ITEM_NORMAL)
self.menu_file.AppendItem(self.menu_close)
self.menubar.Append(self.menu_file, "&File")
self.menu_about = wx.Menu()
self.menu_about_pysaved = wx.MenuItem(self.menu_about, 201, "&About PySaved", "", wx.ITEM_NORMAL)
self.menu_about.AppendItem(self.menu_about_pysaved)
self.menubar.Append(self.menu_about, "&About")
self.SetMenuBar(self.menubar)
self.nb = wx.Notebook(self, wx.ID_ANY, style=0)
self.nb_panel_1 = wx.Panel(self.nb, wx.ID_ANY)
self.label_name = wx.StaticText(self.nb_panel_1, wx.ID_ANY, "Name:")
self.input_name = wx.TextCtrl(self.nb_panel_1, wx.ID_ANY, "")
self.label_icon = wx.StaticText(self.nb_panel_1, wx.ID_ANY, "Icon (Windows only):")
self.input_icon = wx.TextCtrl(self.nb_panel_1, wx.ID_ANY, "")
self.button_search_icon = wx.BitmapButton(self.nb_panel_1, wx.ID_ANY, statics.search(), style=wx.NO_BORDER)
self.label_execfile = wx.StaticText(self.nb_panel_1, wx.ID_ANY, "Executable file:")
self.input_execfile = wx.TextCtrl(self.nb_panel_1, wx.ID_ANY, "")
self.button_search_execfile = wx.BitmapButton(self.nb_panel_1, wx.ID_ANY, statics.search(), style=wx.NO_BORDER)
self.radiobox_console = wx.RadioBox(self.nb_panel_1, wx.ID_ANY, "Console (Windows only)", choices=["show", "hide"], majorDimension=0, style=wx.RA_SPECIFY_COLS)
self.sl1 = wx.StaticLine(self.nb_panel_1, wx.ID_ANY)
self.label_pathstosearchin = wx.StaticText(self.nb_panel_1, wx.ID_ANY, "Paths to search in:")
self.list_pathstosearchin = wx.ListBox(self.nb_panel_1, wx.ID_ANY, choices=[])
self.button_pathstosearchin_add = wx.BitmapButton(self.nb_panel_1, wx.ID_ANY, statics.add(), style=wx.NO_BORDER)
self.button_pathstosearchin_edit = wx.BitmapButton(self.nb_panel_1, wx.ID_ANY, statics.edit(), style=wx.NO_BORDER)
self.button_pathstosearchin_del = wx.BitmapButton(self.nb_panel_1, wx.ID_ANY, statics.dele(), style=wx.NO_BORDER)
self.label_hiddenmodules = wx.StaticText(self.nb_panel_1, wx.ID_ANY, "Hidden modules:")
self.list_hiddenmodules = wx.CheckListBox(self.nb_panel_1, wx.ID_ANY, choices=[])
self.nb_pane_2 = wx.Panel(self.nb, wx.ID_ANY)
self.label_outpath = wx.StaticText(self.nb_pane_2, wx.ID_ANY, "Output path:")
self.input_outpath = wx.TextCtrl(self.nb_pane_2, wx.ID_ANY, "")
self.search_outpath = wx.BitmapButton(self.nb_pane_2, wx.ID_ANY, statics.search(), style=wx.NO_BORDER)
self.label_temppath = wx.StaticText(self.nb_pane_2, wx.ID_ANY, "Temporary path:")
self.input_temppath = wx.TextCtrl(self.nb_pane_2, wx.ID_ANY, "")
self.search_temppath = wx.BitmapButton(self.nb_pane_2, wx.ID_ANY, statics.search(), style=wx.NO_BORDER)
self.sl2 = wx.StaticLine(self.nb_pane_2, wx.ID_ANY)
self.radiobox_saveas = wx.RadioBox(self.nb_pane_2, wx.ID_ANY, "Save as", choices=["multiple files in one folder", "one file"], majorDimension=0, style=wx.RA_SPECIFY_COLS)
self.checkbox_debug = wx.CheckBox(self.nb_pane_2, wx.ID_ANY, "Debug-mode")
self.checkbox_unicode = wx.CheckBox(self.nb_pane_2, wx.ID_ANY, "Support unicode")
self.sl3 = wx.StaticLine(self.nb_pane_2, wx.ID_ANY)
self.bitmap_start = wx.BitmapButton(self.nb_pane_2, wx.ID_ANY, statics.start(), style=wx.NO_BORDER)
self.sl4 = wx.StaticLine(self.nb_pane_2, wx.ID_ANY)
self.label_log = wx.StaticText(self.nb_pane_2, wx.ID_ANY, "Log:")
self.list_log = wx.ListBox(self.nb_pane_2, wx.ID_ANY, choices=[])
self.Bind(wx.EVT_MENU, self.new, self.menu_new)
self.Bind(wx.EVT_MENU, self.open, self.menu_open)
self.Bind(wx.EVT_MENU, self.save, self.menu_save)
self.Bind(wx.EVT_MENU, self.saveas, self.menu_saveas)
self.Bind(wx.EVT_MENU, self.exit, self.menu_close)
self.Bind(wx.EVT_MENU, self.about, self.menu_about_pysaved)
self.Bind(wx.EVT_BUTTON, self.search_icon, self.button_search_icon)
self.Bind(wx.EVT_BUTTON, self.search_execfile, self.button_search_execfile)
self.Bind(wx.EVT_BUTTON, self.addPath, self.button_pathstosearchin_add)
self.Bind(wx.EVT_BUTTON, self.editPath, self.button_pathstosearchin_edit)
self.Bind(wx.EVT_BUTTON, self.delPath, self.button_pathstosearchin_del)
self.Bind(wx.EVT_BUTTON, self.event_search_outpath, self.search_outpath)
self.Bind(wx.EVT_BUTTON, self.event_search_temppath, self.search_temppath)
self.Bind(wx.EVT_BUTTON, self.start, self.bitmap_start)
self.Bind(wx.EVT_CLOSE, self.exit)
self.__set_properties()
self.__do_layout()
self.project = Project()
self.project.loadAllhiddenmodules(self)
self.project.initialFrame(self)
self.path = None
self.progress= False
def __set_properties(self):
self.SetTitle("PySaved")
self.SetMinSize(wx.Size(780, 820))
self.label_name.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
self.input_name.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
self.label_icon.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
self.input_icon.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
self.button_search_icon.SetSize(self.button_search_icon.GetBestSize())
self.label_execfile.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
self.input_execfile.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
self.button_search_execfile.SetSize(self.button_search_execfile.GetBestSize())
self.radiobox_console.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
try: self.radiobox_console.SetSelection(0)
except: pass
#.........这里部分代码省略.........
示例3: __init__
# 需要导入模块: from Project import Project [as 别名]
# 或者: from Project.Project import save [as 别名]
class StoryDNA:
def __init__(self):
self.project = None
self.secureQuit = True # attribute to know if script have to ask to save current project before quitting
# create the app main window
self.window = Tk(className="StoryDNA")
self.window.option_add("*Font", "arial 12")
self.window.geometry(
str(self.window.winfo_screenwidth()) + "x" + str(self.window.winfo_screenheight()) + "+0+0"
)
# activate general shortcut for menu and mouse scrolling
self.window.bind("<Control-KeyPress>", self.shortcut)
self.window.bind_all("<Button-5>", mouseScroll)
self.window.bind_all("<Button-4>", mouseScroll)
# create the menu of the software
self.menubar = Menu(self.window)
menu = Menu(self.menubar, tearoff=0)
# submenu of File menu
menu.add_command(label="New", command=self.new)
menu.add_command(label="Open", command=self.open)
menu.add_command(label="Save", command=self.save, state=DISABLED)
menu.add_command(label="Save As", command=self.saveAs, state=DISABLED)
menu.add_command(label="Quit", command=self.quit)
self.window.protocol("WM_DELETE_WINDOW", self.quit)
self.menubar.add_cascade(label="File", menu=menu)
# Settings menu and submenu
menu = Menu(self.menubar, tearoff=0)
menu.add_command(label="Archetypes", command=lambda win=self.window: Character.setArchetypesList(win))
self.menubar.add_cascade(label="Settings", menu=menu)
self.window.config(menu=self.menubar)
# create content of starting window :
# button to open a project or create a new one
fr = Frame(self.window, pady=300)
fr.pack()
button = Button(fr, text="NEW PROJECT", command=self.new, pady=5, justify=CENTER)
button.pack(pady=5)
button = Button(fr, text="OPEN A PROJECT", command=self.open, pady=5, justify=CENTER)
button.pack(pady=5)
# warning message
label = Label(
fr,
text="This soft is still in development and is not ready to use!",
foreground="#ff0000",
pady=50,
font=("Arial", 50),
wraplength=800,
justify=LEFT,
)
label.pack()
# treat the app argument
argv = sys.argv
while len(argv) > 1:
arg = argv.pop()
if arg == "--no-secure-quit":
# disabled the safe quitting mode
self.secureQuit = False
else:
path = os.path.abspath(arg)
# check the path given and open it as a project
if not os.access(path, os.F_OK):
showerror("Load error", "«" + path + "» didn't exist or is not a file!")
elif not (os.access(path, os.R_OK) and os.access(path, os.W_OK)):
showerror("Load error", "you don't have permission to read or write in «" + path + "» file!")
elif path[-5:] != ".sdna" or not tarfile.is_tarfile(path):
showerror("Load error", "«" + path + "» don't seemed to be a valid Story DNA file!")
else:
fr.destroy() # erase content of starting window
self.open(path=path) # open the project
self.window.mainloop()
# erase the temporary directory before quitting
if self.project is not None:
self.project.__del__()
def shortcut(self, event):
"""call action corresponding to a shortcut"""
if event.keysym == "q":
self.quit()
elif event.keysym == "Q":
self.quit(True) # quit app directly without saving
elif event.keysym == "n":
self.new()
elif event.keysym == "o":
self.open()
elif event.keysym == "s" and self.project is not None:
focus = self.window.focus_displayof()
#.........这里部分代码省略.........