Fix Transfer.time_left that could be None
This commit is contained in:
parent
f9f558cd34
commit
49966e06ad
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user