def __init__(self, title):

        elm_conf = Configuration()
        scale = elm_conf.scale

        Window.__init__(self, title, ELM_WIN_BASIC, title=title, autodel=True)

        self.size = scale * 480, scale * 320

        bg = Background(self, size_hint_weight=EXPAND_BOTH)
        self.resize_object_add(bg)
        bg.show()

        # bt = Button(self, text="Close")
        # bt.callback_clicked_add(lambda b: self.delete())

        self.scroller = Scroller(self, policy=SCROLL_BOTH,
            size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        self.resize_object_add(self.scroller)
        self.scroller.show()

        self.box = Box(self)
        self.box.size_hint_weight = EXPAND_BOTH
        self.scroller.content = self.box

        self.show()
Beispiel #2
0
 def buildSubs(self):
     self.subWin = Window("lifetracker", ELM_WIN_DIALOG_BASIC, self, size=(300, 300))
     self.subWin.title = "Life Tracker Assignment"
     bg = Background(self.subWin, size_hint_weight=EXPAND_BOTH)
     bg.show()
     self.subWin.resize_object_add(bg)
     self.subWin.callback_delete_request_add(lambda o: elm.exit())
     self.ourWin = Window("lifetracker", ELM_WIN_DIALOG_BASIC, self, size=(300, 300))
     self.ourWin.title = "Life Tracker Key Strokes"
     bg = Background(self.ourWin, size_hint_weight=EXPAND_BOTH)
     bg.show()
     self.ourWin.resize_object_add(bg)
     self.ourWin.callback_delete_request_add(lambda o: elm.exit())
     self.ourWin.elm_event_callback_add(self.eventsCb)
     
     self.ourLife = ourLabel = Entry(self.ourWin, editable=False)
     ourLabel.size_hint_weight = EXPAND_BOTH
     ourLabel.size_hint_align = FILL_BOTH
     ourLabel.text_style_user_push("DEFAULT='font_size=20'")
     ourLabel.text = "Up and Down for Their Life, Left and Right for Mine"
     ourLabel.show()
     
     self.ourEntry = ourEntry = Entry(self.subWin)
     ourEntry.size_hint_weight = EXPAND_HORIZ
     ourEntry.size_hint_align = (-1, 0)
     ourEntry.single_line_set(True)
     ourEntry.text_style_user_push("DEFAULT='font_size=50'")
     ourEntry.callback_activated_add(self.ourLifeUpdate)
     ourEntry.text = "20"
     ourEntry.show()
     
     self.theirEntry = theirEntry = Entry(self.subWin)
     theirEntry.size_hint_weight = EXPAND_HORIZ
     theirEntry.size_hint_align = (-1, 0)
     theirEntry.single_line_set(True)
     theirEntry.text_style_user_push("DEFAULT='font_size=50'")
     theirEntry.callback_activated_add(self.theirLifeUpdate)
     theirEntry.text = "20"
     theirEntry.show()
     
     resetBtn = Button(self.subWin)
     resetBtn.text = "Reset life totals"
     resetBtn.callback_pressed_add(self.resetLifeTotals)
     resetBtn.show()
     
     entryBox = Box(self.subWin)
     entryBox.size_hint_weight = EXPAND_HORIZ
     entryBox.pack_end(ourEntry)
     entryBox.pack_end(theirEntry)
     entryBox.pack_end(resetBtn)
     entryBox.show()
     
     self.ourWin.resize_object_add(ourLabel)
     self.subWin.resize_object_add(entryBox)
     
     self.ourWin.show()
     self.subWin.show()
     
     self.ourWin.center(True, True)
     self.subWin.center(True, True)
Beispiel #3
0
    def __init__(self, title):

        elm_conf = Configuration()
        scale = elm_conf.scale

        Window.__init__(self, title, ELM_WIN_BASIC, title=title, autodel=True)

        self.size = scale * 480, scale * 320

        bg = Background(self, size_hint_weight=EXPAND_BOTH)
        self.resize_object_add(bg)
        bg.show()

        # bt = Button(self, text="Close")
        # bt.callback_clicked_add(lambda b: self.delete())

        self.scroller = Scroller(self,
                                 policy=SCROLL_BOTH,
                                 size_hint_weight=EXPAND_BOTH,
                                 size_hint_align=FILL_BOTH)
        self.resize_object_add(self.scroller)
        self.scroller.show()

        self.box = Box(self)
        self.box.size_hint_weight = EXPAND_BOTH
        self.scroller.content = self.box

        self.show()
def bg_plain_clicked(obj, item=None):
    win = Window("bg plain", ELM_WIN_BASIC, title="Bg Plain", autodel=True,
        size=(320, 320))

    bg = Background(win, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bg)
    bg.show()

    win.show()
def inlined_add(parent):
    win = Window("inlined",
                 ELM_WIN_INLINED_IMAGE,
                 parent,
                 pos=(10, 100),
                 size=(150, 70))

    bg = Background(win, color=(110, 210, 120), size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bg)
    bg.show()

    bx = Box(win,
             size_hint_weight=EXPAND_HORIZ,
             size_hint_align=(EVAS_HINT_FILL, 0.0))
    bx.show()

    lb = LOG(win, "ELM_WIN_INLINED_IMAGE")
    bx.pack_end(lb)

    lb = LOG(win, "Profile: <b>N/A</b>")
    bx.pack_end(lb)
    win.data["lb"] = lb

    win.inlined_image_object.pos = 10, 100
    win.inlined_image_object.size = 150, 70

    win.callback_profile_changed_add(win_profile_changed_cb)
    win.show()

    return win
class TestElmImage(unittest.TestCase):

    def setUp(self):
        self.w = Window("t", ELM_WIN_BASIC)
        self.o = Image(self.w)

    def tearDown(self):
        self.o.delete()
        self.w.delete()

    def testImageConstructor(self):
        self.assertIsNotNone(self.o)
        self.assertEqual(Eo.parent_get(self.o), self.w)

    def testImageFile(self):
        self.o.file = os.path.join(script_path, u"icon.png")
        self.assertEqual(
            self.o.file[0], os.path.join(script_path, u"icon.png"))
        self.assertEqual(self.o.object_size, (48, 48))

    def testImageFileException(self):
        self.assertRaises(
            RuntimeError, setattr, self.o, "file", u"this_fails.png")

    def testImageEvas(self):
        self.assertIsInstance(self.o.object, evasImage)

    def testImageBooleans(self):
        self.assertTrue(self.o.aspect_fixed)
        self.o.aspect_fixed = False
        self.assertFalse(self.o.aspect_fixed)

        self.assertFalse(self.o.editable)
        self.o.editable = True
        self.assertTrue(self.o.editable)

        self.assertFalse(self.o.fill_outside)
        self.o.fill_outside = True
        self.assertTrue(self.o.fill_outside)

        self.assertFalse(self.o.no_scale)
        self.o.no_scale = True
        self.assertTrue(self.o.no_scale)

        # Write-only value
        self.o.preload_disabled = True
        self.assertRaises(AttributeError, getattr, self.o, "preload_disabled")

        self.assertEqual(self.o.resizable, (True, True))
        self.o.resizable = False, False
        self.assertEqual(self.o.resizable, (False, False))

        self.assertTrue(self.o.smooth)
        self.o.smooth = False
        self.assertFalse(self.o.smooth)
Beispiel #7
0
class TestElmImage(unittest.TestCase):
    def setUp(self):
        self.w = Window("t", ELM_WIN_BASIC)
        self.o = Image(self.w)

    def tearDown(self):
        self.o.delete()
        self.w.delete()

    def testImageConstructor(self):
        self.assertIsNotNone(self.o)
        self.assertEqual(Eo.parent_get(self.o), self.w)

    def testImageFile(self):
        self.o.file = os.path.join(script_path, u"icon.png")
        self.assertEqual(self.o.file[0], os.path.join(script_path,
                                                      u"icon.png"))
        self.assertEqual(self.o.object_size, (48, 48))

    def testImageFileException(self):
        self.assertRaises(RuntimeError, setattr, self.o, "file",
                          u"this_fails.png")

    def testImageEvas(self):
        self.assertIsInstance(self.o.object, evasImage)

    def testImageBooleans(self):
        self.assertTrue(self.o.aspect_fixed)
        self.o.aspect_fixed = False
        self.assertFalse(self.o.aspect_fixed)

        self.assertFalse(self.o.editable)
        self.o.editable = True
        self.assertTrue(self.o.editable)

        self.assertFalse(self.o.fill_outside)
        self.o.fill_outside = True
        self.assertTrue(self.o.fill_outside)

        self.assertFalse(self.o.no_scale)
        self.o.no_scale = True
        self.assertTrue(self.o.no_scale)

        # Write-only value
        self.o.preload_disabled = True
        self.assertRaises(AttributeError, getattr, self.o, "preload_disabled")

        self.assertEqual(self.o.resizable, (True, True))
        self.o.resizable = False, False
        self.assertEqual(self.o.resizable, (False, False))

        self.assertTrue(self.o.smooth)
        self.o.smooth = False
        self.assertFalse(self.o.smooth)
def bg_image_clicked(obj, item=None):
    win = Window("bg-image", ELM_WIN_BASIC, title="Bg Image", autodel=True,
        size=(320, 320), size_hint_min=(160, 160), size_hint_max=(320,320))

    bg = Background(win, file=ic_file, option=ELM_BG_OPTION_SCALE,
        size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bg)
    bg.show()

    win.show()

    (filename, group) = bg.file_get()
    print(("Background image: '%s'  group: '%s'" % (filename, group)))
    print(("Option: %d" % (bg.option_get())))
def inlined_add(parent):
    win = Window("inlined", ELM_WIN_INLINED_IMAGE, parent, pos=(10, 100),
        size=(150, 70))

    bg = Background(win, color=(110, 210, 120), size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bg)
    bg.show()

    bx = Box(win, size_hint_weight=EXPAND_HORIZ,
        size_hint_align=(EVAS_HINT_FILL, 0.0))
    bx.show()

    lb = LOG(win, "ELM_WIN_INLINED_IMAGE")
    bx.pack_end(lb)

    lb = LOG(win, "Profile: <b>N/A</b>")
    bx.pack_end(lb)
    win.data["lb"] = lb

    win.inlined_image_object.pos = 10, 100
    win.inlined_image_object.size = 150, 70

    win.callback_profile_changed_add(win_profile_changed_cb)
    win.show()

    return win
 def __init__(self, cmd):
     self.cmd = cmd
     self.cmd_exe = None
     
     win = self.win = Window("ecore-ex", ELM_WIN_DIALOG_BASIC)
     win.title = "Ecore Example"
     win.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
     win.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL
     win.resize(300, 200)
     win.callback_delete_request_add(lambda o: elementary.exit())
     win.show()
     win.activate()
     
     self.sendEntry = Entry(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
     self.sendEntry.show()
     
     self.sendButton = Button(win, size_hint_weight=EXPAND_HORIZ,
                           size_hint_align=FILL_HORIZ)
     self.sendButton.text = "Send!"
     self.sendButton.callback_pressed_add(self.sendPressed)
     self.sendButton.show()
     
     box = Box(win, size_hint_weight=EXPAND_HORIZ,
                        size_hint_align=FILL_HORIZ)
     box.pack_end(self.sendEntry)
     box.pack_end(self.sendButton)
     box.show()
     
     win.resize_object_add(box)
     
     self.run_command(cmd)
def gesture_layer_clicked(obj):
    w = 480
    h = 800

    win = Window("gesture-layer", ELM_WIN_BASIC, title="Gesture Layer",
        autodel=True, size=(w, h))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    bg = Background(win, file=os.path.join(img_path, "wood_01.jpg"),
        size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bg)
    bg.show()

    photos = []

    photos.append(photo_object_add(win, None,
        os.path.join(img_path, "pol_sky.png"), 200, 200, 365, 400, 0))
    photos.append(photo_object_add(win, None,
        os.path.join(img_path, "pol_twofish.png"), 40, 300, 365, 400, 45))

    en = Entry(win, line_wrap=ELM_WRAP_MIXED)
    en.text = "You can use whatever object you want, even entries like this."

    postit = Layout(win,
        file=(os.path.join(script_path, "postit_ent.edj"), "main"))
    postit.part_content_set("ent", en)

    photos.append(photo_object_add(win, postit, None, 50, 50, 382, 400, 355))

    win.show()
Beispiel #12
0
class TestElmIcon(unittest.TestCase):
    def setUp(self):
        self.w = Window("t", ELM_WIN_BASIC)
        self.o = Icon(self.w)

    def tearDown(self):
        self.o.delete()
        self.w.delete()

    def testIconConstructor(self):
        self.assertIsNotNone(self.o)
        self.assertEqual(Eo.parent_get(self.o), self.w)

    def testIconStandard(self):
        self.o.standard = u"elementary"
        self.assertEqual(u"elementary", self.o.standard)

    def testIconStandardException(self):
        self.assertRaises(RuntimeWarning, setattr, self.o, "standard",
                          u"this_fails")
class TestElmIcon(unittest.TestCase):

    def setUp(self):
        self.w = Window("t", ELM_WIN_BASIC)
        self.o = Icon(self.w)

    def tearDown(self):
        self.o.delete()
        self.w.delete()

    def testIconConstructor(self):
        self.assertIsNotNone(self.o)
        self.assertEqual(Eo.parent_get(self.o), self.w)

    def testIconStandard(self):
        self.o.standard = u"elementary"
        self.assertEqual(u"elementary", self.o.standard)

    def testIconStandardException(self):
        self.assertRaises(
            RuntimeWarning, setattr, self.o, "standard", u"this_fails")
def icon_transparent_clicked(obj, item=None):
    win = Window("icon-transparent", ELM_WIN_BASIC, title="Icon Transparent",
        autodel=True, alpha=True)
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    icon = Icon(win, file=os.path.join(img_path, "logo.png"),
        resizable=(False, False))
    win.resize_object_add(icon)
    icon.show()

    win.show()
def icon_transparent_clicked(obj, item=None):
    win = Window("icon-transparent",
                 ELM_WIN_BASIC,
                 title="Icon Transparent",
                 autodel=True,
                 alpha=True)
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    icon = Icon(win,
                file=os.path.join(img_path, "logo.png"),
                resizable=(False, False))
    win.resize_object_add(icon)
    icon.show()

    win.show()
def bg_plain_clicked(obj, item=None):
    win = Window("bg plain",
                 ELM_WIN_BASIC,
                 title="Bg Plain",
                 autodel=True,
                 size=(320, 320))

    bg = Background(win, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bg)
    bg.show()

    win.show()
Beispiel #17
0
def gesture_layer_clicked(obj):
    w = 480
    h = 800

    win = Window("gesture-layer",
                 ELM_WIN_BASIC,
                 title="Gesture Layer",
                 autodel=True,
                 size=(w, h))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    bg = Background(win,
                    file=os.path.join(img_path, "wood_01.jpg"),
                    size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bg)
    bg.show()

    photos = []

    photos.append(
        photo_object_add(win, None, os.path.join(img_path, "pol_sky.png"), 200,
                         200, 365, 400, 0))
    photos.append(
        photo_object_add(win, None, os.path.join(img_path, "pol_twofish.png"),
                         40, 300, 365, 400, 45))

    en = Entry(win, line_wrap=ELM_WRAP_MIXED)
    en.text = "You can use whatever object you want, even entries like this."

    postit = Layout(win,
                    file=(os.path.join(script_path, "postit_ent.edj"), "main"))
    postit.part_content_set("ent", en)

    photos.append(photo_object_add(win, postit, None, 50, 50, 382, 400, 355))

    win.show()
def bg_image_clicked(obj, item=None):
    win = Window("bg-image",
                 ELM_WIN_BASIC,
                 title="Bg Image",
                 autodel=True,
                 size=(320, 320),
                 size_hint_min=(160, 160),
                 size_hint_max=(320, 320))

    bg = Background(win,
                    file=ic_file,
                    option=ELM_BG_OPTION_SCALE,
                    size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bg)
    bg.show()

    win.show()

    (filename, group) = bg.file_get()
    print(("Background image: '%s'  group: '%s'" % (filename, group)))
    print(("Option: %d" % (bg.option_get())))
Beispiel #19
0
 def setUp(self):
     self.w = Window("t", ELM_WIN_BASIC)
     self.o = Icon(self.w)
def list2_clicked(obj, item=None):
    win = Window("list-2", ELM_WIN_BASIC, title="List 2",
        autodel=True, size=(320, 320))

    bg = Background(win, file=os.path.join(img_path, "plant_01.jpg"),
        size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bg)
    bg.show()

    bx = Box(win, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bx)
    bx.show()

    li = List(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH,
        mode=ELM_LIST_LIMIT)

    ic = Icon(win, file=os.path.join(img_path, "logo_small.png"))
    it = li.item_append("Hello", ic, callback=my_list2_sel)
    it.selected_set(True)
    ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
        resizable=(False, False))
    li.item_append("world", ic)
    ic = Icon(win, standard="edit", resizable=(False, False))
    li.item_append(".", ic)

    ic = Icon(win, standard="delete", resizable=(False, False))
    ic2 = Icon(win, standard="clock", resizable=(False, False))
    it2 = li.item_append("How", ic, ic2)

    bx2 = Box(win, horizontal=True)

    ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
        resizable=(False, False), size_hint_align=ALIGN_CENTER)
    bx2.pack_end(ic)
    ic.show()

    ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
        resizable=(False, False), size_hint_align=(0.5, 0.0))
    bx2.pack_end(ic)
    ic.show()

    li.item_append("are", bx2)

    li.item_append("you")
    li.item_append("doing")
    li.item_append("out")
    li.item_append("there")
    li.item_append("today")
    li.item_append("?")
    li.item_append("Here")
    li.item_append("are")
    li.item_append("some")
    li.item_append("more")
    li.item_append("items")
    li.item_append("Longer label.")

    li.go()

    bx.pack_end(li)
    li.show()

    bx2 = Box(win, horizontal=True, homogeneous=True,
        size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH)

    bt = Button(win, text="Clear", size_hint_align=FILL_BOTH,
        size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_list2_clear, li)
    bx2.pack_end(bt)
    bt.show()

    bx.pack_end(bx2)
    bx2.show()

    win.show()
