def __init__(self, component_manager, port, data_dir, config_dir, filename): QtCore.QThread.__init__(self) WebServer.__init__(self, component_manager, port, data_dir, config_dir, filename) self.server_has_connection = False # A fast moving progress bar seems to cause crashes on Windows. self.show_numeric_progress_bar = (sys.platform != "win32")
def load_mnemosyne(self): # Load Mnemosyne and its database in the review server thread. self.set_progress_text(_("Remote review in progress...")) mutex.lock() # Libmnemosyne itself could also generate dialog messages, so # we temporarily override the main_widget with the threaded # routines in this class. self.component_manager.components[None]["main_widget"].append(self) self.review_started_signal.emit() if not self.server_has_connection: database_released.wait(mutex) WebServer.load_mnemosyne(self) self.server_has_connection = True mutex.unlock()
def unload_mnemosyne(self): # Close Mnemosyne and its database in the review server thread. self.close_progress() mutex.lock() server_had_connection = self.server_has_connection if self.server_has_connection: WebServer.unload_mnemosyne(self) self.server_has_connection = False database_released.wakeAll() if self in self.component_manager.components[None]["main_widget"]: self.component_manager.components[None]["main_widget"].pop() mutex.unlock() if server_had_connection: # Reload database in the main program. self.review_ended_signal.emit()