How to use the aqt.utils.showWarning function in aqt

To help you get started, we’ve selected a few aqt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github krassowski / Anki-TouchScreen / TouchScreen.py View on Github external
Turn off
    """
    if not ts_profile_loaded:
        showWarning(NM_ERROR_NO_PROFILE)
        return False

    try:
        global ts_state_on
        ts_state_on = False

        mw.reviewer._revHtml = ts_default_review_html

        ts_menu_switch.setChecked(False)
        return True
    except:
        showWarning(NM_ERROR_SWITCH)
        return False
github luoliyan / incremental-reading / ir / importer.py View on Github external
def _createNote(self, title, text, source, priority=None):
        if self.settings['importDeck']:
            deck = mw.col.decks.byName(self.settings['importDeck'])
            if not deck:
                showWarning(
                    'Destination deck no longer exists. '
                    'Please update your settings.'
                )
                return
            did = deck['id']
        else:
            did = mw.col.conf['curDeck']

        model = mw.col.models.byName(self.settings['modelName'])
        note = Note(mw.col, model)
        setField(note, self.settings['titleField'], title)
        setField(note, self.settings['textField'], text)
        setField(note, self.settings['sourceField'], source)
        if priority:
            setField(note, self.settings['prioField'], priority)
        note.model()['did'] = did
github luoliyan / incremental-reading / ir / gui.py View on Github external
if self.extractDeckComboBox.currentText() == '[Current Deck]':
            self.settings['extractDeck'] = None
        else:
            self.settings[
                'extractDeck'
            ] = self.extractDeckComboBox.currentText()

        try:
            self.settings['soonValue'] = int(self.soonValueEditBox.text())
            self.settings['laterValue'] = int(self.laterValueEditBox.text())
            self.settings['extractValue'] = int(
                self.extractValueEditBox.text()
            )
            self.settings['maxWidth'] = int(self.widthEditBox.text())
        except ValueError:
            showWarning('Integer value expected. Please try again.')
            done = False

        if self.importDeckComboBox.currentText() == '[Current Deck]':
            self.settings['importDeck'] = None
        else:
            self.settings['importDeck'] = self.importDeckComboBox.currentText()

        if self.settings['prioEnabled'] != self.prioButton.isChecked():
            self.settings['prioEnabled'] = self.prioButton.isChecked()
            self._addPrioFields()

        if self.soonPercentButton.isChecked():
            self.settings['soonMethod'] = 'percent'
        else:
            self.settings['soonMethod'] = 'count'
github krassowski / Anki-TouchScreen / TouchScreen.py View on Github external
def ts_on():
    """
    Turn on
    """
    if not ts_profile_loaded:
        showWarning(NM_ERROR_NO_PROFILE)
        return False

    global ts_state_on

    try:
        ts_state_on = True
        
        mw.reviewer._revHtml = ts_default_review_html + ts_blackboard + \
        "" + ""
        
        ts_menu_switch.setChecked(True)
        return True
    except:
        showWarning(NM_ERROR_SWITCH)
        return False
github krassowski / Anki-TouchScreen / touchscreen / __init__.py View on Github external
def ts_on():
    """
    Turn on
    """
    if not ts_profile_loaded:
        showWarning(TS_ERROR_NO_PROFILE)
        return False

    global ts_state_on
    ts_state_on = True
    ts_menu_switch.setChecked(True)
    return True
github krassowski / Anki-Night-Mode / Night_Mode.py View on Github external
showWarning(NM_ERROR_NO_PROFILE)
        return False

    try:
        global nm_state_on
        nm_state_on = False

        import aqt.browser
        aqt.browser.COLOUR_MARKED = DEFLAULT_COLOUR_MARKED
        aqt.browser.COLOUR_SUSPENDED = DEFLAULT_COLOUR_SUSPENDED

        nm_append_to_styles()
        nm_menu_switch.setChecked(False)
        return True
    except:
        showWarning(NM_ERROR_SWITCH)
        return False
github krassowski / Anki-Night-Mode / Night_Mode.py View on Github external
def nm_switch():
    """
    Switch night mode.
    """

    # Implementation of "setStyleSheet" method in QT is bugged.
    # At some circumstances it causes a seg fault, without throwing any exceptions.
    # So the switch of mode is not allowed when the problematic dialogs are visible.
    is_active_dialog = filter(bool, [x[1] for x in dialogs._dialogs.values()])

    if appVersion.startswith('2.0') and is_active_dialog:
        info = _("Night mode can not be switched when the dialogs are open")
        showWarning(info)
    else:
        if nm_state_on:
            nm_off()
        else:
            nm_on()
github krassowski / Anki-Night-Mode / Night_Mode.py View on Github external
def nm_off():
    """Turn off night mode."""
    if not nm_profile_loaded:
        showWarning(NM_ERROR_NO_PROFILE)
        return False

    try:
        global nm_state_on
        nm_state_on = False

        import aqt.browser
        aqt.browser.COLOUR_MARKED = DEFLAULT_COLOUR_MARKED
        aqt.browser.COLOUR_SUSPENDED = DEFLAULT_COLOUR_SUSPENDED

        nm_append_to_styles()
        nm_menu_switch.setChecked(False)
        return True
    except:
        showWarning(NM_ERROR_SWITCH)
        return False
github ospalh / anki-addons / quick_replay.py View on Github external
def find_mplayer():
    """
    Try to find mplayer

    Look if we have mplayer. Fix it by adding an .exe on windows first. Clear
    the commands when we don't have one.
    """
    global command_list
    if command_list:
        if isWin:
            command_list[0] += '.exe'
        if not which(command_list[0]):
            # Complain,
            warn_string = u'''Quick replay add-on: Could not find {0} \
                   in path. Please download and install it.'''
            utils.showWarning(warn_string.format(command_list[0]))
            # and clear the list
            command_list = None