Ultimaker / Cura

3D printer / slicing GUI built on top of the Uranium framework
GNU Lesser General Public License v3.0
6.1k stars 2.06k forks source link

Cura 5 won't open files #12266

Closed VK1IAN closed 11 months ago

VK1IAN commented 2 years ago

Application Version

5.0.0

Platform

Ubuntu 20.04

Printer

Cocoon Create

Reproduction steps

  1. Cura opens fine. I can change print settings and work my way through the menus. I can also configure Cura (Preferences->Configure Cura).
  2. When I click the folder at top left (to open a file), nothing happens.
  3. If I try it via File->Open File(s), nothing happens.
  4. I can drag a STL onto the print bed, set up the parameters and slice, but then I can't save the resulting gcode to disk.
  5. "Save to removable media" does work.

Actual results

"Open File(s)" dialog box doesn't appear. After I've dragged a STL onto the print bed and sliced, nothing happens when I click "Save to Disk" (i.e "save to disk" dialog box does not appear).

Expected results

File dialog box should appear to allow me to open files or select the destination for a gcode file.

Checklist of files to include

Additional information & file uploads

cura.log

Vandresc commented 2 years ago

Hi, @VK1IAN any chance you are using Debian 11?

VK1IAN commented 2 years ago

Hi, @VK1IAN any chance you are using Debian 11?

Ubuntu 20.04 (in a VirtualBox VM)

Vandresc commented 2 years ago

Devs see CURA-9348 for our internal reference.

akshimassar commented 2 years ago

The same thing happens for me. I'm using arch linux with AppImage

akshimassar commented 2 years ago

That seems to be problem with opening "open" dialog. I successfully opened file from Open Recent menu.

akshimassar commented 2 years ago
PyInstaller/loader/pyimod03_importers.py:495: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses
Cyclic dependency detected between "file:///tmp/.mount_cura5RySS4x/share/cura/resources/qml/Actions.qml" and "file:///tmp/.mount_cura5RySS4x/share/cura/resources/qml/Actions.qml"
QQmlEngine::setContextForObject(): Object already has a QQmlContext
akshimassar commented 2 years ago

Corresponding action ( I guess) from Actions.qml

    Action
    {
        id: openAction
        property var fileProviderModel: CuraApplication.getFileProviderModel()

        text: catalog.i18nc("@action:inmenu menubar:file","&Open File(s)...")
        icon.name: "document-open"
        // Unassign the shortcut when there are more than one file providers, since then the file provider's shortcut is
        // enabled instead, and Ctrl+O is assigned to the local file provider
        shortcut: fileProviderModel.count == 1 ? StandardKey.Open : ""
    }

Is there anything I can do to help debugging?

akshimassar commented 2 years ago

Save project file dialog won't open as well.

lf94 commented 2 years ago

This issue needs severity critical.

Claghorn commented 2 years ago

Same problem on fedora 36. Running in a terminal shows this stuff: PyInstaller/loader/pyimod03_importers.py:495: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses Cyclic dependency detected between "file:///tmp/.mount_UltimaVg8T4R/share/cura/resources/qml/Actions.qml" and "file:///tmp/.mount_UltimaVg8T4R/share/cura/resources/qml/Actions.qml" QQmlEngine::setContextForObject(): Object already has a QQmlContext qt.qml.context: file:///tmp/.mount_UltimaVg8T4R/share/cura/resources/qml/Settings/SettingView.qml:427:16 Parameter "index" is not declared. Injection of parameters into signal handlers is deprecated. Use JavaScript functions with formal parameters instead.

akshimassar commented 2 years ago

Is there any workaroud for that issue? I would like to use cura 5 but for now I can't

minego commented 2 years ago

You can drag a file onto cura to open it

On Mon, Jun 6, 2022, at 12:54 PM, Alexander wrote:

Is there any workaroud for that issue? I would like to use cura 5 but for now I can't

— Reply to this email directly, view it on GitHub https://github.com/Ultimaker/Cura/issues/12266#issuecomment-1147779472, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADSRCBB5VTLUYLAUIRSHXDVNZCODANCNFSM5WNVOSNA. You are receiving this because you are subscribed to this thread.Message ID: @.***>

akshimassar commented 2 years ago

What about saving resulting g-code? None of the system dialogs of this kind work.

You can drag a file onto cura to open it

minego commented 2 years ago

I use octoprint so I haven't needed to save it

On Mon, Jun 6, 2022, at 1:58 PM, Alexander wrote:

What about saving resulting g-code? None of the system dialogs of this kind work.

You can drag a file onto cura to open it

— Reply to this email directly, view it on GitHub https://github.com/Ultimaker/Cura/issues/12266#issuecomment-1147855912, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADSRCB47EVCEHHONN5FTSTVNZJ6BANCNFSM5WNVOSNA. You are receiving this because you are subscribed to this thread.Message ID: @.***>

akshimassar commented 2 years ago

Here is the error from corresponding cura.log file

2022-06-06 23:19:03,545 - WARNING - [MainThread] UM.Qt.QtApplication.__onQmlWarning [431]: file:///home/akshi/appimage/squashfs-root/share/cura/resources/qml/Cura.qml:629:5: QML FileDialog: Failed to load non-native FileDialog implementation:
qrc:/qt-project.org/imports/QtQuick/Dialogs/quickimpl/qml/FileDialog.qml:37 module "Qt.labs.folderlistmodel" is not installed
akshimassar commented 2 years ago

I've tried installing following packages python-pyqt5 qt5-declarative qt5-quickcontrols (to provide folderlist module) and the error from log is gone but open / save dialogs are still not working.

alexban01 commented 2 years ago

What about saving resulting g-code?

save it to removable and then move it wherever you want. Annoying I know, hope they fix it soon. This is the reason why I'm still on 4.13.1 where I get like 8 error messages telling me the plugins fail

Goodfeat commented 2 years ago

In windows 10 about the same problem, only writes an opening error In general, I noticed that if the file is saved in binary format, then it opens, if left in ACSII, then the cura 5 refuses to open it

2022-06-07 12:48:03,397 - INFO - [MainThread] cura.CuraApplication.readLocalFile [1751]: Attempting to read file file:///G:/Desktop/Кольцо.STL 2022-06-07 12:48:03,399 - INFO - [JobQueueWorker [7]] STLReader.STLReader.load_file [61]: Using legacy code to load STL data. 2022-06-07 12:48:03,400 - DEBUG - [JobQueueWorker [7]] STLReader.STLReader._read [102]: File did not contain valid data, unable to read. 2022-06-07 12:48:03,400 - ERROR - [JobQueueWorker [7]] UM.FileHandler.ReadFileJob.run [80]: Exception: Exception occurred while loading file G:/Desktop/Кольцо.STL 2022-06-07 12:48:03,401 - ERROR - [JobQueueWorker [7]] UM.FileHandler.ReadFileJob.run [80]: Traceback (most recent call last): 2022-06-07 12:48:03,401 - ERROR - [JobQueueWorker [7]] UM.FileHandler.ReadFileJob.run [80]: File "UM\FileHandler\ReadFileJob.py", line 78, in run 2022-06-07 12:48:03,401 - ERROR - [JobQueueWorker [7]] UM.FileHandler.ReadFileJob.run [80]: self.setResult(self._handler.readerRead(reader, self._filename)) 2022-06-07 12:48:03,402 - ERROR - [JobQueueWorker [7]] UM.FileHandler.ReadFileJob.run [80]: File "UM\Mesh\MeshFileHandler.py", line 36, in readerRead 2022-06-07 12:48:03,402 - ERROR - [JobQueueWorker [7]] UM.FileHandler.ReadFileJob.run [80]: results = reader.read(file_name) 2022-06-07 12:48:03,402 - ERROR - [JobQueueWorker [7]] UM.FileHandler.ReadFileJob.run [80]: File "UM\Mesh\MeshReader.py", line 36, in read 2022-06-07 12:48:03,402 - ERROR - [JobQueueWorker [7]] UM.FileHandler.ReadFileJob.run [80]: if mesh.source_mime_type is None: 2022-06-07 12:48:03,403 - ERROR - [JobQueueWorker [7]] UM.FileHandler.ReadFileJob.run [80]: AttributeError: 'NoneType' object has no attribute 'source_mime_type' 2022-06-07 12:48:03,403 - DEBUG - [JobQueueWorker [7]] UM.FileHandler.ReadFileJob.run [83]: Loading file took 0.0 seconds 2022-06-07 12:48:03,412 - DEBUG - [MainThread] UM.Operations.OperationStack.push [72]: GroupedOp.(#=0), took 0ms

nallath commented 2 years ago

I've tried installing following packages python-pyqt5 qt5-declarative qt5-quickcontrols (to provide folderlist module) and the error from log is gone but open / save dialogs are still not working.

That won't work or matter. Cura 5.0.0 uses qt6, not qt5.

akshimassar commented 2 years ago

Sorry for bothering, but how can we get updated version? I can only see 5.0.0 available at the main page Sorry, I wrongly assumed that this bug is closed, however it was a linked one.

nallath commented 2 years ago

Sorry for bothering, but how can we get updated version? I can only see 5.0.0 available at the main page

Updated version? Of what? Cura 5.0.0 is the latest version that we released.

Claghorn commented 2 years ago

At least I found a handy command line program on github named "dragon" which allows me to feed it a filename on the command line then drag that file into cura. About 10,000 times faster than bringing up an annoying GUI file manager and agonizingly navigating to the directory containing the file I want to drag. It does look like I can print directly to octoprint after slicing, so except when I want to edit gcode, I can probably use 5.0 now. Looks like I could download the gcode from octoprint, edit it, then re-upload as a round about way to do that as well.

minego commented 2 years ago

Link? That sounds useful.

On 6/7/22 08:55, Claghorn wrote:

At least I found a handy command line program on github named "dragon" which allows me to feed it a filename on the command line then drag that file into cura. About 10,000 times faster than bringing up an annoying GUI file manager and agonizingly navigating to the directory containing the file I want to drag. It does look like I can print directly to octoprint after slicing, so except when I want to edit gcode, I can probably use 5.0 now. Looks like I could download the gcode from octoprint, edit it, then re-upload as a round about way to do that as well.

— Reply to this email directly, view it on GitHub https://github.com/Ultimaker/Cura/issues/12266#issuecomment-1148787068, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADSRCDJWXB4RAON6NZMGJDVN5PH7ANCNFSM5WNVOSNA. You are receiving this because you are subscribed to this thread.Message ID: @.***>

Claghorn commented 2 years ago

dragon tool:

https://github.com/mwh/dragon/releases/tag/v1.2.0

rmsc commented 2 years ago

That won't work or matter. Cura 5.0.0 uses qt6, not qt5.

Is qt6 being statically linked? I didn't have qt6 installed, and installing all of it changed nothing.

rmsc commented 2 years ago

BTW, a simple workaround is opening the file from the command line:

$ cura yourfile.stl

fieldOfView commented 2 years ago

Qt6 is not statically linked, but the AppImage includes Qt6 (and all of the other dependencies) and uses that.

jellespijker commented 2 years ago

Not opening the filedialog due to the folder list lib not being part of PyQt6-Qt6 was circumvented by us settings the QT_QPA_PLATFORMTHEME in the AppRun script.

https://github.com/Ultimaker/Cura/issues/11874#issuecomment-1109757093

This seems to have mixed results. For my personal Laptop with Manjaro KDE I finally got the system filedialogs, @Ghostkeeper and @nallath reported quicker opening of their dialogs, but other Linux systems seems to break with this.

@nallath maybe we should allow for an user defined argument to be passed along here. So at least people can set the value that works for them.

akshimassar commented 2 years ago

Since you mentioned a line with xdgdesktoportal I was finally able to figure it out for myself. Installing xdg-desktop-portal (xdg-desktop-portal-gtk implementation for me) fixed the issue for me. I never used flatpak and thus xdg desktop portal was never part of my system. Note: I had to run dbus-update-activation-environment --systemd DBUS_SESSION_BUS_ADDRESS DISPLAY XAUTHORITY once after installing to prevent slow startup of applications and to make it work without restarting dbus.

I also tried some random values for QT_QPA_PLATFORMTHEME in AppRun file like gtk2, qt5ct and qt6ct but none worked for me except xdgdesktopportal. I'm using arch linux with awesome desktop manager.

ethanak commented 2 years ago

Works for me! Thank you! XUbuntu 20.04

chipmunk1977 commented 2 years ago

Just downloaded the 5.1 Beta on Ubuntu 20.04 and the issue persists. The workarounds still function, but something as basic as opening and saving a file should be fairly high up the list of priorities!

qcol commented 2 years ago

mee too, 5.1 beta - still can't open / save files

torrancew commented 2 years ago

