mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-18 20:28:01 -06:00
WIP: Add Welcome Page and use CTRL+Alt+D to trigger
This commit is contained in:
parent
3b63f92d55
commit
ac012e8f09
5 changed files with 91 additions and 0 deletions
45
cura/UI/WelcomePagesModel.py
Normal file
45
cura/UI/WelcomePagesModel.py
Normal file
|
@ -0,0 +1,45 @@
|
|||
|
||||
|
||||
import os
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
|
||||
from PyQt5.QtCore import QUrl, Qt
|
||||
|
||||
from UM.Qt.ListModel import ListModel
|
||||
from UM.Resources import Resources
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from PyQt5.QtCore import QObject
|
||||
|
||||
|
||||
class WelcomePagesModel(ListModel):
|
||||
|
||||
IdRole = Qt.UserRole + 1 # Page ID
|
||||
PageUrlRole = Qt.UserRole + 2 # URL to the page's QML file
|
||||
NextPageIdRole = Qt.UserRole + 3 # The next page ID it should go to
|
||||
|
||||
def __init__(self, parent: Optional["QObject"] = None) -> None:
|
||||
super().__init__(parent)
|
||||
|
||||
self.addRoleName(self.IdRole, "id")
|
||||
self.addRoleName(self.PageUrlRole, "page_url")
|
||||
self.addRoleName(self.NextPageIdRole, "next_page_id")
|
||||
|
||||
self._pages = []
|
||||
|
||||
def initialize(self) -> None:
|
||||
from cura.CuraApplication import CuraApplication
|
||||
# Add default welcome pages
|
||||
self._pages.append({"id": "welcome",
|
||||
"page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles,
|
||||
os.path.join("WelcomePages", "WelcomeContent.qml"))),
|
||||
}
|
||||
)
|
||||
|
||||
self.setItems(self._pages)
|
||||
|
||||
def addPage(self):
|
||||
pass
|
||||
|
||||
|
||||
__all__ = ["WelcomePagesModel"]
|
Loading…
Add table
Add a link
Reference in a new issue