gjwgit / rattleng

The New Generation R Analytics Desktop App
GNU General Public License v3.0
19 stars 8 forks source link

IMAGE PAGE: SAVE needs good default filename but fails on Ubuntu #395

Open gjwgit opened 1 week ago

gjwgit commented 1 week ago

20240909 Title updated - focus is becoming the failure of file_picker on Ubuntu, both with inconsistent provision of default filename, missing filter, and exception when zenity is not installed. It assumes either zenity, kdialog, qarma is externally installed. Not the case for Mint (okay for Ubuntu).

Perhaps fork file_picker and find a solution?

Description

The image save/export functionality should provide a default filename in the filechooser popup as we see below. Currently Name is empty. It should be the same as the filename in the temp folder (e.g., model_random_forest_varimp.svg). The user can then choose to use this name or to change the name and then tap OK.

Also, instead of Custom Files it should be SVG files down the bottom right.

Image

Lutra-Fs commented 1 week ago

Description

The image save/export functionality should provide a default filename in the filechooser popup as we see below. Currently Name is empty. It should be the same as the filename in the temp folder (e.g., model_random_forest_varimp.svg). The user can then choose to use this name or to change the name and then tap OK.

Also, instead of Custom Files it should be SVG files down the bottom right.

Image

I believe there are no such settings to set the custom file type description instead of Custom files. I think we have already supplied the supported extension as svg so if we do not add anything it will add .svg to the end of the file name.

Lutra-Fs commented 1 week ago

Also I see your comments on 04/06:

// TODO 20240604 gjw THE DEFAULT FILE NAME, TILE, ETC DOES NOT APPEAR IN THE // DIALOG ON LINUX. COULD BE A PACKAGE BUG? SHOULD REPORT IF SO.

Lutra-Fs commented 1 week ago

Maybe GNOME related.

Lutra-Fs commented 1 week ago

See https://github.com/miguelpruivo/flutter_file_picker/issues/956

gjwgit commented 1 week ago

Seems to be issue with using file_picker.

See miguelpruivo/flutter_file_picker#1451 We also may need to add zenity as an optional dependency to provide save function

On Lab Linux:

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Exception: Couldn't find the executable zenity in the path.
#0      isExecutableOnPath (package:file_picker/src/utils.dart:60)
<asynchronous suspension>
#1      FilePickerLinux._getPathToExecutable (package:file_picker/src/linux/file_picker_linux.dart:127)
<asynchronous suspension>
#2      FilePickerLinux.saveFile (package:file_picker/src/linux/file_picker_linux.dart:91)
<asynchronous suspension>
#3      selectFile (package:rattle/utils/select_file.dart:36)
<asynchronous suspension>
#4      ImagePage.build.<anonymous closure>.<anonymous closure> (package:rattle/widgets/image_page.dart:165)
<asynchronous suspension>

** (rattle:2109544): WARNING **: 20:26:43.615: Attempted to set message handler on an FlBinaryMessenger without an engine

** (rattle:2109544): WARNING **: 20:26:43.615: Attempted to set message handler on an FlBinaryMessenger without an engine

On local linux (Ubunut 24.04 and Gnome) SAVE from SCRIPT works and includes default filename but SAVE for IMAGE PAGE does not provide default filename for me, though does for Lutra.

gjwgit commented 1 week ago

We could revert to simply asking for a filename in a text field popup until this issue is resolved, perhaps upstream if that's where the problem is?

https://github.com/miguelpruivo/flutter_file_picker/issues/956https://github.com/miguelpruivo/flutter_file_picker/issues/956

We may not be able to ask the end user to install zenity.

Notice also that zenity --file-selection --filename="abc.x" --save --file-filter=abx does not add abc.x as the default filename but does list abx as the filter

image

If this is only an issue for Ubuntu, we'll park this for now and keep it using file_picker in general, and perhaps test for Linux if zenity is found and if not revert to simple text field propter.

gjwgit commented 1 week ago

The file_picker package on Linux will choose one of qarma, kdialog, or zenity, in that order, as the CLI for a file chooser and so runs system (i.e., Process.run in dart parlance) to have a native looking file chooser.

qarma

sudo snap install qarma
sudo snap remove qarma

The dialog is slow starting up - probably time out withthe permission problem below (both LOAD and SAVE).

The file picker for FILENAME in DATASET fails with a permission issue:

image

The default filename is shown just fine:

image

kdialog

DATASET FILENAME works as expected with the filter as CSV/TXT files.

image

SAVE for IMAGE PAGE works exactly as expected - the filename is populated correctly and the filter is SVG files.

image

zenity

The file pciker for FILENAME in DATASET works just fine:

image

