File: SwitcherooInSelection.py

package info (click to toggle)
drpython 1%3A3.11.0-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 2,572 kB
  • ctags: 1,504
  • sloc: python: 16,099; sh: 319; makefile: 39
file content (20 lines) | stat: -rw-r--r-- 710 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#drscript
#Updated to new namespace.

#By Daniel Pozmanter
#Released under the GPL

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