本文整理汇总了Python中lib.db.DB.run_contents方法的典型用法代码示例。如果您正苦于以下问题:Python DB.run_contents方法的具体用法?Python DB.run_contents怎么用?Python DB.run_contents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.db.DB
的用法示例。
在下文中一共展示了DB.run_contents方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: RunDetailsWindow
# 需要导入模块: from lib.db import DB [as 别名]
# 或者: from lib.db.DB import run_contents [as 别名]
class RunDetailsWindow(gui.RunDetailsWindow):
'''
classdocs
'''
def __init__(self, parent, run):
'''
Constructor
'''
gui.RunDetailsWindow.__init__(self, parent)
log.info("Starting up a run details window")
self.run = run
self.db = DB()
self.config = Config.get_config()
self.paths = {}
self.load_run_details()
self.load_files(200)
self.load_messages()
icon = wx.Icon(os.path.join(const.PixmapDir, "storage.png"), wx.BITMAP_TYPE_ANY)
self.SetIcon(icon)
# Ensure the right page is showing
self.nbDetails.SetSelection(0)
self.Show()
##################################################################
#
# Event Handlers
#
##################################################################
def onAllFiles(self, event):
self.load_files(None)
self.pnlAllFiles.Hide()
self.pnlFiles.Fit()
##################################################################
#
# Utilities
#
##################################################################
def load_run_details(self):
#(run_id=3, name=u'test', type=1, start_time=u'2010-12-28T15:09:39.455313', hash=u'6da92e0e7f25d003bfcc2cc7d845868fe6a433e1c0fe349300659fc86c8f66ba', size=59764, nfiles=0, status=u'Succeeded')
self.lstDetails.InsertColumn(0, _("Name"))
self.lstDetails.InsertColumn(1, _("Value"))
self.lstDetails.Append([_("Backup Name"), self.run.name])
self.lstDetails.Append([_("Run Date"), self.run.start_time_str])
self.lstDetails.Append([_("Run Type"), self.run.type])
self.lstDetails.Append([_("Status"), self.run.status])
self.lstDetails.Append([_("Files Backed Up"), str(self.run.nfiles)])
self.lstDetails.Append([_("Folders Backed Up"), str(self.run.nfolders)])
self.lstDetails.Append([_("Installed Software List"), _("Included") if self.run.packages else _("Not included")])
self.lstDetails.Append([_("Total Size"), utils.readable_form(self.run.size)])
self.lstDetails.Append([_("Hash"), self.run.hash])
self.lstDetails.SetColumnWidth(0, wx.LIST_AUTOSIZE)
self.lstDetails.SetColumnWidth(1, wx.LIST_AUTOSIZE)
def load_files(self, limit):
with ProgressDialog(self, _("Loading"), _("Loading run files.\nPlease wait...")):
self.lstFiles.DeleteAllColumns()
self.lstFiles.DeleteAllItems()
self.lstFiles.InsertColumn(0, _("Path"))
self.lstFiles.InsertColumn(1, _("Size"))
self.lstFiles.InsertColumn(2, _("Mod Time"))
self.lstFiles.Freeze()
try:
files = self.db.run_contents(self.run.run_id, limit)
for file in files:
wx.Yield()
if file.type == "F":
size = utils.readable_form(file.size)
mod_time = file.mod_time
elif file.type == 'D':
size = _("Folder")
mod_time = file.mod_time
elif file.type == 'X':
size = _("(deleted)")
mod_time = ""
else:
size = "ERROR: Bad type"
path = os.path.join(self.get_path(file.parent_id), file.name)
item = (utils.display_escape(path), size, mod_time)
self.lstFiles.Append(item)
self.lstFiles.SetColumnWidth(0, wx.LIST_AUTOSIZE)
self.lstFiles.SetColumnWidth(1, wx.LIST_AUTOSIZE)
self.lstFiles.SetColumnWidth(2, wx.LIST_AUTOSIZE)
#.........这里部分代码省略.........