Loading files
bae9c0e4eThis file is pinned to the selected release. Download the original to open it in your design tool.
import { Tab } from "../../tab.slint";
import {
AssemblyOutputJobsRowHeader,
AuthorRowHeader,
DeprecatedRowCell,
DeprecatedRowHeader,
DescriptionRowHeader,
IconRowCell,
IconRowHeader,
KeywordsRowHeader,
MetadataFooterRowCell,
NameRowHeader,
PcbDesignRulesRowCell,
PcbDesignRulesRowHeader,
PcbOutputJobsRowHeader,
PriorityRowHeader,
UrlRowCell,
UrlRowHeader,
VersionRowHeader,
} from "../metadatawidgets.slint";
import {
HorizontalSlider,
IconButton,
IconButtonStyle,
LineEdit,
LinkText,
MessageBanner,
TextEdit,
} from "../../widgets.slint";
import {
Backend,
Data,
FeatureState,
OrganizationTabData,
TabAction,
WindowSectionData,
} from "../../api.slint";
export component OrganizationTab inherits Tab {
in property <int> section-index;
in-out property <WindowSectionData> section;
property <[OrganizationTabData]> tabs: section.organization-tabs;
property <int> index: section.current-tab-index;
property <bool> read-only: section.tabs[index].features.save != FeatureState.enabled;
VerticalLayout {
MessageBanner {
text: @tr("Note: This is currently an experimental feature which will be polished in upcoming releases.");
}
GridLayout {
padding: 8px;
spacing: 8px;
Row {
logo-txt := IconRowHeader { }
logo-cell := IconRowCell {
icon: tabs[index].logo;
icon-height: 64px;
clicked => {
Backend.trigger-tab(section-index, index, TabAction.library-choose-icon);
}
}
}
Row {
name-txt := NameRowHeader { }
name-edt := LineEdit {
text: tabs[index].name;
validation-error: tabs[index].name-error;
read-only: read-only;
accessible-label: name-txt.text;
init => {
if !read-only {
self.select-all();
}
}
text-edited(text) => {
tabs[index].name = text;
}
text-accepted(text) => {
tabs[index].name = text;
Backend.trigger-tab(section-index, index, TabAction.apply);
}
}
}
Row {
description-txt := DescriptionRowHeader { }
description-edt := TextEdit {
min-height: 65px; // Corresponds to 3 text rows
max-height: 250px; // Allow growing up to this height for long texts
text: tabs[index].description;
read-only: read-only;
accessible-label: description-txt.text;
text-edited(text) => {
tabs[index].description = text;
}
text-accepted(text) => {
tabs[index].description = text;
Backend.trigger-tab(section-index, index, TabAction.apply);
}
}
}
Row {
keywords-txt := KeywordsRowHeader { }
keywords-edt := LineEdit {
text: tabs[index].keywords;
read-only: read-only;
accessible-label: keywords-txt.text;
text-edited(text) => {
tabs[index].keywords = text;
}
text-accepted(text) => {
tabs[index].keywords = text;
Backend.trigger-tab(section-index, index, TabAction.apply);
}
}
}
Row {
author-txt := AuthorRowHeader { }
author-edt := LineEdit {
text: tabs[index].author;
read-only: read-only;
accessible-label: author-txt.text;
text-edited(text) => {
tabs[index].author = text;
}
text-accepted(text) => {
tabs[index].author = text;
Backend.trigger-tab(section-index, index, TabAction.apply);
}
}
}
Row {
version-txt := VersionRowHeader { }
version-edt := LineEdit {
text: tabs[index].version;
validation-error: tabs[index].version-error;
read-only: read-only;
accessible-label: version-txt.text;
text-edited(text) => {
tabs[index].version = text;
}
text-accepted(text) => {
tabs[index].version = text;
Backend.trigger-tab(section-index, index, TabAction.apply);
}
}
}
Row {
deprecated-txt := DeprecatedRowHeader { }
deprecated-sw := DeprecatedRowCell {
checked: tabs[index].deprecated;
read-only: read-only;
accessible-label: deprecated-txt.text;
toggled(checked) => {
tabs[index].deprecated = checked;
Backend.trigger-tab(section-index, index, TabAction.apply);
}
}
}
Row {
url-txt := UrlRowHeader { }
url-cell := UrlRowCell {
url: tabs[index].url;
url-error: tabs[index].url-error;
read-only: read-only;
label: url-txt.text;
text-edited(text) => {
tabs[index].url = text;
}
text-accepted(text) => {
tabs[index].url = text;
Backend.trigger-tab(section-index, index, TabAction.apply);
}
}
}
Row {
priority-txt := PriorityRowHeader { }
HorizontalLayout {
z: 100; // For the tooltip
priority-value-txt := Text {
min-width: 30px;
horizontal-alignment: left;
vertical-alignment: center;
color: Data.theme.base-text;
text: tabs[index].priority;
}
priority-slider := HorizontalSlider {
value: tabs[index].priority / 200;
value-changed(value) => {
tabs[index].priority = value * 200;
}
value-accepted => {
Backend.trigger-tab(section-index, index, TabAction.apply);
}
}
priority-info-btn := IconButton {
property <string> line-1: @tr("Organizations with higher priority will appear before organizations with lower priority.");
property <string> line-2: "0..49: ⚠ " + @tr("Reserved for official organizations");
property <string> line-3: "50..99: ✓ " + @tr("Recommended for your personal organizations");
property <string> line-4: "100: ⚠ " + @tr("Reserved for LibrePCB Fab");
property <string> line-5: "101+: 🛇 " + @tr("Not recommended");
y: (parent.height - self.height) / 2;
height: 16px;
style: IconButtonStyle.read-only;
icon: @image-url("../../../../bootstrap-icons/icons/info-circle.svg");
tooltip: line-1 + "\n\n" + line-2 + "\n" + line-3 + "\n" + line-4 + "\n" + line-5;
tooltip-position: left;
tooltip-delayed: false;
accessible-label: self.tooltip;
}
}
}
Row {
pcb-design-rules-txt := PcbDesignRulesRowHeader { }
pcb-design-rules-cell := PcbDesignRulesRowCell {
model: tabs[index].pcb-design-rules;
read-only: read-only;
add-clicked => {
Backend.trigger-tab(section-index, index, TabAction.organization-add-pcb-design-rules);
}
}
}
Row {
pcb-jobs-txt := PcbOutputJobsRowHeader { }
pcb-jobs-btn := LinkText {
text: @tr("" | "{n} output job(s)" % tabs[index].pcb-output-jobs);
clicked => {
Backend.trigger-tab(section-index, index, TabAction.organization-edit-pcb-output-jobs);
}
}
}
Row {
assembly-jobs-txt := AssemblyOutputJobsRowHeader { }
assembly-jobs-btn := LinkText {
text: @tr("" | "{n} output job(s)" % tabs[index].assembly-output-jobs);
clicked => {
Backend.trigger-tab(section-index, index, TabAction.organization-edit-assembly-output-jobs);
}
}
}
Row {
Rectangle { }
MetadataFooterRowCell {
section-index: section-index;
tab-index: index;
wizard-mode: false;
unsaved-changes: Data.sections[section-index].tabs[index].unsaved-changes;
checks: tabs[index].checks;
read-only: read-only;
}
}
Row {
Rectangle { }
}
}
}
}