mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2025-12-16 09:40:07 +01:00
Fixes issue #1556
Replaced XXX.keys() calls with idiomatic python 3 calls that are compatible with python 2 such as eg: * replaced "y = xxx.keys()" or "y = list(xxx.keys())" with just "y = list(xxx)" * replaced "sorted(xxx.keys())" or "sorted(list(xxx.keys()))" with just "sorted(xxx)" * replaced "if not A in B.keys():" with "if A not in B:" * replaced "for A in B.keys():" with "for A in B:" See also https://python-future.org/compatible_idioms.html https://python-future.org/compatible_idioms.html#dict-keys-values-items-as-a-list
This commit is contained in:
@@ -106,9 +106,7 @@ class DoodleWindow(wx.Window):
|
||||
def MakeMenu(self):
|
||||
"""Make a menu that can be popped up later"""
|
||||
menu = wx.Menu()
|
||||
keys = list(self.menuColours.keys())
|
||||
keys.sort()
|
||||
for k in keys:
|
||||
for k in sorted(self.menuColours):
|
||||
text = self.menuColours[k]
|
||||
menu.Append(k, text, kind=wx.ITEM_CHECK)
|
||||
self.Bind(wx.EVT_MENU_RANGE, self.OnMenuSetColour, id=100, id2=200)
|
||||
|
||||
@@ -27,7 +27,7 @@ def BB_HitTest(self, event, HitEvent):
|
||||
object_index_list = [] #Create list for holding the indexes
|
||||
xy_p = event.GetPosition()
|
||||
xy = self.PixelToWorld( xy_p ) #Convert to the correct coords
|
||||
for key2 in self.HitDict[HitEvent].keys():
|
||||
for key2 in self.HitDict[HitEvent]:
|
||||
#Get Mouse Event Position
|
||||
bb = self.HitDict[HitEvent][key2].BoundingBox
|
||||
if bb.PointInside(xy):
|
||||
|
||||
@@ -71,7 +71,7 @@ class DrawFrame(wx.Frame):
|
||||
tb = NC.ToolBar
|
||||
# tb.AddSeparator()
|
||||
|
||||
for Group in self.Groups.keys():
|
||||
for Group in self.Groups:
|
||||
Button = wx.Button(tb, wx.ID_ANY, "Remove %s"%Group)
|
||||
tb.AddControl(Button)
|
||||
Button.Bind(wx.EVT_BUTTON, lambda evt, group=Group: self.RemoveGroup(evt, group))
|
||||
|
||||
@@ -71,7 +71,7 @@ class DrawFrame(wx.Frame):
|
||||
tb = NC.ToolBar
|
||||
# tb.AddSeparator()
|
||||
|
||||
for Group in self.Groups.keys():
|
||||
for Group in self.Groups:
|
||||
Button = wx.Button(tb, wx.ID_ANY, "Hide/Show%s"%Group)
|
||||
tb.AddControl(Button)
|
||||
print(Group)
|
||||
|
||||
@@ -77,7 +77,7 @@ class DrawFrame(wx.Frame):
|
||||
wx.lib.colourdb.updateColourDB()
|
||||
self.colors = wx.lib.colourdb.getColourList()
|
||||
|
||||
self.LineStyles = FloatCanvas.DrawObject.LineStyleList.keys()
|
||||
self.LineStyles = list(FloatCanvas.DrawObject.LineStyleList)
|
||||
|
||||
return None
|
||||
|
||||
|
||||
@@ -539,6 +539,6 @@ ctrl_buttons = {} # Button widgets for command (NE) panel
|
||||
app = wx.App(False)
|
||||
MyFrame()
|
||||
if verbose:
|
||||
print_('spin_panels', spin_panels.keys())
|
||||
print_('ctrl_buttons', ctrl_buttons.keys())
|
||||
print_('spin_panels', list(spin_panels))
|
||||
print_('ctrl_buttons', list(ctrl_buttons))
|
||||
app.MainLoop()
|
||||
|
||||
Reference in New Issue
Block a user