コード例 #1
0
    def __init__(self):
        Ui.DroidUi.__init__(self)
        self.result = None
        self.curdatetime = datetime.today()

        self.layout = Ui.LinearLayout(
            self,
            layout_width=Ui.FILL_PARENT,
            layout_height=Ui.FILL_PARENT,
            background="#ff314859",
            orientation=Ui.VERTICAL,
        )

        Ui.TextView(
            self.layout,
            layout_width=Ui.FILL_PARENT,
            textSize="20dp",
            text="Add Screen",
            textColor=color_white,
            gravity=Ui.CENTER,
            layout_weight=15,
        )

        self._datetimeLayout(self.layout, 'add_txt_date', 'Date',
                             self.on_but_datechange_click)
        self._datetimeLayout(self.layout, 'add_txt_time', 'Time',
                             self.on_but_timechange_click)

        valueLayout = Ui.LinearLayout(
            self.layout,
            layout_width=Ui.FILL_PARENT,
            layout_height=Ui.WRAP_CONTENT,
            orientation=Ui.HORIZONTAL,
            layout_weight=11,
        )
        Ui.TextView(
            valueLayout,
            layout_width=Ui.FILL_PARENT,
            layout_height=Ui.FILL_PARENT,
            text='Value',
            textColor=color_yellow,
            textSize="14dp",
            layout_weight=1,
            gravity=Ui.CENTER,
            textStyle=1,
        )
        self.add_txt_value = Ui.EditText(
            valueLayout,
            layout_width=Ui.FILL_PARENT,
            layout_height=Ui.FILL_PARENT,
            digits="0123456789",
            textSize="12dp",
            layout_weight=1,
            background=color_white,
            gravity=Ui.joinattr(Ui.LEFT, Ui.CENTER_VERTICAL),
        )
        Ui.Button(
            valueLayout,
            layout_width=Ui.FILL_PARENT,
            layout_height=Ui.FILL_PARENT,
            textColor=color_yellow,
            textSize="14dp",
            layout_weight=1,
            background=color_light,
            text="Save",
            gravity=Ui.CENTER,
            command=self.on_but_save_click,
        )

        Ui.TextView(
            self.layout,
            layout_width=Ui.FILL_PARENT,
            layout_height=Ui.WRAP_CONTENT,
            textSize="10dp",
            text="Type value or choose below",
            textColor=color_white,
            gravity=Ui.CENTER,
            layout_weight=5,
        )

        buttonBox1 = self._buttonLayout(self.layout)
        self._valueButton(buttonBox1, 40, color_light)
        self._valueButton(buttonBox1, 70, color_deep)
        self._valueButton(buttonBox1, 100, color_light)
        self._valueButton(buttonBox1, 120, color_deep)

        buttonBox2 = self._buttonLayout(self.layout)
        self._valueButton(buttonBox2, 150, color_deep)
        self._valueButton(buttonBox2, 180, color_light)
        self._valueButton(buttonBox2, 200, color_deep)
        self._valueButton(buttonBox2, 250, color_light)

        buttonBox3 = self._buttonLayout(self.layout)
        self._valueButton(buttonBox3, 300, color_light)
        self._valueButton(buttonBox3, 350, color_deep)
        self._valueButton(buttonBox3, 400, color_light)
        self._valueButton(buttonBox3, 450, color_deep)