]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixes and other changes to the demo and some library modules so they
authorRobin Dunn <robin@alldunn.com>
Tue, 13 Aug 2002 23:59:08 +0000 (23:59 +0000)
committerRobin Dunn <robin@alldunn.com>
Tue, 13 Aug 2002 23:59:08 +0000 (23:59 +0000)
work better (or at all) on wxMac

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16500 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

17 files changed:
wxPython/demo/Main.py
wxPython/demo/run.py
wxPython/demo/wxArtProvider.py
wxPython/demo/wxCalendar.py
wxPython/demo/wxFileDialog.py
wxPython/demo/wxFontDialog.py
wxPython/demo/wxMenu.py
wxPython/demo/wxNotebook.py
wxPython/demo/wxPopupWindow.py
wxPython/demo/wxProgressDialog.py
wxPython/demo/wxRadioBox.py
wxPython/demo/wxStatusBar.py
wxPython/demo/wxToggleButton.py
wxPython/demo/wxToolBar.py
wxPython/distrib/mac/_build
wxPython/wxPython/lib/buttons.py
wxPython/wxPython/lib/editor/editor.py

index b06f4da5c9e08073126e472fc37d46104f566b0a..99b84e6406bc87efe2ff60dede93e20ec6131ba4 100644 (file)
@@ -306,8 +306,8 @@ class wxPythonDemo(wxFrame):
         self.treeMap = {}
         self.tree = wxTreeCtrl(splitter, tID,
                                style=wxTR_HAS_BUTTONS |
-                               wxTR_EDIT_LABELS |
-                               wxTR_HAS_VARIABLE_ROW_HEIGHT)
+                               wxTR_HAS_VARIABLE_ROW_HEIGHT
+                               )
 
         #self.tree.SetBackgroundColour(wxNamedColour("Pink"))
         root = self.tree.AddRoot("wxPython Overview")
index f82ecbbea552cbc9af428afd6a7dca97994f8012..615e5e8df4bc03cde4f386a8e85422c2f4239729 100755 (executable)
@@ -33,7 +33,7 @@ class RunDemoApp(wxApp):
     def __init__(self, name, module):
         self.name = name
         self.demoModule = module
-        wxApp.__init__(self, wxPlatform == "__WXMAC__")
+        wxApp.__init__(self, 0) ##wxPlatform == "__WXMAC__")
 
 
     def OnInit(self):
index 0a56fb5c92ff51a7fcc84c0f2aec6de1433163b2..5edd83d3a3c87483a67704681d948b66688c7413 100644 (file)
@@ -165,11 +165,13 @@ class TestPanel(wxPanel):
 
 
     def OnSelectClient(self, evt):
+        self.log.write("OnSelectClient\n")
         self.client = eval(evt.GetString())
         self.getArt()
 
 
     def OnSelectID(self, evt):
+        self.log.write("OnSelectID\n")
         self.artid = eval(evt.GetString())
         self.getArt()
 
index 181e79d85f329107b9f4abd478a06493a75331d2..487eeb39c15974584094800c419fe35c94114c6a 100644 (file)
@@ -62,7 +62,10 @@ class TestPanel(wxPanel):
         monthlist = GetMonthList()
 
         mID = NewId()
-        self.date = wxComboBox(self, mID, Month[start_month], wxPoint(100, 20), wxSize(90, -1), monthlist, wxCB_DROPDOWN)
+        self.date = wxComboBox(self, mID, "",
+                               wxPoint(100, 20), wxSize(90, -1),
+                               monthlist, wxCB_DROPDOWN)
+        self.date.SetSelection(start_month-1)
         EVT_COMBOBOX(self, mID, self.EvtComboBox)
 
 # set start month and year
index eda3e882d10d5d6ad00ec8ada99aec81762b6484..a3c753e45b07c721993e29b0f13e0c3a795616fb 100644 (file)
@@ -1,10 +1,15 @@
 
 from wxPython.wx import *
+import string
 
 #---------------------------------------------------------------------------
 
+wildcard = "Python source (*.py)|*.py|" \
+           "Compiled Python (*.pyc)|*.pyc|" \
+           "All files (*.*)|*.*"
+
 def runTest(frame, nb, log):
