bug fixes.

This commit is contained in:
St.Huang 2019-01-27 09:46:54 +08:00
parent 25146a36ea
commit 65630908f9
11 changed files with 69 additions and 69 deletions

View File

@ -47,7 +47,7 @@ def start_here():
fastwq.browser_menu() fastwq.browser_menu()
fastwq.context_menu() fastwq.context_menu()
fastwq.customize_addcards() fastwq.customize_addcards()
if fastwq.config.auto_update: # if fastwq.config.auto_update:
fastwq.check_updates(True) # fastwq.check_updates(True)
addHook("profileLoaded", start_here) addHook("profileLoaded", start_here)

View File

@ -23,7 +23,7 @@ from .lang import _
__all__ = ['VERSION', 'Endpoint', 'Template'] __all__ = ['VERSION', 'Endpoint', 'Template']
VERSION = 'v1.3.4' VERSION = 'v1.3.5'
class Endpoint: class Endpoint:
repository = u'https://github.com/sth2018/FastWordQuery' repository = u'https://github.com/sth2018/FastWordQuery'

View File

@ -31,22 +31,22 @@ from ..constants import Endpoint, Template
from ..service import service_manager, service_pool from ..service import service_manager, service_pool
__all__ = ['show_options', 'check_updates', 'show_fm_dialog', 'show_about_dialog'] __all__ = ['show_options', 'show_fm_dialog', 'show_about_dialog'] #'check_updates',
def check_updates(background=False, parent=None): # def check_updates(background=False, parent=None):
'''check add-on last version''' # '''check add-on last version'''
try: # try:
parent = mw if parent is None else parent # parent = mw if parent is None else parent
state = ankihub.update([Endpoint.check_version], Endpoint.version, background, parent) # state = ankihub.update([Endpoint.check_version], Endpoint.version, background, parent)
if not background: # if not background:
if state == 0: # if state == 0:
showInfo(_('LATEST_VERSION')) # showInfo(_('LATEST_VERSION'))
elif state == -1: # elif state == -1:
showInfo(_('CHECK_FAILURE')) # showInfo(_('CHECK_FAILURE'))
except: # except:
if not background: # if not background:
showInfo(_('CHECK_FAILURE')) # showInfo(_('CHECK_FAILURE'))
def show_fm_dialog(browser = None): def show_fm_dialog(browser = None):

View File

@ -157,8 +157,8 @@ class OptionsDialog(Dialog):
about_btn = QPushButton(_('ABOUT')) about_btn = QPushButton(_('ABOUT'))
about_btn.clicked.connect(self.show_about) about_btn.clicked.connect(self.show_about)
# about_btn.clicked.connect(self.show_paras) # about_btn.clicked.connect(self.show_paras)
chk_update_btn = QPushButton(_('UPDATE')) # chk_update_btn = QPushButton(_('UPDATE'))
chk_update_btn.clicked.connect(self.check_updates) # chk_update_btn.clicked.connect(self.check_updates)
home_label = QLabel( home_label = QLabel(
'<a href="{url}">User Guide</a>'.format(url=Endpoint.user_guide) '<a href="{url}">User Guide</a>'.format(url=Endpoint.user_guide)
) )
@ -167,7 +167,7 @@ class OptionsDialog(Dialog):
btnbox = QDialogButtonBox(QDialogButtonBox.Ok, Qt.Horizontal, self) btnbox = QDialogButtonBox(QDialogButtonBox.Ok, Qt.Horizontal, self)
btnbox.accepted.connect(self.accept) btnbox.accepted.connect(self.accept)
bottom_layout.addWidget(paras_btn) bottom_layout.addWidget(paras_btn)
bottom_layout.addWidget(chk_update_btn) # bottom_layout.addWidget(chk_update_btn)
bottom_layout.addWidget(about_btn) bottom_layout.addWidget(about_btn)
bottom_layout.addWidget(home_label) bottom_layout.addWidget(home_label)
bottom_layout.addWidget(btnbox) bottom_layout.addWidget(btnbox)
@ -189,10 +189,10 @@ class OptionsDialog(Dialog):
dialog.exec_() dialog.exec_()
dialog.destroy() dialog.destroy()
def check_updates(self): # def check_updates(self):
'''check addon version''' # '''check addon version'''
from .common import check_updates # from .common import check_updates
check_updates(parent=self) # check_updates(parent=self)
def show_fm_dialog(self): def show_fm_dialog(self):
'''open folder manager dialog''' '''open folder manager dialog'''

