| 15 | pub.subscribe(stepmacros, 'stepmacros') |
| 16 | |
| 17 | class Macros: |
| 18 | def __init__(self, title, cmds): |
| 19 | self.title = title |
| 20 | self.cmds = cmds |
| 21 | |
| 22 | def _next(self, callafter=None): |
| 23 | if self.cur==len(self.cmds): |
| 24 | if self.callafter!=None: |
| 25 | self.callafter() |
| 26 | return |
| 27 | if len(self.cmds[self.cur])<3 or self.cmds[self.cur][0] == '#': |
| 28 | self.cur += 1 |
| 29 | return self._next(callafter) |
| 30 | title, para = self.cmds[self.cur].split('>') |
| 31 | self.cur += 1 |
| 32 | plg = PluginsManager.get(title)() |
| 33 | plg.start(eval(para), self.next) |
| 34 | |
| 35 | def next(self): |
| 36 | if IPy.uimode() == 'no': |
| 37 | self._next(self) |
| 38 | else: wx.CallAfter(pub.sendMessage, 'stepmacros', plg=self) |
| 39 | |
| 40 | def run(self):self.next() |
| 41 | #IPy.run_macros(self.cmds) |
| 42 | |
| 43 | def __call__(self): |
| 44 | return self |
| 45 | |
| 46 | def start(self, para=None, callafter=None): |
| 47 | self.callafter = callafter |
| 48 | self.cur = 0 |
| 49 | self.run() |
| 50 | |
| 51 | def show_mc(data, title): |
| 52 | wx.CallAfter(Macros(title, data).start) |
no outgoing calls
no test coverage detected