Fixed interpretation of last_hour

This commit is contained in:
Maximilian Giller 2019-04-09 13:37:39 +02:00
parent b82bfa2aa7
commit e6fa543406
2 changed files with 5 additions and 4 deletions

View file

@ -94,11 +94,12 @@ class DayViewPanel (PanelDesign):
def __get_current_hour_range__(self):
start_hour = datetime.now().hour
additional_hours = self.shownhours_count - 1
if start_hour + self.shownhours_count > 23:
start_hour = 23 - self.shownhours_count
if start_hour + additional_hours > 23:
start_hour = 23 - additional_hours
return start_hour, start_hour + self.shownhours_count
return start_hour, start_hour + additional_hours
def __abs_co__ (self, coordinates):
return (int(coordinates[0] * self.size[0]),int(coordinates[1] * self.size[1]))

View file

@ -36,7 +36,7 @@ class HourListDesign (DesignEntity):
self.__draw_current_time_line__()
def __calc_parameters__ (self):
self.hour_count = self.last_hour - self.first_hour
self.hour_count = self.last_hour - self.first_hour + 1
self.row_size = (self.size[0], self.size[1] / self.hour_count)
def __get_hour_text__ (self, hour):