def __init__(self):
     self.layout = Ui.LinearLayout(
         background="#ff314859",
         orientation=Ui.VERTICAL,
     )
     Ui.TextView(
         self.layout,
         layout_width=Ui.FILL_PARENT,
         layout_height="0px",
         textSize="16dp",
         text="FullScreenWrapper2 Demo",
         textColor="#ffffffff",
         layout_weight=20,
         gravity=Ui.CENTER,
     )
     self.txt_colorbox = Ui.TextView(
         self.layout,
         layout_width=Ui.FILL_PARENT,
         layout_height="0px",
         background="#ff000000",
         layout_weight="60",
         gravity=Ui.CENTER,
     )
     self.buttonBox = Ui.LinearLayout(
         self.layout,
         layout_width=Ui.FILL_PARENT,
         layout_height="0px",
         orientation=Ui.HORIZONTAL,
         layout_weight="20",
     )
     Ui.Button(
         self.buttonBox,
         layout_width=Ui.FILL_PARENT,
         layout_height=Ui.FILL_PARENT,
         background="#ff66a3d2",
         text="Random Color",
         layout_weight=1,
         textSize="14dp",
         gravity=Ui.CENTER,
         # HERE: click callback, auto registered
         command=self.change_color,
     )
     Ui.Button(
         self.buttonBox,
         layout_width=Ui.FILL_PARENT,
         layout_height=Ui.FILL_PARENT,
         background="#ff25567b",
         layout_weight=1,
         text="Exit",
         textSize="14dp",
         gravity=Ui.CENTER,
         # HERE: call quit() on ui element will quit the current layout
         command=self.layout.quit,
     )
 def _button(self, master, **kw):
     Ui.Button(master,
               layout_width=Ui.FILL_PARENT,
               layout_height="80dp",
               textSize="14dp",
               textColor=color_white,
               layout_weight=1,
               gravity=Ui.CENTER,
               **kw)
 def _valueButton(self, master, value, background):
     return Ui.Button(
         master,
         layout_width=Ui.FILL_PARENT,
         layout_height=Ui.FILL_PARENT,
         text=value,
         textSize="14dp",
         background=background,
         textColor=color_white,
         layout_weight=1,
         gravity=Ui.CENTER,
         command=lambda value=value: self.on_but_value_handler(value),
     )
Exemplo n.º 4
0
def main():
	global view
	get_keycodes()
	gui = Ui.DroidUi()
	view = Ui.TextView(gui,
		text = 'Press any key',
		textSize = '40sp',
		layout_width = Ui.FILL_PARENT,
		gravity = Ui.CENTER,
	)
	Ui.Button(gui, text = 'Quit', command = gui.quit)
	gui.reg_event('key', display_event)
	gui.mainloop()
Exemplo n.º 5
0
 def __init__(self):
     self.about = Ui.TextView(
         Ui.ScrollView(padding='20dp', background='#ff000000'),
         text=self.about_text,
     )
     self.game = Game()
     self.outer = Ui.LinearLayout(
         Ui.LinearLayout(background='#ff000000'),
         padding='30dp',
         background='#3500ffff',
         layout_height=Ui.FILL_PARENT,
     )
     self.inner = Ui.LinearLayout(self.outer, gravity=Ui.CENTER)
     Ui.TextView(
         self.inner,
         text='Android Sudoku',
         textSize='20dip',
         layout_marginBottom='25dip',
     )
     Ui.Button(self.inner, text='Continue', command=self.resume)
     Ui.Button(self.inner, text='New Game', command=self.play)
     Ui.Button(self.inner, text='About', command=self.about.mainloop)
     Ui.Button(self.inner, text='Exit', command=self.inner.quit)
 def _datetimeLayout(self, master, name, text, command):
     layout = Ui.LinearLayout(
         master,
         layout_width=Ui.FILL_PARENT,
         layout_height=Ui.WRAP_CONTENT,
         orientation=Ui.HORIZONTAL,
         layout_weight=11,
     )
     Ui.TextView(
         layout,
         layout_width=Ui.FILL_PARENT,
         layout_height=Ui.FILL_PARENT,
         text=text,
         textColor=color_yellow,
         textSize="14dp",
         layout_weight=1,
         gravity=Ui.CENTER,
         textStyle=1,
     )
     setattr(
         self, name,
         Ui.TextView(
             layout,
             layout_width=Ui.FILL_PARENT,
             layout_height=Ui.FILL_PARENT,
             textColor=color_white,
             textSize="14dp",
             layout_weight=1,
             gravity=Ui.joinattr(Ui.LEFT, Ui.CENTER_VERTICAL),
         ))
     Ui.Button(
         layout,
         layout_width=Ui.FILL_PARENT,
         layout_height=Ui.FILL_PARENT,
         textColor=color_white,
         textSize="14dp",
         layout_weight=1,
         background=color_light,
         text="Change",
         gravity=Ui.CENTER,
         command=command,
     )
     Ui.LinearLayout(
         master,
         layout_width=Ui.FILL_PARENT,
         layout_height=Ui.WRAP_CONTENT,
         layout_weight=1,
     )
    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)