| 158 | if IPy.uimode()!='ipy': self.Fit() |
| 159 | |
| 160 | def hold(self): |
| 161 | dire = 1 |
| 162 | while True: |
| 163 | try: |
| 164 | if time == None: break |
| 165 | time.sleep(0.05) |
| 166 | tasks = TaskManager.get() |
| 167 | if(len(tasks)==0): |
| 168 | if self.pro_bar.IsShown(): |
| 169 | wx.CallAfter(self.set_progress, -1) |
| 170 | continue |
| 171 | arr = [i.prgs for i in tasks] |
| 172 | if (None, 1) in arr: |
| 173 | if self.pro_bar.GetValue()<=0: |
| 174 | dire = 1 |
| 175 | if self.pro_bar.GetValue()>=100: |
| 176 | dire = -1 |
| 177 | v = self.pro_bar.GetValue()+dire*5 |
| 178 | wx.CallAfter(self.set_progress, v) |
| 179 | else: |
| 180 | v = max([(i[0]+1)*100.0/i[1] for i in arr]) |
| 181 | wx.CallAfter(self.set_progress, v) |
| 182 | except: |
| 183 | pass |
| 184 | def set_info(self, value): |
| 185 | self.txt_info.SetLabel(value) |
| 186 | |