Пример #1
0
    def search(self, widget, data=None):	
	win = self.gld.get_widget("main_win")
	wait_cursor = Cursor(WATCH)
	        
        dlg = search_dialog(self.gld.get_widget("main_win"), self.icon)
	
	def _fork():	    
	    repos_tree = self.gld.get_widget("repos_tree")
	    repos_model = repos_tree.get_model()
	    
	    pacs = self.database.get_by_keywords(keywords)	    
	    if self.search_iter:
		repos_model.remove(self.search_iter)
	    self.search_iter = repos_model.append(None, [_("Search results for '%s'") %keywords])
	    self.models["search"] = search_list(pacs)
	    repos_tree.set_cursor_on_cell((1))
	    
	    dlg.destroy()
	    win.window.set_cursor(None)
	
        if dlg.run() == RESPONSE_ACCEPT:
            keywords = dlg.entry.get_text()
	    if keywords:
		dlg.vbox.set_sensitive(False)
		self._statusbar(_("Searching for %s..." %keywords))
		win.window.set_cursor(wait_cursor)
		dlg.window.set_cursor(wait_cursor)
		gobject.idle_add(_fork)	
	    else:
		dlg.destroy()
		error_dlg = error_dialog(None, _("You should insert at least one keyword to search for"), self.icon)
		error_dlg.run()
		error_dlg.destroy()
	else:
	    dlg.destroy()
Пример #2
0
    def search(self, widget, data=None):
        dlg = search_dialog(self.gld.get_widget("main_win"), self.icon)
        if dlg.run() == RESPONSE_ACCEPT:
            keywords = dlg.entry.get_text()
        dlg.destroy()

        pacs = self.database.get_by_keywords(keywords)
        
        repos_model = self.gld.get_widget("repos_tree").get_model()
        if self.search_iter:
            repos_model.remove(self.search_iter)
        self.search_iter = repos_model.append(None, [_("Search results for '%s'") %keywords])
        self.models["search"] = search_list(pacs)