gera 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
gera/__init__.py ADDED
File without changes
gera/__main__.py ADDED
@@ -0,0 +1,3 @@
1
+ from .application import main
2
+
3
+ main()
gera/application.py ADDED
@@ -0,0 +1,41 @@
1
+ from __future__ import annotations
2
+ from argparse import Namespace, ArgumentParser
3
+ import sys
4
+
5
+
6
+ def application():
7
+ from PyQt5.QtWidgets import QApplication
8
+
9
+ a = QApplication(sys.argv)
10
+
11
+ try:
12
+ from gera.main_window import MainWindow
13
+
14
+ main_window = MainWindow(**vars(parse_args()))
15
+ except Exception:
16
+ import traceback
17
+
18
+ traceback.print_exc(file=sys.stdout)
19
+ print("press <Enter> to exit")
20
+ input()
21
+ return (None, None)
22
+
23
+ main_window.show()
24
+ return a, main_window
25
+
26
+
27
+ def main():
28
+ a, _main_window = application()
29
+ sys.exit(a and a.exec_())
30
+
31
+
32
+ def parse_args() -> Namespace:
33
+ parser = ArgumentParser("GERA runner")
34
+
35
+ parser.add_argument("files", nargs="*", help="files to open")
36
+ parser.add_argument(
37
+ "--schema",
38
+ choices=["ldj"],
39
+ )
40
+
41
+ return parser.parse_args()
gera/dbutils.py ADDED
@@ -0,0 +1,66 @@
1
+ from __future__ import annotations
2
+ from itertools import islice, chain
3
+
4
+ SEP = "/"
5
+
6
+
7
+ def batch(iterable, size=100):
8
+ """
9
+ >>> list(list(_) for _ in batch(range(10), 3))
10
+ [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9]]
11
+ """
12
+ it = iter(iterable)
13
+ try:
14
+ while True:
15
+ batchiter = islice(it, size)
16
+ yield chain([next(batchiter)], batchiter)
17
+ except StopIteration:
18
+ pass
19
+
20
+
21
+ def flat_dict(entry, sep=SEP):
22
+ """
23
+ flattens hierarchical dict adding sep at each depth
24
+ """
25
+ for key, value in entry.items():
26
+ if isinstance(value, dict):
27
+ for sub_key, value in flat_dict(value):
28
+ yield key + sep + sub_key, value
29
+ elif isinstance(value, list):
30
+ yield key, int # count number of items
31
+ elif value is not None:
32
+ yield key, type(value)
33
+
34
+
35
+ def extract_rows(data):
36
+ """
37
+ list all possible column names from dict
38
+ """
39
+ rows = {}
40
+ for plate in data:
41
+ rows.update(flat_dict(plate))
42
+ return rows
43
+
44
+
45
+ def create_table_statement(
46
+ rows: dict[str, type[int | str | float]],
47
+ table_name: str = "report",
48
+ column_order: list[str] | None = None,
49
+ ):
50
+ """
51
+ :param rows: dict of `str:type`
52
+ """
53
+ types = {
54
+ int: "INTEGER",
55
+ float: "REAL",
56
+ }
57
+ return (
58
+ "CREATE TABLE "
59
+ + table_name
60
+ + " (\n "
61
+ + ",\n ".join(
62
+ '"' + key + '" ' + types.get(rows[key], "TEXT")
63
+ for key in column_order or sorted(rows)
64
+ )
65
+ + "\n)"
66
+ )
gera/main_window.py ADDED
@@ -0,0 +1,133 @@
1
+ from __future__ import annotations
2
+ from PyQt5 import QtCore, QtGui, QtWidgets
3
+ from .mdi_area import MdiArea
4
+ from .utils import get_icon
5
+ from .schemas import iter_schemas, load_schema_cls
6
+
7
+ Qt = QtCore.Qt
8
+
9
+
10
+ class MainWindow(QtWidgets.QMainWindow):
11
+ def __init__(self, schema: str, files: list[str]):
12
+ # enable `get_icon`
13
+ QtCore.QDir.addSearchPath(
14
+ "gera",
15
+ QtCore.QFileInfo(f"{__file__}/../resources").absoluteFilePath(),
16
+ )
17
+ super().__init__(
18
+ windowTitle="GERA - General ERror Analyzer",
19
+ windowIcon=get_icon("gera"),
20
+ )
21
+ self._setup_ui()
22
+ self._load_settings()
23
+ if schema == "ldj":
24
+ for path in files:
25
+ cls = load_schema_cls("ldj")
26
+ report_window = cls().open_filename(path)
27
+ if report_window:
28
+ self._mdi_area.add(report_window, True)
29
+
30
+ def _setup_ui(self):
31
+ self.resize(1000, 770)
32
+ self.setStyleSheet(
33
+ """QMainWindow::separator, QSplitter::handle {
34
+ background:rgba(0,0,0,50);
35
+ width:4px;
36
+ height:4px;
37
+ } """
38
+ )
39
+ # main_splitter splits left_frame and mdi_area
40
+ menu_button = self._create_menu_button()
41
+ self._mdi_area = MdiArea(self, menu_button)
42
+ self._mdi_area.subWindowActivated.connect(self._sub_window_changed)
43
+
44
+ self.setCentralWidget(self._mdi_area)
45
+
46
+ def _create_menu_button(self):
47
+ size_policy = QtWidgets.QSizePolicy(
48
+ QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed
49
+ )
50
+ menu_button = QtWidgets.QPushButton(
51
+ maximumSize=QtCore.QSize(24, 24),
52
+ icon=get_icon("menu"),
53
+ flat=True,
54
+ sizePolicy=size_policy,
55
+ shortcut="Alt+M",
56
+ )
57
+ menu = QtWidgets.QMenu()
58
+ self._open_actions = []
59
+ for name, title in iter_schemas():
60
+ open_act = QtWidgets.QAction(
61
+ get_icon("open"),
62
+ "&Open - " + title,
63
+ self,
64
+ triggered=self._on_open,
65
+ )
66
+ open_act.setData(name)
67
+ self._open_actions.append(open_act)
68
+ menu.addActions(self._open_actions)
69
+ menu_button.setMenu(menu)
70
+ return menu_button
71
+
72
+ def _on_open(self):
73
+ self._default_open = module_name = self.sender().data()
74
+ for act in self._open_actions:
75
+ act.setShortcut(
76
+ "Ctrl+O" if act is self.sender() else QtGui.QKeySequence()
77
+ )
78
+ cls = load_schema_cls(module_name)
79
+ settings = self.get_settings()
80
+ try:
81
+ report_window = cls().open(self, settings)
82
+ except Exception as e:
83
+ QtWidgets.QMessageBox.warning(
84
+ self,
85
+ "Warning",
86
+ "Error opening a file:\n\n"
87
+ + repr(e)
88
+ + "\n\nprobably invalid file",
89
+ )
90
+ import traceback
91
+
92
+ traceback.print_exception(e)
93
+ return
94
+ if report_window is not None:
95
+ self._mdi_area.add(report_window, True)
96
+
97
+ def _sub_window_changed(self, window):
98
+ if window is not None:
99
+ try:
100
+ on_activate = window.widget().on_activate
101
+ except AttributeError:
102
+ return
103
+ on_activate()
104
+
105
+ def _load_settings(self):
106
+ settings = self.get_settings()
107
+ default = QtCore.QByteArray()
108
+ self.restoreGeometry(settings.value("geometry", default))
109
+ self.restoreState(settings.value("windowState", default))
110
+ self._default_open = settings.value("default_open", "")
111
+ for act in self._open_actions:
112
+ if act.data() == self._default_open:
113
+ act.setShortcut(Qt.CTRL + Qt.Key_O)
114
+
115
+ def closeEvent(self, event: QtGui.QCloseEvent):
116
+ """User closes GERA. By default, the event is accepted."""
117
+ self._mdi_area.closeAllSubWindows()
118
+ if self._mdi_area.subWindowList():
119
+ event.ignore()
120
+ else:
121
+ self._save_settings()
122
+
123
+ def _save_settings(self):
124
+ """Called from closeEvent."""
125
+ settings = self.get_settings()
126
+
127
+ settings.setValue("geometry", self.saveGeometry())
128
+ settings.setValue("windowState", self.saveState())
129
+ settings.setValue("default_open", self._default_open)
130
+
131
+ @staticmethod
132
+ def get_settings():
133
+ return QtCore.QSettings("iitpvisionlab", "GERA")
gera/mdi_area.py ADDED
@@ -0,0 +1,253 @@
1
+ from __future__ import annotations
2
+ from PyQt5 import QtCore, QtGui, QtWidgets
3
+ from .utils import get_icon
4
+
5
+ Qt = QtCore.Qt
6
+
7
+
8
+ class TabRenamer(QtCore.QObject):
9
+ def eventFilter(self, tab_bar, event):
10
+ if (
11
+ event.type() == event.MouseButtonDblClick
12
+ and event.button() == QtCore.Qt.LeftButton
13
+ ):
14
+ tab_idx = tab_bar.tabAt(event.pos())
15
+ if tab_idx >= 0:
16
+ text, ok = QtWidgets.QInputDialog.getText(
17
+ tab_bar,
18
+ "Tab Name",
19
+ "?",
20
+ QtWidgets.QLineEdit.Normal,
21
+ tab_bar.tabText(tab_idx),
22
+ )
23
+ if ok and text:
24
+ tab_bar.setTabText(tab_idx, text)
25
+ return True
26
+ return False
27
+
28
+
29
+ def action_for(self, **mod):
30
+ def action(text, *args, **kwargs):
31
+ if args:
32
+ kwargs["triggered"] = args[0]
33
+ kwargs.update(mod)
34
+ return QtWidgets.QAction(self.tr(text), self, **kwargs)
35
+
36
+ return action
37
+
38
+
39
+ class MdiArea(QtWidgets.QMdiArea):
40
+ def __init__(self, parent, button):
41
+ super(MdiArea, self).__init__(
42
+ parent,
43
+ objectName="mdi_area",
44
+ viewMode=QtWidgets.QMdiArea.TabbedView,
45
+ )
46
+ self._button = button
47
+ button.setParent(self)
48
+
49
+ # Setting elide mode
50
+ self._tab_bar = tab_bar = self.findChild(QtWidgets.QTabBar)
51
+ tab_bar.setElideMode(Qt.ElideMiddle)
52
+ tab_bar.setMovable(True)
53
+ tab_bar.setTabsClosable(True)
54
+ tab_bar.currentChanged.connect(self._add_button_space)
55
+ tab_bar.tabCloseRequested.connect(self._add_button_space)
56
+ self.subWindowActivated.connect(self._add_button_space)
57
+ self._renamer = TabRenamer()
58
+ tab_bar.installEventFilter(self._renamer)
59
+
60
+ # Actions
61
+ action = action_for(self)
62
+ close_all_act = action("Close &All", self.closeAllSubWindows)
63
+
64
+ close_others_act = action("Close &Others", self.close_others)
65
+
66
+ self.fullscreen_act = action(
67
+ "&Fullscreen",
68
+ icon=get_icon("fullscreen"),
69
+ checkable=True,
70
+ toggled=self.fullscreen,
71
+ shortcut="Ctrl+F11",
72
+ )
73
+
74
+ tile_act = action("&Tile", self.tileSubWindows, icon=get_icon("tile"))
75
+
76
+ tile_vert_act = action(
77
+ "&Tile Vertical",
78
+ self.tile_vertical,
79
+ icon=get_icon("tile_v"),
80
+ shortcut="Ctrl+Alt+Left",
81
+ )
82
+
83
+ tile_horz_act = action(
84
+ "&Tile Horizontal",
85
+ self.tile_horizontal,
86
+ icon=get_icon("tile_h"),
87
+ shortcut="Ctrl+Alt+Up",
88
+ )
89
+
90
+ tile_vert_rev_act = action(
91
+ "&Tile Vertical Reverse",
92
+ self.tile_vertical_rev,
93
+ icon=get_icon("tile_v"),
94
+ shortcut="Ctrl+Alt+Right",
95
+ )
96
+
97
+ tile_horz_rev_act = action(
98
+ "&Tile Horizontal Reverse",
99
+ self.tile_horizontal_rev,
100
+ icon=get_icon("tile_h"),
101
+ shortcut="Ctrl+Alt+Down",
102
+ )
103
+
104
+ cascade_act = action(
105
+ "&Cascade", self.cascadeSubWindows, icon=get_icon("cascade")
106
+ )
107
+
108
+ next_act = action(
109
+ "Ne&xt",
110
+ self.activateNextSubWindow,
111
+ shortcut=QtGui.QKeySequence.NextChild,
112
+ icon=get_icon("next"),
113
+ )
114
+
115
+ previous_act = action(
116
+ "Pre&vious",
117
+ self.activatePreviousSubWindow,
118
+ shortcut=QtGui.QKeySequence.PreviousChild,
119
+ icon=get_icon("prev"),
120
+ )
121
+
122
+ separator_act = QtWidgets.QAction(self)
123
+ separator_act.setSeparator(True)
124
+ self.menu_actions = [
125
+ close_all_act,
126
+ close_others_act,
127
+ self.fullscreen_act,
128
+ separator_act,
129
+ tile_act,
130
+ tile_vert_act,
131
+ tile_horz_act,
132
+ tile_vert_rev_act,
133
+ tile_horz_rev_act,
134
+ cascade_act,
135
+ separator_act,
136
+ next_act,
137
+ previous_act,
138
+ ]
139
+ self.addActions(self.menu_actions) # so shortcuts work
140
+ self._add_button_space()
141
+
142
+ def _add_button_space(self):
143
+ geometry = self._tab_bar.geometry()
144
+ if geometry.x() == 0:
145
+ btn_geometry = self._button.geometry()
146
+ x = btn_geometry.width()
147
+ geometry.setX(x)
148
+ self._tab_bar.setGeometry(geometry)
149
+ if geometry.height() == 0:
150
+ self.setViewportMargins(0, btn_geometry.height(), 0, 0)
151
+
152
+ def close_others(self):
153
+ w = self.currentSubWindow()
154
+ for window in self.subWindowList():
155
+ if window is not w:
156
+ window.close()
157
+
158
+ def fullscreen(self, state):
159
+ if state: # go fullscreen
160
+ self.splitter = self.parent()
161
+ self._splitter_state = self.splitter.saveState()
162
+ self.setParent(self.splitter.parent())
163
+ self.setWindowFlags(Qt.Tool | Qt.FramelessWindowHint)
164
+ self.showFullScreen()
165
+ else:
166
+ self.setParent(self.splitter)
167
+ self.splitter.restoreState(self._splitter_state)
168
+ self.splitter = None
169
+ self.showNormal()
170
+
171
+ def add(self, window, new=False, icon=None):
172
+ if (
173
+ not new
174
+ and QtWidgets.QApplication.keyboardModifiers() != Qt.AltModifier
175
+ and self.activeSubWindow() is not None
176
+ ):
177
+ self.closeActiveSubWindow()
178
+ window.setAttribute(Qt.WA_DeleteOnClose)
179
+ sub_window = self.addSubWindow(window)
180
+ sub_window.setAttribute(Qt.WA_DeleteOnClose)
181
+ sub_window.systemMenu().addActions(self.menu_actions)
182
+ sub_window.destroyed.connect(self.should_exit_fullscren)
183
+
184
+ if icon:
185
+ sub_window.setWindowIcon(get_icon(icon))
186
+ window.showMaximized()
187
+ self._add_button_space()
188
+
189
+ def tile_vertical_rev(self):
190
+ self.tile_vertical(True)
191
+
192
+ def tile_horizontal_rev(self):
193
+ self.tile_horizontal(True)
194
+
195
+ def tile_horizontal(self, reverse):
196
+ windows = self.subWindowList() # len(windows) != 0 always!
197
+ height = self.viewport().height() / len(windows)
198
+ x = 0
199
+ if reverse:
200
+ windows.reverse()
201
+ for window in windows:
202
+ window.showNormal()
203
+ window.resize(self.width(), height)
204
+ window.move(0, x)
205
+ x += height
206
+
207
+ def tile_vertical(self, reverse):
208
+ windows = self.subWindowList() # len(windows) != 0 always!
209
+ width = self.width() / len(windows)
210
+ x = 0
211
+ if reverse:
212
+ windows.reverse()
213
+ height = self.viewport().height()
214
+ for window in windows:
215
+ window.showNormal()
216
+ window.resize(width, height)
217
+ window.move(x, 0)
218
+ x += width
219
+
220
+ def closeEvent(self, event):
221
+ # Alt+F4 in fullscreen
222
+ self.fullscreen_act.setChecked(False)
223
+ event.ignore()
224
+
225
+ def resizeEvent(self, event):
226
+ super(MdiArea, self).resizeEvent(event)
227
+ self._add_button_space()
228
+
229
+ def should_exit_fullscren(self, _):
230
+ if not self.subWindowList():
231
+ self.fullscreen_act.setChecked(False)
232
+
233
+ def keyPressEvent(self, event):
234
+ # Not as action as `Ambiguous shortcut overload: Esc`
235
+ if event.key() == Qt.Key_Escape and self.isFullScreen():
236
+ self.fullscreen_act.setChecked(False)
237
+ else:
238
+ return QtWidgets.QMdiArea.keyPressEvent(self, event)
239
+
240
+ def eventFilter(self, obj, event):
241
+ # Trick to not steal focus from QDialog window
242
+ if (
243
+ event.type() in (event.KeyPress, event.KeyRelease)
244
+ and event.modifiers() & Qt.ControlModifier
245
+ ):
246
+ parent = obj
247
+ for _level in range(6):
248
+ parent = parent.parent()
249
+ if parent is None:
250
+ break
251
+ if isinstance(parent, QtWidgets.QDialog):
252
+ return False
253
+ return super(MdiArea, self).eventFilter(obj, event)
gera/report_window.py ADDED
@@ -0,0 +1,137 @@
1
+ from __future__ import annotations
2
+ from typing import Callable
3
+ from PyQt5 import QtCore, QtSql, QtWidgets
4
+ from .sql_text_edit import SqlTextEdit
5
+
6
+ Qt = QtCore.Qt
7
+
8
+
9
+ class CustomTableView(QtWidgets.QTableView):
10
+ def __init__(self, sql_text_edit: SqlTextEdit):
11
+ super().__init__(
12
+ sortingEnabled=True,
13
+ selectionBehavior=QtWidgets.QTableView.SelectRows
14
+ | QtWidgets.QTableView.SelectColumns,
15
+ selectionMode=QtWidgets.QTableView.ContiguousSelection,
16
+ alternatingRowColors=True,
17
+ contextMenuPolicy=Qt.ActionsContextMenu,
18
+ editTriggers=QtWidgets.QTableView.EditKeyPressed,
19
+ )
20
+ header = self.horizontalHeader()
21
+ header.setContextMenuPolicy(Qt.ContextMenuPolicy.ActionsContextMenu)
22
+ header.addAction(
23
+ QtWidgets.QAction(
24
+ "&Copy whole column", self, triggered=self._copy_columns
25
+ )
26
+ )
27
+ self._sql_text_edit = sql_text_edit
28
+
29
+ def _copy_columns(self):
30
+ model = self.horizontalHeader().selectionModel()
31
+ self.verticalHeader()
32
+ col_idxs = [idx.column() for idx in model.selectedIndexes()]
33
+ model = self.model()
34
+ data = []
35
+ # header_model = self.horizontalHeader().model()
36
+ data.append(
37
+ [model.headerData(col_idx, Qt.Horizontal) for col_idx in col_idxs]
38
+ )
39
+ for row in range(model.rowCount()):
40
+ data.append(
41
+ [str(model.index(row, col_idx).data()) for col_idx in col_idxs]
42
+ )
43
+ text = "\n".join("\t".join(row) for row in data)
44
+ QtWidgets.QApplication.clipboard().setText(text)
45
+
46
+ def selectionChanged(self, selected, deselected):
47
+ tips: set[str] = set()
48
+ for index in selected.indexes():
49
+ val = index.data()
50
+ try:
51
+ if len(val) > 1:
52
+ tips.add(val)
53
+ except TypeError: # int
54
+ pass
55
+ self._sql_text_edit.setTips(tips)
56
+ super().selectionChanged(selected, deselected)
57
+
58
+
59
+ class ReportWindow(QtWidgets.QSplitter):
60
+ def __init__(
61
+ self,
62
+ title: str,
63
+ report_to_db: Callable[[QtSql.QSqlDatabase], list[str]],
64
+ view_ready: Callable[[CustomTableView], None],
65
+ ):
66
+ super().__init__(Qt.Vertical, windowTitle=title)
67
+ self.setMinimumSize(1, 1)
68
+ self._db_id = "db-" + str(id(self))
69
+ self._db = self._create_db(self._db_id)
70
+ keys = report_to_db(self._db)
71
+ (
72
+ where_widget,
73
+ self._sql_text_edit,
74
+ apply_button,
75
+ self._error_label,
76
+ ) = self._create_where_widget()
77
+ self._sql_table_view = self._create_sql_table(self._db)
78
+ view_ready(self._sql_table_view)
79
+ self.addWidget(self._sql_table_view)
80
+ self.addWidget(where_widget)
81
+ self._sql_text_edit.setColumnNames(keys)
82
+ self._sql_text_edit.apply.connect(self._apply)
83
+ apply_button.clicked.connect(self._apply)
84
+ self.setSizes([1000, 1])
85
+ self._sql_table_view.resizeColumnsToContents()
86
+ if self._sql_table_view.model().rowCount():
87
+ self._sql_table_view.selectRow(0)
88
+
89
+ def _apply(self):
90
+ sql = self._sql_text_edit.toPlainText()
91
+ sql_model = self._sql_table_view.model()
92
+ sql_model.setFilter(sql)
93
+ err = ""
94
+ if sql_model.lastError().isValid():
95
+ err = "SQL error: " + sql_model.lastError().databaseText()
96
+ sql_model.select()
97
+ self._error_label.setText(err)
98
+
99
+ @staticmethod
100
+ def _create_db(connection_name: str):
101
+ db = QtSql.QSqlDatabase.addDatabase("QSQLITE", connection_name)
102
+ db.setDatabaseName(":memory:")
103
+ if not db.open():
104
+ raise Exception("Can't open sqlite database in memory")
105
+ return db
106
+
107
+ def _create_sql_table(self, db: QtSql.QSqlDatabase):
108
+ """
109
+ Create table view
110
+ """
111
+ table_view = CustomTableView(self._sql_text_edit)
112
+ sql_model = QtSql.QSqlTableModel(self, db)
113
+ sql_model.setTable("report")
114
+ sql_model.select()
115
+ table_view.setModel(sql_model)
116
+ return table_view
117
+
118
+ @staticmethod
119
+ def _create_where_widget():
120
+ SP = QtWidgets.QSizePolicy
121
+ sql_text_edit = SqlTextEdit()
122
+ action_layout = QtWidgets.QHBoxLayout()
123
+ error_label = QtWidgets.QLabel(styleSheet="QLabel{color:darkRed;}")
124
+ error_label.setSizePolicy(SP.Expanding, SP.Preferred)
125
+ apply_button = QtWidgets.QPushButton(
126
+ "Apply", toolTip="Ctrl+Enter / Alt+Enter"
127
+ )
128
+ action_layout.addWidget(error_label)
129
+ action_layout.addWidget(apply_button)
130
+
131
+ where_widget = QtWidgets.QWidget()
132
+ layout = QtWidgets.QVBoxLayout(where_widget)
133
+ layout.addWidget(QtWidgets.QLabel("Where:"))
134
+ layout.addWidget(sql_text_edit)
135
+ layout.addLayout(action_layout)
136
+
137
+ return where_widget, sql_text_edit, apply_button, error_label
@@ -0,0 +1,20 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="32" width="32" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/">
3
+ <defs>
4
+ <linearGradient id="shade">
5
+ <stop stop-opacity=".12549" offset="0"/>
6
+ <stop stop-opacity="0" offset="1"/>
7
+ </linearGradient>
8
+ <linearGradient id="linearGradient8103" x1="6.9153" xlink:href="#shade" gradientUnits="userSpaceOnUse" y1="10.576" gradientTransform="translate(-7.248e-5,2.241)" x2="6.9153" y2="-.81356"/>
9
+ <linearGradient id="linearGradient8094" x1="6.9153" xlink:href="#shade" gradientUnits="userSpaceOnUse" x2="6.9153" gradientTransform="translate(15.962 18.076)" y1="10.576" y2="-.81356"/>
10
+ <clipPath id="clipPath8140" clipPathUnits="userSpaceOnUse">
11
+ <path fill="#f0f" d="m1.7483 1.8942v6.2293 6.2293h6.2293v-6.2293h6.2293v-6.2293h-6.2293-6.2293z"/>
12
+ </clipPath>
13
+ </defs>
14
+ <g stroke="#000" stroke-width="1.5">
15
+ <rect clip-path="url(#clipPath8140)" transform="translate(-.0381 -.15228)" height="10.424" width="10.424" y="2.991" x="2.7881" fill="url(#linearGradient8103)"/>
16
+ <rect height="10.424" width="10.424" y="18.826" x="18.75" fill="url(#linearGradient8094)"/>
17
+ <rect clip-path="url(#clipPath8140)" transform="translate(5.2952 5.198)" height="10.424" width="10.424" y="2.991" x="2.7881" fill="url(#linearGradient8103)"/>
18
+ <rect clip-path="url(#clipPath8140)" transform="translate(10.629 10.241)" height="10.424" width="10.424" y="2.991" x="2.7881" fill="url(#linearGradient8103)"/>
19
+ </g>
20
+ </svg>