<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Dark Views &#187; PyQt4</title>
	<atom:link href="http://blog.pdark.de/tag/pyqt4/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.pdark.de</link>
	<description>Opinions and views about computers, writing SciFi and everything else.</description>
	<lastBuildDate>Wed, 08 Feb 2012 06:43:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.pdark.de' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/7741f06d762e6a53700b2915f21e3d77?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Dark Views &#187; PyQt4</title>
		<link>http://blog.pdark.de</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.pdark.de/osd.xml" title="Dark Views" />
	<atom:link rel='hub' href='http://blog.pdark.de/?pushpress=hub'/>
		<item>
		<title>PyScan 0.6</title>
		<link>http://blog.pdark.de/2009/10/10/pyscan-0-6/</link>
		<comments>http://blog.pdark.de/2009/10/10/pyscan-0-6/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 15:50:52 +0000</pubDate>
		<dc:creator>digulla</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[HP]]></category>
		<category><![CDATA[hplip]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PyQt4]]></category>
		<category><![CDATA[PyScan]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[SANE]]></category>
		<category><![CDATA[Scanner]]></category>

		<guid isPermaLink="false">http://blog.pdark.de/?p=717</guid>
		<description><![CDATA[I&#8217;ve done some more work on PyScan. Most work is under the hood but I&#8217;ve got a system to load and save projects and a bug was fixed: If you pressed the Scan button too quickly with 0.4, the last image could have been overwritten. PyScan is now based on hplip 3.9.8. PyScan 0.6.tar.gz (16KB, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=717&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve done some more work on PyScan. Most work is under the hood but I&#8217;ve got a system to load and save projects and a bug was fixed: If you pressed the Scan button too quickly with 0.4, the last image could have been overwritten. PyScan is now based on <a href="http://hplipopensource.com/hplip-web/index.html">hplip 3.9.8</a>.</p>
<p><a href="http://www.pdark.de/PyScan-0.6.tar.gz">PyScan 0.6.tar.gz</a> (16KB, MD5 Sum: 2b5e23099be438ceceb69ec23d64cec6)</p>
<p>See the <a href="http://blog.pdark.de/2009/04/18/pyscan-a-little-helper-for-the-hp-cm1312nfi-mfp-scanner/">original post</a> for features and the system requirements.</p>
<br /> Tagged: HP, hplip, Linux, PyQt4, PyScan, Python, SANE, Scanner <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/darkviews.wordpress.com/717/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/darkviews.wordpress.com/717/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/darkviews.wordpress.com/717/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/darkviews.wordpress.com/717/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/darkviews.wordpress.com/717/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/darkviews.wordpress.com/717/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/darkviews.wordpress.com/717/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/darkviews.wordpress.com/717/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/darkviews.wordpress.com/717/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/darkviews.wordpress.com/717/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/darkviews.wordpress.com/717/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/darkviews.wordpress.com/717/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/darkviews.wordpress.com/717/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/darkviews.wordpress.com/717/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=717&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.pdark.de/2009/10/10/pyscan-0-6/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a4d6f03a8879432d8563aefbf48e787?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">digulla</media:title>
		</media:content>
	</item>
		<item>
		<title>PyScan: A Little Helper For The HP CM1312nfi MFP Scanner</title>
		<link>http://blog.pdark.de/2009/04/18/pyscan-a-little-helper-for-the-hp-cm1312nfi-mfp-scanner/</link>
		<comments>http://blog.pdark.de/2009/04/18/pyscan-a-little-helper-for-the-hp-cm1312nfi-mfp-scanner/#comments</comments>
		<pubDate>Sat, 18 Apr 2009 21:20:09 +0000</pubDate>
		<dc:creator>digulla</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[HP]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PIL]]></category>
		<category><![CDATA[PyQt4]]></category>
		<category><![CDATA[PyScan]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[SANE]]></category>
		<category><![CDATA[Scanner]]></category>

		<guid isPermaLink="false">http://blog.pdark.de/?p=586</guid>
		<description><![CDATA[Update: Find the latest version (0.6) here. I recently bought a HP CM1312nfi MFP scanner (multi function device with scanner and color laser printer). After scanning some 1&#8217;000 pages, I&#8217;m still satisfied with the device. The document feeder (ADF) sometimes tries to eat the paper after spitting it out and the colors could be a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=586&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Update: <a href="http://blog.pdark.de/2009/10/10/pyscan-0-6/">Find the latest version (0.6) here</a>.</p>
<p>I recently bought a<a title="Permanent Link to hpaio: unable to read device-id" rel="bookmark" href="http://blog.pdark.de/2009/03/21/hpaio-unable-to-read-device-id/"> HP CM1312nfi MFP scanner</a> (multi function device with scanner and color laser printer). After scanning some 1&#8217;000 pages, I&#8217;m still satisfied with the device. The document feeder (ADF) sometimes tries to eat the paper after spitting it out and the colors could be a little more brilliant but overall, a good deal for the price.</p>
<p>What bothered me was that the &#8220;Start scan&#8221; button <a href="https://bugs.launchpad.net/hplip/+bug/256541">doesn&#8217;t work on Linux</a>. But someone posted a script in the bug report which can poll the button by reading the URL <strong>http://$ip/hp/device/notifications.xml</strong> (replace &#8220;$ip&#8221; with the IP address or DNS name of the scanner). This returns some XML with two interesting elements: <strong>StartScan</strong> and <strong>ADFLoaded</strong>. The first one becomes 1 when someone presses the &#8220;Start scan&#8221; button on the scanner and the second one tells us whether there is some paper in the ADF.</p>
<p>With that and some source code, it was simple to create a little tool that works quite like <a href="http://www.xsane.org/">xsane</a> but fixes a couple of things that annoyed me for a long time:</p>
<ol>
<li>The UI of xsane is dead while it scans</li>
<li>There is no online preview of the scan; you have to open the file in some extra tool to verify that the scan looks OK</li>
<li>xsane doesn&#8217;t know about scan &#8220;projects&#8221;</li>
<li>xsane doesn&#8217;t start to scan when I press the button on the scanner</li>
</ol>
<p>As with all OSS software, this thing can seriously ruin your day, so be a bit careful. One of the biggest problems is the file size: To be able to edit files without loss of quality, TIFF format is the default. Each full page scan takes 26MB, 100 pages need 2.6GB!</p>
<p>Plans for 0.5: Allow to edit projects in the UI, select them, save and load them. Right now, you must define your projects via the command line or by editing the source code.</p>
<p>Download: <a href="http://www.pdark.de/PyScan-0.4.tar.gz">PyScan-0.4.tar.gz</a> (12KB, <a href="http://www.pdark.de/PyScan-0.4.md5">MD5 checksum</a>)</p>
<p>Dependencies (see README.txt for download links):</p>
<ul>
<li>Python 2.6</li>
<li>PyQt4 4.4.3</li>
<li>Python Imaging Library 1.1.6</li>
<li>Python Imaging SANE 1.1.6 (needs included patch; see README.txt for instructions).</li>
</ul>
<h3>Features</h3>
<ul>
<li>Code to load images in a background thread, generate thumbnails (compatible to Konqueror/Dolphin) and display them in a list view</li>
<li>Display a (big) image with various manual and automatic zoom levels and modes (fit to window, percent) with zoom and pan</li>
<li>Online preview of scan in progress</li>
</ul>
<h3>Hideous details of the source</h3>
<p>Again and again, I&#8217;m astonished how simple some tasks are in Python and Qt &#8230; if you&#8217;re willing to accept some &#8220;non-OO-ness&#8221; of the solution. I&#8217;ll explain some things I did here to give you an idea what&#8217;s going on.</p>
<h3>Online preview</h3>
<p>PyScan has an online preview of the currently active scan. If you look at the documentation, the Python Imaging SANE interface offers no way to do that. After looking at the source, I found that the SANE interface simply reads bytes from the SANE scanner module and copies these into a PIL image which was created on the Python side.</p>
<p>So my solution is to be notified that a scan is in progress and then copy said image every second (all 26MB) into a string. That string is then used to build a QImage which is turned into a QPixmap which is then displayed in the right pixmap view. See pilImage2QImage() for the details.</p>
<h3>Background threads</h3>
<p>I also moved all expensive code into threads: Loading big TIFF images, scaling them down to thumbnails, saving the images, etc. All threads have a method to add work to their input queues and they send Qt signals when they&#8217;re done. Continuing the scanning when there is paper in the ADF tray was a bit of a problem, through.</p>
<p>Since the saving of the images is happening in a background thread, the code could start the next scan before the saving was completed. This wasn&#8217;t such a big problem except that the &#8220;scan next image&#8221; code looks for files on the disk to determine the next filename. This would lead to overwrites. So I had to synchronize this somehow. My simple hack was to set a boolean &#8220;waiting&#8221; in the scanner thread which indicates that the scanner has more paper to process and waits for the save thread to complete. When the UI gets the &#8220;image saved&#8221; signal, it triggers the scanner to continue.</p>
<h3>Generating thumbnails</h3>
<p>The last hack in the code is the generation of the thumbnails. The main issue here was that I need the thumbnails for the gallery view really deep down in the Qt render code. Wasting time at that level is really a no-no but at first glance, the API offers no way to defer loading of the images and then later update the items in the list view when the data is available. Keep in mind what I need to do:</p>
<ol>
<li>Load a 26MB file from disk</li>
<li>Scale it with antialiasing</li>
<li>&#8230; for hundreds, possibly thousands of files!</li>
</ol>
<p>My solution: In the render code, I create a <strong>LazyPixmap</strong>. This is just dumb object to save the filename and a placeholder pixmap which is used into the real thumbnail becomes available. The <strong>LazyPixmap</strong> will schedule a job for the <strong>LoaderThread</strong>.</p>
<p>In my first code, I tried to create a <strong>QPixmap</strong> in the <strong>LoaderThread</strong> but that doesn&#8217;t work: Only the UI thread is allowed to create a <strong>QPixmap</strong>. Duh. But luckily, Qt offers the <strong>QImage</strong> class which works even without a UI and which offers basically the same API as <strong>QPixmap</strong>. So the <strong>LoaderThread</strong> can load the image from disk and scale it down (to save memory and avoid heavy computation in the UI thread) right before emitting a &#8220;loaded&#8221; signal.</p>
<p>There are two places where a <strong>LazyPixmap</strong> is used: In the <strong>PixmapWidget</strong> (which can display and zoom a <strong>QPixmap</strong>) and in the <strong>ThumbnailDelegate</strong> which draws the thumbnails for the filenames in the <strong>GalleryModel</strong>.</p>
<p>In the case of the <strong>PixmapWidget</strong>, the signal will be handled in <strong>lazyLoaded()</strong>. Here, we convert the <strong>QImage</strong> into a <strong>QPixmap</strong> (in <strong>lpm.getPixmap()</strong>) and assign that pixmap, recalculate the zoom factor, realign the view, etc.</p>
<p>The <strong>GalleryModel, </strong>I have the problem that I need to tell Qt somehow that the pixmap has changed but the API offers nothing except rendering the whole widget by calling <strong>update()</strong>. This will render at most (on a huge screen) 30 pixmaps. Happens one time per visible pixmap, causes no flicker. Probably not worth to waste another second on it.</p>
<p>If you look at the code, you&#8217;ll see that a class called <strong>KDEThumbnailCache</strong> is used. This class accesses the same thumbnails als konqueror (KDE3) or Dolphin (KDE4). This means once the images are scaled down (either by my code or Dolphin), all tools can quickly load the small, precalculated thumbnails instead of having to scale the 26MB files <em>again</em>.</p>
<h3>Conclusion</h3>
<p>Well, that&#8217;s it for a small walk through the code. Feel free to give feedback if you like PyScan (or not) or when you have patches.</p>
<br /> Tagged: HP, Linux, PIL, PyQt4, PyScan, Python, SANE, Scanner <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/darkviews.wordpress.com/586/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/darkviews.wordpress.com/586/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/darkviews.wordpress.com/586/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/darkviews.wordpress.com/586/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/darkviews.wordpress.com/586/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/darkviews.wordpress.com/586/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/darkviews.wordpress.com/586/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/darkviews.wordpress.com/586/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/darkviews.wordpress.com/586/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/darkviews.wordpress.com/586/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/darkviews.wordpress.com/586/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/darkviews.wordpress.com/586/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/darkviews.wordpress.com/586/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/darkviews.wordpress.com/586/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=586&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.pdark.de/2009/04/18/pyscan-a-little-helper-for-the-hp-cm1312nfi-mfp-scanner/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a4d6f03a8879432d8563aefbf48e787?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">digulla</media:title>
		</media:content>
	</item>
		<item>
		<title>UPCScan 0.7: Where is my stuff?</title>
		<link>http://blog.pdark.de/2008/11/16/upcscan-07-where-is-my-stuff/</link>
		<comments>http://blog.pdark.de/2008/11/16/upcscan-07-where-is-my-stuff/#comments</comments>
		<pubDate>Sun, 16 Nov 2008 19:39:00 +0000</pubDate>
		<dc:creator>digulla</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[PyQt4]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[upcscan]]></category>

		<guid isPermaLink="false">http://darkviews.wordpress.com/2008/11/16/upcscan-07-where-is-my-stuff/</guid>
		<description><![CDATA[UPCScan 0.7 is released. New features: UPCScan can now find music CDs If UPCScan can&#8217;t find something on Amazon, it will still create an entry which you can then edit to fill in the details. Entries can be deleted. I&#8217;ve added lending information so you can quickly figure out who your new &#8220;ex-friends&#8221; should be. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=163&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>UPCScan 0.7 is released. New features:</p>
<ul>
<li>UPCScan can now find music CDs</li>
<li>If UPCScan can&#8217;t find something on Amazon, it will still create an entry which you can then edit to fill in the details.</li>
<li>Entries can be deleted.</li>
<li>I&#8217;ve added lending information so you can quickly figure out who your new &#8220;ex-friends&#8221; should be.</li>
<li>I&#8217;m working on a series/issue information system to make it more simple to complete your collection. With this version, you&#8217;ll need to edit the database directly to add series/issue information but the user interface can already display this data.</li>
<li>I&#8217;m working on a feature to create an OpenOffice document with the locations. This would allow you to print this out and then scan the locations in as you scan your collection to tell UPCScan under which location to file the items. If you can&#8217;t wait, then you can use the barcode.py script to generate PNG images with barcodes which you can import in OpenOffice to achieve the same effect.</li>
</ul>
<p>Download: <a href="http://www.pdark.de/upcscan-0.7.tar.gz">upcscan-0.7.tar.gz</a> (26,921 Bytes, <a href="http://www.pdark.de/upcscan-0.7.md5sum">MD5</a>)</p>
<br /> Tagged: PyQt4, Python, upcscan <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/darkviews.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/darkviews.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/darkviews.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/darkviews.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/darkviews.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/darkviews.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/darkviews.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/darkviews.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/darkviews.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/darkviews.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/darkviews.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/darkviews.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/darkviews.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/darkviews.wordpress.com/163/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=163&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.pdark.de/2008/11/16/upcscan-07-where-is-my-stuff/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a4d6f03a8879432d8563aefbf48e787?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">digulla</media:title>
		</media:content>
	</item>
		<item>
		<title>UPCScan 0.6: It&#8217;s Qt, Man!</title>
		<link>http://blog.pdark.de/2008/10/08/upcscan-06-its-qt-man/</link>
		<comments>http://blog.pdark.de/2008/10/08/upcscan-06-its-qt-man/#comments</comments>
		<pubDate>Wed, 08 Oct 2008 19:20:00 +0000</pubDate>
		<dc:creator>digulla</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[PyQt4]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[upcscan]]></category>

		<guid isPermaLink="false">http://darkviews.wordpress.com/2008/10/08/upcscan-06-its-qt-man/</guid>
		<description><![CDATA[Update: Version 0.7 released. Getting drowned in your ever growing CD, DVD, book or comic collection? Then UPCScan might be for you. UPCScan 0.6 is ready for download. There are many fixed and improvements. The biggest one is probably the live PyQt4 user interface (live means that the UI saves all your changes instantly, so [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=154&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><b>Update:</b> <a href="/2008/11/upcscan-07-where-is-my-stuff.html">Version 0.7 released</a>.</p>
<p>Getting drowned in your ever growing CD, DVD, book or comic collection? Then UPCScan might be for you.</p>
<p>UPCScan 0.6 is ready for download. There are many fixed and improvements. The biggest one is probably the live PyQt4 user interface (live means that the UI saves all your changes instantly, so no data loss if your computer crashes because of some other program <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> ).</p>
<p>The search field accepts barcodes (from a barcode laser scanner) and ISBN numbers. There is a nice cover image dialog where you can download and assign images if Amazon doesn&#8217;t have one. Note: Amazon sometimes has an image but it&#8217;s marked as &#8220;customer image&#8221;. Use the &#8220;Visit&#8221; button on the UI to check if an image is missing and click on the &#8220;No Cover&#8221; button to open the &#8220;Cover Image&#8221; dialog where you can download and assign images. I haven&#8217;t checked if the result of the search query contains anything useful in this case.</p>
<p><a href="http://www.pdark.de/upcscan-0.6.tar.gz">UPCScan 0.6</a> &#8211; 24,055 bytes, <a href="http://www.pdark.de/upcscan-0.6.md5sum">MD5 Checksum</a>. Needs <a href="http://www.python.org/download/releases/2.5.2/">Python 2.5</a>. <a href="http://www.riverbankcomputing.co.uk/software/pyqt/download">PyQt4 4.4.3</a> is optional.</p>
<p>Security notice: You need an Amazon Web Service Account (get one <a href="http://aws.amazon.com/">here</a>). When you run the program for the first time, it will tell you what to do. This means two things:</p>
<ol>
<li>Your queries will be logged. So if you don&#8217;t want Amazon to know what you own, this program is not very useful for you.</li>
<li>Your account ID will be stored in the article database at various places. I&#8217;m working on an export function which filters all private data out. Until then, don&#8217;t give this file to your friends unless you know what that means (and frankly, I don&#8217;t). You have been warned.</li>
</ol>
<br /> Tagged: PyQt4, Python, upcscan <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/darkviews.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/darkviews.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/darkviews.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/darkviews.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/darkviews.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/darkviews.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/darkviews.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/darkviews.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/darkviews.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/darkviews.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/darkviews.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/darkviews.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/darkviews.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/darkviews.wordpress.com/154/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=154&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.pdark.de/2008/10/08/upcscan-06-its-qt-man/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a4d6f03a8879432d8563aefbf48e787?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">digulla</media:title>
		</media:content>
	</item>
		<item>
		<title>Portable UI</title>
		<link>http://blog.pdark.de/2008/01/18/portable-ui/</link>
		<comments>http://blog.pdark.de/2008/01/18/portable-ui/#comments</comments>
		<pubDate>Fri, 18 Jan 2008 20:22:00 +0000</pubDate>
		<dc:creator>digulla</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[PyQt4]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[UI]]></category>

		<guid isPermaLink="false">http://darkviews.wordpress.com/2008/01/18/portable-ui/</guid>
		<description><![CDATA[For many years, I&#8217;ve been looking for a way to write portable applications with a nice, responsive user interface. Many have tried and many have failed: Python with tcl/tk &#8211; A nice experience from the developer side. The Python wrapper around the tk widget set shows how you can get compact, yet easy understandable code [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=53&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>For many years, I&#8217;ve been looking for a way to write portable applications with a nice, responsive user interface. Many have tried and many have failed:</p>
<ul>
<li><a href="http://www.python.org/">Python</a> with <a href="http://tcl.sourceforge.net/">tcl/tk</a> &#8211; A nice experience from the developer side. The Python wrapper around the tk widget set shows how you can get compact, yet easy understandable code and write UI&#8217;s in short time. If it just weren&#8217;t that ugly &#8230;</li>
<li><a href="http://java.sun.com/">Java</a> with <a href="http://java.sun.com/docs/books/tutorial/uiswing/">Swing</a> &#8211; Swing borrows a lot from <a href="http://www.x.org/">X11</a>, the grandfather of all graphical desktops. I have yet to see anyone managing to impress the world with their grandfather &#8230;</li>
<li>Java with <a href="http://www.eclipse.org/swt/">SWT</a> &#8211; Now, here comes a contender. Java is pretty <a href="http://java.sun.com/javase/downloads/?intcmp=1281">widely available</a> (<a href="http://www.python.org/download/">not quite as many platforms as Python</a>, but still), it is pretty fast, okay, the download is a bit on the big side &#8230; but no DLL hell, easy to setup (especially if you don&#8217;t provide an installer and just push a ZIP out). SWT is nice, fast &#8230; and bare bones. MFC? Well, they have JFace and in a few years, there might even be a text editing component that can do word wrap and still show line numbers. Oh, and SWT is available on even fewer platforms than Java. Palm, anyone?</li>
<li>HTML &#8211; Web based apps are all the hype. If you want to use your app on the run, it gets tricky. I don&#8217;t know about the US, but here in Europe, going online with you mobile <a href="http://www.swisscom-mobile.ch/scm/prv_datenuebertragung-de.aspx">will</a> ruin you. Literally. Also, I&#8217;ve had my struggles with <a href="/2007/07/building-html-there-are-two-ways-to.html">HTML</a> and <a href="/2006/02/whats-wrong-with-css-as-internet.html">CSS</a> and I can do without. Either <em>and</em> both.</li>
</ul>
<p>I&#8217;ve tried a few more but in the end, things never felt right. Until recently. I&#8217;m a <a href="/2007/09/how-to-write-part-1.html">big fan</a> of <a href="http://www.bellz.org/treeline/">treeline</a>. Treeline uses Python and <a href="http://www.riverbankcomputing.co.uk/pyqt/">PyQt</a> which wraps <a href="http://trolltech.com/products/qt">Qt</a> (say: &#8220;cute&#8221;). Qt is a mature framework, currently at version 4.3.3, with <a href="http://trolltech.com/products/qt/whatsnew/qt44-preview">4.4</a> is around the corner. It doesn&#8217;t have all the nifty stuff I can imagine (like an RTF editor; QTextEdit can only do a (big) fraction of that) but it gets closer to what I want than anything else.</p>
<p>In the past two weeks, I wrote a little clone of <a href="http://www.spacejock.com/yWriter4.html">yWriter4</a>. The little baby has currently about 8000 loc and about half of the functionality I want to give it (especially the text editing is still leaving a lot to be desired). Except for two bugs (signal names and <a href="http://en.wikipedia.org/wiki/Garbage_collection_(computer_science)">GC</a> issues), it&#8217;s been a real pleasure to use. I managed to implement almost every feature within a few minutes or few hours (the storyboard took 6 hours, the scene chart view took two), also thanks to the good defaults of the framework. Here is an impression of v0.2:</p>
<p><a href="http://3.bp.blogspot.com/_FB4TTJlspe0/R5ESw7WYL2I/AAAAAAAAABc/JU0dvKs_UEQ/s1600-h/pyWriter.png"><img style="display:block;text-align:center;cursor:hand;margin:0 auto 10px;" src="http://3.bp.blogspot.com/_FB4TTJlspe0/R5ESw7WYL2I/AAAAAAAAABc/JU0dvKs_UEQ/s320/pyWriter.png" border="0" /></a></p>
<p>So when you&#8217;re considering to write a small to medium sized application which needs to run on Windows, Linux and MacOS, give <a href="http://www.riverbankcomputing.co.uk/pyqt/">PyQt</a> a try.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/darkviews.wordpress.com/53/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/darkviews.wordpress.com/53/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/darkviews.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/darkviews.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/darkviews.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/darkviews.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/darkviews.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/darkviews.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/darkviews.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/darkviews.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/darkviews.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/darkviews.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/darkviews.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/darkviews.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/darkviews.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/darkviews.wordpress.com/53/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=53&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.pdark.de/2008/01/18/portable-ui/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a4d6f03a8879432d8563aefbf48e787?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">digulla</media:title>
		</media:content>

		<media:content url="http://3.bp.blogspot.com/_FB4TTJlspe0/R5ESw7WYL2I/AAAAAAAAABc/JU0dvKs_UEQ/s320/pyWriter.png" medium="image" />
	</item>
		<item>
		<title>Sorting Number Table Columns in PyQt4</title>
		<link>http://blog.pdark.de/2008/01/14/sorting-number-table-columns-in-pyqt4/</link>
		<comments>http://blog.pdark.de/2008/01/14/sorting-number-table-columns-in-pyqt4/#comments</comments>
		<pubDate>Mon, 14 Jan 2008 13:55:00 +0000</pubDate>
		<dc:creator>digulla</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[PyQt4]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Qt]]></category>

		<guid isPermaLink="false">http://darkviews.wordpress.com/2008/01/14/sorting-number-table-columns-in-pyqt4/</guid>
		<description><![CDATA[Here is a simple trick to sort number columns in the QTableWidget of Qt4 and PyQt4: Format the number as a right aligned string: for i range(12): item = QTableWidgetItem(u'%7d' random.randint(1, 10000)) item.setTextAlignment(Qt.AlignRight) table.setItem (i, 1, item)<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=52&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here is a simple trick to sort number columns in the QTableWidget of <a href="http://doc.trolltech.com/4.3/index.html">Qt4</a> and <a href="http://www.riverbankcomputing.com/Docs/PyQt4/pyqt4ref.html">PyQt4</a>: Format the number as a right aligned string:</p>
<pre>for i range(12):
    item = QTableWidgetItem(u'%7d' random.randint(1, 10000))
    item.setTextAlignment(Qt.AlignRight)
    table.setItem (i, 1, item)</pre>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/darkviews.wordpress.com/52/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/darkviews.wordpress.com/52/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/darkviews.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/darkviews.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/darkviews.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/darkviews.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/darkviews.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/darkviews.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/darkviews.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/darkviews.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/darkviews.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/darkviews.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/darkviews.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/darkviews.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/darkviews.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/darkviews.wordpress.com/52/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=52&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.pdark.de/2008/01/14/sorting-number-table-columns-in-pyqt4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a4d6f03a8879432d8563aefbf48e787?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">digulla</media:title>
		</media:content>
	</item>
	</channel>
</rss>