I'm also experiencing this issue on ArchLinux with the Cura5 AppImage. Unlike @akshimassar, I have been unable to resolve it (I already have the XDG portal packages installed as I do use some flatpak-distributed things).

I think this problem may be related to the interaction AppImages have with the host system, possibly (reference: https://github.com/AppImage/AppImageKit/wiki/Similar-projects#general -- Row "Using libraries and dependencies"), but have little experience with AppImages themselves, and am not sure how best to debug/chase that idea down.

Is there any plan/intention to eventually package Cura5 as a flatpak? If so, I'd gladly test my (quite possibly incorrect) theory out.

jellespijker commented 2 years ago

@torrancew I think your issues with the AppImage relate to #11856 .

Can you please try the latest-Linux AppImage from the link I posted at the end of that thread. And to keep things a bit organized continue the discussion for that specific problem in that thread.

torrancew commented 2 years ago

@jellespijker Happy to do so -- but just want to note that I can launch Cura5, it's only the File Open dialog that isn't working for me. Will report back in on #11856.

madnificent commented 2 years ago

I have executed the following steps on Arch linux with the custom build mentioned in #11856 . Based on https://github.com/Ultimaker/Cura/issues/12266#issuecomment-1170370529 of @akshimassar

yay -S xdg-desktop-portal xdg-desktop-portal-gtk
dbus-update-activation-environment --systemd DBUS_SESSION_BUS_ADDRESS DISPLAY XAUTHORITY

This gives me the file open dialog through the UI. It did not work when installing only xdg-desktop-portal-gtk.

Thanks for figuring out how to make it work on Arch Linux and kudos to the development team on answering the avalanche of questions that seem to pop up here. People (including me) are really eager to test-drive Cura 5 XD

Ghostkeeper commented 2 years ago

Since you mentioned a line with xdgdesktoportal I was finally able to figure it out for myself. Installing xdg-desktop-portal (xdg-desktop-portal-gtk implementation for me) fixed the issue for me. I never used flatpak and thus xdg desktop portal was never part of my system. Note: I had to run dbus-update-activation-environment --systemd DBUS_SESSION_BUS_ADDRESS DISPLAY XAUTHORITY once after installing to prevent slow startup of applications and to make it work without restarting dbus.

I also tried some random values for QT_QPA_PLATFORMTHEME in AppRun file like gtk2, qt5ct and qt6ct but none worked for me except xdgdesktopportal. I'm using arch linux with awesome desktop manager.

Could I have some clarification on this workaround, @akshimassar ? Or someone else that tried it. Currently in the application's AppRun script it already sets export QT_QPA_PLATFORMTHEME=xdgdesktopportal. So then the only change that you did for this workaround is to install that xdg-desktop-portal package?

I'm making some improvements to include the xdg-desktop-portal package in the build server so that it hopefully picks that along as a dependency inside of the application.

torrancew commented 2 years ago

@Ghostkeeper The reported workarounds so far aren't solving the issue for me (Arch Linux/i3WM). I suspect there's still some undocumented piece here.

mwiercinski commented 2 years ago

Still the case with 5.1.0-beta.

This is crippling main user journeys with no workarounds and has been in the backlog for 2 months.

Ghostkeeper commented 2 years ago

Note that a workaround is still to drag the file onto the main window. And several other workarounds are mentioned in this thread too.

I think there are multiple issues intersecting here, so I'm trying to fix one at a time.

Ghostkeeper commented 2 years ago

If changing the QT_QPA_PLATFORMTHEME variable worked for one of you, could you please share the output of echo ${XDG_CURRENT_DESKTOP}?

rmsc commented 2 years ago

@Ghostkeeper The reported workarounds so far aren't solving the issue for me (Arch Linux/i3WM). I suspect there's still some undocumented piece here.

Is the xdg-desktop-portal.service user service started and enabled? At least in my case I had to do that after installing the required packages:

$ systemctl start --user xdg-desktop-portal
$ systemctl enable --user xdg-desktop-portal
torrancew commented 2 years ago

@rmsc Thanks for the suggestion! I hadn't noticed the mention of the service previously.

Enabling it does not resolve the issue, though (tried with xdg-desktop-portal and xdg-desktop-portal-gtk):

❯ systemctl status xdg-desktop-portal-gtk.service
● xdg-desktop-portal-gtk.service - Portal service (GTK/GNOME implementation)
     Loaded: loaded (/usr/lib/systemd/user/xdg-desktop-portal-gtk.service; static)
     Active: active (running) since Fri 2022-07-15 10:01:03 PDT; 3h 27min ago
   Main PID: 1375217 (xdg-desktop-por)
      Tasks: 4 (limit: 76967)
     Memory: 5.6M
        CPU: 158ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/xdg-desktop-portal-gtk.service
             └─1375217 /usr/lib/xdg-desktop-portal-gtk

Jul 15 10:01:03 somehost systemd[992]: Starting Portal service (GTK/GNOME implementation)...
Jul 15 10:01:03 somehost systemd[992]: Started Portal service (GTK/GNOME implementation).

~
❯

Is there any chance that there are implicit dependencies around a GNOME/KDE session that are involved here? My i3 session is pretty lightweight, and is likely missing several things that are standard in the "main" desktop environments (I do not run a provider for the Secret Service API as one [unrelated] example, and I'm sure there are other nuances I'm not aware of and not running providers for).

torrancew commented 2 years ago

@rmsc After a little digging, I was able to get this working. Some notes I took for @Ghostkeeper et al:

I'm going to look into filing a bug with xdg-desktop-portal upstream about what I encountered there. In the meantime, a concrete ask for the Ultimaker folks: Since this systemd unit is configured (at least in Arch) as a dbus unit and provides no [Install] section, can Cura do something to trigger its launch, so that users don't have to manually start or patch this unit file?

torrancew commented 2 years ago

After a bit more poking, I believe that this service is being auto-started (when installed) just fine, and that my previous issues with xdg-desktop-portal-wlr were masking that fact. @Ghostkeeper based on that, I believe that, if xdg-desktop-portal is functioning correctly on a machine, adding that package to the build process should resolve this issue (and obviously, fixing broken xdg-desktop-portal installs for individual users is not Ultimaker's responsibility)

akshimassar commented 2 years ago

Could I have some clarification on this workaround, @akshimassar ?

I would be happy to help debugging. Although I have no experience with qt or dbus. Basically I installed xdg-desktop-portal and xdg-desktop-portal-gtk.

Arch package for xdg-desktop-portal depends on xdg-desktop-portal-impl which is virtual package and requires one of the following:

sudo pacman -S xdg-desktop-portal
resolving dependencies...
:: There are 5 providers available for xdg-desktop-portal-impl:
:: Repository extra
   1) xdg-desktop-portal-gnome  2) xdg-desktop-portal-gtk  3) xdg-desktop-portal-kde
