GScreen and some understanding gap of hal-widgets

More
7 years 4 months ago - 7 years 4 months ago #138159 by Reinhard
Hi Chris,

thank you for the links. Nothing new or unknown so far and nothing to answer my questions ...
Anyway - I was able to create my first widget - with the help of hal_widget so far! :)
It works, but it has a really annoying behaviour - any time I replace the button with an image, the widget is about to resize. Hell! :(
I already copy all properties from one widget to the other - but that does not help anything.

Does anybody know a solution to prevent the resizing of the widget?
I create the screen for fullscreen usage - so resizing should never be an issue or even happen at all.

On this sample I use a homogeneous table with size-request of 100x100 - my imageIcons have the size 100x100 - the ToggleButton the gets a size of 112x112 - but when I use a size-request of 112x112 the ToggleButton grows even further.
Usage of the buttons of the test app:
Button 1 - 3 change the background color of my widget
Button 8 simulates a hal-pinchange event (external toggling of the button)
Button 5 makes the widget unresponsive (I don't want to use set_sensitive, cause it changes color of the images)
Button 6 makes the widget responsive again


Any help is appreciated!
Last edit: 7 years 4 months ago by Reinhard.

Please Log in or Create an account to join the conversation.

More
7 years 4 months ago #138185 by cmorley
I can't say for sure without a lot of experimenting what the resize problem is - I would guess the removing and inserting of widgets is the cause.
You might be able to explicitly set the size programmatically after insertion, you may need to .hide() .show() the widget..

Is it a toggle button with images that change on external events, or an image that changes on external events that you are looking to make?
The fact you are (in handleWidges) removing/inserting widgets from a container seems complicated.

You should be able to change the image on a button with .set_image()

here is an example (that I didn't try but shows the idea):
Code:
mport gtk win = gtk.Window() image_add = gtk.Image() image_rem = gtk.Image() b = gtk.Button() image_add.set_from_stock(gtk.STOCK_ADD, gtk.ICON_SIZE_BUTTON) image_rem.set_from_stock(gtk.STOCK_REMOVE, gtk.ICON_SIZE_BUTTON) def on_clicked(button): state = button.get_active() if state: button.set_image(image_rem) else: button.set_image(image_add) # setup initial state b.set_image(image_add) # connect signals b.connect('clicked', on_clicked) win.connect('delete-event', gtk.main_quit) win.add(b) win.show_all() gtk.main()

Please Log in or Create an account to join the conversation.

More
7 years 4 months ago - 7 years 4 months ago #138221 by Reinhard
Hi Chris,

I already used 'button.set_image(...)'

The challenge was to remove the button (under the hood) without changing the shown picture.
I got it by changing the superclass from Eventbox to Notebook. Notebook will not resize on page flip, so ...
As Stack-widget is not available at the version used by linuxcnc, Notebook will be the closest try ...
I now have a misplacement of 1 pixel - not nice, but acceptable. At least at the moment ;)
So I can continue work and create other widgets ...
Last edit: 7 years 4 months ago by Reinhard.

Please Log in or Create an account to join the conversation.

More
7 years 4 months ago #138222 by cmorley

Reinhard wrote: Hi Chris,

I already used 'button.set_image(...)'


Yes I saw that in your code - but you seemed to have missed the bigger point.
You seem to be having fun now. I'm interested to see your finished screen!

Chris M

Please Log in or Create an account to join the conversation.

More
7 years 4 months ago #138223 by Reinhard

but you seemed to have missed the bigger point.

In your sample?
Please, gimme a hint.
.

I'm interested to see your finished screen!

Screenshot will not change. I'm working on user input / usability or how you like to name it ...

For example - the new widget will be used for cooling icons and the like.
In auto mode, user can't change cooling state. When I use button.set_sensitive(False), the image will be blurred, which I don't like. So I change the toggle button to an led, that changes icons on state change.
In manual mode, the button is responsive to user action, so I use the toggle button ...

Please Log in or Create an account to join the conversation.

Time to create page: 0.089 seconds
Powered by Kunena Forum