molde 0.1.1__py3-none-any.whl → 0.1.2__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.
- molde/__init__.py +6 -5
- molde/__main__.py +74 -63
- molde/actors/__init__.py +5 -4
- molde/actors/common_symbols_actor.py +148 -0
- molde/actors/ghost_actor.py +12 -12
- molde/actors/lines_actor.py +31 -31
- molde/actors/round_points_actor.py +7 -7
- molde/actors/square_points_actor.py +32 -32
- molde/colors/__init__.py +1 -1
- molde/colors/color.py +120 -120
- molde/colors/color_names.py +124 -124
- molde/interactor_styles/__init__.py +2 -2
- molde/interactor_styles/arcball_camera_style.py +288 -272
- molde/interactor_styles/box_selection_style.py +70 -70
- molde/main_window.ui +864 -0
- molde/pickers/__init__.py +2 -2
- molde/pickers/cell_area_picker.py +61 -61
- molde/pickers/cell_property_area_picker.py +84 -84
- molde/poly_data/__init__.py +19 -2
- molde/poly_data/arrows.py +54 -0
- molde/poly_data/complex_shapes.py +26 -0
- molde/poly_data/lines_data.py +23 -23
- molde/poly_data/simple_shapes.py +22 -0
- molde/poly_data/vertices_data.py +24 -24
- molde/render_widgets/__init__.py +2 -2
- molde/render_widgets/animated_render_widget.py +164 -164
- molde/render_widgets/common_render_widget.py +433 -433
- molde/stylesheets/__init__.py +119 -119
- molde/stylesheets/common.qss +16 -16
- molde/stylesheets/create_color_page.py +61 -61
- molde/stylesheets/mainwindow.ui +611 -611
- molde/stylesheets/qcheckbox.qss +18 -18
- molde/stylesheets/qinputs.qss +78 -78
- molde/stylesheets/qlayouts.qss +22 -22
- molde/stylesheets/qmenubar.qss +12 -12
- molde/stylesheets/qprogressbar.qss +11 -11
- molde/stylesheets/qpushbutton.qss +90 -90
- molde/stylesheets/qradiobutton.qss +30 -30
- molde/stylesheets/qscrollbar.qss +29 -29
- molde/stylesheets/qslider.qss +61 -61
- molde/stylesheets/qtablewidget.qss +27 -27
- molde/stylesheets/qtabwidget.qss +29 -29
- molde/stylesheets/qtoolbar.qss +62 -62
- molde/stylesheets/qtoolbuttons.qss +14 -14
- molde/stylesheets/qtreewidget.qss +25 -25
- molde/ui_files/messages/new_loading_window.ui +73 -0
- molde/utils/__init__.py +8 -8
- molde/utils/format_sequences.py +44 -44
- molde/utils/poly_data_utils.py +24 -24
- molde/utils/tree_info.py +52 -52
- molde/windows/loading_window.py +189 -0
- {molde-0.1.1.dist-info → molde-0.1.2.dist-info}/METADATA +4 -2
- molde-0.1.2.dist-info/RECORD +69 -0
- {molde-0.1.1.dist-info → molde-0.1.2.dist-info}/WHEEL +1 -1
- molde-0.1.1.dist-info/RECORD +0 -62
molde/stylesheets/qslider.qss
CHANGED
@@ -1,61 +1,61 @@
|
|
1
|
-
QSlider:horizontal {
|
2
|
-
padding: 4px 0;
|
3
|
-
}
|
4
|
-
|
5
|
-
QSlider:vertical {
|
6
|
-
padding: 0 4px;
|
7
|
-
}
|
8
|
-
|
9
|
-
QSlider::groove {
|
10
|
-
border-radius: 10px;
|
11
|
-
}
|
12
|
-
|
13
|
-
QSlider::groove:horizontal {
|
14
|
-
height: 4px;
|
15
|
-
}
|
16
|
-
|
17
|
-
QSlider::groove:vertical {
|
18
|
-
width: 4px;
|
19
|
-
}
|
20
|
-
|
21
|
-
QSlider::sub-page:horizontal,
|
22
|
-
QSlider::add-page:vertical,
|
23
|
-
QSlider::handle {
|
24
|
-
background: @primary;
|
25
|
-
}
|
26
|
-
|
27
|
-
QSlider::sub-page:horizontal:disabled,
|
28
|
-
QSlider::add-page:vertical:disabled,
|
29
|
-
QSlider::handle:disabled {
|
30
|
-
background: @disabled-background;
|
31
|
-
}
|
32
|
-
|
33
|
-
QSlider::add-page:horizontal,
|
34
|
-
QSlider::sub-page:vertical {
|
35
|
-
background: @background-variant;
|
36
|
-
}
|
37
|
-
|
38
|
-
QSlider::handle:hover,
|
39
|
-
QSlider::handle:pressed {
|
40
|
-
background: @primary-lighter;
|
41
|
-
}
|
42
|
-
|
43
|
-
QSlider::handle:horizontal {
|
44
|
-
width: 16px;
|
45
|
-
height: 8px;
|
46
|
-
margin: -6px 0;
|
47
|
-
border-radius: 8px;
|
48
|
-
}
|
49
|
-
|
50
|
-
QSlider::handle:vertical {
|
51
|
-
width: 8px;
|
52
|
-
height: 16px;
|
53
|
-
margin: 0 -6px;
|
54
|
-
border-radius: 8px;
|
55
|
-
}
|
56
|
-
|
57
|
-
QSlider::disabled {
|
58
|
-
background-color: @background;
|
59
|
-
}
|
60
|
-
|
61
|
-
|
1
|
+
QSlider:horizontal {
|
2
|
+
padding: 4px 0;
|
3
|
+
}
|
4
|
+
|
5
|
+
QSlider:vertical {
|
6
|
+
padding: 0 4px;
|
7
|
+
}
|
8
|
+
|
9
|
+
QSlider::groove {
|
10
|
+
border-radius: 10px;
|
11
|
+
}
|
12
|
+
|
13
|
+
QSlider::groove:horizontal {
|
14
|
+
height: 4px;
|
15
|
+
}
|
16
|
+
|
17
|
+
QSlider::groove:vertical {
|
18
|
+
width: 4px;
|
19
|
+
}
|
20
|
+
|
21
|
+
QSlider::sub-page:horizontal,
|
22
|
+
QSlider::add-page:vertical,
|
23
|
+
QSlider::handle {
|
24
|
+
background: @primary;
|
25
|
+
}
|
26
|
+
|
27
|
+
QSlider::sub-page:horizontal:disabled,
|
28
|
+
QSlider::add-page:vertical:disabled,
|
29
|
+
QSlider::handle:disabled {
|
30
|
+
background: @disabled-background;
|
31
|
+
}
|
32
|
+
|
33
|
+
QSlider::add-page:horizontal,
|
34
|
+
QSlider::sub-page:vertical {
|
35
|
+
background: @background-variant;
|
36
|
+
}
|
37
|
+
|
38
|
+
QSlider::handle:hover,
|
39
|
+
QSlider::handle:pressed {
|
40
|
+
background: @primary-lighter;
|
41
|
+
}
|
42
|
+
|
43
|
+
QSlider::handle:horizontal {
|
44
|
+
width: 16px;
|
45
|
+
height: 8px;
|
46
|
+
margin: -6px 0;
|
47
|
+
border-radius: 8px;
|
48
|
+
}
|
49
|
+
|
50
|
+
QSlider::handle:vertical {
|
51
|
+
width: 8px;
|
52
|
+
height: 16px;
|
53
|
+
margin: 0 -6px;
|
54
|
+
border-radius: 8px;
|
55
|
+
}
|
56
|
+
|
57
|
+
QSlider::disabled {
|
58
|
+
background-color: @background;
|
59
|
+
}
|
60
|
+
|
61
|
+
|
@@ -1,27 +1,27 @@
|
|
1
|
-
QTableWidget:focus {
|
2
|
-
border: none;
|
3
|
-
}
|
4
|
-
|
5
|
-
QTableWidget::item {
|
6
|
-
background-color: none;
|
7
|
-
}
|
8
|
-
|
9
|
-
QTableWidget::item:selected {
|
10
|
-
background-color: @primary;
|
11
|
-
color: @on-primary;
|
12
|
-
}
|
13
|
-
|
14
|
-
QHeaderView::section {
|
15
|
-
background-color: @background-variant;
|
16
|
-
border: 1px solid @border-color;
|
17
|
-
}
|
18
|
-
|
19
|
-
QHeaderView::section:on:enabled {
|
20
|
-
color: @primary;
|
21
|
-
}
|
22
|
-
|
23
|
-
QTableCornerButton::section {
|
24
|
-
background-color: @background-variant;
|
25
|
-
padding: 5px 5px;
|
26
|
-
border: 1px solid @border-color;
|
27
|
-
}
|
1
|
+
QTableWidget:focus {
|
2
|
+
border: none;
|
3
|
+
}
|
4
|
+
|
5
|
+
QTableWidget::item {
|
6
|
+
background-color: none;
|
7
|
+
}
|
8
|
+
|
9
|
+
QTableWidget::item:selected {
|
10
|
+
background-color: @primary;
|
11
|
+
color: @on-primary;
|
12
|
+
}
|
13
|
+
|
14
|
+
QHeaderView::section {
|
15
|
+
background-color: @background-variant;
|
16
|
+
border: 1px solid @border-color;
|
17
|
+
}
|
18
|
+
|
19
|
+
QHeaderView::section:on:enabled {
|
20
|
+
color: @primary;
|
21
|
+
}
|
22
|
+
|
23
|
+
QTableCornerButton::section {
|
24
|
+
background-color: @background-variant;
|
25
|
+
padding: 5px 5px;
|
26
|
+
border: 1px solid @border-color;
|
27
|
+
}
|
molde/stylesheets/qtabwidget.qss
CHANGED
@@ -1,30 +1,30 @@
|
|
1
|
-
QTabWidget::pane {
|
2
|
-
border: 1px solid @border-color;
|
3
|
-
background-color: @background-variant;
|
4
|
-
top:-1px;
|
5
|
-
}
|
6
|
-
|
7
|
-
QTabBar::tab {
|
8
|
-
background: @background-variant;
|
9
|
-
padding: 10px;
|
10
|
-
border: 1px solid @border-color;
|
11
|
-
}
|
12
|
-
|
13
|
-
QTabBar::tab:selected {
|
14
|
-
background: @background;
|
15
|
-
margin-bottom: -1px;
|
16
|
-
}
|
17
|
-
|
18
|
-
QTabBar::tab:hover {
|
19
|
-
background: @border-color;
|
20
|
-
}
|
21
|
-
|
22
|
-
QTabBar::tab:focus {
|
23
|
-
border: 2px solid @primary-darker;
|
24
|
-
border-bottom: 3px solid @primary-darker;
|
25
|
-
/* background-color: @primary; */
|
26
|
-
}
|
27
|
-
|
28
|
-
QTabWidget::pane:focus {
|
29
|
-
background-color: red;
|
1
|
+
QTabWidget::pane {
|
2
|
+
border: 1px solid @border-color;
|
3
|
+
background-color: @background-variant;
|
4
|
+
top:-1px;
|
5
|
+
}
|
6
|
+
|
7
|
+
QTabBar::tab {
|
8
|
+
background: @background-variant;
|
9
|
+
padding: 10px;
|
10
|
+
border: 1px solid @border-color;
|
11
|
+
}
|
12
|
+
|
13
|
+
QTabBar::tab:selected {
|
14
|
+
background: @background;
|
15
|
+
margin-bottom: -1px;
|
16
|
+
}
|
17
|
+
|
18
|
+
QTabBar::tab:hover {
|
19
|
+
background: @border-color;
|
20
|
+
}
|
21
|
+
|
22
|
+
QTabBar::tab:focus {
|
23
|
+
border: 2px solid @primary-darker;
|
24
|
+
border-bottom: 3px solid @primary-darker;
|
25
|
+
/* background-color: @primary; */
|
26
|
+
}
|
27
|
+
|
28
|
+
QTabWidget::pane:focus {
|
29
|
+
background-color: red;
|
30
30
|
}
|
molde/stylesheets/qtoolbar.qss
CHANGED
@@ -1,62 +1,62 @@
|
|
1
|
-
QToolBar {
|
2
|
-
padding: 1px;
|
3
|
-
spacing: 2px;
|
4
|
-
margin: 1px;
|
5
|
-
}
|
6
|
-
|
7
|
-
QToolBar::separator {
|
8
|
-
background-color: @background-variant;
|
9
|
-
}
|
10
|
-
|
11
|
-
QToolBar::separator:horizontal {
|
12
|
-
width: 2px;
|
13
|
-
margin: 0 6px;
|
14
|
-
}
|
15
|
-
|
16
|
-
QToolBar::separator:vertical {
|
17
|
-
height: 2px;
|
18
|
-
margin: 6px 0;
|
19
|
-
}
|
20
|
-
|
21
|
-
QToolBar QLineEdit {
|
22
|
-
padding: 3px 4px;
|
23
|
-
border: 1px solid @background-variant;
|
24
|
-
border-radius: @border-radius;
|
25
|
-
background-color: @input-color;
|
26
|
-
height: 15px;
|
27
|
-
}
|
28
|
-
|
29
|
-
QToolBar QPushButton,
|
30
|
-
QToolBar QComboBox {
|
31
|
-
height: 15px;
|
32
|
-
}
|
33
|
-
|
34
|
-
/* QToolBar QLineEdit:disabled {
|
35
|
-
background-color: @disabled-color;
|
36
|
-
color: rgb(100, 100, 100)
|
37
|
-
}
|
38
|
-
*/
|
39
|
-
|
40
|
-
QToolBar QSlider:disabled {
|
41
|
-
background-color: @disabled-background;
|
42
|
-
}
|
43
|
-
|
44
|
-
QToolBar QPushButton {
|
45
|
-
min-width: 0px;
|
46
|
-
}
|
47
|
-
|
48
|
-
QToolBar QLabel {
|
49
|
-
margin: 2px;
|
50
|
-
}
|
51
|
-
|
52
|
-
QToolBar QSlider::sub-page:vertical:disabled,
|
53
|
-
QToolBar QSlider::add-page:horizontal:disabled,
|
54
|
-
QToolBar QSlider::handle:disabled {
|
55
|
-
background: @disabled-color;
|
56
|
-
}
|
57
|
-
|
58
|
-
QToolBar QFrame::disabled {
|
59
|
-
background: @disabled-background;
|
60
|
-
}
|
61
|
-
|
62
|
-
|
1
|
+
QToolBar {
|
2
|
+
padding: 1px;
|
3
|
+
spacing: 2px;
|
4
|
+
margin: 1px;
|
5
|
+
}
|
6
|
+
|
7
|
+
QToolBar::separator {
|
8
|
+
background-color: @background-variant;
|
9
|
+
}
|
10
|
+
|
11
|
+
QToolBar::separator:horizontal {
|
12
|
+
width: 2px;
|
13
|
+
margin: 0 6px;
|
14
|
+
}
|
15
|
+
|
16
|
+
QToolBar::separator:vertical {
|
17
|
+
height: 2px;
|
18
|
+
margin: 6px 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
QToolBar QLineEdit {
|
22
|
+
padding: 3px 4px;
|
23
|
+
border: 1px solid @background-variant;
|
24
|
+
border-radius: @border-radius;
|
25
|
+
background-color: @input-color;
|
26
|
+
height: 15px;
|
27
|
+
}
|
28
|
+
|
29
|
+
QToolBar QPushButton,
|
30
|
+
QToolBar QComboBox {
|
31
|
+
height: 15px;
|
32
|
+
}
|
33
|
+
|
34
|
+
/* QToolBar QLineEdit:disabled {
|
35
|
+
background-color: @disabled-color;
|
36
|
+
color: rgb(100, 100, 100)
|
37
|
+
}
|
38
|
+
*/
|
39
|
+
|
40
|
+
QToolBar QSlider:disabled {
|
41
|
+
background-color: @disabled-background;
|
42
|
+
}
|
43
|
+
|
44
|
+
QToolBar QPushButton {
|
45
|
+
min-width: 0px;
|
46
|
+
}
|
47
|
+
|
48
|
+
QToolBar QLabel {
|
49
|
+
margin: 2px;
|
50
|
+
}
|
51
|
+
|
52
|
+
QToolBar QSlider::sub-page:vertical:disabled,
|
53
|
+
QToolBar QSlider::add-page:horizontal:disabled,
|
54
|
+
QToolBar QSlider::handle:disabled {
|
55
|
+
background: @disabled-color;
|
56
|
+
}
|
57
|
+
|
58
|
+
QToolBar QFrame::disabled {
|
59
|
+
background: @disabled-background;
|
60
|
+
}
|
61
|
+
|
62
|
+
|
@@ -1,14 +1,14 @@
|
|
1
|
-
QToolButton{
|
2
|
-
padding: 4px;
|
3
|
-
border: none;
|
4
|
-
margin: 1px;
|
5
|
-
spacing: 10px;
|
6
|
-
border-radius: @border-radius;
|
7
|
-
}
|
8
|
-
|
9
|
-
QToolButton:hover,
|
10
|
-
QToolButton::menu-button:hover,
|
11
|
-
QToolButton::checked {
|
12
|
-
background: @background-variant;
|
13
|
-
border-radius: @border-radius;
|
14
|
-
}
|
1
|
+
QToolButton{
|
2
|
+
padding: 4px;
|
3
|
+
border: none;
|
4
|
+
margin: 1px;
|
5
|
+
spacing: 10px;
|
6
|
+
border-radius: @border-radius;
|
7
|
+
}
|
8
|
+
|
9
|
+
QToolButton:hover,
|
10
|
+
QToolButton::menu-button:hover,
|
11
|
+
QToolButton::checked {
|
12
|
+
background: @background-variant;
|
13
|
+
border-radius: @border-radius;
|
14
|
+
}
|
@@ -1,25 +1,25 @@
|
|
1
|
-
QTreeView {
|
2
|
-
background-color: @background;
|
3
|
-
alternate-background-color: @background-variant;
|
4
|
-
}
|
5
|
-
|
6
|
-
QTreeView::branch:!selected:hover,
|
7
|
-
QTreeView::item:!selected:hover {
|
8
|
-
background-color: @primary-lighter;
|
9
|
-
color: @on-primary;
|
10
|
-
}
|
11
|
-
|
12
|
-
QTreeView::item:selected {
|
13
|
-
background-color: @primary;
|
14
|
-
border: 1px solid @border-color;
|
15
|
-
color: @on-primary;
|
16
|
-
}
|
17
|
-
|
18
|
-
QTreeWidget::branch:has-children:open {
|
19
|
-
background-image: url("@arrow-down-image-icon");
|
20
|
-
}
|
21
|
-
|
22
|
-
QTreeWidget::branch:has-children:closed {
|
23
|
-
background-image: url("@arrow-right-image-icon");
|
24
|
-
}
|
25
|
-
|
1
|
+
QTreeView {
|
2
|
+
background-color: @background;
|
3
|
+
alternate-background-color: @background-variant;
|
4
|
+
}
|
5
|
+
|
6
|
+
QTreeView::branch:!selected:hover,
|
7
|
+
QTreeView::item:!selected:hover {
|
8
|
+
background-color: @primary-lighter;
|
9
|
+
color: @on-primary;
|
10
|
+
}
|
11
|
+
|
12
|
+
QTreeView::item:selected {
|
13
|
+
background-color: @primary;
|
14
|
+
border: 1px solid @border-color;
|
15
|
+
color: @on-primary;
|
16
|
+
}
|
17
|
+
|
18
|
+
QTreeWidget::branch:has-children:open {
|
19
|
+
background-image: url("@arrow-down-image-icon");
|
20
|
+
}
|
21
|
+
|
22
|
+
QTreeWidget::branch:has-children:closed {
|
23
|
+
background-image: url("@arrow-right-image-icon");
|
24
|
+
}
|
25
|
+
|
@@ -0,0 +1,73 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<ui version="4.0">
|
3
|
+
<class>loading_window</class>
|
4
|
+
<widget class="QWidget" name="loading_window">
|
5
|
+
<property name="windowModality">
|
6
|
+
<enum>Qt::ApplicationModal</enum>
|
7
|
+
</property>
|
8
|
+
<property name="geometry">
|
9
|
+
<rect>
|
10
|
+
<x>0</x>
|
11
|
+
<y>0</y>
|
12
|
+
<width>377</width>
|
13
|
+
<height>145</height>
|
14
|
+
</rect>
|
15
|
+
</property>
|
16
|
+
<property name="windowTitle">
|
17
|
+
<string>Loading Window</string>
|
18
|
+
</property>
|
19
|
+
<layout class="QVBoxLayout" name="verticalLayout">
|
20
|
+
<item>
|
21
|
+
<spacer name="verticalSpacer_2">
|
22
|
+
<property name="orientation">
|
23
|
+
<enum>Qt::Vertical</enum>
|
24
|
+
</property>
|
25
|
+
<property name="sizeHint" stdset="0">
|
26
|
+
<size>
|
27
|
+
<width>20</width>
|
28
|
+
<height>40</height>
|
29
|
+
</size>
|
30
|
+
</property>
|
31
|
+
</spacer>
|
32
|
+
</item>
|
33
|
+
<item>
|
34
|
+
<widget class="QLabel" name="progress_label">
|
35
|
+
<property name="text">
|
36
|
+
<string>Loading ...</string>
|
37
|
+
</property>
|
38
|
+
<property name="alignment">
|
39
|
+
<set>Qt::AlignCenter</set>
|
40
|
+
</property>
|
41
|
+
</widget>
|
42
|
+
</item>
|
43
|
+
<item>
|
44
|
+
<widget class="QProgressBar" name="progress_bar">
|
45
|
+
<property name="value">
|
46
|
+
<number>10</number>
|
47
|
+
</property>
|
48
|
+
<property name="textVisible">
|
49
|
+
<bool>true</bool>
|
50
|
+
</property>
|
51
|
+
<property name="textDirection">
|
52
|
+
<enum>QProgressBar::TopToBottom</enum>
|
53
|
+
</property>
|
54
|
+
</widget>
|
55
|
+
</item>
|
56
|
+
<item>
|
57
|
+
<spacer name="verticalSpacer">
|
58
|
+
<property name="orientation">
|
59
|
+
<enum>Qt::Vertical</enum>
|
60
|
+
</property>
|
61
|
+
<property name="sizeHint" stdset="0">
|
62
|
+
<size>
|
63
|
+
<width>20</width>
|
64
|
+
<height>40</height>
|
65
|
+
</size>
|
66
|
+
</property>
|
67
|
+
</spacer>
|
68
|
+
</item>
|
69
|
+
</layout>
|
70
|
+
</widget>
|
71
|
+
<resources/>
|
72
|
+
<connections/>
|
73
|
+
</ui>
|
molde/utils/__init__.py
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
from .format_sequences import format_long_sequence
|
2
|
-
from .poly_data_utils import set_polydata_colors, set_polydata_property
|
3
|
-
from .tree_info import TreeInfo
|
4
|
-
|
5
|
-
|
6
|
-
from collections import defaultdict
|
7
|
-
def nested_dict() -> defaultdict:
|
8
|
-
return defaultdict(nested_dict)
|
1
|
+
from .format_sequences import format_long_sequence
|
2
|
+
from .poly_data_utils import set_polydata_colors, set_polydata_property
|
3
|
+
from .tree_info import TreeInfo
|
4
|
+
|
5
|
+
|
6
|
+
from collections import defaultdict
|
7
|
+
def nested_dict() -> defaultdict:
|
8
|
+
return defaultdict(nested_dict)
|
molde/utils/format_sequences.py
CHANGED
@@ -1,44 +1,44 @@
|
|
1
|
-
from math import ceil, floor
|
2
|
-
|
3
|
-
|
4
|
-
def format_long_sequence(
|
5
|
-
sequence, max_width=30, max_lines=3, item_separator=", ", identation="► "
|
6
|
-
):
|
7
|
-
strings = [str(i) for i in sequence]
|
8
|
-
|
9
|
-
initial_lines = []
|
10
|
-
for _ in range(ceil(max_lines / 2)):
|
11
|
-
new_line = _extract_line(strings, max_width, len(item_separator))
|
12
|
-
if not new_line:
|
13
|
-
break
|
14
|
-
initial_lines.append(new_line)
|
15
|
-
strings = strings[len(new_line) :]
|
16
|
-
|
17
|
-
strings.reverse()
|
18
|
-
final_lines = []
|
19
|
-
for _ in range(floor(max_lines / 2)):
|
20
|
-
new_line = _extract_line(strings, max_width, len(item_separator))
|
21
|
-
if not new_line:
|
22
|
-
break
|
23
|
-
final_lines.append(new_line)
|
24
|
-
strings = strings[len(new_line) :]
|
25
|
-
final_lines.reverse()
|
26
|
-
|
27
|
-
if strings and initial_lines:
|
28
|
-
initial_lines[-1] = ["..."]
|
29
|
-
lines = initial_lines + final_lines
|
30
|
-
|
31
|
-
formated_lines = [item_separator.join(line) for line in lines]
|
32
|
-
concatenated_lines = identation + f"\n{identation}".join(formated_lines)
|
33
|
-
return concatenated_lines
|
34
|
-
|
35
|
-
|
36
|
-
def _extract_line(strings, max_width, separator_size):
|
37
|
-
line = []
|
38
|
-
current_width = 0
|
39
|
-
for string in strings:
|
40
|
-
if len(string) + current_width + separator_size > max_width:
|
41
|
-
break
|
42
|
-
line.append(string)
|
43
|
-
current_width += len(string) + separator_size
|
44
|
-
return line
|
1
|
+
from math import ceil, floor
|
2
|
+
|
3
|
+
|
4
|
+
def format_long_sequence(
|
5
|
+
sequence, max_width=30, max_lines=3, item_separator=", ", identation="► "
|
6
|
+
):
|
7
|
+
strings = [str(i) for i in sequence]
|
8
|
+
|
9
|
+
initial_lines = []
|
10
|
+
for _ in range(ceil(max_lines / 2)):
|
11
|
+
new_line = _extract_line(strings, max_width, len(item_separator))
|
12
|
+
if not new_line:
|
13
|
+
break
|
14
|
+
initial_lines.append(new_line)
|
15
|
+
strings = strings[len(new_line) :]
|
16
|
+
|
17
|
+
strings.reverse()
|
18
|
+
final_lines = []
|
19
|
+
for _ in range(floor(max_lines / 2)):
|
20
|
+
new_line = _extract_line(strings, max_width, len(item_separator))
|
21
|
+
if not new_line:
|
22
|
+
break
|
23
|
+
final_lines.append(new_line)
|
24
|
+
strings = strings[len(new_line) :]
|
25
|
+
final_lines.reverse()
|
26
|
+
|
27
|
+
if strings and initial_lines:
|
28
|
+
initial_lines[-1] = ["..."]
|
29
|
+
lines = initial_lines + final_lines
|
30
|
+
|
31
|
+
formated_lines = [item_separator.join(line) for line in lines]
|
32
|
+
concatenated_lines = identation + f"\n{identation}".join(formated_lines)
|
33
|
+
return concatenated_lines
|
34
|
+
|
35
|
+
|
36
|
+
def _extract_line(strings, max_width, separator_size):
|
37
|
+
line = []
|
38
|
+
current_width = 0
|
39
|
+
for string in strings:
|
40
|
+
if len(string) + current_width + separator_size > max_width:
|
41
|
+
break
|
42
|
+
line.append(string)
|
43
|
+
current_width += len(string) + separator_size
|
44
|
+
return line
|
molde/utils/poly_data_utils.py
CHANGED
@@ -1,25 +1,25 @@
|
|
1
|
-
from vtkmodules.vtkCommonCore import vtkUnsignedCharArray, vtkUnsignedIntArray
|
2
|
-
from vtkmodules.vtkCommonDataModel import vtkPolyData
|
3
|
-
|
4
|
-
|
5
|
-
def set_polydata_colors(data: vtkPolyData, color: tuple) -> vtkUnsignedCharArray:
|
6
|
-
n_cells = data.GetNumberOfCells()
|
7
|
-
cell_colors = vtkUnsignedCharArray()
|
8
|
-
cell_colors.SetName("colors")
|
9
|
-
cell_colors.SetNumberOfComponents(3)
|
10
|
-
cell_colors.SetNumberOfTuples(n_cells)
|
11
|
-
cell_colors.FillComponent(0, color[0])
|
12
|
-
cell_colors.FillComponent(1, color[1])
|
13
|
-
cell_colors.FillComponent(2, color[2])
|
14
|
-
data.GetCellData().SetScalars(cell_colors)
|
15
|
-
return cell_colors
|
16
|
-
|
17
|
-
|
18
|
-
def set_polydata_property(data: vtkPolyData, property_data: int, property_name: str) -> vtkUnsignedIntArray:
|
19
|
-
n_cells = data.GetNumberOfCells()
|
20
|
-
cell_identifier = vtkUnsignedIntArray()
|
21
|
-
cell_identifier.SetName(property_name)
|
22
|
-
cell_identifier.SetNumberOfTuples(n_cells)
|
23
|
-
cell_identifier.Fill(property_data)
|
24
|
-
data.GetCellData().AddArray(cell_identifier)
|
1
|
+
from vtkmodules.vtkCommonCore import vtkUnsignedCharArray, vtkUnsignedIntArray
|
2
|
+
from vtkmodules.vtkCommonDataModel import vtkPolyData
|
3
|
+
|
4
|
+
|
5
|
+
def set_polydata_colors(data: vtkPolyData, color: tuple) -> vtkUnsignedCharArray:
|
6
|
+
n_cells = data.GetNumberOfCells()
|
7
|
+
cell_colors = vtkUnsignedCharArray()
|
8
|
+
cell_colors.SetName("colors")
|
9
|
+
cell_colors.SetNumberOfComponents(3)
|
10
|
+
cell_colors.SetNumberOfTuples(n_cells)
|
11
|
+
cell_colors.FillComponent(0, color[0])
|
12
|
+
cell_colors.FillComponent(1, color[1])
|
13
|
+
cell_colors.FillComponent(2, color[2])
|
14
|
+
data.GetCellData().SetScalars(cell_colors)
|
15
|
+
return cell_colors
|
16
|
+
|
17
|
+
|
18
|
+
def set_polydata_property(data: vtkPolyData, property_data: int, property_name: str) -> vtkUnsignedIntArray:
|
19
|
+
n_cells = data.GetNumberOfCells()
|
20
|
+
cell_identifier = vtkUnsignedIntArray()
|
21
|
+
cell_identifier.SetName(property_name)
|
22
|
+
cell_identifier.SetNumberOfTuples(n_cells)
|
23
|
+
cell_identifier.Fill(property_data)
|
24
|
+
data.GetCellData().AddArray(cell_identifier)
|
25
25
|
return cell_identifier
|