:: Repository community
   4) xdg-desktop-portal-lxqt  5) xdg-desktop-portal-wlr

After that I think I ran dbus-update-activation-environment --systemd DBUS_SESSION_BUS_ADDRESS DISPLAY XAUTHORITY that came out somewhere in the slow startup bug reported to xdg-desktop-portal. I still have the problem with initial slow startup but since I rarely reboot, it doesn't bother me.

Now I have both binaries xdg-desktop-portal and xdg-desktop-portal-gtk running under my user started about the time of last reboot.

chipmunk1977 commented 2 years ago

Not sure if this is a coincidence, or whether it has actually been fixed - but everything now works as expected after upgrading to 5.1 stable. (However, my OS was also updated today to Ubuntu Studio 22.04LTS with the Plasma desktop. If it hasn't been fixed, then maybe the OS update info will help.)

mwiercinski commented 2 years ago

Installing xdg-desktop-portal{,-gtk} fixed the issue. Reproducible both on 5.0.0 and 5.1.0.

ethanak commented 2 years ago

It is not real fix - Cura should suggest file name and folder for saving, but with xdg-desktop filename field is empty, and folder is rather random. Both Cura 5.0 and 5.1, XUbuntu 20.04.

jellespijker commented 2 years ago

It is indeed not a fix, but a work around. We currently don't know how best to fix this bug and take into account all the different desktop and graphical managers.

We investigated shipping the xdg-desktop-*** in the AppImage but that is actually a system library and something like that is bad practice for a reason.

We plan on writing a support article to explain the current work around, to a broader audience then all you tech-savy people with a GitHub account.

We will ofcourse continue our investigation in a "real" fix for future release. But to temper the expectations a bit this will probably not be fixed for 5.2 except if we receive an external pull request. Which I sincerely hope to receive because my personal laptop also experience this issue.