def _notifyUser_disk_quota_exceeded(self, user_used_space, user_quota, pathname, size): caption = Messages.DISK_QUOTA_EXCEEDED_DIALOG_TITLE msg = Messages.DISK_QUOTA_EXCEEDED_DIALOG_BODY % { 'size': format_bytes(size), 'pathname': pathname, 'used_space': format_bytes(user_used_space), 'total_space': format_bytes(user_quota) } self._notifyUser_message(msg, caption)
def _notifyUser_disk_quota_exceeded(self, user_used_space, user_quota, pathname, size): caption = Messages.DISK_QUOTA_EXCEEDED_DIALOG_TITLE msg = Messages.DISK_QUOTA_EXCEEDED_DIALOG_BODY % { 'size': format_bytes(size), 'pathname': pathname, 'used_space': format_bytes(user_used_space), 'total_space': format_bytes(user_quota) } self._notifyUser_message(msg, caption)
def setSpaceInfo(self, user_quota, used_space): """ Updates the space info on main window """ string = Messages.SPACE_INFO_STRING % { "used_space": format_bytes(used_space), "user_quota": format_bytes(user_quota) } tooltip = Messages.SPACE_INFO_TOOLTIP % { "used_space_in_mega": used_space / ONEMEGAINBYTES } self.space_ctrl.SetValue(string) self.space_ctrl.SetToolTipString(tooltip) self.used_space_bar.SetValue(((used_space * 1000) / user_quota))
def setSpaceInfo(self, user_quota, used_space): """ Updates the space info on main window """ string = Messages.SPACE_INFO_STRING % { "used_space": format_bytes(used_space), "user_quota": format_bytes(user_quota) } tooltip = Messages.SPACE_INFO_TOOLTIP % { "used_space_in_mega": used_space / ONEMEGAINBYTES } self.space_ctrl.SetValue(string) self.space_ctrl.SetToolTipString(tooltip) self.used_space_bar.SetValue(((used_space * 1000) / user_quota))
def updatePathnameStatus(self, pathname, status, size, newpathname=None): index = self.activities.FindItem(-1, pathname) if status in [ Pss.DOWNLOADNEEDED, Pss.LOCALDELETENEEDED, Pss.LOCALRENAMENEEDED, Pss.LOCALCOPYNEEDED, Pss.UPLOADNEEDED ]: index = self.activities.InsertStringItem(0, pathname) self.activities.SetStringItem(index, 1, format_bytes(size)) if newpathname is None: self.activities.SetStringItem( index, 2, self.activities.pathname_status_messages[status], self.activities.pathname_status_icon[status]) else: self.activities.SetStringItem( index, 2, newpathname, self.activities.pathname_status_icon[status]) if status in [Pss.LOCALCOPYNEEDED, Pss.LOCALRENAMENEEDED]: self.activities.SetColumnWidth(1, 325) self.Layout()
def updatePathnameStatus(self, pathname, status, size, newpathname=None): index=self.activities.FindItem(-1, pathname) if status in [ Pss.DOWNLOADNEEDED, Pss.LOCALDELETENEEDED, Pss.LOCALRENAMENEEDED, Pss.LOCALCOPYNEEDED, Pss.UPLOADNEEDED ]: index = self.activities.InsertStringItem(0, pathname) self.activities.SetStringItem(index, 1, format_bytes(size)) if newpathname is None: self.activities.SetStringItem(index, 2, self.activities.pathname_status_messages[status], self.activities.pathname_status_icon[status]) else: self.activities.SetStringItem(index, 2, newpathname, self.activities.pathname_status_icon[status]) if status in [Pss.LOCALCOPYNEEDED, Pss.LOCALRENAMENEEDED ]: self.activities.SetColumnWidth(1, 325) self.Layout()
def OnGetItemText(self, index, col): assert index < len(self.item_sequence) k = self.item_sequence[index] # k is either a string (the pathname) or a tuple (pathname, newpathname) for renameing size, status= self.item_data_map[k] if col == 0: # pathname if type(k)==tuple: return k[0] else: return k elif col == 1: # size return format_bytes(size) elif col == 2: # status if type(k)==tuple: return k[1] else: return self.pathname_status_messages[status] else: raise ValueError("unexpected column number in callback from wx")