Merge pull request #6530 from sliptonic/bug/6114

[Path] Fix minor non-modal bug.  Fixes 6114
This commit is contained in:
sliptonic
2022-03-11 10:03:53 -06:00
committed by GitHub
5 changed files with 34 additions and 86 deletions

View File

@@ -85,7 +85,6 @@
<file>icons/edge-join-round.svg</file>
<file>icons/preferences-path.svg</file>
<file>panels/AxisMapEdit.ui</file>
<file>panels/DlgJobChooser.ui</file>
<file>panels/DlgJobCreate.ui</file>
<file>panels/DlgJobModelSelect.ui</file>
<file>panels/DlgJobTemplateExport.ui</file>

View File

@@ -1,70 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DlgJobChooser</class>
<widget class="QDialog" name="DlgJobChooser">
<property name="windowModality">
<enum>Qt::WindowModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>264</width>
<height>92</height>
</rect>
</property>
<property name="windowTitle">
<string>Choose a Path Job</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QComboBox" name="cboProject"/>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DlgJobChooser</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>DlgJobChooser</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -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
)

View File

@@ -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)

View File

@@ -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):