Add sliders to task

This commit is contained in:
Shai Seger
2017-10-25 17:50:06 +03:00
committed by Yorik van Havre
parent 831cb793f6
commit 77193b7e36
2 changed files with 119 additions and 6 deletions

View File

@@ -38,7 +38,7 @@
<string>Stop</string>
</property>
<property name="icon">
<iconset resource="Resources/CAM_Sim.qrc">
<iconset resource="../Path.qrc">
<normaloff>:/icons/Path-BStop.svg</normaloff>:/icons/Path-BStop.svg</iconset>
</property>
<property name="iconSize">
@@ -58,7 +58,7 @@
<string>Play</string>
</property>
<property name="icon">
<iconset resource="Resources/CAM_Sim.qrc">
<iconset resource="../Path.qrc">
<normaloff>:/icons/Path-BPlay.svg</normaloff>:/icons/Path-BPlay.svg</iconset>
</property>
<property name="iconSize">
@@ -78,7 +78,7 @@
<string>Pause</string>
</property>
<property name="icon">
<iconset resource="Resources/CAM_Sim.qrc">
<iconset resource="../Path.qrc">
<normaloff>:/icons/Path-BPause.svg</normaloff>:/icons/Path-BPause.svg</iconset>
</property>
<property name="iconSize">
@@ -98,7 +98,7 @@
<string>Step</string>
</property>
<property name="icon">
<iconset resource="Resources/CAM_Sim.qrc">
<iconset resource="../Path.qrc">
<normaloff>:/icons/Path-BStep.svg</normaloff>:/icons/Path-BStep.svg</iconset>
</property>
<property name="iconSize">
@@ -118,7 +118,7 @@
<string>Fast Forward</string>
</property>
<property name="icon">
<iconset resource="Resources/CAM_Sim.qrc">
<iconset resource="../Path.qrc">
<normaloff>:/icons/Path-BFastForward.svg</normaloff>:/icons/Path-BFastForward.svg</iconset>
</property>
<property name="iconSize">
@@ -163,6 +163,107 @@
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_3">
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Speed:</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="sliderSpeed">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelGPerSec">
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>G/s</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_4">
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Accuracy:</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="sliderAccuracy">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>10</number>
</property>
<property name="pageStep">
<number>2</number>
</property>
<property name="value">
<number>10</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelAccuracy">
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>%</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
@@ -206,7 +307,7 @@
</layout>
</widget>
<resources>
<include location="Resources/CAM_Sim.qrc"/>
<include location="../Path.qrc"/>
</resources>
<connections/>
<slots>

View File

@@ -60,6 +60,10 @@ class PathSimulation:
self.Connect(form.toolButtonPause, self.SimPause)
self.Connect(form.toolButtonStep, self.SimStep)
self.Connect(form.toolButtonFF, self.SimFF)
form.sliderSpeed.valueChanged.connect(self.onSpeedBarChange)
self.onSpeedBarChange()
form.sliderAccuracy.valueChanged.connect(self.onAccuracyBarChange)
self.onAccuracyBarChange()
form.comboJobs.currentIndexChanged.connect(self.onJobChange)
jobList = FreeCAD.ActiveDocument.findObjects("Path::FeaturePython", "Job.*")
form.comboJobs.clear()
@@ -390,6 +394,14 @@ class PathSimulation:
listItem.setCheckState(QtCore.Qt.CheckState.Checked)
self.operations.append(op)
form.listOperations.addItem(listItem)
def onSpeedBarChange(self):
form = self.taskForm.form
form.labelGPerSec.setText(str(form.sliderSpeed.value()) + " G/s")
def onAccuracyBarChange(self):
form = self.taskForm.form
form.labelAccuracy.setText(str(1.1 - 0.1 * form.sliderAccuracy.value()) + "%")
def GuiBusy(self, isBusy):
form = self.taskForm.form