make About and Find dialogs have the same icon as main Beremiz window
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Wed, 20 Apr 2016 17:30:16 +0300
changeset 1490 f03bc6c9c146
parent 1489 9c22ff9c8c06
child 1491 f3c26ebce488
make About and Find dialogs have the same icon as main Beremiz window

all child windows will take the parent's icon, if no other is specified.
Beremiz.py
IDEFrame.py
dialogs/FindInPouDialog.py
docutil/dochtml.py
--- a/Beremiz.py	Wed Apr 20 17:15:35 2016 +0300
+++ b/Beremiz.py	Wed Apr 20 17:30:16 2016 +0300
@@ -459,6 +459,9 @@
         self.SetStatusBar(self.ConnectionStatusBar)
 
     def __init__(self, parent, projectOpen=None, buildpath=None, ctr=None, debug=True):
+        # Add beremiz's icon in top left corner of the frame
+        self.icon = wx.Icon(Bpath("images", "brz.ico"), wx.BITMAP_TYPE_ICO)
+        
         IDEFrame.__init__(self, parent, debug)
         self.Log = LogPseudoFile(self.LogConsole,self.SelectTab)
 
@@ -487,9 +490,6 @@
             ("Extension", ITEM_CONFNODE)]:
             self.TreeImageDict[itemtype] = self.TreeImageList.Add(GetBitmap(imgname))
 
-        # Add beremiz's icon in top left corner of the frame
-        self.SetIcon(wx.Icon(Bpath("images", "brz.ico"), wx.BITMAP_TYPE_ICO))
-
         if projectOpen is not None:
             projectOpen = DecodeFileSystemPath(projectOpen, False)
 
--- a/IDEFrame.py	Wed Apr 20 17:15:35 2016 +0300
+++ b/IDEFrame.py	Wed Apr 20 17:30:16 2016 +0300
@@ -444,10 +444,17 @@
         self._init_coll_DisplayMenu_Items(self.DisplayMenu)
         self._init_coll_HelpMenu_Items(self.HelpMenu)
 
+    def _init_icon(self, parent):
+        if self.icon:
+            self.SetIcon(self.icon)                            
+        elif parent and parent.icon:
+            self.SetIcon(parent.icon)                
+        
     def _init_ctrls(self, prnt):
         wx.Frame.__init__(self, id=ID_PLCOPENEDITOR, name='IDEFrame',
               parent=prnt, pos=wx.DefaultPosition, size=wx.Size(1000, 600),
               style=wx.DEFAULT_FRAME_STYLE)
+        self._init_icon(prnt)
         self.SetClientSize(wx.Size(1000, 600))
         self.Bind(wx.EVT_ACTIVATE, self.OnActivated)
 
--- a/dialogs/FindInPouDialog.py	Wed Apr 20 17:15:35 2016 +0300
+++ b/dialogs/FindInPouDialog.py	Wed Apr 20 17:30:16 2016 +0300
@@ -26,6 +26,11 @@
 
 class FindInPouDialog(wx.Frame):
 
+    def _init_icon(self, parent):
+        if parent and parent.icon:
+                self.SetIcon(parent.icon)
+
+    
     def __init__(self, parent):
         wx.Frame.__init__(self, parent, title=_("Find"), 
               size=wx.Size(400, 250), style=wx.CAPTION|
@@ -34,6 +39,7 @@
                                             wx.RESIZE_BORDER|
                                             wx.STAY_ON_TOP)
         
+        self._init_icon(parent)
         panel = wx.Panel(self, style=wx.TAB_TRAVERSAL)
         
         main_sizer = wx.FlexGridSizer(cols=1, hgap=5, rows=2, vgap=5)
@@ -101,7 +107,7 @@
         self.Bind(wx.EVT_BUTTON, self.OnFindButton, self.FindButton)
         buttons_sizer.AddWindow(self.FindButton, border=5, flag=wx.RIGHT)
         
-        self.CloseButton = wx.Button(panel, label=("Close"))
+        self.CloseButton = wx.Button(panel, label=_("Close"))
         self.Bind(wx.EVT_BUTTON, self.OnCloseButton, self.CloseButton)
         buttons_sizer.AddWindow(self.CloseButton)
         
--- a/docutil/dochtml.py	Wed Apr 20 17:15:35 2016 +0300
+++ b/docutil/dochtml.py	Wed Apr 20 17:30:16 2016 +0300
@@ -63,6 +63,7 @@
             wx.Frame.__init__(self, id=ID_HTMLFRAME, name='HtmlFrame',
                   parent=prnt, pos=wx.Point(320, 231), size=wx.Size(853, 616),
                   style=wx.DEFAULT_FRAME_STYLE, title='')
+            self.SetIcon(prnt.icon)
             self.Bind(wx.EVT_CLOSE, self.OnCloseFrame)
             
             self.HtmlContent = UrlClickHtmlWindow(id=ID_HTMLFRAMEHTMLCONTENT,