当前位置: 首页>>代码示例>>Python>>正文


Python Popup.delete方法代码示例

本文整理汇总了Python中efl.elementary.popup.Popup.delete方法的典型用法代码示例。如果您正苦于以下问题:Python Popup.delete方法的具体用法?Python Popup.delete怎么用?Python Popup.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在efl.elementary.popup.Popup的用法示例。


在下文中一共展示了Popup.delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: errorPopup

# 需要导入模块: from efl.elementary.popup import Popup [as 别名]
# 或者: from efl.elementary.popup.Popup import delete [as 别名]
def errorPopup(window, errorMsg):
    errorPopup = Popup(window, size_hint_weight=EXPAND_BOTH)
    errorPopup.callback_block_clicked_add(lambda obj: errorPopup.delete())

    # Add a table to hold dialog image and text to Popup
    tb = Table(errorPopup, size_hint_weight=EXPAND_BOTH)
    errorPopup.part_content_set("default", tb)
    tb.show()

    # Add dialog-error Image to table
    need_ethumb()
    icon = Icon(errorPopup, thumb='True')
    icon.standard_set('dialog-warning')
    # 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:
        dialogImage = Image(errorPopup,
                            size_hint_weight=EXPAND_HORIZ,
                            size_hint_align=FILL_BOTH,
                            file=icon.file_get())
        tb.pack(dialogImage, 0, 0, 1, 1)
        dialogImage.show()
    except RuntimeError:
        # An error message is displayed for this same error
        #   when aboutWin is initialized so no need to redisplay.
        pass
    # Add dialog text to table
    dialogLabel = Label(errorPopup, line_wrap=ELM_WRAP_WORD,
                        size_hint_weight=EXPAND_HORIZ,
                        size_hint_align=FILL_BOTH)
    dialogLabel.text = errorMsg
    tb.pack(dialogLabel, 1, 0, 1, 1)
    dialogLabel.show()

    # Ok Button
    ok_btt = Button(errorPopup)
    ok_btt.text = "Ok"
    ok_btt.callback_clicked_add(lambda obj: errorPopup.delete())
    ok_btt.show()

    # add button to popup
    errorPopup.part_content_set("button3", ok_btt)
    errorPopup.show()
开发者ID:emctoo,项目名称:ePad,代码行数:49,代码来源:ePad.py

示例2: __init__

# 需要导入模块: from efl.elementary.popup import Popup [as 别名]
# 或者: from efl.elementary.popup.Popup import delete [as 别名]
 def __init__(self, canvas, title, text):
     n = Popup(canvas)
     n.part_text_set("title,text", title)
     n.text = text
     b = Button(canvas)
     b.text = "OK"
     b.callback_clicked_add(lambda x: n.delete())
     n.part_content_set("button1", b)
     n.show()
开发者ID:maikodaraine,项目名称:EnlightenmentUbuntu,代码行数:11,代码来源:Notify.py

示例3: showDialog

# 需要导入模块: from efl.elementary.popup import Popup [as 别名]
# 或者: from efl.elementary.popup.Popup import delete [as 别名]
    def showDialog(self, title, msg):
        dia = Popup(self)
        dia.part_text_set("title,text", title)
        dia.part_text_set("default", msg)

        bt = Button(dia, text="Ok")
        bt.callback_clicked_add(lambda b: dia.delete())
        dia.part_content_set("button1", bt)

        dia.show()
开发者ID:jbenito,项目名称:bodhi3packages,代码行数:12,代码来源:eepDater.py

示例4: FolderSelector

