Another merge of 2.6 changes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36914 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn 2006-01-17 05:42:30 +00:00
parent f3ebbc0ac8
commit 4617be085f
21 changed files with 241 additions and 43 deletions

View File

@ -5,6 +5,18 @@ import os
#----------------------------------------------------------------------
class StaticText(wx.StaticText):
"""
A StaticText that only updates the label if it has changed, to
help reduce potential flicker since these controls would be
updated very frequently otherwise.
"""
def SetLabel(self, label):
if label <> self.GetLabel():
wx.StaticText.SetLabel(self, label)
#----------------------------------------------------------------------
class TestPanel(wx.Panel):
def __init__(self, parent, log):
self.log = log
@ -18,11 +30,14 @@ class TestPanel(wx.Panel):
self.Destroy()
raise
self.Bind(wx.media.EVT_MEDIA_LOADED, self.OnMediaLoaded)
btn1 = wx.Button(self, -1, "Load File")
self.Bind(wx.EVT_BUTTON, self.OnLoadFile, btn1)
btn2 = wx.Button(self, -1, "Play")
self.Bind(wx.EVT_BUTTON, self.OnPlay, btn2)
self.playBtn = btn2
btn3 = wx.Button(self, -1, "Pause")
self.Bind(wx.EVT_BUTTON, self.OnPause, btn3)
@ -35,9 +50,9 @@ class TestPanel(wx.Panel):
slider.SetMinSize((150, -1))
self.Bind(wx.EVT_SLIDER, self.OnSeek, slider)
self.st_size = wx.StaticText(self, -1, size=(100,-1))
self.st_len = wx.StaticText(self, -1, size=(100,-1))
self.st_pos = wx.StaticText(self, -1, size=(100,-1))
self.st_size = StaticText(self, -1, size=(100,-1))
self.st_len = StaticText(self, -1, size=(100,-1))
self.st_pos = StaticText(self, -1, size=(100,-1))
# setup the layout
@ -53,8 +68,8 @@ class TestPanel(wx.Panel):
sizer.Add(self.st_pos, (3, 5))
self.SetSizer(sizer)
self.DoLoadFile(os.path.abspath("data/testmovie.mpg"))
self.mc.Stop()
#self.DoLoadFile(os.path.abspath("data/testmovie.mpg"))
wx.CallAfter(self.DoLoadFile, os.path.abspath("data/testmovie.mpg"))
self.timer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.OnTimer)
@ -73,6 +88,8 @@ class TestPanel(wx.Panel):
def DoLoadFile(self, path):
self.playBtn.Disable()
noLog = wx.LogNull()
if not self.mc.Load(path):
wx.MessageBox("Unable to load %s: Unsupported format?" % path,
"ERROR",
@ -80,13 +97,19 @@ class TestPanel(wx.Panel):
else:
self.mc.SetBestFittingSize()
self.GetSizer().Layout()
self.mc.Play()
self.slider.SetRange(0, self.mc.Length())
def OnMediaLoaded(self, evt):
self.playBtn.Enable()
def OnPlay(self, evt):
self.mc.Play()
if not self.mc.Play():
wx.MessageBox("Unable to Play media : Unsupported format?",
"ERROR",
wx.ICON_ERROR | wx.OK)
else:
self.slider.SetRange(0, self.mc.Length())
def OnPause(self, evt):
self.mc.Pause()
@ -148,4 +171,3 @@ if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])

View File

@ -25,6 +25,21 @@ wx.EventLoop is now implemented for wxMac.
2.6.2.2
-------
Change the wx.ListCtrl InsertStringItem wrapper to use the form that
takes an imageIndex, and set the default to -1. This ensures that on
wxMSW that if there is an image list but they don't specify an image,
the native control doesn't use one anyway.
wxMSW: wx.ListCtrl in report mode is now able to support images in
other columns besides the first one. Simply pass an image index to
SetStringItem.
2.6.2.1
-------
* 10-Jan-2006

View File

