Пример #1
0
 def __init__(self, mw: aqt.main.AnkiQt):
     QDialog.__init__(self, mw, Qt.Window)
     mw.setupDialogGC(self)
     self.mw = mw
     self.name = "deckStats"
     self.period = 0
     self.form = aqt.forms.stats.Ui_Dialog()
     self.oldPos = None
     self.wholeCollection = False
     self.setMinimumWidth(700)
     f = self.form
     f.setupUi(self)
     f.groupBox.setVisible(False)
     f.groupBox_2.setVisible(False)
     restoreGeom(self, self.name)
     b = f.buttonBox.addButton(
         tr(TR.STATISTICS_SAVE_PDF), QDialogButtonBox.ActionRole
     )
     qconnect(b.clicked, self.saveImage)
     b.setAutoDefault(False)
     maybeHideClose(self.form.buttonBox)
     addCloseShortcut(self)
     gui_hooks.stats_dialog_will_show(self)
     self.show()
     self.refresh()
     self.activateWindow()
Пример #2
0
 def __init__(self, mw: aqt.main.AnkiQt) -> None:
     QDialog.__init__(self, mw, Qt.Window)
     mw.setupDialogGC(self)
     self.mw = mw
     self.name = "deckStats"
     self.period = 0
     self.form = aqt.forms.stats.Ui_Dialog()
     self.oldPos = None
     self.wholeCollection = False
     self.setMinimumWidth(700)
     disable_help_button(self)
     f = self.form
     if theme_manager.night_mode and not theme_manager.macos_dark_mode():
         # the grouping box renders incorrectly in the fusion theme. 5.9+
         # 5.13 behave differently to 5.14, but it looks bad in either case,
         # and adjusting the top margin makes the 'save PDF' button show in
         # the wrong place, so for now we just disable the border instead
         self.setStyleSheet("QGroupBox { border: 0; }")
     f.setupUi(self)
     restoreGeom(self, self.name)
     b = f.buttonBox.addButton(tr(TR.STATISTICS_SAVE_PDF),
                               QDialogButtonBox.ActionRole)
     qconnect(b.clicked, self.saveImage)
     b.setAutoDefault(False)
     qconnect(f.groups.clicked, lambda: self.changeScope("deck"))
     f.groups.setShortcut("g")
     qconnect(f.all.clicked, lambda: self.changeScope("collection"))
     qconnect(f.month.clicked, lambda: self.changePeriod(0))
     qconnect(f.year.clicked, lambda: self.changePeriod(1))
     qconnect(f.life.clicked, lambda: self.changePeriod(2))
     maybeHideClose(self.form.buttonBox)
     addCloseShortcut(self)
     gui_hooks.stats_dialog_old_will_show(self)
     self.show()
     self.refresh()
     self.activateWindow()