Fix Transfer.time_left that could be None

This commit is contained in:
miruka 2020-03-09 17:36:47 -04:00
parent f9f558cd34
commit 49966e06ad
3 changed files with 4 additions and 4 deletions

View File

@ -11,7 +11,7 @@ import re
import traceback
from contextlib import suppress
from copy import copy
from datetime import datetime
from datetime import datetime, timedelta
from functools import partial
from pathlib import Path
from typing import (
@ -381,7 +381,7 @@ class MatrixClient(nio.AsyncClient):
def on_speed_changed(speed: float) -> None:
upload_item.speed = speed
upload_item.time_left = monitor.remaining_time
upload_item.time_left = monitor.remaining_time or timedelta(0)
monitor.on_transferred = on_transferred
monitor.on_speed_changed = on_speed_changed

View File

@ -9,7 +9,7 @@ HColumnLayout {
id: transfer
property int msLeft: model.time_left || 0
property int msLeft: model.time_left
property int uploaded: model.uploaded
readonly property int speed: model.speed
readonly property int totalSize: model.total_size

View File

@ -83,7 +83,7 @@ QtObject {
function onModelItemFieldChanged(syncId, oldIndex, newIndex, field, value){
print("\u001b[37mchange", syncId, oldIndex, newIndex, field, value, "\u001b[0m")
// print("change", syncId, oldIndex, newIndex, field, value)
const model = ModelStore.get(syncId)
model.setProperty(oldIndex, field, value)