def __init__(self, cmd, exec_cb): DialogWindow.__init__(self, _app_instance.win, 'egitu-review', 'Git Command Review', autodel=True, size=(300,50)) # main table (inside a padding frame) fr = Frame(self, style='default', text='Command to execute', size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) self.resize_object_add(fr) fr.show() tb = Table(self, padding=(6,6), size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) fr.content = tb tb.show() # cmd entry en = Entry(self, single_line=True, scrollable=True, text=utf8_to_markup(cmd), size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) tb.pack(en, 0, 0, 2, 1) en.show() # buttons bt = Button(self, text='Close', size_hint_expand=EXPAND_HORIZ, size_hint_fill=FILL_HORIZ) bt.callback_clicked_add(lambda b: self.delete()) tb.pack(bt, 0, 1, 1, 1) bt.show() bt = Button(self, text='Execute', size_hint_expand=EXPAND_HORIZ, size_hint_fill=FILL_HORIZ) bt.callback_clicked_add(self._exec_clicked_cb, en, exec_cb) tb.pack(bt, 1, 1, 1, 1) bt.show() # self.show()
def __init__(self, parent): DialogWindow.__init__(self, parent, 'epack-info', 'Epack', autodel=True) fr = Frame(self, style='pad_large', size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.resize_object_add(fr) fr.show() hbox = Box(self, horizontal=True, padding=(12,12)) fr.content = hbox hbox.show() vbox = Box(self, align=(0.0,0.0), padding=(6,6), size_hint_weight=EXPAND_VERT, size_hint_align=FILL_VERT) hbox.pack_end(vbox) vbox.show() # icon + version ic = Icon(self, standard='epack', size_hint_min=(64,64)) vbox.pack_end(ic) ic.show() lb = Label(self, text=_('Version: %s') % __version__) vbox.pack_end(lb) lb.show() sep = Separator(self, horizontal=True) vbox.pack_end(sep) sep.show() # buttons bt = Button(self, text=_('Epack'), size_hint_align=FILL_HORIZ) bt.callback_clicked_add(lambda b: self.entry.text_set(utils.INFO)) vbox.pack_end(bt) bt.show() bt = Button(self, text=_('Website'),size_hint_align=FILL_HORIZ) bt.callback_clicked_add(lambda b: utils.xdg_open(utils.GITHUB)) vbox.pack_end(bt) bt.show() bt = 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 = 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 = Entry(self, editable=False, scrollable=True, text=utils.INFO, size_hint_weight=EXPAND_BOTH, size_hint_align=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()
def __init__(self, app): self.app = app DialogWindow.__init__(self, app.win, 'egitu-remotes', 'Remotes', autodel=True, size=(600,400)) # main vertical box (inside a padding frame) fr = Frame(self, style='pad_medium', size_hint_weight=EXPAND_BOTH) self.resize_object_add(fr) fr.show() box = Box(fr, padding=(6,6)) fr.content = box box.show() # panes panes = Panes(box, content_left_size=0.25, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) box.pack_end(panes) panes.show() ### remotes List (on the left) li = List(panes) li.callback_selected_add(self._list_selected_cb) panes.part_content_set('left', li) li.show() self.remotes_list = li ### remote info (on the right) tb = Table(self, padding=(4, 4)) panes.part_content_set('right', tb) tb.show() # url lb = Label(self, text='URL', size_hint_align=(0.0,0.5)) tb.pack(lb, 0, 0, 1, 1) lb.show() en = Entry(self, single_line=True, scrollable=True, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) en.callback_changed_user_add(lambda e: \ setattr(self.save_url_btn, 'disabled', False)) tb.pack(en, 1, 0, 1, 1) en.show() self.url_entry = en # fetch lb = Label(self, text='Fetch', size_hint_align=(0.0,0.5)) tb.pack(lb, 0, 1, 1, 1) lb.show() en = Entry(self, single_line=True, scrollable=True, editable=False, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) tb.pack(en, 1, 1, 1, 1) en.show() self.fetch_entry = en # save button bt = Button(self, text='Save', disabled=True, size_hint_expand=EXPAND_VERT, size_hint_fill=FILL_VERT) bt.callback_clicked_add(self._save_url_clicked_cb) tb.pack(bt, 2, 0, 1, 1) bt.show() self.save_url_btn = bt # big info entry en = Entry(panes, scrollable=True, editable=False, line_wrap=ELM_WRAP_NONE, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) en.callback_clicked_add(self._info_clicked_cb) tb.pack(en, 0, 2, 3, 1) en.show() self.info_entry = en ### buttons bar hbox = Box(box, horizontal=True, size_hint_expand=EXPAND_HORIZ, size_hint_fill=FILL_BOTH) box.pack_end(hbox) hbox.show() bt = Button(hbox, text='Add') bt.callback_clicked_add(lambda b: RemoteAddPopup(self, self.app.repo)) hbox.pack_end(bt) bt.show() bt = Button(hbox, text='Remove') bt.callback_clicked_add(self._remove_btn_cb) hbox.pack_end(bt) bt.show() bt = Button(hbox, text='Refresh') bt.callback_clicked_add(lambda b: self.restart_dialog()) hbox.pack_end(bt) bt.show() sep = Separator(hbox, size_hint_expand=EXPAND_HORIZ) hbox.pack_end(sep) bt = Button(hbox, text='Close') bt.callback_clicked_add(lambda b: self.delete()) hbox.pack_end(bt) bt.show() # populate and show the dialog window self.restart_dialog() self.show()
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)
def __init__(self, parent, app): self.app = app DialogWindow.__init__(self, parent, 'Egitu-tags', 'Tags', size=(350,350), autodel=True) # main vertical box (inside a padding frame) vbox = Box(self, padding=(0, 6), size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) fr = Frame(self, style='pad_medium', size_hint_weight=EXPAND_BOTH) self.resize_object_add(fr) fr.content = vbox fr.show() vbox.show() # title en = Entry(self, editable=False, single_line=True, text='<title>%s</title>' % 'Tags', size_hint_expand=EXPAND_HORIZ) vbox.pack_end(en) en.show() # tag list self.itc = GenlistItemClass(item_style='one_icon', text_get_func=self._gl_text_get, content_get_func=self._gl_content_get) li = Genlist(self, homogeneous=True, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) li.callback_selected_add(self._list_selected_cb) vbox.pack_end(li) li.show() self.tags_list = li # buttons hbox = Box(self, horizontal=True, size_hint_expand=EXPAND_HORIZ, size_hint_fill=FILL_BOTH) vbox.pack_end(hbox) hbox.show() bt = Button(self, text='Create', content=Icon(self, standard='git-tag')) bt.callback_clicked_add(lambda b: CreateTagPopup(self, self.app)) hbox.pack_end(bt) bt.show() bt = Button(self, text='Delete', content=Icon(self, standard='user-trash')) bt.callback_clicked_add(self._delete_clicked_cb) hbox.pack_end(bt) bt.show() self.delete_btn = bt bt = Button(self, text='Checkout') bt.callback_clicked_add(self._checkout_clicked_cb) hbox.pack_end(bt) bt.show() self.checkout_btn = bt sep = Separator(self, size_hint_expand=EXPAND_HORIZ) hbox.pack_end(sep) bt = Button(self, text='Close') bt.callback_clicked_add(lambda b: self.delete()) hbox.pack_end(bt) bt.show() # self.populate() self.show()
def __init__(self, parent, app, target=None): self.app = app self._selected_item = None DialogWindow.__init__(self, parent, 'Egitu-compare', 'Compare tool', size=(500,500), autodel=True) # main vertical box (inside a padding frame) vbox = Box(self, padding=(0, 6), size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) fr = Frame(self, style='pad_medium', size_hint_expand=EXPAND_BOTH) self.resize_object_add(fr) fr.content = vbox fr.show() vbox.show() # two combos hbox = Box(self, horizontal=True, padding=(6,0), size_hint_expand=EXPAND_HORIZ, size_hint_fill=FILL_HORIZ) vbox.pack_end(hbox) hbox.show() cb1 = ComboBox(self, text=app.repo.status.current_branch.name) cb1.icon = SafeIcon(cb1, 'git-branch') cb1.callback_selected_add(lambda c: self.compare()) hbox.pack_end(cb1) cb1.show() self.base_combo = cb1 lb = Label(self, text='<b>...</b>', size_hint_align=(0.5,1.0)) hbox.pack_end(lb) lb.show() cb2 = ComboBox(self, text=target or app.repo.status.current_branch.name) cb2.icon = SafeIcon(cb1, 'git-branch') cb2.callback_selected_add(lambda c: self.compare()) hbox.pack_end(cb2) cb2.show() self.compare_combo = cb2 for branch in app.repo.branches: cb1.item_append(branch.name, 'git-branch') cb2.item_append(branch.name, 'git-branch') for branch in app.repo.remote_branches: cb1.item_append(branch, 'git-branch') cb2.item_append(branch, 'git-branch') for tag in app.repo.tags: cb1.item_append(tag.name, 'git-tag') cb2.item_append(tag.name, 'git-tag') # vertical panes panes = Panes(self, horizontal=True, content_left_size=0.25, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) vbox.pack_end(panes) panes.show() # commit list (inside a frame) li = CommitsList(panes, select_mode=ELM_OBJECT_SELECT_MODE_ALWAYS) li.callback_selected_add(self._list_selected_cb) li.show() self.commits_list = li fr = Frame(panes, content=li) panes.part_content_set('left', fr) fr.show() self.commits_frame = fr # diff de = DiffedEntry(panes) panes.part_content_set('right', de) de.show() self.diff_entry = de # buttons hbox = Box(self, horizontal=True, size_hint_expand=EXPAND_HORIZ, size_hint_fill=FILL_BOTH) vbox.pack_end(hbox) hbox.show() bt = Button(self, text='Merge', content=SafeIcon(self, 'git-merge')) bt.callback_clicked_add(lambda b: MergeBranchPopup(self, self.app, self.compare_combo.text)) hbox.pack_end(bt) bt.show() self.merge_btn = bt lb = Entry(self, single_line=True, editable=False) hbox.pack_end(lb) lb.show() self.merge_label = lb sep = Separator(self, size_hint_expand=EXPAND_HORIZ) hbox.pack_end(sep) bt = Button(self, text='Close') bt.callback_clicked_add(lambda b: self.delete()) hbox.pack_end(bt) bt.show() # self.compare() self.show()
def __init__(self, parent, app, stash=None): self.app = app self.stash = stash or app.repo.stash[0] self.idx = parseint(stash.ref) if stash else 0 DialogWindow.__init__(self, app.win, 'egitu-stash', 'stash', size=(500,500), autodel=True) # main vertical box (inside a padding frame) vbox = Box(self, padding=(0, 6), size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) fr = Frame(self, style='pad_medium', size_hint_weight=EXPAND_BOTH) self.resize_object_add(fr) fr.content = vbox fr.show() vbox.show() # header horizontal box hbox = Box(self, horizontal=True, size_hint_expand=EXPAND_HORIZ, size_hint_fill=FILL_HORIZ) vbox.pack_end(hbox) hbox.show() # title en = Entry(self, editable=False, scrollable=False, size_hint_expand=EXPAND_HORIZ, size_hint_align=(-1,0.0)) hbox.pack_end(en) en.show() self.title_entry = en # header separator sep = Separator(self) hbox.pack_end(sep) sep.show() # navigation table tb = Table(self, size_hint_align=(0.5,0.0)) hbox.pack_end(tb) tb.show() lb = Label(self) tb.pack(lb, 0, 0, 2, 1) lb.show() self.nav_label = lb ic = SafeIcon(self, 'go-previous') bt = Button(self, text='Prev', content=ic) bt.callback_clicked_add(self._prev_clicked_cb) tb.pack(bt, 0, 1, 1, 1) bt.show() self.prev_btn = bt ic = SafeIcon(self, 'go-next') bt = Button(self, text='Next', content=ic) bt.callback_clicked_add(self._next_clicked_cb) tb.pack(bt, 1, 1, 1, 1) bt.show() self.next_btn = bt # diff entry self.diff_entry = DiffedEntry(self) vbox.pack_end(self.diff_entry) self.diff_entry.show() # buttons sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_HORIZ) vbox.pack_end(sep) sep.show() hbox = Box(self, horizontal=True, size_hint_expand=EXPAND_HORIZ, size_hint_fill=FILL_BOTH) vbox.pack_end(hbox) hbox.show() bt = Button(self, text='Apply') bt.callback_clicked_add(self._apply_clicked_cb) hbox.pack_end(bt) bt.show() bt = Button(self, text='Pop (apply & delete)') bt.callback_clicked_add(self._pop_clicked_cb) hbox.pack_end(bt) bt.show() bt = Button(self, text='Branch & Delete', content=SafeIcon(self, 'git-branch')) bt.callback_clicked_add(self._branch_clicked_cb) hbox.pack_end(bt) bt.show() bt = Button(self, text='Delete', content=SafeIcon(self, 'user-trash')) bt.callback_clicked_add(self._drop_clicked_cb) hbox.pack_end(bt) bt.show() sep = Separator(self, size_hint_expand=EXPAND_HORIZ) hbox.pack_end(sep) bt = Button(self, text='Close') bt.callback_clicked_add(lambda b: self.delete()) hbox.pack_end(bt) bt.show() # request the diff and show the dialog self.update(self.idx) self.show()
def __init__(self, app): self.app = app self.selected_branch = None DialogWindow.__init__(self, app.win, 'Egitu-branches', 'Branches', size=(500,500), autodel=True) # main vertical box (inside a padding frame) vbox = Box(self, padding=(0, 6), size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) fr = Frame(self, style='pad_medium', size_hint_weight=EXPAND_BOTH) self.resize_object_add(fr) fr.content = vbox fr.show() vbox.show() # title en = Entry(self, editable=False, single_line=True, text='<title>%s</title>' % 'Local branches', size_hint_expand=EXPAND_HORIZ) vbox.pack_end(en) en.show() # list li = List(self, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) li.callback_selected_add(self._list_selected_cb) vbox.pack_end(li) li.show() self.branches_list = li # buttons hbox = Box(self, horizontal=True, size_hint_expand=EXPAND_HORIZ, size_hint_fill=FILL_BOTH) vbox.pack_end(hbox) hbox.show() ic = SafeIcon(self, 'git-branch') bt = Button(self, text='Create', content=ic) bt.callback_clicked_add(lambda b: CreateBranchPopup(self, app)) hbox.pack_end(bt) bt.show() ic = SafeIcon(self, 'user-trash') bt = Button(self, text='Delete', content=ic) bt.callback_clicked_add(lambda b: DeleteBranchPopup(self, self.app, self.selected_branch)) hbox.pack_end(bt) bt.show() self.delete_btn = bt ic = SafeIcon(self, 'git-merge') bt = Button(self, text='Merge', content=ic) bt.callback_clicked_add(lambda b: MergeBranchPopup(self, app, self.selected_branch.name)) hbox.pack_end(bt) bt.show() self.merge_btn = bt ic = SafeIcon(self, 'git-compare') bt = Button(self, text='Compare & Merge', content=ic) bt.callback_clicked_add(lambda b: \ self.app.action_compare(target=self.selected_branch.name)) hbox.pack_end(bt) bt.show() self.merge_btn2 = bt sep = Separator(self, size_hint_expand=EXPAND_HORIZ) hbox.pack_end(sep) bt = Button(self, text='Close') bt.callback_clicked_add(lambda b: self.delete()) hbox.pack_end(bt) bt.show() # populate the list and show the dialog self.populate() self.show()
def __init__(self, parent): DialogWindow.__init__(self, parent, 'epack-info', 'Epack', autodel=True) fr = Frame(self, style='pad_large', size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.resize_object_add(fr) fr.show() hbox = Box(self, horizontal=True, padding=(12, 12)) fr.content = hbox hbox.show() vbox = Box(self, align=(0.0, 0.0), padding=(6, 6), size_hint_weight=EXPAND_VERT, size_hint_align=FILL_VERT) hbox.pack_end(vbox) vbox.show() # icon + version ic = SafeIcon(self, 'epack', size_hint_min=(64, 64)) vbox.pack_end(ic) ic.show() lb = Label(self, text=_('Version: %s') % __version__) vbox.pack_end(lb) lb.show() sep = Separator(self, horizontal=True) vbox.pack_end(sep) sep.show() # buttons bt = Button(self, text=_('Epack'), size_hint_align=FILL_HORIZ) bt.callback_clicked_add(lambda b: self.entry.text_set(utils.INFO)) vbox.pack_end(bt) bt.show() bt = Button(self, text=_('Website'), size_hint_align=FILL_HORIZ) bt.callback_clicked_add(lambda b: utils.xdg_open(utils.GITHUB)) vbox.pack_end(bt) bt.show() bt = 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 = 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 = Entry(self, editable=False, scrollable=True, text=utils.INFO, size_hint_weight=EXPAND_BOTH, size_hint_align=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()