The SAVE for IMAGE PAGE does not show the default filename but otherwise works just fine with the user needing to provide the filename.

image

gjwgit commented 1 week ago

CONCLUSION: kdialog works as expected, and if installed on Ubuntu is preferred over zenity and has the general Gnomw look-and-fell, so let's go with kdialog for now for file_picker.

Made note of this on https://github.com/miguelpruivo/flutter_file_picker/issues/1451

I would also propose we look at the file_picker source, review lib/src/linux/ with file_picker_linux.dart as the entry point, to attempt to debug the issue, then contribute any fix back to file_picker.

Lutra-Fs commented 1 week ago

Is the zenity problem on Lab Machine? I have 2 Linux installations Arch with KDE on a physical machine and Arch with Weston and gtk4 through WSL where both don't have the issue. I attached the screenshot with pure zenity on gtk4 which could intercept the name correctly in the Pull Request. If it is replicable using lab machine I can do some testing next week/ Regards, Bo

Lutra-Fs commented 1 week ago

Certainly using XDG file choose protocol is good to see

gjwgit commented 1 week ago

XDG file choose protocol is good

Wasn't clear if that is there now?

gjwgit commented 1 week ago

Is the zenity problem on Lab Machine? I have 2 Linux installations Arch with KDE on a physical machine and Arch with Weston and gtk4 through WSL where both don't have the issue. I attached the screenshot with pure zenity on gtk4 which could intercept the name correctly in the Pull Request. If it is replicable using lab machine I can do some testing next week/ Regards, Bo

Yes. It's a simple install of Mint - not sure if zenity was purposely removed but it's not there now.

gjwgit commented 1 week ago

I just tested with a binary of kdialog on the Linux Lab machines and it works.

Lutra-Fs commented 1 week ago

Hi Graham,

I tried a fresh installation of Linux Mint in my virtual machine with the version listed at the end of the comment, and I see the correct behaviour with zenity --file-selection --filename="abc.x" --save --file-filter=abx image in yaru theme (should be the default one on Ubuntu): image

Would you mind sharing with me some detailed info, like the application theme? BTW, for the qarma issue, have you tried the traditional installation method (using apt, without snap sandbox)? Sandboxing is good, but it is a little bit like a hell for personal end-users/

Yes. It's a simple install of Mint - not sure if zenity was purposely removed but it's not there now.

So zenity is not on lab machine? I am not sure if I have the permission to debug as a student then/

Regards, Bo

P.S.

System:
  Kernel: 6.8.0-41-generic arch: x86_64 bits: 64 compiler: gcc v: 13.2.0 clocksource: tsc
  Desktop: Cinnamon v: 6.2.9 tk: GTK v: 3.24.41 wm: Muffin v: 6.2.0 vt: 7 dm: LightDM v: 1.30.0
    Distro: Linux Mint 22 Wilma base: Ubuntu 24.04 noble
Machine:
  Type: Vmware System: VMware product: VMware Virtual Platform v: N/A serial: <superuser required>
    Chassis: No Enclosure type: 1 serial: <superuser required>
  Mobo: Intel model: 440BX Desktop Reference Platform serial: <superuser required>
    uuid: <superuser required> BIOS: Phoenix v: 6.00 date: 11/12/2020
CPU:
  Info: 2x 1-core model: Intel Core i7-10700KF bits: 64 type: SMP smt: <unsupported>
    arch: Comet Lake rev: 5 cache: L1: 2x 64 KiB (128 KiB) L2: 2x 256 KiB (512 KiB)
    L3: 2x 16 MiB (32 MiB)
  Speed (MHz): avg: 3792 min/max: N/A cores: 1: 3792 2: 3792 bogomips: 15167
  Flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3
Graphics:
  Device-1: VMware SVGA II Adapter driver: vmwgfx v: 2.20.0.0 ports: active: Virtual-1
    empty: Virtual-2, Virtual-3, Virtual-4, Virtual-5, Virtual-6, Virtual-7, Virtual-8
    bus-ID: 00:0f.0 chip-ID: 15ad:0405 class-ID: 0300
  Display: x11 server: X.Org v: 21.1.11 with: Xwayland v: 23.2.6 driver: X: loaded: vmware
    unloaded: fbdev,modesetting,vesa dri: vmwgfx gpu: vmwgfx display-ID: :0 screens: 1
  Screen-1: 0 s-res: 1280x800 s-dpi: 96 s-size: 338x211mm (13.31x8.31") s-diag: 398mm (15.69")
  Monitor-1: Virtual-1 mapped: Virtual1 res: 1280x800 hz: 60 size: N/A modes: max: 1280x800
    min: 640x480
  API: EGL v: 1.5 platforms: device: 0 egl: 1.4 drv: vmwgfx device: 1 drv: swrast gbm: egl: 1.4
    drv: vmwgfx surfaceless: egl: 1.4 drv: vmwgfx x11: egl: 1.4 drv: vmwgfx inactive: wayland
  API: OpenGL v: 4.5 compat-v: 4.3 vendor: vmware mesa v: 24.0.9-0ubuntu0.1 glx-v: 1.4
    direct-render: yes renderer: SVGA3D; build: RELEASE; LLVM; device-ID: 15ad:0405
