diff --git a/CocoaDialog.app/Contents/Info.plist b/CocoaDialog.app/Contents/Info.plist
new file mode 100644
index 0000000..5421c35
--- /dev/null
+++ b/CocoaDialog.app/Contents/Info.plist
@@ -0,0 +1,28 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ English
+ CFBundleExecutable
+ CocoaDialog
+ CFBundleIconFile
+ cocoadialog
+ CFBundleIdentifier
+ org.sporkstorms.CocoaDialog
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundlePackageType
+ APPL
+ CFBundleSignature
+ ????
+ CFBundleVersion
+ 2.1.1
+ LSUIElement
+ 1
+ NSMainNibFile
+ MainMenu
+ NSPrincipalClass
+ NSApplication
+
+
diff --git a/CocoaDialog.app/Contents/MacOS/CocoaDialog b/CocoaDialog.app/Contents/MacOS/CocoaDialog
new file mode 100755
index 0000000..75feff3
Binary files /dev/null and b/CocoaDialog.app/Contents/MacOS/CocoaDialog differ
diff --git a/CocoaDialog.app/Contents/PkgInfo b/CocoaDialog.app/Contents/PkgInfo
new file mode 100644
index 0000000..bd04210
--- /dev/null
+++ b/CocoaDialog.app/Contents/PkgInfo
@@ -0,0 +1 @@
+APPL????
\ No newline at end of file
diff --git a/CocoaDialog.app/Contents/Resources/COPYING b/CocoaDialog.app/Contents/Resources/COPYING
new file mode 100644
index 0000000..5d18622
--- /dev/null
+++ b/CocoaDialog.app/Contents/Resources/COPYING
@@ -0,0 +1,281 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
diff --git a/CocoaDialog.app/Contents/Resources/Changelog b/CocoaDialog.app/Contents/Resources/Changelog
new file mode 100644
index 0000000..e9459fb
--- /dev/null
+++ b/CocoaDialog.app/Contents/Resources/Changelog
@@ -0,0 +1,73 @@
+2.1.0 April 26, 2006
+ - Implemented --packages-as-directories in fileselect.
+
+2.1.0 Feb 26, 2006
+ - Compiled as a Universal Binary
+ - Intelligent resizing to accommodate --informative-text in
+ all inputbox dialogs, all msgbox dialogs, and textbox.
+ Same for --text in all dropdown dialogs.
+ - New "filesave" dialogs
+ - Added --packages-as-directories option to fileselect.
+ - Added --x-placement and --y-placement to bubble.
+
+2.0.0 Jan 2, 2006
+ - Added bubble dialog.
+ - Added secure modes for inputbox and standard-inputbox.
+ - The application now runs as a background app. This means no more annoying
+ menu or dock icon!
+ - Some dialogs can be floated above all other applications.
+ - Timeouts on several dialogs.
+ - Intelligent button resizing
+ - Added custom icon support to msgbox, ok-msgbox, and standard-msgbox.
+ - Added --help options (still needs improvement).
+ - Added --select-only-directories to fileselect.
+ - Restructured project directory, code hierarchy, and refactored much of the code.
+ - Cleaned up the look of several dialogs.
+ - Progressbar won't be displayed right away, to prevent showing for
+ very short operations.
+ - Bug fixes (string-input on inputboxes, missing deallocs).
+ - New application icon.
+
+1.2.2
+ - (Didn't release)
+ - Allan's patch
+
+1.2.1 Jan, 2005
+ - (Did I even release this?).
+ - Wout's patch:
+ added --no-show, --float, --timeout and --help options
+ turned into a background app so that the dialog icon does not show
+ up in the menu bar. This, together with float, is very useful for
+ loginhooks.
+
+1.2.0 Dec 28, 2004
+ - added dropdown and standard-dropdown controls.
+
+1.1.3 May 11, 2004
+ - fixed handling of multi-line input to progressbar.
+
+1.1.2 May 10, 2004
+ - fixed crash that would occur when printing return values containing
+ non-Roman characters. Thanks to Nobumi Iyanaga for finding this.
+ - added "debug" class method to CDControl and got rid of those
+ printf()s.
+
+1.1.1 April 26, 2004
+ - starting to use x.y.z versioning (instead of x.y)
+ - progressbar incorrectly printed error with --debug
+ (runControlFromOptions: always returned nil, which should only happen
+ on error). This has been fixed.
+ - progressbar character encoding bug fixed. should now properly handle
+ UTF8 labels read from stdin. see bug 942012 on sf.net page. thanks to
+ J-F Boquillard for finding and fixing this.
+
+1.1
+ - added inputbox, standard-inputbox
+ - textbox window no longer closes on escape unless there's a "Cancel"
+ button
+ - fixed error handling for textbox when --text-from-file file is
+ invalid.
+
+1.0
+ - initial release
+
diff --git a/CocoaDialog.app/Contents/Resources/Info.plist b/CocoaDialog.app/Contents/Resources/Info.plist
new file mode 100644
index 0000000..5421c35
--- /dev/null
+++ b/CocoaDialog.app/Contents/Resources/Info.plist
@@ -0,0 +1,28 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ English
+ CFBundleExecutable
+ CocoaDialog
+ CFBundleIconFile
+ cocoadialog
+ CFBundleIdentifier
+ org.sporkstorms.CocoaDialog
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundlePackageType
+ APPL
+ CFBundleSignature
+ ????
+ CFBundleVersion
+ 2.1.1
+ LSUIElement
+ 1
+ NSMainNibFile
+ MainMenu
+ NSPrincipalClass
+ NSApplication
+
+
diff --git a/CocoaDialog.app/Contents/Resources/InfoPlist.strings b/CocoaDialog.app/Contents/Resources/InfoPlist.strings
new file mode 100644
index 0000000..aab4510
Binary files /dev/null and b/CocoaDialog.app/Contents/Resources/InfoPlist.strings differ
diff --git a/CocoaDialog.app/Contents/Resources/Inputbox.nib/classes.nib b/CocoaDialog.app/Contents/Resources/Inputbox.nib/classes.nib
new file mode 100644
index 0000000..2482e9e
--- /dev/null
+++ b/CocoaDialog.app/Contents/Resources/Inputbox.nib/classes.nib
@@ -0,0 +1,51 @@
+{
+ IBClasses = (
+ {CLASS = CDControl; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
+ {
+ CLASS = CDInputboxControl;
+ LANGUAGE = ObjC;
+ OUTLETS = {textField = NSTextField; };
+ SUPERCLASS = CDThreeButtonControl;
+ },
+ {
+ CLASS = CDMsgboxControl;
+ LANGUAGE = ObjC;
+ OUTLETS = {imageView = NSImageView; text = NSTextField; };
+ SUPERCLASS = CDThreeButtonControl;
+ },
+ {
+ ACTIONS = {selectionChanged = id; };
+ CLASS = CDPopUpButtonControl;
+ LANGUAGE = ObjC;
+ OUTLETS = {popup = NSPopUpButton; };
+ SUPERCLASS = CDThreeButtonControl;
+ },
+ {
+ CLASS = CDProgressbarControl;
+ LANGUAGE = ObjC;
+ OUTLETS = {label = NSTextField; panel = NSPanel; progressBar = NSProgressIndicator; };
+ SUPERCLASS = CDControl;
+ },
+ {
+ CLASS = CDTextboxControl;
+ LANGUAGE = ObjC;
+ OUTLETS = {textView = NSTextView; };
+ SUPERCLASS = CDThreeButtonControl;
+ },
+ {
+ ACTIONS = {button1Pressed = id; button2Pressed = id; button3Pressed = id; timeout = id; };
+ CLASS = CDThreeButtonControl;
+ LANGUAGE = ObjC;
+ OUTLETS = {
+ button1 = NSButton;
+ button2 = NSButton;
+ button3 = NSButton;
+ expandingLabel = NSTextField;
+ panel = NSPanel;
+ };
+ SUPERCLASS = CDControl;
+ },
+ {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }
+ );
+ IBVersion = 1;
+}
\ No newline at end of file
diff --git a/CocoaDialog.app/Contents/Resources/Inputbox.nib/info.nib b/CocoaDialog.app/Contents/Resources/Inputbox.nib/info.nib
new file mode 100644
index 0000000..304be72
--- /dev/null
+++ b/CocoaDialog.app/Contents/Resources/Inputbox.nib/info.nib
@@ -0,0 +1,16 @@
+
+
+
+
+ IBDocumentLocation
+ 76 119 356 240 0 0 1440 878
+ IBFramework Version
+ 443.0
+ IBOpenObjects
+
+ 5
+
+ IBSystem Version
+ 8H14
+
+
diff --git a/CocoaDialog.app/Contents/Resources/Inputbox.nib/keyedobjects.nib b/CocoaDialog.app/Contents/Resources/Inputbox.nib/keyedobjects.nib
new file mode 100644
index 0000000..61940ca
Binary files /dev/null and b/CocoaDialog.app/Contents/Resources/Inputbox.nib/keyedobjects.nib differ
diff --git a/CocoaDialog.app/Contents/Resources/MainMenu.nib/classes.nib b/CocoaDialog.app/Contents/Resources/MainMenu.nib/classes.nib
new file mode 100644
index 0000000..fec272b
--- /dev/null
+++ b/CocoaDialog.app/Contents/Resources/MainMenu.nib/classes.nib
@@ -0,0 +1,7 @@
+{
+ IBClasses = (
+ {CLASS = AppController; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
+ {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }
+ );
+ IBVersion = 1;
+}
\ No newline at end of file
diff --git a/CocoaDialog.app/Contents/Resources/MainMenu.nib/info.nib b/CocoaDialog.app/Contents/Resources/MainMenu.nib/info.nib
new file mode 100644
index 0000000..0c4c597
--- /dev/null
+++ b/CocoaDialog.app/Contents/Resources/MainMenu.nib/info.nib
@@ -0,0 +1,21 @@
+
+
+
+
+ IBDocumentLocation
+ 373 505 356 240 0 0 1680 1028
+ IBEditorPositions
+
+ 29
+ 131 353 216 44 0 0 1680 1028
+
+ IBFramework Version
+ 364.0
+ IBOpenObjects
+
+ 29
+
+ IBSystem Version
+ 7R28
+
+
diff --git a/CocoaDialog.app/Contents/Resources/MainMenu.nib/info.nib.orig b/CocoaDialog.app/Contents/Resources/MainMenu.nib/info.nib.orig
new file mode 100644
index 0000000..1277b03
--- /dev/null
+++ b/CocoaDialog.app/Contents/Resources/MainMenu.nib/info.nib.orig
@@ -0,0 +1,21 @@
+
+
+
+
+ IBDocumentLocation
+ 188 324 356 240 0 0 1024 746
+ IBEditorPositions
+
+ 29
+ 69 252 299 44 0 0 1024 746
+
+ IBFramework Version
+ 349.0
+ IBOpenObjects
+
+ 29
+
+ IBSystem Version
+ 7F44
+
+
diff --git a/CocoaDialog.app/Contents/Resources/MainMenu.nib/objects.nib b/CocoaDialog.app/Contents/Resources/MainMenu.nib/objects.nib
new file mode 100644
index 0000000..a5f08c3
Binary files /dev/null and b/CocoaDialog.app/Contents/Resources/MainMenu.nib/objects.nib differ
diff --git a/CocoaDialog.app/Contents/Resources/MainMenu.nib/objects.nib.orig b/CocoaDialog.app/Contents/Resources/MainMenu.nib/objects.nib.orig
new file mode 100644
index 0000000..4d53a12
Binary files /dev/null and b/CocoaDialog.app/Contents/Resources/MainMenu.nib/objects.nib.orig differ
diff --git a/CocoaDialog.app/Contents/Resources/Msgbox.nib/classes.nib b/CocoaDialog.app/Contents/Resources/Msgbox.nib/classes.nib
new file mode 100644
index 0000000..55e4a1e
--- /dev/null
+++ b/CocoaDialog.app/Contents/Resources/Msgbox.nib/classes.nib
@@ -0,0 +1,27 @@
+{
+ IBClasses = (
+ {CLASS = CDControl; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
+ {
+ CLASS = CDMsgboxControl;
+ LANGUAGE = ObjC;
+ OUTLETS = {imageView = NSImageView; text = NSTextField; };
+ SUPERCLASS = CDThreeButtonControl;
+ },
+ {
+ ACTIONS = {button1Pressed = id; button2Pressed = id; button3Pressed = id; timeout = id; };
+ CLASS = CDThreeButtonControl;
+ LANGUAGE = ObjC;
+ OUTLETS = {
+ button1 = NSButton;
+ button2 = NSButton;
+ button3 = NSButton;
+ expandingLabel = NSTextField;
+ panel = NSPanel;
+ };
+ SUPERCLASS = CDControl;
+ },
+ {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
+ {CLASS = "java.lang.Object"; LANGUAGE = Java; }
+ );
+ IBVersion = 1;
+}
\ No newline at end of file
diff --git a/CocoaDialog.app/Contents/Resources/Msgbox.nib/info.nib b/CocoaDialog.app/Contents/Resources/Msgbox.nib/info.nib
new file mode 100644
index 0000000..38ca711
--- /dev/null
+++ b/CocoaDialog.app/Contents/Resources/Msgbox.nib/info.nib
@@ -0,0 +1,16 @@
+
+
+
+
+ IBDocumentLocation
+ 57 203 356 240 0 0 1440 878
+ IBFramework Version
+ 443.0
+ IBOpenObjects
+
+ 10
+
+ IBSystem Version
+ 8H14
+
+
diff --git a/CocoaDialog.app/Contents/Resources/Msgbox.nib/keyedobjects.nib b/CocoaDialog.app/Contents/Resources/Msgbox.nib/keyedobjects.nib
new file mode 100644
index 0000000..a734e9c
Binary files /dev/null and b/CocoaDialog.app/Contents/Resources/Msgbox.nib/keyedobjects.nib differ
diff --git a/CocoaDialog.app/Contents/Resources/PopUpButton.nib/classes.nib b/CocoaDialog.app/Contents/Resources/PopUpButton.nib/classes.nib
new file mode 100644
index 0000000..15e1b65
--- /dev/null
+++ b/CocoaDialog.app/Contents/Resources/PopUpButton.nib/classes.nib
@@ -0,0 +1,55 @@
+{
+ IBClasses = (
+ {CLASS = CDControl; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
+ {
+ ACTIONS = {button1Pressed = id; button2Pressed = id; button3Pressed = id; };
+ CLASS = CDInputboxControl;
+ LANGUAGE = ObjC;
+ OUTLETS = {
+ button1 = NSButton;
+ button2 = NSButton;
+ button3 = NSButton;
+ label = NSTextField;
+ panel = NSPanel;
+ textField = NSTextField;
+ };
+ SUPERCLASS = CDControl;
+ },
+ {
+ ACTIONS = {selectionChanged = id; };
+ CLASS = CDPopUpButtonControl;
+ LANGUAGE = ObjC;
+ OUTLETS = {popup = NSPopUpButton; };
+ SUPERCLASS = CDThreeButtonControl;
+ },
+ {
+ ACTIONS = {button1Pressed = id; button2Pressed = id; button3Pressed = id; };
+ CLASS = CDTextboxControl;
+ LANGUAGE = ObjC;
+ OUTLETS = {
+ button1 = NSButton;
+ button2 = NSButton;
+ button3 = NSButton;
+ label = NSTextField;
+ panel = NSPanel;
+ textView = NSTextView;
+ };
+ SUPERCLASS = CDControl;
+ },
+ {
+ ACTIONS = {button1Pressed = id; button2Pressed = id; button3Pressed = id; timeout = id; };
+ CLASS = CDThreeButtonControl;
+ LANGUAGE = ObjC;
+ OUTLETS = {
+ button1 = NSButton;
+ button2 = NSButton;
+ button3 = NSButton;
+ expandingLabel = NSTextField;
+ panel = NSPanel;
+ };
+ SUPERCLASS = CDControl;
+ },
+ {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }
+ );
+ IBVersion = 1;
+}
\ No newline at end of file
diff --git a/CocoaDialog.app/Contents/Resources/PopUpButton.nib/info.nib b/CocoaDialog.app/Contents/Resources/PopUpButton.nib/info.nib
new file mode 100644
index 0000000..a6a01d6
--- /dev/null
+++ b/CocoaDialog.app/Contents/Resources/PopUpButton.nib/info.nib
@@ -0,0 +1,16 @@
+
+
+
+
+ IBDocumentLocation
+ 120 158 356 240 0 0 1440 878
+ IBFramework Version
+ 443.0
+ IBOpenObjects
+
+ 5
+
+ IBSystem Version
+ 8H14
+
+
diff --git a/CocoaDialog.app/Contents/Resources/PopUpButton.nib/keyedobjects.nib b/CocoaDialog.app/Contents/Resources/PopUpButton.nib/keyedobjects.nib
new file mode 100644
index 0000000..4273cdd
Binary files /dev/null and b/CocoaDialog.app/Contents/Resources/PopUpButton.nib/keyedobjects.nib differ
diff --git a/CocoaDialog.app/Contents/Resources/Progressbar.nib/classes.nib b/CocoaDialog.app/Contents/Resources/Progressbar.nib/classes.nib
new file mode 100644
index 0000000..50c9af7
--- /dev/null
+++ b/CocoaDialog.app/Contents/Resources/Progressbar.nib/classes.nib
@@ -0,0 +1,13 @@
+{
+ IBClasses = (
+ {CLASS = CDControl; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
+ {
+ CLASS = CDProgressbarControl;
+ LANGUAGE = ObjC;
+ OUTLETS = {label = NSTextField; panel = NSPanel; progressBar = NSProgressIndicator; };
+ SUPERCLASS = CDControl;
+ },
+ {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }
+ );
+ IBVersion = 1;
+}
\ No newline at end of file
diff --git a/CocoaDialog.app/Contents/Resources/Progressbar.nib/info.nib b/CocoaDialog.app/Contents/Resources/Progressbar.nib/info.nib
new file mode 100644
index 0000000..09cf0a6
--- /dev/null
+++ b/CocoaDialog.app/Contents/Resources/Progressbar.nib/info.nib
@@ -0,0 +1,16 @@
+
+
+
+
+ IBDocumentLocation
+ 128 15 356 240 0 0 1600 1002
+ IBFramework Version
+ 443.0
+ IBOpenObjects
+
+ 5
+
+ IBSystem Version
+ 8F46
+
+
diff --git a/CocoaDialog.app/Contents/Resources/Progressbar.nib/keyedobjects.nib b/CocoaDialog.app/Contents/Resources/Progressbar.nib/keyedobjects.nib
new file mode 100644
index 0000000..c22e518
Binary files /dev/null and b/CocoaDialog.app/Contents/Resources/Progressbar.nib/keyedobjects.nib differ
diff --git a/CocoaDialog.app/Contents/Resources/SecureInputbox.nib/classes.nib b/CocoaDialog.app/Contents/Resources/SecureInputbox.nib/classes.nib
new file mode 100644
index 0000000..46da700
--- /dev/null
+++ b/CocoaDialog.app/Contents/Resources/SecureInputbox.nib/classes.nib
@@ -0,0 +1,40 @@
+{
+ IBClasses = (
+ {CLASS = CDControl; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
+ {
+ CLASS = CDInputboxControl;
+ LANGUAGE = ObjC;
+ OUTLETS = {textField = NSTextField; };
+ SUPERCLASS = CDThreeButtonControl;
+ },
+ {
+ ACTIONS = {button1Pressed = id; button2Pressed = id; button3Pressed = id; };
+ CLASS = CDTextboxControl;
+ LANGUAGE = ObjC;
+ OUTLETS = {
+ button1 = NSButton;
+ button2 = NSButton;
+ button3 = NSButton;
+ label = NSTextField;
+ panel = NSPanel;
+ textView = NSTextView;
+ };
+ SUPERCLASS = CDControl;
+ },
+ {
+ ACTIONS = {button1Pressed = id; button2Pressed = id; button3Pressed = id; timeout = id; };
+ CLASS = CDThreeButtonControl;
+ LANGUAGE = ObjC;
+ OUTLETS = {
+ button1 = NSButton;
+ button2 = NSButton;
+ button3 = NSButton;
+ expandingLabel = NSTextField;
+ panel = NSPanel;
+ };
+ SUPERCLASS = CDControl;
+ },
+ {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }
+ );
+ IBVersion = 1;
+}
\ No newline at end of file
diff --git a/CocoaDialog.app/Contents/Resources/SecureInputbox.nib/info.nib b/CocoaDialog.app/Contents/Resources/SecureInputbox.nib/info.nib
new file mode 100644
index 0000000..a02220b
--- /dev/null
+++ b/CocoaDialog.app/Contents/Resources/SecureInputbox.nib/info.nib
@@ -0,0 +1,16 @@
+
+
+
+
+ IBDocumentLocation
+ 82 210 356 240 0 0 1440 878
+ IBFramework Version
+ 443.0
+ IBOpenObjects
+
+ 5
+
+ IBSystem Version
+ 8H14
+
+
diff --git a/CocoaDialog.app/Contents/Resources/SecureInputbox.nib/keyedobjects.nib b/CocoaDialog.app/Contents/Resources/SecureInputbox.nib/keyedobjects.nib
new file mode 100644
index 0000000..947c3a1
Binary files /dev/null and b/CocoaDialog.app/Contents/Resources/SecureInputbox.nib/keyedobjects.nib differ
diff --git a/CocoaDialog.app/Contents/Resources/Textbox.nib/classes.nib b/CocoaDialog.app/Contents/Resources/Textbox.nib/classes.nib
new file mode 100644
index 0000000..8e39872
--- /dev/null
+++ b/CocoaDialog.app/Contents/Resources/Textbox.nib/classes.nib
@@ -0,0 +1,26 @@
+{
+ IBClasses = (
+ {CLASS = CDControl; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
+ {
+ CLASS = CDTextboxControl;
+ LANGUAGE = ObjC;
+ OUTLETS = {textView = NSTextView; };
+ SUPERCLASS = CDThreeButtonControl;
+ },
+ {
+ ACTIONS = {button1Pressed = id; button2Pressed = id; button3Pressed = id; timeout = id; };
+ CLASS = CDThreeButtonControl;
+ LANGUAGE = ObjC;
+ OUTLETS = {
+ button1 = NSButton;
+ button2 = NSButton;
+ button3 = NSButton;
+ expandingLabel = NSTextField;
+ panel = NSPanel;
+ };
+ SUPERCLASS = CDControl;
+ },
+ {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }
+ );
+ IBVersion = 1;
+}
\ No newline at end of file
diff --git a/CocoaDialog.app/Contents/Resources/Textbox.nib/info.nib b/CocoaDialog.app/Contents/Resources/Textbox.nib/info.nib
new file mode 100644
index 0000000..6329ee4
--- /dev/null
+++ b/CocoaDialog.app/Contents/Resources/Textbox.nib/info.nib
@@ -0,0 +1,16 @@
+
+
+
+
+ IBDocumentLocation
+ 117 70 356 240 0 0 1440 878
+ IBFramework Version
+ 443.0
+ IBOpenObjects
+
+ 5
+
+ IBSystem Version
+ 8H14
+
+
diff --git a/CocoaDialog.app/Contents/Resources/Textbox.nib/keyedobjects.nib b/CocoaDialog.app/Contents/Resources/Textbox.nib/keyedobjects.nib
new file mode 100644
index 0000000..edf8208
Binary files /dev/null and b/CocoaDialog.app/Contents/Resources/Textbox.nib/keyedobjects.nib differ
diff --git a/CocoaDialog.app/Contents/Resources/atom.icns b/CocoaDialog.app/Contents/Resources/atom.icns
new file mode 100644
index 0000000..e3b3fab
Binary files /dev/null and b/CocoaDialog.app/Contents/Resources/atom.icns differ
diff --git a/CocoaDialog.app/Contents/Resources/cocoadialog.icns b/CocoaDialog.app/Contents/Resources/cocoadialog.icns
new file mode 100644
index 0000000..429c6ae
Binary files /dev/null and b/CocoaDialog.app/Contents/Resources/cocoadialog.icns differ
diff --git a/CocoaDialog.app/Contents/Resources/computer.icns b/CocoaDialog.app/Contents/Resources/computer.icns
new file mode 100644
index 0000000..719b4b9
Binary files /dev/null and b/CocoaDialog.app/Contents/Resources/computer.icns differ
diff --git a/CocoaDialog.app/Contents/Resources/document.icns b/CocoaDialog.app/Contents/Resources/document.icns
new file mode 100644
index 0000000..b481ad2
Binary files /dev/null and b/CocoaDialog.app/Contents/Resources/document.icns differ
diff --git a/CocoaDialog.app/Contents/Resources/find.icns b/CocoaDialog.app/Contents/Resources/find.icns
new file mode 100644
index 0000000..713fa14
Binary files /dev/null and b/CocoaDialog.app/Contents/Resources/find.icns differ
diff --git a/CocoaDialog.app/Contents/Resources/finder.icns b/CocoaDialog.app/Contents/Resources/finder.icns
new file mode 100644
index 0000000..afca0b0
Binary files /dev/null and b/CocoaDialog.app/Contents/Resources/finder.icns differ
diff --git a/CocoaDialog.app/Contents/Resources/firewire.icns b/CocoaDialog.app/Contents/Resources/firewire.icns
new file mode 100644
index 0000000..2e25879
Binary files /dev/null and b/CocoaDialog.app/Contents/Resources/firewire.icns differ
diff --git a/CocoaDialog.app/Contents/Resources/folder.icns b/CocoaDialog.app/Contents/Resources/folder.icns
new file mode 100644
index 0000000..3935a47
Binary files /dev/null and b/CocoaDialog.app/Contents/Resources/folder.icns differ
diff --git a/CocoaDialog.app/Contents/Resources/gear.icns b/CocoaDialog.app/Contents/Resources/gear.icns
new file mode 100644
index 0000000..a65eb5d
Binary files /dev/null and b/CocoaDialog.app/Contents/Resources/gear.icns differ
diff --git a/CocoaDialog.app/Contents/Resources/globe.icns b/CocoaDialog.app/Contents/Resources/globe.icns
new file mode 100644
index 0000000..1a58d51
Binary files /dev/null and b/CocoaDialog.app/Contents/Resources/globe.icns differ
diff --git a/CocoaDialog.app/Contents/Resources/hazard.icns b/CocoaDialog.app/Contents/Resources/hazard.icns
new file mode 100644
index 0000000..56e570b
Binary files /dev/null and b/CocoaDialog.app/Contents/Resources/hazard.icns differ
diff --git a/CocoaDialog.app/Contents/Resources/heart.icns b/CocoaDialog.app/Contents/Resources/heart.icns
new file mode 100644
index 0000000..0ce7b5d
Binary files /dev/null and b/CocoaDialog.app/Contents/Resources/heart.icns differ
diff --git a/CocoaDialog.app/Contents/Resources/hourglass.icns b/CocoaDialog.app/Contents/Resources/hourglass.icns
new file mode 100644
index 0000000..d8d02b9
Binary files /dev/null and b/CocoaDialog.app/Contents/Resources/hourglass.icns differ
diff --git a/CocoaDialog.app/Contents/Resources/info.icns b/CocoaDialog.app/Contents/Resources/info.icns
new file mode 100644
index 0000000..77c4d76
Binary files /dev/null and b/CocoaDialog.app/Contents/Resources/info.icns differ
diff --git a/CocoaDialog.app/Contents/Resources/ipod.icns b/CocoaDialog.app/Contents/Resources/ipod.icns
new file mode 100644
index 0000000..c69a78f
Binary files /dev/null and b/CocoaDialog.app/Contents/Resources/ipod.icns differ
diff --git a/CocoaDialog.app/Contents/Resources/person.icns b/CocoaDialog.app/Contents/Resources/person.icns
new file mode 100644
index 0000000..cf610ac
Binary files /dev/null and b/CocoaDialog.app/Contents/Resources/person.icns differ
diff --git a/CocoaDialog.app/Contents/Resources/sound.icns b/CocoaDialog.app/Contents/Resources/sound.icns
new file mode 100644
index 0000000..7bd79fc
Binary files /dev/null and b/CocoaDialog.app/Contents/Resources/sound.icns differ
diff --git a/CocoaDialog.app/Contents/Resources/x.icns b/CocoaDialog.app/Contents/Resources/x.icns
new file mode 100644
index 0000000..5480ace
Binary files /dev/null and b/CocoaDialog.app/Contents/Resources/x.icns differ
diff --git a/README.md b/README.md
index 50715dc..2614b04 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@ This utility is not a replacement for a full-featured tool such as the Library o
## Features
-* Runs on Linux and Windows (after installation of prerequisites). Will likely run on OS X as well - testers welcome.
+* Runs on Linux and Windows (after installation of prerequisites). OSX port is brand new and may still have some bugs.
* Uses standard Graphical User Interface file/directory browser to allow user to select which directory to create Bag from.
* Configuration options:
* The ability to specify which configuration file to use (as a command-line parameter)
@@ -28,11 +28,14 @@ This last option, the 'create_bag_in' configuration option, is important. If thi
* [Python GTK+3](http://python-gtk-3-tutorial.readthedocs.org/en/latest/index.html)
* On Linux, Python bindings for GTK+3 should already be installed
* On Windows, install the latest version from http://sourceforge.net/projects/pygobjectwin32/files/?source=navbar. When asked which packages to install, choose GTK+. No other packages in this distribution are necessary for Create Bag to run.
+ * On OSX, this isn't used.
* [bagit](https://github.com/LibraryOfCongress/bagit-python)
- * On all platforms, install with `pip install bagit`
+ * On all platforms, install with `pip install bagit` (you may need to do easy_install pip first on OSX if it's your first time adding Python packages)
## Usage
+#### Linux / Windows
+
Command line usage is documented here. However, it is possible on both Linux and Windows to create operating-system-specific shortcuts, allowing end users to start the program by clicking or double clicking on a desktop icon.
Invoke the utility from the command line like this:
@@ -59,6 +62,17 @@ Clicking on "OK" will take the user back to the startup window:

+#### OSX
+
+Unzip (or git clone) to ~/.createbag. Then, create a new Service in the OSX Automator that is designated to receive *folders* in the *Finder*. This Service should perform a single action: "Run Shell Script," using /bin/bash, with the "Pass input" drop-down set to "as arguments". Use this syntax for the Service:
+
+ for f in "$@"
+ do
+ python ~/.createbag/createbag.py $f ~/.createbag/config.cfg
+ done
+
+Save the Service with a name like "Create Bag". You can then create a bag using this script by right-clicking on any folder in your Finder and selecting "Create Bag" from the context menu.
+
## To do
* Compile the utility into native Windows, OS X, and Linux binaries, at which point the utility will be invoked like any other Graphical User Interface application on those operating systems.
diff --git a/createbag.py b/createbag.py
index 9c78e46..b082dce 100644
--- a/createbag.py
+++ b/createbag.py
@@ -8,13 +8,45 @@
import shutil
import getpass
import bagit
-from gi.repository import Gtk
+import platform
+if platform.system() != 'Darwin':
+ from gi.repository import Gtk
+else:
+ # Sets up Cocoadialog for error message popup on OSX
+ class cocoaPopup:
+
+ # Change CD_BASE to reflect the location of Cocoadialog on your system
+ CD_BASE = "~/.createbag/"
+ CD_PATH = os.path.join(CD_BASE, "CocoaDialog.app/Contents/MacOS/CocoaDialog")
+
+ def __init__(self, title, message, button):
+ template = "%s msgbox --title '%s' --text '%s' --button1 '%s'"
+ self.pipe = os.popen(template % (cocoaPopup.CD_PATH, title, message, button), "w")
+
+ def cocoaError():
+ if __name__ == "__main__":
+ popup = cocoaPopup("Error","Sorry, you can't create a bag here -- you may want to change the config file so that bags are always created in a different output directory, rather than in situ.","OK")
+ if popup == "1":
+ popup.close()
+ sys.exit()
+
+ def cocoaSuccess(bag_dir):
+ if __name__ == "__main__":
+ popup = cocoaPopup("Success!","Bag created at %s" % bag_dir,"OK")
+ if popup == "1":
+ popup.close()
# Get config file location and parse the file.
-if len(sys.argv) > 1:
- config_file = sys.argv[1]
+if platform.system() != 'Darwin':
+ if len(sys.argv) > 1:
+ config_file = sys.argv[1]
+ else:
+ config_file = './config.cfg'
else:
- config_file = './config.cfg'
+ if len(sys.argv) > 2:
+ config_file = sys.argv[2]
+ else:
+ config_file = './config.cfg'
config = ConfigParser.ConfigParser({'add_source_directory_tag': False})
config.optionxform = str
@@ -41,111 +73,124 @@
bagit_checksums = ['md5']
-class FolderChooserWindow(Gtk.Window):
+# Don't let the utility create a Bag in its own directory.
+def directory_check(chosenFolder):
+ if config.has_option('Other', 'create_bag_in'):
+ relativized_picker_path = os.path.relpath(chosenFolder, '/')
+ bag_dir = os.path.join(config.get('Other', 'create_bag_in'), relativized_picker_path)
+ if os.path.dirname(os.path.realpath(__file__)) == bag_dir:
+ if platform.system() != 'Darwin':
+ FolderChooserWindow.GtkError(win)
+ else:
+ cocoaError()
+ else:
+ if os.path.dirname(os.path.realpath(__file__)) == chosenFolder:
+ if platform.system() != 'Darwin':
+ FolderChooserWindow.GtkError(win)
+ else:
+ cocoaError()
+
+def make_bag(chosenFolder):
+ if config.getboolean('Other', 'add_source_directory_tag'):
+ bagit_tags['Source-Directory'] = chosenFolder
+
+ if config.getboolean('Other', 'add_source_user_id_tag'):
+ bagit_tags['Source-User'] = getpass.getuser()
+
+ # If the 'create_bag_in' config option is set, create the Bag from a
+ # copy of the selected folder.
+ if config.has_option('Other', 'create_bag_in'):
+ relativized_picker_path = os.path.relpath(chosenFolder, '/')
+ bag_dir = os.path.join(config.get('Other', 'create_bag_in'), relativized_picker_path)
+ try:
+ shutil.rmtree(bag_dir, True)
+ shutil.copytree(chosenFolder, bag_dir)
+ except (IOError, os.error) as shutilerror:
+ if platform.system() != 'Darwin':
+ FolderChooserWindow.GtkError(win)
+ else:
+ cocoaError()
+
+ # If it's not set, create the Bag in the selected directory.
+ else:
+ bag_dir = chosenFolder
+
+ try:
+ bag = bagit.make_bag(bag_dir, bagit_tags, 1, bagit_checksums)
+ except (bagit.BagError, Exception) as e:
+ if platform.system() != 'Darwin':
+ FolderChooserWindow.GtkError(win)
+ else:
+ cocoaError()
+ return bag_dir
+
- def __init__(self):
- Gtk.Window.__init__(self, title = config.get('Other', 'main_window_title', 'Creata a Bag'))
- self.set_border_width(10)
- self.move(200, 200)
+if platform.system() != 'Darwin':
+ class FolderChooserWindow(Gtk.Window):
- box = Gtk.Box(spacing=6)
- self.add(box)
+ def __init__(self):
+ Gtk.Window.__init__(self, title = config.get('Other', 'main_window_title', 'Create a Bag'))
+ self.set_border_width(10)
+ self.move(200, 200)
+
+ box = Gtk.Box(spacing=6)
+ self.add(box)
- choose_folder_button = Gtk.Button("Choose a folder to create Bag from")
- choose_folder_button.connect("clicked", self.on_folder_clicked)
- box.add(choose_folder_button)
-
- quit_button = Gtk.Button("Quit")
- quit_button.connect("clicked", Gtk.main_quit)
- box.add(quit_button)
-
- def on_folder_clicked(self, widget):
- folder_picker_dialog = Gtk.FileChooserDialog(
- config.get('Other', 'file_chooser_window_title', 'Creata a Bag - Choose a folder to create Bag from'),
- self, Gtk.FileChooserAction.SELECT_FOLDER,
- (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
- "Create Bag", Gtk.ResponseType.OK))
- folder_picker_dialog.set_default_size(800, 400)
- folder_picker_dialog.set_create_folders(False)
- for filechooser_shortcut in filechooser_shortcuts:
- print filechooser_shortcut
- folder_picker_dialog.add_shortcut_folder(filechooser_shortcut)
-
- response = folder_picker_dialog.run()
-
- if response == Gtk.ResponseType.OK:
- # Don't let the utility create a Bag in its own directory.
+ choose_folder_button = Gtk.Button("Choose a folder to create Bag from")
+ choose_folder_button.connect("clicked", self.on_folder_clicked)
+ box.add(choose_folder_button)
+
+ quit_button = Gtk.Button("Quit")
+ quit_button.connect("clicked", Gtk.main_quit)
+ box.add(quit_button)
+
+ def GtkError(self):
not_allowed_message = "\n\nYou are not allowed to run the program on that directory."
- if config.has_option('Other', 'create_bag_in'):
- relativized_picker_path = os.path.relpath(folder_picker_dialog.get_filename(), '/')
- bag_dir = os.path.join(config.get('Other', 'create_bag_in'), relativized_picker_path)
- if os.path.dirname(os.path.realpath(__file__)) == bag_dir:
- error_dialog = Gtk.MessageDialog(self, 0, Gtk.MessageType.ERROR,
- Gtk.ButtonsType.OK, "Sorry...")
- error_dialog.format_secondary_text(not_allowed_message)
- error_dialog.run()
- error_dialog.destroy()
- raise SystemExit
- else:
- if os.path.dirname(os.path.realpath(__file__)) == folder_picker_dialog.get_filename():
- error_dialog = Gtk.MessageDialog(self, 0, Gtk.MessageType.ERROR,
- Gtk.ButtonsType.OK, "Sorry...")
- error_dialog.format_secondary_text(not_allowed_message)
- error_dialog.run()
- error_dialog.destroy()
- raise SystemExit
-
- if config.getboolean('Other', 'add_source_directory_tag'):
- bagit_tags['Source-Directory'] = folder_picker_dialog.get_filename()
-
- if config.getboolean('Other', 'add_source_user_id_tag'):
- bagit_tags['Source-User'] = getpass.getuser()
-
- # If the 'create_bag_in' config option is set, create the Bag from a
- # copy of the selected folder.
- if config.has_option('Other', 'create_bag_in'):
- relativized_picker_path = os.path.relpath(folder_picker_dialog.get_filename(), '/')
- bag_dir = os.path.join(config.get('Other', 'create_bag_in'), relativized_picker_path)
- try:
- shutil.rmtree(bag_dir, True)
- shutil.copytree(folder_picker_dialog.get_filename(), bag_dir)
- except (IOError, os.error) as shutilerror:
- error_dialog = Gtk.MessageDialog(self, 0, Gtk.MessageType.ERROR,
- Gtk.ButtonsType.OK, "Sorry, there has been an error")
- error_dialog.format_secondary_text(str(shutilerror) +
- "\n\n" + "Clicking 'OK' will exit the program")
- error_dialog.run()
- error_dialog.destroy()
- raise SystemExit
-
- # If it's not set, create the Bag in the selected directory.
- else:
- bag_dir = folder_picker_dialog.get_filename()
-
- try:
- bag = bagit.make_bag(bag_dir, bagit_tags, 1, bagit_checksums)
- except (bagit.BagError, Exception) as e:
- error_dialog = Gtk.MessageDialog(self, 0, Gtk.MessageType.ERROR,
- Gtk.ButtonsType.OK, "Sorry, there has been an error")
- error_dialog.format_secondary_text(str(e) +
- "\n\n" + "Clicking 'OK' will exit the program")
- error_dialog.run()
- error_dialog.destroy()
- raise SystemExit
-
- confirmation_dialog = Gtk.MessageDialog(self, 0, Gtk.MessageType.INFO,
- Gtk.ButtonsType.OK, "Bag created")
- confirmation_dialog.format_secondary_text(
- "The Bag for folder %s has been created." % bag_dir)
- confirmation_dialog.run()
- confirmation_dialog.destroy()
- elif response == Gtk.ResponseType.CANCEL:
- print("Operation cancelled")
-
- folder_picker_dialog.destroy()
-
-
-win = FolderChooserWindow()
-win.connect("delete-event", Gtk.main_quit)
-win.show_all()
-Gtk.main()
+ error_dialog = Gtk.MessageDialog(self, 0, Gtk.MessageType.ERROR,
+ Gtk.ButtonsType.OK, "Sorry...")
+ error_dialog.format_secondary_text(not_allowed_message)
+ error_dialog.run()
+ error_dialog.destroy()
+ raise SystemExit
+
+ def on_folder_clicked(self, widget):
+ folder_picker_dialog = Gtk.FileChooserDialog(
+ config.get('Other', 'file_chooser_window_title', 'Create a Bag - Choose a folder to create Bag from'),
+ self, Gtk.FileChooserAction.SELECT_FOLDER,
+ (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
+ "Create Bag", Gtk.ResponseType.OK))
+ folder_picker_dialog.set_default_size(800, 400)
+ folder_picker_dialog.set_create_folders(False)
+ for filechooser_shortcut in filechooser_shortcuts:
+ print filechooser_shortcut
+ folder_picker_dialog.add_shortcut_folder(filechooser_shortcut)
+
+ response = folder_picker_dialog.run()
+
+ if response == Gtk.ResponseType.OK:
+
+ directory_check(folder_picker_dialog.get_filename())
+
+ bag_dir = make_bag(folder_picker_dialog.get_filename())
+
+ confirmation_dialog = Gtk.MessageDialog(self, 0, Gtk.MessageType.INFO,
+ Gtk.ButtonsType.OK, "Bag created")
+ confirmation_dialog.format_secondary_text(
+ "The Bag for folder %s has been created." % bag_dir)
+ confirmation_dialog.run()
+ confirmation_dialog.destroy()
+ elif response == Gtk.ResponseType.CANCEL:
+ print("Operation cancelled")
+
+ folder_picker_dialog.destroy()
+
+
+ win = FolderChooserWindow()
+ win.connect("delete-event", Gtk.main_quit)
+ win.show_all()
+ Gtk.main()
+
+else:
+ directory_check(sys.argv[1])
+ bag_dir = make_bag(sys.argv[1])
+ cocoaSuccess(bag_dir)