diff --git a/src/fastwq/lang.py b/src/fastwq/lang.py index 01612b0..f45103d 100644 --- a/src/fastwq/lang.py +++ b/src/fastwq/lang.py @@ -62,6 +62,7 @@ arr = [ ['SETTINGS', u'参数', u'Settings'], ['THREAD_NUMBER', u'线程数', u'Thread Number'], ['INITLIZING_DICT', u'初始化词典...', u'Initlizing Dictionary...'], + ['PLS_SET_DICTIONARY_FIELDS', u'请设置字典和字段', u'Please set dictionary and fields.'], ['BRE_PRON', u'英式发音', u'British Pronunciation'], ['AME_PRON', u'美式发音', u'American Pronunciation'], diff --git a/src/fastwq/query.py b/src/fastwq/query.py index 6fceb44..fa62086 100644 --- a/src/fastwq/query.py +++ b/src/fastwq/query.py @@ -198,16 +198,18 @@ def query_from_browser(browser): for note_id in browser.selectedNotes()] if len(notes) == 1: + tooltip(_('PLS_SET_DICTIONARY_FIELDS')) maps = config.get_maps(browser.editor.note.model()['id']) nomaps = True for each in maps: dict_unique = each.get('dict_unique', '').strip() - if dict_unique: + ignore = each.get('ignore', True) + if dict_unique and not ignore: nomaps = False break if nomaps: from .ui import show_options - show_options(browser) + show_options(browser, query_from_browser, browser) else: query_from_editor_all_fields(browser.editor) else: diff --git a/src/fastwq/ui.py b/src/fastwq/ui.py index 2ebdd27..9dff8f2 100644 --- a/src/fastwq/ui.py +++ b/src/fastwq/ui.py @@ -20,6 +20,7 @@ import os import sys import json +import types from collections import namedtuple import anki @@ -43,13 +44,13 @@ __all__ = ['WIDGET_SIZE', 'Dialog', 'ParasDialog', class WIDGET_SIZE: - dialog_width = 650 + dialog_width = 700 dialog_height_margin = 120 map_min_height = 0 map_max_height = 31 map_fld_width = 100 - map_dictname_width = 130 - map_dictfield_width = 130 + map_dictname_width = 150 + map_dictfield_width = 160 class Dialog(QtGui.QDialog): @@ -482,8 +483,8 @@ class OptionsDialog(Dialog): ) ignore, skip = ( - kwargs.get('ignore', False), #忽略标志 - kwargs.get('skip_valued', False), #略过有值项标志 + kwargs.get('ignore', True), #忽略标志 + kwargs.get('skip_valued', True), #略过有值项标志 ) # check word_check_btn = QtGui.QRadioButton(fld_name) @@ -614,7 +615,7 @@ def check_updates(): pass -def show_options(browser = None): +def show_options(browser = None, callback = None, *args, **kwargs): '''open options window''' parent = mw if browser is None else browser config.read() @@ -622,6 +623,8 @@ def show_options(browser = None): opt_dialog.activateWindow() opt_dialog.raise_() opt_dialog.exec_() + if isinstance(callback, types.FunctionType): + callback(*args, **kwargs) def show_fm_dialog(browser = None):