def __delete__(self): self._isClosing = True IconProvider.instance().saveIconsToDatabase() # Wait for all QtConcurrent jobs to finish QThreadPool.globalInstance().waitForDone() # Delete all classes that are saving data in destructor self._bookmarks = None self._cookieJar = None Settings.syncSettings()
def pushButton_4_Click(self): self.close_mpl() self.replot_now() V1 = self.coin_dict['toss_coin1'] V2 = self.coin_dict['toss_coin2'] D = np.hstack((V1, V2)) D.tolist().sort() k1 = choice(D) #隨機選2個不重複的中心k1, k2 k2 = choice(D) while (k1 == k2): k2 = choice(D) do_k_means = Run_k_means(D, k1, k2) #把 D, k1, k2 傳入多線程 do_k_means.res.callback_signal.connect( self.show_k_means_result) #回傳值連接func後續處理 QThreadPool.globalInstance().start(do_k_means) #執行多線程
def pushButton_3_Click(self): filename = self.ui.lineEdit_2.text() res = np.load(filename, allow_pickle=True) np_all_img = res['np_all_img'] wb_all_img = res['wb_all_img'] np_all_t = res['np_all_t'] wb_all_t = res['wb_all_t'] '''原始方法RXD多線程''' do_originalRXD = Run_OriginalRXD(np_all_img, np_all_t) # 傳變數給多線程 do_originalRXD.res.callback_signal.connect( self.drawOriginalRXD) # 將回傳的變數連結給函式處理 QThreadPool.globalInstance().start(do_originalRXD) # 多線程開始工作 '''Woodbury方法RXD多線程''' do_woodburyRXD = Run_WoodburyRXD(wb_all_img, wb_all_t) # 傳變數給多線程 do_woodburyRXD.res.callback_signal.connect( self.drawWoodburyRXD) # 將回傳的變數連結給函式處理 QThreadPool.globalInstance().start(do_woodburyRXD) # 多線程開始工作
def __init__(self, parent=None): super().__init__(parent) self._subService = OpenSubService() self._encService = EncodingService() self._token = None self._threadPool = QThreadPool.globalInstance() self._initUi() self._restoreWindowSettings()