From 51b9d40010c604bf0a496ba9cb1805741df08a55 Mon Sep 17 00:00:00 2001 From: sliptonic Date: Mon, 7 Mar 2022 17:46:02 -0600 Subject: [PATCH 1/2] fixes 6114 replaces DlgJobChooser with QInputDialog. --- src/Mod/Path/Gui/Resources/Path.qrc | 1 - .../Gui/Resources/panels/DlgJobChooser.ui | 70 ------------------- src/Mod/Path/PathScripts/PathPost.py | 14 ++-- src/Mod/Path/PathScripts/PathUtilsGui.py | 25 +++++-- 4 files changed, 26 insertions(+), 84 deletions(-) delete mode 100644 src/Mod/Path/Gui/Resources/panels/DlgJobChooser.ui diff --git a/src/Mod/Path/Gui/Resources/Path.qrc b/src/Mod/Path/Gui/Resources/Path.qrc index 61657c3b3f..66acdc91e6 100644 --- a/src/Mod/Path/Gui/Resources/Path.qrc +++ b/src/Mod/Path/Gui/Resources/Path.qrc @@ -85,7 +85,6 @@ icons/edge-join-round.svg icons/preferences-path.svg panels/AxisMapEdit.ui - panels/DlgJobChooser.ui panels/DlgJobCreate.ui panels/DlgJobModelSelect.ui panels/DlgJobTemplateExport.ui diff --git a/src/Mod/Path/Gui/Resources/panels/DlgJobChooser.ui b/src/Mod/Path/Gui/Resources/panels/DlgJobChooser.ui deleted file mode 100644 index d6d460130a..0000000000 --- a/src/Mod/Path/Gui/Resources/panels/DlgJobChooser.ui +++ /dev/null @@ -1,70 +0,0 @@ - - - DlgJobChooser - - - Qt::WindowModal - - - - 0 - 0 - 264 - 92 - - - - Choose a Path Job - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - DlgJobChooser - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - DlgJobChooser - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/src/Mod/Path/PathScripts/PathPost.py b/src/Mod/Path/PathScripts/PathPost.py index 93ce45bf3b..8a250532fe 100644 --- a/src/Mod/Path/PathScripts/PathPost.py +++ b/src/Mod/Path/PathScripts/PathPost.py @@ -44,6 +44,8 @@ LOG_MODULE = PathLog.thisModule() PathLog.setLevel(PathLog.Level.INFO, LOG_MODULE) +translate = FreeCAD.Qt.translate + class _TempObject: Path = None Name = "Fixture" @@ -241,6 +243,7 @@ class CommandPathPost: job = None else: job = None + if job is None: targetlist = [] for o in FreeCAD.ActiveDocument.Objects: @@ -249,13 +252,12 @@ class CommandPathPost: targetlist.append(o.Label) PathLog.debug("Possible post objects: {}".format(targetlist)) if len(targetlist) > 1: - form = FreeCADGui.PySideUic.loadUi(":/panels/DlgJobChooser.ui") - form.cboProject.addItems(targetlist) - r = form.exec_() - if r is False: + jobname, result = QtGui.QInputDialog.getItem( + None, translate("Path", "Choose a Path Job"), None, targetlist + ) + + if result is False: return - else: - jobname = form.cboProject.currentText() else: jobname = targetlist[0] job = FreeCAD.ActiveDocument.getObject(jobname) diff --git a/src/Mod/Path/PathScripts/PathUtilsGui.py b/src/Mod/Path/PathScripts/PathUtilsGui.py index 3290d75e3c..98a70a47af 100644 --- a/src/Mod/Path/PathScripts/PathUtilsGui.py +++ b/src/Mod/Path/PathScripts/PathUtilsGui.py @@ -21,10 +21,21 @@ # *************************************************************************** import FreeCADGui +import FreeCAD import PathGui as PGui # ensure Path/Gui/Resources are loaded import PathScripts import PathScripts.PathJobCmd as PathJobCmd import PathScripts.PathUtils as PathUtils +from PySide import QtGui +import PathScripts.PathLog as PathLog + +if False: + PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) + PathLog.trackModule(PathLog.thisModule()) +else: + PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) + +translate = FreeCAD.Qt.translate class PathUtilsUserInput(object): @@ -73,19 +84,19 @@ class PathUtilsUserInput(object): if 1 == len(modelObjectSelected): job = modelObjectSelected[0] else: - form = FreeCADGui.PySideUic.loadUi(":/panels/DlgJobChooser.ui") if modelObjectSelected: mylist = [j.Label for j in modelObjectSelected] else: mylist = [j.Label for j in jobs] - form.cboProject.addItems(mylist) - r = form.exec_() - if r is False or r == 0: + + jobname, result = QtGui.QInputDialog.getItem( + None, translate("Path", "Choose a Path Job"), None, mylist + ) + + if result is False: return None else: - job = [ - j for j in jobs if j.Label == form.cboProject.currentText() - ][0] + job = [j for j in jobs if j.Label == jobname][0] return job def createJob(self): From faec9e36c2aa18f410da6c1fa16dab06ebc41e12 Mon Sep 17 00:00:00 2001 From: sliptonic Date: Tue, 8 Mar 2022 08:40:05 -0600 Subject: [PATCH 2/2] fixes #5954 Make headers less confusing and ambiguous --- src/Mod/Path/PathScripts/PathJobGui.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathJobGui.py b/src/Mod/Path/PathScripts/PathJobGui.py index bdb0bf9403..78359a947e 100644 --- a/src/Mod/Path/PathScripts/PathJobGui.py +++ b/src/Mod/Path/PathScripts/PathJobGui.py @@ -623,8 +623,14 @@ class TaskPanel: vUnit = FreeCAD.Units.Quantity(1, FreeCAD.Units.Velocity).getUserPreferred()[2] self.form.toolControllerList.horizontalHeaderItem(1).setText("#") - self.form.toolControllerList.horizontalHeaderItem(2).setText(vUnit) - self.form.toolControllerList.horizontalHeaderItem(3).setText(vUnit) + self.form.toolControllerList.horizontalHeaderItem(2).setText( + translate("Path", "Feed(H)") + ) + self.form.toolControllerList.horizontalHeaderItem(2).setToolTip(vUnit) + self.form.toolControllerList.horizontalHeaderItem(3).setText( + translate("Path", "Feed(V)") + ) + self.form.toolControllerList.horizontalHeaderItem(3).setToolTip(vUnit) self.form.toolControllerList.horizontalHeader().setResizeMode( 0, QtGui.QHeaderView.Stretch )