demo tweaks
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16140 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
47b2f647b9
commit
63b6646e5d
@ -64,7 +64,10 @@ class TestPanel(wxPanel):
|
||||
self.SetSizer(sizer)
|
||||
self.SetAutoLayout(true)
|
||||
|
||||
def __del__(self):
|
||||
EVT_WINDOW_DESTROY(self, self.OnDestroy)
|
||||
|
||||
|
||||
def OnDestroy(self, evt):
|
||||
if self.pdf:
|
||||
self.pdf.Cleanup()
|
||||
self.pdf = None
|
||||
@ -114,12 +117,6 @@ if __name__ == '__main__':
|
||||
wxFrame.__init__(self, None, -1, "ActiveX test -- Acrobat", size=(640, 480),
|
||||
style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
|
||||
self.tp = TestPanel(self, sys.stdout)
|
||||
EVT_CLOSE(self, self.OnCloseWindow)
|
||||
|
||||
def OnCloseWindow(self, event):
|
||||
|
||||
self.tp.pdf.Cleanup()
|
||||
self.Destroy()
|
||||
|
||||
|
||||
app = wxPySimpleApp()
|
||||
|
@ -104,14 +104,18 @@ class TestPanel(wxWindow):
|
||||
self.SetAutoLayout(true)
|
||||
EVT_SIZE(self, self.OnSize)
|
||||
|
||||
EVT_WINDOW_DESTROY(self, self.OnDestroy)
|
||||
|
||||
|
||||
def OnDestroy(self, evt):
|
||||
if self.ie:
|
||||
self.ie.Cleanup()
|
||||
self.ie = None
|
||||
|
||||
|
||||
def OnSize(self, evt):
|
||||
self.Layout()
|
||||
|
||||
def __del__(self):
|
||||
if self.ie:
|
||||
self.ie.Cleanup()
|
||||
self.ie = None
|
||||
|
||||
def OnLocationSelect(self, evt):
|
||||
url = self.location.GetStringSelection()
|
||||
@ -211,11 +215,6 @@ if __name__ == '__main__':
|
||||
style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
|
||||
self.CreateStatusBar()
|
||||
self.tp = TestPanel(self, sys.stdout, self)
|
||||
EVT_CLOSE(self, self.OnCloseWindow)
|
||||
|
||||
def OnCloseWindow(self, event):
|
||||
self.tp.ie.Cleanup()
|
||||
self.Destroy()
|
||||
|
||||
|
||||
app = wxPySimpleApp()
|
||||
|
@ -44,7 +44,10 @@ class TestPanel(wxPanel):
|
||||
self.txt.SetFont(font)
|
||||
self.txt.SetSize(self.txt.GetBestSize())
|
||||
|
||||
|
||||
## st = font.GetNativeFontInfo().ToString()
|
||||
## ni2 = wxNativeFontInfo()
|
||||
## ni2.FromString(st)
|
||||
## font2 = wxFontFromNativeInfo(ni2)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
@ -61,11 +64,14 @@ def runTest(frame, nb, log):
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
overview = """\
|
||||
wxFontEnumerator enumerates either all available fonts on the system or only the ones with given attributes - either only fixed-width (suited for use in programs such as terminal emulators and the like) or the fonts available in the given encoding.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys,os
|
||||
import run
|
||||
run.main(['', os.path.basename(sys.argv[0])])
|
||||
|
||||
|
@ -21,3 +21,8 @@ def runTest(frame, nb, log):
|
||||
|
||||
overview = filling.__doc__
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys,os
|
||||
import run
|
||||
run.main(['', os.path.basename(sys.argv[0])])
|
||||
|
||||
|
@ -72,6 +72,7 @@ class TestPanel(wxPanel):
|
||||
tree = TestTree(splitter, -1, style = wxTR_HAS_BUTTONS |
|
||||
wxTR_NO_LINES |
|
||||
wxTR_ROW_LINES |
|
||||
#wxTR_HIDE_ROOT |
|
||||
wxNO_BORDER )
|
||||
valueWindow = TestValueWindow(splitter, -1, style=wxNO_BORDER)
|
||||
|
||||
@ -111,3 +112,9 @@ also be useful by themselves.
|
||||
"""
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys,os
|
||||
import run
|
||||
run.main(['', os.path.basename(sys.argv[0])])
|
||||
|
||||
|
@ -54,16 +54,17 @@ class TestPanel(wxWindow):
|
||||
txt = wxStaticText(self, -1, "Location:")
|
||||
btnSizer.Add(txt, 0, wxCENTER|wxALL, 2)
|
||||
|
||||
self.location = wxComboBox(self, wxNewId(), "", style=wxCB_DROPDOWN)
|
||||
self.location = wxComboBox(self, wxNewId(), "", style=wxCB_DROPDOWN|wxPROCESS_ENTER)
|
||||
EVT_COMBOBOX(self, self.location.GetId(), self.OnLocationSelect)
|
||||
EVT_KEY_UP(self.location, self.OnLocationKey)
|
||||
EVT_CHAR(self.location, self.IgnoreReturn)
|
||||
btnSizer.Add(self.location, 1, wxEXPAND|wxALL, 2)
|
||||
|
||||
|
||||
sizer.Add(btnSizer, 0, wxEXPAND)
|
||||
sizer.Add(self.ie, 1, wxEXPAND)
|
||||
|
||||
self.ie.LoadUrl(self.current)
|
||||
self.ie.Navigate(self.current)
|
||||
self.location.Append(self.current)
|
||||
|
||||
self.SetSizer(sizer)
|
||||
@ -82,22 +83,23 @@ class TestPanel(wxWindow):
|
||||
def OnSize(self, evt):
|
||||
self.Layout()
|
||||
|
||||
|
||||
def OnLocationSelect(self, evt):
|
||||
url = self.location.GetStringSelection()
|
||||
self.log.write('OnLocationSelect: %s\n' % url)
|
||||
self.ie.LoadUrl(url)
|
||||
self.ie.Navigate(url)
|
||||
|
||||
def OnLocationKey(self, evt):
|
||||
if evt.KeyCode() == WXK_RETURN:
|
||||
URL = self.location.GetValue()
|
||||
self.location.Append(URL)
|
||||
self.ie.LoadUrl(URL)
|
||||
self.ie.Navigate(URL)
|
||||
else:
|
||||
evt.Skip()
|
||||
|
||||
|
||||
def IgnoreReturn(self, evt):
|
||||
print 'IgnoreReturn'
|
||||
if evt.KeyCode() != WXK_RETURN:
|
||||
if evt.GetKeyCode() != WXK_RETURN:
|
||||
evt.Skip()
|
||||
|
||||
def OnOpenButton(self, event):
|
||||
@ -107,7 +109,7 @@ class TestPanel(wxWindow):
|
||||
dlg.CentreOnParent()
|
||||
if dlg.ShowModal() == wxID_OK:
|
||||
self.current = dlg.GetValue()
|
||||
self.ie.LoadUrl(self.current)
|
||||
self.ie.Navigate(self.current)
|
||||
dlg.Destroy()
|
||||
|
||||
def OnHomeButton(self, event):
|
||||
@ -132,7 +134,7 @@ class TestPanel(wxWindow):
|
||||
|
||||
def logEvt(self, name, event):
|
||||
self.log.write('%s: %s\n' %
|
||||
(name, (event.GetLong1(), event.GetLong2(), event.GetText())))
|
||||
(name, (event.GetLong1(), event.GetLong2(), event.GetText1())))
|
||||
|
||||
def OnBeforeNavigate2(self, evt):
|
||||
self.logEvt('OnBeforeNavigate2', evt)
|
||||
@ -143,18 +145,18 @@ class TestPanel(wxWindow):
|
||||
|
||||
def OnDocumentComplete(self, evt):
|
||||
self.logEvt('OnDocumentComplete', evt)
|
||||
self.current = evt.GetText()
|
||||
self.current = evt.GetText1()
|
||||
self.location.SetValue(self.current)
|
||||
|
||||
def OnTitleChange(self, evt):
|
||||
self.logEvt('OnTitleChange', evt)
|
||||
if self.frame:
|
||||
self.frame.SetTitle(self.titleBase + ' -- ' + evt.GetText())
|
||||
self.frame.SetTitle(self.titleBase + ' -- ' + evt.GetText1())
|
||||
|
||||
def OnStatusTextChange(self, evt):
|
||||
self.logEvt('OnStatusTextChange', evt)
|
||||
if self.frame:
|
||||
self.frame.SetStatusText(evt.GetText())
|
||||
self.frame.SetStatusText(evt.GetText1())
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
@ -105,7 +105,7 @@ class TestListCtrlPanel(wxPanel, wxColumnSorterMixin):
|
||||
self.list.SetImageList(self.il, wxIMAGE_LIST_SMALL)
|
||||
|
||||
# Why doesn't this show up on MSW???
|
||||
self.list.SetToolTip(wxToolTip("This is a ToolTip!"))
|
||||
#self.list.SetToolTip(wxToolTip("This is a ToolTip!"))
|
||||
|
||||
if 0:
|
||||
# for normal, simple columns, you can add them like this:
|
||||
@ -280,6 +280,8 @@ class TestListCtrlPanel(wxPanel, wxColumnSorterMixin):
|
||||
|
||||
def OnPopupOne(self, event):
|
||||
self.log.WriteText("Popup one\n")
|
||||
print "FindItem:", self.list.FindItem(-1, "Billy Joel")
|
||||
print "FindItemData:", self.list.FindItemData(-1, 20)
|
||||
|
||||
def OnPopupTwo(self, event):
|
||||
self.log.WriteText("Popup two\n")
|
||||
|
@ -60,10 +60,13 @@ class MySTC(wxStyledTextCtrl):
|
||||
EVT_STC_START_DRAG(self, ID, self.OnStartDrag)
|
||||
EVT_STC_MODIFIED(self, ID, self.OnModified)
|
||||
|
||||
## EVT_WINDOW_DESTROY(self, self.OnDestroy)
|
||||
## def OnDestroy(self, evt):
|
||||
## wxTheClipboard.Flush()
|
||||
## evt.Skip()
|
||||
EVT_WINDOW_DESTROY(self, self.OnDestroy)
|
||||
|
||||
def OnDestroy(self, evt):
|
||||
# This is how the clipboard contents can be preserved after
|
||||
# the app has exited.
|
||||
wxTheClipboard.Flush()
|
||||
evt.Skip()
|
||||
|
||||
|
||||
def OnStartDrag(self, evt):
|
||||
@ -151,7 +154,7 @@ def runTest(frame, nb, log):
|
||||
ed = p = MySTC(nb, -1, log)
|
||||
|
||||
else:
|
||||
p = wxPanel(nb, -1)
|
||||
p = wxPanel(nb, -1, style=wxNO_FULL_REPAINT_ON_RESIZE)
|
||||
ed = MySTC(p, -1, log)
|
||||
s = wxBoxSizer(wxHORIZONTAL)
|
||||
s.Add(ed, 1, wxEXPAND)
|
||||
@ -248,10 +251,12 @@ def runTest(frame, nb, log):
|
||||
ed.SetSelection(25, 35)
|
||||
print "GetSelectedText(): ", repr(ed.GetSelectedText())
|
||||
print "GetTextRange(25, 35): ", repr(ed.GetTextRange(25, 35))
|
||||
|
||||
print "FindText(0, max, 'indicators'): ",
|
||||
print ed.FindText(0, ed.GetTextLength(), "indicators")
|
||||
|
||||
ed.GotoPos(0)
|
||||
|
||||
|
||||
return p
|
||||
|
||||
|
||||
|
@ -47,16 +47,13 @@ class TestPanel(wxPanel):
|
||||
|
||||
l4 = wxStaticText(self, -1, "Rich Text")
|
||||
t4 = wxTextCtrl(self, 40, "If supported by the native control, this is red, and this is a different font.",
|
||||
size=(200, 100), style=wxTE_MULTILINE|wxTE_RICH)
|
||||
size=(200, 100), style=wxTE_MULTILINE|wxTE_RICH2)
|
||||
t4.SetInsertionPoint(0)
|
||||
t4.SetStyle(44, 47, wxTextAttr("RED", "YELLOW"))
|
||||
|
||||
points = t4.GetFont().GetPointSize() # get the current size
|
||||
f = wxFont(points+3, wxROMAN, wxITALIC, wxBOLD, true)
|
||||
## print 'a1', sys.getrefcount(f)
|
||||
## t4.SetStyle(63, 77, wxTextAttr("BLUE", font=f))
|
||||
t4.SetStyle(63, 77, wxTextAttr("BLUE", wxNullColour, f))
|
||||
## print 'a2', sys.getrefcount(f)
|
||||
|
||||
bsizer = wxBoxSizer(wxVERTICAL)
|
||||
bsizer.Add(b, 0, wxGROW)
|
||||
@ -113,3 +110,12 @@ def runTest(frame, nb, log):
|
||||
|
||||
overview = """\
|
||||
"""
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys,os
|
||||
import run
|
||||
run.main(['', os.path.basename(sys.argv[0])])
|
||||
|
||||
|
@ -31,6 +31,7 @@ class TestTreeCtrlPanel(wxPanel):
|
||||
|
||||
self.tree = MyTreeCtrl(self, tID, wxDefaultPosition, wxDefaultSize,
|
||||
wxTR_HAS_BUTTONS | wxTR_EDIT_LABELS# | wxTR_MULTIPLE
|
||||
#| wxTR_HIDE_ROOT
|
||||
, self.log)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user