Example #1
0
    def __init__(self, parent, passageFrame, app, initialState = 0):
        self.passageFrame = passageFrame
        self.app = app
        wx.Frame.__init__(self, parent, title = 'Find/Replace In Passage')
        panel = wx.Panel(self)
        panelSizer = wx.BoxSizer(wx.VERTICAL)
        panel.SetSizer(panelSizer)

        self.notebook = wx.Notebook(panel)
        self.findPanel = FindPanel(self.notebook, onFind = self.passageFrame.findRegexp, \
                                   onClose = lambda: self.Close())
        self.replacePanel = ReplacePanel(self.notebook, onFind = self.passageFrame.findRegexp, \
                                         onReplace = self.passageFrame.replaceOneRegexp, \
                                         onReplaceAll = self.passageFrame.replaceAllRegexps, \
                                         onClose = lambda: self.Close())
        self.notebook.AddPage(self.findPanel, 'Find')
        self.notebook.AddPage(self.replacePanel, 'Replace')
        self.notebook.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.onChangeTab)

        self.notebook.ChangeSelection(initialState)
        if initialState == PassageSearchFrame.FIND_TAB:
            self.findPanel.focus()
        else:
            self.replacePanel.focus()

        panelSizer.Add(self.notebook, 1, wx.EXPAND)
        panelSizer.Fit(self)
        self.SetIcon(self.app.icon)
        self.Show()
Example #2
0
    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()
Example #3
0
class PassageSearchFrame(wx.Frame):
    """
    This allows a user to do search and replaces on a PassageFrame.
    By default, this shows the Find tab initially, but this can be
    set via the constructor.
    """

    def __init__(self, parent, passageFrame, app, initialState = 0):
        self.passageFrame = passageFrame
        self.app = app
        wx.Frame.__init__(self, parent, title = 'Find/Replace In Passage')
        panel = wx.Panel(self)
        panelSizer = wx.BoxSizer(wx.VERTICAL)
        panel.SetSizer(panelSizer)

        self.notebook = wx.Notebook(panel)
        self.findPanel = FindPanel(self.notebook, onFind = self.passageFrame.findRegexp, \
                                   onClose = lambda: self.Close())
        self.replacePanel = ReplacePanel(self.notebook, onFind = self.passageFrame.findRegexp, \
                                         onReplace = self.passageFrame.replaceOneRegexp, \
                                         onReplaceAll = self.passageFrame.replaceAllRegexps, \
                                         onClose = lambda: self.Close())
        self.notebook.AddPage(self.findPanel, 'Find')
        self.notebook.AddPage(self.replacePanel, 'Replace')
        self.notebook.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.onChangeTab)

        self.notebook.ChangeSelection(initialState)
        if initialState == PassageSearchFrame.FIND_TAB:
            self.findPanel.focus()
        else:
            self.replacePanel.focus()

        panelSizer.Add(self.notebook, 1, wx.EXPAND)
        panelSizer.Fit(self)
        self.SetIcon(self.app.icon)
        self.Show()

    def onChangeTab(self, event):
        if event.GetSelection() == PassageSearchFrame.FIND_TAB:
            self.findPanel.focus()
        else:
            self.replacePanel.focus()

        # for some reason, we have to manually propagate the event from here

        event.Skip(True)

    FIND_TAB = 0
    REPLACE_TAB = 1
Example #4
0
class PassageSearchFrame(wx.Frame):
    """
    This allows a user to do search and replaces on a PassageFrame.
    By default, this shows the Find tab initially, but this can be
    set via the constructor.
    """

    def __init__(self, parent, passageFrame, app, initialState = 0):
        self.passageFrame = passageFrame
        self.app = app
        wx.Frame.__init__(self, parent, title = 'Find/Replace In Passage')
        panel = wx.Panel(self)
        panelSizer = wx.BoxSizer(wx.VERTICAL)
        panel.SetSizer(panelSizer)

        self.notebook = wx.Notebook(panel)
        self.findPanel = FindPanel(self.notebook, onFind = self.passageFrame.findRegexp, \
                                   onClose = self.Close)
        self.replacePanel = ReplacePanel(self.notebook, onFind = self.passageFrame.findRegexp, \
                                         onReplace = self.passageFrame.replaceOneRegexp, \
                                         onReplaceAll = self.passageFrame.replaceAllRegexps, \
                                         onClose = self.Close)
        self.notebook.AddPage(self.findPanel, 'Find')
        self.notebook.AddPage(self.replacePanel, 'Replace')
        self.notebook.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.onChangeTab)

        self.notebook.ChangeSelection(initialState)
        if initialState == PassageSearchFrame.FIND_TAB:
            self.findPanel.focus()
        else:
            self.replacePanel.focus()

        panelSizer.Add(self.notebook, 1, wx.EXPAND)
        panelSizer.Fit(self)
        self.SetIcon(self.app.icon)
        self.Show()

    def onChangeTab(self, event):
        if event.GetSelection() == PassageSearchFrame.FIND_TAB:
            self.findPanel.focus()
        else:
            self.replacePanel.focus()

        # for some reason, we have to manually propagate the event from here

        event.Skip(True)

    FIND_TAB = 0
    REPLACE_TAB = 1
Example #5
0
    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 = False, \
                                    onReplaceAll = self.onReplaceAll, onClose = self.onClose)
        sizer.Add(replacePanel)
        replacePanel.focus()

        sizer.Fit(self)
        self.SetIcon(self.app.icon)
        self.Show()
 def __init__ (self, parent, passageFrame, app, initialState = 0):
     self.passageFrame = passageFrame
     self.app = app
     wx.Frame.__init__(self, parent, title = 'Find/Replace In Passage')
     panel = wx.Panel(self)
     panelSizer = wx.BoxSizer(wx.VERTICAL)
     panel.SetSizer(panelSizer)
             
     self.notebook = wx.Notebook(panel)
     self.findPanel = FindPanel(self.notebook, onFind = self.passageFrame.findRegexp, \
                                onClose = lambda: self.Close())
     self.replacePanel = ReplacePanel(self.notebook, onFind = self.passageFrame.findRegexp, \
                                      onReplace = self.passageFrame.replaceOneRegexp, \
                                      onReplaceAll = self.passageFrame.replaceAllRegexps, \
                                      onClose = lambda: self.Close())
     self.notebook.AddPage(self.findPanel, 'Find')
     self.notebook.AddPage(self.replacePanel, 'Replace')
     self.notebook.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.onChangeTab)
     
     self.notebook.ChangeSelection(initialState)
     if initialState == PassageSearchFrame.FIND_TAB:
         self.findPanel.focus()
     else:
         self.replacePanel.focus()
     
     panelSizer.Add(self.notebook, 1, wx.EXPAND)
     panelSizer.Fit(self)
     self.SetIcon(self.app.icon)
     self.Show()