Skip to content

Commit cd588aa

Browse files
authored
Editor Update (#535)
* Implemented more of the core features of the editor * Implemented the ability to toggle comments * Improved block commenting and un-commenting * Fixed fonts and some related version pins * Tweaked the clear log and clear console icons * Started adding editor debugger and fixed bug with Editor.set_text * Fixed bug in set_text and fixed test order errors * Fixed the font setting method and added the maximum line length indicator * Added breakpoints back to the code editor * Fixed a bug with tabbing and tried to increase test coverage a bit * Added search feature in code editor
1 parent 63be9c6 commit cd588aa

File tree

17 files changed

+1525
-118
lines changed

17 files changed

+1525
-118
lines changed

.coveragerc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
timid = True
33
branch = True
44
source = src
5+
omit =
6+
cq_editor/__main__.py
7+
cq_editor/widgets/pyhighlight.py
58

69
[report]
710
exclude_lines =

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ environment:
1313

1414
install:
1515
- sh: if [[ $APPVEYOR_BUILD_WORKER_IMAGE != "macOS"* ]]; then sudo apt update; sudo apt -y --force-yes install libglu1-mesa xvfb libgl1-mesa-dri mesa-common-dev libglu1-mesa-dev; fi
16-
- sh: if [[ $APPVEYOR_BUILD_WORKER_IMAGE != "macOS"* ]]; then curl -fsSL -o miniconda.sh https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh; fi
16+
- sh: if [[ $APPVEYOR_BUILD_WORKER_IMAGE != "macOS"* ]]; then curl -fsSL -o miniconda.sh https://github.com/conda-forge/miniforge/releases/download/25.3.1-0/Miniforge3-Linux-x86_64.sh; fi
1717
- sh: if [[ $APPVEYOR_BUILD_WORKER_IMAGE == "macOS"* ]]; then curl -fsSL -o miniconda.sh https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Darwin-x86_64.sh; fi
1818
- sh: bash miniconda.sh -b -p $HOME/miniconda
1919
- sh: source $HOME/miniconda/bin/activate

conda/meta.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@ build:
1414
- CQ-editor = cq_editor.__main__:main
1515
requirements:
1616
build:
17-
- python >=3.8
17+
- python >=3.10
1818
- setuptools
1919

2020
run:
21-
- python >=3.9
21+
- python >=3.10
2222
- cadquery=master
2323
- ocp
2424
- logbook
2525
- pyqt=5.*
2626
- pyqtgraph
27-
- spyder >=5.5.6,<6
27+
- qtawesome=1.4.0
2828
- path
2929
- logbook
3030
- requests
31-
- qtconsole >=5.5.1,<5.6.0
31+
- qtconsole >=5.5.1,<5.7.0
3232
test:
3333
imports:
3434
- cq_editor

cq_editor/__main__.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,16 @@ def main():
1818

1919
args = parser.parse_args(app.arguments()[1:])
2020

21-
win = MainWindow(filename=args.filename if args.filename else None)
22-
win.show()
23-
sys.exit(app.exec_())
21+
# sys.exit(app.exec_())
22+
23+
try:
24+
win = MainWindow(filename=args.filename if args.filename else None)
25+
win.show()
26+
app.exec_()
27+
except Exception as e:
28+
import traceback
29+
30+
traceback.print_exc()
2431

2532

2633
if __name__ == "__main__":

cq_editor/icons.py

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@
1515
import qtawesome as qta
1616

1717
_icons_specs = {
18-
"new": (("fa.file-o",), {}),
19-
"open": (("fa.folder-open-o",), {}),
18+
"new": (("fa5.file",), {}),
19+
"open": (("fa5.folder-open",), {}),
2020
# borrowed from spider-ide
2121
"autoreload": [
22-
("fa.repeat", "fa.clock-o"),
22+
("fa5s.redo-alt", "fa5.clock"),
2323
{
2424
"options": [
2525
{"scale_factor": 0.75, "offset": (-0.1, -0.1)},
2626
{"scale_factor": 0.5, "offset": (0.25, 0.25)},
2727
]
2828
},
2929
],
30-
"save": (("fa.save",), {}),
30+
"save": (("fa5.save",), {}),
3131
"save_as": (
32-
("fa.save", "fa.pencil"),
32+
("fa5.save", "fa5s.pencil-alt"),
3333
{
3434
"options": [
3535
{
@@ -39,12 +39,13 @@
3939
]
4040
},
4141
),
42-
"run": (("fa.play",), {}),
43-
"delete": (("fa.trash",), {}),
42+
"run": (("fa5s.play",), {}),
43+
"debug": (("fa5s.bug",), {}),
44+
"delete": (("fa5s.trash",), {}),
4445
"delete-many": (
4546
(
46-
"fa.trash",
47-
"fa.trash",
47+
"fa5s.trash",
48+
"fa5s.trash",
4849
),
4950
{
5051
"options": [
@@ -53,25 +54,30 @@
5354
]
5455
},
5556
),
56-
"help": (("fa.life-ring",), {}),
57-
"about": (("fa.info",), {}),
58-
"preferences": (("fa.cogs",), {}),
57+
"help": (("fa5s.life-ring",), {}),
58+
"about": (("fa5s.info",), {}),
59+
"preferences": (("fa5s.cogs",), {}),
5960
"inspect": (
60-
("fa.cubes", "fa.search"),
61+
("fa5s.cubes", "fa5s.search"),
6162
{"options": [{"scale_factor": 0.8, "offset": (0, 0), "color": "gray"}, {}]},
6263
),
63-
"screenshot": (("fa.camera",), {}),
64+
"screenshot": (("fa5s.camera",), {}),
6465
"screenshot-save": (
65-
("fa.save", "fa.camera"),
66+
("fa5.save", "fa5s.camera"),
6667
{
6768
"options": [
6869
{"scale_factor": 0.8},
6970
{"scale_factor": 0.8, "offset": (0.2, 0.2)},
7071
]
7172
},
7273
),
73-
"toggle-comment": (("fa.hashtag",), {}),
74-
"search": (("fa.search",), {}),
74+
"toggle-comment": (("fa5s.hashtag",), {}),
75+
"search": (("fa5s.search",), {}),
76+
"arrow-step-over": (("fa5s.step-forward",), {}),
77+
"arrow-step-in": (("fa5s.angle-down",), {}),
78+
"arrow-continue": (("fa5s.arrow-right",), {}),
79+
"clear": (("fa5s.eraser",), {}),
80+
"clear-2": (("fa5s.broom",), {}),
7581
}
7682

7783

cq_editor/main_window.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,16 @@ def prepare_menubar(self):
323323
)
324324
menu_edit.addAction(self.autocomplete_action)
325325

326+
# Add the menu action to open the code search controls
327+
self.search_action = QAction(
328+
icon("search"),
329+
"Search",
330+
self,
331+
shortcut="ctrl+F",
332+
triggered=self.components["editor"].search_widget.show_search,
333+
)
334+
menu_edit.addAction(self.search_action)
335+
326336
menu_edit.addAction(
327337
QAction(
328338
icon("preferences"),

cq_editor/preferences.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def add(self, name, component):
6363
for child in component.preferences.children():
6464
# Fill the editor color scheme drop down list
6565
if child.name() == "Color scheme":
66-
child.setLimits(["Spyder", "Monokai", "Zenburn"])
66+
child.setLimits(["Light", "Dark"])
6767
# Fill the camera projection type
6868
elif child.name() == "Projection Type":
6969
child.setLimits(

0 commit comments

Comments
 (0)