Skip to content
Snippets Groups Projects
Commit 1144bc25103e authored by Cédric Krier's avatar Cédric Krier :atom:
Browse files

Always set a initial timeline width and ensure to use the latest

Otherwise the width is still 0 on the first draw and no space is left to draw
the timeline.

bug24
parent 29a3941b2140
No related branches found
No related tags found
No related merge requests found
...@@ -479,7 +479,6 @@ ...@@ -479,7 +479,6 @@
def draw_events(self): def draw_events(self):
_, _, bound_width, _ = self.get_bounds() _, _, bound_width, _ = self.get_bounds()
timeline_witdh = self._timeline.width
# Clear previous events. # Clear previous events.
for item in self._event_items: for item in self._event_items:
item.remove() item.remove()
...@@ -575,8 +574,8 @@ ...@@ -575,8 +574,8 @@
self._event_items.append(event_item) self._event_items.append(event_item)
self.get_root_item().add_child(event_item, -1) self.get_root_item().add_child(event_item, -1)
if self.view == "day": if self.view == "day":
x_start = timeline_witdh x_start = self._timeline.width
width = bound_width - timeline_witdh width = bound_width - self._timeline.width
else: else:
x_start = day.x x_start = day.x
width = (day.width + 2) * len(week) width = (day.width + 2) * len(week)
...@@ -688,8 +687,8 @@ ...@@ -688,8 +687,8 @@
y_off1 = top_offset_mins * self.minute_height y_off1 = top_offset_mins * self.minute_height
y_off2 = bottom_offset_mins * self.minute_height y_off2 = bottom_offset_mins * self.minute_height
if self.view == "day": if self.view == "day":
x_start = timeline_witdh x_start = self._timeline.width
column_width = (w - timeline_witdh) / parallel column_width = (w - self._timeline.width) / parallel
else: else:
column_width = day.width / parallel column_width = day.width / parallel
x_start = day.x x_start = day.x
...@@ -1314,6 +1313,8 @@ ...@@ -1314,6 +1313,8 @@
if self.x is not None: if self.x is not None:
self.update() self.update()
else:
self._compute_width()
@property @property
def min_line_height(self): def min_line_height(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment