Ejemplo n.º 1
0
    def __init__(self):
        StandardWindow.__init__(self, "ex4", "Align Example", size=(300, 200))
        self.callback_delete_request_add(lambda o: elm.exit())

        ourButton = Button(self)
        ourButton.size_hint_weight = EXPAND_BOTH
        ourButton.size_hint_align = (0, 0)
        ourButton.text = "Button 1"
        ourButton.show()

        ourButton2 = Button(self)
        ourButton2.size_hint_weight = EXPAND_BOTH
        ourButton2.size_hint_align = FILL_BOTH
        ourButton2.text = "Button 2"
        ourButton2.show()

        ourButton3 = Button(self)
        ourButton3.size_hint_weight = EXPAND_BOTH
        ourButton3.size_hint_align = (1, 1)
        ourButton3.text = "Button 3"
        ourButton3.show()

        ourBox = Box(self)
        ourBox.size_hint_weight = EXPAND_BOTH
        ourBox.pack_end(ourButton)
        ourBox.pack_end(ourButton2)
        ourBox.pack_end(ourButton3)
        ourBox.show()

        self.resize_object_add(ourBox)
Ejemplo n.º 2
0
 def __init__(self):
     StandardWindow.__init__(self, "ex4", "Align Example", size=(300, 200))
     self.callback_delete_request_add(lambda o: elm.exit())
     
     ourButton = Button(self)
     ourButton.size_hint_weight = EXPAND_BOTH
     ourButton.size_hint_align = (0, 0)
     ourButton.text = "Button 1"
     ourButton.show()
     
     ourButton2 = Button(self)
     ourButton2.size_hint_weight = EXPAND_BOTH
     ourButton2.size_hint_align = FILL_BOTH
     ourButton2.text = "Button 2"
     ourButton2.show()
     
     ourButton3 = Button(self)
     ourButton3.size_hint_weight = EXPAND_BOTH
     ourButton3.size_hint_align = (1, 1)
     ourButton3.text = "Button 3"
     ourButton3.show()
     
     ourBox = Box(self)
     ourBox.size_hint_weight = EXPAND_BOTH
     ourBox.pack_end(ourButton)
     ourBox.pack_end(ourButton2)
     ourBox.pack_end(ourButton3)
     ourBox.show()
     
     self.resize_object_add(ourBox)
Ejemplo n.º 3
0
def theme_clicked(obj, data=None):

    win = StandardWindow("config", "Theme", autodel=True, size=(400, 200))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    box = Box(win)
    box.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
    box.show()
    win.resize_object_add(box)

    bt = Button(win, text="A button with a custom style")
    bt.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
    bt.style = "my_custom_style"
    bt.show()
    box.pack_end(bt)

    bt = Button(win, text="A button with default style")
    bt.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
    bt.show()
    box.pack_end(bt)

    sep = Separator(win, horizontal=True)
    sep.show()
    box.pack_end(sep)

    hbox = Box(win, horizontal=True)
    hbox.show()
    box.pack_end(hbox)

    bt = Button(win, text="Add Extension")
    bt.callback_clicked_add(add_ext_clicked_cb)
    bt.show()
    hbox.pack_end(bt)

    bt = Button(win, text="Remove Extension")
    bt.callback_clicked_add(del_ext_clicked_cb)
    bt.show()
    hbox.pack_end(bt)

    bt = Button(win, text="Add Overlay")
    bt.callback_clicked_add(add_ovr_clicked_cb)
    bt.show()
    hbox.pack_end(bt)

    bt = Button(win, text="Remove Overlay")
    bt.callback_clicked_add(del_ovr_clicked_cb)
    bt.show()
    hbox.pack_end(bt)

    win.show()
