144
145
## user text assigned to a variable
145
147
text = entry.get_text()
148
user_input = text.split(' ')
146
150
## The destroy method must be called otherwise the 'Close' button will
151
155
def responseToDialog(self, text, dialog, response):
152
156
dialog.response(response)
327
331
def _filter_commands(self, widget, data=None):
328
332
"""Show commands matching a given search term.
330
333
The user should enter a term in the search box and the treeview should
331
334
only display the rows which contain the search term.
332
335
Pretty straight-forward.
364
367
widget = self.notebook.get_nth_page(pagenum)
365
368
page_widget = widget.get_child()
367
cmnd = CMNDS[row_int] ## CMNDS is where commands are stored
370
## CMNDS is where commands are stored
371
cmnd = CMNDS[row_int]
372
## find how many @(user arguments) are in command
373
match = re.findall('@', cmnd)
374
#print match ## debug
375
#match_group = match.group()
378
Make sure user arguments were found. Replace @ with something
379
.format can read. This is done so the user can just enter @, when
380
adding a command where arguments are needed, instead
381
of {0[1]}, {0[1]}, {0[2]}
388
new_cmnd = self.replace(cmnd, num, ran)
389
print new_cmnd ## debug
368
391
if not self.liststore[row_int][1] == " ": # command with user input
369
392
text = Companion.get_info(self, text)
370
page_widget.feed_child(cmnd+" "+text+"\n") #send command w/ input
395
c = new_cmnd.format(text)
397
page_widget.feed_child(c+"\n") #send command w/ input
371
398
page_widget.show()
372
399
else: ## command that has no user input
373
400
page_widget.feed_child(cmnd+"\n") #send command
374
401
page_widget.show()
375
402
page_widget.grab_focus()
404
## replace @ with {0[n]}
405
def replace(self, cmnd, num, ran):
406
replace_cmnd=re.sub('@', '{0['+str(ran)+']}', cmnd, count=1)
410
return self.replace(cmnd, num, ran)
377
419
## open the man page for selected command
378
420
def man_page(self, widget, data=None):
379
421
row_int = int(ROW[0][0]) # removes everything but number from EX: [5,]