-    dlg = wxFileDialog(frame, "Choose a file", ".", "", "*.*", wxOPEN|wxMULTIPLE)
+    dlg = wxFileDialog(frame, "Choose a file", "", "", wildcard, wxOPEN|wxMULTIPLE)
     if dlg.ShowModal() == wxID_OK:
         for path in dlg.GetPaths():
             log.WriteText('You selected: %s\n' % path)
index 551dc97dc5a2a9f3cacae034681565889dbf69c2..509ebfbb3a6783e471a17cc6d98279705308ede6 100644 (file)
@@ -8,8 +8,9 @@ def runTest(frame, nb, log):
     data.EnableEffects(true)
     font_colour = wxColour(255, 0, 0)   # colour of font (red)
     data.SetColour(font_colour)         # set colour
-    print data.GetColour()
+    ##print data.GetColour()
     dlg = wxFontDialog(frame, data)
+    dlg.SetSize((250,250))
     if dlg.ShowModal() == wxID_OK:
         data = dlg.GetFontData()
         font = data.GetChosenFont()
index c373fa43deea31e21bb59e35e5722be30fdcf338..87758ff783b07bcc22db06b7830bd5ca117948d1 100644 (file)
@@ -19,6 +19,12 @@ class MyFrame(wxFrame):
         self.CreateStatusBar()
         self.SetStatusText("This is the statusbar")
 
+        tc = wxTextCtrl(self, -1, """
+A bunch of bogus menus have been created for this frame.  You
+can play around with them to see how they behave and then
+check the source for this sample to see how to implement them.
+""", style=wxTE_READONLY|wxTE_MULTILINE)
+
         # Prepare the menu bar
         menuBar = wxMenuBar()
 
@@ -28,7 +34,7 @@ class MyFrame(wxFrame):
         menu1.Append(102, "Venus", "")
         menu1.Append(103, "Earth", "You may select Earth too")
         menu1.AppendSeparator()
-        menu1.Append(104, "Exit", "Close this frame")
+        menu1.Append(104, "Close", "Close this frame")
         # Add menu to the menu bar
         menuBar.Append(menu1, "&Planets")
 
index 87aa2b14b9eee53be2b0ab21d20e2048226e1f3c..df761009353be026e9ae258db4fb37c7f0c6ba37 100644 (file)
@@ -19,7 +19,8 @@ class TestNB(wxNotebook):
         self.AddPage(win, "Blue")
         st = wxStaticText(win, -1,
                           "You can put nearly any type of window here,\n"
-                          "and the tabs can be on any side... (look below.)",
+                          "and if the platform supports it then the\n"
+                          "tabs can be on any side of the notebook.",
                           wxPoint(10, 10))
         st.SetForegroundColour(wxWHITE)
         st.SetBackgroundColour(wxBLUE)
index 055f1c25cc647a4500113d0f87162ad548478fc1..86500f3d10bc3a6ead6486b32ac6da2d777c5f70 100644 (file)
@@ -1,5 +1,12 @@
 from wxPython.wx import *
 
+havePopupWindow = 1
+try:
+    wxPopupWindow
+except NameError:
+    havePopupWindow = 0
+    wxPopupWindow = wxPopupTransientWindow = wxWindow
+
 #---------------------------------------------------------------------------
 
 class TestPopup(wxPopupWindow):
@@ -158,8 +165,14 @@ class TestPopupWithListbox(wxPopupWindow):
 #---------------------------------------------------------------------------
 
 def runTest(frame, nb, log):
-    win = TestPanel(nb, log)
-    return win
+    if havePopupWindow:
+        win = TestPanel(nb, log)
+        return win
+    else:
+        dlg = wxMessageDialog(frame, 'wxPopupWindow is not available on this platform.',
+                          'Sorry', wxOK | wxICON_INFORMATION)
+        dlg.ShowModal()
+        dlg.Destroy()
 
 #---------------------------------------------------------------------------
 
index 61caba204e4c580941ac0e90e4fd6a2a37b29ebb..7e097c0150113191f227107714fd9b3fa393021f 100644 (file)
@@ -13,7 +13,7 @@ def runTest(frame, nb, log):
 
     keepGoing = true
     count = 0
-    while keepGoing and count <= max:
+    while keepGoing and count < max:
         count = count + 1
         wxSleep(1)
 
