def __init__(self, parent, initial_search=None): from calibre.gui2.ui import get_gui db = get_gui().current_db QDialog.__init__(self, parent) Ui_SavedSearchEditor.__init__(self) self.setupUi(self) self.connect(self.add_search_button, SIGNAL('clicked()'), self.add_search) self.connect(self.search_name_box, SIGNAL('currentIndexChanged(int)'), self.current_index_changed) self.connect(self.delete_search_button, SIGNAL('clicked()'), self.del_search) self.rename_button.clicked.connect(self.rename_search) self.current_search_name = None self.searches = {} for name in db.saved_search_names(): self.searches[name] = db.saved_search_lookup(name) self.search_names = set( [icu_lower(n) for n in db.saved_search_names()]) self.populate_search_list() if initial_search is not None and initial_search in self.searches: self.select_search(initial_search)
def __init__(self, parent, initial_search=None): QDialog.__init__(self, parent) Ui_SavedSearchEditor.__init__(self) self.setupUi(self) self.connect(self.add_search_button, SIGNAL('clicked()'), self.add_search) self.connect(self.search_name_box, SIGNAL('currentIndexChanged(int)'), self.current_index_changed) self.connect(self.delete_search_button, SIGNAL('clicked()'), self.del_search) self.rename_button.clicked.connect(self.rename_search) self.current_search_name = None self.searches = {} for name in saved_searches().names(): self.searches[name] = saved_searches().lookup(name) self.search_names = set([icu_lower(n) for n in saved_searches().names()]) self.populate_search_list() if initial_search is not None and initial_search in self.searches: self.select_search(initial_search)
def __init__(self, parent, initial_search=None): from calibre.gui2.ui import get_gui db = get_gui().current_db QDialog.__init__(self, parent) Ui_SavedSearchEditor.__init__(self) self.setupUi(self) self.add_search_button.clicked.connect(self.add_search) self.search_name_box.currentIndexChanged[(int)].connect(self.current_index_changed) self.delete_search_button.clicked.connect(self.del_search) self.rename_button.clicked.connect(self.rename_search) self.current_search_name = None self.searches = {} for name in db.saved_search_names(): self.searches[name] = db.saved_search_lookup(name) self.search_names = set([icu_lower(n) for n in db.saved_search_names()]) self.populate_search_list() if initial_search is not None and initial_search in self.searches: self.select_search(initial_search)