ANN: MediaLocker – A wxPython App to Track Your Media

Background

···

================

This is the first release of a real project that I’ve been involved in. I had written an article last month that inspired Werner Bruhin to want to take it and make it into a demonstration program for new wxPython programmers in how to do MVC and CRUD while interfacing with a database. Thus, MediaLocker was born. We hope you like it.

Description:

A wxPython database application that can help you keep track of your media. Currently, it only tracks your Book library. You can read more about the project’s development in the following two articles:

Requirements:

================

Source

You can download the source from BitBucket: [https://bitbucket.org/driscollis/medialocker

](https://bitbucket.org/driscollis/medialocker)

How you can help

Download the software and report bugs on BitBucket. We also happily accept feature requests, especially if they include patches or code.

Note: Also cross-posted on my blog: http://www.blog.pythonlibrary.org/2011/12/09/ann-medialocker-%E2%80%93-a-wxpython-app-to-track-your-media/


Mike Driscoll

Blog: http://blog.pythonlibrary.org

Note that this has only been tested on Windows. I have already received a report that it’s having issues on Ubuntu. Hopefully we’ll have that figured out ASAP.

···

Mike Driscoll

Blog: http://blog.pythonlibrary.org

Hi, Mike. I’m excited to try this, but I went to Bitbucket (for the first time) and it’s not immediately clear to me how to actually get the source code. For those not used to Bitbucket or related sites, could you give us a quick few steps for how to get the most up-to-date version and run it? Thanks.

Che

Hi Che,

···

On Fri, Dec 9, 2011 at 12:38 PM, C M cmpython@gmail.com wrote:

Hi, Mike. I’m excited to try this, but I went to Bitbucket (for the first time) and it’s not immediately clear to me how to actually get the source code. For those not used to Bitbucket or related sites, could you give us a quick few steps for how to get the most up-to-date version and run it? Thanks.

Che

Well, if you have Mercurial installed, then it’s super easy:

  1. Open a command shell or terminal and change to a directory you’d like to use

  2. type: “hg clone https://bitbucket.org/driscollis/medialocker” without the quotes

  3. Now you have the source!

TortoiseHg is almost as simple. You just download it, install it and then right-click a folder and tell it to pull from that bitbucket location.

By the way, we have noticed a bug in ObjectListView on Linux. We’ll be posting a workaround to our project’s wiki shortly.

Mike Driscoll

Blog: http://blog.pythonlibrary.org

Can I get it with Git? I tried it and it failed.

Is there a way you can make it more easily available to newbies who aren’t savvy with version control systems?

Thanks,
Che

···

On Fri, Dec 9, 2011 at 1:43 PM, Mike Driscoll mike@pythonlibrary.org wrote:

Hi Che,

On Fri, Dec 9, 2011 at 12:38 PM, C M cmpython@gmail.com wrote:

Hi, Mike. I’m excited to try this, but I went to Bitbucket (for the first time) and it’s not immediately clear to me how to actually get the source code. For those not used to Bitbucket or related sites, could you give us a quick few steps for how to get the most up-to-date version and run it? Thanks.

Che

Well, if you have Mercurial installed, then it’s super easy:

  1. Open a command shell or terminal and change to a directory you’d like to use
  1. type: “hg clone https://bitbucket.org/driscollis/medialocker” without the quotes
  1. Now you have the source!

TortoiseHg is almost as simple. You just download it, install it and then right-click a folder and tell it to pull from that bitbucket location.

I don’t know much about Git, so I have no idea. But I uploaded a snapshot of the current repo to the announcement page on my blog: http://www.blog.pythonlibrary.org/2011/12/09/ann-medialocker-%E2%80%93-a-wxpython-app-to-track-your-media/

You should be able to get it there. I’ll have to create a place to put finished versions, I suppose.

···

On Fri, Dec 9, 2011 at 1:32 PM, C M cmpython@gmail.com wrote:

On Fri, Dec 9, 2011 at 1:43 PM, Mike Driscoll mike@pythonlibrary.org wrote:

Hi Che,

On Fri, Dec 9, 2011 at 12:38 PM, C M cmpython@gmail.com wrote:

Hi, Mike. I’m excited to try this, but I went to Bitbucket (for the first time) and it’s not immediately clear to me how to actually get the source code. For those not used to Bitbucket or related sites, could you give us a quick few steps for how to get the most up-to-date version and run it? Thanks.

Che

Well, if you have Mercurial installed, then it’s super easy:

  1. Open a command shell or terminal and change to a directory you’d like to use
  1. type: “hg clone https://bitbucket.org/driscollis/medialocker” without the quotes
  1. Now you have the source!

TortoiseHg is almost as simple. You just download it, install it and then right-click a folder and tell it to pull from that bitbucket location.

Can I get it with Git? I tried it and it failed.

Is there a way you can make it more easily available to newbies who aren’t savvy with version control systems?

Thanks,
Che

Mike Driscoll

Blog: http://blog.pythonlibrary.org

You can download the archived current version of the source directly from:

https://bitbucket.org/driscollis/medialocker/downloads

···

On Fri, 09 Dec 2011 20:32:32 +0100, C M <cmpython@gmail.com> wrote:

Can I get it with Git? I tried it and it failed.

Is there a way you can make it more easily available to newbies who aren't
savvy with version control systems?

As you probably guessed, I don’t know bitbucket that well. Thanks for the tip!

···

On Fri, Dec 9, 2011 at 1:46 PM, Toni Ruža gmr.gaf@gmail.com wrote:

On Fri, 09 Dec 2011 20:32:32 +0100, C M cmpython@gmail.com wrote:

Can I get it with Git? I tried it and it failed.

Is there a way you can make it more easily available to newbies who aren’t

savvy with version control systems?

You can download the archived current version of the source directly from:

https://bitbucket.org/driscollis/medialocker/downloads

Mike Driscoll

Blog: http://blog.pythonlibrary.org

Ahh. I had seen that page and for some reason didn’t notice the Download column on the far right…I had been clicking on or saving the revision link! Now it works. Thanks.

I see from scanning Mike’s blog post that there are some dependencies for this I don’t have yet, so I’ll have to put this off a bit but will read the full post right now…

Che

···

On Fri, Dec 9, 2011 at 2:46 PM, Toni Ruža gmr.gaf@gmail.com wrote:

On Fri, 09 Dec 2011 20:32:32 +0100, C M cmpython@gmail.com wrote:

Can I get it with Git? I tried it and it failed.

Is there a way you can make it more easily available to newbies who aren’t

savvy with version control systems?

You can download the archived current version of the source directly from:

https://bitbucket.org/driscollis/medialocker/downloads

Hi Che,

···

On Fri, Dec 9, 2011 at 3:09 PM, C M cmpython@gmail.com wrote:

On Fri, Dec 9, 2011 at 2:46 PM, Toni Ruža gmr.gaf@gmail.com wrote:

On Fri, 09 Dec 2011 20:32:32 +0100, C M cmpython@gmail.com wrote:

Can I get it with Git? I tried it and it failed.

Is there a way you can make it more easily available to newbies who aren’t

savvy with version control systems?

You can download the archived current version of the source directly from:

https://bitbucket.org/driscollis/medialocker/downloads

Ahh. I had seen that page and for some reason didn’t notice the Download column on the far right…I had been clicking on or saving the revision link! Now it works. Thanks.

I see from scanning Mike’s blog post that there are some dependencies for this I don’t have yet, so I’ll have to put this off a bit but will read the full post right now…

Che

Werner put together a special release that we pushed into the code base for now that will allow you and anyone else to just download it and run it by executing the “runapp.py” file. It includes the funky pubsub and ObjectListView dependencies. I think I’ll try to get a website set up today where we can do real releases that will make this sort of thing easier. Let us know if you run into any issues. Thanks!


Mike Driscoll

Blog: http://blog.pythonlibrary.org

Note there's a minor bug into ObjectListView: even if your frame
goes larger than the sum of all columns width/minWidth, the HSCROLL
don't go away.

This is easily circumvented by modifying one line around 861,
From:
freeSpace = max(0, self.GetClientSizeTuple()[0] - totalFixedWidth)
To:
freeSpace = max(0, self.GetClientSizeTuple()[0] - totalFixedWidth - 20)

···

On Fri, 9 Dec 2011 08:17:59 -0600 Mike Driscoll <mike@pythonlibrary.org> wrote:

- ObjectListView <http://pypi.python.org/pypi/ObjectListView&gt;1\.2

--
Experience is not what happens to you; it is what you do with what
happens to you. -- Aldous Huxley

Hi Jean-Yves,

- ObjectListView<http://pypi.python.org/pypi/ObjectListView&gt;1\.2

Note there's a minor bug into ObjectListView: even if your frame
goes larger than the sum of all columns width/minWidth, the HSCROLL
don't go away.

I can't recreate this - using OLV quit a bit and never seen this issue. Hhm, you are on *nix, no?

Just tried it with Ubuntu and MediaLocker and I don't see it there either. What type of OLV are you using? Group, virtual ...?

This is easily circumvented by modifying one line around 861,
From:
freeSpace = max(0, self.GetClientSizeTuple()[0] - totalFixedWidth)
To:
freeSpace = max(0, self.GetClientSizeTuple()[0] - totalFixedWidth - 20)

Hhm, will look at this some more tomorrow, probably to do with the column configuration you use, as the above code is doing something when one uses SpaceFilling column.

Anyhow, thanks for the note.

Werner

···

On 12/10/2011 06:15 PM, Jean-Yves F. Barbier wrote:

On Fri, 9 Dec 2011 08:17:59 -0600 > Mike Driscoll<mike@pythonlibrary.org> wrote:

> Note there's a minor bug into ObjectListView: even if your frame
> goes larger than the sum of all columns width/minWidth, the HSCROLL
> don't go away.
>
I can't recreate this - using OLV quit a bit and never seen this issue.
Hhm, you are on *nix, no?

Yep (Debian unstable & stable)

Just tried it with Ubuntu and MediaLocker and I don't see it there
either. What type of OLV are you using? Group, virtual ...?

A VirtualObjectListView one.

I use it to display rows from a DB table and it happens with the
following parms:

col0: T='Numéro', vG='id', align='right',
      iS=True, W=110, minW=110, maxW=150, iSF=False

col1: T='Nom', vG='name', align='left',
      iS=True, W=150, minW=100, maxW=300, iSF=False

col2: T='Adresse', vG='note', align='left',
      iS=True, W=350, minW=150, maxW=-1, iSF=True

> This is easily circumvented by modifying one line around 861,
> From:
> freeSpace = max(0, self.GetClientSizeTuple()[0] - totalFixedWidth)
> To:
> freeSpace = max(0, self.GetClientSizeTuple()[0] - totalFixedWidth - 20)

Hhm, will look at this some more tomorrow, probably to do with the
column configuration you use,
as the above code is doing something when
one uses SpaceFilling column.

As my 1st version was written a long ago (a spin-off from the
virtual part of the demo), I don't remember everything, but
I think you're right.
I remember I traced it to find out where it came from because the
permanent HSCROLL was bugging me (and it was taking extra space).

Anyhow, thanks for the note.

You're welcome.

JY

···

On Sat, 10 Dec 2011 19:24:12 +0100 werner <wbruhin@free.fr> wrote:
--
I'm not afraid of death -- I just don't want to be there when it
happens. -- Woody Allen

I am trying to debug what Jean-Yves has pointed out the other day.

Note there's a minor bug into ObjectListView: even if your frame
goes larger than the sum of all columns width/minWidth, the HSCROLL
don't go away.

I can't recreate this - using OLV quit a bit and never seen this issue.
Hhm, you are on *nix, no?

Yep (Debian unstable& stable)

What I see is a bit different whatever I do. I don't see scroll bars at all.

When I debug with the WIT I see that on Ubuntu the listctrl has three children, a ScrolledWindow, a Window and a GenStaticText, where as on Windows the listctrl has just one child the StaticText.

Does the listctrl on *nix use a ScrolledWindow? As I can't see anything in the ObjectListView, i.e. it is based/inherits from wx.ListCtrl. If this is the case what is the proper way to get scrollbars when the list doesn't fit in its allocated size?

Jean-Yves, what version of OLV are you using? version 1.2 or the one from SVN?

Werner

···

On 12/10/2011 07:55 PM, Jean-Yves F. Barbier wrote:

What I see is a bit different whatever I do. I don't see scroll bars at
all.

No, not w/ the modification; without I can't get rid of HSCROLL
whatever the width of the frame.

Does the listctrl on *nix use a ScrolledWindow?

No, it is on a panel which is directly in the frame (I can send
you the code in PM if you want).

As I can't see anything
in the ObjectListView, i.e. it is based/inherits from wx.ListCtrl. If
this is the case what is the proper way to get scrollbars when the list
doesn't fit in its allocated size?

I found my old notes, I noted that adding -20 was making HSCROLL
definitely disappearing.
Values higher than -20 make reappearing random, and around -5 you
need to shrink the frame less than columns sum min width to recover
the HSCROLL.

Since then, the wx version has evolved.

As of today, -5 still gives random results: growing width by small
steps I sometimes have the HSCROLL, sometimes not - -20 still make
it completely disappear.

Jean-Yves, what version of OLV are you using? version 1.2 or the one
from SVN?

The regular one.

···

On Sun, 11 Dec 2011 18:01:43 +0100 werner <wbruhin@free.fr> wrote:

--
I was 15 years old before I found out that "damn yankee" was two
words.

I still don't get it, when I use Python 2.6 and wxPython 2.8.12 the scroll bars don't show at all, with or with Jean-Yves suggested change.

When I use Python 2.7 with wxPython 2.9.2.4 then all works fine, i.e. scroll bars show as expected without needed Jean-Yves change.

All this is tested using the ObjectListView from SVN with the two changes in relation to 2.9 (i.e. mouse: evt.m_altDown instead use evt.altDown, and the RefreshObjects issue with an empty list).

Werner

···

On 12/11/2011 06:41 PM, Jean-Yves F. Barbier wrote:

On Sun, 11 Dec 2011 18:01:43 +0100 > werner<wbruhin@free.fr> wrote:

What I see is a bit different whatever I do. I don't see scroll bars at
all.

No, not w/ the modification; without I can't get rid of HSCROLL
whatever the width of the frame.

Does the listctrl on *nix use a ScrolledWindow?

No, it is on a panel which is directly in the frame (I can send
you the code in PM if you want).

  As I can't see anything
in the ObjectListView, i.e. it is based/inherits from wx.ListCtrl. If
this is the case what is the proper way to get scrollbars when the list
doesn't fit in its allocated size?

I found my old notes, I noted that adding -20 was making HSCROLL
definitely disappearing.
Values higher than -20 make reappearing random, and around -5 you
need to shrink the frame less than columns sum min width to recover
the HSCROLL.

Since then, the wx version has evolved.

As of today, -5 still gives random results: growing width by small
steps I sometimes have the HSCROLL, sometimes not - -20 still make
it completely disappear.

(oops: got wx 2.8.12.1-5)

So, the PB is almost solved as the time I finish my dev, the wx
version will surely be 2.9 :slight_smile:

BTW, I use the python 1.2 version as 2.5.0 seems to be reserved to
w$ users only. I didn't find out how to compile it without any
scripts nor Makefile, and I don't even know if it is possible (?)

···

On Mon, 12 Dec 2011 12:00:12 +0100 werner <wbruhin@free.fr> wrote:

>
I still don't get it, when I use Python 2.6 and wxPython 2.8.12 the
scroll bars don't show at all, with or with Jean-Yves suggested change.

When I use Python 2.7 with wxPython 2.9.2.4 then all works fine, i.e.
scroll bars show as expected without needed Jean-Yves change.

All this is tested using the ObjectListView from SVN with the two
changes in relation to 2.9 (i.e. mouse: evt.m_altDown instead use
evt.altDown, and the RefreshObjects issue with an empty list).

--

Hi Jean-Yves,

...

So, the PB is almost solved as the time I finish my dev, the wx
version will surely be 2.9 :slight_smile:

It is already 2.9;-) , but agree 2.9.2 still has a few issues which I wouldn't like in production, but then 2.9.3 is just about around the corner I think.

