comparison frontends/src/primitivus/primitivus @ 1225:82dabb442e2e

frontends (primitivus): new command :search <pattern>
author souliane <souliane@mailoo.org>
date Sat, 04 Oct 2014 10:26:10 +0200
parents 9cc858acae91
children e3a9ea76de35
comparison
equal deleted inserted replaced
1224:f0c9b149ed99 1225:82dabb442e2e
16 16
17 # You should have received a copy of the GNU Affero General Public License 17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 19
20 20
21 from sat.core.i18n import _ 21 from sat.core.i18n import _, D_
22 from sat_frontends.primitivus.constants import Const as C 22 from sat_frontends.primitivus.constants import Const as C
23 from sat.core import log_config 23 from sat.core import log_config
24 log_config.satConfigure(C.LOG_BACKEND_STANDARD, C) 24 log_config.satConfigure(C.LOG_BACKEND_STANDARD, C)
25 from sat.core import log as logging 25 from sat.core import log as logging
26 log = logging.getLogger(__name__) 26 log = logging.getLogger(__name__)
143 limit = 50 143 limit = 50
144 win = self.app.chat_wins[JID(self.app.contact_list.selected).bare] 144 win = self.app.chat_wins[JID(self.app.contact_list.selected).bare]
145 win.clearHistory() 145 win.clearHistory()
146 if limit > 0: 146 if limit > 0:
147 win.historyPrint(size=limit, profile=self.app.profile) 147 win.historyPrint(size=limit, profile=self.app.profile)
148 elif command == 'search':
149 pattern = " ".join(args)
150 if not pattern:
151 self.app.notif_bar.addMessage(D_("Please specify the globbing pattern to search for"))
152 win = self.app.chat_wins[JID(self.app.contact_list.selected).bare]
153 win.clearHistory()
154 win.printInfo(D_("Results for searching the globbing pattern: %s") % pattern, timestamp=0)
155 win.historyPrint(size=C.HISTORY_LIMIT_NONE, search=pattern, profile=self.app.profile)
156 win.printInfo(D_("Type ':history <lines>' to reset the chat history"))
148 else: 157 else:
149 return 158 return
150 self.set_edit_text('') 159 self.set_edit_text('')
151 160
152 def _historyCb(self, text): 161 def _historyCb(self, text):