before_code stringlengths 14 465k | reviewer_comment stringlengths 16 64.5k | after_code stringlengths 9 467k | diff_context stringlengths 0 97k | file_path stringlengths 5 226 | comment_line int32 0 26 | language stringclasses 37
values | quality_score float32 0.07 1 | comment_type stringclasses 9
values | comment_length int32 16 64.5k | before_lines int32 1 17.2k | after_lines int32 1 12.1k | is_negative bool 2
classes | pr_title stringlengths 1 308 | pr_number int32 1 299k | repo_name stringclasses 533
values | repo_stars int64 321 419k | repo_language stringclasses 27
values | reviewer_username stringlengths 0 39 | author_username stringlengths 2 39 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
);
},
[dispatch, updateVarName, propagate, updateVars, valueById, props.onChange, module]
);
const handleCheckAllChange = useCallback(
(event: SelectChangeEvent<HTMLInputElement>, checked: boolean) => {
const sel = checked ? lovList.map((elt) => elt.id) : [];
... | No issues found. | );
},
[dispatch, updateVarName, propagate, updateVars, valueById, props.onChange, module]
);
const handleCheckAllChange = useCallback(
(event: SelectChangeEvent<HTMLInputElement>, checked: boolean) => {
const sel = checked ? lovList.map((elt) => elt.id) : [];
... | @@ -128,6 +128,9 @@ const renderBoxSx = {
interface SelectorProps extends SelTreeProps {
dropdown?: boolean;
mode?: string;
+ defaultSelectionMessage?: string;
+ selectionMessage?: string;
+ showSelectAll?: boolean;
}
const Selector = (props: SelectorProps) => {
@@ -145,6 +148,7 @@ const Selecto... | frontend/taipy-gui/src/components/Taipy/Selector.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | selector: selection message and select all | 2,299 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | |
from taipy.core._orchestrator._dispatcher import _JobDispatcher
from taipy.core._orchestrator._orchestrator_factory import _OrchestratorFactory
from taipy.core.data import InMemoryDataNode
from taipy.core.data.data_node_id import EDIT_JOB_ID_KEY, EDIT_TIMESTAMP_KEY
from taipy.core.job._job_manager_factory import _JobMa... | No issues found. | from taipy.core._orchestrator._dispatcher import _JobDispatcher
from taipy.core._orchestrator._orchestrator_factory import _OrchestratorFactory
from taipy.core.data import InMemoryDataNode
from taipy.core.data.data_node_id import EDIT_JOB_ID_KEY, EDIT_TIMESTAMP_KEY
from taipy.core.job._job_manager_factory import _JobMa... | @@ -10,19 +10,25 @@
# specific language governing permissions and limitations under the License.
import traceback
-from taipy import Job, JobId, Status, Task
+from taipy import Job, JobId, Scope, Status, Task
from taipy.core._orchestrator._dispatcher import _JobDispatcher
from taipy.core._orchestrator._orchestrat... | tests/core/_orchestrator/_dispatcher/test_dispatcher__update_job_status.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Fix issue about not publishing data node updates | 2,316 | Avaiga/taipy | 12,680 | Python | jrobinAV | |
await waitFor(() => {
const elt = container.querySelector(".main-svg");
expect(elt).toHaveStyle({
backgroundColor: "rgb(255, 0, 0)",
});
});
});
it("processes colorMap prop correctly", async () => {
const { container } = render(<Metric... | No issues found. | await waitFor(() => {
const elt = container.querySelector(".main-svg");
expect(elt).toHaveStyle({
backgroundColor: "rgb(255, 0, 0)",
});
});
});
it("processes colorMap prop correctly", async () => {
const { container } = render(<Metric... | @@ -274,14 +274,13 @@ describe("Metric Component", () => {
});
});
- it("applies style correctly when height is undefined", async () => {
+ it("applies style correctly when height and width are undefined", async () => {
const { container } = render(<Metric />);
await waitFor(() =... | frontend/taipy-gui/src/components/Taipy/Metric.spec.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | Allow for adjustement of the metric control geometry | 2,327 | Avaiga/taipy | 12,680 | Python | namnguyen20999 | |
cls,
id: str,
default_path: Optional[str] = None,
encoding: Optional[str] = None,
has_header: Optional[bool] = None,
exposed_type: Optional[str] = None,
scope: Optional[Scope] = None,
validity_period: Optional[timedelta] = None,
**properties,
)... | No issues found. | cls,
id: str,
default_path: Optional[str] = None,
encoding: Optional[str] = None,
has_header: Optional[bool] = None,
exposed_type: Optional[str] = None,
scope: Optional[Scope] = None,
validity_period: Optional[timedelta] = None,
**properties,
)... | @@ -38,7 +38,7 @@ class DataNodeConfig(Section):
"""
name = "DATA_NODE"
-
+ _ALL_TYPES = (str, int, float, bool, list, dict, tuple, set, type(None), callable)
_STORAGE_TYPE_KEY = "storage_type"
_STORAGE_TYPE_VALUE_PICKLE = "pickle"
_STORAGE_TYPE_VALUE_SQL_TABLE = "sql_table"
@@ -150,6 +150... | taipy/core/config/data_node_config.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | feat: add data config checker for property value types | 2,328 | Avaiga/taipy | 12,680 | Python | joaoandre-avaiga | |
"""The list of the input data node configurations."""
return list(self._inputs)
@property
def output_configs(self) -> List[DataNodeConfig]:
"""The list of the output data node configurations."""
return list(self._outputs)
@property
def outputs(self) -> List[DataNodeConf... | No issues found. | """The list of the input data node configurations."""
return list(self._inputs)
@property
def output_configs(self) -> List[DataNodeConfig]:
"""The list of the output data node configurations."""
return list(self._outputs)
@property
def outputs(self) -> List[DataNodeConf... | @@ -50,6 +50,9 @@ class TaskConfig(Section):
(*exposed_type* field) of the input data nodes and returning results compatible with the
data type (*exposed_type* field) of the outputs list."""
+ # NOTE: # {task_type: ["required_key1"]}
+ _REQUIRED_PROPERTIES: Dict[str, List[str]] = {}
+
def __init_... | taipy/core/config/task_config.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | feature/enterprise/#576 added _check_required_properties for task config checker | 2,335 | Avaiga/taipy | 12,680 | Python | toan-quach | |
} else if (evt.key === "ArrowDown") {
let val =
Number(evt.currentTarget.querySelector("input")?.value || 0) -
(step || 1) * (stepMultiplier || 10);
if (min !== undefined && val < min) {
val =... | No issues found. | } else if (evt.key === "ArrowDown") {
let val =
Number(evt.currentTarget.querySelector("input")?.value || 0) -
(step || 1) * (stepMultiplier || 10);
if (min !== undefined && val < min) {
val =... | @@ -51,6 +51,7 @@ const verticalDivStyle: CSSProperties = {
flexDirection: "column",
gap: 0,
};
+const noPaddingYSx = {py: 0};
const Input = (props: TaipyInputProps) => {
const {
@@ -264,32 +265,36 @@ const Input = (props: TaipyInputProps) => {
() =>
type == "number"
... | frontend/taipy-gui/src/components/Taipy/Input.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | Backports for 4.0.2 | 2,336 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | |
defaultOpen="true"
open={undefined as unknown as boolean}
labels={JSON.stringify(["toto", "titi", "toto"])}
/>
</HelmetProvider>
);
expect(getAllByRole("button")).toHaveLength(4);
});
it("is disabled", async ... | No issues found. | defaultOpen="true"
open={undefined as unknown as boolean}
labels={JSON.stringify(["toto", "titi", "toto"])}
/>
</HelmetProvider>
);
expect(getAllByRole("button")).toHaveLength(4);
});
it("is disabled", async ... | @@ -44,7 +44,7 @@ describe("Dialog Component", () => {
const { getByText } = render(
<HelmetProvider>
<Dialog title="Dialog-Test-Title" page="page" open={true} />
- </HelmetProvider>,
+ </HelmetProvider>
);
const elt = getByText("Dialog-Test... | frontend/taipy-gui/src/components/Taipy/Dialog.spec.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | popupdialog associated with an id (query selector) | 2,339 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | |
RowValue,
} from "taipy-gui";
interface GameTableProps extends TaipyDynamicProps {
data: TableValueType;
}
const pageKey = "no-page-key";
const GameTable = (props: GameTableProps) => {
const { data, updateVarName = "", updateVars = "", id } = props;
const [value, setValue] = useState<Record<string, A... | No issues found. | RowValue,
} from "taipy-gui";
interface GameTableProps extends TaipyDynamicProps {
data: TableValueType;
}
const pageKey = "no-page-key";
const GameTable = (props: GameTableProps) => {
const { data, updateVarName = "", updateVars = "", id } = props;
const [value, setValue] = useState<Record<string, A... | @@ -1,3 +1,16 @@
+/*
+ * Copyright 2021-2024 Avaiga Private Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unles... | doc/gui/extension/example_library/front-end/src/GameTable.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | Chart extension documentation | 2,341 | Avaiga/taipy | 12,680 | Python | namnguyen20999 | |
# Copyright 2021-2025 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | No issues found. | # Copyright 2021-2025 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | @@ -9,10 +9,23 @@
# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
-from taipy.gui import Markdown
+import taipy.gui.builder as tgb
selected_scenario = None
selected_d... | taipy/templates/sdm/{{cookiecutter.__root_folder}}/pages/root.py | 0 | Python | 1 | none | 16 | 32 | 32 | true | Feature/#2263 - Convert templates from markdown to tgb | 2,367 | Avaiga/taipy | 12,680 | Python | trgiangdo | |
await userEvent.type(search, "m 3");
expect(queryAllByText(/Item /)).toHaveLength(1);
await userEvent.clear(search);
expect(queryAllByText(/Item /)).toHaveLength(4);
});
});
describe("Selector Component with dropdown", () => {
//dropdown
it... | No issues found. | await userEvent.type(search, "m 3");
expect(queryAllByText(/Item /)).toHaveLength(1);
await userEvent.clear(search);
expect(queryAllByText(/Item /)).toHaveLength(4);
});
});
describe("Selector Component with dropdown", () => {
//dropdown
it... | @@ -328,6 +328,13 @@ describe("Selector Component", () => {
await userEvent.click(elt);
expect(elt.parentElement?.querySelector("span.Mui-checked")).not.toBeNull();
});
+ it("sets the correct height for the radio mode", async () => {
+ const height = "200px";
+ ... | frontend/taipy-gui/src/components/Taipy/Selector.spec.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | Fix Selector Height for Radio/Check Mode | 2,425 | Avaiga/taipy | 12,680 | Python | Satoshi-Sh | |
# Copyright 2021-2025 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | No issues found. | # Copyright 2021-2025 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | @@ -23,6 +23,8 @@ def __enter__(self):
def __exit__(self, exc_type, exc_value, traceback):
if self.__thread_stack:
self.__thread_stack.pop().start()
+ if exc_value:
+ raise exc_value
return self
def _add_thread(self, thread: Thread): | taipy/gui/_event_context_manager.py | 0 | Python | 1 | none | 16 | 32 | 32 | true | fix annoying bits | 2,439 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | |
# Copyright 2021-2025 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | No issues found. | # Copyright 2021-2025 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | @@ -0,0 +1,39 @@
+# Copyright 2021-2025 Avaiga Private Limited
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required b... | tests/common/config/test_inject_section.py | 0 | Python | 1 | none | 16 | 40 | 40 | true | Refactor - Allow expanding the TYPE_PATTERN by the _BaseSerializer._SERIALIZABLE_TYPES list | 2,440 | Avaiga/taipy | 12,680 | Python | trgiangdo | |
new ESLintPlugin({
extensions: [`ts`, `tsx`],
exclude: [`/node_modules/`],
eslintPath: require.resolve("eslint"),
}),
new webpack.DllReferencePlugin({
name: reactBundleName,
... | No issues found. | new ESLintPlugin({
extensions: [`ts`, `tsx`],
exclude: [`/node_modules/`],
eslintPath: require.resolve("eslint"),
}),
new webpack.DllReferencePlugin({
name: reactBundleName,
... | @@ -16,31 +16,31 @@ const path = require("path");
const webpack = require("webpack");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
-const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin');
+const AddAssetHtmlPlugin = require("add-asse... | frontend/taipy-gui/webpack.config.js | 0 | JavaScript | 1 | none | 16 | 51 | 51 | true | Chart animation | 2,443 | Avaiga/taipy | 12,680 | Python | namnguyen20999 | |
from flask import g
class _LocalsContext:
__ctx_g_name = "locals_context"
def __init__(self) -> None:
self.__default_module: str = ""
self._lc_stack: t.List[str] = []
self._locals_map: t.Dict[str, t.Dict[str, t.Any]] = {}
def set_default(self, default: t.Dict[str, t.Any], default... | No issues found. | from flask import g
class _LocalsContext:
__ctx_g_name = "locals_context"
def __init__(self) -> None:
self.__default_module: str = ""
self._lc_stack: t.List[str] = []
self._locals_map: t.Dict[str, t.Dict[str, t.Any]] = {}
def set_default(self, default: t.Dict[str, t.Any], default... | @@ -42,6 +42,9 @@ def get_all_keys(self) -> t.Set[str]:
def get_all_context(self):
return self._locals_map.keys()
+ def has_context(self, context: t.Optional[str]) -> bool:
+ return context is None or context in self._locals_map
+
def add(self, context: t.Optional[str], locals_dict: t.Opt... | taipy/gui/utils/_locals_context.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Manage context for pages that are not directly declared | 2,444 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | |
dynamic_type = match.group(3)
val = os.environ.get(var)
if val is None:
if required:
raise MissingEnvVariableError(f"Environment variable {var} is not set.")
return default
if type is bool:
return cls._to... | No issues found. | dynamic_type = match.group(3)
val = os.environ.get(var)
if val is None:
if required:
raise MissingEnvVariableError(f"Environment variable {var} is not set.")
return default
if type is bool:
return cls._to... | @@ -128,3 +128,12 @@ def _to_class(val: str):
return locate(val)
except Exception:
raise InconsistentEnvVariableError(f"{val} is not a valid class.") from None
+
+ @staticmethod
+ def _to_enum(val: str):
+ enum_class, enum_value = val.rsplit(".", 1)
+ try:
+ ... | taipy/common/config/common/_template_handler.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Feature - Allow serialize Enum object | 2,457 | Avaiga/taipy | 12,680 | Python | trgiangdo | |
entity_type=EventEntityType.SEQUENCE,
entity_id="SEQUENCE_scenario_id",
operation=EventOperation.UPDATE,
attribute_name="tasks",
)
assert isinstance(registration_2.registration_id, str)
assert registration_2.registration_id.startswith(_Registration._ID_PREFIX)
assert isin... | No issues found. | entity_type=EventEntityType.SEQUENCE,
entity_id="SEQUENCE_scenario_id",
operation=EventOperation.UPDATE,
attribute_name="tasks",
)
assert isinstance(registration_2.registration_id, str)
assert registration_2.registration_id.startswith(_Registration._ID_PREFIX)
assert isin... | @@ -18,31 +18,45 @@
def test_create_registration():
- registration_0 = _Registration()
+ registration = _Registration()
+ assert isinstance(registration.registration_id, str)
+ assert registration.registration_id.startswith(_Registration._ID_PREFIX)
+ assert isinstance(registration.queue, SimpleQueu... | tests/core/notification/test_registration.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Make core event registration able to support multiple topics | 2,505 | Avaiga/taipy | 12,680 | Python | jrobinAV | |
boxSizing: "border-box",
// for textarea height calculation
"&.MuiInputBase-inputMultiline": {
minHeight: "unset",
},
// for small size
"&.MuiInputBase-inputSizeSmall": {
... | No issues found. | boxSizing: "border-box",
// for textarea height calculation
"&.MuiInputBase-inputMultiline": {
minHeight: "unset",
},
// for small size
"&.MuiInputBase-inputSizeSmall": {
... | @@ -97,6 +97,10 @@ export const stylekitTheme = {
"&.MuiInputBase-inputMultiline": {
minHeight: "unset",
},
+ // for small size
+ "&.MuiInputBase-inputSizeSmall": {
+ minHeight: 'unset',
+ ... | frontend/taipy-gui/src/themes/stylekit.ts | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | Refactor button and input components to use dynamic height based on size prop | 2,507 | Avaiga/taipy | 12,680 | Python | nunoferna | |
*
* - Its identifier as a string;
* - Its label (or icon) as a `stringIcon`;
* - Potential child elements as an array of `LoVElt`s.
*/
export declare type LoVElt = [
/** The identifier. */
string,
/** The label or icon. */
stringIcon,
/** The list of children. */
LoVElt[]?
];
/**
* A serie... | No issues found. | *
* - Its identifier as a string;
* - Its label (or icon) as a `stringIcon`;
* - Potential child elements as an array of `LoVElt`s.
*/
export declare type LoVElt = [
/** The identifier. */
string,
/** The label or icon. */
stringIcon,
/** The list of children. */
LoVElt[]?
];
/**
* A serie... | @@ -364,7 +364,7 @@ export interface ColumnDesc {
width?: number | string;
/** If true, the column cannot be edited. */
notEditable?: boolean;
- /** The name of the column that holds the CSS classname to
+ /** The name of the column that holds the CSS className to
* apply to the cells. */
... | frontend/taipy-gui/packaging/taipy-gui.d.ts | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | line breaks in table cells | 2,525 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | |
assert len(_DataManager._get_all()) == 1
assert _DataManager._exists(dn.id)
# changing data node attribute
dn._config_id = "foo"
assert dn.config_id == "foo"
_DataManager._update(dn)
assert len(_DataManager._get_all()) == 1
assert dn.config_id == "foo"
... | No issues found. | assert len(_DataManager._get_all()) == 1
assert _DataManager._exists(dn.id)
# changing data node attribute
dn._config_id = "foo"
assert dn.config_id == "foo"
_DataManager._update(dn)
assert len(_DataManager._get_all()) == 1
assert dn.config_id == "foo"
... | @@ -12,7 +12,9 @@
import os
import pathlib
+import pandas as pd
import pytest
+from pandas.testing import assert_frame_equal
from taipy import Scope
from taipy.common.config import Config
@@ -23,7 +25,7 @@
from taipy.core.data.data_node_id import DataNodeId
from taipy.core.data.in_memory import InMemoryDataN... | tests/core/data/test_data_manager.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Refactor: route DataNode.read() and write() to _DataNodeManager | 2,533 | Avaiga/taipy | 12,680 | Python | trgiangdo | |
# Copyright 2021-2025 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | No issues found. | # Copyright 2021-2025 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | @@ -8,26 +8,33 @@
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under ... | taipy/common/_check_dependencies.py | 0 | Python | 1 | none | 16 | 48 | 48 | true | Refactor - Allow passing extra package name to check dependency | 2,577 | Avaiga/taipy | 12,680 | Python | trgiangdo | |
Config.configure_task("tasks1", print, input_config, output_config)
_check_data_nodes_instance("input", "tasks1")
_check_data_nodes_instance("output", "tasks1")
def test_data_node_instance_when_configure_task_by_loading_toml():
toml_config = _configure_task_in_toml()
Config.load(toml_config.filen... | No issues found. | Config.configure_task("tasks1", print, input_config, output_config)
_check_data_nodes_instance("input", "tasks1")
_check_data_nodes_instance("output", "tasks1")
def test_data_node_instance_when_configure_task_by_loading_toml():
toml_config = _configure_task_in_toml()
Config.load(toml_config.filen... | @@ -12,6 +12,7 @@
import os
from unittest import mock
+from taipy import Scope
from taipy.common.config import Config
from taipy.core.config import DataNodeConfig
from tests.core.utils.named_temporary_file import NamedTemporaryFile
@@ -95,15 +96,30 @@ def test_data_node_instance_when_configure_task_by_overriding... | tests/core/config/test_task_config.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | #enterprise-666 prepare migration feature into release/4.1 | 2,604 | Avaiga/taipy | 12,680 | Python | jrobinAV | |
"""Reset the _Reloader singleton between tests."""
_Reloader._instance = None
_Reloader._no_reload_context = False
_Reloader._context_depth = 0
yield
_Reloader._instance = None
_Reloader._no_reload_context = False
_Reloader._context_depth = 0
class TestReloader:
def test_initial_st... | No issues found. | """Reset the _Reloader singleton between tests."""
_Reloader._instance = None
_Reloader._no_reload_context = False
_Reloader._context_depth = 0
yield
_Reloader._instance = None
_Reloader._no_reload_context = False
_Reloader._context_depth = 0
class TestReloader:
def test_initial_st... | @@ -0,0 +1,87 @@
+# Copyright 2021-2025 Avaiga Private Limited
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required b... | tests/core/_entity/test_reload.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Re entrant and thread safe reloader (#2589) | 2,612 | Avaiga/taipy | 12,680 | Python | jrobinAV | |
assert len(Config._collector.errors) == 0
required_properties = ["db_username", "db_password", "db_name", "db_engine", "table_name"]
config._sections[DataNodeConfig.name]["new"].storage_type = "sql_table"
config._sections[DataNodeConfig.name]["new"].properties = {key: f"the_{key}" for k... | No issues found. | assert len(Config._collector.errors) == 0
required_properties = ["db_username", "db_password", "db_name", "db_engine", "table_name"]
config._sections[DataNodeConfig.name]["new"].storage_type = "sql_table"
config._sections[DataNodeConfig.name]["new"].properties = {key: f"the_{key}" for k... | @@ -192,12 +192,11 @@ def test_check_storage_type(self, caplog):
with pytest.raises(SystemExit):
Config._collector = IssueCollector()
Config.check()
- assert len(Config._collector.errors) == 4
+ assert len(Config._collector.errors) == 3
expected_error_messages =... | tests/core/config/checkers/test_data_node_config_checker.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Fix/#2616 - Make read_query and write_query_builder optional for SQLDataNode | 2,649 | Avaiga/taipy | 12,680 | Python | trgiangdo | |
# Copyright 2021-2024 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | No issues found. | # Copyright 2021-2024 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | @@ -25,6 +25,7 @@
from ._registration import _Registration
from ._topic import _Topic
+from .core_event_consumer import CoreEventConsumerBase
from .event import _ENTITY_TO_EVENT_ENTITY_TYPE, Event, EventEntityType, EventOperation, _make_event
from .notifier import Notifier, _publish_event
from .registration_id i... | taipy/core/notification/__init__.py | 0 | Python | 1 | none | 16 | 32 | 32 | true | Make CoreEventConsumerBase deprecated | 2,650 | Avaiga/taipy | 12,680 | Python | jrobinAV | |
# Copyright 2021-2025 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | No issues found. | # Copyright 2021-2025 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | @@ -25,6 +25,7 @@
from ._registration import _Registration
from ._topic import _Topic
+from .core_event_consumer import CoreEventConsumerBase
from .event import Event, EventEntityType, EventOperation, _make_event
from .notifier import Notifier, _publish_event
from .registration_id import RegistrationId | taipy/core/notification/__init__.py | 0 | Python | 1 | none | 16 | 32 | 32 | true | Backport compatibility on consumer to develop | 2,651 | Avaiga/taipy | 12,680 | Python | jrobinAV | |
csv_dn.write(original_content)
def test_write_with_header_pandas(tmp_csv_file):
csv_dn = CSVDataNode("foo", Scope.SCENARIO, properties={"path": tmp_csv_file})
_DataManagerFactory._build_manager()._repository._save(csv_dn)
df = pd.DataFrame([{"a": 1, "b": 2, "c": 3}, {"a": 4, "b": 5, "c": 6}])
csv... | No issues found. | csv_dn.write(original_content)
def test_write_with_header_pandas(tmp_csv_file):
csv_dn = CSVDataNode("foo", Scope.SCENARIO, properties={"path": tmp_csv_file})
_DataManagerFactory._build_manager()._repository._save(csv_dn)
df = pd.DataFrame([{"a": 1, "b": 2, "c": 3}, {"a": 4, "b": 5, "c": 6}])
csv... | @@ -71,6 +71,29 @@ def test_append(csv_file, default_data_frame, content):
)
+def test_append_with_different_separator():
+ path = os.path.join(pathlib.Path(__file__).parent.resolve(), "data_sample/example_2.csv")
+
+ original_content = pd.read_csv(path, sep=";")
+ content = pd.DataFrame(
+ [
+... | tests/core/data/test_write_csv_data_node.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Feature/#2603 - Add separator property to CSVDataNode | 2,652 | Avaiga/taipy | 12,680 | Python | trgiangdo | |
# Copyright 2021-2025 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | No issues found. | # Copyright 2021-2025 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | @@ -19,3 +19,10 @@ def test_part_builder_1(gui: Gui, helpers):
tgb.text(value="This is a part") # type: ignore[attr-defined]
expected_list = ["<Part", "This is a part"]
helpers.test_control_builder(gui, page, expected_list)
+
+def test_part_builder_with_style(gui: Gui, helpers):
+ with tgb.Pa... | tests/gui/builder/control/test_part.py | 0 | Python | 1 | none | 16 | 29 | 29 | true | part style property support | 2,670 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | |
columns[columnKey].headers && columns[columnKey].headers?.length > headerLevel
? columns[columnKey].headers[headerLevel]
: undefined;
const setInputFocus = (input: HTMLInputElement) => input && input.focus();
const textFieldProps = { textField: { margin: "dense" } } as BaseDateTimePickerSlotProps;... | No issues found. | columns[columnKey].headers && columns[columnKey].headers?.length > headerLevel
? columns[columnKey].headers[headerLevel]
: undefined;
const setInputFocus = (input: HTMLInputElement) => input && input.focus();
const textFieldProps = { textField: { margin: "dense" } } as BaseDateTimePickerSlotProps;... | @@ -193,6 +193,8 @@ export const iconsWrapperSx = { gridColumnStart: 2, display: "flex", alignItems:
const CellBoxSx = { display: "grid", gridTemplateColumns: "1fr auto", alignItems: "center" } as CSSProperties;
const TableFontSx = { fontSize: "body2.fontSize" };
const ButtonSx = { minHeight: "unset", mb: "unset", p... | frontend/taipy-gui/src/components/Taipy/tableUtils.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | Selector in table width | 2,687 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | |
# Copyright 2021-2025 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | No issues found. | # Copyright 2021-2025 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | @@ -0,0 +1,18 @@
+# Copyright 2021-2025 Avaiga Private Limited
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required b... | taipy/gui/utils/_check_plotly.py | 0 | Python | 1 | none | 16 | 19 | 19 | true | do not check the plotly generated json | 2,717 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | |
# Copyright 2021-2025 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | No issues found. | # Copyright 2021-2025 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | @@ -0,0 +1,18 @@
+# Copyright 2021-2025 Avaiga Private Limited
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required b... | taipy/gui/utils/_check_plotly.py | 0 | Python | 1 | none | 16 | 19 | 19 | true | do not check the plotly generated json (#2717) | 2,719 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | |
@pytest.mark.skip_if_not_server("flask")
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Test skipped on Windows")
@pytest.mark.filterwarnings("ignore::RuntimeWarning")
@pytest.mark.teste2e
@testbook("tests/gui/notebook/simple_gui.ipynb")
def test_notebook_simple_gui(tb, helpers):
tb.execute_cell("impor... | No issues found. | @pytest.mark.skip_if_not_server("flask")
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Test skipped on Windows")
@pytest.mark.filterwarnings("ignore::RuntimeWarning")
@pytest.mark.teste2e
@testbook("tests/gui/notebook/simple_gui.ipynb")
def test_notebook_simple_gui(tb, helpers):
tb.execute_cell("impor... | @@ -18,6 +18,8 @@
import pytest
from testbook import testbook
+from taipy.gui import Gui
+
def wait_for_content(url, expected_text, timeout=10):
start = time.time()
@@ -45,36 +47,36 @@ def test_notebook_simple_gui(tb, helpers):
tb.execute_cell("gui_run")
while not helpers.port_check():
ti... | tests/gui/notebook/test_notebook_simple_gui.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | block non front-end variables | 2,724 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | |
def __hold_messages(self):
grouping_message = self.__get_message_grouping()
if grouping_message is None:
self._bind_var_val(Gui.__MESSAGE_GROUPING_NAME, [])
def __send_messages(self):
grouping_message = self.__get_message_grouping()
if grouping_message is not None:
... | No issues found. | def __hold_messages(self):
grouping_message = self.__get_message_grouping()
if grouping_message is None:
self._bind_var_val(Gui.__MESSAGE_GROUPING_NAME, [])
def __send_messages(self):
grouping_message = self.__get_message_grouping()
if grouping_message is not None:
... | @@ -32,7 +32,6 @@
import markdown as md_lib
import tzlocal
-from werkzeug.utils import secure_filename
import __main__ # noqa: F401
from taipy.common import _module_exists
@@ -89,6 +88,7 @@
_LocalsContext,
_MapDict,
_patch_value,
+ _secure_filename_unicode,
_setscopeattr,
_setscopea... | taipy/gui/gui.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | fix: preserve unicode characters in uploaded filenames | 2,737 | Avaiga/taipy | 12,680 | Python | AitElBadaoui | |
});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [
refresh,
dispatch,
config.columns,
config.traces,
config.modes,
config.decimators,
updateVarName,
dataVarNames,
id,
module,
]);
useDispatchRequest... | No issues found. | });
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [
refresh,
dispatch,
config.columns,
config.traces,
config.modes,
config.decimators,
updateVarName,
dataVarNames,
id,
module,
]);
useDispatchRequest... | @@ -87,7 +87,7 @@ interface ChartProp extends TaipyActiveProps, TaipyChangeProps {
template_Dark_?: string;
template_Light_?: string;
//[key: `selected${number}`]: number[];
- figure?: Array<Record<string, unknown>>;
+ figure?: Record<string, unknown>;
onClick?: string;
dataVarNames?: str... | frontend/taipy-gui/src/components/Taipy/Chart.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | plotly to_json | 2,761 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | |
"""
The property is dynamic and holds a Boolean value.
"""
number = "number"
"""
The property holds a number.
"""
dynamic_number = _TaipyNumber
"""
The property is dynamic and holds a number.
"""
string = "string"
"""
The property holds a string.
"""
dynam... | No issues found. | """
The property is dynamic and holds a Boolean value.
"""
number = "number"
"""
The property holds a number.
"""
dynamic_number = _TaipyNumber
"""
The property is dynamic and holds a number.
"""
string = "string"
"""
The property holds a string.
"""
dynam... | @@ -75,36 +75,57 @@ class PropertyType(Enum):
"""
The property holds a Boolean value.
"""
- toHtmlContent = _TaipyContentHtml
- content = _TaipyContent
- data = _TaipyData
+ dynamic_boolean = _TaipyBool
+ """
+ The property is dynamic and holds a Boolean value.
+ """
+ number = "n... | taipy/gui/types.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | 'number' control can force integer values | 2,762 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | |
expect(elements[0].type).toBe("div");
expect(elements[0].props.children).toBe("Hello World");
});
it("parse no children HTML", async () => {
const elements = parseJSX("<hr/>");
expect(elements).not.toBeNull();
expect(elements).toHaveLength(1);
expect(elements[0].t... | No issues found. | expect(elements[0].type).toBe("div");
expect(elements[0].props.children).toBe("Hello World");
});
it("parse no children HTML", async () => {
const elements = parseJSX("<hr/>");
expect(elements).not.toBeNull();
expect(elements).toHaveLength(1);
expect(elements[0].t... | @@ -20,18 +20,21 @@ describe("JSX Parser", () => {
expect(elements).not.toBeNull();
expect(elements).toHaveLength(1);
expect(elements[0].type).toBe("div");
- expect(elements[0].props.children).toHaveLength(1);
- const children = elements[0].props.children as React.ReactNode[];
-... | frontend/taipy-gui/src/jsx/parser.spec.ts | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | html tags with no child | 2,765 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | |
<Pane page="page" open={true} onClose="testCloseAction" />
</HelmetProvider>
</TaipyContext.Provider>
);
const elt = document.querySelector(".MuiBackdrop-root");
expect(elt).toBeInTheDocument();
elt && (await userEvent.click(elt));
... | No issues found. | <Pane page="page" open={true} onClose="testCloseAction" />
</HelmetProvider>
</TaipyContext.Provider>
);
const elt = document.querySelector(".MuiBackdrop-root");
expect(elt).toBeInTheDocument();
elt && (await userEvent.click(elt));
... | @@ -12,7 +12,7 @@
*/
import React from "react";
-import { render } from "@testing-library/react";
+import { getByRole, render } from "@testing-library/react";
import "@testing-library/jest-dom";
import userEvent from "@testing-library/user-event";
@@ -90,7 +90,7 @@ describe("Pane Component", () => {
)... | frontend/taipy-gui/src/components/Taipy/Pane.spec.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | Added the title property to the pane block. | 2,772 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | |
/**
* A React hook that requests an update for every dynamic property of the element.
* @param dispatch - The React dispatcher associated to `TaipyContext`.
* @param id - The identifier of the element.
* @param context - The execution context.
* @param updateVars - The content of the property `updateVars`.
* @par... | No issues found. | /**
* A React hook that requests an update for every dynamic property of the element.
* @param dispatch - The React dispatcher associated to `TaipyContext`.
* @param id - The identifier of the element.
* @param context - The execution context.
* @param updateVars - The content of the property `updateVars`.
* @par... | @@ -48,22 +48,22 @@ export const useDynamicProperty = <T>(value: T, defaultValue: T, defaultStatic:
};
/**
- * A React hook to manage a dynamic json property.
+ * A React hook to manage a dynamic dict property (prev. useDynamicJsonProperty).
*
- * A dynamic json property is defined by a default property and a bo... | frontend/taipy-gui/src/utils/hooks.ts | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | rename useDynamicJsonProperty to useDynamicDictProperty | 2,777 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | |
def test_crud_scenario_none(self):
gui_core_context = _GuiCoreContext(Mock())
state = MockState(Mock())
mock_core_delete = Mock()
with (
patch("taipy.gui_core._context.core_get", side_effect=mock_core_get),
patch("taipy.gui_core._context.is_deletable", side_... | No issues found. | def test_crud_scenario_none(self):
gui_core_context = _GuiCoreContext(Mock())
state = MockState(Mock())
mock_core_delete = Mock()
with (
patch("taipy.gui_core._context.core_get", side_effect=mock_core_get),
patch("taipy.gui_core._context.is_deletable", side_... | @@ -41,6 +41,26 @@ def mock_is_true(entity_id):
class TestGuiCoreContext_crud_scenario:
+ def test_crud_scenario_none(self):
+ gui_core_context = _GuiCoreContext(Mock())
+ state = MockState(Mock())
+
+ mock_core_delete = Mock()
+
+ with (
+ patch("taipy.gui_core._context.c... | tests/gui_core/test_context_crud_scenario.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Manage authorization in events | 2,805 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | |
@pytest.mark.parametrize("operation, sequence_is_valid", [(EventOperation.CREATION, True),
(EventOperation.CREATION, False),
(EventOperation.UPDATE, True),
... | No issues found. |
@pytest.mark.parametrize("operation, sequence_is_valid", [(EventOperation.CREATION, True),
(EventOperation.CREATION, False),
(EventOperation.UPDATE, True),
... | @@ -44,7 +44,7 @@ def test_sequence_event(self, operation, sequence_is_valid):
gui_core_context = _GuiCoreContext(Gui())
gui_core_context.process_event(event=event)
- mock_get_auth.assert_called_once_with(system=True)
+ mock_get_auth.assert_called_with(system=True)
... | tests/gui_core/test_context_process_event_sequence.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | every function called with state should be context managed with auth | 2,813 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | |
value: t.Any,
payload: t.Dict[str, t.Any],
data_format: _DataFormat,
) -> t.Dict[str, t.Any]:
return {}
def get_cols_description(self, var_name: str, value: t.Any) -> t.Dict[str, t.Dict[str, str]]:
return {}
def to_pandas(self, value: t.Any) -> t.Union[t.List[t.Any]... | No issues found. | value: t.Any,
payload: t.Dict[str, t.Any],
data_format: _DataFormat,
) -> t.Dict[str, t.Any]:
return {}
def get_cols_description(self, var_name: str, value: t.Any) -> t.Dict[str, t.Dict[str, str]]:
return {}
def to_pandas(self, value: t.Any) -> t.Union[t.List[t.Any]... | @@ -1,6 +1,8 @@
import typing as t
from unittest.mock import Mock
+import pytest
+
from taipy.gui import Gui
from taipy.gui.data.data_accessor import (
_DataAccessor,
@@ -49,6 +51,169 @@ def to_csv(self, var_name: str, value: t.Any) -> t.Optional[str]:
pass
+class MyStringAccessor(_DataAccessor)... | tests/gui/data/test_accessors.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | auth and not auth related or otherwise | 2,815 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | |
def test_patch_update_scalar_in_dict():
obj = { "a": { "b": { "c": None } } }
_patch_value(obj, { "a": { "b": { "c": 2 } } })
assert obj.get("a").get("b").get("c") == 2 # pyright: ignore[reportOptionalMemberAccess]
def test_patch_remove_dict():
obj = { "a": { "b": { "c": 1 } } }
_patch_value(obj... | No issues found. |
def test_patch_update_scalar_in_dict():
obj = { "a": { "b": { "c": None } } }
_patch_value(obj, { "a": { "b": { "c": 2 } } })
assert obj.get("a").get("b").get("c") == 2 # pyright: ignore[reportOptionalMemberAccess]
def test_patch_remove_dict():
obj = { "a": { "b": { "c": 1 } } }
_patch_value(obj... | @@ -90,3 +90,12 @@ def test_update_empty_list():
assert obj2.get("a").get("b", [])[0] == 1 # pyright: ignore[reportOptionalMemberAccess]
assert len(obj2.get("a").get("b", [])) == 2 # pyright: ignore[reportOptionalMemberAccess]
+def test_update_empty_root_dict():
+ obj = {}
+ _patch_value(obj, { "a": {... | tests/gui/utils/test_patch.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | use lower level class to test instances in json type | 2,817 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | |
{
context = context ?? RenderTarget.CreateDrawingContext(this);
RenderComposite(scene, context);
}
context?.Dispose();
}
}
catch (RenderTargetCorruptedException ex)
... | Can we pick a more descriptive name (and maybe save it in a constant so it isn't a magic string)?
Also, is this used for anything other than debugging?
| {
context = context ?? RenderTarget.CreateDrawingContext(this);
RenderComposite(scene, context);
}
context?.Dispose();
}
}
catch (RenderTargetCorruptedException ex)
... | @@ -243,6 +243,15 @@ private void Render(IDrawingContextImpl context, VisualNode node, IVisual layer,
{
clipBounds = node.ClipBounds.Intersect(clipBounds);
+ var np = node.Visual.GetType().GetProperty("Name");
+ var name = (string)np.GetValue(node.Visual);
+... | src/Avalonia.Visuals/Rendering/DeferredRenderer.cs | 26 | C# | 0.571 | bug | 154 | 51 | 51 | false | Clip Focus Adorners | 1,350 | AvaloniaUI/Avalonia | 24,333 | C# | jkoritzinsky | grokys |
_host.UndoRedoState = _currentNode.Value;
}
}
finally
{
_undoRedoing = false;
}
}
public void Snapshot()
{
var current = _host.UndoRedoState;
if (_currentNode == null || !... | Looks like a hack. Could we move this check to the TextBox itself? | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Avalonia.Utilities;
namespace Avalonia.Controls.Utils
{
class UndoRedoHelper<TState> : WeakTimer.IWeakTimerSubscriber where TState : struct, IEquatable<TState>
{
private readonly IU... | @@ -91,6 +110,11 @@ public void Snapshot()
}
}
+ public void Clear()
+ {
+ if (!_undoRedoing) _states.Clear(); | src/Avalonia.Controls/Utils/UndoRedoHelper.cs | 26 | C# | 0.286 | refactor | 66 | 36 | 106 | false | Clear TextBox undo stack on binding change. | 1,450 | AvaloniaUI/Avalonia | 24,333 | C# | kekekeks | grokys |
if (ignoreCancel || !cancelClosing)
{
s_windows.Remove(this);
PlatformImpl?.Dispose();
IsVisible = false;
}
}
}
/// <summary>
/// Handles a closing notification from <see cref... | This should probably just
```
else
{
Renderer.Start();
}
```
| var cancelClosing = false;
try
{
cancelClosing = HandleClosing();
}
finally
{
if (ignoreCancel || !cancelClosing)
{
s_windows.Remove(this);
PlatformImpl?.Dispos... | @@ -308,6 +309,18 @@ protected virtual bool HandleClosing()
return args.Cancel;
}
+ protected virtual void HandleWindowStateChanged(WindowState state)
+ {
+ if (state == WindowState.Minimized)
+ {
+ Renderer.Stop();
+ }
+ e... | src/Avalonia.Controls/Window.cs | 26 | C# | 0.643 | suggestion | 72 | 51 | 51 | false | Stop renderer on Window minimize. | 1,553 | AvaloniaUI/Avalonia | 24,333 | C# | Gillibald | grokys |
using Avalonia.Interactivity;
using Avalonia.VisualTree;
using System.Linq;
using Avalonia.Input.Raw;
namespace Avalonia.Input
{
public class DragDropDevice : IDragDropDevice
{
public static readonly DragDropDevice Instance = new DragDropDevice();
private Interactive _lastTarget = nul... | If `target` is never null, then it should probably be checked as an invariant on entering this method, e.g.
```
Contract.Requires<ArgumentNullException>(target != null);
```
Doing the check here suggests it can sometimes be null. | using Avalonia.Interactivity;
using Avalonia.VisualTree;
using System.Linq;
using Avalonia.Input.Raw;
namespace Avalonia.Input
{
public class DragDropDevice : IDragDropDevice
{
public static readonly DragDropDevice Instance = new DragDropDevice();
private Interactive _lastTarget = nul... | @@ -19,11 +19,11 @@ private Interactive GetTarget(IInputElement root, Point local)
return null;
}
- private DragDropEffects RaiseDragEvent(Interactive target, RoutedEvent<DragEventArgs> routedEvent, DragDropEffects operation, IDataObject data)
+ private DragDropEffects Rais... | src/Avalonia.Input/DragDropDevice.cs | 26 | C# | 1 | suggestion | 237 | 51 | 51 | false | Add GetPosition method to DragEventArgs | 1,556 | AvaloniaUI/Avalonia | 24,333 | C# | grokys | wieslawsoltes |
/// <param name="inner">
/// An optional inner converter to be called before the format takes place.
/// </param>
public StringFormatValueConverter(string format, IValueConverter inner)
{
Contract.Requires<ArgumentNullException>(format != null);
Format = ... | May be `return string.Format(culture, Format, value);`? | /// <param name="inner">
/// An optional inner converter to be called before the format takes place.
/// </param>
public StringFormatValueConverter(string format, IValueConverter inner)
{
Contract.Requires<ArgumentNullException>(format != null);
Format = ... | @@ -0,0 +1,49 @@
+using System;
+using System.Globalization;
+
+namespace Avalonia.Data.Converters
+{
+ /// <summary>
+ /// A value converter which calls <see cref="string.Format(string, object)"/>
+ /// </summary>
+ public class StringFormatValueConverter : IValueConverter
+ {
+ /// <summary>
+ ... | src/Avalonia.Base/Data/Converters/StringFormatValueConverter.cs | 26 | C# | 0.357 | question | 55 | 36 | 36 | false | Add StringFormat to Binding. | 1,684 | AvaloniaUI/Avalonia | 24,333 | C# | Karnah | grokys |
{
foreach (var sub in _subscription)
{
sub.Dispose();
}
}
/// <inheritdocs/>
public IDisposable Apply(Animatable control, IObservable<bool> matchObs)
{
foreach (IAnimator animator in InterpretKeyframes(control))
... | We should check that the sender parameter is equal to control so we can run the same animation on multiple controls programmatically. | if (onComplete != null)
{
var tcs = new TaskCompletionSource<object>();
animatorOnComplete = () => tcs.SetResult(null);
completionTasks.Add(tcs.Task);
}
subscriptions.A... | @@ -153,5 +160,28 @@ public IDisposable Apply(Animatable control, IObservable<bool> matchObs)
}
return this;
}
+
+ /// <inheritdocs/>
+ public Task Run(Animatable control)
+ {
+ var tcs = new TaskCompletionSource<object>();
+
+ if (this.Repea... | src/Avalonia.Animation/Animation.cs | 26 | C# | 0.429 | suggestion | 133 | 41 | 37 | false | Code-behind Animation Trigger | 1,774 | AvaloniaUI/Avalonia | 24,333 | C# | jkoritzinsky | jmacato |
}
/// <inheritdocs/>
public IDisposable Apply(Animatable control, IObservable<bool> matchObs)
{
foreach (IAnimator animator in InterpretKeyframes(control))
{
_subscription.Add(animator.Apply(this, control, matchObs));
}
ret... | Why are we canceling the task here? This wouldn't allow users to run the same animation on two different controls at the same time. | }
subscriptions.Add(animator.Apply(this, control, match, animatorOnComplete));
}
if (onComplete != null)
{
Task.WhenAll(completionTasks).ContinueWith(_ => onComplete());
}
}
... | @@ -153,5 +160,31 @@ public IDisposable Apply(Animatable control, IObservable<bool> matchObs)
}
return this;
}
+
+ /// <inheritdocs/>
+ public Task RunAsync(Animatable control)
+ {
+ var run = new TaskCompletionSource<object>();
+
+ if (this.... | src/Avalonia.Animation/Animation.cs | 26 | C# | 0.429 | question | 131 | 39 | 32 | false | Code-behind Animation Trigger | 1,774 | AvaloniaUI/Avalonia | 24,333 | C# | jkoritzinsky | jmacato |
{
_currentState = KeyFramesStates.DoRun;
}
_currentIteration++;
}
if (_animationDirection == PlaybackDirection.Alternate
... | I've been doing some tests by re-implementing the page transitions, and I found a bug here. If the user animates a render transformation, then the value of `_targetControl` is the Transform object, not the control that is being transformed. This causes the animation to never be registered as completed. | }
else
{
_currentState = KeyFramesStates.DoRun;
}
_currentIteration++;
}
... | @@ -243,7 +243,10 @@ private void InternalStep(PlayState _playState, Func<double, T, T> Interpolator)
{
_targetControl.SetValue(_parent.Property, _lastInterpValue, BindingPriority.LocalValue);
}
+
_targetObserver.OnC... | src/Avalonia.Animation/AnimatorStateMachine`1.cs | 26 | C# | 0.786 | bug | 303 | 50 | 51 | false | Code-behind Animation Trigger | 1,774 | AvaloniaUI/Avalonia | 24,333 | C# | jkoritzinsky | jmacato |
/// The selector always matches this type.
/// </summary>
AlwaysThisType,
/// <summary>
/// The selector always matches this instance, but doesn't always match this type.
/// </summary>
AlwaysThisInstance,
/// <summary>
/// The selector matches t... | nit: Extra '/' at the end of the line (throughout the doc comments in this file). | /// The selector always matches this type.
/// </summary>
AlwaysThisType,
/// <summary>
/// The selector always matches this instance, but doesn't always match this type.
/// </summary>
AlwaysThisInstance,
/// <summary>
/// The selector matches t... | @@ -5,51 +5,95 @@
namespace Avalonia.Styling
{
+ /// <summary>
+ /// Describes how a <see cref="SelectorMatch"/> matches a control and its type.
+ /// </summary>
+ public enum SelectorMatchResult
+ {
+ /// <summary>
+ /// The selector never matches this type.
+ /// </summary>
+ ... | src/Avalonia.Styling/Styling/SelectorMatch.cs | 26 | C# | 0.214 | nitpick | 81 | 51 | 51 | false | [Perf] Cache the possible styles for control types. | 2,088 | AvaloniaUI/Avalonia | 24,333 | C# | jkoritzinsky | grokys |
// Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using Avalonia.Data;
namespace Avalonia
{
/... | Any reason we don't just do either just a dictionary or a list instead of converting from a dictionary to a list here? |
property.NotifyInitialized(e);
}
if (!_initializedCache.TryGetValue(type, out var items))
{
var build = new Dictionary<AvaloniaProperty, object>();
foreach (var property in GetRegistered(type))
{
v... | @@ -239,6 +243,57 @@ public void RegisterAttached(Type type, AvaloniaProperty property)
}
_attachedCache.Clear();
+ _initializedCache.Clear();
+ }
+
+ internal void NotifyInitialized(AvaloniaObject o)
+ {
+ Contract.Requires<ArgumentNullException>(o... | src/Avalonia.Base/AvaloniaPropertyRegistry.cs | 26 | C# | 0.429 | question | 118 | 300 | 38 | false | [Perf] Cache AvaloniaObject initialization notifications. | 2,127 | AvaloniaUI/Avalonia | 24,333 | C# | jkoritzinsky | grokys |
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
using Nuke.Common;
using Nuke.Common.Git;
using Nuke.Common.ProjectModel;
using Nuke.Common.Tooling;
using Nuke.Common.Tools.DotNet;
using Nuke.Comm... | Why is it removed? I've written this comment for a reason | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
using Nuke.Common;
using Nuke.Common.Git;
using Nuke.Common.ProjectModel;
using Nuke.Common.Tooling;
using Nuke.Common.Tools.DotNet;
using Nuke.Comm... | @@ -19,26 +19,19 @@
using static Nuke.Common.Tools.DotNet.DotNetTasks;
using static Nuke.Common.Tools.Xunit.XunitTasks;
-
-/* | nukebuild/Build.cs | 23 | C# | 0.286 | question | 57 | 48 | 48 | false | Parameter properties names must be same as command-line | 2,164 | AvaloniaUI/Avalonia | 24,333 | C# | kekekeks | wieslawsoltes |
EnsureCleanDirectory(Parameters.ZipRoot);
EnsureCleanDirectory(Parameters.TestResultsRoot);
});
Target Compile => _ => _
.DependsOn(Clean)
.Executes(() =>
{
if (Parameters.IsRunningOnWindows)
MSBuild(Parameters.MSBuildSolution, c => c
... | You've just made adding new lines here to cause possible merge-conflicts for no reason. People are even ignoring commas at the end of list to avoid them |
Target Clean => _ => _.Executes(() =>
{
DeleteDirectories(Parameters.BuildDirs);
EnsureCleanDirectories(Parameters.BuildDirs);
EnsureCleanDirectory(Parameters.ArtifactsDir);
EnsureCleanDirectory(Parameters.NugetIntermediateRoot);
EnsureCleanDirectory(Parameters.NugetRoot... | @@ -81,25 +73,23 @@ protected override void OnBuildInitialized()
.AddProperty("PackageVersion", Parameters.Version)
.AddProperty("iOSRoslynPathHackRequired", "true")
.SetToolsVersion(MSBuildToolsVersion._15_0)
- .AddTargets("Build") | nukebuild/Build.cs | 26 | C# | 0.429 | suggestion | 152 | 51 | 51 | false | Parameter properties names must be same as command-line | 2,164 | AvaloniaUI/Avalonia | 24,333 | C# | kekekeks | wieslawsoltes |
// Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System;
namespace Avalonia.Data.Core.Plugins
{
/// <summary>
/// Handles binding to <see cref="IObservable{T}"/>s for the '^' stream bindi... | `Target` can return null. I'd use `WeakReference<object>` which prevents the race condition by introducing a Try method. | // Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System;
using System.Linq;
using System.Reactive.Linq;
using System.Reflection;
namespace Avalonia.Data.Core.Plugins
{
/// <summary>
/// H... | @@ -10,12 +13,19 @@ namespace Avalonia.Data.Core.Plugins
/// </summary>
public class ObservableStreamPlugin : IStreamPlugin
{
+ static MethodInfo observableSelect;
+
/// <summary>
/// Checks whether this plugin handles the specified value.
/// </summary>
/// <pa... | src/Avalonia.Base/Data/Core/Plugins/ObservableStreamPlugin.cs | 25 | C# | 0.714 | bug | 120 | 33 | 50 | false | Fix stream bindings with observable value types | 2,257 | AvaloniaUI/Avalonia | 24,333 | C# | aelij | grokys |
// Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System;
namespace Avalonia.Data.Core.Plugins
{
/// <summary>
/// Handles binding to <see cref="IObservable{T}"/>s for the '^' stream bindi... | `GetInterfaces` won't return interfaces implemented by base types. Better use `FindInterfaces`. | // Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System;
using System.Linq;
using System.Reactive.Linq;
using System.Reflection;
namespace Avalonia.Data.Core.Plugins
{
/// <summary>
/// H... | @@ -10,12 +13,19 @@ namespace Avalonia.Data.Core.Plugins
/// </summary>
public class ObservableStreamPlugin : IStreamPlugin
{
+ static MethodInfo observableSelect;
+
/// <summary>
/// Checks whether this plugin handles the specified value.
/// </summary>
/// <pa... | src/Avalonia.Base/Data/Core/Plugins/ObservableStreamPlugin.cs | 25 | C# | 0.571 | suggestion | 95 | 33 | 50 | false | Fix stream bindings with observable value types | 2,257 | AvaloniaUI/Avalonia | 24,333 | C# | aelij | grokys |
// Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System;
namespace Avalonia.Data.Core.Plugins
{
/// <summary>
/// Handles binding to <see cref="IObservable{T}"/>s for the '^' stream bindi... | Another option here is to invoke the `Observable.Cast` method. |
/// <summary>
/// Starts producing output based on the specified value.
/// </summary>
/// <param name="reference">A weak reference to the object.</param>
/// <returns>
/// An observable that produces the output for the value.
/// </returns>
public virtua... | @@ -26,7 +36,69 @@ public class ObservableStreamPlugin : IStreamPlugin
/// </returns>
public virtual IObservable<object> Start(WeakReference reference)
{
- return reference.Target as IObservable<object>;
+ var target = reference.Target;
+
+ // If the observabl... | src/Avalonia.Base/Data/Core/Plugins/ObservableStreamPlugin.cs | 26 | C# | 0.5 | suggestion | 62 | 33 | 51 | false | Fix stream bindings with observable value types | 2,257 | AvaloniaUI/Avalonia | 24,333 | C# | aelij | grokys |
/// <summary>
/// Gets the bounds rectangle that the specified character occupies.
/// </summary>
/// <param name="index">The index of the character.</param>
/// <returns>The character bounds.</returns>
public Rect HitTestTextPosition(int index)
{
retu... | We will never calculate anything here. Text layouts are immutable. The moment we construct one measures are fixed. I suggest changing this to a property `public Rect Bounds { get; }` or just use `PlatformImpl.Bounds` | /// </returns>
public TextHitTestResult HitTestPoint(Point point)
{
return PlatformImpl.HitTestPoint(point);
}
/// <summary>
/// Gets the bounds rectangle that the specified character occupies.
/// </summary>
/// <param name="index">The index ... | @@ -159,13 +159,10 @@ public IEnumerable<Rect> HitTestTextRange(int index, int length)
}
/// <summary>
- /// Gets the size of the text, taking <see cref="Constraint"/> into account.
+ /// Gets the bounds of the text, taking <see cref="Constraint"/> into account.
/// </summary>... | src/Avalonia.Visuals/Media/FormattedText.cs | 26 | C# | 0.643 | suggestion | 216 | 35 | 35 | false | Fix text rendering where TextAlignment != Left. | 2,344 | AvaloniaUI/Avalonia | 24,333 | C# | Gillibald | grokys |
/// <summary>
/// Base class for all animatable objects.
/// </summary>
public class Animatable : AvaloniaObject
{
public static readonly StyledProperty<IClock> ClockProperty =
AvaloniaProperty.Register<Animatable, IClock>(nameof(Clock), inherits: true);
public IClock Cl... | Perhaps don't allocate this collection until it's needed? Many controls won't have transitions and it'll save quite a bit of memory. | /// <summary>
/// Base class for all animatable objects.
/// </summary>
public class Animatable : AvaloniaObject
{
public static readonly StyledProperty<IClock> ClockProperty =
AvaloniaProperty.Register<Animatable, IClock>(nameof(Clock), inherits: true);
public IClock Cl... | @@ -36,6 +36,9 @@ public IClock Clock
private Transitions _transitions;
+ private Dictionary<AvaloniaProperty, IDisposable> _previousTransitions | src/Avalonia.Animation/Animatable.cs | 26 | C# | 0.5 | suggestion | 132 | 51 | 51 | false | Fixes for Transitions + Sidebar hover effect speedup. | 2,517 | AvaloniaUI/Avalonia | 24,333 | C# | grokys | jmacato |
private static void ValidateDouble(double value, string property)
{
if (double.IsInfinity(value) || double.IsNaN(value))
{
throw new ArgumentException($"{value} is not a valid value for {property}.");
}
}
/// <summary>
/// Vali... | I think we need to apply `Minimum` here as well. | SetAndRaise(ValueProperty, ref _value, value);
}
else
{
SetAndRaise(ValueProperty, ref _value, value);
}
}
}
public double SmallChange
{
get => GetValue(SmallChangePro... | @@ -129,6 +155,14 @@ public double LargeChange
set => SetValue(LargeChangeProperty, value);
}
+ protected override void OnInitialized()
+ {
+ base.OnInitialized();
+
+ Maximum = ValidateMaximum(Maximum); | src/Avalonia.Controls/Primitives/RangeBase.cs | 26 | C# | 0.214 | suggestion | 48 | 43 | 51 | false | Don't coerce RangeBase values until initialized. | 2,683 | AvaloniaUI/Avalonia | 24,333 | C# | MarchingCube | grokys |
[Fact]
public void Right_Click_On_UnselectedItem_Should_Clear_Existing_Selection()
{
var target = new ListBox
{
Template = Template(),
Items = new[] { "Foo", "Bar", "Baz" },
ItemTemplate = new FuncDataTemplate<string>(x => ... | Typo in "mutiple" -> "multiple". Probably should run search and replace on all instances as there are a few :) | var target = new ListBox
{
Template = Template(),
Items = new[] { "Foo", "Bar", "Baz" },
ItemTemplate = new FuncDataTemplate<string>((x, _) => new TextBlock { Width = 20, Height = 10 }),
SelectionMode = SelectionMode.Multiple,
... | @@ -1026,6 +1026,46 @@ public void Right_Click_On_UnselectedItem_Should_Clear_Existing_Selection()
Assert.Equal(1, target.SelectedItems.Count);
}
+ [Fact]
+ public void Shift_Right_Click_Should_Not_Select_Mutiple() | tests/Avalonia.Controls.UnitTests/Primitives/SelectingItemsControlTests_Multiple.cs | 26 | C# | 0.429 | nitpick | 110 | 51 | 51 | false | Some more selection improvements to `TreeView` and `SelectingItemsControl` | 2,702 | AvaloniaUI/Avalonia | 24,333 | C# | MarchingCube | grokys |
/// <summary>
/// Replaces an item in the <see cref="DrawOperations"/> collection.
/// </summary>
/// <param name="index">The operation to be replaced.</param>
/// <param name="operation">The operation to add.</param>
public void ReplaceDrawOperation(int index, IRef<IDraw... | I know it is not really part of this pr but you know the final length of keys so it might save cpu to set in the constructor | /// <summary>
/// Replaces an item in the <see cref="DrawOperations"/> collection.
/// </summary>
/// <param name="index">The operation to be replaced.</param>
/// <param name="operation">The operation to add.</param>
public void ReplaceDrawOperation(int index, IRef<IDraw... | @@ -179,6 +179,11 @@ public void ReplaceDrawOperation(int index, IRef<IDrawOperation> operation)
/// <param name="scene">The scene that the node is a part of.</param>
public void SortChildren(Scene scene)
{
+ if (_children == null || _children.Count <= 1)
+ {
+ ... | src/Avalonia.Visuals/Rendering/SceneGraph/VisualNode.cs | 26 | C# | 0.357 | suggestion | 124 | 51 | 51 | false | Fix NRE in VisualNode.SortChildren. | 2,793 | AvaloniaUI/Avalonia | 24,333 | C# | ahopper | grokys |
namespace Avalonia.Input
{
/*
=========================================================================================
NOTE: Cursors are NOT disposable and are cached in platform implementation.
To support loading custom cursors some measures about that should be taken beforehand
=========... | Add
```cs
[Obsolete("Use BottomSide")]
ButtomSize = BottomSide,
``` |
namespace Avalonia.Input
{
/*
=========================================================================================
NOTE: Cursors are NOT disposable and are cached in platform implementation.
To support loading custom cursors some measures about that should be taken beforehand
=========... | @@ -28,7 +28,7 @@ public enum StandardCursorType
AppStarting,
Help,
TopSide,
- BottomSize,
+ BottomSide, | src/Avalonia.Input/Cursors.cs | 26 | C# | 0.643 | suggestion | 73 | 51 | 51 | false | Fix typo in StandardCursorType. | 2,797 | AvaloniaUI/Avalonia | 24,333 | C# | kekekeks | grokys |
get { return GetValue(RowDetailsTemplateProperty); }
set { SetValue(RowDetailsTemplateProperty, value); }
}
public static readonly StyledProperty<DataGridRowDetailsVisibilityMode> RowDetailsVisibilityModeProperty =
AvaloniaProperty.Register<DataGrid, DataGridRowDetai... | Format issus
```suggestion
ItemsProperty.Changed.AddClassHandler<DataGrid>((x, e) => x.OnItemsPropertyChanged(e));
``` | get { return GetValue(RowDetailsTemplateProperty); }
set { SetValue(RowDetailsTemplateProperty, value); }
}
public static readonly StyledProperty<DataGridRowDetailsVisibilityMode> RowDetailsVisibilityModeProperty =
AvaloniaProperty.Register<DataGrid, DataGridRowDetai... | @@ -723,29 +723,29 @@ static DataGrid()
PseudoClass<DataGrid, bool>(IsValidProperty, x => !x, ":invalid");
- ItemsProperty.Changed.AddClassHandler<DataGrid>(x => x.OnItemsPropertyChanged);
- CanUserResizeColumnsProperty.Changed.AddClassHandler<DataGrid>(x => x.OnCanUserResizeColum... | src/Avalonia.Controls.DataGrid/DataGrid.cs | 26 | C# | 0.929 | suggestion | 135 | 51 | 51 | false | Remove usage of AddClassHandler that returns new lambda per invocation. | 3,088 | AvaloniaUI/Avalonia | 24,333 | C# | lindexi | MarchingCube |
/// Displays items inside an <see cref="ItemsControl"/>.
/// </summary>
public class ItemsPresenter : ItemsPresenterBase, ILogicalScrollable
{
/// <summary>
/// Defines the <see cref="VirtualizationMode"/> property.
/// </summary>
public static readonly StyledProperty<Ite... | Format issue
```suggestion
.AddClassHandler<ItemsPresenter>((x, e) => x.VirtualizationModeChanged(e));
``` | /// Displays items inside an <see cref="ItemsControl"/>.
/// </summary>
public class ItemsPresenter : ItemsPresenterBase, ILogicalScrollable
{
/// <summary>
/// Defines the <see cref="VirtualizationMode"/> property.
/// </summary>
public static readonly StyledProperty<Ite... | @@ -35,7 +35,7 @@ static ItemsPresenter()
KeyboardNavigationMode.Once);
VirtualizationModeProperty.Changed
- .AddClassHandler<ItemsPresenter>(x => x.VirtualizationModeChanged);
+ .AddClassHandler<ItemsPresenter>((x,e) => x.VirtualizationModeChanged(e)); | src/Avalonia.Controls/Presenters/ItemsPresenter.cs | 26 | C# | 0.929 | suggestion | 127 | 51 | 51 | false | Remove usage of AddClassHandler that returns new lambda per invocation. | 3,088 | AvaloniaUI/Avalonia | 24,333 | C# | lindexi | MarchingCube |
o => o.Offset,
(o, v) => o.Offset = v);
/// <summary>
/// Defines the <see cref="Viewport"/> property.
/// </summary>
public static readonly DirectProperty<ScrollContentPresenter, Size> ViewportProperty =
ScrollViewer.ViewportProperty.AddOwner... | Format issue
```suggestion
ChildProperty.Changed.AddClassHandler<ScrollContentPresenter>((x, e) => x.ChildChanged(e));
``` | o => o.Offset,
(o, v) => o.Offset = v);
/// <summary>
/// Defines the <see cref="Viewport"/> property.
/// </summary>
public static readonly DirectProperty<ScrollContentPresenter, Size> ViewportProperty =
ScrollViewer.ViewportProperty.AddOwner... | @@ -73,7 +73,7 @@ public class ScrollContentPresenter : ContentPresenter, IPresenter, IScrollable
static ScrollContentPresenter()
{
ClipToBoundsProperty.OverrideDefaultValue(typeof(ScrollContentPresenter), true);
- ChildProperty.Changed.AddClassHandler<ScrollContentPresenter>(x... | src/Avalonia.Controls/Presenters/ScrollContentPresenter.cs | 26 | C# | 0.929 | suggestion | 139 | 51 | 51 | false | Remove usage of AddClassHandler that returns new lambda per invocation. | 3,088 | AvaloniaUI/Avalonia | 24,333 | C# | lindexi | MarchingCube |
{
ItemCount = 0;
}
else if (Items is IList list)
{
ItemCount = list.Count;
}
else
{
ItemCount = Items.Count();
}
}
protected static IInputElement GetNextContro... | This is C# 8 feature, I thought we are not using it until next version. | {
ItemCount = 0;
}
else if (Items is IList list)
{
ItemCount = list.Count;
}
else
{
ItemCount = Items.Count();
}
}
protected static IInputElement GetNextContro... | @@ -489,18 +489,20 @@ private void UpdateItemCount()
bool wrap)
{
IInputElement result;
+ var c = from;
do
{
- result = container.GetControl(direction, from, wrap);
+ result = container.GetControl(direction, c, wrap)... | src/Avalonia.Controls/ItemsControl.cs | 26 | C# | 0.214 | suggestion | 71 | 40 | 40 | false | Fix hang in ItemsControl.MoveSelection | 3,096 | AvaloniaUI/Avalonia | 24,333 | C# | MarchingCube | grokys |
[Obsolete("Use DoubleTapped or DoubleRightTapped event instead")]
public int ClickCount => _obsoleteClickCount;
[Obsolete("Use PointerUpdateKind")]
public MouseButton MouseButton => Properties.PointerUpdateKind.GetMouseButton();
}
public class PointerReleasedEventArgs : Pointer... | `, see` at the end should be removed I think? | [Obsolete("Use DoubleTapped or DoubleRightTapped event instead")]
public int ClickCount => _obsoleteClickCount;
[Obsolete("Use PointerUpdateKind")]
public MouseButton MouseButton => Properties.PointerUpdateKind.GetMouseButton();
}
public class PointerReleasedEventArgs : Pointer... | @@ -124,23 +135,29 @@ public class PointerPressedEventArgs : PointerEventArgs
public int ClickCount => _obsoleteClickCount;
[Obsolete("Use PointerUpdateKind")]
- public MouseButton MouseButton => Properties.GetObsoleteMouseButton();
+ public MouseButton MouseButton => Properties.Pointe... | src/Avalonia.Input/PointerEventArgs.cs | 26 | C# | 0.286 | question | 45 | 41 | 41 | false | Added InitialPressMouseButton to PointerReleasedEventArgs | 3,101 | AvaloniaUI/Avalonia | 24,333 | C# | grokys | kekekeks |
public int ScreenCount
{
get => GetSystemMetrics(SystemMetric.SM_CMONITORS);
}
private Screen[] _allScreens;
public IReadOnlyList<Screen> AllScreens
{
get
{
if (_allScreens == null)
{
... | I think we can cache the result of this check in a static variable. Other than that looks good | {
public int ScreenCount
{
get => GetSystemMetrics(SystemMetric.SM_CMONITORS);
}
private Screen[] _allScreens;
public IReadOnlyList<Screen> AllScreens
{
get
{
if (_allScreens == null)
{
... | @@ -28,9 +29,28 @@ public IReadOnlyList<Screen> AllScreens
(IntPtr monitor, IntPtr hdcMonitor, ref Rect lprcMonitor, IntPtr data) =>
{
MONITORINFO monitorInfo = MONITORINFO.Create();
- if (GetMonitorInfo(monitor,re... | src/Windows/Avalonia.Win32/ScreenImpl.cs | 26 | C# | 0.214 | performance | 94 | 49 | 51 | false | Fallback to GDI when ShCore.dll isnt found (win7/8). | 3,124 | AvaloniaUI/Avalonia | 24,333 | C# | kekekeks | jmacato |
{
// Issue #2746
var grid = new Grid
{
RowDefinitions = RowDefinitions.Parse("Auto"),
Children =
{
new TestControl
{
MeasureSize = new Size(150, 150),
... | Nits: `Change_Column_Width_Should_Invalidate_Grid` -> `Changing_Column_Width_Should_Invalidate_Grid`
Other similar tests should have the same correction too | {
// Issue #2746
var grid = new Grid
{
RowDefinitions = RowDefinitions.Parse("Auto"),
Children =
{
new TestControl
{
MeasureSize = new Size(150, 150),
... | @@ -1382,6 +1376,245 @@ public void Correct_Grid_Bounds_When_Child_Control_Has_DesiredSize_Larger_Than_A
Assert.Equal(new Size(100, 100), grid.Bounds.Size);
}
+ [Theory]
+ [InlineData(true)]
+ [InlineData(false)]
+ public void Change_Column_Width_Should_Invalidate_Gri... | tests/Avalonia.Controls.UnitTests/GridTests.cs | 26 | C# | 0.571 | suggestion | 161 | 51 | 51 | false | fixed for few major issues with grid | 3,157 | AvaloniaUI/Avalonia | 24,333 | C# | jmacato | donandren |
}
[Fact]
public void Add_Column_Should_Invalidate_Grid()
{
var grid = new Grid { ColumnDefinitions = ColumnDefinitions.Parse("1*,1*") };
Change_Propery_And_Verify_Measure_Requested(grid, () =>
{
grid.ColumnDefinitions.Add(new ColumnDe... | Nit: `Replace_` -> `Replacing_` | }
[Fact]
public void Adding_Column_Should_Invalidate_Grid()
{
var grid = new Grid { ColumnDefinitions = ColumnDefinitions.Parse("1*,1*") };
Change_Property_And_Verify_Measure_Requested(grid, () =>
{
grid.ColumnDefinitions.Add(new Colu... | @@ -1382,6 +1376,245 @@ public void Correct_Grid_Bounds_When_Child_Control_Has_DesiredSize_Larger_Than_A
Assert.Equal(new Size(100, 100), grid.Bounds.Size);
}
+ [Theory]
+ [InlineData(true)]
+ [InlineData(false)]
+ public void Change_Column_Width_Should_Invalidate_Gri... | tests/Avalonia.Controls.UnitTests/GridTests.cs | 26 | C# | 0.286 | nitpick | 31 | 51 | 51 | false | fixed for few major issues with grid | 3,157 | AvaloniaUI/Avalonia | 24,333 | C# | jmacato | donandren |
});
}
[Fact]
public void Remove_Column_Should_Invalidate_Grid()
{
var grid = new Grid { ColumnDefinitions = ColumnDefinitions.Parse("1*,1*") };
Change_Propery_And_Verify_Measure_Requested(grid, () =>
{
grid.ColumnDefinitio... | Typo in `Propery` -> `Property`. | });
}
[Fact]
public void Removing_Column_Should_Invalidate_Grid()
{
var grid = new Grid { ColumnDefinitions = ColumnDefinitions.Parse("1*,1*") };
Change_Property_And_Verify_Measure_Requested(grid, () =>
{
grid.ColumnDefini... | @@ -1382,6 +1376,182 @@ public void Correct_Grid_Bounds_When_Child_Control_Has_DesiredSize_Larger_Than_A
Assert.Equal(new Size(100, 100), grid.Bounds.Size);
}
+ [Theory]
+ [InlineData(true)]
+ [InlineData(false)]
+ public void Change_Column_Width_Should_Invalidate_Gri... | tests/Avalonia.Controls.UnitTests/GridTests.cs | 26 | C# | 0.214 | nitpick | 32 | 48 | 51 | false | fixed for few major issues with grid | 3,157 | AvaloniaUI/Avalonia | 24,333 | C# | MarchingCube | donandren |
RowDefinitions = RowDefinitions.Parse("Auto"),
Children =
{
new TestControl
{
MeasureSize = new Size(150, 150),
}
}
};
var parent = new Decorator {... | ```suggestion
Change_Property_And_Verify_Measure_Requested(grid, () =>
``` | RowDefinitions = RowDefinitions.Parse("Auto"),
Children =
{
new TestControl
{
MeasureSize = new Size(150, 150),
}
}
};
var parent = new Decorator {... | @@ -1382,6 +1376,245 @@ public void Correct_Grid_Bounds_When_Child_Control_Has_DesiredSize_Larger_Than_A
Assert.Equal(new Size(100, 100), grid.Bounds.Size);
}
+ [Theory]
+ [InlineData(true)]
+ [InlineData(false)]
+ public void Changing_Column_Width_Should_Invalidate_G... | tests/Avalonia.Controls.UnitTests/GridTests.cs | 26 | C# | 0.643 | suggestion | 88 | 51 | 51 | false | fixed for few major issues with grid | 3,157 | AvaloniaUI/Avalonia | 24,333 | C# | jmacato | donandren |
}
[Theory]
[InlineData(true)]
[InlineData(false)]
public void Changing_Column_Width_Should_Invalidate_Grid(bool setUsingAvaloniaProperty)
{
var grid = new Grid { ColumnDefinitions = ColumnDefinitions.Parse("1*,1*") };
Change_Propery_And_Verify_Me... | ```suggestion
Change_Property_And_Verify_Measure_Requested(grid, () =>
``` | }
[Theory]
[InlineData(true)]
[InlineData(false)]
public void Changing_Column_Width_Should_Invalidate_Grid(bool setUsingAvaloniaProperty)
{
var grid = new Grid { ColumnDefinitions = ColumnDefinitions.Parse("1*,1*") };
Change_Property_And_Verify_M... | @@ -1382,6 +1376,245 @@ public void Correct_Grid_Bounds_When_Child_Control_Has_DesiredSize_Larger_Than_A
Assert.Equal(new Size(100, 100), grid.Bounds.Size);
}
+ [Theory]
+ [InlineData(true)]
+ [InlineData(false)]
+ public void Changing_Column_Width_Should_Invalidate_G... | tests/Avalonia.Controls.UnitTests/GridTests.cs | 26 | C# | 0.643 | suggestion | 88 | 51 | 51 | false | fixed for few major issues with grid | 3,157 | AvaloniaUI/Avalonia | 24,333 | C# | jmacato | donandren |
}
[Theory]
[InlineData(true)]
[InlineData(false)]
public void Changing_Column_MinWidth_Should_Invalidate_Grid(bool setUsingAvaloniaProperty)
{
var grid = new Grid { ColumnDefinitions = ColumnDefinitions.Parse("1*,1*") };
Change_Propery_And_Verify... | ```suggestion
Change_Property_And_Verify_Measure_Requested(grid, () =>
``` | }
[Theory]
[InlineData(true)]
[InlineData(false)]
public void Changing_Column_MinWidth_Should_Invalidate_Grid(bool setUsingAvaloniaProperty)
{
var grid = new Grid { ColumnDefinitions = ColumnDefinitions.Parse("1*,1*") };
Change_Property_And_Verif... | @@ -1382,6 +1376,245 @@ public void Correct_Grid_Bounds_When_Child_Control_Has_DesiredSize_Larger_Than_A
Assert.Equal(new Size(100, 100), grid.Bounds.Size);
}
+ [Theory]
+ [InlineData(true)]
+ [InlineData(false)]
+ public void Changing_Column_Width_Should_Invalidate_G... | tests/Avalonia.Controls.UnitTests/GridTests.cs | 26 | C# | 0.643 | suggestion | 88 | 51 | 51 | false | fixed for few major issues with grid | 3,157 | AvaloniaUI/Avalonia | 24,333 | C# | jmacato | donandren |
}
[Theory]
[InlineData(true)]
[InlineData(false)]
public void Changing_Column_MaxWidth_Should_Invalidate_Grid(bool setUsingAvaloniaProperty)
{
var grid = new Grid { ColumnDefinitions = ColumnDefinitions.Parse("1*,1*") };
Change_Propery_And_Verify... | ```suggestion
Change_Property_And_Verify_Measure_Requested(grid, () =>
``` | }
[Theory]
[InlineData(true)]
[InlineData(false)]
public void Changing_Column_MaxWidth_Should_Invalidate_Grid(bool setUsingAvaloniaProperty)
{
var grid = new Grid { ColumnDefinitions = ColumnDefinitions.Parse("1*,1*") };
Change_Property_And_Verif... | @@ -1382,6 +1376,245 @@ public void Correct_Grid_Bounds_When_Child_Control_Has_DesiredSize_Larger_Than_A
Assert.Equal(new Size(100, 100), grid.Bounds.Size);
}
+ [Theory]
+ [InlineData(true)]
+ [InlineData(false)]
+ public void Changing_Column_Width_Should_Invalidate_G... | tests/Avalonia.Controls.UnitTests/GridTests.cs | 26 | C# | 0.643 | suggestion | 88 | 51 | 51 | false | fixed for few major issues with grid | 3,157 | AvaloniaUI/Avalonia | 24,333 | C# | jmacato | donandren |
}
[Theory]
[InlineData(true)]
[InlineData(false)]
public void Changing_Row_Height_Should_Invalidate_Grid(bool setUsingAvaloniaProperty)
{
var grid = new Grid { RowDefinitions = RowDefinitions.Parse("1*,1*") };
Change_Propery_And_Verify_Measure_Re... | ```suggestion
Change_Property_And_Verify_Measure_Requested(grid, () =>
``` | }
[Theory]
[InlineData(true)]
[InlineData(false)]
public void Changing_Row_Height_Should_Invalidate_Grid(bool setUsingAvaloniaProperty)
{
var grid = new Grid { RowDefinitions = RowDefinitions.Parse("1*,1*") };
Change_Property_And_Verify_Measure_R... | @@ -1382,6 +1376,245 @@ public void Correct_Grid_Bounds_When_Child_Control_Has_DesiredSize_Larger_Than_A
Assert.Equal(new Size(100, 100), grid.Bounds.Size);
}
+ [Theory]
+ [InlineData(true)]
+ [InlineData(false)]
+ public void Changing_Column_Width_Should_Invalidate_G... | tests/Avalonia.Controls.UnitTests/GridTests.cs | 26 | C# | 0.643 | suggestion | 88 | 51 | 51 | false | fixed for few major issues with grid | 3,157 | AvaloniaUI/Avalonia | 24,333 | C# | jmacato | donandren |
}
[Theory]
[InlineData(true)]
[InlineData(false)]
public void Changing_Row_MinHeight_Should_Invalidate_Grid(bool setUsingAvaloniaProperty)
{
var grid = new Grid { RowDefinitions = RowDefinitions.Parse("1*,1*") };
Change_Propery_And_Verify_Measure... | ```suggestion
Change_Property_And_Verify_Measure_Requested(grid, () =>
``` | }
[Theory]
[InlineData(true)]
[InlineData(false)]
public void Changing_Row_MinHeight_Should_Invalidate_Grid(bool setUsingAvaloniaProperty)
{
var grid = new Grid { RowDefinitions = RowDefinitions.Parse("1*,1*") };
Change_Property_And_Verify_Measur... | @@ -1382,6 +1376,245 @@ public void Correct_Grid_Bounds_When_Child_Control_Has_DesiredSize_Larger_Than_A
Assert.Equal(new Size(100, 100), grid.Bounds.Size);
}
+ [Theory]
+ [InlineData(true)]
+ [InlineData(false)]
+ public void Changing_Column_Width_Should_Invalidate_G... | tests/Avalonia.Controls.UnitTests/GridTests.cs | 26 | C# | 0.643 | suggestion | 88 | 51 | 51 | false | fixed for few major issues with grid | 3,157 | AvaloniaUI/Avalonia | 24,333 | C# | jmacato | donandren |
grid.RowDefinitions[0].MinHeight = 5;
});
}
[Theory]
[InlineData(true)]
[InlineData(false)]
public void Changing_Row_MaxHeight_Should_Invalidate_Grid(bool setUsingAvaloniaProperty)
{
var grid = new Grid { RowDefinitions = RowDe... | ```suggestion
Change_Property_And_Verify_Measure_Requested(grid, () =>
``` | grid.RowDefinitions[0].MinHeight = 5;
});
}
[Theory]
[InlineData(true)]
[InlineData(false)]
public void Changing_Row_MaxHeight_Should_Invalidate_Grid(bool setUsingAvaloniaProperty)
{
var grid = new Grid { RowDefinitions = RowDe... | @@ -1382,6 +1376,245 @@ public void Correct_Grid_Bounds_When_Child_Control_Has_DesiredSize_Larger_Than_A
Assert.Equal(new Size(100, 100), grid.Bounds.Size);
}
+ [Theory]
+ [InlineData(true)]
+ [InlineData(false)]
+ public void Changing_Column_Width_Should_Invalidate_G... | tests/Avalonia.Controls.UnitTests/GridTests.cs | 26 | C# | 0.643 | suggestion | 88 | 51 | 51 | false | fixed for few major issues with grid | 3,157 | AvaloniaUI/Avalonia | 24,333 | C# | jmacato | donandren |
Change_Propery_And_Verify_Measure_Requested(grid, () =>
{
if (setUsingAvaloniaProperty)
grid.RowDefinitions[0][RowDefinition.MaxHeightProperty] = 5;
else
grid.RowDefinitions[0].MaxHeight = 5;
});
}
... | ```suggestion
Change_Property_And_Verify_Measure_Requested(grid, () =>
``` | Change_Property_And_Verify_Measure_Requested(grid, () =>
{
if (setUsingAvaloniaProperty)
grid.RowDefinitions[0][RowDefinition.MaxHeightProperty] = 5;
else
grid.RowDefinitions[0].MaxHeight = 5;
});
}
... | @@ -1382,6 +1376,245 @@ public void Correct_Grid_Bounds_When_Child_Control_Has_DesiredSize_Larger_Than_A
Assert.Equal(new Size(100, 100), grid.Bounds.Size);
}
+ [Theory]
+ [InlineData(true)]
+ [InlineData(false)]
+ public void Changing_Column_Width_Should_Invalidate_G... | tests/Avalonia.Controls.UnitTests/GridTests.cs | 26 | C# | 0.643 | suggestion | 88 | 51 | 51 | false | fixed for few major issues with grid | 3,157 | AvaloniaUI/Avalonia | 24,333 | C# | jmacato | donandren |
{
var grid = new Grid { ColumnDefinitions = ColumnDefinitions.Parse("1*,1*") };
Change_Propery_And_Verify_Measure_Requested(grid, () =>
{
grid.ColumnDefinitions.Add(new ColumnDefinition(new GridLength(5)));
});
}
[Fact]
pu... | ```suggestion
Change_Property_And_Verify_Measure_Requested(grid, () =>
``` | {
var grid = new Grid { ColumnDefinitions = ColumnDefinitions.Parse("1*,1*") };
Change_Property_And_Verify_Measure_Requested(grid, () =>
{
grid.ColumnDefinitions.Add(new ColumnDefinition(new GridLength(5)));
});
}
[Fact]
p... | @@ -1382,6 +1376,245 @@ public void Correct_Grid_Bounds_When_Child_Control_Has_DesiredSize_Larger_Than_A
Assert.Equal(new Size(100, 100), grid.Bounds.Size);
}
+ [Theory]
+ [InlineData(true)]
+ [InlineData(false)]
+ public void Changing_Column_Width_Should_Invalidate_G... | tests/Avalonia.Controls.UnitTests/GridTests.cs | 26 | C# | 0.643 | suggestion | 88 | 51 | 51 | false | fixed for few major issues with grid | 3,157 | AvaloniaUI/Avalonia | 24,333 | C# | jmacato | donandren |
{
var grid = new Grid { RowDefinitions = RowDefinitions.Parse("1*,1*") };
Change_Propery_And_Verify_Measure_Requested(grid, () =>
{
grid.RowDefinitions.Add(new RowDefinition(new GridLength(5)));
});
}
[Fact]
public void Re... | ```suggestion
Change_Property_And_Verify_Measure_Requested(grid, () =>
``` | {
var grid = new Grid { RowDefinitions = RowDefinitions.Parse("1*,1*") };
Change_Property_And_Verify_Measure_Requested(grid, () =>
{
grid.RowDefinitions.Add(new RowDefinition(new GridLength(5)));
});
}
[Fact]
public void R... | @@ -1382,6 +1376,245 @@ public void Correct_Grid_Bounds_When_Child_Control_Has_DesiredSize_Larger_Than_A
Assert.Equal(new Size(100, 100), grid.Bounds.Size);
}
+ [Theory]
+ [InlineData(true)]
+ [InlineData(false)]
+ public void Changing_Column_Width_Should_Invalidate_G... | tests/Avalonia.Controls.UnitTests/GridTests.cs | 26 | C# | 0.643 | suggestion | 88 | 51 | 51 | false | fixed for few major issues with grid | 3,157 | AvaloniaUI/Avalonia | 24,333 | C# | jmacato | donandren |
{
var grid = new Grid { ColumnDefinitions = ColumnDefinitions.Parse("1*,1*") };
Change_Propery_And_Verify_Measure_Requested(grid, () =>
{
grid.ColumnDefinitions = ColumnDefinitions.Parse("2*,1*");
});
}
[Fact]
public void ... | ```suggestion
Change_Property_And_Verify_Measure_Requested(grid, () =>
``` | {
var grid = new Grid { ColumnDefinitions = ColumnDefinitions.Parse("1*,1*") };
Change_Property_And_Verify_Measure_Requested(grid, () =>
{
grid.ColumnDefinitions = ColumnDefinitions.Parse("2*,1*");
});
}
[Fact]
public void... | @@ -1382,6 +1376,245 @@ public void Correct_Grid_Bounds_When_Child_Control_Has_DesiredSize_Larger_Than_A
Assert.Equal(new Size(100, 100), grid.Bounds.Size);
}
+ [Theory]
+ [InlineData(true)]
+ [InlineData(false)]
+ public void Changing_Column_Width_Should_Invalidate_G... | tests/Avalonia.Controls.UnitTests/GridTests.cs | 26 | C# | 0.643 | suggestion | 88 | 51 | 51 | false | fixed for few major issues with grid | 3,157 | AvaloniaUI/Avalonia | 24,333 | C# | jmacato | donandren |
{
var grid = new Grid { RowDefinitions = RowDefinitions.Parse("1*,1*") };
Change_Propery_And_Verify_Measure_Requested(grid, () =>
{
grid.RowDefinitions = RowDefinitions.Parse("2*,1*");
});
}
[Fact]
public void Removing_Col... | ```suggestion
Change_Property_And_Verify_Measure_Requested(grid, () =>
``` | {
var grid = new Grid { RowDefinitions = RowDefinitions.Parse("1*,1*") };
Change_Property_And_Verify_Measure_Requested(grid, () =>
{
grid.RowDefinitions = RowDefinitions.Parse("2*,1*");
});
}
[Fact]
public void Removing_Co... | @@ -1382,6 +1376,245 @@ public void Correct_Grid_Bounds_When_Child_Control_Has_DesiredSize_Larger_Than_A
Assert.Equal(new Size(100, 100), grid.Bounds.Size);
}
+ [Theory]
+ [InlineData(true)]
+ [InlineData(false)]
+ public void Changing_Column_Width_Should_Invalidate_G... | tests/Avalonia.Controls.UnitTests/GridTests.cs | 26 | C# | 0.643 | suggestion | 88 | 51 | 51 | false | fixed for few major issues with grid | 3,157 | AvaloniaUI/Avalonia | 24,333 | C# | jmacato | donandren |
var size = new Size(100, 100);
grid.Measure(size);
grid.Arrange(new Rect(size));
Assert.True(grid.IsMeasureValid);
Assert.True(grid.IsArrangeValid);
Assert.Equal(100, grid.Children[0].Bounds.Width);
grid.Children.Add(new Decorator()... | ```suggestion
private static void Change_Property_And_Verify_Measure_Requested(Grid grid, Action change)
``` |
var size = new Size(100, 100);
grid.Measure(size);
grid.Arrange(new Rect(size));
Assert.True(grid.IsMeasureValid);
Assert.True(grid.IsArrangeValid);
Assert.Equal(100, grid.Children[0].Bounds.Width);
grid.Children.Add(new Decorator()... | @@ -1382,6 +1376,245 @@ public void Correct_Grid_Bounds_When_Child_Control_Has_DesiredSize_Larger_Than_A
Assert.Equal(new Size(100, 100), grid.Bounds.Size);
}
+ [Theory]
+ [InlineData(true)]
+ [InlineData(false)]
+ public void Changing_Column_Width_Should_Invalidate_G... | tests/Avalonia.Controls.UnitTests/GridTests.cs | 26 | C# | 0.786 | suggestion | 118 | 48 | 48 | false | fixed for few major issues with grid | 3,157 | AvaloniaUI/Avalonia | 24,333 | C# | jmacato | donandren |
public TAppBuilder AfterPlatformServicesSetup(Action<TAppBuilder> callback)
{
AfterPlatformServicesSetupCallback = (Action<TAppBuilder>)Delegate.Combine(AfterPlatformServicesSetupCallback, callback);
return Self;
}
/// <summary>
/// Starts the application... | btw here `Instance` is null and `ClassicDesktopStyleApplicationLifetime` in general is always having a null application.
it's good that `app.Run(...)` is extension method and everything is working fine, but there might be some general architecture design vulnerabilities | public TAppBuilder AfterPlatformServicesSetup(Action<TAppBuilder> callback)
{
AfterPlatformServicesSetupCallback = (Action<TAppBuilder>)Delegate.Combine(AfterPlatformServicesSetupCallback, callback);
return Self;
}
/// <summary>
/// Starts the application... | @@ -126,8 +126,7 @@ public void Start<TMainWindow>(Func<object> dataContextProvider = null)
// Copy-pasted because we can't call extension methods due to generic constraints
var lifetime = new ClassicDesktopStyleApplicationLifetime(Instance) {ShutdownMode = ShutdownMode.OnMainWin... | src/Avalonia.Controls/AppBuilderBase.cs | 26 | C# | 0.714 | security | 272 | 51 | 51 | false | Fix AppBuilderBase.Start<TMainWindow> | 3,159 | AvaloniaUI/Avalonia | 24,333 | C# | donandren | kekekeks |
}
[Fact]
public void Removing_Selected_Item_Should_Clear_Selection()
{
var items = new AvaloniaList<Item>
{
new Item(),
new Item(),
};
var target = new SelectingItemsControl
{
It... | This should read `receivedArgs = args`, right? |
var target = new SelectingItemsControl
{
Items = items,
Template = Template(),
};
target.ApplyTemplate();
target.SelectedIndex = 1;
Assert.Equal(items[1], target.SelectedItem);
Assert.Equal(1, target.S... | @@ -522,10 +522,19 @@ public void Removing_Selected_Item_Should_Clear_Selection()
Assert.Equal(items[1], target.SelectedItem);
Assert.Equal(1, target.SelectedIndex);
+ SelectionChangedEventArgs receivedArgs = null;
+
+ target.SelectionChanged += (_, args) => receivedArg... | tests/Avalonia.Controls.UnitTests/Primitives/SelectingItemsControlTests.cs | 26 | C# | 0.286 | question | 46 | 51 | 51 | false | Failing unit tests for SelectingItemsControl events | 3,435 | AvaloniaUI/Avalonia | 24,333 | C# | grokys | MarchingCube |
(int)(minSize.Height < 1 ? 1 : minSize.Height * Scaling));
const int maxDim = MaxWindowDimension;
var max = new PixelSize(
(int)(maxSize.Width > maxDim ? maxDim : Math.Max(min.Width, maxSize.Width * Scaling)),
(int)(maxSize.Height > maxDim ? maxDi... | For `null` icons we should use `XDeleteProperty` instead. | (int)(minSize.Height < 1 ? 1 : minSize.Height * Scaling));
const int maxDim = MaxWindowDimension;
var max = new PixelSize(
(int)(maxSize.Width > maxDim ? maxDim : Math.Max(min.Width, maxSize.Width * Scaling)),
(int)(maxSize.Height > maxDim ? maxDi... | @@ -995,11 +995,11 @@ public void ShowDialog(IWindowImpl parent)
public void SetIcon(IWindowIconImpl icon)
{
- var data = ((X11IconData)icon).Data;
+ var data = ((X11IconData)icon)?.Data; | src/Avalonia.X11/X11Window.cs | 26 | C# | 0.571 | suggestion | 57 | 43 | 50 | false | Allow assigning null to Window.Icon. | 3,558 | AvaloniaUI/Avalonia | 24,333 | C# | kekekeks | grokys |
/// itself and its children.
/// </remarks>
public Styles Styles
{
get { return _styles ?? (Styles = new Styles()); }
set
{
Contract.Requires<ArgumentNullException>(value != null);
if (_styles != value)
... | What do you think about caching args instance in a static and reusing that? Would save us several thousands allocations when starting the app and loading more complex controls. | /// itself and its children.
/// </remarks>
public Styles Styles
{
get
{
if (_styles == null)
{
_styles = new Styles(this);
_styles.ResourcesChanged += ThisResourcesChanged;
}
... | @@ -235,6 +236,7 @@ public Styles Styles
}
_styles.ResourcesChanged += ThisResourcesChanged;
+ NotifyResourcesChanged(new ResourcesChangedEventArgs()); | src/Avalonia.Styling/StyledElement.cs | 26 | C# | 0.357 | question | 176 | 51 | 51 | false | Fix DynamicResource in Style resources | 3,597 | AvaloniaUI/Avalonia | 24,333 | C# | MarchingCube | grokys |
public class Styles : AvaloniaObject, IAvaloniaList<IStyle>, IStyle, ISetResourceParent
{
private IResourceNode _parent;
private IResourceDictionary _resources;
private AvaloniaList<IStyle> _styles = new AvaloniaList<IStyle>();
private Dictionary<Type, List<IStyle>> _cache;
... | Not something that we want to fix within this PR but I wanted to ask if we have any other alternatives to using events for this? We create so many delegates for this that in calendar benchmark it was like the 6th top allocation.
;
private Dictionary<Type, List<IStyle>> _cache;
... | @@ -38,7 +39,7 @@ public Styles()
ResourcesChanged?.Invoke(this, new ResourcesChangedEventArgs());
}
- x.ResourcesChanged += SubResourceChanged;
+ x.ResourcesChanged += NotifyResourcesChanged; | src/Avalonia.Styling/Styling/Styles.cs | 26 | C# | 0.5 | suggestion | 454 | 51 | 51 | false | Fix DynamicResource in Style resources | 3,597 | AvaloniaUI/Avalonia | 24,333 | C# | MarchingCube | grokys |
Command.CanExecuteChanged += CanExecuteChanged;
}
}
protected override void OnDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs e)
{
base.OnDetachedFromLogicalTree(e);
if (Command != null)
{
Command.CanExecute... | We could add inheritance policy option in property registration | Command.CanExecuteChanged += CanExecuteChanged;
}
}
protected override void OnDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs e)
{
base.OnDetachedFromLogicalTree(e);
if (Command != null)
{
Command.CanExecute... | @@ -306,6 +327,36 @@ protected override void OnDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs
}
}
+ protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
+ {
+ base.OnAttachedToVisualTree(e);
+
+ if (this.GetVisualParent() is ... | src/Avalonia.Controls/MenuItem.cs | 26 | C# | 0.286 | suggestion | 63 | 51 | 51 | false | Add MenuItem.InputGestureText. | 3,602 | AvaloniaUI/Avalonia | 24,333 | C# | kekekeks | grokys |
/// Gets or sets the parameter to pass to the <see cref="Command"/> property of a
/// <see cref="MenuItem"/>.
/// </summary>
public object CommandParameter
{
get { return GetValue(CommandParameterProperty); }
set { SetValue(CommandParameterProperty, value)... | I guess it was supposed to be `string` and not `object` ? | /// Gets or sets the parameter to pass to the <see cref="Command"/> property of a
/// <see cref="MenuItem"/>.
/// </summary>
public object CommandParameter
{
get { return GetValue(CommandParameterProperty); }
set { SetValue(CommandParameterProperty, value)... | @@ -194,6 +202,19 @@ public object Icon
set { SetValue(IconProperty, value); }
}
+ /// <summary>
+ /// Gets or sets the input gesture that will be displayed in the menu item.
+ /// </summary>
+ /// <remarks>
+ /// Setting this property does not cause the input ... | src/Avalonia.Controls/MenuItem.cs | 26 | C# | 0.357 | question | 57 | 51 | 51 | false | Add MenuItem.InputGestureText. | 3,602 | AvaloniaUI/Avalonia | 24,333 | C# | MarchingCube | grokys |
{
s.Append("+");
}
}
if (KeyModifiers.HasFlagCustom(KeyModifiers.Control))
{
s.Append("Ctrl");
}
if (KeyModifiers.HasFlagCustom(KeyModifiers.Shift))
{
Plus(s);
... | I guess this is platform dependent, on Windows this should be windows key if I understand it correctly. | if (s.Length > 0)
{
s.Append("+");
}
}
if (KeyModifiers.HasFlagCustom(KeyModifiers.Control))
{
s.Append("Ctrl");
}
if (KeyModifiers.HasFlagCustom(KeyModifiers.Shift))
... | @@ -108,19 +109,43 @@ public static KeyGesture Parse(string gesture)
public override string ToString()
{
- var parts = new List<string>();
+ var s = new StringBuilder();
- foreach (var flag in Enum.GetValues(typeof(KeyModifiers)).Cast<KeyModifiers>())
+ ... | src/Avalonia.Input/KeyGesture.cs | 26 | C# | 0.429 | suggestion | 103 | 51 | 51 | false | Add MenuItem.InputGestureText. | 3,602 | AvaloniaUI/Avalonia | 24,333 | C# | MarchingCube | grokys |
using System;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Text;
using Avalonia.Data.Converters;
using Avalonia.Input;
namespace Avalonia.Controls.Converters
{
public class PlatformKeyGestureConverter : IValueConverter
{
public object Convert(object value, Type target... | Wondering if that could be exposed as a static helper since I would like to reuse that logic in our app and I would need to create a new instance of this converter to do so otherwise (I can obviously use a static shared instance but that feels hacky). | using System;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Text;
using Avalonia.Data.Converters;
using Avalonia.Input;
namespace Avalonia.Controls.Converters
{
/// <summary>
/// Converts a <see cref="KeyGesture"/> to a string, formatting it according to the current
/// pl... | @@ -0,0 +1,173 @@
+using System;
+using System.Globalization;
+using System.Runtime.InteropServices;
+using System.Text;
+using Avalonia.Data.Converters;
+using Avalonia.Input;
+
+namespace Avalonia.Controls.Converters
+{
+ public class PlatformKeyGestureConverter : IValueConverter | src/Avalonia.Controls/Converters/PlatformKeyGestureConverter.cs | 14 | C# | 0.5 | refactor | 251 | 39 | 39 | false | Add MenuItem.InputGestureText. | 3,602 | AvaloniaUI/Avalonia | 24,333 | C# | MarchingCube | grokys |
<Border Name='bar' Classes='bar'/>
<Border Name='baz' Classes='baz'/>
</StackPanel>
</Window>";
var loader = new AvaloniaXamlLoader();
var window = (Window)loader.Load(xaml);
var foo = window.FindControl<Border>("foo");
var bar = window... | wow.. i didnt know this was a thing already! this removes so much redundant styles in many apps out there. | </Window>";
var loader = new AvaloniaXamlLoader();
var window = (Window)loader.Load(xaml);
var foo = window.FindControl<Border>("foo");
var bar = window.FindControl<Border>("bar");
var baz = window.FindControl<Border>("baz");
... | @@ -278,5 +278,67 @@ public void Style_Can_Use_Not_Selector()
Assert.Equal(Colors.Red, ((ISolidColorBrush)notFoo.Background).Color);
}
}
+
+ [Fact]
+ public void Style_Can_Use_Or_Selector_1()
+ {
+ using (UnitTestApplication.Start(TestServices.Style... | tests/Avalonia.Markup.Xaml.UnitTests/Xaml/StyleTests.cs | 26 | C# | 0.429 | style | 106 | 49 | 46 | false | Fix XAML compiler handling of comma/or style selector. | 3,678 | AvaloniaUI/Avalonia | 24,333 | C# | jmacato | grokys |
/// <inheritdoc/>
Vector IScrollable.Offset
{
get { return Virtualizer?.Offset ?? new Vector(); }
set
{
if (Virtualizer != null)
{
Virtualizer.Offset = CoerceOffset(value);
}
}
... | Introduce a constant for that 16? |
/// <inheritdoc/>
Vector IScrollable.Offset
{
get { return Virtualizer?.Offset ?? new Vector(); }
set
{
if (Virtualizer != null)
{
Virtualizer.Offset = CoerceOffset(value);
}
}
... | @@ -95,13 +96,17 @@ Vector IScrollable.Offset
Size IScrollable.Viewport => Virtualizer?.Viewport ?? Bounds.Size;
/// <inheritdoc/>
- Action ILogicalScrollable.InvalidateScroll { get; set; }
+ event EventHandler ILogicalScrollable.ScrollInvalidated
+ {
+ add => _scroll... | src/Avalonia.Controls/Presenters/ItemsPresenter.cs | 26 | C# | 0.071 | question | 33 | 51 | 51 | false | Fix large/small scroll in ScrollViewer. | 3,725 | AvaloniaUI/Avalonia | 24,333 | C# | MarchingCube | grokys |
using System;
using Avalonia.Controls.Presenters;
using Avalonia.Controls.Primitives;
using Avalonia.Input;
namespace Avalonia.Controls
{
/// <summary>
/// A control scrolls its content if the content is bigger than the space available.
/// </summary>
public class ScrollViewer : ContentControl, IScroll... | 16 again, should `ItemsPresenter` share this constant? | using System;
using Avalonia.Controls.Presenters;
using Avalonia.Controls.Primitives;
using Avalonia.Input;
namespace Avalonia.Controls
{
/// <summary>
/// A control scrolls its content if the content is bigger than the space available.
/// </summary>
public class ScrollViewer : ContentControl, IScroll... | @@ -10,6 +10,8 @@ namespace Avalonia.Controls
/// </summary>
public class ScrollViewer : ContentControl, IScrollable, IScrollAnchorProvider
{
+ private static readonly Size s_defaultSmallChange = new Size(16, 16); | src/Avalonia.Controls/ScrollViewer.cs | 13 | C# | 0.429 | question | 54 | 38 | 38 | false | Fix large/small scroll in ScrollViewer. | 3,725 | AvaloniaUI/Avalonia | 24,333 | C# | MarchingCube | grokys |
using System;
namespace Avalonia.Media.Fonts
{
public readonly struct FontKey : IEquatable<FontKey>
{
public readonly string FamilyName;
public readonly FontStyle Style;
public readonly FontWeight Weight;
public FontKey(string familyName, FontWeight weight, FontStyle style)
... | Only just noticed this, but is it a good idea to expose fields on a public API? Should these be properties? | using System;
namespace Avalonia.Media.Fonts
{
public readonly struct FontKey : IEquatable<FontKey>
{
public FontKey(string familyName, FontWeight weight, FontStyle style)
{
FamilyName = familyName;
Style = style;
Weight = weight;
}
public st... | @@ -4,20 +4,20 @@ namespace Avalonia.Media.Fonts
{
public readonly struct FontKey : IEquatable<FontKey>
{
- public readonly FontFamily FontFamily;
+ public readonly string FamilyName; | src/Avalonia.Visuals/Media/Fonts/FontKey.cs | 7 | C# | 0.429 | question | 107 | 32 | 32 | false | More text rendering improvements | 3,782 | AvaloniaUI/Avalonia | 24,333 | C# | grokys | Gillibald |
else if (e.Key == Key.PageDown)
{
VerticalScrollBarValue = Math.Min(_offset.Y + _viewport.Height, VerticalScrollBarMaximum);
e.Handled = true;
}
}
/// <summary>
/// Called when a change in scrolling state is detected, such as a... | I wonder if checking if anything actually changed before raising event would be beneficial. | }
private void CalculatedPropertiesChanged()
{
// Pass old values of 0 here because we don't have the old values at this point,
// and it shouldn't matter as only the template uses these properies.
RaisePropertyChanged(HorizontalScrollBarMaximumProperty, 0, H... | @@ -602,5 +583,35 @@ protected override void OnKeyDown(KeyEventArgs e)
e.Handled = true;
}
}
+
+ /// <summary>
+ /// Called when a change in scrolling state is detected, such as a change in scroll
+ /// position, extent, or viewport size.
+ /// </summar... | src/Avalonia.Controls/ScrollViewer.cs | 26 | C# | 0.286 | suggestion | 91 | 39 | 51 | false | Match LayoutUpdated and ScrollChanged event behavior to WPF/UWP | 4,080 | AvaloniaUI/Avalonia | 24,333 | C# | MarchingCube | grokys |
}
}
/// <summary>
/// Called when a change in scrolling state is detected, such as a change in scroll
/// position, extent, or viewport size.
/// </summary>
/// <param name="e">The event args.</param>
/// <remarks>
/// If you override this met... | I think to have correct behavior (numerically) you might want to use something like `extentDelta.NearlyEquals(default)` perhaps. | // Pass old values of 0 here because we don't have the old values at this point,
// and it shouldn't matter as only the template uses these properies.
RaisePropertyChanged(HorizontalScrollBarMaximumProperty, 0, HorizontalScrollBarMaximum);
RaisePropertyChanged(HorizontalS... | @@ -602,5 +583,38 @@ protected override void OnKeyDown(KeyEventArgs e)
e.Handled = true;
}
}
+
+ /// <summary>
+ /// Called when a change in scrolling state is detected, such as a change in scroll
+ /// position, extent, or viewport size.
+ /// </summar... | src/Avalonia.Controls/ScrollViewer.cs | 26 | C# | 0.571 | suggestion | 128 | 38 | 51 | false | Match LayoutUpdated and ScrollChanged event behavior to WPF/UWP | 4,080 | AvaloniaUI/Avalonia | 24,333 | C# | MarchingCube | grokys |
}
public SplineEasing(double x1 = 0d, double y1 = 0d, double x2 = 1d, double y2 = 1d)
{
this._internalKeySpline = new KeySpline();
this.X1 = x1;
this.Y1 = y1;
this.X2 = x2;
this.Y1 = y2;
}
private KeySpline _in... | You are putting multiple statements in a single line, and it is not even consistent with your own code below which puts same constructs in multiple ones (`X2 for example)
And I think having multiple statements on the same line is really bad. | public double X1
{
get => _internalKeySpline.ControlPointX1;
set
{
_internalKeySpline.ControlPointX1 = value;
}
}
/// <summary>
/// Y coordinate of the first control point
/// </summary>
public doubl... | @@ -0,0 +1,85 @@
+namespace Avalonia.Animation.Easings
+{
+ /// <summary>
+ /// Eases a <see cref="double"/> value
+ /// using a user-defined cubic bezier curve.
+ /// Good for custom easing functions that doesn't quite
+ /// fit with the built-in ones.
+ /// </summary>
+ public class SplineEasing... | src/Avalonia.Animation/Easing/SplineEasing.cs | 26 | C# | 0.571 | suggestion | 245 | 51 | 51 | false | Spline easing | 4,180 | AvaloniaUI/Avalonia | 24,333 | C# | MarchingCube | jmacato |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.