def initializeHotkey(): """ Create toggle action if it does not exist, yet, and assign it the hotkey defined in the user config """ toggle_action = getattr(mw, "_hmToggleAction", None) if toggle_action is None: toggle_action = QAction(mw, triggered=toggleHeatmap) mw.addAction(toggle_action) mw._hmToggleAction = toggle_action hotkey = config["profile"]["hotkeys"]["toggle"] toggle_action.setShortcut(QKeySequence(hotkey))
maybeHideClose(self.form.buttonBox) addCloseShortcut(self) self.refresh() self.show() # show instead of exec in order for browser to open properly ### Hooks and wraps ### # Set up menus and hooks options_action = QAction("Review &Heatmap Options...", mw) options_action.triggered.connect(lambda _, o=mw: on_heatmap_settings(o)) mw.form.menuTools.addAction(options_action) toggle_action = QAction(mw, triggered=toggle_heatmap) toggle_action.setShortcut(QKeySequence(_("Ctrl+R"))) mw.addAction(toggle_action) # Stats calculation and rendering CollectionStats.report_activity = report_activity CollectionStats.dueGraph = wrap(CollectionStats.dueGraph, my_reps_graph, "around") DeckStats.__init__ = my_statswindow_init Overview._renderPage = my_render_page_ov DeckBrowser._renderStats = wrap(DeckBrowser._renderStats, add_heatmap_db, "around") # Custom link handler and finder Overview._linkHandler = wrap(Overview._linkHandler, my_link_handler, "around") DeckBrowser._linkHandler = wrap(DeckBrowser._linkHandler, my_link_handler, "around") DeckStats._linkHandler = my_link_handler