def list2_clicked(obj, item=None):
    win = Window("list-2",
                 ELM_WIN_BASIC,
                 title="List 2",
                 autodel=True,
                 size=(320, 320))

    bg = Background(win,
                    file=os.path.join(img_path, "plant_01.jpg"),
                    size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bg)
    bg.show()

    bx = Box(win, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bx)
    bx.show()

    li = List(win,
              size_hint_align=FILL_BOTH,
              size_hint_weight=EXPAND_BOTH,
              mode=ELM_LIST_LIMIT)

    ic = Icon(win, file=os.path.join(img_path, "logo_small.png"))
    it = li.item_append("Hello", ic, callback=my_list2_sel)
    it.selected_set(True)
    ic = Icon(win,
              file=os.path.join(img_path, "logo_small.png"),
              resizable=(False, False))
    li.item_append("world", ic)
    ic = Icon(win, standard="edit", resizable=(False, False))
    li.item_append(".", ic)

    ic = Icon(win, standard="delete", resizable=(False, False))
    ic2 = Icon(win, standard="clock", resizable=(False, False))
    it2 = li.item_append("How", ic, ic2)

    bx2 = Box(win, horizontal=True)

    ic = Icon(win,
              file=os.path.join(img_path, "logo_small.png"),
              resizable=(False, False),
              size_hint_align=ALIGN_CENTER)
    bx2.pack_end(ic)
    ic.show()

    ic = Icon(win,
              file=os.path.join(img_path, "logo_small.png"),
              resizable=(False, False),
              size_hint_align=(0.5, 0.0))
    bx2.pack_end(ic)
    ic.show()

    li.item_append("are", bx2)

    li.item_append("you")
    li.item_append("doing")
    li.item_append("out")
    li.item_append("there")
    li.item_append("today")
    li.item_append("?")
    li.item_append("Here")
    li.item_append("are")
    li.item_append("some")
    li.item_append("more")
    li.item_append("items")
    li.item_append("Longer label.")

    li.go()

    bx.pack_end(li)
    li.show()

    bx2 = Box(win,
              horizontal=True,
              homogeneous=True,
              size_hint_weight=EXPAND_HORIZ,
              size_hint_align=FILL_BOTH)

    bt = Button(win,
                text="Clear",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_list2_clear, li)
    bx2.pack_end(bt)
    bt.show()

    bx.pack_end(bx2)
    bx2.show()

    win.show()
