Пример #1
0
 def apply(self):
     """
     This button launches a solve, but can also be used to cancel a solve.
     """
     running_state = lib_state.get_solver_is_running_state()
     if running_state is True:
         # Cancel out of a running solve if the user presses
         # the button again.
         lib_state.set_solver_user_interrupt_state(True)
         return
     undo_id = 'mmSolver: '
     undo_id += str(datetime.datetime.isoformat(datetime.datetime.now()))
     undo_id += ' '
     undo_id += str(uuid.uuid4())
     with undo_utils.undo_chunk_context(undo_id):
         block = self.blockSignals(True)
         try:
             mmapi.set_solver_running(True)
             options = lib_collection.gather_execute_options()
             log_level = lib_state.get_log_level()
             col = lib_state.get_active_collection()
             lib_collection.run_solve_ui(col, options, log_level, self)
         finally:
             mmapi.set_solver_running(False)
             self.blockSignals(block)
     return
Пример #2
0
 def closeEvent(self, event):
     # Cancel out of a running solve, before closing the UI.
     running_state = lib_state.get_solver_is_running_state()
     if running_state is True:
         lib_state.set_solver_user_interrupt_state(True)
     super(SolverWindow, self).closeEvent(event)
     return
Пример #3
0
 def apply(self):
     """
     This button launches a solve, but can also be used to cancel a solve.
     """
     running_state = lib_state.get_solver_is_running_state()
     if running_state is True:
         # Cancel out of a running solve if the user presses
         # the button again.
         lib_state.set_solver_user_interrupt_state(True)
         return
     undo_id = 'mmSolver: '
     undo_id += str(datetime.datetime.isoformat(datetime.datetime.now()))
     undo_id += ' '
     undo_id += str(uuid.uuid4())
     with tools_utils.tool_context(use_undo_chunk=True,
                                   undo_chunk_name=undo_id,
                                   restore_current_frame=False,
                                   pre_update_frame=False,
                                   post_update_frame=False,
                                   use_dg_evaluation_mode=True,
                                   disable_viewport=False):
         block = self.blockSignals(True)
         try:
             mmapi.set_solver_running(True)
             options = lib_collection.gather_execute_options()
             log_level = lib_state.get_log_level()
             col = lib_state.get_active_collection()
             lib_collection.run_solve_ui(col, options, log_level, self)
         finally:
             mmapi.set_solver_running(False)
             self.blockSignals(block)
     return
Пример #4
0
 def apply(self):
     """
     Tbis button launches a solve, but can also be used to cancel a solve.
     """
     undo_id = 'mmSolver: ' + str(uuid.uuid4())
     with undo_utils.undo_chunk(undo_id):
         running_state = lib_state.get_solver_is_running_state()
         if running_state is True:
             lib_state.set_solver_user_interrupt_state(True)
             return
         refresh_state = lib_state.get_refresh_viewport_state()
         force_update_state = lib_state.get_force_dg_update_state()
         do_isolate_state = lib_state.get_isolate_object_while_solving_state(
         )
         image_plane_state = lib_state.get_display_image_plane_while_solving_state(
         )
         log_level = lib_state.get_log_level()
         col = lib_state.get_active_collection()
         lib_collection.run_solve_ui(col, refresh_state, force_update_state,
                                     do_isolate_state, image_plane_state,
                                     log_level, self)
     return