Skip to content

Commit a922e09

Browse files
Refresh toolbars, dialogs, icons and controls
1 parent 7f04405 commit a922e09

111 files changed

Lines changed: 12300 additions & 8053 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CHANGELOG.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 1.6.4 - 2026-09-24
4+
5+
- Reworked **Options → Hotkeys** into a table covering named menu commands, including nested commands. A separate assignment dialog offers modifier checkboxes and a searchable key list; shortcuts persist per command, can be cleared or restored to defaults, and conflicting assignments are rejected. Default shortcuts were updated for Refresh and standard views.
6+
- Updated toolbars: moved Refresh to View, placed View after Edit by default, added Statistics and Tool List before the CNC calculators, and added a persistent 1–5 playback-speed slider. The CNC editor mode is now a dropdown with distinct icons for ISO G-Code and Text File. Toolbar icons have configurable 32/24/16-pixel sizes, defaulting to 24 pixels.
7+
- Added the missing Settings menu icons for Stock, Tool Library, WCS, Options and Tokens, refreshed toolbar icons and fixed Qt resource regeneration so changed icon files are embedded by the lint fix workflow.
8+
- Updated Snippets with a smaller monospace content font, editor zoom, and icon-only management buttons. Added 16-pixel icons and concise labels/tooltips to Tool Library actions and preview controls.
9+
- Kept Qt Designer `.ui` sources authoritative, regenerated their Python modules and Russian translations, and extended lint checks for UI formatting and generated UI, translations and resource freshness. Simplified repeated UI handlers without changing CNC behavior.
10+
311
## 1.6.3 - 2026-09-23
412

513
- Fixed milling 3D camera jumps during automatic refresh after pasting or dropping G-code. Ordinary updates preserve the camera center and zoom; a newly inserted path is fitted only when it grows or moves substantially and would otherwise extend beyond the current view. Turning camera behavior is unchanged.

‎FAQ.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ The left panel is a QScintilla editor with syntax highlighting, line numbers, se
6262
- When Lathe Stock Removal playback is active, `Stop` completes the preview, restores the normal plot and leaves the slider at 100%.
6363

6464
Playback speed levels 1–5 correspond to 1000, 250, 100, 40 and 10 ms per logical motion.
65+
Use the spin box on the Playback toolbar or the slider in Options to change the same saved speed setting.
6566

6667
### How do I locate a plotted move in the editor?
6768

@@ -401,6 +402,8 @@ On Windows:
401402
- `Show Stock` immediately after `Show canvas grid`.
402403
- Canvas gradient and STL appearance.
403404
- Playback speed and adaptive/fixed grid spacing.
405+
- Toolbar icon size (32×32, 24×24 or 16×16; default 24×24).
406+
- Menu-command shortcuts in the Hotkeys tab. Select a command, choose modifiers and a key in the assignment dialog, or choose None to clear it. Duplicate assignments are rejected; Restore Defaults restores the built-in keys.
404407

405408
### Where is the log file?
406409

