Discussion:
[Bitpim-devel] ringtones to new fileview
Steven Palm
2004-04-06 00:22:16 UTC
Permalink
Roger,

I made a first pass at taking your logic/code for wallpaper.py and move
it into ringtone.py. I got tired of not being able to view them
properly on my Mac.

Since I'm not really very familiar with all the stuff you are doing in
there and the bpmedia stuff, please have a look at it to make sure I
haven't made a mess of things. If we keep that same view (with a
graphic) it might be nice to have a different graphic for MID and QCP
files, although I think the value of the graphic at all is somewhat
dubious. ;-)
Roger Binns
2004-04-06 07:28:10 UTC
Permalink
Post by Steven Palm
I made a first pass at taking your logic/code for wallpaper.py and move
it into ringtone.py. I got tired of not being able to view them
properly on my Mac.
:-)
Post by Steven Palm
Since I'm not really very familiar with all the stuff you are doing in
there and the bpmedia stuff, please have a look at it to make sure I
haven't made a mess of things.
I did some tweaking on it. There are definitely pieces missing, as the
origin doesn't show up. (I had remembered that it was going to be
quite a bit of work, which is why I kept deferring starting it)
Post by Steven Palm
If we keep that same view (with a
graphic) it might be nice to have a different graphic for MID and QCP
files, although I think the value of the graphic at all is somewhat
dubious. ;-)
The intention was to have different icons for the different formats.
I have changed the default icon size to be 24x24 so less screen real
estate is used.

One of my future plans is to highlight media that are not compatible/
appropriate for the currently selected phone. That would happen for
example if the format isn't supported (eg one entry is an mp3 and the
phone doesn't support them) or if the size is wrong (eg and image
is 640x480 but the phone expects 120x98).

Roger
Roger Binns
2004-04-06 07:31:35 UTC
Permalink
Post by Roger Binns
Post by Steven Palm
Since I'm not really very familiar with all the stuff you are doing in
there and the bpmedia stuff, please have a look at it to make sure I
haven't made a mess of things.
I did some tweaking on it. There are definitely pieces missing, as the
origin doesn't show up. (I had remembered that it was going to be
quite a bit of work, which is why I kept deferring starting it)
You also can't add anything. A fair amount more code needs to
written to complete it.

Roger
Steven Palm
2004-04-06 13:36:23 UTC
Permalink
Post by Roger Binns
Post by Steven Palm
Since I'm not really very familiar with all the stuff you are doing in
there and the bpmedia stuff, please have a look at it to make sure I
haven't made a mess of things.
I did some tweaking on it. There are definitely pieces missing, as the
origin doesn't show up. (I had remembered that it was going to be
quite a bit of work, which is why I kept deferring starting it)
Well, as time permits I'll keep poking at it if you don't mind. If I
get in your way, just let me know. :-)
Steven Palm
2004-04-06 15:19:44 UTC
Permalink
Post by Roger Binns
You also can't add anything. A fair amount more code needs to
written to complete it.
...was that a general issue with the new fileview, or is that
something specific to the ringer implementation? I just tried a
dragndrop on the Mac and it doesn't work, but then again it doesn't
work on the wallpaper view either. I see some code in there to deal
with it, but haven't traced it through all the way to make sure it's
being used.

I realize you are on other issues now, so I will keep working on this
as time allows and see if I can make some more progress. I do have the
'origin' of the ringers coming through now, so at least that little bit
is cleaned up. :-)
Roger Binns
2004-04-06 17:12:05 UTC
Permalink
Post by Steven Palm
...was that a general issue with the new fileview,
My plan was to complete more of it in the wallpaper view,
and then the ringer view would be a quick changeover :-)
Post by Steven Palm
I realize you are on other issues now, so I will keep working on this
as time allows and see if I can make some more progress. I do have the
'origin' of the ringers coming through now, so at least that little bit
is cleaned up. :-)
Yup. The principle here is that you touched it last, so it is yours
to cleanup :-)

Hopefully BitFling will be read for the next build. All the security
is done, the transport is done, and I just have to implement a few
more methods. (There are still a few more issues with the paramiko
library but the author has promised me fixes).

Roger
Steven Palm
2004-04-06 22:52:45 UTC
Permalink
Post by Roger Binns
Post by Steven Palm
...was that a general issue with the new fileview,
My plan was to complete more of it in the wallpaper view,
and then the ringer view would be a quick changeover :-)
Strange, I'm still digging but can't grok why the dragndrop events
aren't coming through... The OnDrop() method is never called. Hmmmm....

I thought it may be due to using a subclass of a subclass of wxPanel,
but that isn't it... I took the dragndrop sample and made it use a
bpmedia.MediaDisplayer object and it works just fine... I'll include
that below, but you also need the run.py module from the wxPython demo
directory.

Anyway, still working on it, but still not getting anything to trigger
the OnDrop() method...

import wx
import guiwidgets
import bpmedia

#----------------------------------------------------------------------

class MyFileDropTarget(wx.FileDropTarget):
def __init__(self, window, log):
wx.FileDropTarget.__init__(self)
self.window = window
self.log = log

