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()
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()
def __init__(self, parent): elm.InnerWindow.__init__(self, parent) vbox = elm.Box(self) vbox.show() self.content = vbox title = elm.Label(self, scale=2.0, text='Edone %s' % VERSION) title.show() vbox.pack_end(title) en = elm.Entry(self, text=INFO, editable=False, scrollable=True, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) en.show() vbox.pack_end(en) sep = elm.Separator(self, horizontal=True) sep.show() vbox.pack_end(sep) close = elm.Button(self, text='Close') close.callback_clicked_add(lambda b: self.delete()) close.show() vbox.pack_end(close) self.activate()
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()
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()
def __init__(self): # main widget 'pointers' self.tasks_list = None self.filters = None self.task_note = None self.search_entry = None self.main_panes = None # the window elm.StandardWindow.__init__(self, 'edone', 'Edone') self.callback_delete_request_add(lambda o: self.safe_quit()) # self.focus_highlight_enabled = True # main vertical box vbox = elm.Box(self, size_hint_weight=EXPAND_BOTH) self.resize_object_add(vbox) vbox.show() ### Header ### hbox1 = elm.Box(vbox, horizontal=True) fr = elm.Frame(vbox, style='outdent_bottom', content=hbox1, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) vbox.pack_end(fr) fr.show() # menu button m = OptionsMenu(hbox1) hbox1.pack_end(m) m.show() # new task button b = elm.Button(hbox1, text='New Task', focus_allow=False) b.content = SafeIcon(hbox1, 'list-add') b.callback_clicked_add(lambda b: self.task_add()) hbox1.pack_end(b) b.show() # title title = elm.Label(hbox1, text='Getting Things Done', scale=2.0, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) hbox1.pack_end(title) title.show() # search entry en = elm.Entry(hbox1, single_line=True, scrollable=True, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) en.part_text_set('guide', 'search') en.callback_changed_user_add(self._search_changed_user_cb) en.content_set('icon', SafeIcon(en, 'edit-find', size_hint_min=(16, 16))) hbox1.pack_end(en) en.show() self.search_entry = en ### Main horizontal box ### hbox = elm.Box(vbox, horizontal=True, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) vbox.pack_end(hbox) hbox.show() # the filters box widget (inside a padding frame) self.filters = Filters(hbox) fr = elm.Frame(hbox, style='pad_medium', content=self.filters, size_hint_weight=EXPAND_VERT, size_hint_align=FILL_VERT) hbox.pack_end(fr) fr.show() ### the main panes (horiz or vert) panes = elm.Panes(hbox, horizontal=not options.horiz_layout, content_left_min_relative_size=0.3, content_right_min_relative_size=0.1, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) panes.content_left_size = 1.0 hbox.pack_end(panes) panes.show() self.main_panes = panes ### the tasks list ### self.tasks_list = TasksList(panes) panes.part_content_set('left', self.tasks_list) ### the single task view ### self.task_note = TaskNote(panes) panes.part_content_set('right', self.task_note) # show the window self.resize(800, 600) self.show()
def __init__(self, parent): elm.DialogWindow.__init__(self, parent, 'eluminance-info', 'Eluminance', autodel=True) fr = elm.Frame(self, style='pad_large', size_hint_expand=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.resize_object_add(fr) fr.show() hbox = elm.Box(self, horizontal=True, padding=(12,12)) fr.content = hbox hbox.show() vbox = elm.Box(self, align=(0.0,0.0), padding=(6,6), size_hint_expand=EXPAND_VERT, size_hint_fill=FILL_VERT) hbox.pack_end(vbox) vbox.show() # icon + version ic = utils.SafeIcon(self, 'eluminance', size_hint_min=(64,64)) vbox.pack_end(ic) ic.show() lb = elm.Label(self, text=_('Version: %s') % __version__) vbox.pack_end(lb) lb.show() sep = elm.Separator(self, horizontal=True) vbox.pack_end(sep) sep.show() # buttons bt = elm.Button(self, text=_('Eluminance'), size_hint_fill=FILL_HORIZ) bt.callback_clicked_add(lambda b: self.entry.text_set(utils.INFO)) vbox.pack_end(bt) bt.show() bt = elm.Button(self, text=_('Website'),size_hint_align=FILL_HORIZ) bt.callback_clicked_add(lambda b: utils.xdg_open(utils.HOMEPAGE)) vbox.pack_end(bt) bt.show() bt = elm.Button(self, text=_('Authors'), size_hint_align=FILL_HORIZ) bt.callback_clicked_add(lambda b: self.entry.text_set(utils.AUTHORS)) vbox.pack_end(bt) bt.show() bt = elm.Button(self, text=_('License'), size_hint_align=FILL_HORIZ) bt.callback_clicked_add(lambda b: self.entry.text_set(utils.LICENSE)) vbox.pack_end(bt) bt.show() # main text self.entry = elm.Entry(self, editable=False, scrollable=True, text=utils.INFO, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) self.entry.callback_anchor_clicked_add(lambda e,i: utils.xdg_open(i.name)) hbox.pack_end(self.entry) self.entry.show() self.resize(400, 200) self.show()