X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3cc7ea5302e6907f597bd20572ead953fde0c879..d9f39e09e82e99c422619f4e3df536d0a9e87987:/utils/wxPython/tests/wxSlash.py?ds=inline diff --git a/utils/wxPython/tests/wxSlash.py b/utils/wxPython/tests/wxSlash.py index 0389a45e80..ae1164d233 100644 --- a/utils/wxPython/tests/wxSlash.py +++ b/utils/wxPython/tests/wxSlash.py @@ -1,12 +1,5 @@ #!/usr/bin/python -from wxPython.wx import * -from httplib import HTTP -from htmllib import HTMLParser -import os -import re -import formatter - -__doc__ = """This is wxSlash 1.1 +"""This is wxSlash 1.1 It's the obligatory Slashdot.org headlines reader that any modern widget set/library must have in order to be taken seriously :-) @@ -34,6 +27,13 @@ the idea for this applet. Harm van der Heijden (H.v.d.Heijden@phys.tue.nl) """ +from wxPython.wx import * +from httplib import HTTP +from htmllib import HTMLParser +import os +import re +import formatter + class HTMLTextView(wxFrame): def __init__(self, parent, id, title='HTMLTextView', url=None): wxFrame.__init__(self, parent, id, title, wxPyDefaultPosition, @@ -214,7 +214,7 @@ class AppFrame(wxFrame): self.BrowserSettings = "xterm -e lynx %s &" elif wxPlatform == '__WXMSW__': # netscape 4.x likes to hang out here... - self.BrowserSettings = '\progra~1\Netscape\Communicator\Program\netscape.exe %s' + self.BrowserSettings = '\\progra~1\\Netscape\\Communicator\\Program\\netscape.exe %s' else: # a wild guess... self.BrowserSettings = 'netscape %s' @@ -235,6 +235,7 @@ class AppFrame(wxFrame): self.list.SetColumnWidth(3, 100) EVT_LIST_ITEM_SELECTED(self, 1100, self.OnItemSelected) + EVT_LEFT_DCLICK(self.list, self.OnLeftDClick) self.logprint("Connecting to slashdot... Please wait.") # wxYield doesn't yet work here. That's why we use a timer @@ -319,6 +320,22 @@ class AppFrame(wxFrame): self.current = event.m_itemIndex self.logprint("URL: %s" % (self.url[self.current])) + def OnLeftDClick(self, event): + (x,y) = event.Position(); + # Actually, we should convert x,y to logical coords using + # a dc, but only for a wxScrolledWindow widget. + # Now wxGTK derives wxListCtrl from wxScrolledWindow, + # and wxMSW from wxControl... So that doesn't work. + #dc = wxClientDC(self.list) + ##self.list.PrepareDC(dc) + #x = dc.DeviceToLogicalX( event.GetX() ) + #y = dc.DeviceToLogicalY( event.GetY() ) + id = self.list.HitTest(wxPoint(x,y)) + #print "Double click at %d %d" % (x,y), id + # Okay, we got a double click. Let's assume it's the current selection + wxYield() + self.OnViewArticle(event) + def OnCloseWindow(self, event): self.Destroy()