@@ -472,7 +475,7 @@ source NC
472475
-> CLI, export, statistics, rendering and playback
473476
```
474477

475-
CNC semantics belong in the kernel. GUI rendering, statistics and export must not independently reinterpret source commands. During the current core-hardening phase, new execution/analysis capabilities should be implemented and regression-tested in the core/CLI first; UI changes should remain bug fixes until the core contract is stable.
478+
CNC semantics belong in the kernel. GUI rendering, statistics and export must not independently reinterpret source commands. New execution and analysis capabilities should be implemented and regression-tested in the core and CLI before the UI consumes them.
476479

477480
Historical module-level imports that existed before the package split are intentionally re-exported/aliased where required so the structural refactor does not change the public Python surface. New code should import from the canonical subject packages.
478481

‎README.md‎

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
<!-- markdownlint-disable MD033 -->
66

77
<details>
8-
<summary><h2>Main Screen</h2></summary>
8+
<summary><h2>Main Window</h2></summary>
99
<p align="center">
10-
<img src="assets/img1.png" alt="Main Screen">
10+
<img src="assets/img1.png" alt="Main Window">
1111
</p>
1212
</details>
1313

@@ -18,6 +18,27 @@
1818
</p>
1919
</details>
2020

21+
<details>
22+
<summary><h2>Milling</h2></summary>
23+
<p align="center">
24+
<img src="assets/img3.png" alt="Milling">
25+
</p>
26+
</details>
27+
28+
<details>
29+
<summary><h2>Turning</h2></summary>
30+
<p align="center">
31+
<img src="assets/img4.png" alt="Turning">
32+
</p>
33+
</details>
34+
35+
<details>
36+
<summary><h2>Lathe Stock Removal Simulation</h2></summary>
37+
<p align="center">
38+
<img src="assets/img5.png" alt="Lathe Stock Removal Simulation">
39+
</p>
40+
</details>
41+
2142
---
2243

2344
Easy G-Code Plot is a desktop editor, analyzer, simulator and trace exporter for FANUC-style turning and milling programs. Rendering, playback, Stock Removal, statistics, CLI analysis and export consume one resolved trace produced by the shared CNC kernel.
@@ -97,6 +118,11 @@ Unsupported or ambiguous controller behavior is reported explicitly instead of b
97118
- **Theme** — Light or Dark; custom colors from the **Colors** tab are preserved.
98119
- **Auto Update** and **Auto update max segments** — control non-modal plot refresh while editing. The segment limit applies only to automatic rendering.
99120
- **Maximum generated motions** — limits the total motions produced by one kernel execution and protects against runaway expansion.
121+
- **Toolpanel icons** — selects 32×32, 24×24 or 16×16 toolbar icons; 24×24 is the default.
122+
123+
### Hotkeys
124+
125+
`Settings → Options → Hotkeys` lists commands from the main menus. Select a command and use **Edit shortcut** (or double-click its row) to choose Ctrl, Alt, Shift or Meta and a key. Choose **None** to clear a shortcut; **Restore Defaults** restores the built-in assignments. Conflicting shortcuts are rejected. Refresh defaults to F5; the 3D, Top, Front and Left views default to Ctrl+1, Ctrl+2, Ctrl+3 and Ctrl+4.
100126

101127
### CNC / Execution
102128

@@ -108,6 +134,7 @@ Unsupported or ambiguous controller behavior is reported explicitly instead of b
108134
- **Arc sampling preset**, **Maximum circular radius**, **Minimum circular radius** and **Minimum chord length** — control GUI trace sampling without changing CNC execution geometry.
109135

110136
Explicit Refresh operations use a cancellable dialog covering tool discovery, parsing, execution, sampling and plot publication.
137+
The Playback toolbar has a 1–5 speed control using the same setting as Options.
111138

112139
## Tool Library
113140

‎app/main_window.py‎

Lines changed: 91 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@
55

66
from PyQt6.QtCore import QBasicTimer, QCoreApplication, QSize, Qt, QTimer
77
from PyQt6.QtGui import QAction, QActionGroup, QIcon, QQuaternion
8-
from PyQt6.QtWidgets import QComboBox, QMainWindow, QMessageBox, QToolBar
8+
from PyQt6.QtWidgets import QComboBox, QMainWindow, QMenu, QMessageBox, QSlider, QToolBar, QToolButton
99

1010
import app.resources.files_res # noqa: F401 # pylint: disable=unused-import # Registers Qt resources on import.
11+
from app.settings import (
12+
DEFAULT_TOOLBAR_ICON_SIZE,
13+
normalized_milling_tools,
14+
normalized_recent_files,
15+
normalized_tools,
16+
)
1117
from app.settings import RECENT_FILES_LIMIT as _RECENT_FILES_LIMIT
12-
from app.settings import normalized_milling_tools, normalized_recent_files, normalized_tools
1318
from app.ui.dialogs.calculators import HoleCalculatorDialog, PocketCalculatorDialog
1419
from app.ui.dialogs.general import About, BlockNum, Export, Find, Wcs
1520
from app.ui.dialogs.help import HelpDialog
@@ -55,7 +60,6 @@
5560
CURSOR_SIZE_PX = _CURSOR_SIZE_PX
5661
RAPID_COLOR = _RAPID_COLOR
5762
LOGGER = logging.getLogger(__name__)
58-
TOOLBAR_ICON_SIZE = QSize(24, 24)
5963

6064

6165
class MainWindow(
@@ -75,6 +79,7 @@ def __init__(self):
7579
self.ui = Ui_MainWindow()
7680
self.ui.setupUi(self)
7781
self._configure_runtime_ui()
82+
self._configure_playback_speed_slider()
7883
self._plot_navigation = PlotNavigation(self.ui.graphicsView, self._update_adaptive_grid, self._pick_trace_at)
7984
self.ui.graphicsView.installEventFilter(self._plot_navigation)
8085

@@ -92,15 +97,9 @@ def __init__(self):
9297

9398
def _configure_runtime_ui(self):
9499
"""Attach runtime-only widgets and action groups to the generated Designer UI."""
95-
for toolbar in (
96-
self.ui.fileToolBar,
97-
self.ui.editToolBar,
98-
self.ui.cncToolBar,
99-
self.ui.viewToolBar,
100-
self.ui.playbackToolBar,
101-
):
102-
toolbar.setIconSize(TOOLBAR_ICON_SIZE)
103-
self.ui.actionStock = QAction(QCoreApplication.translate("MainWindow", "Stock"), self)
100+
self.ui.actionStock = QAction(
101+
QIcon(":/resource/icons/stock.png"), QCoreApplication.translate("MainWindow", "Stock"), self
102+
)
104103
self.ui.actionStock.setObjectName("actionStock")
105104
self.ui.actionStock.setToolTip(QCoreApplication.translate("MainWindow", "Configure turning Stock Removal"))
106105
self.ui.menuSettings.insertAction(self.ui.actionWCS, self.ui.actionStock)
@@ -140,25 +139,99 @@ def _configure_runtime_ui(self):
140139

141140
self.ui.fileTypeCombo = QComboBox(self)
142141
self.ui.fileTypeCombo.setObjectName("fileTypeCombo")
143-
self.ui.fileTypeCombo.addItems(["Text File", "ISO G-Code"])
144-
self.ui.fileTypeCombo.setToolTip(QCoreApplication.translate("MainWindow", "File Type"))
142+
self.ui.fileTypeCombo.addItems(
143+
[
144+
QCoreApplication.translate("MainWindow", "Text File"),
145+
QCoreApplication.translate("MainWindow", "ISO G-Code"),
146+
]
147+
)
148+
self.ui.fileTypeCombo.hide()
149+
self.ui.fileTypeMenu = QMenu(self)
150+
self.ui.fileTypeMenu.setObjectName("fileTypeMenu")
151+
self._file_type_icons = (
152+
QIcon(":/resource/icons/text.png"),
153+
QIcon(":/resource/icons/text-color.png"),
154+
)
155+
self._file_type_action_group = QActionGroup(self)
156+
self._file_type_action_group.setExclusive(True)
157+
self._file_type_actions = []
158+
for index in range(self.ui.fileTypeCombo.count()):
159+
action = self.ui.fileTypeMenu.addAction(self.ui.fileTypeCombo.itemText(index))
160+
action.setIcon(self._file_type_icons[index])
161+
action.setCheckable(True)
162+
self._file_type_action_group.addAction(action)
163+
action.triggered.connect(
164+
lambda _checked=False, selected=index: self.ui.fileTypeCombo.setCurrentIndex(selected)
165+
)
166+
self._file_type_actions.append(action)
167+
self.ui.fileTypeButton = QToolButton(self.ui.cncToolBar)
168+
self.ui.fileTypeButton.setObjectName("fileTypeButton")
169+
self.ui.fileTypeButton.setMenu(self.ui.fileTypeMenu)
170+
self.ui.fileTypeButton.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)
171+
self.ui.fileTypeButton.setIcon(self._file_type_icons[0])
172+
self.ui.fileTypeButton.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
173+
self.ui.fileTypeButton.setAutoRaise(True)
174+
self.ui.fileTypeButton.setToolTip(QCoreApplication.translate("MainWindow", "File Type"))
175+
self.syncFileTypeMenu(self.ui.fileTypeCombo.currentIndex())
145176
actions = self.ui.cncToolBar.actions()
146177
if actions:
147178
first_action = actions[0]
148-
self.ui.cncToolBar.insertWidget(first_action, self.ui.fileTypeCombo)
179+
self.ui.cncToolBar.insertWidget(first_action, self.ui.fileTypeButton)
149180
self.ui.cncToolBar.insertSeparator(first_action)
150181
else:
151-
self.ui.cncToolBar.addWidget(self.ui.fileTypeCombo)
182+
self.ui.cncToolBar.addWidget(self.ui.fileTypeButton)
183+
184+
self._toolbar_action_icons = {
185+
action: action.icon()
186+
for toolbar in self._toolbars()
187+
for action in toolbar.actions()
188+
if not action.icon().isNull()
189+
}
190+
self.applyToolbarIconSize(DEFAULT_TOOLBAR_ICON_SIZE)
152191

153192
self.setContextMenuPolicy(Qt.ContextMenuPolicy.DefaultContextMenu)
154193

194+
def _configure_playback_speed_slider(self):
195+
self.ui.playbackSpeedSlider = QSlider(Qt.Orientation.Horizontal, self.ui.playbackToolBar)
196+
self.ui.playbackSpeedSlider.setObjectName("playbackSpeedSlider")
197+
self.ui.playbackSpeedSlider.setRange(1, 5)
198+
self.ui.playbackSpeedSlider.setSingleStep(1)
199+
self.ui.playbackSpeedSlider.setPageStep(1)
200+
self.ui.playbackSpeedSlider.setTickInterval(1)
201+
self.ui.playbackSpeedSlider.setTickPosition(QSlider.TickPosition.TicksAbove)
202+
self.ui.playbackSpeedSlider.setFixedWidth(120)
203+
self.ui.playbackSpeedSlider.setToolTip(QCoreApplication.translate("OptionsDlg", "Playback speed"))
204+
self.ui.playbackToolBar.addWidget(self.ui.playbackSpeedSlider)
205+
206+
def syncFileTypeMenu(self, index: int):
207+
selected = 1 if index == 1 else 0
208+
for action_index, action in enumerate(self._file_type_actions):
209+
action.setChecked(action_index == selected)
210+
label = self.ui.fileTypeCombo.itemText(selected)
211+
self.ui.fileTypeMenu.setTitle(label)
212+
self.ui.fileTypeButton.setText(label)
213+
self.ui.fileTypeButton.setIcon(self._file_type_icons[selected])
214+
215+
def applyToolbarIconSize(self, dimension: int):
216+
"""Use one icon size for every toolbar, including small source images."""
217+
size = QSize(dimension, dimension)
218+
for toolbar in self._toolbars():
219+
toolbar.setIconSize(size)
220+
for action, original in self._toolbar_action_icons.items():
221+
pixmap = original.pixmap(size)
222+
if pixmap.size() != size:
223+
pixmap = pixmap.scaled(
224+
size, Qt.AspectRatioMode.KeepAspectRatio, Qt.TransformationMode.SmoothTransformation
225+
)
226+
action.setIcon(QIcon(pixmap))
227+
155228
def _toolbars(self):
156229
"""Return toolbars in their canonical default order."""
157230
return (
158231
self.ui.fileToolBar,
159232
self.ui.editToolBar,
160-
self.ui.cncToolBar,
161233
self.ui.viewToolBar,
234+
self.ui.cncToolBar,
162235
self.ui.playbackToolBar,
163236
)
164237

@@ -205,6 +278,7 @@ def _initialize_runtime_helpers(self):
205278
getattr(self.ui, "actionPocketCalculator").triggered.connect(self.pocketCalculatorDlg.show)
206279
getattr(self.ui, "actionSnippets").triggered.connect(self.snippetsDlg.show)
207280
self.timer = QBasicTimer()
281+
self.ui.playbackSpeedSlider.valueChanged.connect(self.setPlaybackSpeed)
208282
self.autoUpdateTimer = QTimer(self)
209283
self.autoUpdateTimer.setSingleShot(True)
210284
self.autoUpdateTimer.setInterval(AUTO_REFRESH_DELAY_MS)

0 commit comments

Comments
 (0)