patchGNU Octave - Patches: patch #8013, GUI Workspace color coding based...

 
 

patch #8013: GUI Workspace color coding based upon variable scope.

Submitter:  Dan Sebald <sebald>
Submitted:  Fri 12 Apr 2013 05:08:38 AM UTC
   
 
Category:  None Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  None Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 04 May 2013 09:10:24 AM UTC, comment #5: 

I have created changeset
http://hg.savannah.gnu.org/hgweb/octave/rev/a1f613e5066d
derived from this patch.

Thanks for the patch.

Torsten Lilge <ttl>
Group Member
Sat 27 Apr 2013 07:27:29 PM UTC, comment #4: 

I like it.  It is certainly the right idea and accomplished easy enough with the small number of lines used.

I don't think it pays to quibble over too much right now.  This is one of those things that will evolve as users try it and come up with ideas.  Along with that will probably come ideas for how to group the data, display the context when debugging and so on.

There is a Qt color selector here:

http://qt-project.org/doc/qt-4.8/qcolordialog.html

The basic colors in the far right rows look like the better candidates for a default.  Although, I'm not sure why Qt has used six similar shades of green, two similar shades of yellow, and three similar shades of blue.

My experience is that good candidate colors are those which are light and a composite of more than one primary color.  If a color is light and monochromatic, it tends to be harsh on the eyes.

One comment about coding.  This hunk of code:

+                if (c == 'g')
+                  retval = QVariant (tr ("global"));
+                else if (c == 'p')
+                  retval = QVariant (tr ("persistent"));
+                else if (c == 'a')
+                  retval = QVariant (tr ("automatic"));
+                else if (c == 'f')
+                  retval = QVariant (tr ("function parameter"));
+                else if (c == 'h')
+                  retval = QVariant (tr ("hidden"));
+                else if (c == 'i')
+                  retval = QVariant (tr ("inherited"));

is something that would work better as a switch statement.  Switch statements are good for when there are more than two or three if conditions on the same variable.  An if/elseif will test c (in this case) six times.  A switch statement, on the other hand, will use some form of table lookup and jump to the hunk of code that it is supposed to execute.  That is, a switch has a little extra overhead up front, but after that is very efficient.

Dan Sebald <sebald>
Sat 27 Apr 2013 05:33:14 PM UTC, comment #3: 

I updated the patch to the recent changes in the sources (ws_row_color.diff) and made a patch for a possible tool tip with the color key (ws_color_key.diff, the code may need some polishing). If the tool tip is okay in this form I would like to add colors for all storage classes and make the colors configurable in the settings.

(file #27960, file #27961)

Torsten Lilge <ttl>
Group Member
Fri 12 Apr 2013 07:37:38 AM UTC, comment #2: 

I thought the same thing, that the normal variables should be in white and others in colors.  It works, but the color is sort of a nice visual contrast in the overall view.

While I was out I was thinking that the key could be in the tool tip that pops up if, say, putting the cursor over the window header, just like position the cursor over the tab of a web browser brings up a condensed graphic of the web page.  So rather than take up space and rather than have to search for where the key is, just position the cursor a little above the variables and there it is.

Could make the colors configurable in the Preferences... as well.  It shouldn't be too difficult to put up an array of a dozen light, contrasting colors to choose from.  I think this is one of those things where feedback would help.

Dan Sebald <sebald>
Fri 12 Apr 2013 05:53:15 AM UTC, comment #1: 

This seems like a reasonable idea, but I think we need some kind of key for the colors, otherwise they just seem random.  And most of the time, people will be looking at the top-level symbol table without global variables, so everything will be one color.  So maybe the color for normal variables should just be the normal background color?

Anyway, I made some changes that confliced with this patch, so I'm uploading a new version with the conflicts resolved.


(file #27849)

John W. Eaton <jwe>
Group administrator
Fri 12 Apr 2013 05:08:38 AM UTC, original submission:  

This is a small proof-of-concept changeset that adds background color to the data model based upon scope.  It has potential.  Place a breakpoint in the attached testfun.m and step through.  I think it would be much nicer to organize these entries by type, or at least group variables inside a function (currently not supported, an 'f' would be needed to the scope characters).  It wouldn't be too difficult to do because separate QTableView could be made for each and if placed in the QVerticalLayout.

Another thing we could do is have a Preferences... setting that allows sorting based on name, or sorting based upon scope.  That would be easy to do inside the "data" model.  When they come in, just sort accordingly in the lists.

Dan Sebald <sebald>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #27960:  ws_row_color.diff added by ttl (4KiB - text/x-diff)
file #27961:  ws_color_key.diff added by ttl (1KiB - text/x-diff)
file #27849:  workspace-color-diffs.txt added by jwe (2KiB - text/plain)
file #27847:  octave-workspace_color_code-2013apr11.patch added by sebald (2KiB - application/octet-stream)
file #27848:  testfun.m added by sebald (155B - application/vnd.wolfram.mathematica.package)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by ttl (Updated the item)
  • -email is unavailable- added by jwe (Updated the item)
  • -email is unavailable- added by sebald (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-05-04 ttl StatusNone Done
        Open/ClosedOpen Closed
    2013-04-27 ttl Attached File- Added ws_row_color.diff, #27960
        Attached File- Added ws_color_key.diff, #27961
    2013-04-12 jwe Attached File- Added workspace-color-diffs.txt, #27849
    2013-04-12 sebald Attached File- Added octave-workspace_color_code-2013apr11.patch, #27847
        Attached File- Added testfun.m, #27848

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code