def collect_versions(self):
        self.layouts.clear()
        root_folder = self.settings.value('root_folder')
        dirs = next(os.walk(root_folder))[1]
        versions = []

        for dir in dirs:
            if os.path.isfile(os.path.join(root_folder, dir, "blender.exe")):
                versions.append(dir)

        for ver in versions:
            b3d_item_layout = B3dItemLayout(root_folder, ver, False, self)
            self.layouts.append(b3d_item_layout)
    def collect_versions(self):
        self.layouts.clear()
        root_folder = self.settings.value('root_folder')
        dirs = next(os.walk(root_folder))[1]
        versions = []

        if self.platform == 'Windows':
            blender_exe = "blender.exe"
        elif self.platform == 'Linux':
            blender_exe = "blender"

        for dir in dirs:
            if os.path.isfile(os.path.join(root_folder, dir, blender_exe)):
                versions.append(dir)

        for ver in versions:
            b3d_item_layout = B3dItemLayout(root_folder, ver, False, self)
            self.layouts.append(b3d_item_layout)
    def finished(self, version):
        self.build_loader.terminate()
        self.build_loader.wait()

        self.btnSetRootFolder.show()
        self.set_task_visible(False)
        self.is_update_running = False

        if version:
            root_folder = self.settings.value('root_folder')
            b3d_item_layout = B3dItemLayout(root_folder, version, True, self)
            self.layouts.append(b3d_item_layout)

            self.tray_icon.showMessage("Blender Version Manager",
                                       "Update finished!",
                                       QSystemTrayIcon.Information, 4000)

        self.draw_list_versions()
        self.set_progress_bar(0, 0, "")
        self.start_uptodate_thread()
Beispiel #4
0
    def draw_list_versions(self):
        versions = self.collect_versions()
        self.cleanup_layout(self.layoutListVersions)
        root_folder = self.settings.value('root_folder')

        if versions:
            self.blender_action.setVisible(True)
            self.latest_local = versions[0]

            for ver in versions:
                is_latest = True if ver == self.latest_local else False
                b3d_item_layout = B3dItemLayout(
                    root_folder, ver, is_latest, self)
                self.layoutListVersions.addLayout(b3d_item_layout)
        else:
            self.latest_local = None
            label = QLabel("No Local Versions Found!")
            label.setStyleSheet("color: white; font-size: 10pt;")
            label.setAlignment(Qt.AlignCenter)
            label.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
            self.layoutListVersions.addWidget(label)
            self.blender_action.setVisible(False)