File: ReplaceAllInSelection.py

package info (click to toggle)
drpython 161-3.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,588 kB
  • ctags: 1,470
  • sloc: python: 15,817; sh: 358; makefile: 43
file content (14 lines) | stat: -rw-r--r-- 458 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#drscript

#By Daniel Pozmanter
#Released under the GPL

target = ""
newtext = ""
d = wx.TextEntryDialog(DrFrame, "Replace What?:", "Replace All In Selection", "")
if (d.ShowModal() == wx.ID_OK):
	target = d.GetValue()
	d = wx.TextEntryDialog(DrFrame, ("Replace " + target +  " With:"), "Replace All In Selection", "")
	if (d.ShowModal() == wx.ID_OK):
		newtext = d.GetValue()
DrDocument.SetSelectedText(DrDocument.GetSelectedText().replace(target, newtext))