molde 0.1.12__py3-none-any.whl → 0.1.14__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.
Files changed (52) hide show
  1. molde/__init__.py +12 -12
  2. molde/__main__.py +81 -81
  3. molde/actors/__init__.py +5 -5
  4. molde/actors/common_symbols_actor.py +148 -148
  5. molde/actors/ghost_actor.py +12 -12
  6. molde/actors/lines_actor.py +31 -31
  7. molde/actors/round_points_actor.py +7 -7
  8. molde/actors/square_points_actor.py +32 -32
  9. molde/colors/__init__.py +1 -1
  10. molde/colors/color.py +273 -150
  11. molde/colors/color_names.py +124 -124
  12. molde/interactor_styles/__init__.py +2 -2
  13. molde/interactor_styles/arcball_camera_style.py +288 -288
  14. molde/interactor_styles/box_selection_style.py +87 -87
  15. molde/main_window.ui +864 -864
  16. molde/pickers/__init__.py +2 -2
  17. molde/pickers/cell_area_picker.py +61 -61
  18. molde/pickers/cell_property_area_picker.py +84 -84
  19. molde/poly_data/__init__.py +13 -13
  20. molde/poly_data/lines_data.py +23 -23
  21. molde/poly_data/vertices_data.py +24 -24
  22. molde/render_widgets/__init__.py +2 -2
  23. molde/render_widgets/animated_render_widget.py +164 -164
  24. molde/render_widgets/common_render_widget.py +429 -429
  25. molde/stylesheets/__init__.py +122 -122
  26. molde/stylesheets/common.qss +15 -15
  27. molde/stylesheets/create_color_page.py +61 -61
  28. molde/stylesheets/mainwindow.ui +646 -646
  29. molde/stylesheets/qcheckbox.qss +23 -23
  30. molde/stylesheets/qinputs.qss +81 -81
  31. molde/stylesheets/qlayouts.qss +23 -23
  32. molde/stylesheets/qmenubar.qss +12 -12
  33. molde/stylesheets/qprogressbar.qss +11 -11
  34. molde/stylesheets/qpushbutton.qss +89 -89
  35. molde/stylesheets/qradiobutton.qss +30 -30
  36. molde/stylesheets/qscrollbar.qss +29 -29
  37. molde/stylesheets/qslider.qss +61 -61
  38. molde/stylesheets/qtablewidget.qss +27 -27
  39. molde/stylesheets/qtabwidget.qss +28 -28
  40. molde/stylesheets/qtoolbar.qss +63 -63
  41. molde/stylesheets/qtoolbuttons.qss +14 -14
  42. molde/stylesheets/qtreewidget.qss +25 -25
  43. molde/ui_files/messages/new_loading_window.ui +73 -73
  44. molde/utils/__init__.py +8 -8
  45. molde/utils/format_sequences.py +44 -44
  46. molde/utils/poly_data_utils.py +66 -66
  47. molde/utils/tree_info.py +52 -52
  48. molde/windows/loading_window.py +189 -189
  49. {molde-0.1.12.dist-info → molde-0.1.14.dist-info}/METADATA +1 -1
  50. molde-0.1.14.dist-info/RECORD +68 -0
  51. {molde-0.1.12.dist-info → molde-0.1.14.dist-info}/WHEEL +1 -1
  52. molde-0.1.12.dist-info/RECORD +0 -68
@@ -1,122 +1,122 @@
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_6.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_5.to_hex(),
24
- "@danger-color": color_names.RED_4.to_hex(),
25
- "@danger-color-darker": color_names.RED_2.to_hex(),
26
-
27
- "@warning-color-lighter": color_names.YELLOW_6.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_6.to_hex(),
58
- "@primary": color_names.BLUE_5.to_hex(),
59
- "@primary-darker": color_names.BLUE_4.to_hex(),
60
-
61
- "@danger-color-lighter": color_names.RED_5.to_hex(),
62
- "@danger-color": color_names.RED_4.to_hex(),
63
- "@danger-color-darker": color_names.RED_2.to_hex(),
64
-
65
- "@warning-color-lighter": color_names.YELLOW_6.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)
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_6.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_5.to_hex(),
24
+ "@danger-color": color_names.RED_4.to_hex(),
25
+ "@danger-color-darker": color_names.RED_2.to_hex(),
26
+
27
+ "@warning-color-lighter": color_names.YELLOW_6.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_6.to_hex(),
58
+ "@primary": color_names.BLUE_5.to_hex(),
59
+ "@primary-darker": color_names.BLUE_4.to_hex(),
60
+
61
+ "@danger-color-lighter": color_names.RED_5.to_hex(),
62
+ "@danger-color": color_names.RED_4.to_hex(),
63
+ "@danger-color-darker": color_names.RED_2.to_hex(),
64
+
65
+ "@warning-color-lighter": color_names.YELLOW_6.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)
@@ -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;
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
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&nbsp;\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&nbsp;\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)