job_status: fix filename sometimes not scrolling until the end
This commit is contained in:
parent
b091eeff37
commit
fad00227fa
@ -767,22 +767,27 @@ class Panel(ScreenPanel):
|
|||||||
self.filename_label = {
|
self.filename_label = {
|
||||||
"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,
|
"end": 0,
|
||||||
"limit": (self._screen.width * 37 / 480) // (self._gtk.font_size / 11),
|
|
||||||
"length": len(self.labels['file'].get_label())
|
|
||||||
}
|
}
|
||||||
if self.animation_timeout is None and (self.filename_label['length'] - self.filename_label['limit']) > 0:
|
ellipsized = self.labels['file'].get_layout().is_ellipsized()
|
||||||
|
if not self.animation_timeout and ellipsized:
|
||||||
self.animation_timeout = GLib.timeout_add_seconds(1, self.animate_label)
|
self.animation_timeout = GLib.timeout_add_seconds(1, self.animate_label)
|
||||||
|
elif self.animation_timeout:
|
||||||
|
GLib.source_remove(self.animation_timeout)
|
||||||
|
self.animation_timeout = None
|
||||||
self.update_file_metadata()
|
self.update_file_metadata()
|
||||||
|
|
||||||
def animate_label(self):
|
def animate_label(self):
|
||||||
pos = self.filename_label['position']
|
ellipsized = self.labels['file'].get_layout().is_ellipsized()
|
||||||
if pos > (self.filename_label['length'] - self.filename_label['limit']):
|
if ellipsized or self.filename_label['end'] < 3:
|
||||||
self.filename_label['position'] = 0
|
self.filename_label['current'] = self.filename_label['current'][2:]
|
||||||
self.labels['file'].set_label(self.filename_label['complete'])
|
self.labels['file'].set_label(self.filename_label['current'])
|
||||||
|
if not ellipsized:
|
||||||
|
self.filename_label['end'] += 1
|
||||||
else:
|
else:
|
||||||
self.labels['file'].set_label(self.filename_label['current'][pos:self.filename_label['length']])
|
self.filename_label['end'] = 0
|
||||||
self.filename_label['position'] += 1
|
self.filename_label['current'] = self.filename_label['complete']
|
||||||
|
self.labels['file'].set_label(self.filename_label['complete'])
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def update_file_metadata(self):
|
def update_file_metadata(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user