def __init__(self, win, url=None): Popup.__init__(self, win) self.win = win # title self.part_text_set('title,text', 'Recent Repositories') ic = Icon(self, file=theme_resource_get('egitu.png')) self.part_content_set('title,icon', ic) # content: recent list li = List(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) li.callback_activated_add(self.recent_selected_cb) recents = recent_history_get() if recents: for recent_url in recents: path, name = os.path.split(recent_url) item = li.item_append(name) item.data['url'] = recent_url else: item = li.item_append('no recent repository') item.disabled = True li.show() # table+rect to respect min size :/ tb = Table(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) r = Rectangle(self.evas, color=(0,0,0,0), size_hint_min=(200,200), size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) tb.pack(r, 0, 0, 1, 1) tb.pack(li, 0, 0, 1, 1) self.content = tb # popup auto-list - not expand well :( # self.size_hint_weight = EXPAND_BOTH # self.size_hint_align = FILL_BOTH # self.size_hint_min = 400, 400 # self.item_append('no recent repos', None) # self.item_append('asd2', None) # self.item_append('asd2', None) # buttons bt = Button(self, text='Open') bt.callback_clicked_add(self.load_btn_cb) self.part_content_set('button1', bt) bt = Button(self, text='Clone (TODO)') bt.disabled = True self.part_content_set('button2', bt) bt = Button(self, text='Create (TODO)') bt.disabled = True self.part_content_set('button3', bt) if url is not None: self.try_to_load(url) else: self.callback_block_clicked_add(lambda p: p.delete()) self.show()
def __init__(self, parent, app, branch): self.app = app self.branch = branch Popup.__init__(self, parent) self.part_text_set("title,text", "Delete branch") self.part_content_set("title,icon", Icon(self, standard="user-trash")) # main vertical box box = Box(self) self.content = box box.show() # sep sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_BOTH) box.pack_end(sep) sep.show() # label en = Entry( self, editable=False, text="%s<br><br><hilight>%s</hilight><br>" % ("Are you sure you want to delete this branch?", branch.name), size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH, ) box.pack_end(en) en.show() # force checkbox ck = Check( self, text="Force delete (even if not fully merged)", size_hint_expand=EXPAND_BOTH, size_hint_align=(0.0, 0.5), ) box.pack_end(ck) ck.show() self.force_chk = ck # buttons sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_BOTH) box.pack_end(sep) 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="Delete branch") bt.callback_clicked_add(self._delete_btn_cb) self.part_content_set("button2", bt) bt.show() # self.show()
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()
def __init__(self, parent, title, msg): Popup.__init__(self, parent) self.part_text_set('title,text', title) self.part_text_set('default', msg) b = Button(self, text='Close') b.callback_clicked_add(lambda b: self.delete()) b.show() self.part_content_set('button1', b) self.show()
def __init__(self, parent, title=None, msg=None): Popup.__init__(self, parent) self.part_text_set('title,text', title or 'Error') if not msg: msg = 'Unknown error' self.part_text_set('default', '<align=left>'+msg+'</align>') b = Button(self, text='Close') b.callback_clicked_add(lambda b: self.delete()) b.show() self.part_content_set('button1', b) self.show()
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()
def __init__(self, ourParent, ourMsg, ourIcon=None, *args, **kwargs): Popup.__init__(self, ourParent, *args, **kwargs) self.callback_block_clicked_add(lambda obj: self.delete()) # Add a table to hold dialog image and text to Popup tb = Table(self, size_hint_weight=EXPAND_BOTH) self.part_content_set("default", tb) tb.show() # Add dialog-error Image to table need_ethumb() icon = Icon(self, thumb='True') icon.standard_set(ourIcon) # Using gksudo or sudo fails to load Image here # unless options specify using preserving their existing environment. # may also fail to load other icons but does not raise an exception # in that situation. # Works fine using eSudo as a gksudo alternative, # other alternatives not tested try: dialogImage = Image(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH, file=icon.file_get()) tb.pack(dialogImage, 0, 0, 1, 1) dialogImage.show() except RuntimeError: # An error message is displayed for this same error # when aboutWin is initialized so no need to redisplay. pass # Add dialog text to table dialogLabel = Label(self, line_wrap=ELM_WRAP_WORD, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) dialogLabel.text = ourMsg tb.pack(dialogLabel, 1, 0, 1, 1) dialogLabel.show() # Ok Button ok_btt = Button(self) ok_btt.text = "Ok" ok_btt.callback_clicked_add(lambda obj: self.delete()) ok_btt.show() # add button to popup self.part_content_set("button3", ok_btt)
def __init__(self, ourParent, ourMsg, ourIcon=None, *args, **kwargs): Popup.__init__(self, ourParent, *args, **kwargs) self.callback_block_clicked_add(lambda obj: self.delete()) # Add a table to hold dialog image and text to Popup tb = Table(self, size_hint_weight=EXPAND_BOTH) self.part_content_set("default", tb) tb.show() # Add dialog-error Image to table need_ethumb() icon = Icon(self, thumb='True') icon.standard_set(ourIcon) # Using gksudo or sudo fails to load Image here # unless options specify using preserving their existing environment. # may also fail to load other icons but does not raise an exception # in that situation. # Works fine using eSudo as a gksudo alternative, # other alternatives not tested try: dialogImage = Image(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH, file=icon.file_get()) tb.pack(dialogImage, 0, 0, 1, 1) dialogImage.show() except RuntimeError: # An error message is displayed for this same error # when aboutWin is initialized so no need to redisplay. pass # Add dialog text to table dialogLabel = Label(self, line_wrap=ELM_WRAP_WORD, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) dialogLabel.text = ourMsg tb.pack(dialogLabel, 1, 0, 1, 1) dialogLabel.show() # Ok Button ok_btt = Button(self) ok_btt.text = "Ok" ok_btt.callback_clicked_add(lambda obj: self.delete()) ok_btt.show() # add button to popup self.part_content_set("button3", ok_btt)
def __init__(self, parent, text=None, title=None): Popup.__init__(self, parent) self.part_text_set('title,text', title or 'Please wait') box = Box(self, horizontal=True, padding=(6,6)) self.content = box box.show() wheel = Progressbar(self, style='wheel', pulse_mode=True) wheel.pulse(True) box.pack_end(wheel) wheel.show() lb = Label(self, text=text or 'Operation in progress...') box.pack_end(lb) lb.show() self.show()
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()
def __init__(self, parent): Popup.__init__(self, parent) self.part_text_set("title,text", "Document is encrypted") e = self.e = Entry(self, password=True) e.part_text_set("guide", "Enter Password") self.content_set(e) e.show() okb = Button(self, text="OK") self.part_content_set("button1", okb) okb.callback_clicked_add(lambda x: self.okcb()) okb.show() canb = Button(self, text="Cancel") self.part_content_set("button2", canb) canb.callback_clicked_add(lambda x: self.delete()) canb.show() self.show()
def __init__(self, parent): Popup.__init__(self, parent) self.part_text_set("title,text", "Document is encrypted") e = self.e = Entry(self, password=True) e.part_text_set("guide", "Enter Password") self.content_set(e) e.show() okb = Button(self, text="OK") self.part_content_set("button1", okb) okb.callback_clicked_add(lambda x: self.okcb()) okb.show() canb = Button(self, text="Cancel") self.part_content_set("button2", canb) canb.callback_clicked_add(lambda x: self.delete()) canb.show() self.show()
def __init__(self, parent, title=None, msg=None, ok_cb=None): Popup.__init__(self, parent) self.part_text_set('title,text', title or 'Are you sure?') en = Entry(self, scrollable=False, editable=False, text=msg or 'Please confirm', size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) self.content = en en.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='Yes, do it!') b.callback_clicked_add(self._confirmed_cb, ok_cb) self.part_content_set('button2', b) b.show() self.show()
def __init__(self, app): self.app = app Popup.__init__(self, app.win) # title self.part_text_set('title,text', 'Recent Repositories') self.part_content_set('title,icon', SafeIcon(self, 'egitu')) # main table tb = Table(self, padding=(0,4), size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.content = tb tb.show() # sep sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_BOTH) tb.pack(sep, 0, 0, 1, 1) sep.show() # recent list itc = GenlistItemClass(item_style='no_icon', text_get_func=self._gl_text_get) li = Genlist(self, homogeneous=True, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) li.callback_selected_add(self._recent_selected_cb) recents = recent_history_get() if recents: for path in recents: li.item_append(itc, path) else: item = li.item_append(itc, None) item.disabled = True li.show() r = Rectangle(self.evas, color=(0,0,0,0), size_hint_min=(300,200), size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) tb.pack(r, 0, 1, 1, 1) tb.pack(li, 0, 1, 1, 1) # sep sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_BOTH) tb.pack(sep, 0, 2, 1, 1) sep.show() # buttons bt = Button(self, text='Close') bt.callback_clicked_add(lambda b: self.delete()) self.part_content_set('button1', bt) bt = Button(self, text='Clone') bt.callback_clicked_add(self._clone_btn_cb) self.part_content_set('button2', bt) bt = Button(self, text='Open') bt.callback_clicked_add(self._load_btn_cb) self.part_content_set('button3', bt) # self.show()
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()
def __init__(self, parent, app, branch): self.app = app self.branch = branch Popup.__init__(self, parent) self.part_text_set('title,text', 'Merge branch') self.part_content_set('title,icon', SafeIcon(self, 'git-merge')) box = Box(self) self.content = box box.show() # sep sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_BOTH) box.pack_end(sep) sep.show() # info entry text = 'We are going to merge branch:<br><hilight>%s</hilight><br><br>' \ 'into current branch:<br><hilight>%s</hilight><br><br>' \ '<info>Note:</info> No commit will be performed, ' \ 'you will need to manually commit after the merge.' % \ (self.branch, app.repo.status.current_branch.name) if not app.repo.status.is_clean: text += '<br><br><warning>Warning:</warning> The current status is not clean, ' \ 'I suggested to only merge in a clean status, or you can make a mess.' en = Entry(self, editable=False, text=text, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) box.pack_end(en) en.show() # fast forward ? rdg = Radio(self, state_value=0, text='Fast Forward when possible', size_hint_align=(0.0, 0.5)) box.pack_end(rdg) rdg.show() self.ff_rdg = rdg rd = Radio(self, state_value=1, text='Never Fast Forward', size_hint_align=(0.0, 0.5)) rd.group_add(rdg) box.pack_end(rd) rd.show() rd = Radio(self, state_value=2, text='Fast Forward Only', size_hint_align=(0.0, 0.5)) rd.group_add(rdg) box.pack_end(rd) rd.show() # sep sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_BOTH) 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() ic = SafeIcon(self, 'git-merge') bt = Button(self, text='Merge', content=ic) bt.callback_clicked_add(self._merge_clicked_cb) self.part_content_set('button2', bt) bt.show() # self.show()
def __init__(self, parent, app, branch=None): self.app = app Popup.__init__(self, parent) self.part_text_set('title,text', 'Create a new local branch') self.part_content_set('title,icon', SafeIcon(self, 'git-branch')) # main table 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() # branch name lb = Label(self, text='Branch name', size_hint_align=(0.0, 0.5)) tb.pack(lb, 0, 1, 1, 1) lb.show() en = Entry(self, single_line=True, scrollable=True, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) tb.pack(en, 1, 1, 1, 1) en.show() self.name_entry = en # branch type lb = Label(self, text='Branch type', size_hint_align=(0.0, 0.5)) tb.pack(lb, 0, 2, 1, 1) lb.show() hbox = Box(self, horizontal=True, padding=(6,0), size_hint_expand=EXPAND_BOTH, size_hint_align=(0.0, 0.5)) tb.pack(hbox, 1, 2, 1, 1) hbox.show() rdg = Radio(self, state_value=0, text='Local branch') rdg.callback_changed_add(self._type_radio_changed_cb) hbox.pack_end(rdg) rdg.show() rd = Radio(self, state_value=1, text='Tracking branch') rd.callback_changed_add(self._type_radio_changed_cb) rd.group_add(rdg) hbox.pack_end(rd) rd.show() self.type_radio = rdg # starting revision fr = Frame(self, text='Starting revision', size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) tb.pack(fr, 0, 3, 2, 1) fr.show() r = Rectangle(self.evas, size_hint_min=(300,200), size_hint_expand=EXPAND_BOTH) tb.pack(r, 0, 3, 2, 1) # TODO: use genlist to speedup population 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._revision_selected_cb) fr.content = li li.show() self.rev_list = li # sep sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_BOTH) tb.pack(sep, 0, 4, 2, 1) sep.show() # buttons hbox = Box(self, horizontal=True, size_hint_expand=EXPAND_HORIZ, size_hint_fill=FILL_BOTH) tb.pack(hbox, 0, 5, 2, 1) hbox.show() bt = Button(self, text='Close') bt.callback_clicked_add(lambda b: self.delete()) hbox.pack_end(bt) bt.show() sep = Separator(self, size_hint_expand=EXPAND_HORIZ) hbox.pack_end(sep) bt = Button(self, text='Create') bt.callback_clicked_add(self._create_clicked_cb) hbox.pack_end(bt) bt.show() # populate the revision list and show the popup self.populate() self.show() self.name_entry.focus = True
def __init__(self, parent, method): Popup.__init__(self, parent) self._method = method self._param_entry = None self._return_entry = None # title self.part_text_set('title,text', 'Method: %s()' % method.name) self.show() # content is vbox vbox = Box(parent) vbox.show() self.content = vbox # params label + entry if len(method.params) > 0: label = Label(parent) label.size_hint_align = 0.0, 0.5 label.text = 'Params: ' + method.params_str label.show() vbox.pack_end(label) en = Entry(parent) self._param_entry = en en.editable = True en.scrollable = True en.single_line = True en.entry = '' en.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND en.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL en.show() vbox.pack_end(en) sp = Separator(win) sp.horizontal = True sp.show() vbox.pack_end(sp) # returns label + entry label = Label(parent) label.size_hint_align = 0.0, 0.5 label.text = 'Returns: ' label.text += method.returns_str if method.returns_str else 'None' label.show() vbox.pack_end(label) en = Entry(parent) self._return_entry = en en.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND en.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL en.editable = False en.scrollable = True en.disabled = True en.single_line = True # TODO this is wrong, but the only way to show the entry :/ en.entry = '<br> <br> <br>' en.show() vbox.pack_end(en) # pretty print check button def pretty_output_clicked_cb(chk): options.pretty_output = chk.state ch = Check(parent) ch.size_hint_align = 0.0, 0.5 ch.text = "Prettify output (loosing type infos)" ch.state = options.pretty_output ch.callback_changed_add(pretty_output_clicked_cb) ch.show() vbox.pack_end(ch) # popup buttons btn = Button(parent) btn.text = 'Close' btn.callback_clicked_add(lambda b: self.delete()) self.part_content_set('button1', btn) btn = Button(parent) btn.text = 'Clear output' btn.callback_clicked_add(lambda b: self._return_entry.entry_set('')) self.part_content_set('button2', btn) btn = Button(parent) btn.text = 'Run method' btn.callback_clicked_add(self.run_clicked_cb) self.part_content_set('button3', btn)
def __init__(self, app): self.app = app Popup.__init__(self, app.win) self.part_text_set('title,text', 'Discard local changes') self.part_content_set('title,icon', Icon(self, standard='user-trash')) # 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_BOTH) tb.pack(sep, 0, 0, 1, 1) sep.show() # warning label en = Entry(self, editable=False, text='<warning>WARNING: This operation is not reversible!</warning><br>' \ 'Selected files (or ALL files, if nothing is selected) will be ' \ 'reverted to the state of the last commit.', size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) tb.pack(en, 0, 1, 1, 1) en.show() # changes list r = Rectangle(self.evas, size_hint_min=(300,200), size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) li = List(self, multi_select=True, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) li.callback_selected_add(self._list_selection_changed_cb) li.callback_unselected_add(self._list_selection_changed_cb) tb.pack(li, 0, 2, 1, 1) tb.pack(r, 0, 2, 1, 1) for path in sorted(self.app.repo.status.changes): mod, staged, name, new_name = self.app.repo.status.changes[path] icon = Icon(self, standard='git-mod-'+mod) check = Check(self, text='', state=staged, disabled=True) label = '{} → {}'.format(name, new_name) if new_name else name it = li.item_append(label, icon, check) it.data['mod'] = mod li.go() li.show() self.file_list = li # delete untracked check ck = Check(self, text='Also delete untracked files', state=True, size_hint_expand=EXPAND_BOTH, size_hint_align=(0.0,0.5)) tb.pack(ck, 0, 3, 1, 1) ck.show() self.untracked_chk = ck # sep sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_BOTH) tb.pack(sep, 0, 4, 1, 1) 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="Discard EVERYTHING!", content=Icon(self, standard='user-trash')) bt.callback_clicked_add(self._confirm_clicked_cb) self.part_content_set('button2', bt) bt.show() self.confirm_btn = bt # self.show()
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()
def __init__(self, parent, app, title, icon_name): self.app = app Popup.__init__(self, parent) self.part_text_set('title,text', title) self.part_content_set('title,icon', Icon(self, standard=icon_name)) # TODO padding should be (4,4) but it seems buggy for the big entry tb = Table(self, padding=(0,4), size_hint_expand=EXPAND_BOTH) self.content = tb tb.show() self.table = tb # sep sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_BOTH) tb.pack(sep, 0, 0, 2, 1) sep.show() # remote lb = Label(tb, text='Remote', size_hint_align=(0.0, 0.5)) tb.pack(lb, 0, 1, 1, 1) lb.show() cb = ComboBox(self, icon=Icon(self, standard='git-remote')) cb.callback_selected_add(self.rbranch_populate) for remote in app.repo.remotes: cb.item_append(remote.name, 'git-remote') tb.pack(cb, 1, 1, 1, 1) cb.show() self.remote_combo = cb # remote branch lb = Label(tb, text='Remote branch', size_hint_align=(0.0, 0.5)) tb.pack(lb, 0, 2, 1, 1) lb.show() cb = ComboBox(self, icon=Icon(cb, standard='git-branch')) tb.pack(cb, 1, 2, 1, 1) cb.show() self.rbranch_combo = cb # local branch lb = Label(tb, text='Local branch', size_hint_align=(0.0, 0.5)) tb.pack(lb, 0, 3, 1, 1) lb.show() en = Entry(tb, disabled=True, single_line=True, scrollable=True, text=app.repo.status.current_branch.name, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) tb.pack(en, 1, 3, 1, 1) en.show() self.lbranch_entry = en # 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_BOTH) tb.pack(sep, 0, 5, 2, 1) sep.show() # buttons 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='Action') bt.callback_clicked_add(self._action_btn_cb) self.part_content_set('button2', bt) bt.show() self.action_btn = bt self.autopopulate() self.show()
def __init__(self, parent, method): Popup.__init__(self, parent) self._method = method self._param_entry = None self._return_entry = None # title self.part_text_set('title,text', 'Method: %s()' % method.name) self.show() # content is vbox vbox = Box(parent) vbox.show() self.content = vbox # params label + entry if len(method.params) > 0: label = Label(parent) label.size_hint_align = 0.0, 0.5 label.text = 'Params: ' + method.params_str label.show() vbox.pack_end(label) en = Entry(parent) self._param_entry = en en.editable = True en.scrollable = True en.single_line = True en.entry = '' en.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND en.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL en.show() vbox.pack_end(en) sp = Separator(win) sp.horizontal = True sp.show() vbox.pack_end(sp) # returns label + entry label = Label(parent) label.size_hint_align = 0.0, 0.5 label.text = 'Returns: ' label.text += method.returns_str if method.returns_str else 'None' label.show() vbox.pack_end(label) en = Entry(parent) self._return_entry = en en.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND en.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL en.editable = False en.scrollable = True en.disabled = True en.single_line = True # TODO this is wrong, but the only way to show the entry :/ en.entry = '<br> <br> <br>' en.show() vbox.pack_end(en) # pretty print check button def pretty_output_clicked_cb(chk): options.pretty_output = chk.state ch = Check(parent) ch.size_hint_align = 0.0, 0.5 ch.text = "Prettify output (loosing type infos)" ch.state = options.pretty_output ch.callback_changed_add(pretty_output_clicked_cb) ch.show() vbox.pack_end(ch) # popup buttons btn = Button(parent) btn.text = 'Close' btn.callback_clicked_add(lambda b: self.delete()) self.part_content_set('button1', btn) btn = Button(parent) btn.text = 'Clear output' btn.callback_clicked_add(lambda b: self._return_entry.entry_set('')) self.part_content_set('button2', btn) btn = Button(parent) btn.text = 'Run method' btn.callback_clicked_add(self.run_clicked_cb) self.part_content_set('button3', btn)