Dakusan's Domain Forum

Main Site Discussion => Updates => Topic started by: Dakusan on October 07, 2009, 12:06:17 pm

Title: Picture Viewer v1.0
Post by: Dakusan on October 07, 2009, 12:06:17 pm
Original update for Picture Viewer v1.0 can be found at https://www.castledragmire.com/Updates/Picture_Viewer_v1.0.
Originally posted on: 09/10/09
Regarding: Picture Viewer

Here is the initial v1.0 (source) public release of my Picture Viewer project. See its project page for more information on what all it does.

I’ve wanted to try out Python for a while now, as it has been recommended to me by multiple friends. I decided to redo an old Visual Basic [6] project I did way back in October of 2002 in Python for this reason, and also because I used it every now and then and was frustrated by all the features it was missing that I wanted (I had been meaning to redo it in C++ for a while).

The original project was done as a request from a friend, and was completed in a couple of hours. It only had 5 settings that it read from a config file that had to be in a proper order, and had pretty much no interactivity, but it was a novel idea I had not seen implemented well elsewhere.

For this new version, I started out by listing over a dozen options and configurations I wanted from this redo of the project and compiled the readme and configuration file from it. From there I built the configuration file reader/parser. These 2 parts of the project actually ended up taking more time than the rest of the application programming itself ^_^;. The actual GUI/interactivity part was the quick part of the project.


This new iteration of the project is much more versatile, configurable, and robust. Most all of the options are changeable both through the configuration file, and through keyboard shortcuts set in the configuration file. It is set up to be used as both a picture screen saver, or just as a picture viewer.


I spent a good chunk of time also playing around with compiling python files for Windows for binary release (py2exe), the options for it, and reducing the final size of the distribution. I was able to get the final project distribution size from 5.8MB down to 1.83MB (including upx packing). There was a lot of trial and error to get it down to an acceptable size, including finding a lot of package distribution/compiling options, which aren’t very well documented, and determining which included Python modules and DLLs were not being used and could be excluded. Setting and retrieving file version information wasn’t really documented either, and I even had to do some hacking (dynamic class reconfiguring) to include some file version information that was not being included that should have been.

The final distribution could be made a lot smaller still by removing some of the modules I used. The PyWin32 information could all be included through ctypes and manually including Windows32 constants (win32con). The Python Imaging Library (PIL) module could also be completely removed and replaced with Windows graphics APIs, but it would really have been a pain. PIL included support for a good number of graphics formats, and hooking up with Windows GDI+ through Python would been a major pain in the ass, so in the end, for this project, being able to quickly get everything done won out.


There are a number of things I’d still like to get implemented in this project that I’m just not going to worry about right now. Those include:
  • Command line option overrides (Override all options that can be set in the configuration file)
  • The “ExitOnActivity” option (for screen savers) doesn’t work outside the window (when the “background” option is turned off). If the mouse does not travel over the window, it will not close from mouse movements.
  • I ended up decided on not implementing next-picture preloading yet (though it is included in the configuration file). This would be especially useful for “picture viewer” mode, as moving to the next picture when the user presses a key would [usually] have [virtually] no load time.
  • It would be better if pictures started displaying immediately upon application load (whenever the first picture is found) instead of waiting for the entire “File List” to load.
  • Checking for interrupt/exit signals
  • Reading the configuration file from different (and multiple) paths
  • Get Unicode working in the configuration file
  • Resorting images
  • Go back to last the focused window

This project was originally named on this site “Picture Screen Saver”. Its entry has been completely updated including changing the rating from a 4 to a 7. The content section of the project page now reflects the readme file found in the project’s downloads.