Ejemplo n.º 4
0
def theme_clicked(obj, data=None):

    win = StandardWindow("config", "Theme", autodel=True, size=(400,200))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    box = Box(win)
    box.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
    box.show()
    win.resize_object_add(box)

    bt = Button(win, text = "A button with a custom style")
    bt.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
    bt.style = "my_custom_style"
    bt.show()
    box.pack_end(bt)

    bt = Button(win, text = "A button with default style")
    bt.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
    bt.show()
    box.pack_end(bt)

    sep = Separator(win, horizontal=True)
    sep.show()
    box.pack_end(sep)
    
    hbox = Box(win, horizontal=True)
    hbox.show()
    box.pack_end(hbox)

    bt = Button(win, text = "Add Extension")
    bt.callback_clicked_add(add_ext_clicked_cb)
    bt.show()
    hbox.pack_end(bt)

    bt = Button(win, text = "Remove Extension")
    bt.callback_clicked_add(del_ext_clicked_cb)
    bt.show()
    hbox.pack_end(bt)

    bt = Button(win, text = "Add Overlay")
    bt.callback_clicked_add(add_ovr_clicked_cb)
    bt.show()
    hbox.pack_end(bt)

    bt = Button(win, text = "Remove Overlay")
    bt.callback_clicked_add(del_ovr_clicked_cb)
    bt.show()
    hbox.pack_end(bt)

    win.show()
    def __init__(self):
        StandardWindow.__init__(self, "ex7", "Naviframe", size=(300, 200))
        self.callback_delete_request_add(lambda o: elm.exit())

        staticImage = staticImage = Image(self)
        staticImage.size_hint_weight = EXPAND_BOTH
        staticImage.file_set("images/logo.png")
        staticImage.tooltip_text_set("A picture!")
        staticImage.show()

        ourLabel = ourLabel = Label(self)
        ourLabel.size_hint_weight = EXPAND_BOTH
        ourLabel.text = "Hey look some text!"
        ourLabel.show()

        self.nf = Naviframe(self)
        self.nf.size_hint_weight = EXPAND_BOTH
        self.nf.size_hint_align = FILL_BOTH
        self.nf.show()

        buttonOne = Button(self)
        buttonOne.size_hint_weight = EXPAND_BOTH
        buttonOne.text = "Show image"
        buttonOne.callback_clicked_add(self.buttonPressed, staticImage)
        buttonOne.show()

        buttonTwo = Button(self)
        buttonTwo.size_hint_weight = EXPAND_BOTH
        buttonTwo.text = "Show label"
        buttonTwo.callback_clicked_add(self.buttonPressed, ourLabel)
        buttonTwo.show()

        buttonBox = Box(self)
        buttonBox.size_hint_weight = EXPAND_HORIZ
        buttonBox.horizontal_set(True)
        buttonBox.pack_end(buttonOne)
        buttonBox.pack_end(buttonTwo)
        buttonBox.show()

        mainBox = Box(self)
        mainBox.size_hint_weight = EXPAND_BOTH
        mainBox.pack_end(self.nf)
        mainBox.pack_end(buttonBox)
        mainBox.show()

        self.nf.item_simple_push(staticImage)

        self.resize_object_add(mainBox)
Ejemplo n.º 6
0
    def __init__(self):
        StandardWindow.__init__(self, "ex7", "Naviframe", size=(300, 200))
        self.callback_delete_request_add(lambda o: elm.exit())

        staticImage = staticImage = Image(self)
        staticImage.size_hint_weight = EXPAND_BOTH
        staticImage.file_set("images/logo.png")
        staticImage.tooltip_text_set("A picture!")
        staticImage.show()
        
        ourLabel = ourLabel = Label(self)
        ourLabel.size_hint_weight = EXPAND_BOTH
        ourLabel.text = "Hey look some text!"
        ourLabel.show()
        
        self.nf = Naviframe(self)
        self.nf.size_hint_weight = EXPAND_BOTH
        self.nf.size_hint_align = FILL_BOTH
        self.nf.show()
        
        buttonOne = Button(self)
        buttonOne.size_hint_weight = EXPAND_BOTH
        buttonOne.text = "Show image"
        buttonOne.callback_clicked_add(self.buttonPressed, staticImage)
        buttonOne.show()
        
        buttonTwo = Button(self)
        buttonTwo.size_hint_weight = EXPAND_BOTH
        buttonTwo.text = "Show label"
        buttonTwo.callback_clicked_add(self.buttonPressed, ourLabel)
        buttonTwo.show()
        
        buttonBox = Box(self)
        buttonBox.size_hint_weight = EXPAND_HORIZ
        buttonBox.horizontal_set(True)
        buttonBox.pack_end(buttonOne)
        buttonBox.pack_end(buttonTwo)
        buttonBox.show()
        
        mainBox = Box(self)
        mainBox.size_hint_weight = EXPAND_BOTH
        mainBox.pack_end(self.nf)
        mainBox.pack_end(buttonBox)
        mainBox.show()
        
        self.nf.item_simple_push(staticImage)
        
        self.resize_object_add(mainBox)
    def __init__(self):
        StandardWindow.__init__(self,
                                "ex2",
                                "Hello Elementary",
                                size=(300, 200))
        self.callback_delete_request_add(lambda o: elm.exit())

        ourLabel = Label(self)
        ourLabel.size_hint_weight = EXPAND_BOTH
        ourLabel.text = "Hello Elementary!"
        ourLabel.show()

        ourButton = Button(self)
        ourButton.size_hint_weight = EXPAND_BOTH
        ourButton.text = "Goodbye Elementary"
        ourButton.callback_clicked_add(self.buttonPressed)
        ourButton.show()

        ourBox = Box(self)
        ourBox.size_hint_weight = EXPAND_BOTH
        ourBox.pack_end(ourLabel)
        ourBox.pack_end(ourButton)
        ourBox.show()

        self.resize_object_add(ourBox)
    def __init__(self):
        StandardWindow.__init__(self, "ex2", "Hello Elementary", size=(300, 200))
        self.callback_delete_request_add(lambda o: elm.exit())

        ourLabel = Label(self)
        ourLabel.size_hint_weight = EXPAND_BOTH
        ourLabel.text = "Hello Elementary!"
        ourLabel.show()
        
        ourButton = Button(self)
        ourButton.size_hint_weight = EXPAND_BOTH
        ourButton.text = "Goodbye Elementary"
        ourButton.callback_clicked_add(self.buttonPressed)
        ourButton.show()
        
        ourBox = Box(self)
        ourBox.size_hint_weight = EXPAND_BOTH
        ourBox.pack_end(ourLabel)
        ourBox.pack_end(ourButton)
        ourBox.show()
        
        self.resize_object_add(ourBox)
Ejemplo n.º 9
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
Ejemplo n.º 10
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