Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts

Tuesday, July 28, 2009

Extracting Clipart from the Office Website

Despite things like the recent GPL-licensed(!) contribution from Redmond, Micro$oft is not well-known for being friendly toward the open source movement. One example is the clipart available on the Microsoft Office website. It's an excellent resource for teachers and office workers. With the Office 2007 clipart manager dead in the water with Crossover Office and Wine last I checked, getting clipart to make newsletters and such in Linux is a problem.

The problem is that clipart from the Office website is downloaded in MPF files. These are simply XML files with the actual file data base64-encoded. There is a Perl script to extract the files, but it requires several modules to be downloaded from CPAN. Not too horrible for me, but definitely not something that, say, the secretary at my church would be able to tackle. No more. I have written a GPL-licensed Python script, mpfextract.py, to extract all clipart from MPF files. This'll also be a nice thing to have once Haiku has WMF support beyond having libwmf ported. :)

Thursday, June 4, 2009

Keeping Busy

As of three weeks ago, I was in the throes of futzing with Python to make a clipart manager for Linux and hit what seemed to be a brick wall. For the most part, it is... that is unless you use Qt. Looks like PyQt4 is going to be the route for the API at this point. I've taken a break from that for now while I'm in the process of learning to use it, but I'll be coming back to it later.

Paladin has seen some renewed development. The last time I was actively developing it, I was in a burst of activity that kind of burned me out a bit. After a little time off, I'm back at it. There have been some bugfixes and it looks like there are enough that a new release isn't far off. There are a bunch of things that have been fixed and there is even work on getting it to build under GCC4.

I've also stumbled into actively looking into something that I thought was going to wait for later: a GUI designer. Yeah, yeah, there's MeTOS, BeBuilder, Bic, BeXL, and probably a few others. Each has their own problems and limitations. The biggest problem I see is a lack of active development, especially in light of the slow-but-steady progress Haiku is making. None of the open source ones seem all that usable -- though each has some nice features -- and there doesn't seem to be anything new brought to the table aside from an easy way to piece together the GUI. Right now, I'm working on a component model that so far seems to do its job pretty well and as far as I can tell is language-agnostic, making the use of something besides C++ (yab, Python, Perl, etc.) not too far-fetched. We'll see what happens.

School lets out for the summer tomorrow, so there should be some significant stuff happening in the next couple of months. Should be fun to see what, um, develops.

Friday, May 15, 2009

Brick Walls Sure Hurt

Ouch. I've been doing research into the whole Linux clipart manager and wxPython and I've run headlong into a brick wall. What is it? The X clipboard system was designed by paranoid, short-sighted morons. If you're not copying text, you're pretty much shut out, so it seems, because most applications that work with other kinds of data use private clipboards. Then again, the way the X clipboard is designed, clipboard storage is decentralized and if an app puts something on the clipboard and then quits, the data goes poof with it. Interoperability at it's best. Yay! The nice part? Unless we have some benevolent dictator say this has to be fixed, it'll never be fixed, either.

This discovery more or less puts the clipart manager dead in the water, unfortunately. The upshot to all of this is that I've been slowly getting the hang of working in Python, which is both fun and powerful.

Wednesday, May 13, 2009

Hacking Python

16 days of school left before the end of the year. Good. I've spent almost all of my waking hours the last week and a half somewhere besides at home. For me, this is definitely not a good thing. I've been learning a bit of Visual Basic in VB.NET 2008. It's OK, but it seems like a weak cross between C++ and Python. The last day or two, I've felt more like it's a waste of time to learn VB when I can learn something like wxPython, which should be just as productive and cross-platform to boot.

I've liked Python for quite some time, but I never really had any need to use it. Until now. I haven't used BeOS lately because I've been trying to iron out some production limitations for office-related work done at my school and my church. What are they? I need a flashcard program that can handle pictures or text card and can be used in a way as to be done with an LCD projector with a class. Nothing out there does that. There is also a complete lack of a clipart manager for Linux, which for a teacher or church secretary is an automatic no vote.

The state of consumer-level desktop publishing under Linux is abysmal. Yeah, yeah, I know about Scribus. It could be workable if there were WMF support. KWord and OOo Writer can do frames, but neither is very easy to do even somewhat complicated layout work. I'm thinking of something along the lines of Broderbund's The Print Shop or even (blech) Microsoft Publisher.

The major problem with Linux DTP is that unless you're someone who does it professionally and knows the intricacies of things like working with a printer and such, it's not very easy to use. I hate to say it, but Scribus could be a really killer program if it were able to utilize WMF and EMF files. The pro doesn't need them, but a large number of other people depend on them. The part that bugs me most is that the website offers a crappy workaround which, while providing results with varying levels of quality, is too technical for Joe User to really get a handle on and, frankly, too much effort to want to manually bother with.

Barring the Scribus development team to implementing this (fat chance), the solution would be to build a manager which can import and manage collections of clipart from different sources and then export them to the clipboard or to a file in a variety of formats. That is the goal, but first, I must learn to walk before I can run. Alas. The fruits of my first efforts? A script to extract clipart from MPF files served up by the clipart obtainable from the Office website. I'll post it a little later when I have more opportunity. For now, I've got some serious reading and hacking to do.