예제 #1
0
    def __reload_atlas(self) -> None:
        """Reload atlas with the engine."""
        current_pos = self.collection_list.currentRow()
        self.collections_layouts.clear()
        self.collection_list.clear()
        self.__clear_selection()
        if not self.collections:
            return

        dlg = QProgressDialog(
            "Drawing atlas...",
            "Cancel",
            0,
            len(self.collections),
            self
        )
        dlg.setWindowTitle("Type synthesis")
        dlg.resize(400, dlg.height())
        dlg.setModal(True)
        dlg.show()
        engine_str = self.graph_engine.currentText()
        for i, g in enumerate(self.collections):
            QCoreApplication.processEvents()
            if dlg.wasCanceled():
                dlg.deleteLater()
                return

            item = QListWidgetItem(f"No. {i + 1}")
            engine = engine_picker(g, engine_str, self.graph_link_as_node.isChecked())
            item.setIcon(graph2icon(
                g,
                self.collection_list.iconSize().width(),
                engine,
                self.graph_link_as_node.isChecked(),
                self.graph_show_label.isChecked(),
                self.prefer.monochrome_option
            ))
            self.collections_layouts.append(engine)
            item.setToolTip(f"{g.edges}")
            self.collection_list.addItem(item)
            dlg.setValue(i + 1)

        dlg.deleteLater()
        if current_pos > -1:
            self.collection_list.setCurrentRow(current_pos)
            self.__set_selection(self.collection_list.currentItem())
예제 #2
0
 def __check_update(self) -> None:
     """Check for update."""
     dlg = QProgressDialog("Checking update ...", "Cancel", 0, 3, self)
     dlg.setWindowTitle("Check for update")
     dlg.resize(400, dlg.height())
     dlg.setModal(True)
     dlg.show()
     url = check_update(dlg)
     dlg.deleteLater()
     if url:
         if QMessageBox.question(
                 self, "Pyslvs has update",
                 "Do you want to get it from Github?") == QMessageBox.Yes:
             self.__open_url(url)
     else:
         QMessageBox.information(
             self, "Pyslvs is up to date",
             "You are using the latest version of Pyslvs.")