Script_Maya.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:3D_Software_and_Python 作者: p4vv37 项目源码 文件源码
def run(self, text, function, path=None):
        """
        Run the script: create the scene. It can run step-by-step and stop after every part or run every function
        one after another. The function also measures an execution time of commands and updates the UI elements.

        :param text: string - Name of the current step that will be displayed in the UI and scores table.
        :param function: function() - Function that will be run.
        :param path: string - Additional parameter: path that can be passed to the function as parameter:
                              required by some functions.
        """

        self.target_label.setText(text)  # Update the label of UI
        if path is None:  # If no path was passed as argument, then do not pass this variable to target function
            ts = time.time()  # Start measuring time
            function()  # Execute the function passed as an argument
        else:
            ts = time.time()
            function(path)  # if path was passed then pass it to the target function
        te = time.time()  # Record the ending time of command
        score = [text, te - ts]  # Measure the interval
        self.scores_list.append(score)  # append the

        try:
            self.target_list.addItem(QtGui.QListWidgetItem(str(score)))  # Add measured time to scores list in UI
        except:
            print("Some problem with UI occurred")
            pass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号