Quote:
Originally Posted by thiago.eec
I'm sorry you having issues. I can't replicate the bug.If you have any more info, I would love to debug this
|
I figured out that the issue is somewhere/within the navigationRequest handling:
Code:
self.browser.page().navigationRequested.connect(self.daily_pages_columns)
I replaced the navigationRequested with buttons, and this works. E.g. this:
Code:
class ReadingGoalStatisticsDialog(Dialog):
def setup_ui(self) -> None:
# ...
self.change_view_menu.addItem(get_icon('genre_view.png'), _('By genre'))
self.daily_button_jan = QPushButton(_('Jan'))
self.h_layout.addWidget(self.daily_button_jan, 0, Qt.AlignRight)
self.daily_button_jan.clicked.connect(lambda: self.on_daily_button('jan'))
self.h_layout.addWidget(self.change_view_menu, 0, Qt.AlignRight)
# ...
# ...
def on_daily_button(self, month) -> None:
# this is basically daily_pages_columns with only the part in len(url) == 3 and url replaced with month
daily_page_count = self.daily_page_count()
daily_data = [[_('Days'), _('Pages')]]
temp_daily_data = []
for day in daily_page_count[month]:
temp_daily_data.append([str(day), daily_page_count[month][day]])
for item in temp_daily_data:
daily_data.append(item)
h_axis_title = _('Days')
v_axis_title = _('Pages')
previous_button = _('Previous')
next_button = _('Next')
main_title = month.upper()
background_color = '#121212' if is_dark_theme() else '#ffffff'
text_color = '#ddd' if is_dark_theme() else '#000000'
_daily_html_column = daily_html_column
formated_daily_html_column = _daily_html_column.format(daily_data, background_color, text_color,
h_axis_title, v_axis_title, main_title,
previous_button, next_button)
self.browser.page().setHtml(formated_daily_html_column)
self.month_name = deepcopy(month).lower()
self.months = [x.lower() for x in daily_page_count.keys()]
self.year_menu.setFocus()
Though the question is why the navigationRequest connect function leads to this issue of calibre just closing.
Any idea?