index d2ea54e1b4006062acfd9c4361453eb34339c868..78921edaa97f4a5a89667166d50f2afecdfc0487 100644 (file)
@@ -3,6 +3,11 @@ from wxPython.wx import *
 
 #---------------------------------------------------------------------------
 
+RBOX1 = wxNewId()
+RBOX2 = wxNewId()
+RBUT1 = wxNewId()
+RBUT2 = wxNewId()
+
 class TestRadioButtons(wxPanel):
     def __init__(self, parent, log):
         self.log = log
@@ -12,20 +17,32 @@ class TestRadioButtons(wxPanel):
         sampleList = ['zero', 'one', 'two', 'three', 'four', 'five',
                       'six', 'seven', 'eight']
 
-        rb = wxRadioBox(self, 30, "wxRadioBox", wxPoint(35, 30), wxDefaultSize,
-                        sampleList, 3, wxRA_SPECIFY_COLS)
-        EVT_RADIOBOX(self, 30, self.EvtRadioBox)
+        sizer = wxBoxSizer(wxVERTICAL)
+        rb = wxRadioBox(self, RBOX1, "wxRadioBox",
+                        wxDefaultPosition, wxDefaultSize,
+                        sampleList, 2, wxRA_SPECIFY_COLS)
+        EVT_RADIOBOX(self, RBOX1, self.EvtRadioBox)
         #rb.SetBackgroundColour(wxBLUE)
         rb.SetToolTip(wxToolTip("This is a ToolTip!"))
+        #rb.SetLabel("wxRadioBox")
+        sizer.Add(rb, 0, wxALL, 20)
 
