Lines Matching refs:self

46     def __init__(self, *args, ui: 'UI', **kwargs):
48 self.ui = ui
50 def keypress(self, size: int, key: str) -> typing.Optional[str]:
54 asyncio.ensure_future(self.ui.update())
56 self.ui.add()
68 def __init__(self, ui: 'UI', commit: 'core.Commit'):
71 self.ui = ui
72 self.commit = commit
74 async def apply(self) -> None:
75 async with self.ui.git_lock:
76 result, err = await self.commit.apply(self.ui)
78 self.ui.chp_failed(self, err)
80 self.ui.remove_commit(self)
82 async def denominate(self) -> None:
83 async with self.ui.git_lock:
84 await self.commit.denominate(self.ui)
85 self.ui.remove_commit(self)
87 async def backport(self) -> None:
88 async with self.ui.git_lock:
89 await self.commit.backport(self.ui)
90 self.ui.remove_commit(self)
92 def keypress(self, size: int, key: str) -> typing.Optional[str]:
94 asyncio.ensure_future(self.apply())
96 asyncio.ensure_future(self.denominate())
98 asyncio.ensure_future(self.backport())
125 def _make_body(self) -> 'urwid.Columns':
126 commits = urwid.ListBox(self.commit_list)
127 feedback = urwid.ListBox(self.feedback_box)
130 def _make_footer(self) -> 'urwid.Columns':
141 def _make_root(self) -> 'RootWidget':
142 return RootWidget(self.body, self.header, self.footer, 'body', ui=self)
144 def render(self) -> 'WidgetType':
145 asyncio.ensure_future(self.update())
146 return self.root
148 def load(self) -> None:
149 self.previous_commits = core.load()
151 async def update(self) -> None:
152 self.load()
155 if self.previous_commits:
156 sha = self.previous_commits[0].sha
164 o = self.mainloop.widget
165 self.mainloop.widget = urwid.Overlay(
167 self.new_commits = await core.gather_commits(
168 version, self.previous_commits, new_commits,
170 self.mainloop.widget = o
172 for commit in reversed(list(itertools.chain(self.new_commits, self.previous_commits))):
174 b = urwid.AttrMap(CommitWidget(self, commit), None, focus_map='reversed')
175 self.commit_list.append(b)
176 self.save()
178 async def feedback(self, text: str) -> None:
179 self.feedback_box.append(urwid.AttrMap(urwid.Text(text), None))
180 latest_item_index = len(self.feedback_box) - 1
181 self.feedback_box.set_focus(latest_item_index)
183 def remove_commit(self, commit: CommitWidget) -> None:
184 for i, c in enumerate(self.commit_list):
186 del self.commit_list[i]
189 def save(self):
190 core.save(itertools.chain(self.new_commits, self.previous_commits))
192 def add(self) -> None:
194 o = self.mainloop.widget
197 self.mainloop.widget = o
207 for c in reversed(list(itertools.chain(self.new_commits, self.previous_commits))):
214 await commit.apply(self)
228 self.mainloop.widget = urwid.Overlay(
232 def chp_failed(self, commit: 'CommitWidget', err: str) -> None:
233 o = self.mainloop.widget
236 self.mainloop.widget = o
249 can_btn, 'click', lambda _: asyncio.ensure_future(commit.commit.abort_cherry(self, err)))
254 ok_btn, 'click', lambda _: asyncio.ensure_future(commit.commit.resolve(self)))
256 ok_btn, 'click', lambda _: self.remove_commit(commit))
262 self.mainloop.widget = urwid.Overlay(