]> git.saurik.com Git - wxWidgets.git/commitdiff
demo tweaks
authorRobin Dunn <robin@alldunn.com>
Thu, 11 Jul 2002 20:41:21 +0000 (20:41 +0000)
committerRobin Dunn <robin@alldunn.com>
Thu, 11 Jul 2002 20:41:21 +0000 (20:41 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16140 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/demo/ActiveXWrapper_Acrobat.py
wxPython/demo/ActiveXWrapper_IE.py
wxPython/demo/FontEnumerator.py
wxPython/demo/PyCrustWithFilling.py
wxPython/demo/SplitTree.py
wxPython/demo/wxIEHtmlWin.py
wxPython/demo/wxListCtrl.py
wxPython/demo/wxStyledTextCtrl_1.py
wxPython/demo/wxTextCtrl.py
wxPython/demo/wxTreeCtrl.py

index 06da8cc6999115458602337f6ab58d643547f76b..6eb972d1097c3406345ff6ab0273da4a5b9ba239 100644 (file)
@@ -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()
index c91db4d56b8a6e82e30d7c84ec4c61a6f6d5dff8..001455286ab1325996f233f481a73fa4c1fd0f14 100644 (file)
@@ -104,15 +104,19 @@ class TestPanel(wxWindow):
         self.SetAutoLayout(true)
         EVT_SIZE(self, self.OnSize)
 
+        EVT_WINDOW_DESTROY(self, self.OnDestroy)
 
-    def OnSize(self, evt):
-        self.Layout()
 
-    def __del__(self):
+    def OnDestroy(self, evt):
         if self.ie:
             self.ie.Cleanup()
             self.ie = None
 
+
+    def OnSize(self, evt):
+        self.Layout()
+
+
     def OnLocationSelect(self, evt):
         url = self.location.GetStringSelection()
         self.log.write('OnLocationSelect: %s\n' % url)
@@ -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()
index 5ada2dac5c861d1aecbda48e10bd40250b1da104..27a1466d94e7ab6c16e42d71c4aa5625e3eab344 100644 (file)
@@ -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])])
+
index 30ea8e1d7466d791051d14440447ad1bd7eaf203..a90c61649a007f2eff30a3dcf9e3b14ce84b4e77 100644 (file)
@@ -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])])
+
index afdccb9e2e4ce2767558ad7ecb74aacc40df14b9..fddd44f7dc96bbeb8f5bc238900f5bca64fc6d77 100644 (file)
@@ -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])])
+
index 5bdd7191bec39914af836f8b7bc0580222a69a58..a09476159bcdc85bfae1e865626672212d0cf1e9 100644 (file)
@@ -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())
 
 
 #----------------------------------------------------------------------
index 9c23d2e6749d5d8b21b849682e96f0c5674a6586..2dcd90178535ba5b200a008df31824468a329181 100644 (file)
@@ -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")
index 0f082c2ca9e656de437d163abc9e0b0f42e69067..e0964cf78a367a2f9a071c65cfcb237ddab87e56 100644 (file)
@@ -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
 
 
index 56098d2023f6b63e0f7694954f0eaf80d0ad5cdb..7b554563991bc16799c545241e45eb4d1fba7a4d 100644 (file)
@@ -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])])
+
index 877c92bf61fa27db4230da39010692c580f67ee0..ed5adc05e6aca290f7810f2155e3d2576ad25495 100644 (file)
@@ -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)