Beispiel #22
0
    def __init__(self,
                 parent,
                 title='About',
                 standardicon='dialog-information',
                 version='N/A',
                 authors='No One',
                 licen='GPL',
                 webaddress='',
                 info='Something, something, turtles'):

        if AboutWindow.__initialized:
            raise InstanceError(
                "You can't create more than 1 instance of AboutWindow")
        AboutWindow.__initialized = True
        self.parent = parent
        Window.__init__(self, title, ELM_WIN_DIALOG_BASIC, autodel=True)
        self.callback_delete_request_add(self.cb_close)
        background = Background(self, size_hint_weight=EXPAND_BOTH)
        self.resize_object_add(background)
        background.show()

        frame = Frame(self,
                      style='pad_large',
                      size_hint_weight=EXPAND_BOTH,
                      size_hint_align=FILL_BOTH)
        self.resize_object_add(frame)
        frame.show()

        hbox = Box(self, horizontal=True, padding=(12, 12))
        frame.content = hbox
        hbox.show()

        vbox = Box(self,
                   align=(0.0, 0.0),
                   padding=(6, 6),
                   size_hint_weight=EXPAND_VERT,
                   size_hint_align=FILL_VERT)
        hbox.pack_end(vbox)
        vbox.show()

        # icon + version
        icon = Icon(self, size_hint_min=(64, 64))
        icon.standard_set(standardicon)
        vbox.pack_end(icon)
        icon.show()

        ver_lb = Label(self, text=f'Version: {version}')
        vbox.pack_end(ver_lb)
        ver_lb.show()

        sep = Separator(self, horizontal=True)
        vbox.pack_end(sep)
        sep.show()

        # buttons
        btn = Button(self, text=(title), size_hint_align=FILL_HORIZ)
        btn.callback_clicked_add(lambda b: self.entry.text_set(info))
        vbox.pack_end(btn)
        btn.show()

        btn = Button(self, text=('Website'), size_hint_align=FILL_HORIZ)
        btn.callback_clicked_add(lambda b: xdg_open(webaddress))
        vbox.pack_end(btn)
        btn.show()

        btn = Button(self, text=('Authors'), size_hint_align=FILL_HORIZ)
        btn.callback_clicked_add(lambda b: self.entry.text_set(authors))
        vbox.pack_end(btn)
        btn.show()

        btn = Button(self, text=('License'), size_hint_align=FILL_HORIZ)
        btn.callback_clicked_add(lambda b: self.entry.text_set(licen))
        vbox.pack_end(btn)
        btn.show()

        # main text
        self.entry = Entry(self,
                           editable=False,
                           scrollable=True,
                           text=info,
                           size_hint_weight=EXPAND_BOTH,
                           size_hint_align=FILL_BOTH)
        self.entry.callback_anchor_clicked_add(lambda e, i: xdg_open(i.name))
        hbox.pack_end(self.entry)
        self.entry.show()

        self.resize(400, 200)
        self.show()
