示例#1
0
文件: gui.py 项目: olbabrn/edone
    def _task_edit_start(self, task):
        pp = elm.Popup(self.top_widget)
        pp.part_text_set('title,text', 'Edit task')

        en = elm.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 = elm.Button(pp, text='Cancel')
        b.callback_clicked_add(lambda b: pp.delete())
        pp.part_content_set('button1', b)

        b = elm.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()
示例#2
0
文件: gui.py 项目: olbabrn/edone
    def _file_change(self):
        # hack to make popup respect min_size
        rect = Rectangle(self.parent.evas, size_hint_min=(400, 400))
        tb = elm.Table(self.parent)
        tb.pack(rect, 0, 0, 1, 1)

        # show the fileselector inside a popup
        popup = elm.Popup(self.top_widget, content=tb)
        popup.part_text_set('title,text', 'Choose the Todo.txt file to use')
        popup.show()

        # the fileselector widget
        fs = elm.Fileselector(popup,
                              is_save=False,
                              expandable=False,
                              size_hint_weight=EXPAND_BOTH,
                              size_hint_align=FILL_BOTH)
        fs.callback_activated_add(self._file_change_done, popup)
        fs.callback_done_add(self._file_change_done, popup)
        try:
            fs.selected = options.txt_file
        except:
            fs.path = os.path.expanduser('~')
        fs.show()
        tb.pack(fs, 0, 0, 1, 1)
示例#3
0
文件: gui.py 项目: olbabrn/edone
    def _confirm_delete(self, m, item):
        pp = elm.Popup(self.top_widget, text=self._task.text)
        pp.part_text_set('title,text', 'Confirm task deletion?')

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

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

        pp.show()
示例#4
0
文件: gui.py 项目: olbabrn/edone
    def _popup_build(self):
        popup = elm.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 = elm.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 = elm.Frame(popup, style='pad_small', content=rect)
        popup.part_content_set('button1', frame)

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

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

        popup.show()
示例#5
0
文件: gui.py 项目: olbabrn/edone
    def safe_quit(self):
        if need_save() is False:
            elm.exit()
        else:
            pp = elm.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 = elm.Button(pp, text='Close without saving')
            btn.callback_clicked_add(lambda b: elm.exit())
            pp.part_content_set('button1', btn)

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

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

            pp.show()