diff --git a/Container.py b/Container.py index a8a4b72a..8f39e888 100644 --- a/Container.py +++ b/Container.py @@ -1779,7 +1779,7 @@ def OnPaint(self, event): # Initialize the wx.BufferedPaintDC, assigning a background # colour and a foreground colour (to draw the text) backColour = self.GetBackgroundColour() - backBrush = wx.Brush(backColour, wx.PENSTYLE_SOLID) + backBrush = wx.Brush(backColour, wx.BRUSHSTYLE_SOLID) pdc.SetBackground(backBrush) pdc.Clear() @@ -2531,48 +2531,50 @@ def DiagramModified(self): from window where modifications are performed to DEVSimPy main window. """ - if self.diagram.modify: - ### window where modification is performed - win = self.GetTopLevelParent() - - if isinstance(win, DetachedFrame): - ### main window - mainW = wx.GetApp().GetTopWindow() + if not self.diagram.modify: + return - if not isinstance(mainW, DetachedFrame): - nb2 = mainW.GetDiagramNotebook() - s = nb2.GetSelection() - canvas = nb2.GetPage(s) - diagram = canvas.GetDiagram() - ### modifying propagation - diagram.modify = True - ### update general shapes - canvas.UpdateShapes() + ### window where modification is performed + win = self.GetTopLevelParent() - label = nb2.GetPageText(s) + if isinstance(win, DetachedFrame): + ### main window + mainW = wx.GetApp().GetTopWindow() - ### modified windows dictionary - D = {win.GetTitle(): win, label: mainW} - else: - D={} - else: - nb2 = win.GetDiagramNotebook() + if not isinstance(mainW, DetachedFrame) and hasattr(mainW, 'GetDiagramNotebook'): + nb2 = mainW.GetDiagramNotebook() s = nb2.GetSelection() canvas = nb2.GetPage(s) diagram = canvas.GetDiagram() + ### modifying propagation diagram.modify = True + ### update general shapes + canvas.UpdateShapes() + label = nb2.GetPageText(s) - D = {label : win} + ### modified windows dictionary + D = {win.GetTitle(): win, label: mainW} + else: + D={} + else: + nb2 = win.GetDiagramNotebook() + s = nb2.GetSelection() + canvas = nb2.GetPage(s) + diagram = canvas.GetDiagram() + diagram.modify = True + label = nb2.GetPageText(s) + + D = {label : win} - #nb.SetPageText(nb.GetSelection(), "*%s"%label.replace('*','')) + #nb.SetPageText(nb.GetSelection(), "*%s"%label.replace('*','')) - ### statusbar printing - for string,win in list(D.items()): - printOnStatusBar(win.statusbar, {0:"%s %s"%(string ,_("modified")), 1:os.path.basename(diagram.last_name_saved), 2:''}) + ### statusbar printing + for string,win in list(D.items()): + printOnStatusBar(win.statusbar, {0:"%s %s"%(string ,_("modified")), 1:os.path.basename(diagram.last_name_saved), 2:''}) - tb = win.GetToolBar() - tb.EnableTool(Menu.ID_SAVE, self.diagram.modify) + tb = win.GetToolBar() + tb.EnableTool(Menu.ID_SAVE, self.diagram.modify) ### def OnMotion(self, event): diff --git a/Menu.py b/Menu.py index 20992078..0cbe33a1 100644 --- a/Menu.py +++ b/Menu.py @@ -37,7 +37,7 @@ import gettext _ = gettext.gettext -if wx.VERSION_STRING > '4.0.1': wx.NewId = wx.NewIdRef +if wx.VERSION_STRING > '4.0.1': wx.NewId = wx.ID_ANY #File menu identifiers ID_NEW = wx.ID_NEW diff --git a/PropertiesGridCtrl.py b/PropertiesGridCtrl.py index 3e7006a0..814155d2 100644 --- a/PropertiesGridCtrl.py +++ b/PropertiesGridCtrl.py @@ -319,7 +319,7 @@ def Draw(self, grid, attr, dc, rect, row, col, isSelected): fg = attr.GetTextColour() dc.SetTextBackground(bg) dc.SetTextForeground(fg) - dc.SetBrush(wx.Brush(bg, wx.PENSTYLE_SOLID)) + dc.SetBrush(wx.Brush(bg, wx.BRUSHSTYLE_SOLID)) dc.SetPen(wx.TRANSPARENT_PEN) dc.DrawRectangleRect(rect) if wx.VERSION_STRING < '4.0' else wx.DC.DrawRectangle(dc, rect) grid.DrawTextRectangle(dc, text, rect, hAlign, vAlign) @@ -497,7 +497,7 @@ def GetAttr(self, row, col, kind): #attr.SetBackgroundColour("light blue") elif col == 2: attr.SetReadOnly(True) - attr.SetFont(wx.Font(10, wx.FONTFAMILY_SWISS, wx.FONTFAMILY_ITALIC, wx.FONTWEIGHT_NORMAL)) + attr.SetFont(wx.Font(10, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_ITALIC, wx.FONTWEIGHT_NORMAL)) else: ### load color in cell for pen and fill if isinstance(val, list):