Skip to content

Commit

Permalink
added standard buttons and title name of the task panel
Browse files Browse the repository at this point in the history
  • Loading branch information
amrit3701 committed Jun 22, 2017
1 parent 5acca2b commit 5d9467e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 62 deletions.
5 changes: 3 additions & 2 deletions StraightRebar.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
class _StraightRebarTaskPanel:
def __init__(self, Rebar = None):
self.form = FreeCADGui.PySideUic.loadUi(os.path.splitext(__file__)[0]+".ui")
self.form.setWindowTitle(QtGui.QApplication.translate("Arch", "Straight Rebar", None))
self.form.amount_radio.clicked.connect(self.amount_radio_clicked)
self.form.spacing_radio.clicked.connect(self.spacing_radio_clicked)
QtCore.QObject.connect(self.form.submit, QtCore.SIGNAL("clicked()"), self.accept)
self.form.image.setPixmap(QtGui.QPixmap(os.path.split(os.path.abspath(__file__))[0]+"/icons/StraightRebar.svg"))
self.Rebar = Rebar

def getStandardButtons(self):
return int(QtGui.QDialogButtonBox.Close)
return int(QtGui.QDialogButtonBox.Ok) | int(QtGui.QDialogButtonBox.Cancel)

def accept(self):
f_cover = self.form.frontCover.text()
Expand Down Expand Up @@ -46,6 +46,7 @@ def accept(self):
FreeCAD.Console.PrintMessage("Done!\n")
FreeCADGui.Control.closeDialog(self)


def amount_radio_clicked(self):
self.form.spacing.setEnabled(False)
self.form.amount.setEnabled(True)
Expand Down
24 changes: 2 additions & 22 deletions StraightRebar.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>245</width>
<height>377</height>
<width>197</width>
<height>306</height>
</rect>
</property>
<property name="windowTitle">
Expand All @@ -23,25 +23,6 @@
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="4" column="0" alignment="Qt::AlignHCenter|Qt::AlignVCenter">
<widget class="QPushButton" name="submit">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>OK</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="heading">
<property name="font">
Expand Down Expand Up @@ -235,7 +216,6 @@
<tabstop>spacing_radio</tabstop>
<tabstop>amount</tabstop>
<tabstop>spacing</tabstop>
<tabstop>submit</tabstop>
</tabstops>
<resources/>
<connections/>
Expand Down
4 changes: 2 additions & 2 deletions UShapeRebar.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
class _UShapeRebarTaskPanel:
def __init__(self, Rebar = None):
self.form = FreeCADGui.PySideUic.loadUi(os.path.splitext(__file__)[0]+".ui")
self.form.setWindowTitle(QtGui.QApplication.translate("Arch", "U-Shape Rebar", None))
self.form.amount_radio.clicked.connect(self.amount_radio_clicked)
self.form.spacing_radio.clicked.connect(self.spacing_radio_clicked)
QtCore.QObject.connect(self.form.submit, QtCore.SIGNAL("clicked()"), self.accept)
self.form.image.setPixmap(QtGui.QPixmap(os.path.split(os.path.abspath(__file__))[0]+"/icons/UShapeRebar.svg"))
self.Rebar = Rebar

def getStandardButtons(self):
return int(QtGui.QDialogButtonBox.Close)
return int(QtGui.QDialogButtonBox.Ok) | int(QtGui.QDialogButtonBox.Cancel)

def accept(self):
f_cover = self.form.frontCover.text()
Expand Down
52 changes: 16 additions & 36 deletions UShapeRebar.ui
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>StraightRebar</class>
<widget class="QDialog" name="StraightRebar">
<class>UShapeRebar</class>
<widget class="QDialog" name="UShapeRebar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>197</width>
<height>387</height>
<height>354</height>
</rect>
</property>
<property name="windowTitle">
Expand All @@ -23,38 +23,6 @@
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="4" column="0">
<widget class="QLabel" name="heading">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Fill all the values</string>
</property>
</widget>
</item>
<item row="8" column="0" alignment="Qt::AlignHCenter|Qt::AlignVCenter">
<widget class="QPushButton" name="submit">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>OK</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
Expand Down Expand Up @@ -215,6 +183,19 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="heading">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Fill all the values</string>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
Expand Down Expand Up @@ -245,7 +226,6 @@
<tabstop>spacing_radio</tabstop>
<tabstop>amount</tabstop>
<tabstop>spacing</tabstop>
<tabstop>submit</tabstop>
</tabstops>
<resources/>
<connections/>
Expand Down

0 comments on commit 5d9467e

Please sign in to comment.