HAL gladevcp Iconview widget - Coding error
- auto-mation-assist
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 425
- Thank you received: 81
17 Mar 2018 06:25 - 17 Mar 2018 06:29 #107458
by auto-mation-assist
HAL gladevcp Iconview widget - Coding error was created 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.
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.
Last edit: 17 Mar 2018 06:29 by auto-mation-assist.
Please Log in or Create an account to join the conversation.
- andypugh
- Away
- Moderator
Less
More
- Posts: 23561
- Thank you received: 4859
18 Mar 2018 22:54 #107523
by andypugh
Replied by andypugh on topic HAL gladevcp Iconview widget - Coding error
Can you raise this on the big tracker? (Just paste all of this there).
github.com/LinuxCNC/linuxcnc/issues
github.com/LinuxCNC/linuxcnc/issues
Please Log in or Create an account to join the conversation.
- auto-mation-assist
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 425
- Thank you received: 81
19 Mar 2018 03:50 #107531
by auto-mation-assist
Replied by auto-mation-assist on topic HAL gladevcp Iconview widget - Coding error
OK Andy, its done.
Please Log in or Create an account to join the conversation.
- andypugh
- Away
- Moderator
Less
More
- Posts: 23561
- Thank you received: 4859
21 Mar 2018 12:57 #107658
by andypugh
Replied by andypugh on topic HAL gladevcp Iconview widget - Coding error
Please Log in or Create an account to join the conversation.
Moderators: newbynobi, HansU
Time to create page: 0.075 seconds