Skip to content

Commit

Permalink
remove tooltips and other metadata field, add desktop error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
axfelix committed Jan 30, 2023
1 parent f081334 commit bd7637c
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 66 deletions.
40 changes: 0 additions & 40 deletions README.md

This file was deleted.

1 change: 1 addition & 0 deletions README.md
40 changes: 40 additions & 0 deletions gui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# MoveIt

![MoveIt](moveit.png)

This is MoveIt, a tool for building bag packages from files and folders on your desktop for transfer to repositories! The metadata fields entered into this app will be written into the bag's `bag-info.txt`. Right now, the compiled versions listed under the releases tab are customized for Simon Fraser University (as is one documentation link built into the app), but it's very easy to customize for your local context if you want.

User properties (those before the "jump" halfway down the app window) are automatically saved between runs and repopulated; bag-specific properties are not. Uses the Library of Congress' Python bagit library.

## Development
```
$ pip install -r requirements.txt --user
$ cd gui
$ npm install
$ npm start
```

## Building
The Python code needs to be built on its target platform using `pyinstaller`:

`pyinstaller -w moveit.py --distpath gui`

(On Mac, this also builds a .app version of the Python code, which you'll actually want to delete -- just keep the folder of CLI tools.)

After building the crawler, the GUI can be built from the `gui` subdirectory with:

`electron-packager . --icon=resources/icon.ico` (Windows)

`electron-packager . --icon=resources/icon.icns` (Mac)

On Mac, you can sign for distribution with `electron-osx-sign` and `electron-notarize-cli`, and you need to include the embedded Python binaries:

`IFS=$'\n' && electron-osx-sign sfu-moveit-darwin-x64/sfu-moveit.app/ $(find sfu-moveit-darwin-x64/sfu-moveit.app/Contents/Resources/app/ -type f -perm -u+x) --identity [hash] --entitlements=entitlements.plist --entitlements-inherit=entitlements.plist --hardenedRuntime`

`electron-notarize --bundle-id ca.sfu.moveit --username [email protected] --password @keystore:AC_PASSWORD sfu-moveit-darwin-x64/sfu-moveit.app/`

Finally, to package for install:

`electron-installer-windows --src moveit-win32-x64/ --dest install/ --config config.json` (Windows)

`hdiutil create tmp.dmg -ov -volname "MoveIt" -fs HFS+ -srcfolder moveit-darwin-x64/ && hdiutil convert tmp.dmg -format UDZO -o sfu-moveit.dmg && rm tmp.dmg` (Mac)
22 changes: 8 additions & 14 deletions gui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

<body>
<div id="container" class="container-fluid">
<br/>
<h2>MoveIt</h2>
<br/>
<div class="row">
Expand Down Expand Up @@ -61,28 +62,29 @@ <h4>Telephone</h4>

<br/><hr/>

<h3>Transfer Description</h3><br/>

<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 ">
<h4>Record Creator</h4>
The name of the responsible department or individual.
<input name="creator" id="creator" type="text" size="56"/>
<img class="exp_icon0" src="icon_explanation.png" data-toggle="tooltip" data-placement="right" width="25" height="25" title="The name of the department or unit responsible for creating and maintaing the records." >
</div>
</div>
<br/>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 ">
<h4>RRSDA Number</h4>
Internal SFU Users Only. See <a href="http://www.sfu.ca/archives2/dur/rrsdas.html">Overview</a>.
<h4>RRSDA Number(s)</h4>
Internal SFU Users Only. Separate by commas.
<input name="rrsda" id="rrsda" type="text" size="56"/>
<img class="exp_icon0" src="icon_explanation.png" data-toggle="tooltip" data-placement="right" width="25" height="25" title="The Records Retention Schedule and Disposal Authority (RRSDA) number that applies to the records." >
</div>
</div>
<br/>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 ">
<h4>Transfer Title</h4>
The name of the records series if known, or a brief descriptor.
<input name="title" id="title" type="text" size="56"/>
<img class="exp_icon0" src="icon_explanation.png" data-toggle="tooltip" data-placement="right" width="25" height="25" title="The name of the records series if known, or a brief descriptor." >
</div>
</div>
<br/>
Expand All @@ -100,19 +102,11 @@ <h4>Records Description</h4>
</div>
</div>
<br/>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 ">
<h4>Other Metadata Available?</h4>
e.g. file lists, indices, documentation.<br/>
If so, please provide a brief description.
<textarea name="metadata" id="metadata" rows="4" wrap="soft" cols="56"></textarea>
</div>
</div>

<br/><br/>

<div class="button">
<button class="btn btn-primary" id="package">Create Transfer Package</button>
<button class="btn btn-primary" id="package">Select Directory for Transfer</button>
</div>

<br/><br/>
Expand Down
5 changes: 2 additions & 3 deletions gui/makePackage.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ function package() {
var datefrom = document.getElementById("datefrom").value;
var dateto = document.getElementById("dateto").value;
var description = document.getElementById("description").value;
var metadata = document.getElementById("metadata").value;
if (contactname === "" || email === "" || title === ""){
notifier.notify({"title" : "MoveIt", "message" : "Contact name, email, and transfer title are required fields."});
} else {
Expand All @@ -54,7 +53,7 @@ function package() {
childWindow.once('ready-to-show', () => {
childWindow.show()
});
client.invoke("bag_package", contactname, jobtitle, department, email, phone, creator, rrsda, title, datefrom, dateto, description, metadata, JSON.stringify(packageFolder[0]), function(error, res, more) {
client.invoke("bag_package", contactname, jobtitle, department, email, phone, creator, rrsda, title, datefrom, dateto, description, JSON.stringify(packageFolder[0]), function(error, res, more) {
childWindow.close();
if (res === true){
notifier.notify({"title" : "MoveIt", "message" : "Transfer package has been created on desktop."});
Expand All @@ -63,7 +62,7 @@ function package() {
if (err) throw err;
});
} else {
notifier.notify({"title" : "MoveIt", "message" : "Error creating transfer package."});
notifier.notify({"title" : "MoveIt", "message" : "Error creating transfer package. Log added to desktop."});
console.log(error);
}
});
Expand Down
12 changes: 6 additions & 6 deletions gui/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "sfu-moveit",
"version": "2.0.6",
"homepage": "https://github.com/axfelix/moveit",
"name": "@axfelix/moveit",
"version": "2.0.7",
"homepage": "https://github.com/axfelix/moveit-electron",
"main": "main.js",
"description": "An app for producing packages for deposit to the Archives",
"description": "An app for producing bag packages for deposit.",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/axfelix/moveit"
"url": "https://github.com/axfelix/moveit-electron"
},
"scripts": {
"start": "electron .",
Expand All @@ -17,7 +17,7 @@
"electron": "~10.1.3",
"electron-squirrel-startup": "^1.0.0",
"jquery": "~3.5.1",
"node-notifier": "^5.4.0",
"node-notifier": "^10.0.1",
"portfinder": "^1.0.20",
"update-electron-app": "^1.3.0",
"zerorpc": "hokiedsp/zerorpc-node#dev_zmq6"
Expand Down
10 changes: 7 additions & 3 deletions moveit.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
import tempfile
import zerorpc
import json
from datetime import datetime

class MoveIt(object):
def bag_package(self, contactname, jobtitle, department, email, phone, creator, rrsda, title, datefrom, dateto, description, metadata, package_folder):
def bag_package(self, contactname, jobtitle, department, email, phone, creator, rrsda, title, datefrom, dateto, description, package_folder):
bag_dir_parent = tempfile.mkdtemp()
if os.path.isdir(bag_dir_parent):
shutil.rmtree(bag_dir_parent)
Expand Down Expand Up @@ -43,14 +44,17 @@ def bag_package(self, contactname, jobtitle, department, email, phone, creator,
bag.info['Year-Start'] = datefrom
bag.info['Year-End'] = dateto
bag.info['External-Description'] = description
bag.info['Other-Available-Metadata'] = metadata
bag.info['Internal-Sender-Identifier'] = ''
bag.info['Internal-Sender-Description'] = ''
bag.info['Internal-Validation-Date'] = ''
bag.info['Internal-Validation-By'] = ''
bag.info['Internal-Validation-Note'] = ''
bag.save()
except (bagit.BagError, Exception) as e:
desktop_log = os.path.join(os.environ["HOMEPATH"], "Desktop", "moveit_log.txt")
dt = datetime.now()
with open(desktop_log, "a") as logfile:
logfile.write((str(dt) + " " + str(e)))
return False

bag_destination = os.path.join(str(bag_dir_parent), (title))
Expand All @@ -64,4 +68,4 @@ def bag_package(self, contactname, jobtitle, department, email, phone, creator,
if __name__ == '__main__':
s = zerorpc.Server(MoveIt())
s.bind('tcp://127.0.0.1:' + str(sys.argv[1]))
s.run()
s.run()

0 comments on commit bd7637c

Please sign in to comment.