BATS.py 文件源码

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

项目:BATS-Bayesian-Adaptive-Trial-Simulator 作者: ContaTP 项目源码 文件源码
def setCallbackPlot(self, filedir):

        self.plot_file = {}
        # Delete previous widgets
        for root, dir, files in os.walk(filedir):

            for file in files:

                if file.endswith(".png"):

                    filename = file.rsplit(".", 1)[0]
                    root_index = root.rsplit("/", 1)[1]
                    if root_index in self.plot_file:

                        if file != "ui.png":

                            self.plot_file[root_index].append(root + "/" + file)

                    else:

                        self.plot_file[root_index] = [root + "/ui.png"]
                        if file != "ui.png":

                            self.plot_file[root_index].append(root + "/" + file)

        row_pos = col_pos = 0

        for root_index in range(0, len(list(self.plot_file.keys()))):

            row_pos = int(root_index/2)
            col_pos = root_index % 2
            root_name = list(self.plot_file.keys())[root_index]
            currentfile = self.plot_file[root_name][0]
            plot_frame = SubGraphViewer(self, root_name, currentfile)
            self.plotViewer.addWidget(plot_frame, row_pos, col_pos, QtCore.Qt.AlignTop)

        # self.plotViewer.addItem(QtWidgets.QSpacerItem(20, 60, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding), row_pos + 1, 0)
        # self.graph_comboBox.setCurrentIndex(-1)
        self.exportPlot_flag = -1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号