Skip to content

Commit 82b085b

Browse files
authored
Merge pull request #982 from UC-Davis-molecular-computing/dev
Dev
2 parents ebf29a6 + b876256 commit 82b085b

36 files changed

+573
-641
lines changed

CONTRIBUTING.md

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -248,33 +248,35 @@ This project requires using Dart version **2.13**, not the latest version. Click
248248
<details><summary><strong>Windows</strong></summary>
249249
First, install <a href="https://chocolatey.org/install">Chocolatey</a> if you haven't already. If <code>choco help</code> shows a help menu for using Chocolatey, then you've set it up correctly.
250250

251-
Then, install Dart 2.13:
251+
Then, install Dart 2.13.4:
252252

253253
<pre>
254-
choco install dart-sdk --version 2.13
254+
choco install dart-sdk --version 2.13.4
255255
</pre>
256256

257257
To stop Chocolatey from automatically updating Dart to the latest version, pin it:
258258

259259
<pre>
260-
choco pin --name="'dart-sdk'" --version="'2.13'"
260+
choco pin --name="'dart-sdk'" --version="'2.13.4'"
261261
</pre>
262262

263263
</details>
264264

265265
<details><summary><strong>macOS</strong></summary>
266266
First, install <a href="https://brew.sh/">Homebrew</a> if you haven't already. If <code>brew -v</code> shows some version numbers, then you've set it up correctly.
267267

268-
Then, install Dart 2.13:
268+
It may help to run `brew tap dart-lang/dart` first.
269+
270+
Then, install Dart 2.13.4:
269271

270272
<pre>
271-
brew install dart@2.13
273+
brew install dart@2.13.4
272274
</pre>
273275

274276
To stop Homebrew from automatically updating Dart to the latest version, pin it:
275277

276278
<pre>
277-
brew pin dart@2.13
279+
brew pin dart@2.13.4
278280
</pre>
279281

280282
If running `dart` in a terminal now does not work, you may need to follow <a href="https://docs.brew.sh/FAQ#my-mac-apps-dont-find-homebrew-utilities">these instructions</a>.
@@ -290,17 +292,17 @@ wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo gpg --dea
290292
echo 'deb [signed-by=/usr/share/keyrings/dart.gpg arch=amd64] https://storage.googleapis.com/download.dartlang.org/linux/debian stable main' | sudo tee /etc/apt/sources.list.d/dart_stable.list
291293
</pre>
292294

293-
Then, install Dart 2.13:
295+
Then, install Dart 2.13.4:
294296

295297
<pre>
296298
sudo apt-get update
297-
sudo apt-get install dart=2.13
299+
sudo apt-get install dart=2.13.4
298300
</pre>
299301

300302
To stop apt from automatically updating Dart to the latest version, hold it:
301303

302304
<pre>
303-
sudo apt-mark hold dart=2.13
305+
sudo apt-mark hold dart=2.13.4
304306
</pre>
305307

306308
</details>
@@ -312,35 +314,44 @@ After installing the Dart SDK, you should see a help menu when you run `dart`.
312314
Once you have installed Dart, install all the Dart dependencies (from the same directory `scadnano` into which the project was cloned by git):
313315

314316
```
315-
316317
pub get
317-
318318
```
319319

320320
### Installing `webdev`
321321

322322
This project uses an older version of the `webdev` tool, not the latest version, to build and serve the web app. Install it with:
323323

324324
```
325-
326325
pub global activate webdev 2.5.9
326+
```
327+
328+
Note that often a message like this appears:
327329

328330
```
331+
Warning: Pub installs executables into C:\Users\pexat\AppData\Local\Pub\Cache\bin, which is not on your path.
332+
You can fix that by adding that directory to your system's "Path" environment variable.
333+
A web search for "configure windows path" will show you how.
334+
```
335+
So you may need to add the installation location of `webdev` to your PATH environment variable.
336+
329337

330338
### Running a Local Server
331339

332340
Run
333341

334342
```
335-
336343
webdev serve
337-
338344
```
339345

340346
in the `scadnano` directory to compile your code
341347
with the [Dart dev compiler](https://dart.dev/tools/dartdevc)
342348
(dartdevc) and start up a [local
343349
server](https://dart.dev/tools/webdev#serve).
350+
351+
Sometimes it may be necessary to clean out the generated files and cache if this has an error. See the file `clean.sh`, which has this line: `dart run build_runner clean`. Also see `remove_g.sh`, which removes all `.g.dart` files from the project, which can also help to fix compilation errors.
352+
353+
If that does not work, try `dart run build_runner clean --delete-conflicting-outputs`.
354+
344355
Running `webdev serve --release` will compile the project in production mode (instead of development mode), which is claimed to be faster in principle if you are not doing development and just want to run scadnano offline.
345356
However, in scadnano, it doesn't appear to make a big difference whether development or production mode is used.
346357
The webdev program will tell you which URL to enter in your browser; it will be something like

clean.sh

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
1-
#TODO: don't know how to prevent this check from printing error message to the screen in case pub isn't found
2-
if type pub > /dev/null; then
3-
PUB=pub
4-
echo "Using pub as dart pub command"
5-
else
6-
# on Windows the pub command is called pub.bat
7-
PUB=pub.bat
8-
echo "Using pub.bat as dart pub command"
9-
fi
10-
11-
$PUB run build_runner clean
1+
dart run build_runner clean
122
bash remove_g.sh
133
#rm -rf .dart_tool/build/
144

lib/src/.DS_Store

-6 KB
Binary file not shown.

lib/src/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
*.g.dart
22
#*.g 2.dart
33
/test_built_value.dart
4+
.DS_Store

lib/src/actions/actions.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -754,19 +754,19 @@ abstract class ShowUnpairedInsertionDeletionsSet
754754
_$showUnpairedInsertionDeletionsSetSerializer;
755755
}
756756

757-
abstract class SetShowEditor
757+
abstract class OxviewShowSet
758758
with BuiltJsonSerializable
759-
implements Action, Built<SetShowEditor, SetShowEditorBuilder> {
759+
implements Action, Built<OxviewShowSet, OxviewShowSetBuilder> {
760760
bool get show;
761761

762-
factory SetShowEditor(bool show) => SetShowEditor.from((b) => b..show = show);
762+
factory OxviewShowSet(bool show) => OxviewShowSet.from((b) => b..show = show);
763763

764764
/************************ begin BuiltValue boilerplate ************************/
765-
factory SetShowEditor.from([void Function(SetShowEditorBuilder) updates]) = _$SetShowEditor;
765+
factory OxviewShowSet.from([void Function(OxviewShowSetBuilder) updates]) = _$OxviewShowSet;
766766

767-
SetShowEditor._();
767+
OxviewShowSet._();
768768

769-
static Serializer<SetShowEditor> get serializer => _$setShowEditorSerializer;
769+
static Serializer<OxviewShowSet> get serializer => _$oxviewShowSetSerializer;
770770
}
771771

772772
abstract class SetDisplayBaseOffsetsOfMajorTicksOnlyFirstHelix

lib/src/app.dart

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ import 'package:redux_dev_tools/redux_dev_tools.dart';
1212
import 'package:over_react/over_react.dart' as react;
1313
import 'package:scadnano/src/reducers/dna_extensions_move_reducer.dart';
1414
import 'package:scadnano/src/state/dna_extensions_move.dart';
15+
import 'package:scadnano/src/util.dart';
1516

1617
import 'middleware/all_middleware.dart';
18+
import 'middleware/oxview_update_view.dart';
1719
import 'middleware/throttle.dart';
1820
import 'state/dna_ends_move.dart';
1921
import 'state/helix_group_move.dart';
@@ -84,14 +86,30 @@ class App {
8486
setup_undo_redo_keyboard_listeners();
8587
setup_save_open_dna_file_keyboard_listeners();
8688
copy_selected_strands_to_clipboard_image_keyboard_listeners();
87-
// util.save_editor_content_to_js_context(state.editor_content);
8889
restore_all_local_storage(app.store);
8990
setup_warning_before_unload();
9091
setup_save_design_to_localStorage_before_unload();
9192
make_dart_functions_available_to_js(state);
9293
DivElement app_root_element = querySelector('#top-container');
9394
this.view = View(app_root_element);
9495
this.view.render(state);
96+
this.view.oxview_view.frame.onLoad.listen((event) {
97+
const js_set_camera_commands = 'camera.up.multiplyScalar(-1)';
98+
String text_blob_type = blob_type_to_string(BlobType.text);
99+
Blob blob_js_camera_commands = new Blob([js_set_camera_commands], text_blob_type);
100+
Map<String, dynamic> message_js_commands = {
101+
'message': 'iframe_drop',
102+
'files': [blob_js_camera_commands],
103+
'ext': ['js'],
104+
};
105+
this
106+
.view
107+
.oxview_view
108+
.frame
109+
.contentWindow
110+
?.postMessage(message_js_commands, 'https://sulcgroup.github.io/oxdna-viewer/');
111+
update_oxview_view(app.state.design, this.view.oxview_view.frame);
112+
});
95113
// do next after view renders so that JS SVG pan zoom containers are defined
96114
util.set_zoom_speed(store.state.ui_state.zoom_speed);
97115
}

lib/src/constants.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@ import 'state/grid.dart';
88

99
// WARNING: Do not modify line below, except for the version string
1010
// (and also add new version string to scadnano_versions_to_link).
11-
const String CURRENT_VERSION = "0.19.3";
11+
const String CURRENT_VERSION = "0.19.4";
1212
const String INITIAL_VERSION = "0.1.0";
1313

1414
// scadnano versions that we deploy so that older versions can be used.
1515
final scadnano_older_versions_to_link = [
16-
"0.19.2",
17-
"0.19.1",
16+
"0.19.3",
1817
"0.18.10",
1918
"0.17.14",
2019
// "0.17.13",
@@ -185,6 +184,7 @@ const default_display_angle = 35.0;
185184
const default_display_length = 1.5;
186185

187186
const default_side_pane_width = '8%';
187+
const default_design_width = "66%";
188188

189189
const default_group_name = 'default_group';
190190

lib/src/middleware/all_middleware.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import 'helix_offsets_change.dart';
2121
import 'insertion_deletion_batching.dart';
2222
import 'load_file.dart';
2323
import 'oxdna_export.dart';
24+
import 'oxview_update_view.dart';
2425
import 'periodic_save_design_local_storage.dart';
2526
import 'reselect_moved_dna_ends.dart';
2627
import 'reselect_moved_copied_strands.dart';
@@ -80,4 +81,5 @@ final all_middleware = List<Middleware<AppState>>.unmodifiable([
8081
system_clipboard_middleware,
8182
zoom_speed_middleware,
8283
oxdna_export_middleware,
84+
oxview_update_view_middleware,
8385
]);

lib/src/middleware/local_storage.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ save(AppState state, Storable storable) {
4747
if (value_string != null) window.localStorage[storable_key] = value_string;
4848
}
4949

50-
String side_pane_width() => window.localStorage[_LOCAL_STORAGE_PREFIX + 'side_pane_width'];
50+
String side_pane_width() => window.localStorage[_LOCAL_STORAGE_PREFIX + 'side-pane-width'];
51+
String design_width() =>
52+
window.localStorage[_LOCAL_STORAGE_PREFIX + 'design-and-modes-buttons-container-width'];
5153

5254
restore(Store<AppState> store, Storable storable) {
5355
try {

0 commit comments

Comments
 (0)