def genlist2_clicked(obj, item=None):
    win = Window("Genlist", ELM_WIN_BASIC, title="Genlist test 2",
        autodel=True, size=(320, 320))

    bg = Background(win, file=os.path.join(img_path, "plant_01.jpg"),
        size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bg)
    bg.show()

    bx = Box(win, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bx)
    bx.show()

    gl = Genlist(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
    gl.show()

    itc1 = GenlistItemClass(item_style="default",
                            text_get_func=gl_text_get,
                            content_get_func=gl_content_get,
                            state_get_func=gl_state_get)

    gl.item_append(itc1, 1001, func=gl_item_sel)
    gl.item_append(itc1, 1002, func=gl_item_sel)
    gl.item_append(itc1, 1003, func=gl_item_sel)
    gl.item_append(itc1, 1004, func=gl_item_sel)
    gl.item_append(itc1, 1005, func=gl_item_sel)
    gl.item_append(itc1, 1006, func=gl_item_sel)
    gl.item_append(itc1, 1007, func=gl_item_sel)

    bx.pack_end(gl)

    bx2 = Box(win, horizontal=True, homogeneous=True,
        size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH)

    def my_gl_first(bt, gl):
        gli = gl.first_item
        if gli:
            gli.show()
            gli.selected = True

    bt = Button(win, text="/\\", size_hint_align=FILL_BOTH,
        size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_first, gl)
    bx2.pack_end(bt)
    bt.show()


    def my_gl_last(bt, gl):
        gli = gl.last_item_get()
        if gli:
            gli.show()
            gli.selected = True

    bt = Button(win, text="\\/", size_hint_align=FILL_BOTH,
        size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_last, gl)
    bx2.pack_end(bt)
    bt.show()


    def my_gl_disable(bt, gl):
        gli = gl.selected_item
        if gli:
            gli.disabled = True
            gli.selected = False
            gli.update()
        else:
            print("no item selected")

    bt = Button(win, text="#", size_hint_align=FILL_BOTH,
        size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_disable, gl)
    bx2.pack_end(bt)
    bt.show()


    def my_gl_update_all(bt, gl):
        gli = gl.first_item_get()
        i = 0
        while gli:
            gli.update()
            print(i)
            i = i + 1
            gli = gli.next_get()

    bt = Button(win, text="U", size_hint_align=FILL_BOTH,
        size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_update_all, gl)
    bx2.pack_end(bt)
    bt.show()

    bx.pack_end(bx2)
    bx2.show()


    bx2 = Box(win, horizontal=True, homogeneous=True,
        size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH)


    def my_gl_clear(bt, gl):
        gl.clear()

    bt = Button(win, text="X", size_hint_align=FILL_BOTH,
        size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_clear, gl)
    bx2.pack_end(bt)
    bt.show()


    class MyGlAdd:
        i = 0
    def my_gl_add(bt, gl, itc1):
        gl.item_append(itc1, MyGlAdd.i, func=gl_item_sel)
        MyGlAdd.i = MyGlAdd.i + 1

    bt = Button(win, text="+", size_hint_align=FILL_BOTH,
        size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_add, gl, itc1)
    bx2.pack_end(bt)
    bt.show()


    def my_gl_del(bt, gl):
        gli = gl.selected_item_get()
        if gli:
            gli.delete()
        else:
            print("no item selected")

    bt = Button(win, text="-", size_hint_align=FILL_BOTH,
        size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_del, gl)
    bx2.pack_end(bt)
    bt.show()

    bx.pack_end(bx2)
    bx2.show()

    bx2 = Box(win, horizontal=True, homogeneous=True,
        size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH)


    class MyGlInsertBefore:
        i = 0
    def my_gl_insert_before(bt, gl, itc1):
        gli = gl.selected_item_get()
        if gli:
            gl.item_insert_before(itc1, MyGlInsertBefore.i, gli,
                func=gl_item_sel)
            MyGlInsertBefore.i = MyGlInsertBefore.i + 1
        else:
            print("no item selected")

    bt = Button(win, text="+ before", size_hint_align=FILL_BOTH,
        size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_insert_before, gl, itc1)
    bx2.pack_end(bt)
    bt.show()


    class MyGlInsertAfter:
        i = 0
    def my_gl_insert_after(bt, gl, itc1):
        gli = gl.selected_item_get()
        if gli:
            gl.item_insert_after(itc1, MyGlInsertAfter.i, gli, func=gl_item_sel)
            MyGlInsertAfter.i = MyGlInsertAfter.i + 1
        else:
            print("no item selected")

    bt = Button(win, text="+ after", size_hint_align=FILL_BOTH,
        size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_insert_after, gl, itc1)
    bx2.pack_end(bt)
    bt.show()


    def my_gl_flush(bt, gl):
        def my_gl_flush_delay():
            cache_all_flush()
        Timer(1.2, my_gl_flush_delay)
    bt = Button(win, text="Flush", size_hint_align=FILL_BOTH,
        size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_flush, gl)
    bx2.pack_end(bt)
    bt.show()

    bx.pack_end(bx2)
    bx2.show()

    win.show()
    def __init__(self, parent, title="About", standardicon="dialog-information", \
                        version="N/A", authors="No One", \
                        licen="GPL", webaddress="", info="Something, something, turtles"):

        if AboutWindow.__initialized:
            raise InstanceError("You can't create more than 1 instance of AboutWindow")
        AboutWindow.__initialized = True

        Window.__init__(self, title, ELM_WIN_DIALOG_BASIC, autodel=True)
        self.callback_delete_request_add(self.close_inst)
        background = Background(self, size_hint_weight=EXPAND_BOTH)
        self.resize_object_add(background)
        background.show()

        fr = Frame(self, style='pad_large', size_hint_weight=EXPAND_BOTH,
                   size_hint_align=FILL_BOTH)
        self.resize_object_add(fr)
        fr.show()

        hbox = Box(self, horizontal=True, padding=(12,12))
        fr.content = hbox
        hbox.show()

        vbox = Box(self, align=(0.0,0.0), padding=(6,6),
                   size_hint_weight=EXPAND_VERT, size_hint_align=FILL_VERT)
        hbox.pack_end(vbox)
        vbox.show()

        # icon + version
        ic = Icon(self, size_hint_min=(64,64))
        ic.standard_set(standardicon)
        vbox.pack_end(ic)
        ic.show()

        lb = Label(self, text=('Version: %s') % version)
        vbox.pack_end(lb)
        lb.show()

        sep = Separator(self, horizontal=True)
        vbox.pack_end(sep)
        sep.show()

        # buttons
        bt = Button(self, text=(title), size_hint_align=FILL_HORIZ)
        bt.callback_clicked_add(lambda b: self.entry.text_set(info))
        vbox.pack_end(bt)
        bt.show()

        bt = Button(self, text=('Website'),size_hint_align=FILL_HORIZ)
        bt.callback_clicked_add(lambda b: xdg_open(webaddress))
        vbox.pack_end(bt)
        bt.show()

        bt = Button(self, text=('Authors'), size_hint_align=FILL_HORIZ)
        bt.callback_clicked_add(lambda b: self.entry.text_set(authors))
        vbox.pack_end(bt)
        bt.show()

        bt = Button(self, text=('License'), size_hint_align=FILL_HORIZ)
        bt.callback_clicked_add(lambda b: self.entry.text_set(licen))
        vbox.pack_end(bt)
        bt.show()

        # main text
        self.entry = Entry(self, editable=False, scrollable=True, text=info,
                        size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        self.entry.callback_anchor_clicked_add(lambda e,i: xdg_open(i.name))
        hbox.pack_end(self.entry)
        self.entry.show()

        self.resize(400, 200)
        self.show()
def window_states_clicked(obj):
    win = Window("window-states",
                 ELM_WIN_BASIC,
                 title="Window States test",
                 autodel=True,
                 size=(280, 400))
    win.callback_moved_add(cb_win_moved)
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    print(win.available_profiles)

    bg = Background(win, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bg)
    bg.show()

    vbox = Box(win, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(vbox)
    vbox.show()

    hbox = Box(win,
               horizontal=True,
               size_hint_align=FILL_HORIZ,
               size_hint_weight=EXPAND_HORIZ)
    vbox.pack_end(hbox)
    hbox.show()

    for state in [True, False]:
        bt = Button(win,
                    text="Alpha " + ("On" if state else "Off"),
                    size_hint_align=FILL_HORIZ,
                    size_hint_weight=EXPAND_HORIZ)
        bt.callback_clicked_add(cb_alpha, win, bg, state)
        hbox.pack_end(bt)
        bt.show()

    for state in [True, False]:
        bt = Button(win,
                    text="FS " + ("On" if state else "Off"),
                    size_hint_align=FILL_HORIZ,
                    size_hint_weight=EXPAND_HORIZ)
        bt.callback_clicked_add(cb_fullscreen, win, state)
        hbox.pack_end(bt)
        bt.show()

    sl = Slider(win,
                text="Visual test",
                indicator_format="%3.0f",
                min_max=(50, 150),
                value=50,
                inverted=True,
                size_hint_weight=EXPAND_BOTH,
                size_hint_align=(0.5, EVAS_HINT_FILL))
    vbox.pack_end(sl)
    sl.show()

    ck = Check(win, text="Resize on rotate", size_hint_align=(0.0, 0.0))
    vbox.pack_end(ck)
    ck.show()

    hbox = Box(win,
               horizontal=True,
               size_hint_align=FILL_HORIZ,
               size_hint_weight=EXPAND_HORIZ)
    vbox.pack_end(hbox)
    hbox.show()

    for rot in [0, 90, 180, 270]:
        bt = Button(win,
                    text="Rot " + str(rot),
                    size_hint_align=FILL_HORIZ,
                    size_hint_weight=EXPAND_HORIZ)
        bt.callback_clicked_add(cb_rot, win, ck, rot)
        hbox.pack_end(bt)
        bt.show()

    win.show()
Beispiel #26
0
    def __init__(self, parent, canvas):

        self._parent = parent
        self._canvas = canvas
        # Dialog Window Basics
        self.aboutDialog = Window("epad", ELM_WIN_DIALOG_BASIC)
        #
        self.aboutDialog.callback_delete_request_add(self.closeabout)
        #    Set Dialog background
        background = Background(self.aboutDialog, size_hint_weight=EXPAND_BOTH)
        self.aboutDialog.resize_object_add(background)
        background.show()
        #
        mainBox = Box(self.aboutDialog, size_hint_weight=EXPAND_BOTH,
                      size_hint_align=FILL_BOTH)
        self.aboutDialog.resize_object_add(mainBox)
        mainBox.show()
        #
        need_ethumb()
        icon = Icon(self.aboutDialog, thumb='True')
        icon.standard_set('accessories-text-editor')

        # Using gksudo or sudo fails to load Image here
        #   unless options specify using preserving their existing environment.
        #   may also fail to load other icons but does not raise an exception
        #   in that situation.
        # Works fine using eSudo as a gksudo alternative,
        #   other alternatives not tested
        try:
            aboutImage = Image(self.aboutDialog, no_scale=True,
                               size_hint_weight=EXPAND_BOTH,
                               size_hint_align=FILL_BOTH,
                               file=icon.file_get())
            aboutImage.aspect_fixed_set(False)

            mainBox.pack_end(aboutImage)
            aboutImage.show()
        except RuntimeError as msg:
            print("Warning: to run as root please use:\n"
                  "\t gksudo -k or sudo -E \n"
                  "Continuing with minor errors ...")

        labelBox = Box(self.aboutDialog, size_hint_weight=EXPAND_NONE)
        mainBox.pack_end(labelBox)
        labelBox.show()
        #    Entry to hold text
        titleStr = '<br>ePad version <em>{0}</em><br>'.format(__version__)
        aboutStr = ('<br>A simple text editor written in <br>'
                    'python and elementary<br>')
        aboutLbTitle = Label(self.aboutDialog, style='marker')
        aboutLbTitle.text = titleStr
        aboutLbTitle.show()

        labelBox.pack_end(aboutLbTitle)

        sep = Separator(self.aboutDialog, horizontal=True)
        labelBox.pack_end(sep)
        sep.show()

        aboutText = Label(self.aboutDialog)
        aboutText.text = aboutStr

        aboutText.show()
        labelBox.pack_end(aboutText)

        aboutCopyright = Label(self.aboutDialog)
        aboutCopyright.text = '<b>Copyright</b> © <i>2014 Bodhi Linux</i><br>'

        aboutCopyright.show()
        labelBox.pack_end(aboutCopyright)

        # Dialog Buttons
        #    Horizontal Box for Dialog Buttons
        buttonBox = Box(self.aboutDialog, horizontal=True,
                        size_hint_weight=EXPAND_HORIZ,
                        size_hint_align=FILL_BOTH, padding=PADDING)
        buttonBox.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0)
        buttonBox.show()
        labelBox.pack_end(buttonBox)
        #    Credits Button
        creditsBtn = Button(self.aboutDialog, text="Credits ",
                            size_hint_weight=EXPAND_NONE)
        creditsBtn.callback_clicked_add(self.creditsPress)
        creditsBtn.show()
        buttonBox.pack_end(creditsBtn)
        #    Close Button
        okBtn = Button(self.aboutDialog, text=" Close ",
                       size_hint_weight=EXPAND_NONE)
        okBtn.callback_clicked_add(self.closeabout)
        okBtn.show()
        buttonBox.pack_end(okBtn)

        # Ensure the min height
        self.aboutDialog.resize(300, 100)
    def __init__(self, parent, title="About", standardicon="dialog-information", \
                        version="N/A", authors="No One", \
                        licen="GPL", webaddress="", info="Something, something, turtles"):
        Window.__init__(self, title, ELM_WIN_DIALOG_BASIC, autodel=True)

        background = Background(self, size_hint_weight=EXPAND_BOTH)
        self.resize_object_add(background)
        background.show()

        fr = Frame(self,
                   style='pad_large',
                   size_hint_weight=EXPAND_BOTH,
                   size_hint_align=FILL_BOTH)
        self.resize_object_add(fr)
        fr.show()

        hbox = Box(self, horizontal=True, padding=(12, 12))
        fr.content = hbox
        hbox.show()

        vbox = Box(self,
                   align=(0.0, 0.0),
                   padding=(6, 6),
                   size_hint_weight=EXPAND_VERT,
                   size_hint_align=FILL_VERT)
        hbox.pack_end(vbox)
        vbox.show()

        # icon + version
        ic = Icon(self, size_hint_min=(64, 64))
        ic.standard_set(standardicon)
        vbox.pack_end(ic)
        ic.show()

        lb = Label(self, text=('Version: %s') % version)
        vbox.pack_end(lb)
        lb.show()

        sep = Separator(self, horizontal=True)
        vbox.pack_end(sep)
        sep.show()

        # buttons
        bt = Button(self, text=(title), size_hint_align=FILL_HORIZ)
        bt.callback_clicked_add(lambda b: self.entry.text_set(info))
        vbox.pack_end(bt)
        bt.show()

        bt = Button(self, text=('Website'), size_hint_align=FILL_HORIZ)
        bt.callback_clicked_add(lambda b: xdg_open(webaddress))
        vbox.pack_end(bt)
        bt.show()

        bt = Button(self, text=('Authors'), size_hint_align=FILL_HORIZ)
        bt.callback_clicked_add(lambda b: self.entry.text_set(authors))
        vbox.pack_end(bt)
        bt.show()

        bt = Button(self, text=('License'), size_hint_align=FILL_HORIZ)
        bt.callback_clicked_add(lambda b: self.entry.text_set(licen))
        vbox.pack_end(bt)
        bt.show()

        # main text
        self.entry = Entry(self,
                           editable=False,
                           scrollable=True,
                           text=info,
                           size_hint_weight=EXPAND_BOTH,
                           size_hint_align=FILL_BOTH)
        self.entry.callback_anchor_clicked_add(lambda e, i: xdg_open(i.name))
        hbox.pack_end(self.entry)
        self.entry.show()

        self.resize(400, 200)
        self.show()
Beispiel #28
0
                      action="store_true",
                      default=False,
                      help=("start the video from last know position"))
    options, args = parser.parse_args()
    if not args and not options.webcams:
        parser.error("missing filename or the -w option")
    return options, args


if __name__ == "__main__" or True:
    options, args = cmdline_parse()

    elementary.init()

    # elementary window
    win = Window("test-emotion", ELM_WIN_BASIC)
    win.title_set("python-emotion test application")
    win.callback_delete_request_add(lambda o: elementary.exit())
    win.on_key_down_add(AppKeyboardEvents())

    # edje main scene object
    scene = edje.Edje(win.evas, file=theme_file, group="background")
    win.resize_object_add(scene)
    scene.show()

    win.data["movie_windows"] = objects = []

    # one edje frame for each file passed
    for fname in args:
        print("Playing url: '%s'" % (fname))
        mw = MovieWindow(win.evas,
def socket_add(name):
    win = Window("socket image", ELM_WIN_SOCKET_IMAGE)

    try:
        win.socket_listen(name, 0, False)
    except RuntimeError:
        print("No socket")
        win.delete()
        return None
    else:
        win.autodel = True

        bg = Background(win,
                        color=(80, 110, 205),
                        size_hint_weight=EXPAND_BOTH)
        win.resize_object_add(bg)
        bg.show()

        bx = Box(win,
                 size_hint_weight=EXPAND_HORIZ,
                 size_hint_align=(EVAS_HINT_FILL, 0.0))
        bx.show()

        lb = LOG(win, "ELM_WIN_SOCKET_IMAGE")
        bx.pack_end(lb)

        lb = LOG(win, "Profile: <b>N/A</b>")
        bx.pack_end(lb)
        win.data["lb"] = lb

        inlined_add(win)

        win.move(0, 0)
        win.resize(150, 200)

        win.callback_profile_changed_add(win_profile_changed_cb)
        win.show()
        return win
Beispiel #30
0
def genlist2_clicked(obj, item=None):
    win = Window("Genlist",
                 ELM_WIN_BASIC,
                 title="Genlist test 2",
                 autodel=True,
                 size=(320, 320))

    bg = Background(win,
                    file=os.path.join(img_path, "plant_01.jpg"),
                    size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bg)
    bg.show()

    bx = Box(win, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bx)
    bx.show()

    gl = Genlist(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
    gl.show()

    itc1 = GenlistItemClass(item_style="default",
                            text_get_func=gl_text_get,
                            content_get_func=gl_content_get,
                            state_get_func=gl_state_get)

    gl.item_append(itc1, 1001, func=gl_item_sel)
    gl.item_append(itc1, 1002, func=gl_item_sel)
    gl.item_append(itc1, 1003, func=gl_item_sel)
    gl.item_append(itc1, 1004, func=gl_item_sel)
    gl.item_append(itc1, 1005, func=gl_item_sel)
    gl.item_append(itc1, 1006, func=gl_item_sel)
    gl.item_append(itc1, 1007, func=gl_item_sel)

    bx.pack_end(gl)

    bx2 = Box(win,
              horizontal=True,
              homogeneous=True,
              size_hint_weight=EXPAND_HORIZ,
              size_hint_align=FILL_BOTH)

    def my_gl_first(bt, gl):
        gli = gl.first_item
        if gli:
            gli.show()
            gli.selected = True

    bt = Button(win,
                text="/\\",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_first, gl)
    bx2.pack_end(bt)
    bt.show()

    def my_gl_last(bt, gl):
        gli = gl.last_item_get()
        if gli:
            gli.show()
            gli.selected = True

    bt = Button(win,
                text="\\/",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_last, gl)
    bx2.pack_end(bt)
    bt.show()

    def my_gl_disable(bt, gl):
        gli = gl.selected_item
        if gli:
            gli.disabled = True
            gli.selected = False
            gli.update()
        else:
            print("no item selected")

    bt = Button(win,
                text="#",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_disable, gl)
    bx2.pack_end(bt)
    bt.show()

    def my_gl_update_all(bt, gl):
        gli = gl.first_item_get()
        i = 0
        while gli:
            gli.update()
            print(i)
            i = i + 1
            gli = gli.next_get()

    bt = Button(win,
                text="U",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_update_all, gl)
    bx2.pack_end(bt)
    bt.show()

    bx.pack_end(bx2)
    bx2.show()

    bx2 = Box(win,
              horizontal=True,
              homogeneous=True,
              size_hint_weight=EXPAND_HORIZ,
              size_hint_align=FILL_BOTH)

    def my_gl_clear(bt, gl):
        gl.clear()

    bt = Button(win,
                text="X",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_clear, gl)
    bx2.pack_end(bt)
    bt.show()

    class MyGlAdd:
        i = 0

    def my_gl_add(bt, gl, itc1):
        gl.item_append(itc1, MyGlAdd.i, func=gl_item_sel)
        MyGlAdd.i = MyGlAdd.i + 1

    bt = Button(win,
                text="+",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_add, gl, itc1)
    bx2.pack_end(bt)
    bt.show()

    def my_gl_del(bt, gl):
        gli = gl.selected_item_get()
        if gli:
            gli.delete()
        else:
            print("no item selected")

    bt = Button(win,
                text="-",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_del, gl)
    bx2.pack_end(bt)
    bt.show()

    bx.pack_end(bx2)
    bx2.show()

    bx2 = Box(win,
              horizontal=True,
              homogeneous=True,
              size_hint_weight=EXPAND_HORIZ,
              size_hint_align=FILL_BOTH)

    class MyGlInsertBefore:
        i = 0

    def my_gl_insert_before(bt, gl, itc1):
        gli = gl.selected_item_get()
        if gli:
            gl.item_insert_before(itc1,
                                  MyGlInsertBefore.i,
                                  gli,
                                  func=gl_item_sel)
            MyGlInsertBefore.i = MyGlInsertBefore.i + 1
        else:
            print("no item selected")

    bt = Button(win,
                text="+ before",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_insert_before, gl, itc1)
    bx2.pack_end(bt)
    bt.show()

    class MyGlInsertAfter:
        i = 0

    def my_gl_insert_after(bt, gl, itc1):
        gli = gl.selected_item_get()
        if gli:
            gl.item_insert_after(itc1,
                                 MyGlInsertAfter.i,
                                 gli,
                                 func=gl_item_sel)
            MyGlInsertAfter.i = MyGlInsertAfter.i + 1
        else:
            print("no item selected")

    bt = Button(win,
                text="+ after",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_insert_after, gl, itc1)
    bx2.pack_end(bt)
    bt.show()

    def my_gl_flush(bt, gl):
        def my_gl_flush_delay():
            cache_all_flush()

        Timer(1.2, my_gl_flush_delay)

    bt = Button(win,
                text="Flush",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_flush, gl)
    bx2.pack_end(bt)
    bt.show()

    bx.pack_end(bx2)
    bx2.show()

    win.show()
 def setUp(self):
     self.w = Window("t", ELM_WIN_BASIC)
     self.o = Icon(self.w)
def window_states_clicked(obj):
    win = Window("window-states", ELM_WIN_BASIC,
        title="Window States test", autodel=True, size=(280, 400))
    win.callback_moved_add(cb_win_moved)
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    print(win.available_profiles)

    bg = Background(win, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bg)
    bg.show()

    vbox = Box(win, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(vbox)
    vbox.show()

    hbox = Box(win, horizontal=True, size_hint_align=FILL_HORIZ,
        size_hint_weight=EXPAND_HORIZ)
    vbox.pack_end(hbox)
    hbox.show()

    for state in [True, False]:
        bt = Button(win, text="Alpha " + ("On" if state else "Off"),
            size_hint_align=FILL_HORIZ, size_hint_weight=EXPAND_HORIZ)
        bt.callback_clicked_add(cb_alpha, win, bg, state)
        hbox.pack_end(bt)
        bt.show()

    for state in [True, False]:
        bt = Button(win, text="FS " + ("On" if state else "Off"),
            size_hint_align=FILL_HORIZ, size_hint_weight=EXPAND_HORIZ)
        bt.callback_clicked_add(cb_fullscreen, win, state)
        hbox.pack_end(bt)
        bt.show()

    sl = Slider(win, text="Visual test", indicator_format="%3.0f",
        min_max=(50, 150), value=50, inverted=True,
        size_hint_weight=EXPAND_BOTH, size_hint_align=(0.5, EVAS_HINT_FILL))
    vbox.pack_end(sl)
    sl.show()

    ck = Check(win, text="Resize on rotate", size_hint_align=(0.0, 0.0))
    vbox.pack_end(ck)
    ck.show()

    hbox = Box(win, horizontal=True, size_hint_align=FILL_HORIZ,
        size_hint_weight=EXPAND_HORIZ)
    vbox.pack_end(hbox)
    hbox.show()

    for rot in [0, 90, 180, 270]:
        bt = Button(win, text="Rot " + str(rot), size_hint_align=FILL_HORIZ,
            size_hint_weight=EXPAND_HORIZ)
        bt.callback_clicked_add(cb_rot, win, ck, rot)
        hbox.pack_end(bt)
        bt.show()

    win.show()
Beispiel #33
0
    def __init__(self):

        # Dialog Window Basics
        self.findDialog = Window("find", ELM_WIN_DIALOG_BASIC)
        self.findDialog.callback_delete_request_add(self.closeFind)
        #    Set Window Icon
        #       Icons work  in ubuntu min everything compiled
        #       but not bodhi rc3
        icon = Icon(self.findDialog,
                    size_hint_weight=EXPAND_BOTH,
                    size_hint_align=FILL_BOTH)
        icon.standard_set('edit-find-replace')
        icon.show()
        self.findDialog.icon_object_set(icon.object_get())
        #    Set Dialog background
        background = Background(self.findDialog, size_hint_weight=EXPAND_BOTH)
        self.findDialog.resize_object_add(background)
        background.show()
        #    Main box to hold shit
        mainBox = Box(self.findDialog, size_hint_weight=EXPAND_BOTH)
        self.findDialog.resize_object_add(mainBox)
        mainBox.show()

        # Search Section
        #    Horizontal Box to hold search stuff
        seachBox = Box(self.findDialog, horizontal=True,
                       size_hint_weight=EXPAND_HORIZ,
                       size_hint_align=FILL_BOTH, padding=PADDING)
        seachBox.show()
        mainBox.pack_end(seachBox)
        #    Label for search entry
        seachLabel = Label(self.findDialog, text="Search for:",
                           size_hint_weight=EXPAND_NONE,
                           size_hint_align=FILL_HORIZ)
        seachBox.pack_end(seachLabel)
        seachLabel.show()
        #    Search Entry
        self.sent = Entry(self.findDialog, scrollable=True, single_line=True,
                          size_hint_weight=EXPAND_HORIZ,
                          size_hint_align=FILL_HORIZ)
        self.sent.callback_activated_add(self.find)  # Enter activates find fn
        self.sent.show()
        seachBox.pack_end(self.sent)

        #    Check boxs for Search Options
        #   FIXME: add callbacks  These states should be in config file
        caseCk = Check(self.findDialog, text="Case sensitive",
                       size_hint_weight=EXPAND_BOTH,
                       size_hint_align=FILL_HORIZ, state=CASE_SENSITIVE)
        caseCk.callback_changed_add(self.ckCase)
        caseCk.show()
        mainBox.pack_end(caseCk)
        wordCk = Check(self.findDialog, text="Match only a whole word",
                       size_hint_weight=EXPAND_BOTH,
                       size_hint_align=FILL_HORIZ, state=WHOLE_WORD)
        wordCk.callback_changed_add(self.ckWord)
        wordCk.show()
        mainBox.pack_end(wordCk)

        # Dialog Buttons
        #    Horizontal Box for Dialog Buttons
        buttonBox = Box(self.findDialog, horizontal=True,
                        size_hint_weight=EXPAND_HORIZ,
                        size_hint_align=FILL_BOTH, padding=PADDING)
        buttonBox.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0)
        buttonBox.show()
        mainBox.pack_end(buttonBox)
        #    Cancel Button
        cancelBtn = Button(self.findDialog, text="Cancel",
                           size_hint_weight=EXPAND_NONE)
        cancelBtn.callback_clicked_add(self.closeFind)
        cancelBtn.show()
        buttonBox.pack_end(cancelBtn)
        #    Ok Button
        okBtn = Button(self.findDialog, text=" Find ",
                       size_hint_weight=EXPAND_NONE)
        okBtn.callback_clicked_add(self.find)
        okBtn.show()
        buttonBox.pack_end(okBtn)

        # Ensure the min height
        self.findDialog.resize(300, 1)
        self.findDialog.show()
    parser.add_option("-p", "--position", action="store_true",
                      default=False,
                      help=("start the video from last know position") )
    options, args = parser.parse_args()
    if not args and not options.webcams:
        parser.error("missing filename or the -w option")
    return options, args


if __name__ == "__main__"or True:
    options, args = cmdline_parse()

    elementary.init()

    # elementary window
    win = Window("test-emotion", ELM_WIN_BASIC)
    win.title_set("python-emotion test application")
    win.callback_delete_request_add(lambda o: elementary.exit())
    win.on_key_down_add(AppKeyboardEvents())

    # edje main scene object
    scene = edje.Edje(win.evas, file=theme_file, group="background")
    win.resize_object_add(scene)
    scene.show()

    win.data["movie_windows"] = objects = []

    # one edje frame for each file passed
    for fname in args:
        print("Playing url: '%s'" % (fname))
        mw = MovieWindow(win.evas, media_module=options.engine, media_file=fname)
def mapbuf_clicked(obj, item=None):
    global mb_list

    win = Window("mapbuf", ELM_WIN_BASIC, title="Mapbuf test", autodel=True,
        size=(480, 600))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    bg = Background(win, file=os.path.join(img_path, "sky_04.jpg"),
        size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bg)
    bg.show()

    vbox = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
    win.resize_object_add(vbox)
    vbox.show()

    # launcher
    sc = Scroller(win, bounce=(True, False), policy=SCROLL_POLICY_OFF,
        size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
    vbox.pack_end(sc)

    bx = Box(win, horizontal=True, homogeneous=True)
    bx.show()

    for k in range(8):
        tb = Table(win, size_hint_align=ALIGN_CENTER,
            size_hint_weight=(0.0, 0.0))
        tb.show()

        pad = Rectangle(win.evas, color=(255, 255, 0, 255))
        pad.size_hint_min = (464, 4)
        pad.size_hint_weight = (0.0, 0.0)
        pad.size_hint_align = (EVAS_HINT_FILL, EVAS_HINT_FILL)
        pad.show()
        tb.pack(pad, 1, 0, 5, 1)

        pad = Rectangle(win.evas, color=(255, 255, 0, 255))
        pad.size_hint_min = (464, 4)
        pad.size_hint_weight = (0.0, 0.0)
        pad.size_hint_align = (EVAS_HINT_FILL, EVAS_HINT_FILL)
        pad.show()
        tb.pack(pad, 1, 11, 5, 1)

        pad = Rectangle(win.evas, color=(255, 255, 0, 255))
        pad.size_hint_min = (4, 4)
        pad.size_hint_weight = (0.0, 0.0)
        pad.size_hint_align = (EVAS_HINT_FILL, EVAS_HINT_FILL)
        pad.show()
        tb.pack(pad, 0, 1, 1, 10)

        pad = Rectangle(win.evas, color=(255, 255, 0, 255))
        pad.size_hint_min = (4, 4)
        pad.size_hint_weight = (0.0, 0.0)
        pad.size_hint_align = (EVAS_HINT_FILL, EVAS_HINT_FILL)
        pad.show()
        tb.pack(pad, 6, 1, 1, 10)

        mb = Mapbuf(win, content=tb)
        mb.point_color_set(k % 4, 255, 0, 0, 255)
        mb_list.append(mb)
        bx.pack_end(mb)
        mb.show()

        n = m = 0
        for j in range(5):
            for i in range(5):
                ic = Icon(win, scale=0.5,
                    file=os.path.join(img_path, "icon_%02d.png" % (n)),
                    resizable=(False, False), size_hint_weight=EXPAND_BOTH,
                    size_hint_align=ALIGN_CENTER)
                tb.pack(ic, 1 + i, 1 + (j * 2), 1, 1)
                ic.show()

                lb = Label(win, style="marker", text=names[m])
                tb.pack(lb, 1 + i, 1 + (j * 2) + 1, 1, 1)
                lb.show()

                n = n + 1 if n < 23 else 0
                m = m + 1 if m < 15 else 0

    sc.content = bx
    sc.page_relative_set(1.0, 1.0)
    sc.show()

    # controls
    hbox = Box(win, horizontal=True, homogeneous=True,
        size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
    vbox.pack_start(hbox)
    hbox.show()

    ck = Check(win, text="Map", state=False)
    ck.callback_changed_add(cb_ck_map)
    hbox.pack_end(ck)
    ck.show()

    ck = Check(win, text="Alpha", state=True)
    ck.callback_changed_add(cb_ck_alpha)
    hbox.pack_end(ck)
    ck.show()

    ck = Check(win, text="Smooth", state=True)
    ck.callback_changed_add(cb_ck_smooth)
    hbox.pack_end(ck)
    ck.show()

    ck = Check(win, text="FS", state=False)
    ck.callback_changed_add(cb_ck_fs, win)
    hbox.pack_end(ck)
    ck.show()

    bt = Button(win, text="Close", size_hint_align=FILL_BOTH,
        size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(cb_btn_close, win)
    hbox.pack_end(bt)
    bt.show()

    win.show()
Beispiel #36
0
class MainWindow(StandardWindow):
    def __init__(self):
        StandardWindow.__init__(self, "lifetracker", "Life Tracker", size=(200, 200))
        self.callback_delete_request_add(lambda o: elm.exit())
        self.elm_event_callback_add(self.eventsCb)

        self.buildSubs()
        self.resetLifeTotals()
    
    def buildSubs(self):
        self.subWin = Window("lifetracker", ELM_WIN_DIALOG_BASIC, self, size=(300, 300))
        self.subWin.title = "Life Tracker Assignment"
        bg = Background(self.subWin, size_hint_weight=EXPAND_BOTH)
        bg.show()
        self.subWin.resize_object_add(bg)
        self.subWin.callback_delete_request_add(lambda o: elm.exit())
        self.ourWin = Window("lifetracker", ELM_WIN_DIALOG_BASIC, self, size=(300, 300))
        self.ourWin.title = "Life Tracker Key Strokes"
        bg = Background(self.ourWin, size_hint_weight=EXPAND_BOTH)
        bg.show()
        self.ourWin.resize_object_add(bg)
        self.ourWin.callback_delete_request_add(lambda o: elm.exit())
        self.ourWin.elm_event_callback_add(self.eventsCb)
        
        self.ourLife = ourLabel = Entry(self.ourWin, editable=False)
        ourLabel.size_hint_weight = EXPAND_BOTH
        ourLabel.size_hint_align = FILL_BOTH
        ourLabel.text_style_user_push("DEFAULT='font_size=20'")
        ourLabel.text = "Up and Down for Their Life, Left and Right for Mine"
        ourLabel.show()
        
        self.ourEntry = ourEntry = Entry(self.subWin)
        ourEntry.size_hint_weight = EXPAND_HORIZ
        ourEntry.size_hint_align = (-1, 0)
        ourEntry.single_line_set(True)
        ourEntry.text_style_user_push("DEFAULT='font_size=50'")
        ourEntry.callback_activated_add(self.ourLifeUpdate)
        ourEntry.text = "20"
        ourEntry.show()
        
        self.theirEntry = theirEntry = Entry(self.subWin)
        theirEntry.size_hint_weight = EXPAND_HORIZ
        theirEntry.size_hint_align = (-1, 0)
        theirEntry.single_line_set(True)
        theirEntry.text_style_user_push("DEFAULT='font_size=50'")
        theirEntry.callback_activated_add(self.theirLifeUpdate)
        theirEntry.text = "20"
        theirEntry.show()
        
        resetBtn = Button(self.subWin)
        resetBtn.text = "Reset life totals"
        resetBtn.callback_pressed_add(self.resetLifeTotals)
        resetBtn.show()
        
        entryBox = Box(self.subWin)
        entryBox.size_hint_weight = EXPAND_HORIZ
        entryBox.pack_end(ourEntry)
        entryBox.pack_end(theirEntry)
        entryBox.pack_end(resetBtn)
        entryBox.show()
        
        self.ourWin.resize_object_add(ourLabel)
        self.subWin.resize_object_add(entryBox)
        
        self.ourWin.show()
        self.subWin.show()
        
        self.ourWin.center(True, True)
        self.subWin.center(True, True)
    
    def resetLifeTotals(self, obj=None):
        self.ourLifeTotal = 20
        self.ourEntry.text = str(self.ourLifeTotal)
        self.updateLifeText("mine")
        self.theirLifeTotal = 20
        self.theirEntry.text = str(self.theirLifeTotal)
        self.updateLifeText("theirs")
    
    def ourLifeUpdate(self, obj):
        self.ourLifeTotal = int(obj.text)
        self.updateLifeText("mine")
    
    def theirLifeUpdate(self, obj):
        self.theirLifeTotal = int(obj.text)
        self.updateLifeText("theirs")
    
    def updateLifeText(self, who):
        if who == "mine":
            lifeText = str(self.ourLifeTotal)
            while len(lifeText) < 3:
                lifeText = " %s"%lifeText
            with open(myLifeFile, 'w') as myfile: #file is a builtin, don't name your file 'file'
                myfile.write(lifeText)
        else:
            lifeText = str(self.theirLifeTotal)
            while len(lifeText) < 3:
                lifeText = " %s"%lifeText
            with open(theirLifeFile,'w') as myfile: #file is a builtin, don't name your file 'file'
                myfile.write(lifeText)
    
    def lifeChange(self, who, direction):
        if direction == "up":
            change = 1
        else:
            change = -1
        
        if who == "mine":
            self.ourLifeTotal += change
            self.ourEntry.text = str(self.ourLifeTotal)
            self.updateLifeText("mine")
        else:
            self.theirLifeTotal += change
            self.theirEntry.text = str(self.theirLifeTotal)
            self.updateLifeText("theirs")
    
    def eventsCb(self, obj, src, event_type, event):
        #print(obj)
        #print(src)
        #print(event.key.lower())
        #print(event_type)
        #print("")

        if not event_type == EVAS_CALLBACK_KEY_UP:
            return False

        if event.keyname == "Up":
            self.lifeChange("mine", "up")
        elif event.keyname == "Down":
            self.lifeChange("mine", "down")
        elif event.keyname == "Right":
            self.lifeChange("thiers", "up")
        elif event.keyname == "Left":
            self.lifeChange("theirs", "down")
            

        event.event_flags = event.event_flags | EVAS_EVENT_FLAG_ON_HOLD
        return True
def socket_add(name):
    win = Window("socket image", ELM_WIN_SOCKET_IMAGE)

    try:
        win.socket_listen(name, 0, False)
    except RuntimeError:
        print("No socket")
        win.delete()
        return None
    else:
        win.autodel = True

        bg = Background(win, color=(80, 110, 205), size_hint_weight=EXPAND_BOTH)
        win.resize_object_add(bg)
        bg.show()

        bx = Box(win, size_hint_weight=EXPAND_HORIZ,
            size_hint_align=(EVAS_HINT_FILL, 0.0))
        bx.show()

        lb = LOG(win, "ELM_WIN_SOCKET_IMAGE")
        bx.pack_end(lb)

        lb = LOG(win, "Profile: <b>N/A</b>")
        bx.pack_end(lb)
        win.data["lb"] = lb

        inlined_add(win)

        win.move(0, 0)
        win.resize(150, 200)

        win.callback_profile_changed_add(win_profile_changed_cb)
        win.show()
        return win
Beispiel #38
0
    def __init__(self,
                 command=None,
                 win=None,
                 start_callback=None,
                 end_callback=None,
                 *args,
                 **kwargs):
        if not win:
            nowindow = True
            win = self.win = Window("esudo", ELM_WIN_DIALOG_BASIC)
            win.title = "eSudo"
            win.borderless = True
            win.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
            win.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL
            win.resize(300, 200)
            win.callback_delete_request_add(lambda o: elementary.exit())
            win.layer_set(11)
            #~ win.fullscreen = True
            win.show()
            win.activate()

            bg = Background(win)
            bg.size_hint_weight = 1.0, 1.0
            win.resize_object_add(bg)
            bg.show()

            self.embedded = False
        else:
            nowindow = False
            self.embedded = True

        self.cmd = command
        self.start_cb = start_callback if callable(start_callback) else None
        self.end_cb = end_callback if callable(end_callback) else None
        self.args = args
        self.kwargs = kwargs

        #--------eSudo Window
        bz = Box(win)
        if nowindow:
            bz.size_hint_weight = evas.EVAS_HINT_EXPAND, 0.0
        else:
            bz.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
        bz.size_hint_align = evas.EVAS_HINT_FILL, 0.0
        bz.show()

        if nowindow:
            lbl = Label(win)
            lbl.style = "marker"
            lbl.color = 170, 170, 170, 255
            lbl.size_hint_align = 0.5, 0.0
            lbl.scale = 2.0
            lbl.text = "<b>eSudo</b>"
            bz.pack_end(lbl)
            lbl.show()

            sep = Separator(win)
            sep.horizontal = True
            bz.pack_end(sep)
            sep.show()

        fr = Frame(win)
        fr.text = "Command:"
        fr.size_hint_align = evas.EVAS_HINT_FILL, 0.0
        bz.pack_end(fr)
        fr.show()

        if nowindow:
            sep = Separator(win)
            sep.horizontal = True
            bz.pack_end(sep)
            sep.show()

        self.cmdline = cmdline = Entry(win)
        cmdline.elm_event_callback_add(self.entry_event)
        cmdline.single_line = True
        if self.cmd:
            cmdline.text = self.cmd
            cmdline.editable = False
        fr.content = cmdline
        cmdline.scrollable_set(True)
        cmdline.show()

        if nowindow:
            fr = Frame(win)
            fr.text = "Password:"******"<b>Password:</b>"
            lb.size_hint_align = 0.0, 0.5
            bz1.pack_end(lb)
            lb.show()

        en = self.en = Entry(win)
        en.name = "password"
        en.elm_event_callback_add(self.entry_event)
        en.single_line = True
        en.password = True
        en.show()

        if nowindow:
            fr.content = en
        else:
            bz1.pack_end(en)

        sep = Separator(win)
        sep.horizontal = True
        bz.pack_end(sep)
        sep.show()

        btnb = Box(win)
        btnb.horizontal = True
        btnb.size_hint_weight = evas.EVAS_HINT_EXPAND, 0.0
        btnb.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL
        bz.pack_end(btnb)
        btnb.show()

        bt = Button(win)
        bt.text = "Cancel"
        bt.callback_clicked_add(self.esudo_cancel, en)
        bt.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL
        bt.size_hint_weight = evas.EVAS_HINT_EXPAND, 0.0
        btnb.pack_end(bt)
        bt.show()

        bt = Button(win)
        bt.text = "OK"
        bt.callback_clicked_add(self.password_check, en)
        bt.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL
        bt.size_hint_weight = evas.EVAS_HINT_EXPAND, 0.0
        btnb.pack_end(bt)
        bt.show()

        self.iw = iw = InnerWindow(win)
        iw.content = bz
        iw.show()
        iw.activate()
        if self.cmd:
            en.focus = True
def mapbuf_clicked(obj, item=None):
    global mb_list

    win = Window("mapbuf",
                 ELM_WIN_BASIC,
                 title="Mapbuf test",
                 autodel=True,
                 size=(480, 600))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    bg = Background(win,
                    file=os.path.join(img_path, "sky_04.jpg"),
                    size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bg)
    bg.show()

    vbox = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
    win.resize_object_add(vbox)
    vbox.show()

    # launcher
    sc = Scroller(win,
                  bounce=(True, False),
                  policy=SCROLL_POLICY_OFF,
                  size_hint_align=FILL_BOTH,
                  size_hint_weight=EXPAND_BOTH)
    vbox.pack_end(sc)

    bx = Box(win, horizontal=True, homogeneous=True)
    bx.show()

    for k in range(8):
        tb = Table(win,
                   size_hint_align=ALIGN_CENTER,
                   size_hint_weight=(0.0, 0.0))
        tb.show()

        pad = Rectangle(win.evas, color=(255, 255, 0, 255))
        pad.size_hint_min = (464, 4)
        pad.size_hint_weight = (0.0, 0.0)
        pad.size_hint_align = (EVAS_HINT_FILL, EVAS_HINT_FILL)
        pad.show()
        tb.pack(pad, 1, 0, 5, 1)

        pad = Rectangle(win.evas, color=(255, 255, 0, 255))
        pad.size_hint_min = (464, 4)
        pad.size_hint_weight = (0.0, 0.0)
        pad.size_hint_align = (EVAS_HINT_FILL, EVAS_HINT_FILL)
        pad.show()
        tb.pack(pad, 1, 11, 5, 1)

        pad = Rectangle(win.evas, color=(255, 255, 0, 255))
        pad.size_hint_min = (4, 4)
        pad.size_hint_weight = (0.0, 0.0)
        pad.size_hint_align = (EVAS_HINT_FILL, EVAS_HINT_FILL)
        pad.show()
        tb.pack(pad, 0, 1, 1, 10)

        pad = Rectangle(win.evas, color=(255, 255, 0, 255))
        pad.size_hint_min = (4, 4)
        pad.size_hint_weight = (0.0, 0.0)
        pad.size_hint_align = (EVAS_HINT_FILL, EVAS_HINT_FILL)
        pad.show()
        tb.pack(pad, 6, 1, 1, 10)

        mb = Mapbuf(win, content=tb)
        mb.point_color_set(k % 4, 255, 0, 0, 255)
        mb_list.append(mb)
        bx.pack_end(mb)
        mb.show()

        n = m = 0
        for j in range(5):
            for i in range(5):
                ic = Icon(win,
                          scale=0.5,
                          file=os.path.join(img_path, "icon_%02d.png" % (n)),
                          resizable=(False, False),
                          size_hint_weight=EXPAND_BOTH,
                          size_hint_align=ALIGN_CENTER)
                tb.pack(ic, 1 + i, 1 + (j * 2), 1, 1)
                ic.show()

                lb = Label(win, style="marker", text=names[m])
                tb.pack(lb, 1 + i, 1 + (j * 2) + 1, 1, 1)
                lb.show()

                n = n + 1 if n < 23 else 0
                m = m + 1 if m < 15 else 0

    sc.content = bx
    sc.page_relative_set(1.0, 1.0)
    sc.show()

    # controls
    hbox = Box(win,
               horizontal=True,
               homogeneous=True,
               size_hint_weight=EXPAND_HORIZ,
               size_hint_align=FILL_HORIZ)
    vbox.pack_start(hbox)
    hbox.show()

    ck = Check(win, text="Map", state=False)
    ck.callback_changed_add(cb_ck_map)
    hbox.pack_end(ck)
    ck.show()

    ck = Check(win, text="Alpha", state=True)
    ck.callback_changed_add(cb_ck_alpha)
    hbox.pack_end(ck)
    ck.show()

    ck = Check(win, text="Smooth", state=True)
    ck.callback_changed_add(cb_ck_smooth)
    hbox.pack_end(ck)
    ck.show()

    ck = Check(win, text="FS", state=False)
    ck.callback_changed_add(cb_ck_fs, win)
    hbox.pack_end(ck)
    ck.show()

    bt = Button(win,
                text="Close",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(cb_btn_close, win)
    hbox.pack_end(bt)
    bt.show()

    win.show()