BTW, I use the python 1.2 version as 2.5.0 seems to be reserved to
w$ users only. I didn't find out how to compile it without any
scripts nor Makefile, and I don't even know if it is possible (?)

I sure hope for you that you are not using "1.2" of Python:-) .

Werner

···

On 12/12/2011 12:39 PM, Jean-Yves F. Barbier wrote:

Yes. The generic listctrl uses one subwindow for the column headers (when in report mode) and one for the scrolled area. It looks like things have changed somewhat in 2.9 as the scrolling functionality has been moved up to the listctrl class itself by inheriting from a scrolling helper class, but that should just be an "implementation detail" and everything should work the same via the public API. Is OLV doing something like grabbing the child window for the main scrolling area and calling its methods directly? If so then there could be a problem in 2.9 since it is just a wx.Window in that case.

···

On 12/11/11 9:01 AM, werner wrote:

Does the listctrl on *nix use a ScrolledWindow?

--
Robin Dunn
Software Craftsman

Hi Robin,

Does the listctrl on *nix use a ScrolledWindow?

Yes. The generic listctrl uses one subwindow for the column headers (when in report mode) and one for the scrolled area. It looks like things have changed somewhat in 2.9 as the scrolling functionality has been moved up to the listctrl class itself by inheriting from a scrolling helper class, but that should just be an "implementation detail" and everything should work the same via the public API. Is OLV doing something like grabbing the child window for the main scrolling area and calling its methods directly?

Not that I am aware off.

  If so then there could be a problem in 2.9 since it is just a wx.Window in that case.

OLV is actually very happy (and so am I:)) when used with 2.9, at least what I have seen so far.

Werner

···

On 12/12/2011 07:43 PM, Robin Dunn wrote:

On 12/11/11 9:01 AM, werner wrote: