Browse Source

Merge branch 'master' into feature_curaversion_appname

# Conflicts:
#	cura/CuraApplication.py
fieldOfView 6 years ago
parent
commit
056655e584
10 changed files with 84 additions and 51 deletions
  1. 0 1
      .gitignore
  2. 2 41
      Jenkinsfile
  3. 2 1
      README.md
  4. 2 0
      cmake/CuraTests.cmake
  5. 1 1
      cura.desktop.in
  6. 8 0
      cura.sharedmimeinfo
  7. 11 4
      cura/API/Account.py
  8. 3 3
      cura/API/Backups.py
  9. 50 0
      cura/ApplicationMetadata.py
  10. 5 0
      cura/Arranging/Arrange.py

+ 0 - 1
.gitignore

@@ -42,7 +42,6 @@ plugins/cura-siemensnx-plugin
 plugins/CuraBlenderPlugin
 plugins/CuraCloudPlugin
 plugins/CuraDrivePlugin
-plugins/CuraDrive
 plugins/CuraLiveScriptingPlugin
 plugins/CuraOpenSCADPlugin
 plugins/CuraPrintProfileCreator

+ 2 - 41
Jenkinsfile

@@ -38,20 +38,9 @@ parallel_nodes(['linux && cura', 'windows && cura'])
                 {
                     if (isUnix())
                     {
-                        // For Linux to show everything
-                        def branch = env.BRANCH_NAME
-                        if(!fileExists("${env.CURA_ENVIRONMENT_PATH}/${branch}"))
-                        {
-                            branch = "master"
-                        }
-                        def uranium_dir = get_workspace_dir("Ultimaker/Uranium/${branch}")
-
+                        // For Linux
                         try {
-                            sh """
-                                cd ..
-                                export PYTHONPATH=.:"${uranium_dir}"
-                                ${env.CURA_ENVIRONMENT_PATH}/${branch}/bin/pytest -x --verbose --full-trace --capture=no ./tests
-                            """
+                            sh 'make CTEST_OUTPUT_ON_FAILURE=TRUE test'
                         } catch(e)
                         {
                             currentBuild.result = "UNSTABLE"
@@ -70,34 +59,6 @@ parallel_nodes(['linux && cura', 'windows && cura'])
                         }
                     }
                 }
-
-                stage('Code Style')
-                {
-                    if (isUnix())
-                    {
-                        // For Linux to show everything.
-                        // CMake also runs this test, but if it fails then the test just shows "failed" without details of what exactly failed.
-                        def branch = env.BRANCH_NAME
-                        if(!fileExists("${env.CURA_ENVIRONMENT_PATH}/${branch}"))
-                        {
-                            branch = "master"
-                        }
-                        def uranium_dir = get_workspace_dir("Ultimaker/Uranium/${branch}")
-
-                        try
-                        {
-                            sh """
-                                cd ..
-                                export PYTHONPATH=.:"${uranium_dir}"
-                                ${env.CURA_ENVIRONMENT_PATH}/${branch}/bin/python3 run_mypy.py
-                            """
-                        }
-                        catch(e)
-                        {
-                            currentBuild.result = "UNSTABLE"
-                        }
-                    }
-                }
             }
         }
 

+ 2 - 1
README.md

