Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed easy issues with some demos to get them working again. #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions demo/CheckListCtrlMixin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env python

import sys
import wx
from wx.lib.mixins.listctrl import CheckListCtrlMixin

Expand Down Expand Up @@ -46,8 +45,8 @@ def __init__(self, parent, log):
self.list.InsertColumn(1, "Title", wx.LIST_FORMAT_RIGHT)
self.list.InsertColumn(2, "Genre")

for key, data in musicdata.iteritems():
index = self.list.InsertStringItem(sys.maxint, data[0])
for key, data in musicdata.items():
index = self.list.InsertStringItem(self.list.GetItemCount(), data[0])
self.list.SetItem(index, 1, data[1])
self.list.SetItem(index, 2, data[2])
self.list.SetItemData(index, key)
Expand Down
4 changes: 1 addition & 3 deletions demo/DVC_ListCtrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@

# Reuse the music data in the ListCtrl sample
import ListCtrl
musicdata = ListCtrl.musicdata.items()
musicdata.sort()
musicdata = [[str(k)] + list(v) for k,v in musicdata]
musicdata = [[str(k)] + list(v) for k,v in sorted(ListCtrl.musicdata.items())]


class TestPanel(wx.Panel):
Expand Down
4 changes: 2 additions & 2 deletions demo/GridBagSizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ def OnLeftDown(self, evt):
pt = evt.GetPosition()
item = self.gbs.FindItemAtPoint(pt)
if item is None:
print("no item at", `pt`)
print("no item at", pt)
else:
print("item found: ", `item.GetPos()`, "--", `item.GetSpan()`)
print("item found: ", item.GetPos(), "--", item.GetSpan())


#---------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion demo/ListCtrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def PopulateList(self):

items = musicdata.items()
for key, data in items:
index = self.list.InsertItem(sys.maxsize, data[0], self.idx1)
index = self.list.InsertItem(self.list.GetItemCount(), data[0], self.idx1)
self.list.SetItem(index, 1, data[1])
self.list.SetItem(index, 2, data[2])
self.list.SetItemData(index, key)
Expand Down
2 changes: 1 addition & 1 deletion demo/ListCtrl_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def Populate(self):

