job_status: animated label compute max characters

This commit is contained in:
alfrix 2022-09-22 21:55:02 -03:00
parent 032638e027
commit 72413544c8

View File

@ -837,13 +837,12 @@ class JobStatusPanel(ScreenPanel):
"complete": self.labels['file'].get_label(), "complete": self.labels['file'].get_label(),
"current": self.labels['file'].get_label(), "current": self.labels['file'].get_label(),
"position": 0, "position": 0,
"limit": 24, "limit": 0.8 * (self._gtk.get_content_width() - self.labels[
'darea'].get_allocated_width()) // self._gtk.get_font_size(),
"length": len(self.labels['file'].get_label()) "length": len(self.labels['file'].get_label())
} }
if self.animation_timeout is None: if self.animation_timeout is None and (self.filename_label['length'] - self.filename_label['limit']) > 0:
# if self.labels['file'].is_ellipsized(): <- currently this doesn't work
if (self.filename_label['length'] - self.filename_label['limit']) > 0:
self.animation_timeout = GLib.timeout_add_seconds(1, self.animate_label) self.animation_timeout = GLib.timeout_add_seconds(1, self.animate_label)
self.update_percent_complete() self.update_percent_complete()
self.update_file_metadata() self.update_file_metadata()