diff --git a/docs/manual-reference.adoc b/docs/manual-reference.adoc index 607b5b7b..60a11a9f 100644 --- a/docs/manual-reference.adoc +++ b/docs/manual-reference.adoc @@ -381,7 +381,6 @@ 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 @@ -389,6 +388,14 @@ documentation. |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"] diff --git a/docs/manual.adoc b/docs/manual.adoc index e3b682e1..1363b5cd 100644 --- a/docs/manual.adoc +++ b/docs/manual.adoc @@ -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 diff --git a/docs/manual.html b/docs/manual.html index 0c80c2cd..e4b5be7b 100644 --- a/docs/manual.html +++ b/docs/manual.html @@ -2566,8 +2566,8 @@

Files and formats

  • .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 @@ -4188,11 +4188,6 @@

    File

    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

    @@ -4221,6 +4216,30 @@

    File

    +

    Import

    + +++++ + + + + + + + + + + + + + + +
    ControlWhat it doesShortcut / 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

    diff --git a/raptor/gui/command_table.py b/raptor/gui/command_table.py index 61bc1fb5..7d6016f6 100644 --- a/raptor/gui/command_table.py +++ b/raptor/gui/command_table.py @@ -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. diff --git a/raptor/gui/ui/backstage.py b/raptor/gui/ui/backstage.py index 3763e857..36584f4d 100644 --- a/raptor/gui/ui/backstage.py +++ b/raptor/gui/ui/backstage.py @@ -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: @@ -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) @@ -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() diff --git a/tests/unit/test_backstage.py b/tests/unit/test_backstage.py index 93f7d2a4..2b17148e 100644 --- a/tests/unit/test_backstage.py +++ b/tests/unit/test_backstage.py @@ -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…"]