CQ-editor 0.3.dev0__tar.gz → 0.4.0__tar.gz

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 (45) hide show
  1. {cq_editor-0.3.dev0 → cq_editor-0.4.0}/CQ_editor.egg-info/PKG-INFO +12 -8
  2. {cq_editor-0.3.dev0 → cq_editor-0.4.0}/CQ_editor.egg-info/requires.txt +2 -2
  3. {cq_editor-0.3.dev0 → cq_editor-0.4.0}/PKG-INFO +12 -8
  4. {cq_editor-0.3.dev0 → cq_editor-0.4.0}/README.md +9 -5
  5. {cq_editor-0.3.dev0 → cq_editor-0.4.0}/cq_editor/__main__.py +5 -5
  6. cq_editor-0.4.0/cq_editor/_version.py +1 -0
  7. {cq_editor-0.3.dev0 → cq_editor-0.4.0}/cq_editor/cq_utils.py +60 -41
  8. {cq_editor-0.3.dev0 → cq_editor-0.4.0}/cq_editor/cqe_run.py +5 -5
  9. cq_editor-0.4.0/cq_editor/icons.py +84 -0
  10. cq_editor-0.4.0/cq_editor/main_window.py +436 -0
  11. {cq_editor-0.3.dev0 → cq_editor-0.4.0}/cq_editor/mixins.py +29 -29
  12. cq_editor-0.4.0/cq_editor/preferences.py +96 -0
  13. cq_editor-0.4.0/cq_editor/utils.py +163 -0
  14. {cq_editor-0.3.dev0 → cq_editor-0.4.0}/cq_editor/widgets/console.py +19 -20
  15. {cq_editor-0.3.dev0 → cq_editor-0.4.0}/cq_editor/widgets/cq_object_inspector.py +67 -62
  16. {cq_editor-0.3.dev0 → cq_editor-0.4.0}/cq_editor/widgets/debugger.py +163 -139
  17. cq_editor-0.4.0/cq_editor/widgets/editor.py +321 -0
  18. cq_editor-0.4.0/cq_editor/widgets/log.py +62 -0
  19. cq_editor-0.4.0/cq_editor/widgets/object_tree.py +429 -0
  20. {cq_editor-0.3.dev0 → cq_editor-0.4.0}/cq_editor/widgets/occt_widget.py +80 -82
  21. cq_editor-0.4.0/cq_editor/widgets/traceback_viewer.py +111 -0
  22. cq_editor-0.4.0/cq_editor/widgets/viewer.py +468 -0
  23. {cq_editor-0.3.dev0 → cq_editor-0.4.0}/pyproject.toml +3 -3
  24. {cq_editor-0.3.dev0 → cq_editor-0.4.0}/setup.py +16 -11
  25. cq_editor-0.4.0/tests/test_app.py +1666 -0
  26. cq_editor-0.3.dev0/cq_editor/_version.py +0 -1
  27. cq_editor-0.3.dev0/cq_editor/icons.py +0 -59
  28. cq_editor-0.3.dev0/cq_editor/main_window.py +0 -349
  29. cq_editor-0.3.dev0/cq_editor/preferences.py +0 -62
  30. cq_editor-0.3.dev0/cq_editor/utils.py +0 -134
  31. cq_editor-0.3.dev0/cq_editor/widgets/editor.py +0 -304
  32. cq_editor-0.3.dev0/cq_editor/widgets/log.py +0 -60
  33. cq_editor-0.3.dev0/cq_editor/widgets/object_tree.py +0 -397
  34. cq_editor-0.3.dev0/cq_editor/widgets/traceback_viewer.py +0 -99
  35. cq_editor-0.3.dev0/cq_editor/widgets/viewer.py +0 -392
  36. cq_editor-0.3.dev0/tests/test_app.py +0 -1584
  37. {cq_editor-0.3.dev0 → cq_editor-0.4.0}/CQ_editor.egg-info/SOURCES.txt +0 -0
  38. {cq_editor-0.3.dev0 → cq_editor-0.4.0}/CQ_editor.egg-info/dependency_links.txt +0 -0
  39. {cq_editor-0.3.dev0 → cq_editor-0.4.0}/CQ_editor.egg-info/entry_points.txt +0 -0
  40. {cq_editor-0.3.dev0 → cq_editor-0.4.0}/CQ_editor.egg-info/top_level.txt +0 -0
  41. {cq_editor-0.3.dev0 → cq_editor-0.4.0}/LICENSE +0 -0
  42. {cq_editor-0.3.dev0 → cq_editor-0.4.0}/cq_editor/__init__.py +0 -0
  43. {cq_editor-0.3.dev0 → cq_editor-0.4.0}/cq_editor/icons_res.py +0 -0
  44. {cq_editor-0.3.dev0 → cq_editor-0.4.0}/cq_editor/widgets/__init__.py +0 -0
  45. {cq_editor-0.3.dev0 → cq_editor-0.4.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: CQ-editor
3
- Version: 0.3.dev0
3
+ Version: 0.4.0
4
4
  Summary: CadQuery plugin to create a mesh of an assembly with corresponding data
5
5
  Author: CadQuery Developers
6
6
  Maintainer: CadQuery Developers
@@ -216,11 +216,11 @@ Description-Content-Type: text/markdown
216
216
  License-File: LICENSE
217
217
  Requires-Dist: cadquery
218
218
  Requires-Dist: pyqtgraph
219
- Requires-Dist: spyder==5
219
+ Requires-Dist: spyder<6,>=5.5.6
220
220
  Requires-Dist: path
221
221
  Requires-Dist: logbook
222
222
  Requires-Dist: requests
223
- Requires-Dist: qtconsole==5.4.1
223
+ Requires-Dist: qtconsole<5.6.0,>=5.5.1
224
224
  Provides-Extra: test
225
225
  Requires-Dist: pytest; extra == "test"
226
226
  Requires-Dist: pluggy; extra == "test"
@@ -259,10 +259,6 @@ CadQuery GUI editor based on PyQT supports Linux, Windows and Mac.
259
259
 
260
260
  ## Installation - Pre-Built Packages (Recommended)
261
261
 
262
- ~~### Release Packages~~
263
-
264
- ~~Stable release builds which do not require Anaconda are attached to the [latest release](https://github.com/CadQuery/CQ-editor/releases). Download installer for your operating system, extract it, and run the CQ-editor script for your OS (CQ-editor.cmd for Windows, CQ-editor.sh for Linux and MacOS). On Windows you should be able to simply double-click on CQ-editor.cmd. On Linux and MacOS you may need to make the script executable with `chmod +x CQ-editor.sh` and run the script from the command line. The script contains an environment variable export that may be required to get CQ-editor to launch correctly on MacOS Big Sur, so it is better to use the script than to launch CQ-editor directly.~~
265
-
266
262
  ### Development Packages
267
263
 
268
264
  Development builds are also available, but can be unstable and should be used at your own risk. You can download the newest build [here](https://github.com/CadQuery/CQ-editor/releases/tag/nightly). Install and run the `run.sh` (Linux/MacOS) or `run.bat` (Windows) script in the root CQ-editor directory. The CQ-editor window should launch.
@@ -292,7 +288,7 @@ micromamba install -n base -c cadquery cq-editor
292
288
  micromamba run -n base cq-editor
293
289
  ```
294
290
 
295
- On some linux distributions (e.g. `Ubuntu 18.04`) it might be necessary to install additonal packages:
291
+ On some linux distributions (e.g. `Ubuntu 18.04`+) it might be necessary to install additonal packages:
296
292
  ```
297
293
  sudo apt install libglu1-mesa libgl1-mesa-dri mesa-common-dev libglu1-mesa-dev
298
294
  ```
@@ -301,6 +297,14 @@ On Fedora 29 the packages can be installed as follows:
301
297
  dnf install -y mesa-libGLU mesa-libGL mesa-libGLU-devel
302
298
  ```
303
299
 
300
+ ## Installation (pip)
301
+
302
+ A newer installation option (starting with 0.3.0) is to install via pip. Being a newer option, there may be issues that are not present with the conda installation method. It has worked well in testing so far though.
303
+
304
+ ```
305
+ pip install CQ-editor
306
+ ```
307
+
304
308
  ## Usage
305
309
 
306
310
  ### Showing Objects
@@ -1,10 +1,10 @@
1
1
  cadquery
2
2
  pyqtgraph
3
- spyder==5
3
+ spyder<6,>=5.5.6
4
4
  path
5
5
  logbook
6
6
  requests
7
- qtconsole==5.4.1
7
+ qtconsole<5.6.0,>=5.5.1
8
8
 
9
9
  [dev]
10
10
  black
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: CQ-editor
3
- Version: 0.3.dev0
3
+ Version: 0.4.0
4
4
  Summary: CadQuery plugin to create a mesh of an assembly with corresponding data
5
5
  Author: CadQuery Developers
6
6
  Maintainer: CadQuery Developers
@@ -216,11 +216,11 @@ Description-Content-Type: text/markdown
216
216
  License-File: LICENSE
217
217
  Requires-Dist: cadquery
218
218
  Requires-Dist: pyqtgraph
219
- Requires-Dist: spyder==5
219
+ Requires-Dist: spyder<6,>=5.5.6
220
220
  Requires-Dist: path
221
221
  Requires-Dist: logbook
222
222
  Requires-Dist: requests
223
- Requires-Dist: qtconsole==5.4.1
223
+ Requires-Dist: qtconsole<5.6.0,>=5.5.1
224
224
  Provides-Extra: test
225
225
  Requires-Dist: pytest; extra == "test"
226
226
  Requires-Dist: pluggy; extra == "test"
@@ -259,10 +259,6 @@ CadQuery GUI editor based on PyQT supports Linux, Windows and Mac.
259
259
 
260
260
  ## Installation - Pre-Built Packages (Recommended)
261
261
 
262
- ~~### Release Packages~~
263
-
264
- ~~Stable release builds which do not require Anaconda are attached to the [latest release](https://github.com/CadQuery/CQ-editor/releases). Download installer for your operating system, extract it, and run the CQ-editor script for your OS (CQ-editor.cmd for Windows, CQ-editor.sh for Linux and MacOS). On Windows you should be able to simply double-click on CQ-editor.cmd. On Linux and MacOS you may need to make the script executable with `chmod +x CQ-editor.sh` and run the script from the command line. The script contains an environment variable export that may be required to get CQ-editor to launch correctly on MacOS Big Sur, so it is better to use the script than to launch CQ-editor directly.~~
265
-
266
262
  ### Development Packages
267
263
 
268
264
  Development builds are also available, but can be unstable and should be used at your own risk. You can download the newest build [here](https://github.com/CadQuery/CQ-editor/releases/tag/nightly). Install and run the `run.sh` (Linux/MacOS) or `run.bat` (Windows) script in the root CQ-editor directory. The CQ-editor window should launch.
@@ -292,7 +288,7 @@ micromamba install -n base -c cadquery cq-editor
292
288
  micromamba run -n base cq-editor
293
289
  ```
294
290
 
295
- On some linux distributions (e.g. `Ubuntu 18.04`) it might be necessary to install additonal packages:
291
+ On some linux distributions (e.g. `Ubuntu 18.04`+) it might be necessary to install additonal packages:
296
292
  ```
297
293
  sudo apt install libglu1-mesa libgl1-mesa-dri mesa-common-dev libglu1-mesa-dev
298
294
  ```
@@ -301,6 +297,14 @@ On Fedora 29 the packages can be installed as follows:
301
297
  dnf install -y mesa-libGLU mesa-libGL mesa-libGLU-devel
302
298
  ```
303
299
 
300
+ ## Installation (pip)
301
+
302
+ A newer installation option (starting with 0.3.0) is to install via pip. Being a newer option, there may be issues that are not present with the conda installation method. It has worked well in testing so far though.
303
+
304
+ ```
305
+ pip install CQ-editor
306
+ ```
307
+
304
308
  ## Usage
305
309
 
306
310
  ### Showing Objects
@@ -26,10 +26,6 @@ CadQuery GUI editor based on PyQT supports Linux, Windows and Mac.
26
26
 
27
27
  ## Installation - Pre-Built Packages (Recommended)
28
28
 
29
- ~~### Release Packages~~
30
-
31
- ~~Stable release builds which do not require Anaconda are attached to the [latest release](https://github.com/CadQuery/CQ-editor/releases). Download installer for your operating system, extract it, and run the CQ-editor script for your OS (CQ-editor.cmd for Windows, CQ-editor.sh for Linux and MacOS). On Windows you should be able to simply double-click on CQ-editor.cmd. On Linux and MacOS you may need to make the script executable with `chmod +x CQ-editor.sh` and run the script from the command line. The script contains an environment variable export that may be required to get CQ-editor to launch correctly on MacOS Big Sur, so it is better to use the script than to launch CQ-editor directly.~~
32
-
33
29
  ### Development Packages
34
30
 
35
31
  Development builds are also available, but can be unstable and should be used at your own risk. You can download the newest build [here](https://github.com/CadQuery/CQ-editor/releases/tag/nightly). Install and run the `run.sh` (Linux/MacOS) or `run.bat` (Windows) script in the root CQ-editor directory. The CQ-editor window should launch.
@@ -59,7 +55,7 @@ micromamba install -n base -c cadquery cq-editor
59
55
  micromamba run -n base cq-editor
60
56
  ```
61
57
 
62
- On some linux distributions (e.g. `Ubuntu 18.04`) it might be necessary to install additonal packages:
58
+ On some linux distributions (e.g. `Ubuntu 18.04`+) it might be necessary to install additonal packages:
63
59
  ```
64
60
  sudo apt install libglu1-mesa libgl1-mesa-dri mesa-common-dev libglu1-mesa-dev
65
61
  ```
@@ -68,6 +64,14 @@ On Fedora 29 the packages can be installed as follows:
68
64
  dnf install -y mesa-libGLU mesa-libGL mesa-libGLU-devel
69
65
  ```
70
66
 
67
+ ## Installation (pip)
68
+
69
+ A newer installation option (starting with 0.3.0) is to install via pip. Being a newer option, there may be issues that are not present with the conda installation method. It has worked well in testing so far though.
70
+
71
+ ```
72
+ pip install CQ-editor
73
+ ```
74
+
71
75
  ## Usage
72
76
 
73
77
  ### Showing Objects
@@ -3,18 +3,18 @@ import argparse
3
3
 
4
4
  from PyQt5.QtWidgets import QApplication
5
5
 
6
- NAME = 'CQ-editor'
6
+ NAME = "CQ-editor"
7
7
 
8
- #need to initialize QApp here, otherewise svg icons do not work on windows
9
- app = QApplication(sys.argv,
10
- applicationName=NAME)
8
+ # need to initialize QApp here, otherewise svg icons do not work on windows
9
+ app = QApplication(sys.argv, applicationName=NAME)
11
10
 
12
11
  from .main_window import MainWindow
13
12
 
13
+
14
14
  def main():
15
15
 
16
16
  parser = argparse.ArgumentParser(description=NAME)
17
- parser.add_argument('filename',nargs='?',default=None)
17
+ parser.add_argument("filename", nargs="?", default=None)
18
18
 
19
19
  args = parser.parse_args(app.arguments()[1:])
20
20
 
@@ -0,0 +1 @@
1
+ __version__ = "0.4.0"
@@ -8,8 +8,11 @@ from types import SimpleNamespace
8
8
  from OCP.XCAFPrs import XCAFPrs_AISObject
9
9
  from OCP.TopoDS import TopoDS_Shape
10
10
  from OCP.AIS import AIS_InteractiveObject, AIS_Shape
11
- from OCP.Quantity import \
12
- Quantity_TOC_RGB as TOC_RGB, Quantity_Color, Quantity_NOC_GOLD as GOLD
11
+ from OCP.Quantity import (
12
+ Quantity_TOC_RGB as TOC_RGB,
13
+ Quantity_Color,
14
+ Quantity_NOC_GOLD as GOLD,
15
+ )
13
16
  from OCP.Graphic3d import Graphic3d_NOM_JADE, Graphic3d_MaterialAspect
14
17
 
15
18
  from PyQt5.QtGui import QColor
@@ -25,26 +28,33 @@ def is_cq_obj(obj):
25
28
  return isinstance(obj, (Workplane, Shape, Assembly, Sketch))
26
29
 
27
30
 
28
- def find_cq_objects(results : dict):
31
+ def find_cq_objects(results: dict):
29
32
 
30
- return {k:SimpleNamespace(shape=v,options={}) for k,v in results.items() if is_cq_obj(v)}
33
+ return {
34
+ k: SimpleNamespace(shape=v, options={})
35
+ for k, v in results.items()
36
+ if is_cq_obj(v)
37
+ }
31
38
 
32
39
 
33
- def to_compound(obj : Union[cq.Workplane, List[cq.Workplane], cq.Shape, List[cq.Shape], cq.Sketch]):
40
+ def to_compound(
41
+ obj: Union[cq.Workplane, List[cq.Workplane], cq.Shape, List[cq.Shape], cq.Sketch],
42
+ ):
34
43
 
35
44
  vals = []
36
45
 
37
- if isinstance(obj,cq.Workplane):
46
+ if isinstance(obj, cq.Workplane):
38
47
  vals.extend(obj.vals())
39
- elif isinstance(obj,cq.Shape):
48
+ elif isinstance(obj, cq.Shape):
40
49
  vals.append(obj)
41
- elif isinstance(obj,list) and isinstance(obj[0],cq.Workplane):
42
- for o in obj: vals.extend(o.vals())
43
- elif isinstance(obj,list) and isinstance(obj[0],cq.Shape):
50
+ elif isinstance(obj, list) and isinstance(obj[0], cq.Workplane):
51
+ for o in obj:
52
+ vals.extend(o.vals())
53
+ elif isinstance(obj, list) and isinstance(obj[0], cq.Shape):
44
54
  vals.extend(obj)
45
55
  elif isinstance(obj, TopoDS_Shape):
46
56
  vals.append(cq.Shape.cast(obj))
47
- elif isinstance(obj,list) and isinstance(obj[0],TopoDS_Shape):
57
+ elif isinstance(obj, list) and isinstance(obj[0], TopoDS_Shape):
48
58
  vals.extend(cq.Shape.cast(o) for o in obj)
49
59
  elif isinstance(obj, cq.Sketch):
50
60
  if obj._faces:
@@ -52,21 +62,32 @@ def to_compound(obj : Union[cq.Workplane, List[cq.Workplane], cq.Shape, List[cq.
52
62
  else:
53
63
  vals.extend(obj._edges)
54
64
  else:
55
- raise ValueError(f'Invalid type {type(obj)}')
65
+ raise ValueError(f"Invalid type {type(obj)}")
56
66
 
57
67
  return cq.Compound.makeCompound(vals)
58
68
 
59
69
 
60
- def to_workplane(obj : cq.Shape):
70
+ def to_workplane(obj: cq.Shape):
61
71
 
62
- rv = cq.Workplane('XY')
63
- rv.objects = [obj,]
72
+ rv = cq.Workplane("XY")
73
+ rv.objects = [
74
+ obj,
75
+ ]
64
76
 
65
77
  return rv
66
78
 
67
79
 
68
- def make_AIS(obj : Union[cq.Workplane, List[cq.Workplane], cq.Shape, List[cq.Shape], cq.Assembly, AIS_InteractiveObject],
69
- options={}):
80
+ def make_AIS(
81
+ obj: Union[
82
+ cq.Workplane,
83
+ List[cq.Workplane],
84
+ cq.Shape,
85
+ List[cq.Shape],
86
+ cq.Assembly,
87
+ AIS_InteractiveObject,
88
+ ],
89
+ options={},
90
+ ):
70
91
 
71
92
  shape = None
72
93
 
@@ -82,28 +103,29 @@ def make_AIS(obj : Union[cq.Workplane, List[cq.Workplane], cq.Shape, List[cq.Sha
82
103
  set_material(ais, DEFAULT_MATERIAL)
83
104
  set_color(ais, DEFAULT_FACE_COLOR)
84
105
 
85
- if 'alpha' in options:
86
- set_transparency(ais, options['alpha'])
87
- if 'color' in options:
88
- set_color(ais, to_occ_color(options['color']))
89
- if 'rgba' in options:
90
- r,g,b,a = options['rgba']
91
- set_color(ais, to_occ_color((r,g,b)))
106
+ if "alpha" in options:
107
+ set_transparency(ais, options["alpha"])
108
+ if "color" in options:
109
+ set_color(ais, to_occ_color(options["color"]))
110
+ if "rgba" in options:
111
+ r, g, b, a = options["rgba"]
112
+ set_color(ais, to_occ_color((r, g, b)))
92
113
  set_transparency(ais, a)
93
114
 
94
- return ais,shape
115
+ return ais, shape
95
116
 
96
117
 
97
- def export(obj : Union[cq.Workplane, List[cq.Workplane]], type : str,
98
- file, precision=1e-1):
118
+ def export(
119
+ obj: Union[cq.Workplane, List[cq.Workplane]], type: str, file, precision=1e-1
120
+ ):
99
121
 
100
122
  comp = to_compound(obj)
101
123
 
102
- if type == 'stl':
124
+ if type == "stl":
103
125
  comp.exportStl(file, tolerance=precision)
104
- elif type == 'step':
126
+ elif type == "step":
105
127
  comp.exportStep(file)
106
- elif type == 'brep':
128
+ elif type == "brep":
107
129
  comp.exportBrep(file)
108
130
 
109
131
 
@@ -116,17 +138,14 @@ def to_occ_color(color) -> Quantity_Color:
116
138
  elif isinstance(color[0], float):
117
139
  color = QColor.fromRgbF(*color)
118
140
  else:
119
- raise ValueError('Unknown color format')
141
+ raise ValueError("Unknown color format")
120
142
  else:
121
143
  color = QColor(color)
122
144
 
123
- return Quantity_Color(color.redF(),
124
- color.greenF(),
125
- color.blueF(),
126
- TOC_RGB)
145
+ return Quantity_Color(color.redF(), color.greenF(), color.blueF(), TOC_RGB)
127
146
 
128
147
 
129
- def get_occ_color(obj : Union[AIS_InteractiveObject, Quantity_Color]) -> QColor:
148
+ def get_occ_color(obj: Union[AIS_InteractiveObject, Quantity_Color]) -> QColor:
130
149
 
131
150
  if isinstance(obj, AIS_InteractiveObject):
132
151
  color = Quantity_Color()
@@ -137,7 +156,7 @@ def get_occ_color(obj : Union[AIS_InteractiveObject, Quantity_Color]) -> QColor:
137
156
  return QColor.fromRgbF(color.Red(), color.Green(), color.Blue())
138
157
 
139
158
 
140
- def set_color(ais : AIS_Shape, color : Quantity_Color) -> AIS_Shape:
159
+ def set_color(ais: AIS_Shape, color: Quantity_Color) -> AIS_Shape:
141
160
 
142
161
  drawer = ais.Attributes()
143
162
  drawer.SetupOwnShadingAspect()
@@ -146,7 +165,7 @@ def set_color(ais : AIS_Shape, color : Quantity_Color) -> AIS_Shape:
146
165
  return ais
147
166
 
148
167
 
149
- def set_material(ais : AIS_Shape, material: Graphic3d_MaterialAspect) -> AIS_Shape:
168
+ def set_material(ais: AIS_Shape, material: Graphic3d_MaterialAspect) -> AIS_Shape:
150
169
 
151
170
  drawer = ais.Attributes()
152
171
  drawer.SetupOwnShadingAspect()
@@ -155,7 +174,7 @@ def set_material(ais : AIS_Shape, material: Graphic3d_MaterialAspect) -> AIS_Sha
155
174
  return ais
156
175
 
157
176
 
158
- def set_transparency(ais : AIS_Shape, alpha: float) -> AIS_Shape:
177
+ def set_transparency(ais: AIS_Shape, alpha: float) -> AIS_Shape:
159
178
 
160
179
  drawer = ais.Attributes()
161
180
  drawer.SetupOwnShadingAspect()
@@ -184,13 +203,13 @@ def reload_cq():
184
203
  reload(cq.occ_impl.exporters.dxf)
185
204
  reload(cq.occ_impl.exporters.amf)
186
205
  reload(cq.occ_impl.exporters.json)
187
- #reload(cq.occ_impl.exporters.assembly)
206
+ # reload(cq.occ_impl.exporters.assembly)
188
207
  reload(cq.occ_impl.exporters)
189
208
  reload(cq.assembly)
190
209
  reload(cq)
191
210
 
192
211
 
193
- def is_obj_empty(obj : Union[cq.Workplane,cq.Shape]) -> bool:
212
+ def is_obj_empty(obj: Union[cq.Workplane, cq.Shape]) -> bool:
194
213
 
195
214
  rv = False
196
215
 
@@ -1,13 +1,13 @@
1
1
  import os, sys, asyncio
2
2
 
3
- if 'CASROOT' in os.environ:
4
- del os.environ['CASROOT']
3
+ if "CASROOT" in os.environ:
4
+ del os.environ["CASROOT"]
5
5
 
6
- if sys.platform == 'win32':
6
+ if sys.platform == "win32":
7
7
  asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
8
8
 
9
9
  from cq_editor.__main__ import main
10
10
 
11
11
 
12
- if __name__ == '__main__':
13
- main()
12
+ if __name__ == "__main__":
13
+ main()
@@ -0,0 +1,84 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ Created on Fri May 25 14:47:10 2018
5
+
6
+ @author: adam
7
+ """
8
+
9
+ from PyQt5.QtGui import QIcon
10
+
11
+ from . import icons_res
12
+
13
+ _icons = {"app": QIcon(":/images/icons/cadquery_logo_dark.svg")}
14
+
15
+ import qtawesome as qta
16
+
17
+ _icons_specs = {
18
+ "new": (("fa.file-o",), {}),
19
+ "open": (("fa.folder-open-o",), {}),
20
+ # borrowed from spider-ide
21
+ "autoreload": [
22
+ ("fa.repeat", "fa.clock-o"),
23
+ {
24
+ "options": [
25
+ {"scale_factor": 0.75, "offset": (-0.1, -0.1)},
26
+ {"scale_factor": 0.5, "offset": (0.25, 0.25)},
27
+ ]
28
+ },
29
+ ],
30
+ "save": (("fa.save",), {}),
31
+ "save_as": (
32
+ ("fa.save", "fa.pencil"),
33
+ {
34
+ "options": [
35
+ {
36
+ "scale_factor": 1,
37
+ },
38
+ {"scale_factor": 0.8, "offset": (0.2, 0.2)},
39
+ ]
40
+ },
41
+ ),
42
+ "run": (("fa.play",), {}),
43
+ "delete": (("fa.trash",), {}),
44
+ "delete-many": (
45
+ (
46
+ "fa.trash",
47
+ "fa.trash",
48
+ ),
49
+ {
50
+ "options": [
51
+ {"scale_factor": 0.8, "offset": (0.2, 0.2), "color": "gray"},
52
+ {"scale_factor": 0.8},
53
+ ]
54
+ },
55
+ ),
56
+ "help": (("fa.life-ring",), {}),
57
+ "about": (("fa.info",), {}),
58
+ "preferences": (("fa.cogs",), {}),
59
+ "inspect": (
60
+ ("fa.cubes", "fa.search"),
61
+ {"options": [{"scale_factor": 0.8, "offset": (0, 0), "color": "gray"}, {}]},
62
+ ),
63
+ "screenshot": (("fa.camera",), {}),
64
+ "screenshot-save": (
65
+ ("fa.save", "fa.camera"),
66
+ {
67
+ "options": [
68
+ {"scale_factor": 0.8},
69
+ {"scale_factor": 0.8, "offset": (0.2, 0.2)},
70
+ ]
71
+ },
72
+ ),
73
+ "toggle-comment": (("fa.hashtag",), {}),
74
+ }
75
+
76
+
77
+ def icon(name):
78
+
79
+ if name in _icons:
80
+ return _icons[name]
81
+
82
+ args, kwargs = _icons_specs[name]
83
+
84
+ return qta.icon(*args, **kwargs)