You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(116) |
Sep
(146) |
Oct
(78) |
Nov
(69) |
Dec
(70) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(188) |
Feb
(142) |
Mar
(143) |
Apr
(131) |
May
(97) |
Jun
(221) |
Jul
(127) |
Aug
(89) |
Sep
(83) |
Oct
(66) |
Nov
(47) |
Dec
(70) |
2003 |
Jan
(77) |
Feb
(91) |
Mar
(103) |
Apr
(98) |
May
(134) |
Jun
(47) |
Jul
(74) |
Aug
(71) |
Sep
(48) |
Oct
(23) |
Nov
(37) |
Dec
(13) |
2004 |
Jan
(24) |
Feb
(15) |
Mar
(52) |
Apr
(119) |
May
(49) |
Jun
(41) |
Jul
(34) |
Aug
(91) |
Sep
(169) |
Oct
(38) |
Nov
(32) |
Dec
(47) |
2005 |
Jan
(61) |
Feb
(47) |
Mar
(101) |
Apr
(130) |
May
(51) |
Jun
(65) |
Jul
(71) |
Aug
(96) |
Sep
(28) |
Oct
(20) |
Nov
(39) |
Dec
(62) |
2006 |
Jan
(13) |
Feb
(19) |
Mar
(18) |
Apr
(34) |
May
(39) |
Jun
(50) |
Jul
(63) |
Aug
(18) |
Sep
(37) |
Oct
(14) |
Nov
(56) |
Dec
(32) |
2007 |
Jan
(30) |
Feb
(13) |
Mar
(25) |
Apr
(3) |
May
(15) |
Jun
(42) |
Jul
(5) |
Aug
(17) |
Sep
(6) |
Oct
(25) |
Nov
(49) |
Dec
(10) |
2008 |
Jan
(12) |
Feb
|
Mar
(17) |
Apr
(18) |
May
(12) |
Jun
(2) |
Jul
(2) |
Aug
(6) |
Sep
(4) |
Oct
(15) |
Nov
(45) |
Dec
(9) |
2009 |
Jan
(1) |
Feb
(3) |
Mar
(18) |
Apr
(8) |
May
(3) |
Jun
|
Jul
(13) |
Aug
(2) |
Sep
(1) |
Oct
(9) |
Nov
(13) |
Dec
|
2010 |
Jan
(2) |
Feb
(3) |
Mar
(9) |
Apr
(10) |
May
|
Jun
(1) |
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
(1) |
Dec
(4) |
2011 |
Jan
|
Feb
|
Mar
(10) |
Apr
(44) |
May
(9) |
Jun
(22) |
Jul
(2) |
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2012 |
Jan
|
Feb
(1) |
Mar
(2) |
Apr
(2) |
May
|
Jun
(5) |
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
(2) |
Apr
(1) |
May
(1) |
Jun
|
Jul
(3) |
Aug
(8) |
Sep
(3) |
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: william G. <gun...@gm...> - 2010-03-12 10:12:32
|
def on_initialize(self, event): l=['1','2','3'] self.components.List1.clear() for i in l: print i #self.components.List1.clear() self.components.List1.append(i) I figured it out: if its just going to console: l=[1,2,3] works fine but to append to the list component it: l=['1','2','3'] But thanks for the quick response anyways. Thank you William Gunnells * 918-830-7300 * cell 918-615-2397 * gun...@gm... * co...@qi... On Thu, Mar 11, 2010 at 3:10 PM, XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX wrote: > > > On 10/3/10 23:24, william Gunnells wrote: >> >> I know I'm butchering thel list component. Could someone provide an exmple >> as you can see below I can print the list but not add it to List1 >> =name type=List >> I though I understood: but evidently not. >> >> def on_initialize(self, event): >> l=[1,2,3] >> for i in l: >> print i >> self.components.List1.InsertItem(i) >> self.update() >> #self.components.List1.stringSelection(i) >> > > You should be able to use append(i) instead of InsertItem(i) to add items to > the list control. > > -- > XXXXXXXXXXX > > |
From: william G. <gun...@gm...> - 2010-03-12 02:44:52
|
I tried with append and got the following error: Traceback (most recent call last): File "/usr/lib/python2.5/site-packages/wx-2.6-gtk2-unicode/wx/_core.py", line 13535, in <lambda> lambda event: event.callable(*event.args, **event.kw) ) File "horsewx.py", line 16, in on_initialize self.components.List1.append(i) File "/usr/lib/pymodules/python2.5/PythonCard/components/list.py", line 100, in append self.Append(aString) File "/usr/lib/python2.5/site-packages/wx-2.6-gtk2-unicode/wx/_core.py", line 11156, in Append return _core_.ItemContainer_Append(*args, **kwargs) TypeError: String or Unicode type required ************************************************************************* oh and this does not work either: self.components.List1.items = l Thank you William Gunnells 450 W. 7th Street Suite # 303 Tulsa, OK 74119 * 918-830-7300 * cell 918-615-2397 * gun...@gm... * co...@qi... |
From: Brian D. <deb...@ho...> - 2010-03-11 15:51:03
|
Received: from sfi-mx-1.v28.ch3.sourceforge.com ([172.29.28.121] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from <deb...@ho...>) id 1Npkf9-0006Qb-GK for pyt...@li...; Thu, 11 Mar 2010 15:51:03 +0000 Received-SPF: pass (sfi-mx-1.v28.ch3.sourceforge.com: domain of hotmail.com designates 65.55.90.141 as permitted sender) client-ip=65.55.90.141; envelope-from=deb...@ho...; helo=snt0-omc3-s2.snt0.hotmail.com; Received: from snt0-omc3-s2.snt0.hotmail.com ([65.55.90.141]) by sfi-mx-1.v28.ch3.sourceforge.com with esmtp (Exim 4.69) id 1Npkf8-0004iz-CB for pyt...@li...; Thu, 11 Mar 2010 15:51:03 +0000 Received: from SNT114-W65 ([65.55.90.135]) by snt0-omc3-s2.snt0.hotmail.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 11 Mar 2010 07:50:56 -0800 Message-ID: <SNT...@ph...l> Content-Type: multipart/alternative; boundary="_5fe43b91-a27f-4276-b5fa-4e5bba119328_" X-Originating-IP: [200.124.230.68] From: Brian Debuire <deb...@ho...> To: python users <pyt...@li...> Date: Thu, 11 Mar 2010 15:50:56 +0000 Importance: Normal In-Reply-To: <4B9...@su...> References: <13f...@ma...>, <4B9...@su...> MIME-Version: 1.0 X-OriginalArrivalTime: 11 Mar 2010 15:50:56.0886 (UTC) FILETIME=[A37CA160:01CAC132] X-Sender-Verify: failed, postmaster X-Spam-Score: -0.0 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain 0.5 VA_SENDER_VERIFY_POSTMASTER Unable to Verify pos...@do...d -0.0 SPF_PASS SPF: sender matches SPF record 1.0 HTML_MESSAGE BODY: HTML included in message X-Headers-End: 1Npkf8-0004iz-CB Subject: Re: [Pythoncard-users] list box X-BeenThere: pyt...@li... X-Mailman-Version: 2.1.9 Precedence: list List-Id: <pythoncard-users.lists.sourceforge.net> List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/pythoncard-users>, <mailto:pyt...@li...?subject=unsubscribe> List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=pythoncard-users> List-Post: <mailto:pyt...@li...> List-Help: <mailto:pyt...@li...?subject=help> List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/pythoncard-users>, <mailto:pyt...@li...?subject=subscribe> X-List-Received-Date: Thu, 11 Mar 2010 15:51:03 -0000 |
From: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - 2010-03-11 15:44:22
|
On 10/3/10 23:24, william Gunnells wrote: > I know I'm butchering thel list component. Could someone provide an exmple > as you can see below I can print the list but not add it to List1 > =name type=List > I though I understood: but evidently not. > > def on_initialize(self, event): > l=[1,2,3] > for i in l: > print i > self.components.List1.InsertItem(i) > self.update() > #self.components.List1.stringSelection(i) > You should be able to use append(i) instead of InsertItem(i) to add items to the list control. -- XXXXXXXXXXX |
From: william G. <gun...@gm...> - 2010-03-10 23:25:05
|
I know I'm butchering thel list component. Could someone provide an exmple as you can see below I can print the list but not add it to List1 =name type=List I though I understood: but evidently not. def on_initialize(self, event): l=[1,2,3] for i in l: print i self.components.List1.InsertItem(i) self.update() #self.components.List1.stringSelection(i) Thank you William Gunnells * gun...@gm... * co...@qi... |
From: Alec B. <wry...@gm...> - 2010-03-09 08:55:24
|
I'm launching a child window, and I'd like it to stay visible (unminimized) when the parent is minimized. Is there some clever window style that can accomplish this? Or some other clever way? I'm launching my child window like this. Note that I already have the ability to specify a window style. # launch it self.childWindow = model.childWindow(self, viewer.Minimal) # the child window object, abbreviated class Minimal(model.Background): .....def __init__(self, aParent, aBgRsrc): ..........aBgRsrc.style = ['wx.DEFAULT_FRAME_STYLE'] ..........model.Background.__init__(self, aParent, aBgRsrc) |
From: John H. <ec...@ya...> - 2010-03-07 06:32:04
|
Back many years ago, there were some discussions about integrating Matplotlib with Pythoncard but no actions were ever taken (that I know of). In looking at the wxmpl package, it just seem like it should be quite doable. wxmpl works by being a subclass of wx.Frame, and the main program declares itself as a sub--class of wx.App. Has anybody looked into this? Regards, -- John Henry |
From: Alec B. <wry...@gm...> - 2010-02-17 03:09:03
|
And if you're using PyInstaller and PythonCard, remember that you need to explicity import all the components. So for example: from PythonCard.components import statictext, imagebutton, textfield, textarea #, [and so on] from PythonCard import graphic, timer # [and so on] # and for our fantastic new flashwindow: from PythonCard.components import flashwindow |
From: Alec B. <wry...@gm...> - 2010-02-16 20:43:46
|
There's nothing Pythoncard-specific about the audio recording task, you simply need a GUI with a record button if I understand correctly? And probably a countdown to let them know how much time they have left unless they press the stop button? In the Pythoncard Resource Editor you'll simply be placing a bitmap button on a frame. If you want that record button to turn into a stop button while they're recording, you'll use SetBitmapLabel if I remember correctly, to change the graphic of the button. And in the Resource Editor, you'll add a command that is triggered when that button is pressed. For example the command might be called RecordButton, and in your file you'll put this line: on_RecordButton_command(self, event): ...print "record was pressed" ....#(do something here) As far as the countdown, you can either put it in the statusbar (look around for some examples, there are lots) or I believe you could update the text on a statictext widget. To check the time remaining and update the countdown, you'll use a timer. Timers are quirky and are applied to a specific widget, look for samples. For the audio recording, I did something very similar to what you're describing (a "confessional" at Burning Man) using this code as a starting point: http://www.daniweb.com/forums/thread259262.html On Tue, Feb 16, 2010 at 8:38 AM, Mohammad Abdollahi <m.a...@gm...>wrote: > Hi everyone, > > I am trying to create a GUI for audio recording to create a database of > utterances. So in principle I want it to work in a way that it presents like > 100 sentences one by one to the user and for each sentence the user can > start recording by pressing say "record" and he himself will be the one to > press STOP button when he is done saying each sentences and the audio is > stored somewhere and then moves to the next sentence. Now since I'm quite > new to this package I wanted to know if anyone can show me an example > similar to my task or perhaps general guidelines. because previously i had > done some simple Gui in MATLAB but I dont see PythonCard Gui design > organized in a same way. > > besides as usually in audio recording tasks (e.g. in MATLAB) i have to > specify the duration of the recording independent of the time that takes the > user to read a sentence out. So can I have such a user dependent recording > duration (controlled by two buttons mentioned above) using python card ? > > Many thanks in advance > > Best. > Mohammad > > > ------------------------------------------------------------------------------ > SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, > Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW > http://p.sf.net/sfu/solaris-dev2dev > _______________________________________________ > Pythoncard-users mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/pythoncard-users > > |
From: Mohammad A. <m.a...@gm...> - 2010-02-16 16:38:20
|
Hi everyone, I am trying to create a GUI for audio recording to create a database of utterances. So in principle I want it to work in a way that it presents like 100 sentences one by one to the user and for each sentence the user can start recording by pressing say "record" and he himself will be the one to press STOP button when he is done saying each sentences and the audio is stored somewhere and then moves to the next sentence. Now since I'm quite new to this package I wanted to know if anyone can show me an example similar to my task or perhaps general guidelines. because previously i had done some simple Gui in MATLAB but I dont see PythonCard Gui design organized in a same way. besides as usually in audio recording tasks (e.g. in MATLAB) i have to specify the duration of the recording independent of the time that takes the user to read a sentence out. So can I have such a user dependent recording duration (controlled by two buttons mentioned above) using python card ? Many thanks in advance Best. Mohammad |
From: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - 2010-01-05 10:37:22
|
On 5/1/10 03:42, Alec Bennett wrote: > I need to trigger an event when the user clicks anywhere on my > PythonCard window, as opposed to on a specific object. I'm wondering if > anyone can think of any clever ways to do this? > > Ideally I need the coordinates of that click as well, but I think I can > find that myself. Hmmm...I'm not near my PythonCard machine today (don't use it much nowadays, unfortunately), but am I right in thinking that on_mouseUp only gets called from components and not the background window? I don't think PythonCard offers the equivalant of a wx.Frame - could you create a blank Image component and make it the full size of the window, so it would catch mouse events not picked up by you other components? -- XXXXXXXXXXX |
From: Alec B. <wry...@gm...> - 2010-01-05 03:42:24
|
I need to trigger an event when the user clicks anywhere on my PythonCard window, as opposed to on a specific object. I'm wondering if anyone can think of any clever ways to do this? Ideally I need the coordinates of that click as well, but I think I can find that myself. |
From: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - 2009-11-17 10:46:33
|
On 17/11/09 05:14, John Henry wrote: > CALENDAR.PY appears to be just a wrapper of the wxPython Calendar widget. If there is a bug, then I suspect it's a bug in wxPython. Google for a native wxPython Calendar sample and run it to see if the bug exists or not. If so, you have to report that to the wxPython folks. > > Celio Franco wrote: >> >> >> I identify a bug in CALENDAR.PY every OCTOBER month ... >> It duplicate a day in October... and I don't know fix it !!! >> >> If you can help me about these >> I thank you Very Much !!! Just checked the widgets sample program that comes with wxPython 2.8.9.2 (Windows XP) and the calendar component looks fine for October 2009/2010. I've also created a simple PythonCard GUI with just the calendar component and that looks fine as well. Celio...what operating system and version of wxPython are you running? Maybe it's specific to a certain combination that somebody else might be able to duplicate. -- XXXXXXXXXXX |
From: John H. <ec...@ya...> - 2009-11-17 05:14:57
|
CALENDAR.PY appears to be just a wrapper of the wxPython Calendar widget. If there is a bug, then I suspect it's a bug in wxPython. Google for a native wxPython Calendar sample and run it to see if the bug exists or not. If so, you have to report that to the wxPython folks. Celio Franco wrote: > > > > > > >Dear Fellow, > >I identify a bug in CALENDAR.PY every OCTOBER month ... >It duplicate a day in October... and I don't know fix it !!! > >If you can help me about these >I thank you Very Much !!! > >CF > >________________________________ -- John Henry |
From: Celio F. <cel...@ho...> - 2009-11-17 02:10:50
|
Dear Fellow, I identify a bug in CALENDAR.PY every OCTOBER month ... It duplicate a day in October... and I don't know fix it !!! If you can help me about these I thank you Very Much !!! CF _________________________________________________________________ Windows Live: Keep your friends up to date with what you do online. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_1:092010 |
From: John H. <ec...@ya...> - 2009-11-16 17:40:42
|
After reading the code tree.py, I understand what was wrong: I shouldn't be using the mouse event. The tree.py was developed to support only those methods invoked by the minimalTree example (which is REALLY ... minimal). So, I added a couple of events to support drag&drop of items to tree.py, and found an example at http://wiki.wxpython.org/TreeControlsand updated minimalTree to do drag&drag w scrolling. I've uploaded the file to the Pythoncard Features Request page at: https://sourceforge.net/tracker/?func=detail&aid=2898599&group_id=19015&atid=369015 I hope this example program can help others see how Pythoncard supports the wxPython card control. -- John Henry ----- Original Message ---- > From: John Henry <ec...@ya...> > To: pyt...@li... > Sent: Sun, November 15, 2009 4:29:42 PM > Subject: mouse event failures (was Re: [Pythoncard-users] tree) > > I'm now taking a closer look at my tree control program and try to figure out > why somethings don't work right. > > In a native wxPython set up, when you get a dragEnd event, you should be able to > know the target from: > > target = evt.GetItem() > > > For Pythoncard, you get a "MouseEvent" object has no attribute xxx. In > addition, you can't even do a evt.Veto() for the same reason. > > Something is wrong here. > > > -- > John Henry > > > > ----- Original Message ---- > > From: John Henry > > To: pyt...@li... > > Sent: Wed, October 28, 2009 8:40:27 PM > > Subject: Re: [Pythoncard-users] tree > > > > With the help of a debugger and plenty of Google searches, and a lot of > > guessing, I was able to invoke most of the wx tree functions. It proves that > > the minimal tree wrapper does work. > > > > -- > > John Henry > > > > > > > > ----- Original Message ---- > > > From: Neil Hughes > > > To: John Henry > > > Cc: pyt...@li... > > > Sent: Wed, October 28, 2009 4:24:03 AM > > > Subject: Re: [Pythoncard-users] tree > > > > > > On 21/10/09 00:27, John Henry wrote: > > > > Does anybody have more examples on the tree control? The minimum tree > only > > > show very simple functions and I'm able to do those. But there is no > > > information on how I can traverse the tree - start with the root, get to the > > > > NextChild, get the label, delete a branch, programmatically expand or > contract > > a > > > branch, ... - all the standard things one would do with a tree... > > > > > > My use of the tree control hasn't been much more sophisticated than the > > > example. I did add a couple of extra method aliases to > > > PythonCard\components\tree.py because the ones already there are only > > > enough to support the example. So in __init__ I added > > > > > > setExpanded = wx.TreeCtrl.Expand > > > clearTree = wx.TreeCtrl.DeleteAllItems > > > > > > so that having built the tree from a dictionary I could open up all of > > > the nodes at startup, and I could tear it down and rebuild it > > > differently later on. > > > > > > -- > > > Neil Hughes > > > > > > > ------------------------------------------------------------------------------ > > > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > > > is the only developer event you need to attend this year. Jumpstart your > > > developing skills, take BlackBerry mobile applications to market and stay > > > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > > > http://p.sf.net/sfu/devconference > > > _______________________________________________ > > > Pythoncard-users mailing list > > > Pyt...@li... > > > https://lists.sourceforge.net/lists/listinfo/pythoncard-users |
From: John H. <ec...@ya...> - 2009-11-16 00:31:28
|
I'm now taking a closer look at my tree control program and try to figure out why somethings don't work right. In a native wxPython set up, when you get a dragEnd event, you should be able to know the target from: target = evt.GetItem() For Pythoncard, you get a "MouseEvent" object has no attribute xxx. In addition, you can't even do a evt.Veto() for the same reason. Something is wrong here. -- John Henry ----- Original Message ---- > From: John Henry <ec...@ya...> > To: pyt...@li... > Sent: Wed, October 28, 2009 8:40:27 PM > Subject: Re: [Pythoncard-users] tree > > With the help of a debugger and plenty of Google searches, and a lot of > guessing, I was able to invoke most of the wx tree functions. It proves that > the minimal tree wrapper does work. > > -- > John Henry > > > > ----- Original Message ---- > > From: Neil Hughes > > To: John Henry > > Cc: pyt...@li... > > Sent: Wed, October 28, 2009 4:24:03 AM > > Subject: Re: [Pythoncard-users] tree > > > > On 21/10/09 00:27, John Henry wrote: > > > Does anybody have more examples on the tree control? The minimum tree only > > show very simple functions and I'm able to do those. But there is no > > information on how I can traverse the tree - start with the root, get to the > > NextChild, get the label, delete a branch, programmatically expand or contract > a > > branch, ... - all the standard things one would do with a tree... > > > > My use of the tree control hasn't been much more sophisticated than the > > example. I did add a couple of extra method aliases to > > PythonCard\components\tree.py because the ones already there are only > > enough to support the example. So in __init__ I added > > > > setExpanded = wx.TreeCtrl.Expand > > clearTree = wx.TreeCtrl.DeleteAllItems > > > > so that having built the tree from a dictionary I could open up all of > > the nodes at startup, and I could tear it down and rebuild it > > differently later on. > > > > -- > > Neil Hughes > > > > ------------------------------------------------------------------------------ > > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > > is the only developer event you need to attend this year. Jumpstart your > > developing skills, take BlackBerry mobile applications to market and stay > > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > > http://p.sf.net/sfu/devconference > > _______________________________________________ > > Pythoncard-users mailing list > > Pyt...@li... > > https://lists.sourceforge.net/lists/listinfo/pythoncard-users |
From: John H. <ec...@ya...> - 2009-11-15 21:13:48
|
Thanks to Alex Tweedly's post a few years back and pointed to: http://wiki.wxpython.org/index.cgi/DragAndDropWithFolderMovingAndRearranging I did it using Pythoncard style: class FileDropTarget(wx.FileDropTarget): def __init__(self, parent, obj): wx.FileDropTarget.__init__(self) self.parent = parent self.obj = obj def OnDropFiles(self, x, y, filenames): try: exec "self.parent.on_%s_DropFiles(x, y, filenames)"%self.obj.name except: pass return class MyClass(Minimal): def on_initialize(self, event): Minimal.on_initialize(self, event) self.components.tree.SetDropTarget(FileDropTarget(self, self.components.tree)) def on_tree_DropFiles(self, x, y, filenames): print filenames This works. The only problem is that I don't know how to figure out who the dropped target is (in other words: which branch or item the dragged file was dropped onto) and so I can only assume that the selected item is the dropped target. Does anybody know how to figure out the dropped target? -- John Henry ----- Original Message ---- > From: John Henry <ec...@ya...> > To: pyt...@li... > Sent: Mon, October 19, 2009 8:46:11 PM > Subject: Drag-&-drop from the Windows Explorer? > > Hi list, > > Is it possible to accept a Drag-n-drop event from the IE running under Windows? > In other words, if I drag a file from the drive folder and drop it onto a > Pythoncard window, is there a way to raise an event and get, perheps the name of > the file? > > If so, does anybody has any sample code? > > Thanks, > > -- > John Henry |
From: John H. <ec...@ya...> - 2009-11-15 05:59:47
|
Received: from sfi-mx-4.v28.ch3.sourceforge.com ([172.29.28.124] helo=mx.sourceforge.net) by 235xhf1.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from <ec...@ya...>) id 1N9Y9L-0008Hd-EU for pyt...@li...; Sun, 15 Nov 2009 05:59:47 +0000 X-ACL-Warn: Received: from web81206.mail.mud.yahoo.com ([68.142.199.110]) by 1b2kzd1.ch3.sourceforge.com with smtp (Exim 4.69) id 1N9Y9G-00008x-Su for pyt...@li...; Sun, 15 Nov 2009 05:59:47 +0000 Received: (qmail 68681 invoked by uid 60001); 15 Nov 2009 05:59:37 -0000 Message-ID: <266...@we...> X-YMail-OSG: 19OJ9VMVM1mKuiAzP3Rtua4jVoxKz4lB4bjW2ZVReVEghBG_pf5HqxkVczGHI2meLvSuyZe9alvgdoQKkhU3zgqGwdA_ZH0gR1oxO__AetI3DmGTQY986wAvzmVtMgkOiYa2hzi5wPvmKpCt1.2M.h12HsS.KtCXrhK5jkqvCVAqSmW4wibgSbhxjtt8fMFHTJdLVajRm5adOW7GyQh1jb_nu4LxU9d7dngLEpmn7DGPkBwVWsqmXBjsVoGcWJ3sOy6IEWwJsHAt9x3UwkrFGAfMOHNQS1EoES2Qq9sLkwBpY4w_p0QnXvqy3.RvXBzLIyNrpu4ELRMShwywt_03xrKTO.jkpYt33G6WRp3zzXZG3Hm484N21T_T6eYTEERKZUDVTPvyQGuKvM7d0KhCyrlEqujqLnHwG3jnqPpmoZMi3vq00wwgcZh55uMnKYGwXllcaCMxcW2oumUfkcmcVtz7m1tUQLhYyBhprUvNP_Lbx3f2LOPKRMX1kj75YRI5WOZk4UqA4bw7dzzOwgP4zOwZ8v06.VTlMBf6Rr_.jNs7Q5yFwnRosA-- Received: from [99.9.39.161] by web81206.mail.mud.yahoo.com via HTTP; Sat, 14 Nov 2009 21:59:36 PST X-Mailer: YahooMailRC/211.6 YahooMailWebService/0.7.361.4 Date: Sat, 14 Nov 2009 21:59:36 -0800 (PST) From: John Henry <ec...@ya...> To: pyt...@li... MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-818445677-1258264776=:68495" X-Spam-Score: 0.6 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 DKIM_VERIFIED Domain Keys Identified Mail: signature passes verification 0.0 DKIM_SIGNED Domain Keys Identified Mail: message has a signature 1.0 HTML_MESSAGE BODY: HTML included in message -0.4 AWL AWL: From: address is in the auto white-list X-Headers-End: 1N9Y9G-00008x-Su Subject: Re: [Pythoncard-users] FlashWindow and PDFWindow X-BeenThere: pyt...@li... X-Mailman-Version: 2.1.9 Precedence: list Reply-To: John Henry <kim...@ya...> List-Id: <pythoncard-users.lists.sourceforge.net> List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/pythoncard-users>, <mailto:pyt...@li...?subject=unsubscribe> List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=pythoncard-users> List-Post: <mailto:pyt...@li...> List-Help: <mailto:pyt...@li...?subject=help> List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/pythoncard-users>, <mailto:pyt...@li...?subject=subscribe> X-List-Received-Date: Sun, 15 Nov 2009 05:59:47 -0000 |
From: John H. <ec...@ya...> - 2009-11-14 18:50:55
|
Received: from sfi-mx-2.v28.ch3.sourceforge.com ([172.29.28.122] helo=mx.sourceforge.net) by 3yr0jf1.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from <ec...@ya...>) id 1N9Ni3-0006r9-50 for pyt...@li...; Sat, 14 Nov 2009 18:50:55 +0000 X-ACL-Warn: Received: from web81204.mail.mud.yahoo.com ([68.142.199.108]) by 72vjzd1.ch3.sourceforge.com with smtp (Exim 4.69) id 1N9Nht-00055z-JG for pyt...@li...; Sat, 14 Nov 2009 18:50:54 +0000 Received: (qmail 85686 invoked by uid 60001); 14 Nov 2009 18:50:40 -0000 Message-ID: <781...@we...> X-YMail-OSG: xzzkswMVM1nZy8jnmJ5yok51RUoy8FQmPWJ1EIuoBz8OvhPc1fQ5o8Xf8ifkZFf9nDqFwZWqKX3SsTgLddUrEC9AXzEU1yUcN3bLbD9Sva0S.8nzAYEPRtMwe.hwHiEKKIEEaG50zms37wPNF9zLvX_I_r0Mmt_ZIWj30EPmR.USCvGHRzO4g8IK19KY.PwRnPbMWeVbWC7aOQN7r.FnM9sKR4EzySRdgi0QDs0REFkPYvAnhRdxjxX42Pfg1w9E7qaKiBknN4VkfsyDDDXM_VymrljTKEPQA8VlRXOtUsLGF4cg_wv5.5iefPy4rkcEfQqyPxMDET7gNlPbVSgyXxskpWAlVEK3AFpGQg5nca.X6Yg_N6e5p0fsqzZRK0KExaySL_rp3bw1FD7T3bHpUpkwT4N7KgD.arGo.S8pOYRa9xj3AQ-- Received: from [68.28.41.232] by web81204.mail.mud.yahoo.com via HTTP; Sat, 14 Nov 2009 10:50:39 PST X-Mailer: YahooMailRC/211.6 YahooMailWebService/0.7.361.4 Date: Sat, 14 Nov 2009 10:50:39 -0800 (PST) From: John Henry <ec...@ya...> To: pyt...@li... MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1701223309-1258224639=:84840" X-Spam-Score: 1.0 (+) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 DKIM_VERIFIED Domain Keys Identified Mail: signature passes verification 0.0 DKIM_SIGNED Domain Keys Identified Mail: message has a signature 1.0 HTML_MESSAGE BODY: HTML included in message X-Headers-End: 1N9Nht-00055z-JG Subject: Re: [Pythoncard-users] FlashWindow and PDFWindow X-BeenThere: pyt...@li... X-Mailman-Version: 2.1.9 Precedence: list Reply-To: John Henry <kim...@ya...> List-Id: <pythoncard-users.lists.sourceforge.net> List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/pythoncard-users>, <mailto:pyt...@li...?subject=unsubscribe> List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=pythoncard-users> List-Post: <mailto:pyt...@li...> List-Help: <mailto:pyt...@li...?subject=help> List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/pythoncard-users>, <mailto:pyt...@li...?subject=subscribe> X-List-Received-Date: Sat, 14 Nov 2009 18:50:55 -0000 |
From: John H. <ec...@ya...> - 2009-11-14 00:39:35
|
Ok. I did a search and added "PDFWindow, flashWindow" to everywhere I found htmlWindow and IEHtmlWindow and it works great now. I still a little issue with PDFWindow but otherwise both of the PDFWindow and FlashWindow wrappers work. , I'll report back once I figure out the remaining issue with PDFWindow. -- John Henry ----- Original Message ---- > From: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX > To: John Henry <kim...@ya...> > Cc: pyt...@li... > Sent: Tue, November 10, 2009 6:08:51 AM > Subject: Re: [Pythoncard-users] FlashWindow and PDFWindow > > On 2/11/09 19:48, John Henry wrote: > > I can now be more specific about the layoutEditor error in handling the > PDFWindow & FlashWindow wrappers. layoutEditor actually creates the components > fine (in the same manner as htmlWindow) but when it saves the file, it always > ended up with a size of (-1,-1). Of course that won't work properly. > > > > What do I need to do to fix this? > > Hmmm...this sounds familiar. I came across a similar problem with the > built-in components on OSX after a particular version of wxPython came > out, back in 2008, and although it won't be the same issue as you're > getting it might pinpoint the code you need to modify. Take a look at > the mailing list archive around October 08. > > The code for the layout editor will be making calls to GetBestSize() > before it writes the resource file, unless you add PDFWindow to the list > of excluded components. If GetBestSize returns a width and height equal > to the current dimensions (which it did...and might still do...on OSX), > it substitutes (-1,-1). Not sure why, and in some of the editors Kevin > has added a comment querying the need to do this. > > -- > XXXXXXXXXXX > > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Pythoncard-users mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/pythoncard-users |
From: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - 2009-11-10 14:09:08
|
On 2/11/09 19:48, John Henry wrote: > I can now be more specific about the layoutEditor error in handling the PDFWindow & FlashWindow wrappers. layoutEditor actually creates the components fine (in the same manner as htmlWindow) but when it saves the file, it always ended up with a size of (-1,-1). Of course that won't work properly. > > What do I need to do to fix this? Hmmm...this sounds familiar. I came across a similar problem with the built-in components on OSX after a particular version of wxPython came out, back in 2008, and although it won't be the same issue as you're getting it might pinpoint the code you need to modify. Take a look at the mailing list archive around October 08. The code for the layout editor will be making calls to GetBestSize() before it writes the resource file, unless you add PDFWindow to the list of excluded components. If GetBestSize returns a width and height equal to the current dimensions (which it did...and might still do...on OSX), it substitutes (-1,-1). Not sure why, and in some of the editors Kevin has added a comment querying the need to do this. -- XXXXXXXXXXX |
From: John H. <ec...@ya...> - 2009-11-02 19:48:50
|
I can now be more specific about the layoutEditor error in handling the PDFWindow & FlashWindow wrappers. layoutEditor actually creates the components fine (in the same manner as htmlWindow) but when it saves the file, it always ended up with a size of (-1,-1). Of course that won't work properly. What do I need to do to fix this? Regards, -- John Henry ----- Original Message ---- > From: John Henry <ec...@ya...> > To: John Henry <kim...@ya...>; pyt...@li... > Sent: Mon, November 2, 2009 8:42:47 AM > Subject: FlashWindow (was e: [Pythoncard-users] PDFWindow) > > Using the same approach as PDFWindow, I managed to create a wrapper for > FlashWindow. Unlike PDFWindow, this one actually works. However, layoutEditor > doesn't recognize it and screws up. How do I added it to layoutEditor. > > Here's the wrapper code, follow by test sample program: > > > """ > __version__ = "$Revision: 1.19 $" > __date__ = "$Date: 2004/05/13 02:40:24 $" > """ > > import wx > > if wx.Platform == '__WXMSW__': > from wx.lib import flashwin > else: > # need a graceful exit > pass > > from PythonCard import event, log, widget > > FlashWindowEvents = ( > ) > > class FlashWindowSpec(widget.WidgetSpec): > def __init__(self): > self.name = 'FlashWindow' > self.parent = 'Widget' > events = list(FlashWindowEvents) > attributes = { > 'size' : { 'presence' : 'optional', 'default' : [ 50, 50 ] }, > 'text' : { 'presence' : 'optional', 'default' : '' }, > } > widget.WidgetSpec.__init__(self, 'FlashWindow', 'Widget', events, > attributes ) > > > class FlashWindow(widget.Widget, flashwin.FlashWindow): > """ > An HTML window using the MS HTML control. > """ > > _spec = FlashWindowSpec() > > def __init__(self, aParent, aResource): > flashwin.FlashWindow.__init__( > self, > aParent, > -1, # widget.makeNewId(aResource.id), > aResource.position, > aResource.size, > style=wx.SUNKEN_BORDER, > #style = wx.CLIP_SIBLINGS | wx.NO_FULL_REPAINT_ON_RESIZE, > name = aResource.name > ) > > widget.Widget.__init__(self, aParent, aResource) > > self._setText(aResource.text) > > self._bindEvents(event.WIDGET_EVENTS + FlashWindowEvents) > > def _getText(self) : > #return self.GetOpenedPage() > return self.GetText() > > def _setText(self, aString): > if aString == '' or aString[0] == '<': > self.LoadMovie(0, aString) > else: > # filename or URL > self.LoadMovie(0, aString) > > text = property(_getText, _setText) > > # KEA 2004-05-02 > # this will probably end up in Scriptable or Component > # it should be completely generic > # the only problem part would be the reference to the parent (background) > # where the events are actually defined which would make this problematic > # for a compound component or events bound to a Panel > # what we really want is a reference to the application instance > # there is probably some method to give us that in wxWidgets > # UPDATE - I think GetTopLevelParent is what I was looking for > def _bindEvents(self, eventList): > # shouldn't components be subclasses of Scriptable? > # components would have their own handlers but when > # looking for a handler match it will search the parents > # for now just grab handlers from the background > > # the references below would be self.findHandler instead of > # background.findHandler > > #background = self.GetParent().GetParent() > background = wx.GetTopLevelParent(self) > > if wx.GetApp()._showDebugMenu: > bindUnusedEvents = True > else: > bindUnusedEvents = False > > # helper variable to simplify test for whether to bind > InsteadOfTypeEvents > # there is a good chance we will need to know > # which events are bound, if we want to dynamically add or remove > # events later, so go ahead and keep a reference to the list > self.boundEvents = {} > > self.eventIdToHandler = {} > self.wxEventIdMap = {} > > if 0: > print "\nBINDING...", self.name > > for eventClass in eventList: > #for eventClass in ButtonEvents: > # need to figure out a way to avoid the need > # for this id to class mapping which is used in _dispatch below > self.wxEventIdMap[eventClass.id] = eventClass > # command handler overrides normal mouseClick or select handler > # so dispatch will automatically dispatch to the command handler > # by looking up the handler this way > # it also means that if there is a command association with this > component > # then the regular mouseClick or select handler will never be bound, > just ignored > if issubclass(eventClass, event.CommandTypeEvent) and self.command: > handler = background.findHandler('on_' + self.command + > '_command') > if not handler: > handler = background.findHandler('on_' + self.name + '_' + > eventClass.name) > else: > handler = background.findHandler('on_' + self.name + '_' + > eventClass.name) > if not handler: > handler = background.findHandler('on_' + eventClass.name) > if handler or bindUnusedEvents: > # only bind events that have an event handler > # in this scenario unused events are never bound > # which is more efficient, but the Message Watcher needs > # to be changed > # alternatively we can bind everything and then in _dispatch > # if there isn't a match in eventIdToHandler then we know > # the event isn't used and we can set used to False > # the complication would be that we probably have to have to > # always call Skip() which may or may not be a hassle with > components > > # this doesn't bind command events > # they would be of the form on_somename_command > # or perhaps on_command but I don't think we would want > # to support that > # the event binding would be specific to a component > # since on dispatch command overrides something like > mouseClickEvent > # but the name of the command is not related to the component > # need to look at whether self.command has a value and then bind > # with ButtonMouseClickEvent.binding if that isn't already bound > # then in dispatch have to check again I think > > # need to avoid double binding > # also binding shouldn't be order-specific > # so how to avoid binding mouseDrag to _dispatch > # if mouseMove is already bound or if binding mouseMove > # not rebinding if mouseDrag is already bound > # perhaps MouseDragEvent keeps a reference to MouseMoveEvent > # and that is inserted into boundEvents, then we check > boundEvents > # prior to rebinding? > if not self.boundEvents.get(eventClass.binding, None): > background.Bind(eventClass.binding, self._dispatch, self) > self.boundEvents[eventClass.binding] = eventClass.name > if handler: > if 0: > print " binding", self.name, eventClass.name, > handler.__name__, eventClass.id > # KEA 2004-05-02 > # change to just using the method directly, Handler class > not needed > # actually the Handler class isn't needed at all > # so if the initial list built to simplify findHandler > # just stores a reference to the method that would be fine > # as long as the whole system uses that > # the only reason we don't just build the list ourselves > # in _bindEvents is that every component needs to do > findHandler > # so it is more efficient to do once when the Scriptable > object > # is created than to reparse for each component > #self.eventIdToHandler[eventClass.id] = handler > #self.eventIdToHandler[eventClass.id] = > handler.getFunction() > self.eventIdToHandler[eventClass.id] = handler > > if 0: > print "\n boundEvents:" > for name in self.boundEvents.values(): > print " ", name > print "\n\n" > print "\n self.eventIdToHandler:" > for id in self.eventIdToHandler: > # KEA 2004-05-02 > # change to just using the method directly, Handler class not > needed > #print " ", id, self.eventIdToHandler[id]._function > print " ", id, self.eventIdToHandler[id] > print "\n\n" > > > import sys > from PythonCard import registry > registry.Registry.getInstance().register(sys.modules[__name__].FlashWindow) > > #Sample program and rsrc file > > #!/usr/bin/python > > """ > __version__ = "$Revision: 1.19 $" > __date__ = "$Date: 2004/08/12 19:18:59 $" > """ > > from PythonCard import dialog, model > import wx > > class SimpleFlashViewer(model.Background): > > def on_initialize(self, event): > self.flash = self.components.FlashDisplay > > btnFlags = wx.RIGHT | wx.ALIGN_CENTER_VERTICAL > > sizer3 = wx.BoxSizer(wx.HORIZONTAL) > sizer3.Add((5, 5), 0) # spacer > sizer3.Add(self.flash, 1, wx.EXPAND) > sizer3.Add((10, 5), 0) # spacer > > sizer2 = wx.BoxSizer(wx.HORIZONTAL) > sizer2.Add((5, 5), 1) # spacer > sizer2.Add(self.components.btnOpenFile, 0, btnFlags, 5) > sizer2.Add(self.components.btnOpenURL, 0, btnFlags, 5) > > sizer1 = wx.BoxSizer(wx.VERTICAL) > sizer1.Add(sizer3, 1, wx.EXPAND) > sizer1.Add((5, 5), 0) # spacer > sizer1.Add(sizer2, 0, wx.EXPAND) > > sizer1.Fit(self) > sizer1.SetSizeHints(self) > self.panel.SetSizer(sizer1) > self.panel.SetAutoLayout(1) > self.panel.Layout() > > def on_btnOpenFile_mouseClick(self, event): > wildcard = "SWF files (*.swf)|*.swf;*.SWF|All files (*.*)|*.*" > result = dialog.openFileDialog(None, "Open file", '', '', wildcard) > if result.accepted: > self.flash.LoadMovie(0, result.paths[0]) > return > > def on_btnOpenURL_mouseClick(self, event): > # you can retrieve flash files from internet too > result = dialog.textEntryDialog(self, "Enter a URL of a .swf file", > "Enter URL", '') > if result.accepted and result.returnedString=="Ok": > # setting the movie property works too > self.flash.movie = result.text > return > > if __name__ == '__main__': > app = model.Application(SimpleFlashViewer) > app.MainLoop() > > # rsrc file > > {'application':{'type':'Application', > 'name':'SimpleFlashViewer', > 'backgrounds': [ > {'type':'Background', > 'name':'bgMin', > 'title':'SimpleFlashViewer PythonCard Application', > 'size':(698, 703), > 'statusBar':1, > 'style':['resizeable'], > > 'menubar': {'type':'MenuBar', > 'menus': [ > {'type':'Menu', > 'name':'menuFile', > 'label':'&File', > 'items': [ > {'type':'MenuItem', > 'name':'menuFileExit', > 'label':'E&xit\tAlt+X', > 'command':'exit', > }, > ] > }, > ] > }, > 'components': [ > > {'type':'FlashWindow', > 'name':'FlashDisplay', > 'position':(0, 30), > 'size':(685, 553), > 'backgroundColor':(255, 255, 255, 255), > }, > > {'type':'Button', > 'name':'btnOpenFile', > 'position':(524, 593), > 'label':'Open File', > }, > > {'type':'Button', > 'name':'btnOpenURL', > 'position':(599, 593), > 'label':'Open URL', > }, > > ] # end components > } # end background > ] # end backgrounds > } } > > > -- > John Henry |
From: John H. <ec...@ya...> - 2009-11-02 16:43:05
|
Using the same approach as PDFWindow, I managed to create a wrapper for FlashWindow. Unlike PDFWindow, this one actually works. However, layoutEditor doesn't recognize it and screws up. How do I added it to layoutEditor. Here's the wrapper code, follow by test sample program: """ __version__ = "$Revision: 1.19 $" __date__ = "$Date: 2004/05/13 02:40:24 $" """ import wx if wx.Platform == '__WXMSW__': from wx.lib import flashwin else: # need a graceful exit pass from PythonCard import event, log, widget FlashWindowEvents = ( ) class FlashWindowSpec(widget.WidgetSpec): def __init__(self): self.name = 'FlashWindow' self.parent = 'Widget' events = list(FlashWindowEvents) attributes = { 'size' : { 'presence' : 'optional', 'default' : [ 50, 50 ] }, 'text' : { 'presence' : 'optional', 'default' : '' }, } widget.WidgetSpec.__init__(self, 'FlashWindow', 'Widget', events, attributes ) class FlashWindow(widget.Widget, flashwin.FlashWindow): """ An HTML window using the MS HTML control. """ _spec = FlashWindowSpec() def __init__(self, aParent, aResource): flashwin.FlashWindow.__init__( self, aParent, -1, # widget.makeNewId(aResource.id), aResource.position, aResource.size, style=wx.SUNKEN_BORDER, #style = wx.CLIP_SIBLINGS | wx.NO_FULL_REPAINT_ON_RESIZE, name = aResource.name ) widget.Widget.__init__(self, aParent, aResource) self._setText(aResource.text) self._bindEvents(event.WIDGET_EVENTS + FlashWindowEvents) def _getText(self) : #return self.GetOpenedPage() return self.GetText() def _setText(self, aString): if aString == '' or aString[0] == '<': self.LoadMovie(0, aString) else: # filename or URL self.LoadMovie(0, aString) text = property(_getText, _setText) # KEA 2004-05-02 # this will probably end up in Scriptable or Component # it should be completely generic # the only problem part would be the reference to the parent (background) # where the events are actually defined which would make this problematic # for a compound component or events bound to a Panel # what we really want is a reference to the application instance # there is probably some method to give us that in wxWidgets # UPDATE - I think GetTopLevelParent is what I was looking for def _bindEvents(self, eventList): # shouldn't components be subclasses of Scriptable? # components would have their own handlers but when # looking for a handler match it will search the parents # for now just grab handlers from the background # the references below would be self.findHandler instead of # background.findHandler #background = self.GetParent().GetParent() background = wx.GetTopLevelParent(self) if wx.GetApp()._showDebugMenu: bindUnusedEvents = True else: bindUnusedEvents = False # helper variable to simplify test for whether to bind InsteadOfTypeEvents # there is a good chance we will need to know # which events are bound, if we want to dynamically add or remove # events later, so go ahead and keep a reference to the list self.boundEvents = {} self.eventIdToHandler = {} self.wxEventIdMap = {} if 0: print "\nBINDING...", self.name for eventClass in eventList: #for eventClass in ButtonEvents: # need to figure out a way to avoid the need # for this id to class mapping which is used in _dispatch below self.wxEventIdMap[eventClass.id] = eventClass # command handler overrides normal mouseClick or select handler # so dispatch will automatically dispatch to the command handler # by looking up the handler this way # it also means that if there is a command association with this component # then the regular mouseClick or select handler will never be bound, just ignored if issubclass(eventClass, event.CommandTypeEvent) and self.command: handler = background.findHandler('on_' + self.command + '_command') if not handler: handler = background.findHandler('on_' + self.name + '_' + eventClass.name) else: handler = background.findHandler('on_' + self.name + '_' + eventClass.name) if not handler: handler = background.findHandler('on_' + eventClass.name) if handler or bindUnusedEvents: # only bind events that have an event handler # in this scenario unused events are never bound # which is more efficient, but the Message Watcher needs # to be changed # alternatively we can bind everything and then in _dispatch # if there isn't a match in eventIdToHandler then we know # the event isn't used and we can set used to False # the complication would be that we probably have to have to # always call Skip() which may or may not be a hassle with components # this doesn't bind command events # they would be of the form on_somename_command # or perhaps on_command but I don't think we would want # to support that # the event binding would be specific to a component # since on dispatch command overrides something like mouseClickEvent # but the name of the command is not related to the component # need to look at whether self.command has a value and then bind # with ButtonMouseClickEvent.binding if that isn't already bound # then in dispatch have to check again I think # need to avoid double binding # also binding shouldn't be order-specific # so how to avoid binding mouseDrag to _dispatch # if mouseMove is already bound or if binding mouseMove # not rebinding if mouseDrag is already bound # perhaps MouseDragEvent keeps a reference to MouseMoveEvent # and that is inserted into boundEvents, then we check boundEvents # prior to rebinding? if not self.boundEvents.get(eventClass.binding, None): background.Bind(eventClass.binding, self._dispatch, self) self.boundEvents[eventClass.binding] = eventClass.name if handler: if 0: print " binding", self.name, eventClass.name, handler.__name__, eventClass.id # KEA 2004-05-02 # change to just using the method directly, Handler class not needed # actually the Handler class isn't needed at all # so if the initial list built to simplify findHandler # just stores a reference to the method that would be fine # as long as the whole system uses that # the only reason we don't just build the list ourselves # in _bindEvents is that every component needs to do findHandler # so it is more efficient to do once when the Scriptable object # is created than to reparse for each component #self.eventIdToHandler[eventClass.id] = handler #self.eventIdToHandler[eventClass.id] = handler.getFunction() self.eventIdToHandler[eventClass.id] = handler if 0: print "\n boundEvents:" for name in self.boundEvents.values(): print " ", name print "\n\n" print "\n self.eventIdToHandler:" for id in self.eventIdToHandler: # KEA 2004-05-02 # change to just using the method directly, Handler class not needed #print " ", id, self.eventIdToHandler[id]._function print " ", id, self.eventIdToHandler[id] print "\n\n" import sys from PythonCard import registry registry.Registry.getInstance().register(sys.modules[__name__].FlashWindow) #Sample program and rsrc file #!/usr/bin/python """ __version__ = "$Revision: 1.19 $" __date__ = "$Date: 2004/08/12 19:18:59 $" """ from PythonCard import dialog, model import wx class SimpleFlashViewer(model.Background): def on_initialize(self, event): self.flash = self.components.FlashDisplay btnFlags = wx.RIGHT | wx.ALIGN_CENTER_VERTICAL sizer3 = wx.BoxSizer(wx.HORIZONTAL) sizer3.Add((5, 5), 0) # spacer sizer3.Add(self.flash, 1, wx.EXPAND) sizer3.Add((10, 5), 0) # spacer sizer2 = wx.BoxSizer(wx.HORIZONTAL) sizer2.Add((5, 5), 1) # spacer sizer2.Add(self.components.btnOpenFile, 0, btnFlags, 5) sizer2.Add(self.components.btnOpenURL, 0, btnFlags, 5) sizer1 = wx.BoxSizer(wx.VERTICAL) sizer1.Add(sizer3, 1, wx.EXPAND) sizer1.Add((5, 5), 0) # spacer sizer1.Add(sizer2, 0, wx.EXPAND) sizer1.Fit(self) sizer1.SetSizeHints(self) self.panel.SetSizer(sizer1) self.panel.SetAutoLayout(1) self.panel.Layout() def on_btnOpenFile_mouseClick(self, event): wildcard = "SWF files (*.swf)|*.swf;*.SWF|All files (*.*)|*.*" result = dialog.openFileDialog(None, "Open file", '', '', wildcard) if result.accepted: self.flash.LoadMovie(0, result.paths[0]) return def on_btnOpenURL_mouseClick(self, event): # you can retrieve flash files from internet too result = dialog.textEntryDialog(self, "Enter a URL of a .swf file", "Enter URL", '') if result.accepted and result.returnedString=="Ok": # setting the movie property works too self.flash.movie = result.text return if __name__ == '__main__': app = model.Application(SimpleFlashViewer) app.MainLoop() # rsrc file {'application':{'type':'Application', 'name':'SimpleFlashViewer', 'backgrounds': [ {'type':'Background', 'name':'bgMin', 'title':'SimpleFlashViewer PythonCard Application', 'size':(698, 703), 'statusBar':1, 'style':['resizeable'], 'menubar': {'type':'MenuBar', 'menus': [ {'type':'Menu', 'name':'menuFile', 'label':'&File', 'items': [ {'type':'MenuItem', 'name':'menuFileExit', 'label':'E&xit\tAlt+X', 'command':'exit', }, ] }, ] }, 'components': [ {'type':'FlashWindow', 'name':'FlashDisplay', 'position':(0, 30), 'size':(685, 553), 'backgroundColor':(255, 255, 255, 255), }, {'type':'Button', 'name':'btnOpenFile', 'position':(524, 593), 'label':'Open File', }, {'type':'Button', 'name':'btnOpenURL', 'position':(599, 593), 'label':'Open URL', }, ] # end components } # end background ] # end backgrounds } } -- John Henry |
From: John H. <ec...@ya...> - 2009-10-31 18:37:43
|
I got a little further. Turns out I had to pass down an ID of -1. Not sure if it's working yet but at least it's behaving the same as an wxWindow example - the file is loaded but I'm not seeing anything - but I believe the binding itself is working. """ __version__ = "$Revision: 1.19 $" __date__ = "$Date: 2004/05/13 02:40:24 $" """ import wx if wx.Platform == '__WXMSW__': from wx.lib import pdfwin else: # need a graceful exit pass from PythonCard import event, log, widget PDFWindowEvents = ( ) class PDFWindowSpec(widget.WidgetSpec): def __init__(self): self.name = 'PDFWindow' self.parent = 'Widget' events = list(PDFWindowEvents) attributes = { 'size' : { 'presence' : 'optional', 'default' : [ 50, 50 ] }, 'text' : { 'presence' : 'optional', 'default' : '' }, } widget.WidgetSpec.__init__(self, 'PDFWindow', 'Widget', events, attributes ) class PDFWindow(widget.Widget, pdfwin.PDFWindow): """ An HTML window using the MS HTML control. """ _spec = PDFWindowSpec() def __init__(self, aParent, aResource): pdfwin.PDFWindow.__init__( self, aParent, -1, # widget.makeNewId(aResource.id), aResource.position, aResource.size, style=wx.SUNKEN_BORDER, #style = wx.CLIP_SIBLINGS | wx.NO_FULL_REPAINT_ON_RESIZE, name = aResource.name ) widget.Widget.__init__(self, aParent, aResource) self._setText(aResource.text) self._bindEvents(event.WIDGET_EVENTS + PDFWindowEvents) def _getText(self) : #return self.GetOpenedPage() return self.GetText() def _setText(self, aString): if aString == '' or aString[0] == '<': self.LoadString(aString) else: # filename or URL self.LoadFile(aString) text = property(_getText, _setText) # KEA 2004-05-02 # this will probably end up in Scriptable or Component # it should be completely generic # the only problem part would be the reference to the parent (background) # where the events are actually defined which would make this problematic # for a compound component or events bound to a Panel # what we really want is a reference to the application instance # there is probably some method to give us that in wxWidgets # UPDATE - I think GetTopLevelParent is what I was looking for def _bindEvents(self, eventList): # shouldn't components be subclasses of Scriptable? # components would have their own handlers but when # looking for a handler match it will search the parents # for now just grab handlers from the background # the references below would be self.findHandler instead of # background.findHandler #background = self.GetParent().GetParent() background = wx.GetTopLevelParent(self) if wx.GetApp()._showDebugMenu: bindUnusedEvents = True else: bindUnusedEvents = False # helper variable to simplify test for whether to bind InsteadOfTypeEvents # there is a good chance we will need to know # which events are bound, if we want to dynamically add or remove # events later, so go ahead and keep a reference to the list self.boundEvents = {} self.eventIdToHandler = {} self.wxEventIdMap = {} if 0: print "\nBINDING...", self.name for eventClass in eventList: #for eventClass in ButtonEvents: # need to figure out a way to avoid the need # for this id to class mapping which is used in _dispatch below self.wxEventIdMap[eventClass.id] = eventClass # command handler overrides normal mouseClick or select handler # so dispatch will automatically dispatch to the command handler # by looking up the handler this way # it also means that if there is a command association with this component # then the regular mouseClick or select handler will never be bound, just ignored if issubclass(eventClass, event.CommandTypeEvent) and self.command: handler = background.findHandler('on_' + self.command + '_command') if not handler: handler = background.findHandler('on_' + self.name + '_' + eventClass.name) else: handler = background.findHandler('on_' + self.name + '_' + eventClass.name) if not handler: handler = background.findHandler('on_' + eventClass.name) if handler or bindUnusedEvents: # only bind events that have an event handler # in this scenario unused events are never bound # which is more efficient, but the Message Watcher needs # to be changed # alternatively we can bind everything and then in _dispatch # if there isn't a match in eventIdToHandler then we know # the event isn't used and we can set used to False # the complication would be that we probably have to have to # always call Skip() which may or may not be a hassle with components # this doesn't bind command events # they would be of the form on_somename_command # or perhaps on_command but I don't think we would want # to support that # the event binding would be specific to a component # since on dispatch command overrides something like mouseClickEvent # but the name of the command is not related to the component # need to look at whether self.command has a value and then bind # with ButtonMouseClickEvent.binding if that isn't already bound # then in dispatch have to check again I think # need to avoid double binding # also binding shouldn't be order-specific # so how to avoid binding mouseDrag to _dispatch # if mouseMove is already bound or if binding mouseMove # not rebinding if mouseDrag is already bound # perhaps MouseDragEvent keeps a reference to MouseMoveEvent # and that is inserted into boundEvents, then we check boundEvents # prior to rebinding? if not self.boundEvents.get(eventClass.binding, None): background.Bind(eventClass.binding, self._dispatch, self) self.boundEvents[eventClass.binding] = eventClass.name if handler: if 0: print " binding", self.name, eventClass.name, handler.__name__, eventClass.id # KEA 2004-05-02 # change to just using the method directly, Handler class not needed # actually the Handler class isn't needed at all # so if the initial list built to simplify findHandler # just stores a reference to the method that would be fine # as long as the whole system uses that # the only reason we don't just build the list ourselves # in _bindEvents is that every component needs to do findHandler # so it is more efficient to do once when the Scriptable object # is created than to reparse for each component #self.eventIdToHandler[eventClass.id] = handler #self.eventIdToHandler[eventClass.id] = handler.getFunction() self.eventIdToHandler[eventClass.id] = handler if 0: print "\n boundEvents:" for name in self.boundEvents.values(): print " ", name print "\n\n" print "\n self.eventIdToHandler:" for id in self.eventIdToHandler: # KEA 2004-05-02 # change to just using the method directly, Handler class not needed #print " ", id, self.eventIdToHandler[id]._function print " ", id, self.eventIdToHandler[id] print "\n\n" import sys from PythonCard import registry registry.Registry.getInstance().register(sys.modules[__name__].PDFWindow) -- John Henry ----- Original Message ---- > From: John Henry <ec...@ya...> > To: pyt...@li... > Sent: Wed, October 28, 2009 8:37:26 PM > Subject: Re: [Pythoncard-users] PDFWindow > > Without knowing what I am doing, I used htmlWindow as a sample and created a > PDFWindow wrapper. The problem is that when it chokes at the line: > > wx.activex.ActiveXWindow.__init__(self, parent, > wx.activex.CLSID('{CA8A9780-280D-11CF-A24D-444553540000}'), > ID, pos, size, style, name) > > inside wx\lib\pdfwin.py. I have no clue what to do. > > > > > > > """ > __version__ = "$Revision: 1.17 $" > __date__ = "$Date: 2004/05/13 02:40:24 $" > """ > > import wx > from wx.lib import pdfwin > from PythonCard import event, log, widget > > class PDFWindowSpec(widget.WidgetSpec): > def __init__(self): > events = [] > attributes = { > 'size' : { 'presence' : 'optional', 'default' : [ 50, 50 ] }, > 'text' : { 'presence' : 'optional', 'default' : '' }, > } > widget.WidgetSpec.__init__(self, 'PDFWindow', 'Widget', events, > attributes ) > > > class PDFWindow(widget.Widget, pdfwin.PDFWindow): > """ > An PDF window. > """ > > _spec = PDFWindowSpec() > > def __init__(self, aParent, aResource): > self._addressField = None > > id=widget.makeNewId(aResource.id) > pdfwin.PDFWindow.__init__( > self, > aParent, > id, > aResource.position, > aResource.size, > style=wx.SUNKEN_BORDER, > #style = wx.HW_SCROLLBAR_AUTO | wx.CLIP_SIBLINGS, > name = aResource.name > ) > > widget.Widget.__init__(self, aParent, aResource) > > self._setText(aResource.text) > > self._bindEvents(event.WIDGET_EVENTS) > > def setAddressField(self, field): > self._addressField = field > > def _getText(self) : > return self.GetOpenedFile() > > def _setText(self, aString): > if aString == '' or aString[0] == '<': > self.SetFile(aString) > else: > # filename > self.LoadFile(aString) > #self._delegate.Refresh() > > def base_LoadFile(self, url): > log.debug("base_LoadFile " + url) > if self._addressField is not None: > self._addressField.text = url > log.debug("loaded") > pdfwin.PDFWindow.base_LoadFile(self, url) > > def LoadFile(self, url): > log.debug("LoadFile " + url) > if self._addressField is not None: > self._addressField.text = url > log.debug("loaded") > pdfwin.PDFWindow.LoadFile(self, url) > > def SetFile(self, text): > log.debug("SetFile " + text) > #if self._addressField is not None: > # self._addressField.text = text > # log.debug("set") > pdfwin.PDFWindow.SetFile(self, text) > > def OnLinkClicked(self, link): > log.debug("OnLinkClicked " + str(link)) > if self._addressField is not None: > url = self.GetOpenedFile() > log.debug("url: " + url) > baseURL = url[:url.rfind('/')] > log.debug("baseURL: " + baseURL) > href = link.GetHref() > log.debug("href: " + href) > if href.find('://') != -1: > self._addressField.text = href > else: > self._addressField.text = baseURL + '/' + href > log.debug("full url: " + self._addressField.text) > # Virtuals in the base class have been renamed with base_ on the front. > pdfwin.PDFWindow.base_OnLinkClicked(self, link) > > text = property(_getText, _setText) > > > import sys > from PythonCard import registry > registry.Registry.getInstance().register(sys.modules[__name__].PDFWindow) > > > -- > John Henry > > > > ----- Original Message ---- > > From: Neil Hughes > > To: John Henry > > Cc: pyt...@li... > > Sent: Wed, October 28, 2009 3:11:25 AM > > Subject: Re: [Pythoncard-users] PDFWindow > > > > On 28/10/09 04:08, John Henry wrote: > > > What ever happened to PDFWindow for Pythoncard? Did it ever happened? > > > > > > http://osdir.com/ml/python.pythoncard/2004-04/msg00116.html > > > > Probably not....this is the first I've heard of it, not having delved > > too deeply into the mailing list archives. > > > > With, I suspect, quite a few of the PythonCard users using non-Windows > > development machines (including Kevin) maybe one of the factors is the > > use of ActiveX? > > > > -- > > Neil Hughes > > > > > > ------------------------------------------------------------------------------ > > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > > is the only developer event you need to attend this year. Jumpstart your > > developing skills, take BlackBerry mobile applications to market and stay > > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > > http://p.sf.net/sfu/devconference > > _______________________________________________ > > Pythoncard-users mailing list > > Pyt...@li... > > https://lists.sourceforge.net/lists/listinfo/pythoncard-users |