Ejemplo n.º 1
0
    def __init__(self, app, branch):
        self.app = app

        on_head = (branch == app.repo.status.current_branch)
        disable = (on_head or app.repo.status.head_detached)

        Menu.__init__(self, app.win)
        label = '{} {}'.format(branch.name, '(HEAD)' if on_head else '')
        self.item_add(None, label, 'git-branch').disabled = True
        self.item_separator_add()

        self.item_add(None, 'Checkout', None,
                      lambda m,i: self.app.checkout_ref(branch.name)) \
                      .disabled = disable

        self.item_add(None, 'Merge in current branch', 'git-merge',
                      lambda m,i: self.app.action_branch_merge(branch)) \
                      .disabled = disable

        self.item_add(None, 'Compare & Merge', 'git-compare',
                      lambda m,i: self.app.action_compare(target=branch.name)) \
                      .disabled = disable

        self.item_add(None, 'Delete', 'user-trash',
                      lambda m,i: self.app.action_branch_delete(branch)) \
                      .disabled = disable

        # show the menu at mouse position
        x, y = self.evas.pointer_canvas_xy_get()
        self.move(x + 2, y)
        self.show()
Ejemplo n.º 2
0
    def __init__(self, parent, task):
        self._task = task
        Menu.__init__(self, parent)

        # done/todo
        if task.completed:
            self.item_add(None, 'Mark as Todo', None,
                          lambda m,i: self._completed_set(False))
        else:
            self.item_add(None, 'Mark as Done', None,
                          lambda m,i: self._completed_set(True))

        # priority
        it_prio = self.item_add(None, 'Priority')
        for p in ('A', 'B', 'C', 'D', 'E'):
            icon = 'arrow_right' if task.priority == p else None
            self.item_add(it_prio, p, icon, self._priority_cb)

        # completion progress
        it_prog = self.item_add(None, 'Progress')
        for p in range(0, 101, 10):
            if task.progress is not None and p <= task.progress < p + 10:
                icon = 'arrow_right'
            else:
                icon = None
            self.item_add(it_prog, '%d %%' % p, icon, self._progress_cb)

        # delete task
        self.item_separator_add()
        self.item_add(None, 'Delete task', 'delete', self._confirm_delete)

        # show the menu at mouse position
        x, y = self.evas.pointer_canvas_xy_get()
        self.move(x + 2, y)
        self.show()
Ejemplo n.º 3
0
Archivo: gui.py Proyecto: simotek/egitu
    def __init__(self, win, parent):
        Menu.__init__(self, win)
        self.win = win

        # main actions
        self.item_add(None, "Refresh", "refresh", self._item_refresh_cb)
        self.item_add(None, "Open", "folder", self._item_open_cb)
        self.item_separator_add()

        # general options
        it_gen = self.item_add(None, "General", "preference")

        it = self.item_add(it_gen, "Use relative dates", None,
                           self._item_check_opts_cb, 'date_relative')
        it.content = Check(self, state=options.date_relative)

        it_gravatar = self.item_add(it_gen, "Gravatar")
        for name in ('mm', 'identicon', 'monsterid', 'wavatar', 'retro'):
            icon = "arrow_right" if name == options.gravatar_default else None
            self.item_add(it_gravatar, name, icon,  self._item_gravatar_cb)
        self.item_separator_add(it_gravatar)
        self.item_add(it_gravatar, 'Clear icons cache', 'delete',
                      lambda m,i: GravatarPict.clear_icon_cache())

        # dag options
        it_dag = self.item_add(None, "Dag", "preference")

        it = self.item_add(it_dag, "Show remote refs", None,
                           self._item_check_opts_cb, 'show_remotes_in_dag')
        it.content = Check(self, state=options.show_remotes_in_dag)

        it = self.item_add(it_dag, "Show commit messagges", None,
                           self._item_check_opts_cb, 'show_message_in_dag')
        it.content = Check(self, state=options.show_message_in_dag)

        # diff options
        it_diff = self.item_add(None, "Diff", "preference")

        it = self.item_add(it_diff, "Wrap long lines", None,
                           self._item_wrap_line_cb)
        it.content = Check(self, state=options.diff_text_wrap)

        it_font = self.item_add(it_diff, "Font face")
        for face in ('Sans', 'Mono'):
            icon = "arrow_right" if face == options.diff_font_face else None
            self.item_add(it_font, face, icon, self._item_font_face_cb)

        it_font = self.item_add(it_diff, "Font size")
        for size in (8, 9, 10, 11, 12, 13, 14):
            icon = "arrow_right" if size == options.diff_font_size else None
            self.item_add(it_font, str(size), icon, self._item_font_size_cb)

        x, y, w, h = parent.geometry
        self.move(x, y + h)
        self.show()
Ejemplo n.º 4
0
    def __init__(self, app, tag):
        self.app = app

        Menu.__init__(self, app.win)
        self.item_add(None, tag.name, 'git-tag').disabled = True
        self.item_separator_add()

        self.item_add(None, 'Checkout', None,
                      lambda m,i: self.app.checkout_ref(tag.ref))
        self.item_add(None, 'Delete', 'user-trash',
                      lambda m,i: self.app.action_tag_delete(tag))

        # show the menu at mouse position
        x, y = self.evas.pointer_canvas_xy_get()
        self.move(x + 2, y)
        self.show()
Ejemplo n.º 5
0
    def __init__(self, app, stash_item):
        self.app = app

        Menu.__init__(self, app.win)
        self.item_add(None, stash_item.desc, 'git-stash').disabled = True
        self.item_separator_add()
        self.item_add(None, 'Show', None,
                      lambda m,i: self.app.action_stash_show_item(stash_item))
        self.item_add(None, 'Apply', None,
                      lambda m,i: self.app.action_stash_apply(stash_item))
        self.item_add(None, 'Pop (apply & delete)', None,
                      lambda m,i: self.app.action_stash_pop(stash_item))
        self.item_add(None, 'Branch & Delete', 'git-branch',
                      lambda m,i: self.app.action_stash_branch(stash_item))
        self.item_add(None, 'Delete', 'user-trash',
                      lambda m,i: self.app.action_stash_drop(stash_item))

        # show the menu at mouse position
        x, y = self.evas.pointer_canvas_xy_get()
        self.move(x + 2, y)
        self.show()