# HG changeset patch # User Laurent Bessard # Date 1341686903 -7200 # Node ID 2a9d4eafadddc40518dd03ea4441d0dc8dc23b10 # Parent bc2e98641bdd7018fa6ed944a375572260661b42 Fix bug no title bar on wx.SingleChoiceDialogs diff -r bc2e98641bdd -r 2a9d4eafaddd PLCOpenEditor.py --- a/PLCOpenEditor.py Sun Jul 01 23:36:44 2012 +0200 +++ b/PLCOpenEditor.py Sat Jul 07 20:48:23 2012 +0200 @@ -346,7 +346,7 @@ split = None for idx, tab in enumerate(tabs): if len(tab["pages"]) == 0: - raise ValueError, "Not possible" + raise ValueError, "Not possible" if tab["size"][0] == rect.width: if tab["pos"][1] == rect.y: split = (wx.TOP, float(tab["size"][1]) / float(rect.height)) @@ -824,17 +824,18 @@ tabs = [] for child in notebook.GetChildren(): if isinstance(child, wx.aui.AuiTabCtrl): - pos = child.GetPosition() - tab = {"pos": (pos.x, pos.y), "pages": []} - tab_size = child.GetSize() - for page_idx in xrange(child.GetPageCount()): - page = child.GetWindowFromIdx(page_idx) - if not tab.has_key("size"): - tab["size"] = (tab_size[0], tab_size[1] + page.GetSize()[1]) - tab_infos = self.GetTabInfos(page) - if tab_infos is not None: - tab["pages"].append((tab_infos, page_idx == child.GetActivePage())) - tabs.append(tab) + if child.GetPageCount() > 0: + pos = child.GetPosition() + tab = {"pos": (pos.x, pos.y), "pages": []} + tab_size = child.GetSize() + for page_idx in xrange(child.GetPageCount()): + page = child.GetWindowFromIdx(page_idx) + if not tab.has_key("size"): + tab["size"] = (tab_size[0], tab_size[1] + page.GetSize()[1]) + tab_infos = self.GetTabInfos(page) + if tab_infos is not None: + tab["pages"].append((tab_infos, page_idx == child.GetActivePage())) + tabs.append(tab) tabs.sort(lambda x, y: cmp(x["pos"], y["pos"])) size = notebook.GetSize() return ComputeTabsLayout(tabs, wx.Rect(1, 1, size[0] - NOTEBOOK_BORDER, size[1] - NOTEBOOK_BORDER)) diff -r bc2e98641bdd -r 2a9d4eafaddd SFCViewer.py --- a/SFCViewer.py Sun Jul 01 23:36:44 2012 +0200 +++ b/SFCViewer.py Sat Jul 07 20:48:23 2012 +0200 @@ -691,7 +691,9 @@ for block in self.Blocks: if isinstance(block, SFC_Step): choices.append(block.GetName()) - dialog = wx.SingleChoiceDialog(self.ParentWindow, _("Add a new jump"), _("Please choose a target"), choices, wx.OK|wx.CANCEL) + dialog = wx.SingleChoiceDialog(self.ParentWindow, + _("Add a new jump"), _("Please choose a target"), + choices, wx.DEFAULT_DIALOG_STYLE|wx.OK|wx.CANCEL) if dialog.ShowModal() == wx.ID_OK: value = dialog.GetStringSelection() self.SelectedElement.AddOutput() diff -r bc2e98641bdd -r 2a9d4eafaddd Viewer.py --- a/Viewer.py Sun Jul 01 23:36:44 2012 +0200 +++ b/Viewer.py Sat Jul 07 20:48:23 2012 +0200 @@ -263,7 +263,10 @@ if pou_type == "program": location = values[0] if not location.startswith("%"): - dialog = wx.SingleChoiceDialog(self.ParentWindow, _("Select a variable class:"), _("Variable class"), ["Input", "Output", "Memory"], wx.OK|wx.CANCEL) + dialog = wx.SingleChoiceDialog(self.ParentWindow, + _("Select a variable class:"), _("Variable class"), + ["Input", "Output", "Memory"], + wx.DEFAULT_DIALOG_STYLE|wx.OK|wx.CANCEL) if dialog.ShowModal() == wx.ID_OK: selected = dialog.GetSelection() else: @@ -2232,7 +2235,9 @@ for block in self.Blocks.itervalues(): if isinstance(block, SFC_Step): choices.append(block.GetName()) - dialog = wx.SingleChoiceDialog(self.ParentWindow, _("Add a new jump"), _("Please choose a target"), choices, wx.OK|wx.CANCEL) + dialog = wx.SingleChoiceDialog(self.ParentWindow, + _("Add a new jump"), _("Please choose a target"), + choices, wx.DEFAULT_DIALOG_STYLE|wx.OK|wx.CANCEL) if dialog.ShowModal() == wx.ID_OK: id = self.GetNewId() value = dialog.GetStringSelection() @@ -2535,7 +2540,9 @@ for block in self.Blocks.itervalues(): if isinstance(block, SFC_Step): choices.append(block.GetName()) - dialog = wx.SingleChoiceDialog(self.ParentWindow, _("Edit jump target"), _("Please choose a target"), choices, wx.OK|wx.CANCEL) + dialog = wx.SingleChoiceDialog(self.ParentWindow, + _("Edit jump target"), _("Please choose a target"), + choices, wx.DEFAULT_DIALOG_STYLE|wx.OK|wx.CANCEL) dialog.SetSelection(choices.index(jump.GetTarget())) if dialog.ShowModal() == wx.ID_OK: value = dialog.GetStringSelection() diff -r bc2e98641bdd -r 2a9d4eafaddd controls/VariablePanel.py --- a/controls/VariablePanel.py Sun Jul 01 23:36:44 2012 +0200 +++ b/controls/VariablePanel.py Sat Jul 07 20:48:23 2012 +0200 @@ -272,7 +272,10 @@ elif base_type not in LOCATIONDATATYPES[location[0]]: message = _("Incompatible size of data between \"%s\" and \"%s\"")%(location, variable_type) else: - dialog = wx.SingleChoiceDialog(self.ParentWindow, _("Select a variable class:"), _("Variable class"), ["Input", "Output", "Memory"], wx.OK|wx.CANCEL) + dialog = wx.SingleChoiceDialog(self.ParentWindow, + _("Select a variable class:"), _("Variable class"), + ["Input", "Output", "Memory"], + wx.DEFAULT_DIALOG_STYLE|wx.OK|wx.CANCEL) if dialog.ShowModal() == wx.ID_OK: selected = dialog.GetSelection() if selected == 0: