Skip to content

Commit

Permalink
Unify file saves on mac and win. Fixes #25.
Browse files Browse the repository at this point in the history
Previously, file paths in Windows environments were wrapped in a list and thus required special handling. Apparently that difference been fixed in PyQt6, so our special handling is no longer needed.
  • Loading branch information
sdouglas committed Apr 28, 2022
1 parent b64d94a commit 08e6822
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 13 deletions.
41 changes: 31 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,29 @@
* Activate virtualenv: `source ~/virtualenvs/cn24x/bin/activate`
* Install via pip: `pip3 install cadnano2`

**Windows** (not tested)
* Download and install latest [python3](https://www.python.org/downloads/)
* Create a virtualenv: `python -m venv c:\virtualenvs\cn24x`
* Activate virtualenv: `c:\virtualenvs\cn24x\Scripts\activate.bat`
* Install via pip: `pip3 install cadnano2`

**Linux**
* Create a virtual env: `python3 -m venv ~/virtualenvs/cn24x`
* Activate the venv: `source ~/virtualenvs/cn24x/bin/activate`
* Install from PyPI: `pip3 install cadnano2`

**Windows** (tested for Python 3.10.4)
* Download and install latest [python3](https://www.python.org/downloads/)
* Use "Manage app execution aliases" to disable launching "App Installer" via any python executables.
* Add python app folder to your system path, e.g. `C:\Users\shawn\AppData\Local\Programs\Python\Python310\`
* Add scripts folder to your system path, e.g. `C:\Users\shawn\AppData\Local\Programs\Python\Python310\Scripts\`
* Open command prompt (cmd.exe) and confirm you can run "python" and "pip".
* Install Cadnano via pip: `pip install cadnano2`

## Running

**macOS or Linux**
* Open the Terminal
* Activate virtual env:
- `source ~/virtualenvs/cn24x/bin/activate` (macOS or Linux)
- `c:\virtualenvs\cn24x\Scripts\activate.bat` (Windows)
* (macOS or Linux) Activate virtual env:
- `source ~/virtualenvs/cn24x/bin/activate`
* Run the app: `cadnano2`

**Windows**
* Open the Command Prompt
* Run the app: `cadnano2`

**macOS alias**
Expand All @@ -42,7 +49,7 @@

## Development

**Setup a dev environment**
**Setup a dev environment (Mac or Linux)**

* Create a virtualenv: `python3 -m venv ~/virtualenvs/cn24dev`
* Activate virtualenv: `source ~/virtualenvs/cn24dev/bin/activate`
Expand All @@ -54,6 +61,20 @@
* Test: `cadnano2`
* Repeat previous 3 steps as needed

**Setup a dev environment (Windows)**

* Install venv: `pip install virtualenv`
* Create a virtualenv: `python -m venv virtualenvs\cn24dev` (e.g. in %homepath%)
* Activate virtualenv: `virtualenvs\cn24dev\Scripts\activate`
* Install PyQt6: `pip install pyqt6`
* Clone repo: `git clone git@github.com:douglaslab/cadnano2.git`
* Change directory: `cd cadnano2`
* Make desired code edits
* Build and install: `python setup.py install`
* Test: `cadnano2`
* Repeat previous 3 steps as needed


**Build new dist and upload to PyPi**

* `pip install build twine` <- install [build](https://pypi.org/project/build/) and [twine](https://pypi.org/project/twine/)
Expand Down
2 changes: 0 additions & 2 deletions cadnano2/controllers/documentcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,8 +790,6 @@ def writeDocumentToFile(self, filename=None):
assert(not self._hasNoAssociatedFile)
filename = self.filename()
try:
if util.isWindows():
filename = filename[0]
with open(filename, 'w') as f:
helixOrderList = self.win.pathroot.getSelectedPartOrderedVHList()
encode(self._document, helixOrderList, f)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name='cadnano2',
version='2.4.4',
version='2.4.5',
description='Cadnano2 for PyQt6',
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 08e6822

Please sign in to comment.