def _ConvertFileSeedToListCtrlTuples(self, file_seed): try: file_seed_index = self._file_seed_cache.GetFileSeedIndex(file_seed) pretty_file_seed_index = HydrusData.ToHumanInt(file_seed_index) except: file_seed_index = '--' pretty_file_seed_index = '--' file_seed_data = file_seed.file_seed_data status = file_seed.status added = file_seed.created modified = file_seed.modified source_time = file_seed.source_time note = file_seed.note pretty_file_seed_data = str(file_seed_data) pretty_status = CC.status_string_lookup[status] pretty_added = ClientData.TimestampToPrettyTimeDelta(added) pretty_modified = ClientData.TimestampToPrettyTimeDelta(modified) if source_time is None: pretty_source_time = 'unknown' else: pretty_source_time = ClientData.TimestampToPrettyTimeDelta( source_time) sort_source_time = ClientGUIListCtrl.SafeNoneInt(source_time) pretty_note = note.split(os.linesep)[0] display_tuple = (pretty_file_seed_index, pretty_file_seed_data, pretty_status, pretty_added, pretty_modified, pretty_source_time, pretty_note) sort_tuple = (file_seed_index, file_seed_data, status, added, modified, sort_source_time, note) return (display_tuple, sort_tuple)
def _ConvertRuleToListCtrlTuples(self, rule): (bandwidth_type, time_delta, max_allowed) = rule pretty_time_delta = HydrusData.TimeDeltaToPrettyTimeDelta(time_delta) if bandwidth_type == HC.BANDWIDTH_TYPE_DATA: pretty_max_allowed = HydrusData.ToHumanBytes(max_allowed) elif bandwidth_type == HC.BANDWIDTH_TYPE_REQUESTS: pretty_max_allowed = HydrusData.ToHumanInt( max_allowed) + ' requests' sort_time_delta = ClientGUIListCtrl.SafeNoneInt(time_delta) sort_tuple = (max_allowed, sort_time_delta) display_tuple = (pretty_max_allowed, pretty_time_delta) return (display_tuple, sort_tuple)