Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old April 7th, 2004, 09:31 PM
roypython roypython is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 71 roypython User rank is Lance Corporal (50 - 100 Reputation Level)roypython User rank is Lance Corporal (50 - 100 Reputation Level)roypython User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 h 20 m 49 sec
Reputation Power: 5
Thumbs up wxPython questions

Hi, I encountered some problems when using wxPython :

1. I'm using a frame that includes wx.lib.iewin
the Html page will include text and links.
I would like to able to :
1.1 Capture the click event on the link
1.2 Cancel the click event so that the ActiveX browser
won't navigate.
1.3 Open IE app with that link info

The problem:
1.4 Which event does this ActiveX exposes so I can
hook up to it? ( I couldn't find ANY documentation)
2. How to get the IE app path from the registry?
( and then use os.system(path) to run IE )
( I tried to used the absolute path,
but it doesn't work as well
os.system("C:\\Program
Files\\Internet\Explorer\\iexplore.exe")
)

2. Regarding raising events:
I defined custom event class, and Icon class ( which
creates an icon on the task bar). On dbl click on the icon, I
want to raise custom event ( so listeners can hook up to
it) , but since Icon class is a 'plain
one ' - it doesn't have GetEventHandler() method
What is the best way to achieve that?
The code is attached:
###### The custom event class ########
import sys
import wx

class CustomEvt(wx.PyCommandEvent):
def __init__(self, evtType, id=-1):
wx.PyCommandEvent.__init__(self, evtType, id)
self.myVal = None

def SetMyVal(self, val):
self.myVal = val

def GetMyVal(self):
return self.myVal

########## The IconClass ##########
from wxPython.wx import *
import sys
from CustomeEvent import CustomEvt

# custome Events
myEVT_ICON_DBLCLICKED = wxNewEventType()
EVT_ICON_DBLCLICKED = wxPyEventBinder(myEVT_ICON_DBLCLICKED, 0)

class Icon():

def __init__(self):
# instantiate task bar icon
self.tbicon = wxTaskBarIcon()
# set icon
self.updateIcon()
# set up event handlers to catch tray icon events
EVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnLeftDblClick)
wxInitAllImageHandlers()
return None


def updateIcon(self):
self.tbicon.SetIcon(wxIcon('icon1.ico', wxBITMAP_TYPE_ICO), '')


def OnLeftDblClick(self,event):
evt = CustomEvt(myEVT_ICON_DBLCLICKED)
self.GetEventHandler().ProcessEvent(evt)
event.Skip()


Thanks a lot
Roy

Reply With Quote
  #2  
Old April 8th, 2004, 07:36 AM
Grim Archon's Avatar
Grim Archon Grim Archon is offline
Mini me.
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2003
Location: Cambridge, UK
Posts: 783 Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)  Folding Points: 1488 Folding Title: Novice Folder
Time spent in forums: 3 Days 2 h 15 m 57 sec
Reputation Power: 7
Send a message via MSN to Grim Archon
One thing you can do is define your own event handler for the pre-navigate event.
Code:
    EVT_MSHTML_BEFORENAVIGATE2(self, -1, self.OnBeforeNavigate2)
    def OnBeforeNavigate2(self, evt):
        if  evt.GetText1().find(self.homepage) != 0:
            self.ie.Navigate(self.homepage)


The success of this is site dependent.

You could combine that with a call to the webbrowser module.

Have a look at the wx Demo it uses the taskbar icon and has it's own menu.

Tip: when posting code use a code block to get the indentation right!
__________________
*** Experimental Python Markup CGI V2 ***

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > wxPython questions


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway