Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion docs/manual-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -381,14 +381,21 @@ documentation.
|Control |What it does |Shortcut / value
|New |Create a new blank model (Ctrl+N) |Ctrl+N
|Open |Open an .rbd or .rbds file (Ctrl+O) |Ctrl+O
|Import Availability Workbench… |Open an Isograph Availability Workbench 5.0 .awb project as a new RAPTOR model; the summary lists what AWB features RAPTOR cannot represent |
|Save |Save (Ctrl+S) |Ctrl+S
|Save As |Save to a new .rbds or .rbd file (Ctrl+Shift+S) |Ctrl+Shift+S
|Close |Close the current model (with save prompt) (Ctrl+W) |Ctrl+W
|Quit |Quit RAPTOR Studio (Ctrl+Q) |Ctrl+Q
|Differences… |What is different between this model and another: its saved file (what you have changed), any model, or a recent one -- parameters and wiring. Nothing is run. |
|===

==== Import

[cols="2,4,1",options="header"]
|===
|Control |What it does |Shortcut / value
|Import Availability Workbench… |Open an Isograph Availability Workbench 5.0 .awb project as a new RAPTOR model; the summary lists what AWB features RAPTOR cannot represent |
|===

==== Print and Export

[cols="2,4,1",options="header"]
Expand Down
4 changes: 2 additions & 2 deletions docs/manual.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1750,8 +1750,8 @@ the Help window stays usable, and can be closed, while a dialog is open.
(annotations, for example) as `.rbd` drops it, with a warning
first. Import RBD merges a `.rbd` or `.rbds` file in as one hierarchy.
* `.awb` — an Isograph **Availability Workbench 5.0** project (RBD/AvSim).
*File ▸ Import Availability Workbench…* reads one into a new model and
*File ▸ Export to Availability Workbench…* writes one; `raptor convert`
*File ▸ Import ▸ Import Availability Workbench…* reads one into a new model and
*File ▸ Print and Export ▸ Export to Availability Workbench…* writes one; `raptor convert`
does the same headless. The conversion always prints a summary of the
features the destination cannot represent, with a count; `--strict`
writes nothing when that list is not empty. AWB's demonstration mode can
Expand Down
33 changes: 26 additions & 7 deletions docs/manual.html
Original file line number Diff line number Diff line change
Expand Up @@ -2566,8 +2566,8 @@ <h2 id="files">Files and formats</h2>
</li>
<li>
<p><code>.awb</code> — an Isograph <strong>Availability Workbench 5.0</strong> project (RBD/AvSim).
<strong>File ▸ Import Availability Workbench…</strong> reads one into a new model and
<strong>File ▸ Export to Availability Workbench…</strong> writes one; <code>raptor convert</code>
<strong>File ▸ Import ▸ Import Availability Workbench…</strong> reads one into a new model and
<strong>File ▸ Print and Export ▸ Export to Availability Workbench…</strong> writes one; <code>raptor convert</code>
does the same headless. The conversion always prints a summary of the
features the destination cannot represent, with a count; <code>--strict</code>
writes nothing when that list is not empty. AWB&#8217;s demonstration mode can
Expand Down Expand Up @@ -4188,11 +4188,6 @@ <h4 id="_file">File</h4>
<td class="tableblock halign-left valign-top"><p class="tableblock">Ctrl+O</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Import Availability Workbench…</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Open an Isograph Availability Workbench 5.0 .awb project as a new RAPTOR model; the summary lists what AWB features RAPTOR cannot represent</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Save</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Save (Ctrl+S)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Ctrl+S</p></td>
Expand Down Expand Up @@ -4221,6 +4216,30 @@ <h4 id="_file">File</h4>
</table>
</div>
<div class="sect3">
<h4 id="_import">Import</h4>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 28.5714%;">
<col style="width: 57.1428%;">
<col style="width: 14.2858%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Control</th>
<th class="tableblock halign-left valign-top">What it does</th>
<th class="tableblock halign-left valign-top">Shortcut / value</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Import Availability Workbench…</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Open an Isograph Availability Workbench 5.0 .awb project as a new RAPTOR model; the summary lists what AWB features RAPTOR cannot represent</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>
</div>
<div class="sect3">
<h4 id="_print_and_export">Print and Export</h4>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
Expand Down
5 changes: 4 additions & 1 deletion raptor/gui/command_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -1496,8 +1496,11 @@ def _p(title: str, index_attr: str, *groups: Group) -> Page:
#: left of the tabs, as in Office: (section title, command ids). Commands
#: here are placed as surely as those on a ribbon page.
BACKSTAGE: tuple[tuple[str, tuple[str, ...]], ...] = (
("File", ("file.new", "file.open", "file.import_awb", "file.save",
("File", ("file.new", "file.open", "file.save",
"file.save_as", "file.close_file", "file.quit", "home.diff")),
# Other tools' files opened as a new model: one tile per format, so a
# new importer is one more id here.
("Import", ("file.import_awb",)),
# U22: one Export (the file type picks what is written), then Export
# Tables for choosing tables; the single-type commands stay in the
# command palette and on their shortcuts.
Expand Down
22 changes: 14 additions & 8 deletions raptor/gui/ui/backstage.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,19 @@ def __init__(self, window: MainWindow):
self._home_page = self._build_home_page()
self._new_page = self._build_new_page()
self._recent_page = self._build_recent_page()
self._share_page = self._build_share_page()
self._tiles: list[QPushButton] = []
sections = dict(BACKSTAGE)
self._import_page = self._build_tile_page("Import", sections["Import"])
self._share_page = self._build_tile_page("Print and Export",
sections["Print and Export"])
self._add_page_button(nl, "Home", self._home_page, "home_icon")
self._add_page_button(nl, "New", self._new_page, "new_file_icon")
self._add_page_button(nl, "Recent", self._recent_page,
"recent_files_icon")
for cid in BACKSTAGE[0][1]:
for cid in sections["File"]:
if cid != "file.new": # the New page's Blank model card
nl.addWidget(self._nav_command(cid))
self._add_page_button(nl, "Import", self._import_page, "awb_import_icon")
self._add_page_button(nl, "Print and Export", self._share_page,
"printer_icon")
for cid in BACKSTAGE_ACTIONS:
Expand Down Expand Up @@ -502,20 +507,20 @@ def _build_recent_page(self) -> QWidget:
lay.addWidget(self._empty)
return page

def _build_share_page(self) -> QWidget:
def _build_tile_page(self, heading: str, ids: tuple[str, ...]) -> QWidget:
"""A page of large command tiles: Import, Print and Export."""
page = QWidget()
page.setObjectName("BackstagePage")
lay = QVBoxLayout(page)
lay.setContentsMargins(40, 28, 40, 28)
lay.setSpacing(16)
title = QLabel("Print and Export")
title = QLabel(heading)
title.setObjectName("BackstageTitle")
lay.addWidget(title)
grid = QGridLayout()
grid.setHorizontalSpacing(12)
grid.setVerticalSpacing(12)
self._tiles: list[QPushButton] = []
for n, cid in enumerate(BACKSTAGE[1][1]):
for n, cid in enumerate(ids):
tile = self._tile(self._win._commands.action(cid))
grid.addWidget(tile, n // 2, n % 2)
self._tiles.append(tile)
Expand Down Expand Up @@ -570,8 +575,9 @@ def sync(a=action, t=tile, d=desc) -> None:
# ---- behaviour ------------------------------------------------------

def open_view(self, page: str = "Home") -> None:
"""Show the view on `page` ("Home", "New", "Recent", "Print and
Export"). Home is the start screen: new, recent and help at once."""
"""Show the view on `page` ("Home", "New", "Recent", "Import",
"Print and Export"). Home is the start screen: new, recent and help
at once."""
self._restyle()
self.setGeometry(self._win.rect())
self.reload()
Expand Down
16 changes: 16 additions & 0 deletions tests/unit/test_backstage.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,3 +234,19 @@ def test_a_refresh_with_an_unchanged_list_keeps_the_rows(win):
after = bs._home_page.findChildren(QPushButton, "BackstageRecentRow")
assert [id(b) for b in before if b.isVisible()] \
== [id(b) for b in after if b.isVisible()]


def test_the_file_view_has_an_import_page_with_availability_workbench(win):
"""Importers sit on their own Import page (one tile per format), not
among Open/Save in the nav column."""
from raptor.gui.command_table import BACKSTAGE
sections = dict(BACKSTAGE)
assert sections["Import"] == ("file.import_awb",)
assert "file.import_awb" not in sections["File"]
win._show_backstage("Import")
bs = win._backstage
names = [b.text() for b in bs._nav_buttons]
assert names.index("Import") == names.index("Print and Export") - 1
page, _btn = bs._page_by_name["Import"]
tiles = [t for t in bs._tiles if page.isAncestorOf(t)]
assert [t.accessibleName() for t in tiles] == ["Import Availability Workbench…"]