dialogs/FindInPouDialog.py
changeset 1618 474de7fdcfd9
parent 1571 486f94a8032c
child 1620 3bffe3bd8d78
equal deleted inserted replaced
1617:3f3d97be9a9f 1618:474de7fdcfd9
    23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    24 
    24 
    25 import wx
    25 import wx
    26 from plcopen.plcopen import *
    26 from plcopen.plcopen import *
    27 
    27 
    28 class FindInPouDialog(wx.Frame):
    28 class FindInPouDialog(wx.Dialog):
    29 
    29 
    30     def _init_icon(self, parent):
    30     def _init_icon(self, parent):
    31         if parent and parent.icon:
    31         if parent and parent.icon:
    32                 self.SetIcon(parent.icon)
    32                 self.SetIcon(parent.icon)
    33 
    33 
    34     
    34     
    35     def __init__(self, parent):
    35     def __init__(self, parent):
    36         wx.Frame.__init__(self, parent, title=_("Find"), 
    36         wx.Dialog.__init__(self, parent, title=_("Find"),         
    37               size=wx.Size(410, 250), style=wx.CAPTION|
    37               size=wx.Size(500, 280), style=wx.CAPTION|
    38                                             wx.CLOSE_BOX|
    38                                             wx.CLOSE_BOX|
    39                                             wx.CLIP_CHILDREN|
    39                                             wx.CLIP_CHILDREN|
    40                                             wx.RESIZE_BORDER|
    40                                             wx.RESIZE_BORDER)
    41                                             wx.STAY_ON_TOP)
       
    42         
    41         
    43         self._init_icon(parent)
    42         self._init_icon(parent)
    44         self.CreateStatusBar(style=wx.SB_FLAT)
       
    45         panel = wx.Panel(self, style=wx.TAB_TRAVERSAL)
    43         panel = wx.Panel(self, style=wx.TAB_TRAVERSAL)
    46         
    44         
    47         main_sizer = wx.FlexGridSizer(cols=1, hgap=5, rows=2, vgap=5)
    45         main_sizer = wx.FlexGridSizer(cols=1, hgap=5, rows=2, vgap=5)
    48         main_sizer.AddGrowableCol(0)
    46         main_sizer.AddGrowableCol(0)
    49         main_sizer.AddGrowableRow(0)
    47         main_sizer.AddGrowableRow(0)
   111         buttons_sizer.AddWindow(self.FindButton, border=5, flag=wx.RIGHT)
   109         buttons_sizer.AddWindow(self.FindButton, border=5, flag=wx.RIGHT)
   112         
   110         
   113         self.CloseButton = wx.Button(panel, label=_("Close"))
   111         self.CloseButton = wx.Button(panel, label=_("Close"))
   114         self.Bind(wx.EVT_BUTTON, self.OnCloseButton, self.CloseButton)
   112         self.Bind(wx.EVT_BUTTON, self.OnCloseButton, self.CloseButton)
   115         buttons_sizer.AddWindow(self.CloseButton)
   113         buttons_sizer.AddWindow(self.CloseButton)
       
   114 
       
   115         self.StatusLabel = wx.StaticText(panel, label= "")
       
   116         controls_sizer.AddWindow(self.StatusLabel, flag=wx.ALIGN_CENTER_VERTICAL)
   116         
   117         
   117         panel.SetSizer(main_sizer)
   118         panel.SetSizer(main_sizer)
   118         
   119         
   119         self.ParentWindow = parent
   120         self.ParentWindow = parent
   120         
   121         
   145 
   146 
   146     def OnFindPatternChanged(self, event):
   147     def OnFindPatternChanged(self, event):
   147         self.RefreshButtonsState()
   148         self.RefreshButtonsState()
   148         event.Skip()
   149         event.Skip()
   149 
   150 
       
   151     def SetStatusText(self, msg):
       
   152         self.StatusLabel.SetLabel(msg)
       
   153         self.Layout()
       
   154         
   150     def OnFindButton(self, event):
   155     def OnFindButton(self, event):
   151         infos = {
   156         infos = {
   152             "find_pattern": self.FindPattern.GetValue(),
   157             "find_pattern": self.FindPattern.GetValue(),
   153             "wrap": self.WrapSearch.GetValue(),
   158             "wrap": self.WrapSearch.GetValue(),
   154             "case_sensitive": self.CaseSensitive.GetValue(),
   159             "case_sensitive": self.CaseSensitive.GetValue(),