-        wxRadioButton(self, 32, "wxRadioButton", (235, 35))
-        wxRadioButton(self, 33, "wxRadioButton", (235, 55))
-        EVT_RADIOBUTTON(self, 32, self.EvtRadioButton)
-        EVT_RADIOBUTTON(self, 33, self.EvtRadioButton)
-
-        rb = wxRadioBox(self, 35, "", wxPoint(35, 120), wxDefaultSize,
+        rb = wxRadioBox(self, RBOX2, "", wxDefaultPosition, wxDefaultSize,
                         sampleList, 3, wxRA_SPECIFY_COLS | wxNO_BORDER)
-        EVT_RADIOBOX(self, 35, self.EvtRadioBox)
+        EVT_RADIOBOX(self, RBOX2, self.EvtRadioBox)
+        rb.SetToolTip(wxToolTip("This box has no label"))
+        sizer.Add(rb, 0, wxLEFT|wxRIGHT|wxBOTTOM, 20)
+
+        sizer.Add(wxStaticText(self, -1, "These are plain wxRadioButtons"),
+                  0, wxLEFT|wxRIGHT, 20)
+        sizer.Add(wxRadioButton(self, RBUT1, "wxRadioButton 1"),
+                  0, wxLEFT|wxRIGHT, 20)
+        sizer.Add(wxRadioButton(self, RBUT2, "wxRadioButton 2"),
+                  0, wxLEFT|wxRIGHT, 20)
+        EVT_RADIOBUTTON(self, RBUT1, self.EvtRadioButton)
+        EVT_RADIOBUTTON(self, RBUT2, self.EvtRadioButton)
+
+        self.SetSizer(sizer)
 
 
     def EvtRadioBox(self, event):
index f40facb72f279dab7ba2a029d2518a825e5355a8..1c9b45655f95f911e9c8a6934066fd42017baaac 100644 (file)
@@ -71,12 +71,14 @@ class CustomStatusBar(wxStatusBar):
 
 class TestCustomStatusBar(wxFrame):
     def __init__(self, parent, log):
-        wxFrame.__init__(self, parent, -1, 'Test Custom StatusBar',
-                         wxPoint(0,0), wxSize(500, 300))
-        wxWindow(self, -1).SetBackgroundColour(wxNamedColour("WHITE"))
+        wxFrame.__init__(self, parent, -1, 'Test Custom StatusBar')
+        #wxWindow(self, -1).SetBackgroundColour(wxNamedColour("WHITE"))
 
         self.sb = CustomStatusBar(self, log)
         self.SetStatusBar(self.sb)
+        tc = wxTextCtrl(self, -1, "", style=wxTE_READONLY|wxTE_MULTILINE)
+
+        self.SetSize((500, 300))
         EVT_CLOSE(self, self.OnCloseWindow)
 
     def OnCloseWindow(self, event):
index 80f1cf1c0473c652a581c9111e311970d4218cc4..b184437ab7525722f956a3f19cd43cbbcf14d111 100644 (file)
@@ -1,6 +1,12 @@
 
 from wxPython.wx import *
 
+haveToggleBtn = 1
+try:
+    wxToggleButton
+except NameError:
+    haveToggleBtn = 0
+
 #----------------------------------------------------------------------
 
 class TestPanel(wxPanel):
@@ -25,8 +31,16 @@ class TestPanel(wxPanel):
 #----------------------------------------------------------------------
 
 def runTest(frame, nb, log):
-    win = TestPanel(nb, log)
-    return win
+    if haveToggleBtn:
+        win = TestPanel(nb, log)
+        return win
+    else:
+        dlg = wxMessageDialog(frame, 'wxToggleButton is not available on this platform.',
+                          'Sorry', wxOK | wxICON_INFORMATION)
+        dlg.ShowModal()
+        dlg.Destroy()
+
+
 
 
 #----------------------------------------------------------------------
index bf02e8bb35fedd64b02f0d03d5e5bacf4518e126..ad4bfe5ea994797cc5e5db7bebd6b7244062e765 100644 (file)
@@ -54,11 +54,12 @@ class TestToolBar(wxFrame):
         EVT_TOOL_RCLICKED(self, -1, self.OnToolRClick)  # Match all
         EVT_TIMER(self, -1, self.OnClearSB)
 
-        tb.AddSeparator()
-        cbID = wxNewId()
-        tb.AddControl(wxComboBox(tb, cbID, "", choices=["", "This", "is a", "wxComboBox"],
-                                 size=(150,-1), style=wxCB_DROPDOWN))
-        EVT_COMBOBOX(self, cbID, self.OnCombo)
+        if wxPlatform != "__WXMAC__":
+            tb.AddSeparator()
+            cbID = wxNewId()
+            tb.AddControl(wxComboBox(tb, cbID, "", choices=["", "This", "is a", "wxComboBox"],
+                                     size=(150,-1), style=wxCB_DROPDOWN))
+            EVT_COMBOBOX(self, cbID, self.OnCombo)
 
         tb.Realize()
 
index 1911587b0eb8c7355f42dcb85f836f6f6cb28945..d0c81c5e96c70acb603d891206bc2783a93e83d4 100755 (executable)
@@ -17,7 +17,7 @@ progDir="`dirname \"$0\"`"
 defSrcPath="/projects/wx"
 defDstPath="/projects/wx/wxPython/dist"
 
-pkgName="wxMacPython"
+pkgName="wxPythonOSX"
 #version=`date +"%Y-%m-%d"`
 version=`cd $defSrcPath/wxPython; python$PYVER -c 'import setup;print setup.VERSION'`
 
index 62aaf6168e33e3e7f533036096dc5efce4cc5a34..e8e2a66f643c755ba37277f074b1110b6a8aae13 100644 (file)
@@ -159,8 +159,13 @@ class wxGenButton(wxPyControl):
         highlightClr = wxSystemSettings_GetSystemColour(wxSYS_COLOUR_BTNHIGHLIGHT)
         self.shadowPen    = wxPen(shadowClr, 1, wxSOLID)
         self.highlightPen = wxPen(highlightClr, 1, wxSOLID)
-        self.focusIndPen  = wxPen(textClr, 1, wxUSER_DASH)
-        ##self.focusIndPen = wxPen(textClr, 1, wxDOT)
+        if wxPlatform == "__WXMAC__":
+            self.focusIndPen = wxPen(textClr, 1, wxSOLID)
+        else:
+            self.focusIndPen  = wxPen(textClr, 1, wxUSER_DASH)
+            self.focusIndPen.SetDashes([1,1])
+            self.focusIndPen.SetCap(wxCAP_BUTT)
+        self.focusClr = highlightClr
 
 
     def SetBackgroundColour(self, colour):
@@ -176,6 +181,7 @@ class wxGenButton(wxPyControl):
         self.shadowPen = wxPen(wxColour(sr,sg,sb), 1, wxSOLID)
         hr, hg, hb = min(255,r+64), min(255,g+64), min(255,b+64)
         self.highlightPen = wxPen(wxColour(hr,hg,hb), 1, wxSOLID)
+        self.focusClr = wxColour(hr, hg, hb)
 
 
     def _GetLabelSize(self):
@@ -227,15 +233,17 @@ class wxGenButton(wxPyControl):
 
     def DrawFocusIndicator(self, dc, w, h):
         bw = self.bezelWidth
-        if self.hasFocus:
-            self.focusIndPen.SetColour(self.GetForegroundColour())
-        else:
-            self.focusIndPen.SetColour(self.GetBackgroundColour())
-        self.focusIndPen.SetDashes([1,1])
-        self.focusIndPen.SetCap(wxCAP_BUTT)
+##         if self.hasFocus:
+##             self.focusIndPen.SetColour(self.GetForegroundColour())
+##         else:
+##             #self.focusIndPen.SetColour(self.GetBackgroundColour())
+##             self.focusIndPen.SetColour(self.GetForegroundColour())
+        self.focusIndPen.SetColour(self.focusClr)
+        dc.SetLogicalFunction(wxINVERT)
         dc.SetPen(self.focusIndPen)
         dc.SetBrush(wxTRANSPARENT_BRUSH)
         dc.DrawRectangle(bw+2,bw+2, w-bw*2-4, h-bw*2-4)
+        dc.SetLogicalFunction(wxCOPY)
 
 
     def OnPaint(self, event):
index 3f7c57ae889517c2d2950656d24424ab0ec25b21..72fc6d5ceefd88d25b367c9081322eec6320b77d 100644 (file)
@@ -158,12 +158,13 @@ class wxEditor(wxScrolledWindow):
 
 
     def UpdateView(self, dc = None):
-        if not dc:
+        if dc is None:
             dc = wxClientDC(self)
-        self.SetCharDimensions()
-        self.KeepCursorOnScreen()
-        self.DrawSimpleCursor(0,0,dc, true)
-        self.Draw(dc)
+        if dc.Ok():
+            self.SetCharDimensions()
+            self.KeepCursorOnScreen()
+            self.DrawSimpleCursor(0,0,dc, true)
+            self.Draw(dc)
 
     def OnPaint(self, event):
         dc = wxPaintDC(self)
@@ -188,9 +189,7 @@ class wxEditor(wxScrolledWindow):
         self.selectColor = wxColour(238, 220, 120)  # r, g, b = emacsOrange
 
     def InitDoubleBuffering(self):
-        bw,bh = self.GetClientSizeTuple()
-        self.mdc = wxMemoryDC()
-        self.mdc.SelectObject(wxEmptyBitmap(bw,bh))
+        pass
 
     def DrawEditText(self, t, x, y, dc):
         dc.DrawText(t, x * self.fw, y * self.fh)
@@ -218,19 +217,19 @@ class wxEditor(wxScrolledWindow):
         if not odc:
             odc = wxClientDC(self)
 
-        dc = self.mdc
-        dc.SetFont(self.font)
-        dc.SelectObject(wxEmptyBitmap(self.bw,self.bh))
-        dc.SetBackgroundMode(wxSOLID)
-        dc.SetTextBackground(self.bgColor)
-        dc.SetTextForeground(self.fgColor)
-        dc.Clear()
-        for line in range(self.sy, self.sy + self.sh):
-            self.DrawLine(line, dc)
-        if len(self.lines) < self.sh + self.sy:
-            self.DrawEofMarker(dc)
-        odc.Blit(0,0,self.bw,self.bh,dc,0,0,wxCOPY)
-        self.DrawCursor(odc)
+        bmp = wxEmptyBitmap(max(1,self.bw), max(1,self.bh))
+        dc = wxBufferedDC(odc, bmp)
+        if dc.Ok():
+            dc.SetFont(self.font)
+            dc.SetBackgroundMode(wxSOLID)
+            dc.SetTextBackground(self.bgColor)
+            dc.SetTextForeground(self.fgColor)
+            dc.Clear()
+            for line in range(self.sy, self.sy + self.sh):
+                self.DrawLine(line, dc)
+            if len(self.lines) < self.sh + self.sy:
+                self.DrawEofMarker(dc)
+            self.DrawCursor(dc)
 
 ##------------------ eofMarker stuff