Beispiel #1
0
    def __init__(self, parent):
        elm.Box.__init__(self, parent, horizontal=True,
                         size_hint_expand=EXPAND_HORIZ,
                         size_hint_fill=FILL_HORIZ)

        self.lb_name = elm.Label(self, ellipsis=True,
                    size_hint_expand=EXPAND_HORIZ, size_hint_fill=FILL_HORIZ,
                    text='<align=left>{}</align>'.format(_('No image selected')))
        self.pack_end(self.lb_name)
        self.lb_name.show()
        
        self.lb_info = elm.Label(self)
        self.pack_end(self.lb_info)
        self.lb_info.show()
Beispiel #2
0
    def __init__(self, parent):
        self._freezed = False  # used in populate to not trigger callbacks
        elm.Box.__init__(self,
                         parent,
                         size_hint_weight=EXPAND_VERT,
                         size_hint_align=FILL_VERT)

        # status (view: all, todo or done)
        seg = elm.SegmentControl(self, focus_allow=False)
        for name, val in ('All', 'all'), ('Todo', 'todo'), ('Done', 'done'):
            it = seg.item_add(None, name)
            it.data['view'] = val
            it.selected = True if options.view == val else False
        seg.callback_changed_add(self._status_changed_cb)
        self.pack_end(seg)
        seg.show()

        # @Projects list
        label = elm.Label(self, text="<b>Projects +</b>", scale=1.4)
        self.pack_end(label)
        label.show()

        self.projs_list = elm.List(self,
                                   multi_select=True,
                                   focus_allow=False,
                                   size_hint_weight=EXPAND_BOTH,
                                   size_hint_align=FILL_BOTH)
        self.projs_list.callback_selected_add(self._list_selection_changed_cb)
        self.projs_list.callback_unselected_add(
            self._list_selection_changed_cb)
        self.pack_end(self.projs_list)
        self.projs_list.show()

        # @Contexts list
        label = elm.Label(self, text="<b>Contexts @</b>", scale=1.4)
        self.pack_end(label)
        label.show()

        self.cxts_list = elm.List(self,
                                  multi_select=True,
                                  focus_allow=False,
                                  size_hint_weight=EXPAND_BOTH,
                                  size_hint_align=FILL_BOTH)
        self.cxts_list.callback_selected_add(self._list_selection_changed_cb)
        self.cxts_list.callback_unselected_add(self._list_selection_changed_cb)
        self.pack_end(self.cxts_list)
        self.cxts_list.show()

        self.show()
Beispiel #3
0
    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()
Beispiel #4
0
def main():

    # make the application quit when the last window is closed
    elm.policy_set(elm.ELM_POLICY_QUIT, elm.ELM_POLICY_QUIT_LAST_WINDOW_CLOSED)

    # Create the main app window
    win = elm.StandardWindow("main",
                             "My first window",
                             autodel=True,
                             size=(300, 200))

    # Create a simple label
    label = elm.Label(win,
                      text="Hello World Python !",
                      size_hint_expand=EXPAND_BOTH,
                      size_hint_fill=FILL_BOTH)
    win.resize_object_add(label)
    label.show()

    # Show the window and start the efl main loop
    win.show()
    elm.run()
Beispiel #5
0
    def populate_lists(self):
        tags = {}  # key: tag_name  val: num_tasks
        selected = [
            it.text for it in chain(self.cxts_list.selected_items,
                                    self.projs_list.selected_items)
        ]

        for task in TASKS:
            for name in chain(task.projects, task.contexts):
                tags[name] = tags[name] + 1 if name in tags else 1

        self._freezed = True
        self.cxts_list.clear()
        self.projs_list.clear()
        for name, num in sorted(tags.items()):
            rect = ColorRect(self, tag_color_get(name), name)
            num = elm.Label(self, text=str(num), style='marker')
            if name.startswith('+'):
                it = self.projs_list.item_append(name, rect, num)
            else:
                it = self.cxts_list.item_append(name, rect, num)
            if name in selected:
                it.selected = True
        self._freezed = False
Beispiel #6
0
    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()
Beispiel #7
0
    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()