コード例 #1
0
    def createViews(self, layout):
        ### config my window
        myColor = "white"
        self.config(bg=myColor)

        ### create some views
        vert = GUI.Vertical("", padding=1)
        self.masterHost = GUI.OptionField("masterHost",
                                          "Master host: ", ["host1", "host2"],
                                          direction="vertical",
                                          boxWidth=12)
        self.deployHost = GUI.OptionField("deployHost",
                                          "Deploy host: ", ["host1", "host2"],
                                          direction="horizontal",
                                          boxWidth=12)
        self.commandFields = [
            GUI.ButtonField("sleep1",
                            "Sleep for 1s",
                            actionCallback=self.cmdBtnClicked,
                            height=4),
            GUI.ButtonField("sleep3",
                            "Sleep for 3s",
                            actionCallback=self.cmdBtnClicked,
                            height=4),
        ]
        self.cbx1 = GUI.CheckboxField("cbx1_",
                                      "do you love me?",
                                      selectColor="lavender")
        self.cbx2 = GUI.CheckboxField("cbx2_",
                                      "do you really really love me???",
                                      selectColor="lavender")
        ###config these
        self.masterHost.config(bg=myColor)
        self.deployHost.config(bg=myColor)
        for v in self.commandFields:
            v.config(bg="white smoke")
        self.cbx1.config(bg=myColor)
        self.cbx2.config(bg=myColor)
        ### change padding from the main layout of this window
        layout.padding = 7
        ##add these to our window layout
        layout.addView(self.masterHost)
        layout.addView(self.deployHost)
        vert.addView(self.commandFields)
        layout.addView(vert)
        layout.addView(self.cbx1)
        layout.addView(self.cbx2)

        ###done layout
        return layout