Ejemplo n.º 1
0
    def _center(self):
        self.form = Form(self.formlist)

        hbox = QtGui.QHBoxLayout()
        hbox.addStretch(0.5)
        hbox.addLayout(self.form)
        hbox.addStretch(0.5)

        self.layout.addLayout(hbox)
        self.layout.addStretch(1)  # Adds some space between the
Ejemplo n.º 2
0
class Details(Page):

    def __init__(self, parent, name):
        super(Details, self).__init__(parent, name)

    def _setup(self):
        self.formlist = [
            {"column": "flowrate",
             "label": "Enter Flowrate (GPM) : ",
             "type": "textenter",
             "value": 50
             },
            {"column": "length",
             "label": "Enter Length of Pipe (feet) : ",
             "type": "textenter",
             "value": 100
             },
        ]

    def _header(self):
        label = QtGui.QLabel('<font size=16 align="center">\
                              NCF Line Sizer</font>')
        label.indent = 20
        self.layout.addWidget(label)

    def _center(self):
        self.form = Form(self.formlist)

        hbox = QtGui.QHBoxLayout()
        hbox.addStretch(0.5)
        hbox.addLayout(self.form)
        hbox.addStretch(0.5)

        self.layout.addLayout(hbox)
        self.layout.addStretch(1)  # Adds some space between the
                                   # form and the footer buttons

    def _footer(self):
        hbox = QtGui.QHBoxLayout()
        hbox.addStretch(1)

        okbut = QtGui.QPushButton("Calculate", self)
        okbut.released.connect(self.on_ok)
        hbox.addWidget(okbut)

        clearbut = QtGui.QPushButton("Cancel", self)
        clearbut.released.connect(self.on_clear)
        hbox.addWidget(clearbut)

        hbox.addStretch(1)  # Moves boxes to the center,
                            # delete to right justify

        self.layout.addLayout(hbox)
        self.layout.addStretch(1)

    def refresh(self):
        self._setup()
        self.form.clearForm()
        self.layout.update()

    def on_clear(self):
        self.form.clearForm()

    def on_ok(self):
        formdata = self.form.getData()
        self.session.flowrate = formdata["flowrate"]
        self.session.pipelength = formdata["length"]
        self.session.calculate()

        self.PM.ThisPage("Results")
Ejemplo n.º 3
0
class NewPage(Page):

    def __init__(self, parent, name):
        super(NewPage, self).__init__(parent, name)

    def _setup(self):
        self.fluidlist = self.session.fluidlist
        self.qualitylist = self.session.qualitylist

        self.formlist = [
            {"column": "fluid_id",
             "label": "Select Fluid: ",
             "type": "combobox",
             "list": self.fluidlist,
             "value": 4
             },
            {"column": "quality_id",
             "label": "Select Quality of Pipe: ",
             "type": "combobox",
             "list": self.qualitylist,
             "value": 1
             }]

    def _header(self):
        label = QtGui.QLabel('<font size=16 align="center">\
                             Non-Compressible Fluid Line Sizer</font>')
        label.indent = 20
        self.layout.addWidget(label)

    def _center(self):
        self.form = Form(self.formlist)

        hbox = QtGui.QHBoxLayout()
        hbox.addStretch(0.5)
        hbox.addLayout(self.form)
        hbox.addStretch(0.5)

        self.layout.addLayout(hbox)
        self.layout.addStretch(1)  # Adds some space between the form
                                   # and the footer buttons

    def _footer(self):
        hbox = QtGui.QHBoxLayout()
        hbox.addStretch(1)

        okbut = QtGui.QPushButton("Ok", self)
        okbut.released.connect(self.on_ok)
        hbox.addWidget(okbut)

        clearbut = QtGui.QPushButton("Cancel", self)
        clearbut.released.connect(self.on_clear)
        hbox.addWidget(clearbut)

        hbox.addStretch(1)  # Moves boxes to the center,
                            # delete to right justify

        self.layout.addLayout(hbox)
        self.layout.addStretch(1)

    def refresh(self):
        self._setup()
        self.form.UpdateComboLists([self.fluidlist, self.qualitylist])
        self.layout.update()

    def on_clear(self):
        self.form.clearForm()

    def on_ok(self):
        formdata = self.form.getData()
        self.session.quality = formdata["quality_id"]
        self.session.fluid = formdata["fluid_id"]

        self.PM.ThisPage("Details")