def OnDropFiles(self, x, y, filenames):
print "%d file(s) dropped at %d,%d\n" % (len(filenames), x, y)
for file in filenames:
print file,":",


class FileDropPanel(wx.Panel):
def __init__(self, parent, log):
wx.Panel.__init__(self, parent, -1)

dt = MyFileDropTarget(self, log)
self.SetDropTarget(dt)

#----------------------------------------------------------------------

#class TestPanel(wx.Panel):
class TestPanel(bpmedia.MediaDisplayer):
def __init__(self, parent, log):
# wx.Panel.__init__(self, parent, -1)
bpmedia.MediaDisplayer.__init__(self, parent)

self.SetAutoLayout(True)
outsideSizer = wx.BoxSizer(wx.VERTICAL)
outsideSizer.Add(FileDropPanel(self, log), 1, wx.EXPAND)
self.SetSizer(outsideSizer)

#----------------------------------------------------------------------

def runTest(frame, nb, log):
win = TestPanel(nb, log)
return win

#----------------------------------------------------------------------

if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])
Steven Palm
2004-04-06 23:08:20 UTC
Permalink
Post by Steven Palm
Strange, I'm still digging but can't grok why the dragndrop events
aren't coming through... The OnDrop() method is never called.
Hmmmm....
Interesting... I put in a drop event on the LogWindow, just to test...

(in __init__)
self.droptarget=MyFileDropTarget(self)
self.SetDropTarget(self.droptarget)
print "LogWindow Drop Target:",self.droptarget

Didn't work.

However, if I changed the self.SetDropTarget() to
self.tb.SetDropTarget(), it worked.

So, it is something with not being attached to a proper wx control? I
dunno.... Just throwing this out to see if it rings any bells for you.
:-)
Roger Binns
2004-04-06 23:24:35 UTC
Permalink
Post by Steven Palm
So, it is something with not being attached to a proper wx control? I
dunno.... Just throwing this out to see if it rings any bells for you.
There is a problem with the drag and drop and you have notebook panes.
What I found was that it isn't necessarily the currently viewed pane
that gets a drop message:

http://bitpim.sf.net/pyxr/c/projects/bitpim/guiwidgets.py.html#1042

Roger
Steven Palm
2004-04-07 00:15:50 UTC
Permalink
Post by Roger Binns
Post by Steven Palm
So, it is something with not being attached to a proper wx control? I
dunno.... Just throwing this out to see if it rings any bells for you.
There is a problem with the drag and drop and you have notebook panes.
What I found was that it isn't necessarily the currently viewed pane
Ah, but I was looking for ANY OnDropFiles() call, and none was
happening. Very strange...

I found that if I changed the registration call to not be the
ringerview object, but rather it's preview pane, then a drop to that
pane will work. I haven't found an object I can register for to get the
left two panes, though... grid doesn't work, nor does tbsplitter or
lrsplitter....

I got this from a thread I found that suggested you may have to
register every control in a view (sigh), although it wasn't conclusive:

http://lists.wxwidgets.org/archive/wx-users/msg35311.html

But I will perservere. LoL. Eventually *something* has to give. <wink>
At least finding out that registering the preview pane will finally get
something to triggers shows that there is something to this train of
thought... as long as it's not the "crazy train". :-)
Roger Binns
2004-04-07 00:44:07 UTC
Permalink
Post by Steven Palm
But I will perservere. LoL. Eventually *something* has to give. <wink>
Are you regretting touching the code yet :-?
Post by Steven Palm
At least finding out that registering the preview pane will finally get
something to triggers shows that there is something to this train of
thought... as long as it's not the "crazy train". :-)
BTW what is the actual problem? On both Linux and Windows, images drag
perfectly into any part of the wallpaper view. For the ringer view,
they drag in perfectly as well, but there is a later exception while
transmogrifying the name.

Roger
Steven Palm
2004-04-07 02:05:27 UTC
Permalink
Post by Roger Binns
Post by Steven Palm
But I will perservere. LoL. Eventually *something* has to give. <wink>
Are you regretting touching the code yet :-?
Well, in response to your "he who touched it last", I was recently
thinking of... "But you started it!" :-)
Post by Roger Binns
BTW what is the actual problem? On both Linux and Windows, images drag
perfectly into any part of the wallpaper view. For the ringer view,
they drag in perfectly as well, but there is a later exception while
transmogrifying the name.
Ugh! Well, it doesn't work on the Macintosh. This must be some
platform issue, then. It wasn't working in ringer or wallpaper view...

I found by changing the code in guiwidgets.py for the __init__ method
of the FileView class putting in the following would allow it to work
for the preview area and the icon view:

self.droptarget=MyFileDropTarget(self)
self.SetDropTarget(self.droptarget)
self.icons.SetDropTarget(self.droptarget)
self.preview.SetDropTarget(self.droptarget)

However, it crashes something when you quit BitPim. :-( Obviously
this "magic bit" is doing something on the Mac, but it's not needed on
the other platforms. <sigh>

More digging. I'm about to check in some changes, test it on Windows
and/or Linux and see how it fares there.

Loading...