Files
Phoenix/demo/agw/UltimateListCtrl.py
Per A. Brodtkorb 033c18fd9f 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
2020-03-20 18:51:19 +01:00

81 lines
2.0 KiB
Python

#!/usr/bin/env python
import wx
import os
import sys
try:
dirName = os.path.dirname(os.path.abspath(__file__))
except:
dirName = os.path.dirname(os.path.abspath(sys.argv[0]))
sys.path.append(os.path.split(dirName)[0])
try:
from agw import ultimatelistctrl as ULC
except ImportError: # if it's not there locally, try the wxPython lib.
from wx.lib.agw import ultimatelistctrl as ULC
#---------------------------------------------------------------------------
buttonDefs = {
814 : ('UltimateReportDemo', ' wx.LC_REPORT style '),
815 : ('UltimateVirtualDemo', ' wx.LC_VIRTUAL style '),
816 : ('UltimateListIconDemo', ' wx.LC_ICON style '),
817 : ('UltimateListListDemo', ' wx.LC_LIST style '),
818 : ('Windows7Explorer_Contents', ' Windows 7 Explorer "Contents" style'),
819 : ('MacLargeDemo', ' Torrent Style :-D')
}
class ButtonPanel(wx.Panel):
def __init__(self, parent, log):
wx.Panel.__init__(self, parent, -1)
self.log = log
box = wx.BoxSizer(wx.VERTICAL)
box.Add((20, 20))
keys = sorted(buttonDefs)
for k in keys:
text = buttonDefs[k][1]
btn = wx.Button(self, k, text)
box.Add(btn, 0, wx.ALIGN_CENTER|wx.ALL, 10)
self.Bind(wx.EVT_BUTTON, self.OnButton, btn)
self.SetSizer(box)
box.Fit(self)
def OnButton(self, event):
event.Skip()
wx.BeginBusyCursor()
modName = buttonDefs[event.GetId()][0]
module = __import__(modName)
frame = module.TestFrame(None, self.log)
wx.EndBusyCursor()
#---------------------------------------------------------------------------
def runTest(frame, nb, log):
win = ButtonPanel(nb, log)
return win
#---------------------------------------------------------------------------
overview = ULC.__doc__
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])