Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
trungleduc committed Nov 2, 2023
1 parent 0685df0 commit da270e2
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
fail-fast: false
max-parallel: 4
matrix:
python-version: [3.7, 3.8, 3.9, "3.10"]
python-version: [3.8, 3.9, 3.10, 3.11]

steps:
- uses: actions/checkout@v1
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ build-backend = "hatchling.build"
name = "voila-gridstack"
readme = "README.md"
license = { file = "LICENSE" }
requires-python = ">=3.7"
requires-python = ">=3.8"
dependencies = ["jupyterlab_widgets~=3.0", "voila>=0.2,<0.6"]
classifiers = [
"Framework :: Jupyter",
Expand All @@ -23,10 +23,10 @@ classifiers = [
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
dynamic = ["version", "description", "authors", "urls", "keywords"]

Expand Down
10 changes: 5 additions & 5 deletions src/editor/gridstack/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,16 @@ export class GridStackLayout extends Layout {
this._prepareGrid();
}

/**
/**
* Create an iterator over the widgets in the layout.
*
* @returns A new iterator over the widgets in the layout.
*/
*[Symbol.iterator](): IterableIterator<Widget> {
for (const item of this._gridItems) {
yield item;
}
*[Symbol.iterator](): IterableIterator<Widget> {
for (const item of this._gridItems) {
yield item;
}
}

/**
* Remove a widget from the layout.
Expand Down
26 changes: 23 additions & 3 deletions src/editor/gridstack/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class GridStackWidget extends Widget {
this.addClass('grid-editor');
this._model = model;

this.layout = new GridStackLayout(this._model.info);
this._gridlayout = new GridStackLayout(this._model.info);
this.layout.gridItemChanged.connect(this._onGridItemChange, this);

this._model.ready.connect(() => {
Expand All @@ -62,6 +62,27 @@ export class GridStackWidget extends Widget {
});
}

get layout(): GridStackLayout {
return this._gridlayout;
}

set layout(value: GridStackLayout) {
if (this._gridlayout === value) {
return;
}
if (this.testFlag(Widget.Flag.DisallowLayout)) {
throw new Error('Cannot set widget layout.');
}
if (this._gridlayout) {
throw new Error('Cannot change widget layout.');
}
if (value!.parent) {

Check warning on line 79 in src/editor/gridstack/widget.ts

View workflow job for this annotation

GitHub Actions / build

Forbidden non-null assertion
throw new Error('Cannot change layout parent.');
}
this._gridlayout = value;
value!.parent = this;

Check warning on line 83 in src/editor/gridstack/widget.ts

View workflow job for this annotation

GitHub Actions / build

Forbidden non-null assertion
}

/**
* Update the layout to reclaim any empty space
*/
Expand Down Expand Up @@ -733,8 +754,7 @@ export class GridStackWidget extends Widget {
}
}

//@ts-ignore
layout: GridStackLayout;
private _gridlayout: GridStackLayout;

private _model: GridStackModel;
private _shadowWidget: GridItemHTMLElement | null = null;
Expand Down

0 comments on commit da270e2

Please sign in to comment.