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