mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Improve date rendering
- Use "Mon Dec 3 at 12:39" if 7 days or more away. - Use "Mon at 12:39" if within 7 days but more than one away. - Use "tomorrow at 12:39" if one day away. - Use "today at 12:39" if today. Contributes to CL-1153
This commit is contained in:
parent
3d80e28174
commit
a28cae0a43
1 changed files with 18 additions and 2 deletions
|
@ -386,8 +386,24 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
|
|||
@pyqtSlot(int, result = str)
|
||||
def getDateCompleted(self, time_remaining: int) -> str:
|
||||
current_time = time()
|
||||
datetime_completed = datetime.fromtimestamp(current_time + time_remaining)
|
||||
return (datetime_completed.strftime("%a %b ") + "{day}".format(day=datetime_completed.day)).upper()
|
||||
completed = datetime.fromtimestamp(current_time + time_remaining)
|
||||
today = datetime.fromtimestamp(current_time)
|
||||
|
||||
# If finishing date is more than 7 days out, using "Mon Dec 3 at HH:MM" format
|
||||
if completed.toordinal() > today.toordinal() + 7:
|
||||
return completed.strftime("%a %b ") + "{day}".format(day=completed.day)
|
||||
|
||||
# If finishing date is within the next week, use "Monday at HH:MM" format
|
||||
elif completed.toordinal() > today.toordinal() + 1:
|
||||
return completed.strftime("%a")
|
||||
|
||||
# If finishing tomorrow, use "tomorrow at HH:MM" format
|
||||
elif completed.toordinal() > today.toordinal():
|
||||
return "tomorrow"
|
||||
|
||||
# If finishing today, use "today at HH:MM" format
|
||||
else:
|
||||
return "today"
|
||||
|
||||
@pyqtSlot(str)
|
||||
def sendJobToTop(self, print_job_uuid: str) -> None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue