Opened 5 years ago

Closed 5 years ago

#3385 closed enhancement (fixed)

Don't spam log with volume color change commands

Reported by: goddard@… Owned by: Tom Goddard
Priority: normal Milestone:
Component: Volume Data Version:
Keywords: Cc: Eric Pettersen
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

The following bug report has been submitted:
Platform:        Darwin-19.5.0-x86_64-i386-64bit
ChimeraX Version: 1.1.dev202006100038 (2020-06-10 00:38:38 UTC)
Description
Coloring volume using color chooser writes dozens of color commands to the log.  Would be better to only log the color perhaps when the color dialog is closed, or after a 1 second delay.

Log:
UCSF ChimeraX version: 1.1.dev202006100038 (2020-06-10)  
© 2016-2020 Regents of the University of California. All rights reserved.  
How to cite UCSF ChimeraX  

> open /Users/goddard/Downloads/ChimeraX/EMDB/emd_0632.map format ccp4

Opened emd_0632.map, grid size 180,180,180, pixel 0.837, shown at level
0.0349, step 1, values float32  

> volume #1 color #a5b3a6

> volume #1 color #a4b3a4

> volume #1 color #a2b4a0

> volume #1 color #9eb49c

> volume #1 color #97b595

> volume #1 color #96b593

> volume #1 color #92b590

> volume #1 color #90b58d

> volume #1 color #8cb58a

> volume #1 color #87b686

> volume #1 color #83b683

> volume #1 color #7eb67f

> volume #1 color #78b77b

> volume #1 color #73b777

> volume #1 color #6cb771

> volume #1 color #63b86a

> volume #1 color #5cb864

> volume #1 color #57b95f

> volume #1 color #52b95b

> volume #1 color #4fb959

> volume #1 color #4db957

> volume #1 color #4bb955

> volume #1 color #48b953

> volume #1 color #47b952

> volume #1 color #46b951

> volume #1 color #45b951

> volume #1 color #43b950

> volume #1 color #43b94f

> volume #1 color #42b94f

> volume #1 color #41ba4e

> volume #1 color #40ba4e

> volume #1 color #3fba4e

> volume #1 color #3eba4d

> volume #1 color #3dba4d

> volume #1 color #3cba4c

> volume #1 color #3bba4c

> volume #1 color #3aba4c

> volume #1 color #39ba4b

> volume #1 color #36ba49

> volume #1 color #35ba49

> volume #1 color #34ba48

> volume #1 color #30ba48

> volume #1 color #2dba47

> volume #1 color #2bba46

> volume #1 color #27ba44

> volume #1 color #25ba44

> volume #1 color #23ba44

> volume #1 color #21ba43

> volume #1 color #20ba43

> volume #1 color #1bba43

> volume #1 color #19ba43

> volume #1 color #17ba43

> volume #1 color #0ebb43

> volume #1 color #00bb43

> volume #1 color #00bb42

> volume #1 color #00bb43

> volume #1 color #00bb44

> volume #1 color #00bb45

> volume #1 color #00bb46

> volume #1 color #00bb47




OpenGL version: 4.1 ATI-3.9.15
OpenGL renderer: AMD Radeon Pro Vega 20 OpenGL Engine
OpenGL vendor: ATI Technologies Inc.Hardware:

    Hardware Overview:

      Model Name: MacBook Pro
      Model Identifier: MacBookPro15,3
      Processor Name: 8-Core Intel Core i9
      Processor Speed: 2.4 GHz
      Number of Processors: 1
      Total Number of Cores: 8
      L2 Cache (per Core): 256 KB
      L3 Cache: 16 MB
      Hyper-Threading Technology: Enabled
      Memory: 32 GB
      Boot ROM Version: 1037.120.87.0.0 (iBridge: 17.16.15300.0.0,0)

Software:

    System Software Overview:

      System Version: macOS 10.15.5 (19F101)
      Kernel Version: Darwin 19.5.0
      Time since boot: 1 day 18:19

Graphics/Displays:

    Intel UHD Graphics 630:

      Chipset Model: Intel UHD Graphics 630
      Type: GPU
      Bus: Built-In
      VRAM (Dynamic, Max): 1536 MB
      Vendor: Intel
      Device ID: 0x3e9b
      Revision ID: 0x0002
      Automatic Graphics Switching: Supported
      gMux Version: 5.0.0
      Metal: Supported, feature set macOS GPUFamily2 v1

    Radeon Pro Vega 20:

      Chipset Model: Radeon Pro Vega 20
      Type: GPU
      Bus: PCIe
      PCIe Lane Width: x8
      VRAM (Total): 4 GB
      Vendor: AMD (0x1002)
      Device ID: 0x69af
      Revision ID: 0x00c0
      ROM Revision: 113-D2060I-087
      VBIOS Version: 113-D20601MA0T-016
      Option ROM Version: 113-D20601MA0T-016
      EFI Driver Version: 01.01.087
      Automatic Graphics Switching: Supported
      gMux Version: 5.0.0
      Metal: Supported, feature set macOS GPUFamily2 v1
      Displays:
        Color LCD:
          Display Type: Built-In Retina LCD
          Resolution: 2880 x 1800 Retina
          Framebuffer Depth: 24-Bit Color (ARGB8888)
          Main Display: Yes
          Mirror: Off
          Online: Yes
          Automatically Adjust Brightness: No
          Connection Type: Internal

PyQt version: 5.12.3
Compiled Qt version: 5.12.4
Runtime Qt version: 5.12.8

Change History (10)

comment:1 by Tom Goddard, 5 years ago

Component: UnassignedVolume Data
Owner: set to Tom Goddard
Platform: all
Project: ChimeraX
Status: newassigned
Summary: ChimeraX bug report submissionDon't spam log with volume color change commands
Type: defectenhancement

Neither solution is very good. The dialog may be close 20 commands after the color was actually changed. Also delaying a second may log the command after another command which could be slightly confusing. These many updates happen when the mouse is dragged in the color chooser. Could there be a way to change only on mouse up? This is how the volume viewer threshold level change avoids spamming the log.

comment:2 by Tom Goddard, 5 years ago

Cc: Eric Pettersen added

Model panel would also have this problem with its color buttons except it currently does not log any color change command.

QColorDialog unsurprisingly has no option to distinguish color changes resulting from a mouse drag versus discrete mouse click changes.

ChimeraX color buttons all use common ui.widgets.ColorButton code and the fix to avoid spamming the log should probably go into the ColorButton class so that all tools can use it.

comment:3 by Eric Pettersen, 5 years ago

...and the reason the Model Panel isn't logging a command is because it is setting model.single_color, which at this point has no command equivalent.

comment:4 by Eric Pettersen, 5 years ago

Looking at the 'color' command code, it seems that 'color #!N target s' is _mostly_ equivalent to setting the single_color. It does some extra stuff with associated surfaces, but maybe that's okay. Perhaps once you've fixed the spamming situation by what means you could reassign this to me and change the summary.

in reply to:  5 ; comment:5 by goddard@…, 5 years ago

Ok, I haven't thought of any satisfactory solution for the log spam.  So it may be a while (years?).  I really want a mouse drag color change to only log at mouse release but using someone else's color dialog isn't going to allow that.

comment:6 by Eric Pettersen, 5 years ago

Maybe you could put a QTimer in ColorButton._color_changed_cb that delays a tenth of a second before emitting the color_changed signal (which would get cancelled if another color change came in during that tenth of a second). Kind of ugly, but maybe worth it?

in reply to:  7 ; comment:7 by goddard@…, 5 years ago

We want to keep instantaneous color updates on the model -- the drags are a nice way to choose a color because you can quickly see how it looks on the structure.

How about this for a hack?  Detect mouse up on the QColorDialog and signal the client and log the command at that point. This will use a second signal so the continuous color changes will still work as before. Probably only send the signal on mouse up if the color has actually changed.

comment:8 by Eric Pettersen, 5 years ago

Sure, why not. :-)

comment:9 by Tom Goddard, 5 years ago

On Mac QColorDialog mouseReleaseEvent and mousePressEvent are never called. I suspect that is because it is a native color chooser dialog.

comment:10 by Tom Goddard, 5 years ago

Resolution: fixed
Status: assignedclosed

Fixed.

I added a "color_pause" signal to ColorButton that fires after the color has changed and a delay with no color change has elapsed. The delay is set using the pause_delay argument of the ColorButton constructor and I use 1 second for volume viewer color changes.

Note: See TracTickets for help on using tickets.