@@ -20,8 +20,9 @@ Dependencies
 ------------
 * [Uranium](https://github.com/Ultimaker/Uranium) Cura is built on top of the Uranium framework.
 * [CuraEngine](https://github.com/Ultimaker/CuraEngine) This will be needed at runtime to perform the actual slicing.
+* [fdm_materials](https://github.com/Ultimaker/fdm_materials) Required to load a printer that has swappable material profiles.
 * [PySerial](https://github.com/pyserial/pyserial) Only required for USB printing support.
-* [python-zeroconf](https://github.com/jstasiak/python-zeroconf) Only required to detect mDNS-enabled printers
+* [python-zeroconf](https://github.com/jstasiak/python-zeroconf) Only required to detect mDNS-enabled printers.
 
 Build scripts
 -------------

+ 2 - 0
cmake/CuraTests.cmake

@@ -6,6 +6,8 @@ include(CMakeParseArguments)
 
 find_package(PythonInterp 3.5.0 REQUIRED)
 
+add_custom_target(test-verbose COMMAND ${CMAKE_CTEST_COMMAND} --verbose)
+
 function(cura_add_test)
     set(_single_args NAME DIRECTORY PYTHONPATH)
     cmake_parse_arguments("" "" "${_single_args}" "" ${ARGN})

+ 1 - 1
cura.desktop.in

@@ -13,6 +13,6 @@ TryExec=@CMAKE_INSTALL_FULL_BINDIR@/cura
 Icon=cura-icon
 Terminal=false
 Type=Application
-MimeType=model/stl;application/vnd.ms-3mfdocument;application/prs.wavefront-obj;image/bmp;image/gif;image/jpeg;image/png;model/x3d+xml;
+MimeType=model/stl;application/vnd.ms-3mfdocument;application/prs.wavefront-obj;image/bmp;image/gif;image/jpeg;image/png;model/x3d+xml;text/x-gcode;
 Categories=Graphics;
 Keywords=3D;Printing;Slicer;

+ 8 - 0
cura.sharedmimeinfo

@@ -19,4 +19,12 @@
         <glob-deleteall/>
         <glob pattern="*.obj"/>
     </mime-type>
+    <mime-type type="text/x-gcode">
+        <sub-class-of type="text/plain"/>
+        <comment>Gcode file</comment>
+        <icon name="unknown"/>
+        <glob-deleteall/>
+        <glob pattern="*.gcode"/>
+        <glob pattern="*.g"/>
+    </mime-type>
 </mime-info>

+ 11 - 4
cura/API/Account.py

@@ -6,6 +6,7 @@ from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot, pyqtProperty
 
 from UM.i18n import i18nCatalog
 from UM.Message import Message
+from cura import UltimakerCloudAuthentication
 
 from cura.OAuth2.AuthorizationService import AuthorizationService
 from cura.OAuth2.Models import OAuth2Settings
@@ -37,15 +38,16 @@ class Account(QObject):
         self._logged_in = False
 
         self._callback_port = 32118
-        self._oauth_root = "https://account.ultimaker.com"
-        self._cloud_api_root = "https://api.ultimaker.com"
+        self._oauth_root = UltimakerCloudAuthentication.CuraCloudAccountAPIRoot
 
         self._oauth_settings = OAuth2Settings(
             OAUTH_SERVER_URL= self._oauth_root,
             CALLBACK_PORT=self._callback_port,
             CALLBACK_URL="http://localhost:{}/callback".format(self._callback_port),
-            CLIENT_ID="um---------------ultimaker_cura_drive_plugin",
-            CLIENT_SCOPES="account.user.read drive.backup.read drive.backup.write packages.download packages.rating.read packages.rating.write",
+            CLIENT_ID="um----------------------------ultimaker_cura",
+            CLIENT_SCOPES="account.user.read drive.backup.read drive.backup.write packages.download "
+                          "packages.rating.read packages.rating.write connect.cluster.read connect.cluster.write "
+                          "cura.printjob.read cura.printjob.write cura.mesh.read cura.mesh.write",
             AUTH_DATA_PREFERENCE_KEY="general/ultimaker_auth_data",
             AUTH_SUCCESS_REDIRECT="{}/app/auth-success".format(self._oauth_root),
             AUTH_FAILED_REDIRECT="{}/app/auth-error".format(self._oauth_root)
@@ -60,6 +62,11 @@ class Account(QObject):
         self._authorization_service.onAuthenticationError.connect(self._onLoginStateChanged)
         self._authorization_service.loadAuthDataFromPreferences()
 
+    ## Returns a boolean indicating whether the given authentication is applied against staging or not.
+    @property
+    def is_staging(self) -> bool:
+        return "staging" in self._oauth_root
+
     @pyqtProperty(bool, notify=loginStateChanged)
     def isLoggedIn(self) -> bool:
         return self._logged_in

+ 3 - 3
cura/API/Backups.py

@@ -1,6 +1,6 @@
 # Copyright (c) 2018 Ultimaker B.V.
 # Cura is released under the terms of the LGPLv3 or higher.
-from typing import Tuple, Optional, TYPE_CHECKING
+from typing import Tuple, Optional, TYPE_CHECKING, Dict, Any
 
 from cura.Backups.BackupsManager import BackupsManager
 
@@ -24,12 +24,12 @@ class Backups:
     ##  Create a new back-up using the BackupsManager.
     #   \return Tuple containing a ZIP file with the back-up data and a dict
     #   with metadata about the back-up.
-    def createBackup(self) -> Tuple[Optional[bytes], Optional[dict]]:
+    def createBackup(self) -> Tuple[Optional[bytes], Optional[Dict[str, Any]]]:
         return self.manager.createBackup()
 
     ##  Restore a back-up using the BackupsManager.
     #   \param zip_file A ZIP file containing the actual back-up data.
     #   \param meta_data Some metadata needed for restoring a back-up, like the
     #   Cura version number.
-    def restoreBackup(self, zip_file: bytes, meta_data: dict) -> None:
+    def restoreBackup(self, zip_file: bytes, meta_data: Dict[str, Any]) -> None:
         return self.manager.restoreBackup(zip_file, meta_data)

+ 50 - 0
cura/ApplicationMetadata.py

@@ -0,0 +1,50 @@
+# Copyright (c) 2018 Ultimaker B.V.
+# Cura is released under the terms of the LGPLv3 or higher.
+
+# ---------
+# Genearl constants used in Cura
+# ---------
+DEFAUKT_CURA_APP_NAME = "cura"
+DEFAULT_CURA_DISPLAY_NAME = "Ultimaker Cura"
+DEFAULT_CURA_VERSION = "master"
+DEFAULT_CURA_BUILD_TYPE = ""
+DEFAULT_CURA_DEBUG_MODE = False
+DEFAULT_CURA_SDK_VERSION = "6.0.0"
+
+try:
+    from cura.CuraVersion import CuraAppName  # type: ignore
+    if CuraAppName == "":
+        CuraAppName = DEFAULT_CURA_APP_NAME
+except ImportError:
+    CuraAppName = DEFAULT_CURA_APP_NAME
+
+try:
+    from cura.CuraVersion import CuraAppDisplayName  # type: ignore
+    if CuraAppDisplayName == "":
+        CuraAppDisplayName = DEFAULT_CURA_DISPLAY_NAME
+except ImportError:
+    CuraAppDisplayName = DEFAULT_CURA_DISPLAY_NAME
+
+try:
+    from cura.CuraVersion import CuraVersion  # type: ignore
+    if CuraVersion == "":
+        CuraVersion = DEFAULT_CURA_VERSION
+except ImportError:
+    CuraVersion = DEFAULT_CURA_VERSION  # [CodeStyle: Reflecting imported value]
+
+try:
+    from cura.CuraVersion import CuraBuildType  # type: ignore
+except ImportError:
+    CuraBuildType = DEFAULT_CURA_BUILD_TYPE
+
+try:
+    from cura.CuraVersion import CuraDebugMode  # type: ignore
+except ImportError:
+    CuraDebugMode = DEFAULT_CURA_DEBUG_MODE
+
+try:
+    from cura.CuraVersion import CuraSDKVersion  # type: ignore
+    if CuraSDKVersion == "":
+        CuraSDKVersion = DEFAULT_CURA_SDK_VERSION
+except ImportError:
+    CuraSDKVersion = DEFAULT_CURA_SDK_VERSION

+ 5 - 0
cura/Arranging/Arrange.py

@@ -66,6 +66,11 @@ class Arrange:
                 continue
             vertices = vertices.getMinkowskiHull(Polygon.approximatedCircle(min_offset))
             points = copy.deepcopy(vertices._points)
+
+            # After scaling (like up to 0.1 mm) the node might not have points
+            if len(points) == 0:
+                continue
+
             shape_arr = ShapeArray.fromPolygon(points, scale = scale)
             arranger.place(0, 0, shape_arr)
 

Some files were not shown because too many files changed in this diff