# 需要导入模块: from efl.elementary.popup import Popup [as 别名]
# 或者: from efl.elementary.popup.Popup import delete [as 别名]
class FolderSelector(Fileselector):
    def __init__(self, parent):
        Fileselector.__init__(self, parent, is_save=False, folder_only=True,
                        size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        self.path = os.getcwd()

        # table+rect to respect min size :/
        tb = Table(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        r = Rectangle(self.evas, color=(0,0,0,0), size_hint_min=(300,300),
                      size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        tb.pack(r, 0, 0, 1, 1)
        tb.pack(self, 0, 0, 1, 1)

        self.popup = Popup(parent)
        self.popup.part_text_set('title,text', 'Choose repository')
        self.popup.content = tb
        self.popup.show()

        self.show()

    def delete(self):
        self.popup.delete()
开发者ID:DaveMDS,项目名称:egitu,代码行数:24,代码来源:utils.py

示例5: show_error_msg

# 需要导入模块: from efl.elementary.popup import Popup [as 别名]
# 或者: from efl.elementary.popup.Popup import delete [as 别名]
    def show_error_msg(self, msg):
        pop = Popup(self, text=msg)
        pop.part_text_set('title,text', _('Error'))

        btn = Button(self, text=_('Continue'))
        btn.callback_clicked_add(lambda b: pop.delete())
        pop.part_content_set('button1', btn)

        btn = Button(self, text=_('Exit'))
        btn.callback_clicked_add(lambda b: self.app.exit())
        pop.part_content_set('button2', btn)

        pop.show()
开发者ID:lonid,项目名称:epack,代码行数:15,代码来源:gui.py

示例6: _confirm_delete

# 需要导入模块: from efl.elementary.popup import Popup [as 别名]
# 或者: from efl.elementary.popup.Popup import delete [as 别名]
    def _confirm_delete(self, m, item):
        pp = Popup(self.top_widget, text=self._task.text)
        pp.part_text_set('title,text', 'Confirm task deletion?')

        btn = Button(pp, text='Cancel')
        btn.callback_clicked_add(lambda b: pp.delete())
        pp.part_content_set('button1', btn)

        btn = Button(pp, text='Delete Task')
        btn.callback_clicked_add(self._delete_confirmed, pp)
        pp.part_content_set('button2', btn)

        pp.show()
开发者ID:mwarchulinski,项目名称:edone,代码行数:15,代码来源:gui.py

示例7: _popup_build

# 需要导入模块: from efl.elementary.popup import Popup [as 别名]
# 或者: from efl.elementary.popup.Popup import delete [as 别名]
    def _popup_build(self):
        popup = Popup(self.top_widget)
        popup.part_text_set('title,text',
                            'Choose the color for %s' % self._tag_name)
        popup.callback_block_clicked_add(lambda p: popup.delete())

        cs = Colorselector(popup, color=self._rect.color)
        cs.callback_changed_add(lambda s: setattr(rect, 'color', cs.color))
        popup.content = cs

        rect = Rectangle(popup.evas, color=self._rect.color)
        frame = Frame(popup, style='pad_small', content=rect)
        popup.part_content_set('button1', frame)

        bt = Button(popup, text='Accept')
        bt.callback_clicked_add(self._popup_accept_cb, popup, cs)
        popup.part_content_set('button2', bt)

        bt = Button(popup, text='Cancel')
        bt.callback_clicked_add(lambda b: popup.delete())
        popup.part_content_set('button3', bt)

        popup.show()
开发者ID:mwarchulinski,项目名称:edone,代码行数:25,代码来源:gui.py

示例8: _task_edit_start

# 需要导入模块: from efl.elementary.popup import Popup [as 别名]
# 或者: from efl.elementary.popup.Popup import delete [as 别名]
    def _task_edit_start(self, task):
        pp = Popup(self.top_widget)
        pp.part_text_set('title,text', 'Edit task')

        en = Entry(pp, editable=True, single_line=True, scrollable=True,
                   text=task.raw_txt)
        en.callback_activated_add(lambda e: self._task_edit_end(task, en, pp))
        en.callback_aborted_add(lambda e: pp.delete())
        pp.part_content_set('default', en)

        b = Button(pp, text='Cancel')
        b.callback_clicked_add(lambda b: pp.delete())
        pp.part_content_set('button1', b)

        b = Button(pp, text='Accept')
        b.callback_clicked_add(lambda b: self._task_edit_end(task, en, pp))
        pp.part_content_set('button2', b)

        pp.show()

        en.cursor_begin_set()
        en.cursor_selection_begin()
        en.cursor_end_set()
        en.cursor_selection_end()
开发者ID:mwarchulinski,项目名称:edone,代码行数:26,代码来源:gui.py

示例9: safe_quit

# 需要导入模块: from efl.elementary.popup import Popup [as 别名]
# 或者: from efl.elementary.popup.Popup import delete [as 别名]
    def safe_quit(self):
        if need_save() is False:
            elm.exit()
        else:
            pp = Popup(self, text="You have unsave changes, if you don't save now all your recent modification will be lost.")
            pp.part_text_set('title,text', 'Save changes to your txt file?')

            btn = Button(pp, text='Close without saving')
            btn.callback_clicked_add(lambda b: elm.exit())
            pp.part_content_set('button1', btn)

            btn = Button(pp, text='Cancel')
            btn.callback_clicked_add(lambda b: pp.delete())
            pp.part_content_set('button2', btn)

            btn = Button(pp, text='Save')
            btn.callback_clicked_add(lambda b: self.save(True))
            pp.part_content_set('button3', btn)

            pp.show()
开发者ID:mwarchulinski,项目名称:edone,代码行数:22,代码来源:gui.py

示例10: ask_what_to_do_next

# 需要导入模块: from efl.elementary.popup import Popup [as 别名]
# 或者: from efl.elementary.popup.Popup import delete [as 别名]
    def ask_what_to_do_next(self):
        pop = Popup(self)
        pop.part_text_set('title,text', _('Extract completed'))

        box = Box(pop)
        pop.content = box
        box.show()

        lb = Label(pop, text=_('What to do next?'),
                   size_hint_align=FILL_HORIZ)
        box.pack_end(lb)
        lb.show()

        btn = Button(pop, text=_('Open Filemanager'),
                     size_hint_align=FILL_HORIZ)
        btn.callback_clicked_add(self._open_fm_and_exit_cb)
        box.pack_end(btn)
        btn.show()

        btn = Button(pop, text=_('Open Terminal'),
                     size_hint_align=FILL_HORIZ)
        btn.callback_clicked_add(self._open_term_and_exit_cb)
        box.pack_end(btn)
        btn.show()

        btn = Button(pop, text=_('Close this popup'),
                     size_hint_align=FILL_HORIZ)
        btn.callback_clicked_add(lambda b: pop.delete())
        box.pack_end(btn)
        btn.show()

        btn = Button(pop, text=_('Exit'),
                     size_hint_align=FILL_HORIZ)
        btn.callback_clicked_add(lambda b: self.app.exit())
        box.pack_end(btn)
        btn.show()

        pop.show()
开发者ID:lonid,项目名称:epack,代码行数:40,代码来源:gui.py

示例11: Interface

# 需要导入模块: from efl.elementary.popup import Popup [as 别名]
# 或者: from efl.elementary.popup.Popup import delete [as 别名]
class Interface(object):
    def __init__( self ):
        self.mainWindow = StandardWindow("epad", "Untitled - ePad", size=(600, 400))
        self.mainWindow.callback_delete_request_add(self.closeChecks)
        self.mainWindow.elm_event_callback_add(self.eventsCb)

        icon = Icon(self.mainWindow)
        icon.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND)
        icon.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL)
        icon.standard_set('accessories-text-editor') # assumes image icon is in local dir, may need to change later
        icon.show()
        self.mainWindow.icon_object_set(icon.object_get())

        self.mainBox = Box(self.mainWindow, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        self.mainBox.show()

        self.mainTb = Toolbar(self.mainWindow, homogeneous=False, size_hint_weight=(0.0, 0.0), size_hint_align=(EVAS_HINT_FILL, 0.0))
        self.mainTb.menu_parent =  self.mainWindow

        self.mainTb.item_append("document-new", "New", self.newPress)
        self.mainTb.item_append("document-open", "Open", self.openPress)
        self.mainTb.item_append("document-save", "Save", self.savePress)
        self.mainTb.item_append("document-save-as", "Save As", self.saveAsPress)
        # -- Edit Dropdown Menu --
        tb_it = self.mainTb.item_append("edit", "Edit")
        tb_it.menu = True
        menu = tb_it.menu
        menu.item_add(None, "Copy", "edit-copy", self.copyPress)
        menu.item_add(None, "Paste", "edit-paste", self.pastePress)
        menu.item_add(None, "Cut", "edit-cut", self.cutPress)
        menu.item_separator_add()
        menu.item_add(None, "Select All", "edit-select-all", self.selectAllPress)
        # -----------------------
        # self.mainTb.item_append("settings", "Options", self.optionsPress)
        self.mainTb.item_append("dialog-information", "About", self.aboutPress)
        
        self.mainEn = Entry(self.mainWindow, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        self.mainEn.callback_changed_user_add(self.textEdited)
        self.mainEn.scrollable_set(True) # creates scrollbars rather than enlarge window
        self.mainEn.line_wrap_set(False) # does not allow line wrap (can be changed by user)
        self.mainEn.autosave_set(False) # set to false to reduce disk I/O
        self.mainEn.elm_event_callback_add(self.eventsCb)
        self.mainEn.markup_filter_append(self.textFilter)
        self.mainEn.show()
        
        self.mainTb.show()

        self.mainBox.pack_end(self.mainTb)
        self.mainBox.pack_end(self.mainEn)

        #Build our file selector for saving/loading files
        self.fileBox = Box(self.mainWindow, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        self.fileBox.show()

        self.fileLabel = Label(self.mainWindow, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH)
        self.fileLabel.text = ""
        self.fileLabel.show()

        self.fileSelector = Fileselector(self.mainWindow, is_save=False, expandable=False, folder_only=False,
                      path=os.getenv("HOME"), size_hint_weight=EXPAND_BOTH,
                      size_hint_align=FILL_BOTH)
        self.fileSelector.callback_done_add(self.fileSelected)
        #self.fileSelector.callback_selected_add(fs_cb_selected, win)
        #self.fileSelector.callback_directory_open_add(fs_cb_directory_open, win)
        self.fileSelector.show()

        self.fileBox.pack_end(self.fileLabel)
        self.fileBox.pack_end(self.fileSelector)

        # the flip object has the file selector on one side and the GUI on the other
        self.flip = Flip(self.mainWindow, size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH)
        self.flip.part_content_set("front", self.mainBox)
        self.flip.part_content_set("back", self.fileBox)
        self.mainWindow.resize_object_add(self.flip)
        self.flip.show()

        self.isSaved = True
        self.isNewFile = False
        self.confirmPopup = None

    def newPress( self, obj, it ):
        self.newFile()
        it.selected_set(False)

    def openPress( self, obj, it ):
        self.openFile()
        it.selected_set(False)

    def savePress( self, obj, it ):
        self.saveFile()
        it.selected_set(False)

    def saveAsPress( self, obj, it ):
        self.saveAs()
        it.selected_set(False)

    def optionsPress( self, obj, it ):
        it.selected_set(False)

#.........这里部分代码省略.........
开发者ID:rbtylee,项目名称:ePad,代码行数:103,代码来源:ePad.py

示例12: Interface

# 需要导入模块: from efl.elementary.popup import Popup [as 别名]
# 或者: from efl.elementary.popup.Popup import delete [as 别名]
class Interface(object):
    def __init__(self):
        self.mainWindow = StandardWindow("epad", "Untitled - ePad",
                                         size=(600, 400))
        self.mainWindow.callback_delete_request_add(self.closeChecks)
        self.mainWindow.elm_event_callback_add(self.eventsCb)

        icon = Icon(self.mainWindow,
                    size_hint_weight=EXPAND_BOTH,
                    size_hint_align=FILL_BOTH)
        icon.standard_set('accessories-text-editor')
        icon.show()
        self.mainWindow.icon_object_set(icon.object_get())

        self.mainBox = Box(self.mainWindow,
                           size_hint_weight=EXPAND_BOTH,
                           size_hint_align=FILL_BOTH)
        self.mainBox.show()

        self.mainTb = ePadToolbar(self, self.mainWindow)
        self.mainTb.show()
        self.mainBox.pack_end(self.mainTb)

        # Initialize Text entry box
        print("Word wrap Initialized: {0}".format(self.wordwrap))
        self.entryInit()

        # Add label to show current cursor position
        if SHOW_POS:
            self.line_label = Label(self.mainWindow,
                                    size_hint_weight=EXPAND_HORIZ,
                                    size_hint_align=ALIGN_RIGHT)
            self.curChanged(self.mainEn, self.line_label)
            self.line_label.show()
            self.mainBox.pack_end(self.line_label)
            self.mainEn.callback_cursor_changed_add(self.curChanged,
                                                    self.line_label)

        # Build our file selector for saving/loading files
        self.fileBox = Box(self.mainWindow,
                           size_hint_weight=EXPAND_BOTH,
                           size_hint_align=FILL_BOTH)
        self.fileBox.show()

        self.fileLabel = Label(self.mainWindow,
                               size_hint_weight=EXPAND_HORIZ,
                               size_hint_align=FILL_BOTH, text="")
        self.fileLabel.show()

        self.fileSelector = Fileselector(self.mainWindow, is_save=False,
                                         expandable=False, folder_only=False,
                                         path=os.getenv("HOME"),
                                         size_hint_weight=EXPAND_BOTH,
                                         size_hint_align=FILL_BOTH)
        self.fileSelector.callback_done_add(self.fileSelected)
        self.fileSelector.show()

        self.fileBox.pack_end(self.fileLabel)
        self.fileBox.pack_end(self.fileSelector)

        # Flip object has the file selector on one side
        #   and the GUI on the other
        self.flip = Flip(self.mainWindow, size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH)
        self.flip.part_content_set("front", self.mainBox)
        self.flip.part_content_set("back", self.fileBox)
        self.mainWindow.resize_object_add(self.flip)
        self.flip.show()

        self.isSaved = True
        self.isNewFile = False
        self.confirmPopup = None

    def entryInit(self):
        self.mainEn = Entry(self.mainWindow, scrollable=True,
                            line_wrap=self.wordwrap, autosave=False,
                            size_hint_weight=EXPAND_BOTH,
                            size_hint_align=FILL_BOTH)
        self.mainEn.callback_changed_user_add(self.textEdited)
        self.mainEn.elm_event_callback_add(self.eventsCb)
        # self.mainEn.markup_filter_append(self.textFilter)
        self.mainEn.show()
        self.mainBox.pack_end(self.mainEn)

    def curChanged(self, entry, label):
        # get linear index into current text
        index = entry.cursor_pos_get()
        # Replace <br /> tag with single char
        #   to simplify (line, col) calculation
        tmp_text = entry.entry_get().replace("<br/>", "\n")
        line = tmp_text[:index].count("\n") + 1
        col = len(tmp_text[:index].split("\n")[-1]) + 1
        # Update label text with line, col
        label.text = "Ln {0} Col {1} ".format(line, col)

    def textEdited(self, obj):
        current_file = self.mainEn.file[0]
        current_file = \
            os.path.basename(current_file) if \
            current_file and not self.isNewFile else \
#.........这里部分代码省略.........
开发者ID:nijek,项目名称:ePad,代码行数:103,代码来源:ePad.py

示例13: ePadToolbar

# 需要导入模块: from efl.elementary.popup import Popup [as 别名]
# 或者: from efl.elementary.popup.Popup import delete [as 别名]
class ePadToolbar(Toolbar):
    def __init__(self, parent, canvas):
        Toolbar.__init__(self, canvas)
        self._parent = parent
        self._canvas = canvas

        self.homogeneous = False
        self.size_hint_weight = (0.0, 0.0)
        self.size_hint_align = (EVAS_HINT_FILL, 0.0)
        self.select_mode = ELM_OBJECT_SELECT_MODE_NONE

        self.menu_parent = canvas

        self.item_append("document-new", "New", self.newPress)
        self.item_append("document-open", "Open", self.openPress)
        self.item_append("document-save", "Save", self.savePress)
        self.item_append("document-save-as", "Save As", self.saveAsPress)
        # -- Edit Dropdown Menu --
        tb_it = self.item_append("edit", "Edit")
        tb_it.menu = True
        menu = tb_it.menu
        menu.item_add(None, "Copy", "edit-copy", self.copyPress)
        menu.item_add(None, "Paste", "edit-paste", self.pastePress)
        menu.item_add(None, "Cut", "edit-cut", self.cutPress)
        menu.item_separator_add()
        menu.item_add(None, "Select All", "edit-select-all",
                      self.selectAllPress)
        # -----------------------
        #
        # -- Options Dropdown Menu --
        #
        # self.item_append("settings", "Options", self.optionsPress)
        tb_it = self.item_append("preferences-desktop", "Options")
        tb_it.menu = True
        menu = tb_it.menu
        self._parent.wordwrap = WORD_WRAP
        it = menu.item_add(None, "Wordwrap", None, self.optionsWWPress)
        chk = Check(canvas, disabled=True)
        it.content = chk

        # ---------------------------

        self.item_append("dialog-information", "About", self.aboutPress)

    def newPress(self, obj, it):
        self._parent.newFile()

    def openPress(self, obj, it):
        self._parent.openFile()

    def savePress(self, obj, it):
        self._parent.saveFile()

    def saveAsPress(self, obj, it):
        self._parent.saveAs()

    def optionsWWPress(self, obj, it):
        wordwrap = self._parent.mainEn.line_wrap
        wordwrap = not wordwrap
        self._parent.mainEn.line_wrap = wordwrap
        it.content.state = wordwrap
        # FIXME: is this variable needed for anything?
        self._parent.wordwrap = wordwrap

    def copyPress(self, obj, it):
        self._parent.mainEn.selection_copy()

    def pastePress(self, obj, it):
        self._parent.mainEn.selection_paste()

    def cutPress(self, obj, it):
        self._parent.mainEn.selection_cut()

    def selectAllPress(self, obj, it):
        self._parent.mainEn.select_all()

    def aboutPress(self, obj, it):
        # About popup
        self.popupAbout = Popup(self._canvas, size_hint_weight=EXPAND_BOTH)
        self.popupAbout.part_text_set("title,text",
                                      "ePad version {0}".format(__version__))
        self.popupAbout.text = (
            "A simple text editor written in "
            "python and elementary<br><br> "
            "By: Jeff Hoogland"
            )
        bt = Button(self._canvas, text="Done")
        bt.callback_clicked_add(self.aboutClose)
        self.popupAbout.part_content_set("button1", bt)
        self.popupAbout.show()

    def aboutClose(self, bt):
        self.popupAbout.delete()
开发者ID:nijek,项目名称:ePad,代码行数:95,代码来源:ePad.py

示例14: aboutWin

# 需要导入模块: from efl.elementary.popup import Popup [as 别名]
# 或者: from efl.elementary.popup.Popup import delete [as 别名]
class aboutWin(Window):
    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 creditsPress(self, obj):
        # About popup
        self.popupAbout = Popup(self.aboutDialog,
                                size_hint_weight=EXPAND_BOTH)
#.........这里部分代码省略.........
开发者ID:emctoo,项目名称:ePad,代码行数:103,代码来源:ePad.py

示例15: Interface

# 需要导入模块: from efl.elementary.popup import Popup [as 别名]
# 或者: from efl.elementary.popup.Popup import delete [as 别名]
class Interface(object):
    def __init__(self):
        self.mainWindow = StandardWindow("epad", "Untitled - ePad",
                                         size=(600, 400))
        self.mainWindow.callback_delete_request_add(self.closeChecks)
        self.mainWindow.elm_event_callback_add(self.eventsCb)

        icon = Icon(self.mainWindow,
                    size_hint_weight=EXPAND_BOTH,
                    size_hint_align=FILL_BOTH)
        icon.standard_set('accessories-text-editor')
        icon.show()
        self.mainWindow.icon_object_set(icon.object_get())

        self.mainBox = Box(self.mainWindow,
                           size_hint_weight=EXPAND_BOTH,
                           size_hint_align=FILL_BOTH)
        self.mainBox.show()

        self.newInstance = NEW_INSTANCE
        self.mainTb = ePadToolbar(self, self.mainWindow)
        self.mainTb.focus_allow = False
        self.mainTb.show()
        self.mainBox.pack_end(self.mainTb)
        # Root User Notification
        if os.geteuid() == 0:
            printErr("Caution: Root User")
            if NOTIFY_ROOT:
                notifyBox = Box(self.mainWindow, horizontal=True)
                notifyBox.show()
                notify = Notify(self.mainWindow, size_hint_weight=EXPAND_BOTH,
                                align=(ELM_NOTIFY_ALIGN_FILL, 0.0),
                                content=notifyBox)
                notifyLabel = Label(self.mainWindow)
                notifyLabel.text = "<b><i>Root User</i></b>"
                notifyBox.pack_end(notifyLabel)
                notifyLabel.show()
                self.mainBox.pack_end(notifyBox)
        self.about = aboutWin(self, self.mainWindow)
        self.about.hide()
        # Initialize Text entry box and line label

        # FIXME: self.wordwrap initialized by ePadToolbar
        print("Word wrap Initialized: {0}".format(self.wordwrap))
        self.entryInit()

        # Build our file selector for saving/loading files
        self.fileBox = Box(self.mainWindow,
                           size_hint_weight=EXPAND_BOTH,
                           size_hint_align=FILL_BOTH)
        self.fileBox.show()

        self.fileLabel = Label(self.mainWindow,
                               size_hint_weight=EXPAND_HORIZ,
                               size_hint_align=FILL_BOTH, text="")
        self.fileLabel.show()
        self.lastDir = os.getenv("HOME")
        self.fileSelector = Fileselector(self.mainWindow, is_save=False,
                                         expandable=False, folder_only=False,
                                         hidden_visible=SHOW_HIDDEN,
                                         path=self.lastDir,
                                         size_hint_weight=EXPAND_BOTH,
                                         size_hint_align=FILL_BOTH)
        self.fileSelector.callback_done_add(self.fileSelected)
        self.fileSelector.callback_activated_add(self.fileSelected)
        self.fileSelector.callback_directory_open_add(self.updateLastDir)
        self.fileSelector.path_set(os.getcwd())
        self.fileSelector.show()

        self.fileBox.pack_end(self.fileLabel)
        self.fileBox.pack_end(self.fileSelector)

        # Flip object has the file selector on one side
        #   and the GUI on the other
        self.flip = Flip(self.mainWindow, size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH)
        self.flip.part_content_set("front", self.mainBox)
        self.flip.part_content_set("back", self.fileBox)
        self.mainWindow.resize_object_add(self.flip)
        self.flip.show()

        self.isSaved = True
        self.isNewFile = False
        self.confirmPopup = None
        self.fileExistsFlag = False

    def entryInit(self):
        self.mainEn = Entry(self.mainWindow, scrollable=True,
                            line_wrap=self.wordwrap, autosave=False,
                            size_hint_weight=EXPAND_BOTH,
                            size_hint_align=FILL_BOTH)
        self.mainEn.callback_changed_user_add(self.textEdited)
        self.mainEn.elm_event_callback_add(self.eventsCb)
        self.mainEn.callback_clicked_add(resetCloseMenuCount)
        # delete line lable if it exist so we can create and add new one
        #    Later need to rethink logic here
        try:
            self.line_label.delete()
        except AttributeError:
            pass
#.........这里部分代码省略.........
开发者ID:emctoo,项目名称:ePad,代码行数:103,代码来源:ePad.py


注:本文中的efl.elementary.popup.Popup.delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。