示例#1
0
文件: Etext.py 项目: tbradbeer/Etext
def unsaved_popup(window1, textbox1, function1):
    # Create popup
    unsaved_popup = elementary.Popup(window1)
    unsaved_popup.part_text_set("title,text", "File Unsaved!")
    unsaved_popup.text = "The current file has not been saved.<ps>what would you like to do?"
    # Close without saving button
    clc_no_save_btt = elementary.Button(window1)
    clc_no_save_btt.text = "Close Without Saving"
    clc_no_save_btt.callback_clicked_add(function1, window1, textbox1)
    clc_no_save_btt.show()
    # Save the file and then close button
    clc_save_btt = elementary.FileselectorButton(window1)
    clc_save_btt.expandable_set(False)
    clc_save_btt.inwin_mode_set(True)
    clc_save_btt.is_save_set(True)
    if textbox1.file_get()[0] != None:
        clc_save_btt.path_set(textbox1.file_get()[0])
    clc_save_btt.callback_file_chosen_add(saveas_file, None, window1, textbox1)
    clc_save_btt.text = "Save File"
    clc_save_btt.show()
    # cancel close request
    cancel_btt = elementary.Button(window1)
    cancel_btt.text = "Cancel"
    cancel_btt.callback_clicked_add(close_popup, unsaved_popup)
    cancel_btt.show()
    # add buttons to popup
    unsaved_popup.part_content_set("button1", clc_no_save_btt)
    unsaved_popup.part_content_set("button2", clc_save_btt)
    unsaved_popup.part_content_set("button3", cancel_btt)
    unsaved_popup.show()
示例#2
0
def cb_popup_center_title_content_3button(li, item, win):
    popup = elementary.Popup(win)
    popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    popup.part_text_set("title,text", "Title")

    ic = elementary.Icon(win)
    ic.file = "images/logo_small.png"
    bt = elementary.Button(win)
    bt.text = "Content"
    bt.content = ic
    popup.content = bt

    bt = elementary.Button(win)
    bt.text = "OK"
    popup.part_content_set("button1", bt)

    bt = elementary.Button(win)
    bt.text = "Cancel"
    popup.part_content_set("button2", bt)

    bt = elementary.Button(win)
    bt.text = "Close"
    bt.callback_clicked_add(cb_bnt_close, popup)
    popup.part_content_set("button3", bt)

    popup.show()
示例#3
0
def cb_popup_center_title_item_3button(li, item, win):
    popup = elementary.Popup(win)
    popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    popup.part_text_set("title,text", "Title")

    for i in range(1, 11):
        if i in [3, 5, 6]:
            ic = elementary.Icon(win)
            ic.file = "images/logo_small.png"
            popup.item_append("item" + str(i), ic)
        else:
            popup.item_append("item" + str(i))

    bt = elementary.Button(win)
    bt.text = "OK"
    popup.part_content_set("button1", bt)

    bt = elementary.Button(win)
    bt.text = "Cancel"
    popup.part_content_set("button2", bt)

    bt = elementary.Button(win)
    bt.text = "Close"
    bt.callback_clicked_add(cb_bnt_close, popup)
    popup.part_content_set("button3", bt)

    popup.show()
示例#4
0
def cb_popup_bottom_title_text_3button(li, item, win):
    popup = elementary.Popup(win)
    popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    popup.text = "This Popup has title area, content area and " \
                 "action area set with content being character wrapped. " \
                 "action area has three buttons OK, Cancel and Close"
    popup.content_text_wrap_type = elementary.ELM_WRAP_CHAR
    popup.part_text_set("title,text", "Title")

    ic = elementary.Icon(win)
    ic.file = "images/logo_small.png"
    popup.part_content_set("title,icon", ic)

    bt = elementary.Button(win)
    bt.text = "OK"
    popup.part_content_set("button1", bt)

    bt = elementary.Button(win)
    bt.text = "Cancel"
    popup.part_content_set("button2", bt)

    bt = elementary.Button(win)
    bt.text = "Close"
    bt.callback_clicked_add(cb_bnt_close, popup)
    popup.part_content_set("button3", bt)

    popup.show()
示例#5
0
def cb_popup_center_title_text_block_clicked_event(li, item, win):
    popup = elementary.Popup(win)
    popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    popup.text = "This Popup has title area and content area. " \
                 "When clicked on blocked event region, popup gets deleted"
    popup.part_text_set("title,text", "Title")
    popup.callback_block_clicked_add(cb_bnt_close, popup)
    popup.show()
示例#6
0
def cb_popup_center_title_text_1button(li, item, win):
    popup = elementary.Popup(win)
    popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    popup.text = "This Popup has content area and " \
                 "action area set, action area has one button Close"
    bt = elementary.Button(win)
    bt.text = "Close"
    bt.callback_clicked_add(cb_bnt_close, popup)
    popup.part_content_set("button1", bt)
    popup.show()
示例#7
0
文件: Etext.py 项目: tbradbeer/Etext
def about_pressed(about_button, window1):
    about_popup = elementary.Popup(window1)
    about_popup.size_hint_weight_set(evas.EVAS_HINT_EXPAND,
                                     evas.EVAS_HINT_EXPAND)
    about_popup.part_text_set("title,text", "Etext v" + str(version))
    about_popup.text = "<b>The Enlightened Text Editor</b><ps>By: Tyler Bradbeer<ps><ps>Etext is licensed under the GNU GPL v2"

    close_button = elementary.Button(window1)
    close_button.text = "OK"
    close_button.callback_clicked_add(close_popup, about_popup)
    about_popup.part_content_set("button1", close_button)

    about_popup.show()
示例#8
0
def cb_popup_center_title_text_2button_restack(li, item, win):
    popup = elementary.Popup(win)
    popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    popup.text = "When you click the 'Restack' button, " \
                 "an image will be located under this popup"
    popup.part_text_set("title,text", "Title")

    bt = elementary.Button(win)
    bt.text = "Restack"
    bt.callback_clicked_add(cb_btn_restack, popup)
    popup.part_content_set("button1", bt)

    bt = elementary.Button(win)
    bt.text = "Close"
    bt.callback_clicked_add(cb_bnt_close, popup)
    popup.part_content_set("button3", bt)

    popup.show()
示例#9
0
def cb_popup_center_text_1button_hide_show(li, item, win):
    global times
    global g_popup

    times += 1

    if g_popup is not None:
        g_popup.text = "You have checked this popup %d times." % times
        g_popup.show()
        return

    g_popup = elementary.Popup(win)
    g_popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    g_popup.text = "Hide this popup by using the button." \
                   "When you click list item again, you will see this popup again."

    bt = elementary.Button(win)
    bt.text = "Hide"
    bt.callback_clicked_add(lambda b: g_popup.hide())
    g_popup.part_content_set("button1", bt)

    g_popup.show()
示例#10
0
def cb_popup_center_text(li, item, win):
    popup = elementary.Popup(win)
    popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    popup.text = "This Popup has content area and timeout value is 3 seconds"
    popup.timeout = 3.0
    popup.show()