commit decc21fa938045ca834431c9e8ce70d2531b74bf
parent 2dba3ebed51594bb4b433b377c3f1c8d664f44d3
Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date: Sat, 15 Feb 2014 00:24:18 +0100
Improved file dialogs
Diffstat:
3 files changed, 46 insertions(+), 61 deletions(-)
diff --git a/README.rst b/README.rst
@@ -0,0 +1,41 @@
+cross-stitch
+============
+
+A Python application to turn your images into patterns for cross stitching.
+
+https://github.com/anders-dc/cross-stitch
+
+Requirements
+------------
+Python 2 or 3, Numpy, Scipy, and Matplotlib.
+
+To install these dependencies in Debian and its derivatives, run:
+
+ $ sudo apt-get install python python-numpy python-scipy python-matplotlib
+
+License
+-------
+GNU Public License version 3 or newer. See LICENSE.txt for details.
+
+Author
+------
+Anders Damsgaard (andersd@riseup.net)
+
+Todo
+----
+Show color-by-color output images. Show product names of needed yarn colors.
+
+
+Example
+-------
+
+.. image:: fiskeren.jpg
+ :scale: 50 %
+ :alt: Original image
+ :align: center
+
+.. image:: fisker-pattern.png
+ :scale: 60 %
+ :alt: Cross stitching pattern
+ :align: center
+
diff --git a/cross-stitch.py b/cross-stitch.py
@@ -146,7 +146,8 @@ class MainScreen(wx.Frame):
self.dirname = ''
openFileDialog = wx.FileDialog(self, 'Open image file', self.dirname,
- '', 'JEPG files (*.jpg)|*.jpg',
+ '', 'Image files (*.jpg, *.jpeg, *.png, *.gif, *.bmp)|'
+ + '*.jpg;*.jpeg;*.png;*.gif;*.bmp',
wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
if openFileDialog.ShowModal() == wx.ID_OK:
@@ -158,7 +159,9 @@ class MainScreen(wx.Frame):
def OnSave(self, event):
saveFileDialog = wx.FileDialog(self, 'Save image file', self.dirname,
- '', 'PNG files (*.png)|*.png', wx.FD_SAVE |
+ '', 'JPEG files (*.jpg,*.jpeg)|*.jpg*.jpeg|PNG files '
+ + '(*.png)|*.png|GIF files (*.gif)|*.gif|'
+ + 'BMP files (*.bmp)|*.bmp', wx.FD_SAVE |
wx.FD_OVERWRITE_PROMPT)
if saveFileDialog.ShowModal() == wx.ID_CANCEL:
diff --git a/generate-readme.sh b/generate-readme.sh
@@ -1,59 +0,0 @@
-#!/bin/bash
-
-# Pass README output file name as argument
-
-HEADER="cross-stitch
-============
-
-A Python application to turn your images into patterns for cross stitching.
-
-https://github.com/anders-dc/cross-stitch
-
-Requirements
-------------
-Python 2 or 3, Numpy, Scipy, and Matplotlib.
-
-To install these dependencies in Debian and its derivatives, run:
-
- $ sudo apt-get install python python-numpy python-scipy python-matplotlib
-
-License
--------
-GNU Public License version 3 or newer. See LICENSE.txt for details.
-
-Author
-------
-Anders Damsgaard (andersd@riseup.net)
-
-Todo
-----
-Add color processing functions to enhance colors and limit the number of colors.
-Show product names of needed yarn colors.
-
-Usage
------
-"
-
-echo "Generating $1"
-echo "$HEADER" > $1
-echo " `./cross-stitch.py -h`" >> $1
-
-EXAMPLE="
-Example
--------
-
- $ ./cross-stitch.py -i fiskeren.jpg -o fisker-pattern.py -w 80 -c 16
-
-.. image:: fiskeren.jpg
- :scale: 50 %
- :alt: Original image
- :align: center
-
-.. image:: fisker-pattern.png
- :scale: 60 %
- :alt: Cross stitching pattern
- :align: center
-
-"
-
-echo "$EXAMPLE" >> $1