molde 0.1.3__py3-none-any.whl → 0.1.5__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 +12 -6
- molde/__main__.py +77 -74
- molde/actors/__init__.py +5 -5
- molde/actors/common_symbols_actor.py +164 -164
- 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 +150 -120
- molde/colors/color_names.py +124 -124
- molde/interactor_styles/__init__.py +2 -2
- molde/interactor_styles/arcball_camera_style.py +288 -288
- molde/interactor_styles/box_selection_style.py +87 -70
- molde/main_window.ui +864 -864
- 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 +13 -13
- molde/poly_data/lines_data.py +23 -23
- 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 +429 -433
- molde/stylesheets/__init__.py +122 -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 +23 -18
- molde/stylesheets/qinputs.qss +81 -78
- molde/stylesheets/qlayouts.qss +23 -22
- molde/stylesheets/qmenubar.qss +12 -12
- molde/stylesheets/qprogressbar.qss +11 -11
- molde/stylesheets/qpushbutton.qss +91 -91
- 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 +28 -29
- molde/stylesheets/qtoolbar.qss +52 -62
- molde/stylesheets/qtoolbuttons.qss +14 -14
- molde/stylesheets/qtreewidget.qss +25 -25
- molde/ui_files/messages/new_loading_window.ui +73 -73
- molde/utils/__init__.py +8 -8
- molde/utils/format_sequences.py +44 -44
- molde/utils/poly_data_utils.py +66 -66
- molde/utils/tree_info.py +52 -52
- molde/windows/loading_window.py +189 -189
- {molde-0.1.3.dist-info → molde-0.1.5.dist-info}/METADATA +6 -4
- molde-0.1.5.dist-info/RECORD +68 -0
- {molde-0.1.3.dist-info → molde-0.1.5.dist-info}/WHEEL +1 -1
- molde-0.1.3.dist-info/RECORD +0 -68
molde/stylesheets/__init__.py
CHANGED
@@ -1,119 +1,122 @@
|
|
1
|
-
from typing import Literal
|
2
|
-
from
|
3
|
-
from molde import MOLDE_DIR
|
4
|
-
from molde.colors import color_names
|
5
|
-
|
6
|
-
|
7
|
-
def set_qproperty(widget: QWidget, **kwargs):
|
8
|
-
for key, val in kwargs.items():
|
9
|
-
widget.setProperty(key, val)
|
10
|
-
widget.style().polish(widget)
|
11
|
-
|
12
|
-
def get_variables(theme:Literal["light", "dark"] = "light") -> dict:
|
13
|
-
variables = {
|
14
|
-
"@border-radius": "5px",
|
15
|
-
}
|
16
|
-
|
17
|
-
if theme == "light":
|
18
|
-
variables.update({
|
19
|
-
"@primary-lighter": color_names.BLUE_7.to_hex(),
|
20
|
-
"@primary": color_names.BLUE_4.to_hex(),
|
21
|
-
"@primary-darker": color_names.BLUE_3.to_hex(),
|
22
|
-
|
23
|
-
"@danger-color-lighter": color_names.RED_7.to_hex(),
|
24
|
-
"@danger-color": color_names.RED_4.to_hex(),
|
25
|
-
"@danger-color-darker": color_names.RED_3.to_hex(),
|
26
|
-
|
27
|
-
"@warning-color-lighter": color_names.YELLOW_7.to_hex(),
|
28
|
-
"@warning-color": color_names.YELLOW_4.to_hex(),
|
29
|
-
"@warning-color-darker": color_names.YELLOW_3.to_hex(),
|
30
|
-
|
31
|
-
"@background": color_names.GRAY_9.to_hex(),
|
32
|
-
"@background-variant": color_names.GRAY_8.to_hex(),
|
33
|
-
|
34
|
-
"@
|
35
|
-
"@on-
|
36
|
-
|
37
|
-
|
38
|
-
"@border-color": color_names.
|
39
|
-
"@input-color": color_names.
|
40
|
-
|
41
|
-
"@disabled-background": color_names.GRAY_8.to_hex(),
|
42
|
-
"@disabled-color": color_names.GRAY_7.to_hex(),
|
43
|
-
|
44
|
-
|
45
|
-
"@arrow-
|
46
|
-
"@arrow-
|
47
|
-
"@arrow-
|
48
|
-
"@arrow-
|
49
|
-
"@
|
50
|
-
"@
|
51
|
-
"@arrow-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
"@primary": color_names.
|
58
|
-
"@primary
|
59
|
-
|
60
|
-
|
61
|
-
"@danger-color": color_names.
|
62
|
-
"@danger-color
|
63
|
-
|
64
|
-
|
65
|
-
"@warning-color": color_names.
|
66
|
-
"@warning-color
|
67
|
-
|
68
|
-
|
69
|
-
"@background
|
70
|
-
|
71
|
-
|
72
|
-
"@on-
|
73
|
-
|
74
|
-
|
75
|
-
"@
|
76
|
-
|
77
|
-
"@
|
78
|
-
|
79
|
-
|
80
|
-
"@
|
81
|
-
"@
|
82
|
-
|
83
|
-
"@arrow-
|
84
|
-
"@arrow-
|
85
|
-
"@
|
86
|
-
"@arrow-
|
87
|
-
"@arrow-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
all_stylesheets
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
1
|
+
from typing import Literal
|
2
|
+
from qtpy.QtWidgets import QApplication, QWidget
|
3
|
+
from molde import MOLDE_DIR
|
4
|
+
from molde.colors import color_names
|
5
|
+
|
6
|
+
|
7
|
+
def set_qproperty(widget: QWidget, **kwargs):
|
8
|
+
for key, val in kwargs.items():
|
9
|
+
widget.setProperty(key, val)
|
10
|
+
widget.style().polish(widget)
|
11
|
+
|
12
|
+
def get_variables(theme:Literal["light", "dark"] = "light") -> dict:
|
13
|
+
variables = {
|
14
|
+
"@border-radius": "5px",
|
15
|
+
}
|
16
|
+
|
17
|
+
if theme == "light":
|
18
|
+
variables.update({
|
19
|
+
"@primary-lighter": color_names.BLUE_7.to_hex(),
|
20
|
+
"@primary": color_names.BLUE_4.to_hex(),
|
21
|
+
"@primary-darker": color_names.BLUE_3.to_hex(),
|
22
|
+
|
23
|
+
"@danger-color-lighter": color_names.RED_7.to_hex(),
|
24
|
+
"@danger-color": color_names.RED_4.to_hex(),
|
25
|
+
"@danger-color-darker": color_names.RED_3.to_hex(),
|
26
|
+
|
27
|
+
"@warning-color-lighter": color_names.YELLOW_7.to_hex(),
|
28
|
+
"@warning-color": color_names.YELLOW_4.to_hex(),
|
29
|
+
"@warning-color-darker": color_names.YELLOW_3.to_hex(),
|
30
|
+
|
31
|
+
"@background": color_names.GRAY_9.to_hex(),
|
32
|
+
"@background-variant": color_names.GRAY_8.to_hex(),
|
33
|
+
|
34
|
+
"@on-primary": color_names.WHITE.to_hex(),
|
35
|
+
"@on-background": color_names.BLACK.to_hex(),
|
36
|
+
|
37
|
+
"@border-color": color_names.GRAY_7.to_hex(),
|
38
|
+
"@checkbox-border-color": color_names.GRAY_6.to_hex(),
|
39
|
+
"@input-color": color_names.GRAY_8.to_hex(),
|
40
|
+
|
41
|
+
"@disabled-background": color_names.GRAY_8.to_hex(),
|
42
|
+
"@disabled-color": color_names.GRAY_7.to_hex(),
|
43
|
+
"@alternative-disabled-background" : color_names.GRAY_6.to_hex(),
|
44
|
+
|
45
|
+
"@hover-arrow-color": color_names.GRAY_8.to_hex(),
|
46
|
+
"@arrow-up-image-icon": str(MOLDE_DIR / "icons/arrow_up_light_theme.svg").replace("\\", "/"),
|
47
|
+
"@arrow-down-image-icon": str(MOLDE_DIR/ "icons/arrow_down_light_theme.svg").replace("\\", "/"),
|
48
|
+
"@arrow-left-image-icon": str(MOLDE_DIR/ "icons/arrow_left_light_theme.svg").replace("\\", "/"),
|
49
|
+
"@arrow-right-image-icon": str(MOLDE_DIR/ "icons/arrow_right_light_theme.svg").replace("\\", "/"),
|
50
|
+
"@check-box-image-icon": str(MOLDE_DIR / "icons/check_box_image.svg").replace("\\", "/"),
|
51
|
+
"@arrow-up-disabled-image-icon" : str(MOLDE_DIR / "icons/arrow_up_disabled_light_theme.svg").replace("\\", "/"),
|
52
|
+
"@arrow-down-disabled-image-icon" : str(MOLDE_DIR / "icons/arrow_down_disabled_light_theme.svg").replace("\\", "/"),
|
53
|
+
})
|
54
|
+
|
55
|
+
elif theme == "dark":
|
56
|
+
variables.update({
|
57
|
+
"@primary-lighter": color_names.BLUE_7.to_hex(),
|
58
|
+
"@primary": color_names.BLUE_6.to_hex(),
|
59
|
+
"@primary-darker": color_names.BLUE_5.to_hex(),
|
60
|
+
|
61
|
+
"@danger-color-lighter": color_names.RED_7.to_hex(),
|
62
|
+
"@danger-color": color_names.RED_4.to_hex(),
|
63
|
+
"@danger-color-darker": color_names.RED_3.to_hex(),
|
64
|
+
|
65
|
+
"@warning-color-lighter": color_names.YELLOW_7.to_hex(),
|
66
|
+
"@warning-color": color_names.YELLOW_4.to_hex(),
|
67
|
+
"@warning-color-darker": color_names.YELLOW_3.to_hex(),
|
68
|
+
|
69
|
+
"@background": color_names.GRAY_1.to_hex(),
|
70
|
+
"@background-variant": color_names.GRAY_3.to_hex(),
|
71
|
+
|
72
|
+
"@on-background": color_names.WHITE.to_hex(),
|
73
|
+
"@on-primary": color_names.WHITE.to_hex(),
|
74
|
+
|
75
|
+
"@border-color": color_names.GRAY_2.to_hex(),
|
76
|
+
"@checkbox-border-color": color_names.GRAY_4.to_hex(),
|
77
|
+
"@input-color": color_names.GRAY_3.to_hex(),
|
78
|
+
|
79
|
+
"@disabled-background": color_names.GRAY_0.to_hex(),
|
80
|
+
"@disabled-color": color_names.GRAY_4.to_hex(),
|
81
|
+
"@alternative-disabled-background" : color_names.GRAY_2.to_hex(),
|
82
|
+
|
83
|
+
"@hover-arrow-color": color_names.GRAY_1.to_hex(),
|
84
|
+
"@arrow-up-image-icon": str(MOLDE_DIR / "icons/arrow_up_dark_theme.svg").replace("\\", "/"),
|
85
|
+
"@arrow-down-image-icon": str(MOLDE_DIR / "icons/arrow_down_dark_theme.svg").replace("\\", "/"),
|
86
|
+
"@arrow-left-image-icon": str(MOLDE_DIR/ "icons/arrow_left_dark_theme.svg").replace("\\", "/"),
|
87
|
+
"@arrow-right-image-icon": str(MOLDE_DIR/ "icons/arrow_right_dark_theme.svg").replace("\\", "/"),
|
88
|
+
"@check-box-image-icon": str(MOLDE_DIR / "icons/check_box_image.svg").replace("\\", "/"),
|
89
|
+
"@arrow-up-disabled-image-icon" : str(MOLDE_DIR / "icons/arrow_up_disabled_light_theme.svg").replace("\\", "/"),
|
90
|
+
"@arrow-down-disabled-image-icon" : str(MOLDE_DIR / "icons/arrow_down_disabled_light_theme.svg").replace("\\", "/"),
|
91
|
+
|
92
|
+
})
|
93
|
+
|
94
|
+
return variables
|
95
|
+
|
96
|
+
def get_stylesheet(theme:Literal["light", "dark"] = "light", *, extra_style=""):
|
97
|
+
qss_dir = MOLDE_DIR / "stylesheets/"
|
98
|
+
|
99
|
+
all_stylesheets = []
|
100
|
+
for path in qss_dir.glob("*.qss"):
|
101
|
+
all_stylesheets.append(path.read_text())
|
102
|
+
all_stylesheets.append(extra_style)
|
103
|
+
stylesheet = "\n\n".join(all_stylesheets)
|
104
|
+
|
105
|
+
# Replace variables by correspondent data
|
106
|
+
variable_size = lambda x: len(x[0])
|
107
|
+
variables_mapping = sorted(get_variables(theme).items(),
|
108
|
+
key=variable_size, reverse=True)
|
109
|
+
for name, data in variables_mapping:
|
110
|
+
stylesheet = stylesheet.replace(name, data)
|
111
|
+
|
112
|
+
return stylesheet
|
113
|
+
|
114
|
+
def set_theme(theme=Literal["light", "dark"], *, extra_style=""):
|
115
|
+
|
116
|
+
app: QApplication | None = QApplication.instance()
|
117
|
+
if app is None:
|
118
|
+
print("Ops")
|
119
|
+
return
|
120
|
+
|
121
|
+
stylesheet = get_stylesheet(theme)
|
122
|
+
app.setStyleSheet(stylesheet)
|
molde/stylesheets/common.qss
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
QWidget {
|
2
|
-
font-family: sans-serif;
|
3
|
-
background-color: @background;
|
4
|
-
color: @on-background;
|
5
|
-
border-color: @border-color;
|
6
|
-
}
|
7
|
-
|
8
|
-
QWidget::disabled {
|
9
|
-
background-color: @disabled-background;
|
10
|
-
color: @disabled-color;
|
11
|
-
}
|
12
|
-
|
13
|
-
QWidget:focus {
|
14
|
-
outline: none;
|
15
|
-
border-color: @primary-darker;
|
16
|
-
}
|
1
|
+
QWidget {
|
2
|
+
font-family: sans-serif;
|
3
|
+
background-color: @background;
|
4
|
+
color: @on-background;
|
5
|
+
border-color: @border-color;
|
6
|
+
}
|
7
|
+
|
8
|
+
QWidget::disabled {
|
9
|
+
background-color: @disabled-background;
|
10
|
+
color: @disabled-color;
|
11
|
+
}
|
12
|
+
|
13
|
+
QWidget:focus {
|
14
|
+
outline: none;
|
15
|
+
border-color: @primary-darker;
|
16
|
+
}
|
@@ -1,61 +1,61 @@
|
|
1
|
-
from molde import MOLDE_DIR
|
2
|
-
from molde.utils import nested_dict
|
3
|
-
from molde.colors import color_names
|
4
|
-
|
5
|
-
|
6
|
-
colors_by_name = nested_dict()
|
7
|
-
for full_name, color in color_names.__dict__.items():
|
8
|
-
try:
|
9
|
-
name, level = full_name.split("_")
|
10
|
-
level = int(level)
|
11
|
-
colors_by_name[name][level] = color.to_hex()
|
12
|
-
except:
|
13
|
-
continue
|
14
|
-
|
15
|
-
page_body_list = []
|
16
|
-
for color_name, color_data in colors_by_name.items():
|
17
|
-
color_data: dict
|
18
|
-
palette_header = ""
|
19
|
-
html_palette_list = []
|
20
|
-
for color_level, color_code in sorted(color_data.items(), reverse=True):
|
21
|
-
if color_level == 4:
|
22
|
-
palette_header = (
|
23
|
-
f'<div class="colorblock" style="color:#ffffff; background:{color_code}">'
|
24
|
-
f'<b>{color_name.title()}</b>'
|
25
|
-
f'<b>{color_code}</b>'
|
26
|
-
'</div>'
|
27
|
-
)
|
28
|
-
txt_color = "#000000" if color_level >= 5 else "#FFFFFF"
|
29
|
-
block = (
|
30
|
-
f'<div class="colorblock" style="color:{txt_color}; background:{color_code}">'
|
31
|
-
f'<b>{color_level}</b>'
|
32
|
-
f'<b>{color_code}</b>'
|
33
|
-
'</div>'
|
34
|
-
)
|
35
|
-
html_palette_list.append(block)
|
36
|
-
|
37
|
-
html_palette_list = [palette_header] + html_palette_list
|
38
|
-
page_body_list.append("\n".join(html_palette_list))
|
39
|
-
|
40
|
-
page_header = '''<html>
|
41
|
-
<title>Molde Colors</title>
|
42
|
-
<style>
|
43
|
-
body{
|
44
|
-
font-family: sans-serif;
|
45
|
-
background-color: #000000;
|
46
|
-
}
|
47
|
-
div.colorblock {
|
48
|
-
display:flex;
|
49
|
-
justify-content:space-between;
|
50
|
-
padding: 0.75rem 1.5rem;
|
51
|
-
}
|
52
|
-
</style>
|
53
|
-
|
54
|
-
'''
|
55
|
-
|
56
|
-
page_body = "\n\n \n\n".join(page_body_list)
|
57
|
-
|
58
|
-
page_footer = "\n\n</html>"
|
59
|
-
|
60
|
-
path = MOLDE_DIR.parent / "docs/index.html"
|
61
|
-
path.write_text(page_header + page_body + page_footer)
|
1
|
+
from molde import MOLDE_DIR
|
2
|
+
from molde.utils import nested_dict
|
3
|
+
from molde.colors import color_names
|
4
|
+
|
5
|
+
|
6
|
+
colors_by_name = nested_dict()
|
7
|
+
for full_name, color in color_names.__dict__.items():
|
8
|
+
try:
|
9
|
+
name, level = full_name.split("_")
|
10
|
+
level = int(level)
|
11
|
+
colors_by_name[name][level] = color.to_hex()
|
12
|
+
except:
|
13
|
+
continue
|
14
|
+
|
15
|
+
page_body_list = []
|
16
|
+
for color_name, color_data in colors_by_name.items():
|
17
|
+
color_data: dict
|
18
|
+
palette_header = ""
|
19
|
+
html_palette_list = []
|
20
|
+
for color_level, color_code in sorted(color_data.items(), reverse=True):
|
21
|
+
if color_level == 4:
|
22
|
+
palette_header = (
|
23
|
+
f'<div class="colorblock" style="color:#ffffff; background:{color_code}">'
|
24
|
+
f'<b>{color_name.title()}</b>'
|
25
|
+
f'<b>{color_code}</b>'
|
26
|
+
'</div>'
|
27
|
+
)
|
28
|
+
txt_color = "#000000" if color_level >= 5 else "#FFFFFF"
|
29
|
+
block = (
|
30
|
+
f'<div class="colorblock" style="color:{txt_color}; background:{color_code}">'
|
31
|
+
f'<b>{color_level}</b>'
|
32
|
+
f'<b>{color_code}</b>'
|
33
|
+
'</div>'
|
34
|
+
)
|
35
|
+
html_palette_list.append(block)
|
36
|
+
|
37
|
+
html_palette_list = [palette_header] + html_palette_list
|
38
|
+
page_body_list.append("\n".join(html_palette_list))
|
39
|
+
|
40
|
+
page_header = '''<html>
|
41
|
+
<title>Molde Colors</title>
|
42
|
+
<style>
|
43
|
+
body{
|
44
|
+
font-family: sans-serif;
|
45
|
+
background-color: #000000;
|
46
|
+
}
|
47
|
+
div.colorblock {
|
48
|
+
display:flex;
|
49
|
+
justify-content:space-between;
|
50
|
+
padding: 0.75rem 1.5rem;
|
51
|
+
}
|
52
|
+
</style>
|
53
|
+
|
54
|
+
'''
|
55
|
+
|
56
|
+
page_body = "\n\n \n\n".join(page_body_list)
|
57
|
+
|
58
|
+
page_footer = "\n\n</html>"
|
59
|
+
|
60
|
+
path = MOLDE_DIR.parent / "docs/index.html"
|
61
|
+
path.write_text(page_header + page_body + page_footer)
|