items = listctrldata.items()
for key, data in items:
index = self.InsertItem(sys.maxint, data[0])
index = self.InsertItem(self.GetItemCount(), data[0])
self.SetItem(index, 1, data[1])
self.SetItem(index, 2, data[2])
self.SetItemData(index, key)
Expand Down
2 changes: 1 addition & 1 deletion demo/MediaCtrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class StaticText(wx.StaticText):
updated very frequently otherwise.
"""
def SetLabel(self, label):
if label <> self.GetLabel():
if label != self.GetLabel():
wx.StaticText.SetLabel(self, label)

#----------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions demo/Sizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,13 @@ def makeGrid1(win):
#----------------------------------------------------------------------

def makeGrid2(win):
gs = wx.GridSizer(3, 3) # rows, cols, vgap, hgap
gs = wx.GridSizer(rows=3, cols=3, vgap=0, hgap=0)

box = wx.BoxSizer(wx.VERTICAL)
box.Add(SampleWindow(win, 'A'), 0, wx.EXPAND)
box.Add(SampleWindow(win, 'B'), 1, wx.EXPAND)

gs2 = wx.GridSizer(2,2, 4, 4)
gs2 = wx.GridSizer(2, 2, 4, 4)
gs2.AddMany([ (SampleWindow(win, 'C'), 0, wx.EXPAND),
(SampleWindow(win, 'E'), 0, wx.EXPAND),
(SampleWindow(win, 'F'), 0, wx.EXPAND),
Expand Down
4 changes: 1 addition & 3 deletions demo/TablePrint.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ def __init__(self, parent, log, frame):

box = wx.BoxSizer(wx.VERTICAL)
box.Add((20, 30))
keys = buttonDefs.keys()
keys.sort()

for k in keys:
for k in sorted(buttonDefs.keys()):
text = buttonDefs[k][1]
btn = wx.Button(self, k, text)
box.Add(btn, 0, wx.ALIGN_CENTER|wx.ALL, 15)
Expand Down
2 changes: 1 addition & 1 deletion demo/Throbber.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def __init__(self, parent, log):
)

sizer.Add(
wx.StaticText(self, -1, 'with custom & manual sequences'),
wx.StaticText(self, -1, 'with custom and manual sequences'),
(row, 1), flag = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT
)

Expand Down
2 changes: 1 addition & 1 deletion demo/Toolbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(self, parent, id, log):
first = True
for colour in colourList:
win = self.makeColorPanel(colour)
self.AddPage(win, colour, imageId=imageIdGenerator.next())
self.AddPage(win, colour, imageId=next(imageIdGenerator))
if first:
st = wx.StaticText(win.win, -1,
"You can put nearly any type of window here,\n"
Expand Down
4 changes: 2 additions & 2 deletions demo/Treebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(self, parent, id, log):
first = True
for colour in colourList:
win = self.makeColorPanel(colour)
self.AddPage(win, colour, imageId=imageIdGenerator.next())
self.AddPage(win, colour, imageId=next(imageIdGenerator))
if first:
st = wx.StaticText(win.win, -1,
"You can put nearly any type of window here,\n"
Expand All @@ -56,7 +56,7 @@ def __init__(self, parent, id, log):

win = self.makeColorPanel(colour)
st = wx.StaticText(win.win, -1, "this is a sub-page", (10,10))
self.AddSubPage(win, 'a sub-page', imageId=imageIdGenerator.next())
self.AddSubPage(win, 'a sub-page', imageId=next(imageIdGenerator))

self.Bind(wx.EVT_TREEBOOK_PAGE_CHANGED, self.OnPageChanged)
self.Bind(wx.EVT_TREEBOOK_PAGE_CHANGING, self.OnPageChanging)
Expand Down
8 changes: 6 additions & 2 deletions demo/VListBox.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,19 @@ def OnCellMouseHover(self, event):
self.log.WriteText('OnCellMouseHover: %s\n' % (cell))
if isinstance(cell, html.HtmlWordCell):
sel = html.HtmlSelection()
self.log.WriteText(' %s\n' % cell.ConvertToText(sel))
# BUG: ConvertToText() doesn't exist yet.
# self.log.WriteText(' %s\n' % cell.ConvertToText(sel))
self.log.WriteText(' %s\n' % sel)
event.Skip()

def OnCellClicked(self, event):
cell = event.GetCell()
self.log.WriteText('OnCellClicked: %s\n' % (cell))
if isinstance(cell, html.HtmlWordCell):
sel = html.HtmlSelection()
self.log.WriteText(' %s\n' % cell.ConvertToText(sel))
# BUG: ConvertToText() doesn't exist yet.
# self.log.WriteText(' %s\n' % cell.ConvertToText(sel))
self.log.WriteText(' %s\n' % sel)
event.Skip()

#----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion demo/Validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def OnChar(self, event):
event.Skip()
return

if self.flag == ALPHA_ONLY and chr(key) in string.letters:
if self.flag == ALPHA_ONLY and chr(key) in string.ascii_letters:
event.Skip()
return

Expand Down
30 changes: 15 additions & 15 deletions demo/agw/AUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ def __init__(self, parent, frame):
s1.Add(wx.StaticText(self, -1, "Pane Border Size:"))
s1.Add(self._border_size)
s1.Add((1, 1), 1, wx.EXPAND)
s1.SetItemMinSize(1, (180, 20))
s1.SetItemMinSize(index=1, size=(180, 20))

s2 = wx.BoxSizer(wx.HORIZONTAL)
self._sash_size = wx.SpinCtrl(self, ID_SashSize, "%d"%frame.GetDockArt().GetMetric(aui.AUI_DOCKART_SASH_SIZE), wx.DefaultPosition,
Expand All @@ -450,7 +450,7 @@ def __init__(self, parent, frame):
s2.Add(wx.StaticText(self, -1, "Sash Size:"))
s2.Add(self._sash_size)
s2.Add((1, 1), 1, wx.EXPAND)
s2.SetItemMinSize(1, (180, 20))
s2.SetItemMinSize(index=1, size=(180, 20))

s3 = wx.BoxSizer(wx.HORIZONTAL)
self._caption_size = wx.SpinCtrl(self, ID_CaptionSize, "%d"%frame.GetDockArt().GetMetric(aui.AUI_DOCKART_CAPTION_SIZE),
Expand All @@ -459,7 +459,7 @@ def __init__(self, parent, frame):
s3.Add(wx.StaticText(self, -1, "Caption Size:"))
s3.Add(self._caption_size)
s3.Add((1, 1), 1, wx.EXPAND)
s3.SetItemMinSize(1, (180, 20))
s3.SetItemMinSize(index=1, size=(180, 20))

b = self.CreateColourBitmap(wx.BLACK)

Expand All @@ -469,95 +469,95 @@ def __init__(self, parent, frame):
s4.Add(wx.StaticText(self, -1, "Background Colour:"))
s4.Add(self._background_colour)
s4.Add((1, 1), 1, wx.EXPAND)
s4.SetItemMinSize(1, (180, 20))
s4.SetItemMinSize(index=1, size=(180, 20))

s5 = wx.BoxSizer(wx.HORIZONTAL)
self._sash_colour = wx.BitmapButton(self, ID_SashColour, b, wx.DefaultPosition, wx.Size(50, 25))
s5.Add((1, 1), 1, wx.EXPAND)
s5.Add(wx.StaticText(self, -1, "Sash Colour:"))
s5.Add(self._sash_colour)
s5.Add((1, 1), 1, wx.EXPAND)
s5.SetItemMinSize(1, (180, 20))
s5.SetItemMinSize(index=1, size=(180, 20))

s6 = wx.BoxSizer(wx.HORIZONTAL)
self._inactive_caption_colour = wx.BitmapButton(self, ID_InactiveCaptionColour, b, wx.DefaultPosition, wx.Size(50, 25))
s6.Add((1, 1), 1, wx.EXPAND)
s6.Add(wx.StaticText(self, -1, "Normal Caption:"))
s6.Add(self._inactive_caption_colour)
s6.Add((1, 1), 1, wx.EXPAND)
s6.SetItemMinSize(1, (180, 20))
s6.SetItemMinSize(index=1, size=(180, 20))

s7 = wx.BoxSizer(wx.HORIZONTAL)
self._inactive_caption_gradient_colour = wx.BitmapButton(self, ID_InactiveCaptionGradientColour, b, wx.DefaultPosition, wx.Size(50, 25))
s7.Add((1, 1), 1, wx.EXPAND)
s7.Add(wx.StaticText(self, -1, "Normal Caption Gradient:"))
s7.Add(self._inactive_caption_gradient_colour)
s7.Add((1, 1), 1, wx.EXPAND)
s7.SetItemMinSize(1, (180, 20))
s7.SetItemMinSize(index=1, size=(180, 20))

s8 = wx.BoxSizer(wx.HORIZONTAL)
self._inactive_caption_text_colour = wx.BitmapButton(self, ID_InactiveCaptionTextColour, b, wx.DefaultPosition, wx.Size(50, 25))
s8.Add((1, 1), 1, wx.EXPAND)
s8.Add(wx.StaticText(self, -1, "Normal Caption Text:"))
s8.Add(self._inactive_caption_text_colour)
s8.Add((1, 1), 1, wx.EXPAND)
s8.SetItemMinSize(1, (180, 20))
s8.SetItemMinSize(index=1, size=(180, 20))

s9 = wx.BoxSizer(wx.HORIZONTAL)
self._active_caption_colour = wx.BitmapButton(self, ID_ActiveCaptionColour, b, wx.DefaultPosition, wx.Size(50, 25))
s9.Add((1, 1), 1, wx.EXPAND)
s9.Add(wx.StaticText(self, -1, "Active Caption:"))
s9.Add(self._active_caption_colour)
s9.Add((1, 1), 1, wx.EXPAND)
s9.SetItemMinSize(1, (180, 20))
s9.SetItemMinSize(index=1, size=(180, 20))

s10 = wx.BoxSizer(wx.HORIZONTAL)
self._active_caption_gradient_colour = wx.BitmapButton(self, ID_ActiveCaptionGradientColour, b, wx.DefaultPosition, wx.Size(50, 25))
s10.Add((1, 1), 1, wx.EXPAND)
s10.Add(wx.StaticText(self, -1, "Active Caption Gradient:"))
s10.Add(self._active_caption_gradient_colour)
s10.Add((1, 1), 1, wx.EXPAND)
s10.SetItemMinSize(1, (180, 20))
s10.SetItemMinSize(index=1, size=(180, 20))

s11 = wx.BoxSizer(wx.HORIZONTAL)
self._active_caption_text_colour = wx.BitmapButton(self, ID_ActiveCaptionTextColour, b, wx.DefaultPosition, wx.Size(50, 25))
s11.Add((1, 1), 1, wx.EXPAND)
s11.Add(wx.StaticText(self, -1, "Active Caption Text:"))
s11.Add(self._active_caption_text_colour)
s11.Add((1, 1), 1, wx.EXPAND)
s11.SetItemMinSize(1, (180, 20))
s11.SetItemMinSize(index=1, size=(180, 20))

s12 = wx.BoxSizer(wx.HORIZONTAL)
self._border_colour = wx.BitmapButton(self, ID_BorderColour, b, wx.DefaultPosition, wx.Size(50, 25))
s12.Add((1, 1), 1, wx.EXPAND)
s12.Add(wx.StaticText(self, -1, "Border Colour:"))
s12.Add(self._border_colour)
s12.Add((1, 1), 1, wx.EXPAND)
s12.SetItemMinSize(1, (180, 20))
s12.SetItemMinSize(index=1, size=(180, 20))

s13 = wx.BoxSizer(wx.HORIZONTAL)
self._gripper_colour = wx.BitmapButton(self, ID_GripperColour, b, wx.DefaultPosition, wx.Size(50,25))
s13.Add((1, 1), 1, wx.EXPAND)
s13.Add(wx.StaticText(self, -1, "Gripper Colour:"))
s13.Add(self._gripper_colour)
s13.Add((1, 1), 1, wx.EXPAND)
s13.SetItemMinSize(1, (180, 20))
s13.SetItemMinSize(index=1, size=(180, 20))

s14 = wx.BoxSizer(wx.HORIZONTAL)
self._sash_grip = wx.CheckBox(self, ID_SashGrip, "", wx.DefaultPosition, wx.Size(50,20))
s14.Add((1, 1), 1, wx.EXPAND)
s14.Add(wx.StaticText(self, -1, "Draw Sash Grip:"))
s14.Add(self._sash_grip)
s14.Add((1, 1), 1, wx.EXPAND)
s14.SetItemMinSize(1, (180, 20))
s14.SetItemMinSize(index=1, size=(180, 20))

s15 = wx.BoxSizer(wx.HORIZONTAL)
self._hint_colour = wx.BitmapButton(self, ID_HintColour, b, wx.DefaultPosition, wx.Size(50,25))
s15.Add((1, 1), 1, wx.EXPAND)
s15.Add(wx.StaticText(self, -1, "Hint Window Colour:"))
s15.Add(self._hint_colour)
s15.Add((1, 1), 1, wx.EXPAND)
s15.SetItemMinSize(1, (180, 20))
s15.SetItemMinSize(index=1, size=(180, 20))

grid_sizer = wx.GridSizer(rows=0, cols=2, vgap=5, hgap=5)
grid_sizer.SetHGap(5)
Expand Down
4 changes: 2 additions & 2 deletions wx/lib/analogclock/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,5 @@

#----------------------------------------------------------------------

from analogclock import AnalogClock, AnalogClockWindow
from styles import *
from .analogclock import AnalogClock, AnalogClockWindow
from .styles import *
6 changes: 3 additions & 3 deletions wx/lib/analogclock/analogclock.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

import wx

from styles import *
from helpers import Dyer, Face, Hand, HandSet, TickSet, Box
from setup import Setup
from .styles import *
from .helpers import Dyer, Face, Hand, HandSet, TickSet, Box
from .setup import Setup

#----------------------------------------------------------------------

Expand Down
6 changes: 3 additions & 3 deletions wx/lib/analogclock/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import math
import wx

from styles import *
from .styles import *

#----------------------------------------------------------------------

Expand Down Expand Up @@ -662,7 +662,7 @@ def RecalcCoords(self, clocksize, centre, scale):
dc.SetFont(self.font)
maxsize = size
for tick in self.ticks.values():
maxsize = max(*(dc.GetTextExtent(tick.text) + (maxsize,)))
maxsize = max(*(tuple(dc.GetTextExtent(tick.text)) + (maxsize,)))

radius = self.radius = min(clocksize.Get()) / 2. - \
self.dyer.width / 2. - \
Expand Down Expand Up @@ -941,7 +941,7 @@ def SetTickFont(self, font, target):
for i, attr in enumerate(["TicksH", "TicksM"]):
if _targets[i] & target:
tick = getattr(self, attr)
tick.SetFont(wx.FontFromNativeInfoString(fs))
tick.SetFont(wx.Font(fs))


def SetIsRotated(self, rotate):
Expand Down
8 changes: 4 additions & 4 deletions wx/lib/analogclock/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

import wx

import styles
import lib_setup.colourselect as csel
import lib_setup.fontselect as fsel
import lib_setup.buttontreectrlpanel as bt
from . import styles
from .lib_setup import colourselect as csel
from .lib_setup import fontselect as fsel
from .lib_setup import buttontreectrlpanel as bt

#----------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion wx/lib/colourchooser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# o wxPyColourChooser -> PyColourChooser
#

from pycolourchooser import *
from .pycolourchooser import *

# For the American in you
PyColorChooser = PyColourChooser
Expand Down
12 changes: 6 additions & 6 deletions wx/lib/colourchooser/pycolourchooser.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
# Tags: phoenix-port

import wx
import colorsys

import pycolourbox
import pypalette
import pycolourslider
import colorsys
import intl
from . import pycolourbox
from . import pypalette
from . import pycolourslider
from . import intl

from intl import _ # _
from .intl import _ # _

class PyColourChooser(wx.Panel):
"""A Pure-Python implementation of the colour chooser dialog.
Expand Down
Loading