HAL gladevcp Iconview widget - Coding error

More
8 years 7 months ago #107458 by auto-mation-assist
Small things can bug me a little because you never know if these small things will lead to other more serious issues later.
I decided to look at why my gmoccapy always reports an error at start up, Invalid icon size 48. Not a big issue but still a problem that needs to be fixed. One of the causes for this is that Hal GladeVCP iconview.py has a programming error and thus more than just gmoccapy reports can show this error in its printed log.

Here is my description of the issue with Hal GladeVCP iconview.py and a simple suggestion for a fix.

Withing the iconview.py are 9 lines like:

"image.set_from_stock(gtk.STOCK_GOTO_TOP, 48)"

The 48 is supposed to refer to the displayed file folders icons desired size. This cannot be done with entering 48 in these lines.
In these lines size is looking for a "name" that has defined an icon and "not a size number".

Per the gtk Class Reference for gtk.Image, the normal allowed things for unless a custom one is made are:

gtk.ICON_SIZE_MENU
gtk.ICON_SIZE_SMALL_TOOLBAR
gtk.ICON_SIZE_LARGE_TOOLBAR
gtk.ICON_SIZE_BUTTON
gtk.ICON_SIZE_DND
gtk.ICON_SIZE_DIALOG.

Here are my suggested changes to consider to the Hal GladeVCP iconview.py widget:

Leave this line alone:
self.icon_size = 48 # The actual per file folder display size - must agree with the named item standard size definitions. A error in choosing the wrong size here will show wrong folder colors since that size is not likely defined as being possible in the named STOCK item definition.

Ok now for the suggested changes:

Add this line:
stksize = gtk.ICON_SIZE_MENU # GTK standard size name # chosen at random

Change 9 lines from and to list:
image.set_from_stock(gtk.STOCK_HOME,48)
image.set_from_stock(gtk.STOCK_HOME, stksize)

image.set_from_stock(gtk.STOCK_GOTO_TOP,48)
image.set_from_stock(gtk.STOCK_GOTO_TOP,stksize)

mage.set_from_stock(gtk.STOCK_GO_BACK,48)
image.set_from_stock(gtk.STOCK_GO_BACK, stksize)

image.set_from_stock(gtk.STOCK_GO_FORWARD,48)
image.set_from_stock(gtk.STOCK_GO_FORWARD, stksize)

#image.set_from_stock(gtk.STOCK_GO_DOWN,48)
#image.set_from_stock(gtk.STOCK_GO_DOWN, stksize)

#image.set_from_stock(gtk.STOCK_GO_UP,48)
#image.set_from_stock(gtk.STOCK_GO_UP, stksize)

image.set_from_stock(gtk.STOCK_JUMP_TO,48)
image.set_from_stock(gtk.STOCK_JUMP_TO, stksize)

image.set_from_stock(gtk.STOCK_OK,48)
image.set_from_stock(gtk.STOCK_OK, stksize)

image.set_from_stock(gtk.STOCK_STOP,48)
image.set_from_stock(gtk.STOCK_STOP, stksize)

This eliminates the Invalid icon size 48 error message generated by this widget.
I have seen similar errors in the past from at least one other file but cant recall its name.

Please Log in to join the conversation.

More
8 years 7 months ago #107523 by andypugh
Can you raise this on the big tracker? (Just paste all of this there).

github.com/LinuxCNC/linuxcnc/issues

Please Log in to join the conversation.

More
8 years 7 months ago #107531 by auto-mation-assist
OK Andy, its done.

Please Log in to join the conversation.

More
8 years 7 months ago #107658 by andypugh

Please Log in to join the conversation.

Time to create page: 0.085 seconds
Powered by Kunena Forum