-
Notifications
You must be signed in to change notification settings - Fork 98
/
storysearchframes.py
63 lines (52 loc) · 2.29 KB
/
storysearchframes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import wx
from searchpanels import FindPanel, ReplacePanel
class StoryFindFrame(wx.Frame):
"""
This allows the user to search a StoryPanel for a string of text.
This is just a front-end to method calls on StoryPanel.
"""
def __init__(self, storyPanel, app, parent = None):
self.storyPanel = storyPanel
self.app = app
wx.Frame.__init__(self, parent, wx.ID_ANY, title = 'Find in Story', \
style = wx.MINIMIZE_BOX | wx.CLOSE_BOX | wx.CAPTION | wx.SYSTEM_MENU)
sizer = wx.BoxSizer(wx.VERTICAL)
self.SetSizer(sizer)
findPanel = FindPanel(parent = self, onFind = self.onFind, onClose = self.onClose)
findPanel.focus()
sizer.Add(findPanel)
sizer.Fit(self)
self.SetIcon(self.app.icon)
self.Show()
def onFind(self, regexp, flags):
self.storyPanel.findWidgetRegexp(regexp, flags)
def onClose(self):
self.Close()
class StoryReplaceFrame(wx.Frame):
"""
This allows the user to replace text across an entire StoryPanel.
This is just a front-end to method calls on StoryPanel.
"""
def __init__(self, storyPanel, app, parent = None):
self.storyPanel = storyPanel
self.app = app
wx.Frame.__init__(self, parent, wx.ID_ANY, title = 'Replace Across Entire Story', \
style = wx.MINIMIZE_BOX | wx.CLOSE_BOX | wx.CAPTION | wx.SYSTEM_MENU)
sizer = wx.BoxSizer(wx.VERTICAL)
self.SetSizer(sizer)
replacePanel = ReplacePanel(self, allowIncremental = True, \
onFind=self.onFind, onReplace=self.onReplace, \
onReplaceAll = self.onReplaceAll, onClose = self.onClose)
sizer.Add(replacePanel)
replacePanel.focus()
sizer.Fit(self)
self.SetIcon(self.app.icon)
self.Show()
def onFind(self, regexp, flags):
self.storyPanel.findWidgetRegexp(regexp, flags)
def onReplace(self, findRegexp, flags, replaceRegexp):
self.storyPanel.replaceRegexpInSelectedWidget(findRegexp, replaceRegexp, flags)
def onReplaceAll(self, findRegexp, flags, replaceRegexp):
self.storyPanel.replaceRegexpInWidgets(findRegexp, replaceRegexp, flags)
def onClose(self):
self.Close()