Audio:
  Device-1: Ensoniq ES1371/ES1373 / Creative Labs CT2518 driver: snd_ens1371 v: kernel
    bus-ID: 02:02.0 chip-ID: 1274:1371 class-ID: 0401
  API: ALSA v: k6.8.0-41-generic status: kernel-api
  Server-1: PipeWire v: 1.0.5 status: active with: 1: pipewire-pulse status: active
    2: wireplumber status: active 3: pipewire-alsa type: plugin
Network:
  Device-1: Intel 82371AB/EB/MB PIIX4 ACPI vendor: VMware Virtual Machine type: network bridge
    driver: N/A port: N/A bus-ID: 00:07.3 chip-ID: 8086:7113 class-ID: 0680
  Device-2: Intel 82545EM Gigabit Ethernet vendor: VMware PRO/1000 MT Single Port driver: e1000
    v: kernel port: 2000 bus-ID: 02:01.0 chip-ID: 8086:100f class-ID: 0200
  IF: ens33 state: up speed: 1000 Mbps duplex: full mac: <filter>
Drives:
  Local Storage: total: 20 GiB used: 17.71 GiB (88.5%)
  ID-1: /dev/sda vendor: VMware model: Virtual S size: 20 GiB tech: N/A serial: N/A fw-rev: 1.0
    scheme: GPT
Partition:
  ID-1: / size: 19.02 GiB used: 17.7 GiB (93.1%) fs: ext4 dev: /dev/sda3
  ID-2: /boot/efi size: 512 MiB used: 6.1 MiB (1.2%) fs: vfat dev: /dev/sda2
Swap:
  ID-1: swap-1 type: file size: 2.09 GiB used: 524 KiB (0.0%) priority: -2 file: /swapfile
USB:
  Hub-1: 1-0:1 info: full speed or root hub ports: 2 rev: 1.1 speed: 12 Mb/s lanes: 1
    chip-ID: 1d6b:0001 class-ID: 0900
  Device-1: 1-1:2 info: VMware Virtual Mouse type: mouse driver: hid-generic,usbhid interfaces: 1
    rev: 1.1 speed: 12 Mb/s lanes: 1 chip-ID: 0e0f:0003 class-ID: 0301
  Hub-2: 1-2:3 info: VMware Virtual USB Hub ports: 7 rev: 1.1 speed: 12 Mb/s lanes: 1
    chip-ID: 0e0f:0002 class-ID: 0900
  Hub-3: 2-0:1 info: full speed or root hub ports: 6 rev: 2.0 speed: 480 Mb/s lanes: 1
    chip-ID: 1d6b:0002 class-ID: 0900
Sensors:
  Src: lm-sensors+/sys Message: No sensor data found using /sys/class/hwmon or lm-sensors.
Repos:
  Packages: pm: dpkg pkgs: 1892
  No active apt repos in: /etc/apt/sources.list
  Active apt repos in: /etc/apt/sources.list.d/official-package-repositories.list
    1: deb https: //mirrors.cicku.me/linuxmint/packages wilma main upstream import backport
    2: deb https: //mirror.internet.asn.au/pub/ubuntu/archive noble main restricted universe multiverse
    3: deb https: //mirror.internet.asn.au/pub/ubuntu/archive noble-updates main restricted universe multiverse
    4: deb https: //mirror.internet.asn.au/pub/ubuntu/archive noble-backports main restricted universe multiverse
    5: deb http: //security.ubuntu.com/ubuntu/ noble-security main restricted universe multiverse
  Active apt repos in: /etc/apt/sources.list.d/vscode.list
    1: deb [arch=amd64,arm64,armhf] https: //packages.microsoft.com/repos/code stable main
Info:
  Memory: total: 4 GiB available: 3.78 GiB used: 1.3 GiB (34.5%)
  Processes: 305 Power: uptime: 10m states: freeze,standby,mem,disk suspend: s2idle wakeups: 0
    hibernate: platform Init: systemd v: 255 target: graphical (5) default: graphical
  Compilers: gcc: 13.2.0 Client: Cinnamon v: 6.2.9 inxi: 3.3.34