View File

@ -36,7 +36,7 @@ class SettingDialog(Dialog):
self.setFixedWidth(400) self.setFixedWidth(400)
self.check_force_update = None self.check_force_update = None
self.check_ignore_accents = None self.check_ignore_accents = None
self.check_auto_update = None # self.check_auto_update = None
self.input_thread_number = None self.input_thread_number = None
self.build() self.build()
@ -53,10 +53,10 @@ class SettingDialog(Dialog):
layout.addWidget(check_ignore_accents) layout.addWidget(check_ignore_accents)
layout.addSpacing(10) layout.addSpacing(10)
check_auto_update = QCheckBox(_("AUTO_UPDATE")) # check_auto_update = QCheckBox(_("AUTO_UPDATE"))
check_auto_update.setChecked(config.auto_update) # check_auto_update.setChecked(config.auto_update)
layout.addWidget(check_auto_update) # layout.addWidget(check_auto_update)
layout.addSpacing(10) # layout.addSpacing(10)
check_ighore_mdx_wordcase = QCheckBox(_("IGNORE_MDX_WORDCASE")) check_ighore_mdx_wordcase = QCheckBox(_("IGNORE_MDX_WORDCASE"))
check_ighore_mdx_wordcase.setChecked(config.ignore_mdx_wordcase) check_ighore_mdx_wordcase.setChecked(config.ignore_mdx_wordcase)
@ -93,7 +93,7 @@ class SettingDialog(Dialog):
self.check_force_update = check_force_update self.check_force_update = check_force_update
self.check_ignore_accents = check_ignore_accents self.check_ignore_accents = check_ignore_accents
self.check_auto_update = check_auto_update # self.check_auto_update = check_auto_update
self.check_ighore_mdx_wordcase = check_ighore_mdx_wordcase self.check_ighore_mdx_wordcase = check_ighore_mdx_wordcase
self.input_thread_number = input_thread_number self.input_thread_number = input_thread_number
self.input_cloze_str = input_cloze_str self.input_cloze_str = input_cloze_str
@ -109,7 +109,7 @@ class SettingDialog(Dialog):
data = { data = {
'force_update': self.check_force_update.isChecked(), 'force_update': self.check_force_update.isChecked(),
'ignore_accents': self.check_ignore_accents.isChecked(), 'ignore_accents': self.check_ignore_accents.isChecked(),
'auto_update': self.check_auto_update.isChecked(), # 'auto_update': self.check_auto_update.isChecked(),
'ignore_mdx_wordcase': self.check_ighore_mdx_wordcase.isChecked(), 'ignore_mdx_wordcase': self.check_ighore_mdx_wordcase.isChecked(),
'thread_number': self.input_thread_number.value(), 'thread_number': self.input_thread_number.value(),
'cloze_str': self.input_cloze_str.text() 'cloze_str': self.input_cloze_str.text()

View File

@ -42,7 +42,7 @@ def start_here():
fastwq.browser_menu() fastwq.browser_menu()
fastwq.context_menu() fastwq.context_menu()
fastwq.customize_addcards() fastwq.customize_addcards()
if fastwq.config.auto_update: # if fastwq.config.auto_update:
fastwq.check_updates(True) # fastwq.check_updates(True)
addHook("profileLoaded", start_here) addHook("profileLoaded", start_here)

View File

@ -23,7 +23,7 @@ from aqt.qt import *
from anki.hooks import addHook, wrap, remHook from anki.hooks import addHook, wrap, remHook
from aqt.addcards import AddCards from aqt.addcards import AddCards
from aqt.utils import showInfo, shortcut, downArrow from aqt.utils import showInfo, shortcut, downArrow
from .gui import show_options, show_about_dialog, check_updates from .gui import show_options, show_about_dialog #, check_updates
from .query import query_from_browser, query_from_editor_fields from .query import query_from_browser, query_from_editor_fields
from .context import config, APP_ICON, Config from .context import config, APP_ICON, Config
from .lang import _ from .lang import _
@ -33,8 +33,8 @@ from .utils import get_icon
__all__ = [ __all__ = [
'browser_menu', 'customize_addcards', 'browser_menu', 'customize_addcards',
'config_menu', 'check_updates', 'context_menu' 'config_menu', 'context_menu'
] ] # 'check_updates',
have_setup = False have_setup = False
@ -107,10 +107,10 @@ def browser_menu():
if b: if b:
menu.addSeparator() menu.addSeparator()
# check update # # check update
action = QAction(_('CHECK_UPDATE'), browser) # action = QAction(_('CHECK_UPDATE'), browser)
action.triggered.connect(lambda: check_updates(background=False, parent=browser)) # action.triggered.connect(lambda: check_updates(background=False, parent=browser))
menu.addAction(action) # menu.addAction(action)
# About # About
action = QAction(_('ABOUT'), browser) action = QAction(_('ABOUT'), browser)

View File

@ -23,7 +23,7 @@ from .lang import _
__all__ = ['VERSION', 'Endpoint', 'Template'] __all__ = ['VERSION', 'Endpoint', 'Template']
VERSION = 'v1.3.4' VERSION = 'v1.3.5'
class Endpoint: class Endpoint:
repository = u'https://github.com/sth2018/FastWordQuery' repository = u'https://github.com/sth2018/FastWordQuery'

View File

@ -31,22 +31,22 @@ from ..constants import Endpoint, Template
from ..service import service_manager, service_pool from ..service import service_manager, service_pool
__all__ = ['show_options', 'check_updates', 'show_fm_dialog', 'show_about_dialog'] __all__ = ['show_options', 'show_fm_dialog', 'show_about_dialog'] #'check_updates',
def check_updates(background=False, parent=None): # def check_updates(background=False, parent=None):
'''check add-on last version''' # '''check add-on last version'''
try: # try:
parent = mw if parent is None else parent # parent = mw if parent is None else parent
state = ankihub.update([Endpoint.check_version], Endpoint.version, background, parent) # state = ankihub.update([Endpoint.check_version], Endpoint.version, background, parent)
if not background: # if not background:
if state == 0: # if state == 0:
showInfo(_('LATEST_VERSION')) # showInfo(_('LATEST_VERSION'))
elif state == -1: # elif state == -1:
showInfo(_('CHECK_FAILURE')) # showInfo(_('CHECK_FAILURE'))
except: # except:
if not background: # if not background:
showInfo(_('CHECK_FAILURE')) # showInfo(_('CHECK_FAILURE'))
def show_fm_dialog(browser = None): def show_fm_dialog(browser = None):

View File

@ -157,8 +157,8 @@ class OptionsDialog(Dialog):
about_btn = QPushButton(_('ABOUT')) about_btn = QPushButton(_('ABOUT'))
about_btn.clicked.connect(self.show_about) about_btn.clicked.connect(self.show_about)
# about_btn.clicked.connect(self.show_paras) # about_btn.clicked.connect(self.show_paras)
chk_update_btn = QPushButton(_('UPDATE')) # chk_update_btn = QPushButton(_('UPDATE'))
chk_update_btn.clicked.connect(self.check_updates) # chk_update_btn.clicked.connect(self.check_updates)
home_label = QLabel( home_label = QLabel(
'<a href="{url}">User Guide</a>'.format(url=Endpoint.user_guide) '<a href="{url}">User Guide</a>'.format(url=Endpoint.user_guide)
) )
@ -167,7 +167,7 @@ class OptionsDialog(Dialog):
btnbox = QDialogButtonBox(QDialogButtonBox.Ok, Qt.Horizontal, self) btnbox = QDialogButtonBox(QDialogButtonBox.Ok, Qt.Horizontal, self)
btnbox.accepted.connect(self.accept) btnbox.accepted.connect(self.accept)
bottom_layout.addWidget(paras_btn) bottom_layout.addWidget(paras_btn)
bottom_layout.addWidget(chk_update_btn) # bottom_layout.addWidget(chk_update_btn)
bottom_layout.addWidget(about_btn) bottom_layout.addWidget(about_btn)
bottom_layout.addWidget(home_label) bottom_layout.addWidget(home_label)
bottom_layout.addWidget(btnbox) bottom_layout.addWidget(btnbox)
@ -189,10 +189,10 @@ class OptionsDialog(Dialog):
dialog.exec_() dialog.exec_()
dialog.destroy() dialog.destroy()
def check_updates(self): # def check_updates(self):
'''check addon version''' # '''check addon version'''
from .common import check_updates # from .common import check_updates
check_updates(parent=self) # check_updates(parent=self)
def show_fm_dialog(self): def show_fm_dialog(self):
'''open folder manager dialog''' '''open folder manager dialog'''

View File

@ -36,7 +36,7 @@ class SettingDialog(Dialog):
self.setFixedWidth(400) self.setFixedWidth(400)
self.check_force_update = None self.check_force_update = None
self.check_ignore_accents = None self.check_ignore_accents = None
self.check_auto_update = None # self.check_auto_update = None
self.input_thread_number = None self.input_thread_number = None
self.build() self.build()
@ -53,10 +53,10 @@ class SettingDialog(Dialog):
layout.addWidget(check_ignore_accents) layout.addWidget(check_ignore_accents)
layout.addSpacing(10) layout.addSpacing(10)
check_auto_update = QCheckBox(_("AUTO_UPDATE")) # check_auto_update = QCheckBox(_("AUTO_UPDATE"))
check_auto_update.setChecked(config.auto_update) # check_auto_update.setChecked(config.auto_update)
layout.addWidget(check_auto_update) # layout.addWidget(check_auto_update)
layout.addSpacing(10) # layout.addSpacing(10)
check_ighore_mdx_wordcase = QCheckBox(_("IGNORE_MDX_WORDCASE")) check_ighore_mdx_wordcase = QCheckBox(_("IGNORE_MDX_WORDCASE"))
check_ighore_mdx_wordcase.setChecked(config.ignore_mdx_wordcase) check_ighore_mdx_wordcase.setChecked(config.ignore_mdx_wordcase)
@ -93,7 +93,7 @@ class SettingDialog(Dialog):
self.check_force_update = check_force_update self.check_force_update = check_force_update
self.check_ignore_accents = check_ignore_accents self.check_ignore_accents = check_ignore_accents
self.check_auto_update = check_auto_update # self.check_auto_update = check_auto_update
self.check_ighore_mdx_wordcase = check_ighore_mdx_wordcase self.check_ighore_mdx_wordcase = check_ighore_mdx_wordcase
self.input_thread_number = input_thread_number self.input_thread_number = input_thread_number
self.input_cloze_str = input_cloze_str self.input_cloze_str = input_cloze_str
@ -109,7 +109,7 @@ class SettingDialog(Dialog):
data = { data = {
'force_update': self.check_force_update.isChecked(), 'force_update': self.check_force_update.isChecked(),
'ignore_accents': self.check_ignore_accents.isChecked(), 'ignore_accents': self.check_ignore_accents.isChecked(),
'auto_update': self.check_auto_update.isChecked(), # 'auto_update': self.check_auto_update.isChecked(),
'ignore_mdx_wordcase': self.check_ighore_mdx_wordcase.isChecked(), 'ignore_mdx_wordcase': self.check_ighore_mdx_wordcase.isChecked(),
'thread_number': self.input_thread_number.value(), 'thread_number': self.input_thread_number.value(),
'cloze_str': self.input_cloze_str.text() 'cloze_str': self.input_cloze_str.text()