Exemplo n.º 1
0
    def __init__(self, repo, win):
        self.repo = repo
        self.win = win
        self.confirmed = False

        StandardWindow.__init__(self, 'Egitu', 'Egitu', autodel=True)

        vbox = Box(self, size_hint_weight=EXPAND_BOTH,
                   size_hint_align=FILL_BOTH)
        self.resize_object_add(vbox)
        vbox.show()

        # title
        en = Entry(self, editable=False,
                   text='<title><align=center>Commit changes</align></title>',
                   size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
        vbox.pack_end(en)
        en.show()

        panes = Panes(self, content_left_size = 0.2, horizontal=True,
                      size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        vbox.pack_end(panes)
        panes.show()
        
        # message entry
        en = Entry(self, editable=True, scrollable=True,
                   size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        en.part_text_set('guide', 'Enter commit message here')
        panes.part_content_set("left", en)
        en.show()
        self.msg_entry = en

        # diff entry
        self.diff_entry = DiffedEntry(self)
        panes.part_content_set("right", self.diff_entry)
        self.diff_entry.show()

        # buttons
        hbox = Box(self, horizontal=True, size_hint_weight=EXPAND_HORIZ,
                   size_hint_align=FILL_HORIZ)
        vbox.pack_end(hbox)
        hbox.show()

        bt = Button(self, text="Cancel")
        bt.callback_clicked_add(lambda b: self.delete())
        hbox.pack_end(bt)
        bt.show()

        bt = Button(self, text="Commit")
        bt.callback_clicked_add(self.commit_button_cb)
        hbox.pack_end(bt)
        bt.show()

        # show the window and give focus to the editable entry
        self.size = 500, 500
        self.show()
        en.focus = True

        # load the diff
        repo.request_diff(self.diff_done_cb, only_staged=True)
Exemplo n.º 2
0
    def __init__(self, parent, repo):
        self.repo = repo

        Popup.__init__(self, parent)
        self.part_text_set("title,text", "Add remote")

        tb = Table(self, padding=(3, 3), size_hint_expand=EXPAND_BOTH)
        self.content = tb
        tb.show()

        # name
        lb = Label(tb, text="Name")
        tb.pack(lb, 0, 0, 1, 1)
        lb.show()

        en = Entry(
            tb, editable=True, single_line=True, scrollable=True, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH
        )
        en.part_text_set("guide", "Name for the new remote")
        en.callback_changed_user_add(lambda e: self.err_unset())
        tb.pack(en, 1, 0, 1, 1)
        en.show()
        self.name_entry = en

        # url
        lb = Label(tb, text="URL")
        tb.pack(lb, 0, 1, 1, 1)
        lb.show()

        en = Entry(
            tb, editable=True, single_line=True, scrollable=True, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH
        )
        en.part_text_set("guide", "git://git.example.com/repo.git")
        en.callback_changed_user_add(lambda e: self.err_unset())
        tb.pack(en, 1, 1, 1, 1)
        en.show()
        self.url_entry = en

        # error label
        lb = Label(tb, text="", size_hint_expand=EXPAND_HORIZ)
        tb.pack(lb, 0, 2, 2, 1)
        lb.show()
        self.error_label = lb

        # buttons
        bt = Button(self, text="Cancel")
        bt.callback_clicked_add(lambda b: self.delete())
        self.part_content_set("button1", bt)
        bt.show()

        bt = Button(self, text="Add remote")
        bt.callback_clicked_add(self._add_btn_cb)
        self.part_content_set("button2", bt)
        bt.show()

        self.show()
Exemplo n.º 3
0
    def __init__(self, parent, app):
        self.app = app

        Popup.__init__(self, parent)
        self.part_text_set('title,text', 'Save current status')
        self.part_content_set('title,icon', SafeIcon(self, 'git-stash'))

        # main vertical box
        box = Box(self, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
        self.content = box
        box.show()

        # separator
        sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_HORIZ)
        box.pack_end(sep)
        sep.show()

        # description
        en = Entry(self, single_line=True, scrollable=True,
                   size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
        en.part_text_set('guide', 'Stash description (or empty for the default)')
        en.text = 'WIP on ' + app.repo.status.head_describe
        box.pack_end(en)
        en.show()

        # include untracked
        ck = Check(self, text='Include untracked files', state=True,
                   size_hint_expand=EXPAND_HORIZ, size_hint_align=(0.0,0.5))
        box.pack_end(ck)
        ck.show()

        # separator
        sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_HORIZ)
        box.pack_end(sep)
        sep.show()

        # buttons
        bt = Button(self, text='Close')
        bt.callback_clicked_add(lambda b: self.delete())
        self.part_content_set('button1', bt)
        bt.show()

        bt = Button(self, text='Stash', content=SafeIcon(self, 'git-stash'))
        bt.callback_clicked_add(self._stash_clicked_cb, en, ck)
        self.part_content_set('button2', bt)
        bt.show()

        # focus to the entry and show
        en.select_all()
        en.focus = True
        self.show()
Exemplo n.º 4
0
    def __init__(self, parent, done_cb, title, text=None, guide=None, not_empty=True):
        self.done_cb = done_cb

        Popup.__init__(self, parent)
        self.part_text_set('title,text', title)

        box = Box(self, padding=(0,4))
        self.content = box
        box.show()

        if text:
            lb = Label(self, text=text)
            box.pack_end(lb)
            lb.show()

        en = Entry(self, single_line=True, scrollable=True,
                   size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
        if guide is not None:
            en.part_text_set('guide', guide)
        box.pack_end(en)
        en.show()

        sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_HORIZ)
        box.pack_end(sep)
        sep.show()

        b = Button(self, text='Cancel')
        b.callback_clicked_add(lambda b: self.delete())
        self.part_content_set('button1', b)
        b.show()
        
        b = Button(self, text='OK', disabled=not_empty)
        b.callback_clicked_add(self._confirmed_cb, en, done_cb)
        self.part_content_set('button2', b)
        b.show()

        if not_empty is True:
            en.callback_changed_user_add(self._entry_changed, b)

        en.focus = True
        self.show()
Exemplo n.º 5
0
Arquivo: gui.py Projeto: DaveMDS/egitu
    def __init__(self, parent, app):
        self.app = app

        Popup.__init__(self, parent)

        # title
        self.part_text_set('title,text', 'Clone')
        self.part_content_set('title,icon', SafeIcon(self, 'egitu'))

        # main table
        tb = Table(self, padding=(0,4),
                   size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
        self.content = tb
        tb.show()

        # sep
        sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_HORIZ)
        tb.pack(sep, 0, 0, 2, 1)
        sep.show()

        # url
        en = Entry(self, single_line=True, scrollable=True,
                   size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
        en.part_text_set('guide', 'Path or URL to clone')
        tb.pack(en, 0, 1, 2, 1)
        en.show()
        self.url_entry = en

        # parent folder
        en = Entry(self, single_line=True, scrollable=True,
                   size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
        en.part_text_set('guide', 'Parent folder to clone into')
        tb.pack(en, 0, 2, 1, 1)
        en.show()

        bt = Button(self, text='', content=SafeIcon(self, 'folder'))
        bt.callback_clicked_add(self._folder_clicked_cb)
        tb.pack(bt, 1, 2, 1, 1)
        bt.show()
        self.folder_entry = en

        # shallow check
        ck = Check(self, text='Shallow (no history and no branches, faster)',
                   size_hint_expand=EXPAND_BOTH, size_hint_align=(0.0,0.5))
        tb.pack(ck, 0, 3, 2, 1)
        ck.show()
        self.shallow_check = ck

        # output entry
        en = CommandOutputEntry(self, min_size=(400, 150))
        tb.pack(en, 0, 4, 2, 1)
        en.show()
        self.output_entry = en

        # sep
        sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_HORIZ)
        tb.pack(sep, 0, 5, 2, 1)
        sep.show()

        # bottons
        bt = Button(self, text='Close')
        bt.callback_clicked_add(lambda b: self.delete())
        self.part_content_set('button1', bt)
        bt.show()
        self.close_btn = bt

        bt = Button(self, text='Clone')
        bt.callback_clicked_add(self._clone_clicked_cb)
        self.part_content_set('button2', bt)
        bt.show()
        self.clone_btn = bt

        #
        self.show()
Exemplo n.º 6
0
    def __init__(self, app, revert_commit=None, cherrypick_commit=None):
        self.app = app
        self.confirmed = False
        self.revert_commit = revert_commit
        self.cherrypick_commit = cherrypick_commit

        DialogWindow.__init__(self, app.win, 'Egitu', 'Egitu',
                              size=(500,500), autodel=True)

        vbox = Box(self, size_hint_weight=EXPAND_BOTH,
                   size_hint_align=FILL_BOTH)
        self.resize_object_add(vbox)
        vbox.show()

        # title
        if revert_commit:
            title = 'Revert commit'
        elif cherrypick_commit:
            title = 'Cherry-pick commit'
        else:
            title = 'Commit changes'
        en = Entry(self, editable=False,
                   text='<title><align=center>%s</align></title>' % title,
                   size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
        vbox.pack_end(en)
        en.show()

        # auto-commit checkbox (for revert and cherry-pick)
        if revert_commit or cherrypick_commit:
            ck = Check(vbox, state=True)
            ck.text = 'Automatically commit, in branch: %s' % \
                      app.repo.status.current_branch.name
            ck.callback_changed_add(lambda c: self.msg_entry.disabled_set(not c.state))
            vbox.pack_end(ck)
            ck.show()
            self.autocommit_chk = ck

        # Panes
        panes = Panes(self, content_left_size = 0.2, horizontal=True,
                      size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        vbox.pack_end(panes)
        panes.show()

        # message entry
        en = Entry(self, editable=True, scrollable=True,
                   size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        en.part_text_set('guide', 'Enter commit message here')
        panes.part_content_set("left", en)
        if revert_commit:
            en.text = 'Revert "%s"<br><br>This reverts commit %s.<br><br>' % \
                      (utf8_to_markup(revert_commit.title),
                       revert_commit.sha)
        elif cherrypick_commit:
            en.text = '%s<br><br>%s<br>(cherry picked from commit %s)<br>' % \
                      (utf8_to_markup(cherrypick_commit.title),
                       utf8_to_markup(cherrypick_commit.message),
                       cherrypick_commit.sha)
        en.cursor_end_set()
        en.show()
        self.msg_entry = en

        # diff entry
        self.diff_entry = DiffedEntry(self)
        panes.part_content_set('right', self.diff_entry)
        self.diff_entry.show()

        # buttons
        hbox = Box(self, horizontal=True, size_hint_weight=EXPAND_HORIZ,
                   size_hint_align=FILL_HORIZ)
        vbox.pack_end(hbox)
        hbox.show()

        bt = Button(self, text='Cancel')
        bt.callback_clicked_add(lambda b: self.delete())
        hbox.pack_end(bt)
        bt.show()

        if revert_commit:
            label = 'Revert'
        elif cherrypick_commit:
            label = 'Cherry-pick'
        else:
            label = 'Commit'
        bt = Button(self, text=label)
        bt.callback_clicked_add(self.commit_button_cb)
        hbox.pack_end(bt)
        bt.show()

        # show the window and give focus to the editable entry
        self.show()
        en.focus = True

        # load the diff
        if revert_commit:
            app.repo.request_diff(self.diff_done_cb, revert=True,
                                  ref1=revert_commit.sha)
        elif cherrypick_commit:
            app.repo.request_diff(self.diff_done_cb, ref1=cherrypick_commit.sha)
        else:
            app.repo.request_diff(self.diff_done_cb, only_staged=True)
Exemplo n.º 7
0
    def __init__(self, parent, app):
        self.app = app

        Popup.__init__(self, parent)
        self.part_text_set('title,text', 'Create tag')
        self.part_content_set('title,icon', Icon(self, standard='git-tag'))

        # main vertical box
        tb = Table(self, padding=(4,4),
                    size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
        self.content = tb
        tb.show()

        # sep
        sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_BOTH)
        tb.pack(sep, 0, 0, 2, 1)
        sep.show()

        # tag name
        en = Entry(self, single_line=True, scrollable=True,
                   size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
        en.part_text_set('guide', 'Type the tag name, ex: v1.15.0')
        en.callback_changed_user_add(self._something_changed_cb)
        tb.pack(en, 0, 1, 2, 1)
        en.show()
        self.name_entry  = en

        # annotated or light
        rdg = Radio(self, state_value=1, value=1, text='Annotated',
                    size_hint_expand=EXPAND_BOTH)
        rdg.callback_changed_add(self._annotated_radio_changed_cb)
        rdg.callback_changed_add(self._something_changed_cb)
        tb.pack(rdg, 0, 2, 1, 1)
        rdg.show()
        self.annotated_radio  = rdg

        rd = Radio(self, state_value=0, text='Lightweight',
                   size_hint_expand=EXPAND_BOTH)
        rd.callback_changed_add(self._annotated_radio_changed_cb)
        rd.callback_changed_add(self._something_changed_cb)
        rd.group_add(rdg)
        tb.pack(rd, 1, 2, 1, 1)
        rd.show()

        # message entry
        en = Entry(self, scrollable=True,
                   size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
        en.part_text_set('guide', 'Type a message for the tag')
        en.callback_changed_user_add(self._something_changed_cb)

        r = Rectangle(self.evas, size_hint_min=(200,150),
                      size_hint_expand=EXPAND_BOTH)
        tb.pack(r, 0, 3, 2, 1)
        tb.pack(en, 0, 3, 2, 1)
        en.show()
        self.msg_entry  = en

        # buttons
        sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_BOTH)
        tb.pack(sep, 0, 4, 2, 1)
        sep.show()

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

        bt = Button(self, text='Create', disabled=True,
                    content=Icon(self, standard='git-tag'))
        bt.callback_clicked_add(self._create_clicked_cb)
        self.part_content_set('button2', bt)
        bt.show()
        self.create_btn = bt

        #
        self.name_entry.focus = True
        self.show()
Exemplo n.º 8
0
    tg.callback_changed_add(cb_mirroring)
    box0.pack_end(tg)
    tg.show()

    bx1 = Box(win, size_hint_weight=(EVAS_HINT_EXPAND, 0.0),
        size_hint_align=(EVAS_HINT_FILL, 0.0), horizontal=True)
    box0.pack_end(bx1)
    bx1.show()

    lb = Label(win, text="Filter:")
    bx1.pack_end(lb)
    lb.show()

    en = Entry(win, single_line=True, scrollable=True,
        size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
    en.part_text_set("guide", "Type widget name here to search.")
    en.callback_changed_add(cb_filter, win)
    bx1.pack_end(en)
    en.show()
    en.focus_set(True)

    sc = Scroller(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
        bounce=(False, True))
    sc.show()
    box0.pack_end(sc)

    tbx = Box(win, size_hint_weight=(EVAS_HINT_EXPAND, 0.0),
        size_hint_align=(EVAS_HINT_FILL, 0.0))
    sc.content_set(tbx)
    tbx.show()
Exemplo n.º 9
0
              size_hint_weight=(EVAS_HINT_EXPAND, 0.0),
              size_hint_align=(EVAS_HINT_FILL, 0.0),
              horizontal=True)
    box0.pack_end(bx1)
    bx1.show()

    lb = Label(win, text="Filter:")
    bx1.pack_end(lb)
    lb.show()

    en = Entry(win,
               single_line=True,
               scrollable=True,
               size_hint_weight=EXPAND_BOTH,
               size_hint_align=FILL_BOTH)
    en.part_text_set("guide", "Type widget name here to search.")
    en.callback_changed_add(cb_filter, win)
    bx1.pack_end(en)
    en.show()
    en.focus_set(True)

    sc = Scroller(win,
                  size_hint_weight=EXPAND_BOTH,
                  size_hint_align=FILL_BOTH,
                  bounce=(False, True))
    sc.show()
    box0.pack_end(sc)

    tbx = Box(win,
              size_hint_weight=(EVAS_HINT_EXPAND, 0.0),
              size_hint_align=(EVAS_HINT_FILL, 0.0))
Exemplo n.º 10
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
        StandardWindow.__init__(self, "edone", "Edone")
        self.callback_delete_request_add(lambda o: self.safe_quit())
        # self.focus_highlight_enabled = True

        # main vertical box
        vbox = Box(self, size_hint_weight=EXPAND_BOTH)
        self.resize_object_add(vbox)
        vbox.show()

        ### Header ###
        hbox1 = Box(vbox, horizontal=True)
        fr = 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 = Button(hbox1, text='New Task', focus_allow=False)
        b.content = Icon(hbox1, standard='add')
        b.callback_clicked_add(lambda b: self.task_add())
        hbox1.pack_end(b)
        b.show()

        # title
        title = 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 = 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('end', Icon(en, standard='find', size_hint_min=(20,20)))
        hbox1.pack_end(en)
        en.show()
        self.search_entry = en

        ### Main horizontal box ###
        hbox = 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 = 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 = 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()