(self, title, style, call, progress, errMsgLbl=None)
| 913 | progress=progress) |
| 914 | |
| 915 | def handleProgress(self, title, style, call, progress, errMsgLbl=None): |
| 916 | extraArgs = {} |
| 917 | if progress.maximum is not None: |
| 918 | extraArgs['maximum'] = progress.maximum |
| 919 | with wx.ProgressDialog( |
| 920 | parent=self, |
| 921 | title=title, |
| 922 | message=progress.message, |
| 923 | style=style, |
| 924 | **extraArgs |
| 925 | ) as dlg: |
| 926 | func, args, kwargs = call |
| 927 | func(*args, **kwargs) |
| 928 | while progress.working: |
| 929 | wx.MilliSleep(250) |
| 930 | wx.Yield() |
| 931 | (progress.dlgWorking, skip) = dlg.Update(progress.current, progress.message) |
| 932 | if progress.error and errMsgLbl: |
| 933 | with wx.MessageDialog( |
| 934 | self, |
| 935 | _t("The following error was generated") + |
| 936 | f"\n\n{progress.error}\n\n" + |
| 937 | _t("Be aware that already processed fits were not saved"), |
| 938 | errMsgLbl, wx.OK | wx.ICON_ERROR |
| 939 | ) as dlg: |
| 940 | dlg.ShowModal() |
| 941 | elif progress.callback: |
| 942 | progress.callback(*progress.cbArgs) |
| 943 | |
| 944 | def _openAfterImport(self, fits): |
| 945 | if len(fits) > 0: |
no test coverage detected