Ejemplo n.º 4
0
class FormPage(Page):

    def __init__(self, parent, name):
        super(FormPage, self).__init__(parent, name)

    def _setup(self):
        self.combolist = [(1, "Test1"), (2, "Test2")]  # Can be from database

        self.formlist = [
            {"column": "name", "label": "Name: ",
                "type": "textenter", "value": "Name"},
            {"column": "number", "label": "Number: ",
             "type": "textenter", "value": "XXX"},
            {"column": "question", "label": "Question?: ",
             "type": "checkbox", "value": True},
            {"column": "test_id", "label": "Select Test: ", "type":
             "combobox", "list": self.combolist, "value": 1}]

    def _header(self):
        label = QtGui.QLabel('<font size=16 align="center">My Form Page</font>')
        label.indent = 20
        self.layout.addWidget(label)

    def _center(self):
        self.form = Form(self.formlist)

        hbox = QtGui.QHBoxLayout()
        hbox.addStretch(0.5)
        hbox.addLayout(self.form)
        hbox.addStretch(0.5)

        self.layout.addLayout(hbox)
        self.layout.addStretch(1)  # Adds some space between the form and the footer buttons

    def _footer(self):
        hbox = QtGui.QHBoxLayout()
        hbox.addStretch(1)

        okbut = QtGui.QPushButton("Ok", self)
        okbut.released.connect(self.on_ok)
        hbox.addWidget(okbut)

        clearbut = QtGui.QPushButton("Cancel", self)
        clearbut.released.connect(self.on_clear)
        hbox.addWidget(clearbut)

        hbox.addStretch(1)  # Moves boxes to the center, delete to right justify

        self.layout.addLayout(hbox)
        self.layout.addStretch(1)

    def refresh(self):
        self._setup()
        self.form.UpdateComboLists([self.combolist])
        self.layout.update()

    def on_clear(self):
        self.form.clearForm()

    def on_ok(self):
        formdata = self.form.getData()
        print formdata

        self.PM.ThisPage("ButtonGridPage")
Ejemplo n.º 5
0
class NewPage(Page):
    def __init__(self, parent, name):
        super(NewPage, self).__init__(parent, name)

    def _setup(self):
        self.fluidlist = self.session.fluidlist
        self.qualitylist = self.session.qualitylist

        self.formlist = [{
            "column": "fluid_id",
            "label": "Select Fluid: ",
            "type": "combobox",
            "list": self.fluidlist,
            "value": 4
        }, {
            "column": "quality_id",
            "label": "Select Quality of Pipe: ",
            "type": "combobox",
            "list": self.qualitylist,
            "value": 1
        }]

    def _header(self):
        label = QtGui.QLabel('<font size=16 align="center">\
                             Non-Compressible Fluid Line Sizer</font>')
        label.indent = 20
        self.layout.addWidget(label)

    def _center(self):
        self.form = Form(self.formlist)

        hbox = QtGui.QHBoxLayout()
        hbox.addStretch(0.5)
        hbox.addLayout(self.form)
        hbox.addStretch(0.5)

        self.layout.addLayout(hbox)
        self.layout.addStretch(1)  # Adds some space between the form
        # and the footer buttons

    def _footer(self):
        hbox = QtGui.QHBoxLayout()
        hbox.addStretch(1)

        okbut = QtGui.QPushButton("Ok", self)
        okbut.released.connect(self.on_ok)
        hbox.addWidget(okbut)

        clearbut = QtGui.QPushButton("Cancel", self)
        clearbut.released.connect(self.on_clear)
        hbox.addWidget(clearbut)

        hbox.addStretch(1)  # Moves boxes to the center,
        # delete to right justify

        self.layout.addLayout(hbox)
        self.layout.addStretch(1)

    def refresh(self):
        self._setup()
        self.form.UpdateComboLists([self.fluidlist, self.qualitylist])
        self.layout.update()

    def on_clear(self):
        self.form.clearForm()

    def on_ok(self):
        formdata = self.form.getData()
        self.session.quality = formdata["quality_id"]
        self.session.fluid = formdata["fluid_id"]

        self.PM.ThisPage("Details")