@ -35,7 +35,7 @@ public:
void base_GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo);
PYPRIVATE;
DECLARE_ABSTRACT_CLASS(wxPyPrintout);
DECLARE_ABSTRACT_CLASS(wxPyPrintout)
};
#endif

View File

@ -20,7 +20,7 @@
//---------------------------------------------------------------------------
class wxPySizer : public wxSizer {
DECLARE_DYNAMIC_CLASS(wxPySizer);
DECLARE_DYNAMIC_CLASS(wxPySizer)
public:
wxPySizer() : wxSizer() {};
@ -33,7 +33,7 @@ public:
//---------------------------------------------------------------------------
class wxPyValidator : public wxValidator {
DECLARE_DYNAMIC_CLASS(wxPyValidator);
DECLARE_DYNAMIC_CLASS(wxPyValidator)
public:
wxPyValidator() {
}

View File

@ -286,7 +286,7 @@ PyObject* wxArrayInt2PyList_helper(const wxArrayInt& arr);
#ifndef wxPyUSE_EXPORTED_API
class wxPyCallback : public wxObject {
DECLARE_ABSTRACT_CLASS(wxPyCallback);
DECLARE_ABSTRACT_CLASS(wxPyCallback)
public:
wxPyCallback(PyObject* func);
wxPyCallback(const wxPyCallback& other);
@ -606,7 +606,7 @@ enum {
class wxPyApp: public wxApp
{
DECLARE_ABSTRACT_CLASS(wxPyApp);
DECLARE_ABSTRACT_CLASS(wxPyApp)
public:
wxPyApp();

99
wxPython/misc/wxprojview.py Executable file
View File

@ -0,0 +1,99 @@
#!/usr/bin/env python
import wx
import wx.lib.stattext as st
import os
class MyFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, title="wx Active Project",
style=wx.FRAME_NO_TASKBAR|wx.STAY_ON_TOP,
name="wxprojview"
)
p = wx.Panel(self)#, style=wx.SIMPLE_BORDER)
p.SetBackgroundColour("sky blue")
self.label = st.GenStaticText(p, -1, "wx XXX")
self.label.SetBackgroundColour("sky blue")
self.label.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD))
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.label, 1, wx.ALIGN_CENTER|wx.ALL, 2)
p.SetSizerAndFit(sizer)
self.SetClientSize(p.GetSize())
for obj in [p, self.label]:
obj.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
obj.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
obj.Bind(wx.EVT_MOTION, self.OnMouseMove)
obj.Bind(wx.EVT_RIGHT_UP, self.OnRightUp)
cfg = wx.Config.Get()
cfg.SetPath("/")
if cfg.Exists("Pos"):
pos = eval(cfg.Read("Pos"))
# TODO: ensure this position is on-screen
self.SetPosition(pos)
self.Bind(wx.EVT_CLOSE, self.OnClose)
self.Bind(wx.EVT_TIMER, self.OnUpdateVersion)
self.timer = wx.Timer(self)
self.timer.Start(5000)
self.OnUpdateVersion(None)
def OnUpdateVersion(self, evt):
ver = '??'
if 'wxMSW' in wx.PlatformInfo:
pass
else:
link = '/opt/wx/current'
if os.path.islink(link):
rp = os.path.realpath(link)
ver = os.path.split(rp)[1]
label = 'wx %s' % ver
if label != self.label.GetLabel():
self.label.SetLabel(label)
self.label.GetContainingSizer().Layout()
def OnClose(self, evt):
cfg = wx.Config.Get()
cfg.SetPath("/")
cfg.Write("Pos", str(self.GetPosition().Get()))
self.timer.Stop()
evt.Skip()
def OnLeftDown(self, evt):
win = evt.GetEventObject()
win.CaptureMouse()
self.capture = win
pos = win.ClientToScreen(evt.GetPosition())
origin = self.GetPosition()
dx = pos.x - origin.x
dy = pos.y - origin.y
self.delta = wx.Point(dx, dy)
def OnLeftUp(self, evt):
if self.capture.HasCapture():
self.capture.ReleaseMouse()
def OnMouseMove(self, evt):
if evt.Dragging() and evt.LeftIsDown():
win = evt.GetEventObject()
pos = win.ClientToScreen(evt.GetPosition())
fp = (pos.x - self.delta.x, pos.y - self.delta.y)
self.Move(fp)
def OnRightUp(self, evt):
self.Close()
app = wx.PySimpleApp()
app.SetAppName("wxprojview")
app.SetVendorName("Robin Dunn")
frm = MyFrame()
frm.Show()
app.MainLoop()

View File

@ -23,13 +23,15 @@ Blue (RGB) intensity values, and is used to determine drawing colours,
window colours, etc. Valid RGB values are in the range 0 to 255.
In wxPython there are typemaps that will automatically convert from a
colour name, or from a '#RRGGBB' colour hex value string to a
wx.Colour object when calling C++ methods that expect a wxColour.
This means that the following are all equivallent::
colour name, from a '#RRGGBB' colour hex value string, or from a 3
integer tuple to a wx.Colour object when calling C++ methods that
expect a wxColour. This means that the following are all
equivallent::
win.SetBackgroundColour(wxColour(0,0,255))
win.SetBackgroundColour('BLUE')
win.SetBackgroundColour('#0000FF')
win.SetBackgroundColour((0,0,255))
Additional colour names and their coresponding values can be added
using `wx.ColourDatabase`. Various system colours (as set in the

View File

@ -21,7 +21,7 @@
// in the wrapper code.
#include <wx/hashmap.h>
WX_DECLARE_STRING_HASH_MAP( swig_type_info*, wxPyTypeInfoHashMap );
WX_DECLARE_STRING_HASH_MAP( swig_type_info*, wxPyTypeInfoHashMap );
// Maintains a hashmap of className to swig_type_info pointers. Given the

View File

@ -91,7 +91,7 @@ const wxVideoMode wxDefaultVideoMode;
#include <wx/dynarray.h>
#include <wx/vidmode.h>
WX_DECLARE_OBJARRAY(wxVideoMode, wxArrayVideoModes);
WX_DECLARE_OBJARRAY(wxVideoMode, wxArrayVideoModes);
#include "wx/arrimpl.cpp"
WX_DEFINE_OBJARRAY(wxArrayVideoModes);
const wxVideoMode wxDefaultVideoMode;

View File

@ -368,7 +368,7 @@ EVT_LIST_ITEM_FOCUSED = wx.PyEventBinder(wxEVT_COMMAND_LIST_ITEM_FOCUSED
%{ // C++ Version of a Python aware class
class wxPyListCtrl : public wxListCtrl {
DECLARE_ABSTRACT_CLASS(wxPyListCtrl);
DECLARE_ABSTRACT_CLASS(wxPyListCtrl)
public:
wxPyListCtrl() : wxListCtrl() {}
wxPyListCtrl(wxWindow* parent, wxWindowID id,
@ -661,13 +661,16 @@ details in the second return value (see wx.LIST_HITTEST flags.)", "");
long InsertItem(wxListItem& info);
// Insert a string item
%Rename(InsertStringItem, long, InsertItem(long index, const wxString& label));
%Rename(InsertStringItem,
long, InsertItem(long index, const wxString& label, int imageIndex=-1));
// Insert an image item
%Rename(InsertImageItem, long, InsertItem(long index, int imageIndex));
%Rename(InsertImageItem,
long, InsertItem(long index, int imageIndex));
// Insert an image/string item
%Rename(InsertImageStringItem, long, InsertItem(long index, const wxString& label, int imageIndex));
%Rename(InsertImageStringItem,
long, InsertItem(long index, const wxString& label, int imageIndex));
// For list view mode (only), inserts a column.
%Rename(InsertColumnItem, long, InsertColumn(long col, wxListItem& info));

View File

@ -721,7 +721,7 @@ public:
%{
class wxPyPreviewFrame : public wxPreviewFrame
{
DECLARE_CLASS(wxPyPreviewFrame);
DECLARE_CLASS(wxPyPreviewFrame)
public:
wxPyPreviewFrame(wxPrintPreview* preview, wxFrame* parent,
const wxString& title,
@ -780,7 +780,7 @@ public:
%{
class wxPyPreviewControlBar : public wxPreviewControlBar
{
DECLARE_CLASS(wxPyPreviewControlBar);
DECLARE_CLASS(wxPyPreviewControlBar)
public:
wxPyPreviewControlBar(wxPrintPreview *preview,
long buttons,

View File

@ -61,7 +61,7 @@ enum {
// Otherwise make a class that can virtualize CreatePopupMenu
class wxPyTaskBarIcon : public wxTaskBarIcon
{
DECLARE_ABSTRACT_CLASS(wxPyTaskBarIcon);
DECLARE_ABSTRACT_CLASS(wxPyTaskBarIcon)
public:
wxPyTaskBarIcon() : wxTaskBarIcon()
{}

View File

@ -263,7 +263,7 @@ public:
%{ // C++ version of Python aware wxTreeCtrl
class wxPyTreeCtrl : public wxTreeCtrl {
DECLARE_ABSTRACT_CLASS(wxPyTreeCtrl);
DECLARE_ABSTRACT_CLASS(wxPyTreeCtrl)
public:
wxPyTreeCtrl() : wxTreeCtrl() {}
wxPyTreeCtrl(wxWindow *parent, wxWindowID id,

View File

@ -35,7 +35,7 @@
%{
class wxPyVScrolledWindow : public wxVScrolledWindow
{
DECLARE_ABSTRACT_CLASS(wxPyVScrolledWindow);
DECLARE_ABSTRACT_CLASS(wxPyVScrolledWindow)
public:
wxPyVScrolledWindow() : wxVScrolledWindow() {}
@ -224,7 +224,7 @@ MAKE_CONST_WXSTRING(VListBoxNameStr);
%{
class wxPyVListBox : public wxVListBox
{
DECLARE_ABSTRACT_CLASS(wxPyVListBox);
DECLARE_ABSTRACT_CLASS(wxPyVListBox)
public:
wxPyVListBox() : wxVListBox() {}
@ -463,7 +463,7 @@ public:
%{
class wxPyHtmlListBox : public wxHtmlListBox
{
DECLARE_ABSTRACT_CLASS(wxPyHtmlListBox);
DECLARE_ABSTRACT_CLASS(wxPyHtmlListBox)
public:
wxPyHtmlListBox() : wxHtmlListBox() {}

View File

@ -245,7 +245,7 @@ public:
%{
class wxPyHtmlTagHandler : public wxHtmlTagHandler {
DECLARE_DYNAMIC_CLASS(wxPyHtmlTagHandler);
DECLARE_DYNAMIC_CLASS(wxPyHtmlTagHandler)
public:
wxPyHtmlTagHandler() : wxHtmlTagHandler() {};
@ -283,7 +283,7 @@ public:
%{
class wxPyHtmlWinTagHandler : public wxHtmlWinTagHandler {
DECLARE_DYNAMIC_CLASS(wxPyHtmlWinTagHandler);
DECLARE_DYNAMIC_CLASS(wxPyHtmlWinTagHandler)
public:
wxPyHtmlWinTagHandler() : wxHtmlWinTagHandler() {};
@ -642,7 +642,7 @@ public:
%{ // here's the C++ version
class wxPyHtmlFilter : public wxHtmlFilter {
DECLARE_ABSTRACT_CLASS(wxPyHtmlFilter);
DECLARE_ABSTRACT_CLASS(wxPyHtmlFilter)
public:
wxPyHtmlFilter() : wxHtmlFilter() {}
@ -710,7 +710,7 @@ public:
%{
class wxPyHtmlWindow : public wxHtmlWindow {
DECLARE_ABSTRACT_CLASS(wxPyHtmlWindow);
DECLARE_ABSTRACT_CLASS(wxPyHtmlWindow)
public:
wxPyHtmlWindow(wxWindow *parent, wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,

View File

@ -126,7 +126,7 @@ public:
%{ // C++ Version of a Python aware class
class wxPyWizardPage : public wxWizardPage {
DECLARE_ABSTRACT_CLASS(wxPyWizardPage);
DECLARE_ABSTRACT_CLASS(wxPyWizardPage)
public:
wxPyWizardPage() : wxWizardPage() {}
wxPyWizardPage(wxWizard *parent,

View File

@ -529,10 +529,10 @@ class __ToggleMixin:
if not self.IsEnabled() or not self.HasCapture():
return
if self.HasCapture():
if self.up != self.saveUp:
self.Notify()
self.ReleaseMouse()
self.Refresh()
if self.up != self.saveUp:
self.Notify()
def OnKeyDown(self, event):
event.Skip()

View File

@ -279,6 +279,10 @@ class CrustFrame(frame.Frame, frame.ShellFrameMixin):
dialog.Destroy()
def OnHelp(self, event):
"""Show a help dialog."""
frame.ShellFrameMixin.OnHelp(self, event)
def LoadSettings(self):
if self.config is not None:

View File

@ -95,6 +95,11 @@ class ShellFrame(frame.Frame, frame.ShellFrameMixin):
dialog.Destroy()
def OnHelp(self, event):
"""Show a help dialog."""
frame.ShellFrameMixin.OnHelp(self, event)
def LoadSettings(self):
if self.config is not None:
frame.ShellFrameMixin.LoadSettings(self)

View File

@ -1073,6 +1073,8 @@ wxEventLoop = wx._core.EventLoop
wxEventLoopPtr = wx._core.EventLoopPtr
wxEventLoop_GetActive = wx._core.EventLoop_GetActive
wxEventLoop_SetActive = wx._core.EventLoop_SetActive
wxEventLoopActivator = wx._core.EventLoopActivator
wxEventLoopActivatorPtr = wx._core.EventLoopActivatorPtr
wxAcceleratorEntry = wx._core.AcceleratorEntry
wxAcceleratorEntryPtr = wx._core.AcceleratorEntryPtr
wxAcceleratorTable = wx._core.AcceleratorTable

View File

@ -127,18 +127,64 @@ wxHtmlSearchStatus = wx.html.HtmlSearchStatus
wxHtmlSearchStatusPtr = wx.html.HtmlSearchStatusPtr
wxHtmlHelpData = wx.html.HtmlHelpData
wxHtmlHelpDataPtr = wx.html.HtmlHelpDataPtr
wxHtmlHelpFrame = wx.html.HtmlHelpFrame
wxHtmlHelpFramePtr = wx.html.HtmlHelpFramePtr
wxHF_TOOLBAR = wx.html.HF_TOOLBAR
wxHF_FLATTOOLBAR = wx.html.HF_FLATTOOLBAR
wxHF_CONTENTS = wx.html.HF_CONTENTS
wxHF_INDEX = wx.html.HF_INDEX
wxHF_SEARCH = wx.html.HF_SEARCH
wxHF_BOOKMARKS = wx.html.HF_BOOKMARKS
wxHF_OPENFILES = wx.html.HF_OPENFILES
wxHF_OPEN_FILES = wx.html.HF_OPEN_FILES
wxHF_PRINT = wx.html.HF_PRINT
wxHF_DEFAULTSTYLE = wx.html.HF_DEFAULTSTYLE
wxHF_FLAT_TOOLBAR = wx.html.HF_FLAT_TOOLBAR
wxHF_MERGE_BOOKS = wx.html.HF_MERGE_BOOKS
wxHF_ICONS_BOOK = wx.html.HF_ICONS_BOOK
wxHF_ICONS_BOOK_CHAPTER = wx.html.HF_ICONS_BOOK_CHAPTER
wxHF_ICONS_FOLDER = wx.html.HF_ICONS_FOLDER
wxHF_DEFAULT_STYLE = wx.html.HF_DEFAULT_STYLE
wxHF_EMBEDDED = wx.html.HF_EMBEDDED
wxHF_DIALOG = wx.html.HF_DIALOG
wxHF_FRAME = wx.html.HF_FRAME
wxHF_MODAL = wx.html.HF_MODAL
wxID_HTML_PANEL = wx.html.ID_HTML_PANEL
wxID_HTML_BACK = wx.html.ID_HTML_BACK
wxID_HTML_FORWARD = wx.html.ID_HTML_FORWARD
wxID_HTML_UPNODE = wx.html.ID_HTML_UPNODE
wxID_HTML_UP = wx.html.ID_HTML_UP
wxID_HTML_DOWN = wx.html.ID_HTML_DOWN
wxID_HTML_PRINT = wx.html.ID_HTML_PRINT
wxID_HTML_OPENFILE = wx.html.ID_HTML_OPENFILE
wxID_HTML_OPTIONS = wx.html.ID_HTML_OPTIONS
wxID_HTML_BOOKMARKSLIST = wx.html.ID_HTML_BOOKMARKSLIST
wxID_HTML_BOOKMARKSADD = wx.html.ID_HTML_BOOKMARKSADD
wxID_HTML_BOOKMARKSREMOVE = wx.html.ID_HTML_BOOKMARKSREMOVE
wxID_HTML_TREECTRL = wx.html.ID_HTML_TREECTRL
wxID_HTML_INDEXPAGE = wx.html.ID_HTML_INDEXPAGE
wxID_HTML_INDEXLIST = wx.html.ID_HTML_INDEXLIST
wxID_HTML_INDEXTEXT = wx.html.ID_HTML_INDEXTEXT
wxID_HTML_INDEXBUTTON = wx.html.ID_HTML_INDEXBUTTON
wxID_HTML_INDEXBUTTONALL = wx.html.ID_HTML_INDEXBUTTONALL
wxID_HTML_NOTEBOOK = wx.html.ID_HTML_NOTEBOOK
wxID_HTML_SEARCHPAGE = wx.html.ID_HTML_SEARCHPAGE
wxID_HTML_SEARCHTEXT = wx.html.ID_HTML_SEARCHTEXT
wxID_HTML_SEARCHLIST = wx.html.ID_HTML_SEARCHLIST
wxID_HTML_SEARCHBUTTON = wx.html.ID_HTML_SEARCHBUTTON
wxID_HTML_SEARCHCHOICE = wx.html.ID_HTML_SEARCHCHOICE
wxID_HTML_COUNTINFO = wx.html.ID_HTML_COUNTINFO
wxHtmlHelpWindow = wx.html.HtmlHelpWindow
wxHtmlHelpWindowPtr = wx.html.HtmlHelpWindowPtr
wxPreHtmlHelpWindow = wx.html.PreHtmlHelpWindow
wxHtmlWindowEvent = wx.html.HtmlWindowEvent
wxHtmlWindowEventPtr = wx.html.HtmlWindowEventPtr
wxHtmlHelpFrame = wx.html.HtmlHelpFrame
wxHtmlHelpFramePtr = wx.html.HtmlHelpFramePtr
wxPreHtmlHelpFrame = wx.html.PreHtmlHelpFrame
wxHtmlHelpDialog = wx.html.HtmlHelpDialog
wxHtmlHelpDialogPtr = wx.html.HtmlHelpDialogPtr
wxPreHtmlHelpDialog = wx.html.PreHtmlHelpDialog
wxHelpControllerBase = wx.html.HelpControllerBase
wxHelpControllerBasePtr = wx.html.HelpControllerBasePtr
wxHtmlHelpController = wx.html.HtmlHelpController
wxHtmlHelpControllerPtr = wx.html.HtmlHelpControllerPtr
wxHtmlModalHelp = wx.html.HtmlModalHelp
wxHtmlModalHelpPtr = wx.html.HtmlModalHelpPtr