Merge branch 'ui_rework_4_0' into STAR-322_cloud-connection

* ui_rework_4_0:
  Ensure that reset always correctly gets set to basic
  Remove semi-colon
  Simplify preview icon logic
  Always return a string for preview icon
  Update USBPrinting version to 1.0.1
  Fix module importing in USBPrinting
  When toggling auto-slice, force a re-slice
  Fix multi-argument i18n string
  Improve printer status handling
  Make "finishes at" single translatable string
  Improve exposed progress prop
  Simplify logic slightly
  Handle idle, unavailable, and unreachable states
  Improve printer status and progress bar
  Improve date rendering
  Add some typings
  Move isActive and timeRemaining logic from QML to Python
This commit is contained in:
ChrisTerBeke 2018-12-04 21:30:24 +01:00
commit 467d347008
No known key found for this signature in database
GPG key ID: A49F1AB9D7E0C263
10 changed files with 169 additions and 99 deletions

View file

@ -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: