The Geyser Layout Manager

Geyser is an object oriented framework for creating, updating and organizing GUI elements within Mudlet.
User avatar
Akaya
Posts: 412
Joined: Thu Apr 19, 2012 1:36 am

Re: The Geyser Layout Manager

Post by Akaya » Sun Jan 19, 2014 7:09 pm

Would it be possible to have an option for all children of a label to respect the margin value in the stylesheet of its parent? Its always a pain to change the childs x,y,width and height based on its parent's margins.

For example, if we had the following label:
Code: [show] | [select all] lua
myParent = Geyser.Label:new({
  name = "myParent",
  x = "10%", y = "10%",
  width = "10%", height = "10%",
})
myParent:setStyleSheet([[
  background-color: red;
  margin: 10px;
And we add another label to it that is the same size...
Code: [show] | [select all] lua
myChild = Geyser.Label:new({
  name = "myChild",
  x = 0, y = 0,
  width = "100%", height = "100%",
},myParent)
In this instance, the child is actually LARGER than the parent because the parent has a 10px margin. Can we have myChild also have the margin? This cannot be done via the stylesheet because some children are not labels. myChild could be a miniConsole or mapper widget.

Wondering how difficult this would be to implement. Or if anyone has a different way of doing things that avoids this problem.

User avatar
Oneymus
Posts: 321
Joined: Thu Sep 17, 2009 5:24 am

Re: The Geyser Layout Manager

Post by Oneymus » Mon Jan 27, 2014 10:33 pm

This is something I came up against when developing Vyzor. There is no way to get the stylesheet information out of a label; hence one of the reasons for Vyzor's wrapper objects. It would be necessary for Geyser to store this data somewhere within its object structure in order to do this.

You might want to check out the box model for the Qt 4.7 documentation for a more detailed explanation; in short, a Mudlet label is the entire box.

fetaera
Posts: 191
Joined: Sat Aug 03, 2013 7:00 pm

Re: The Geyser Layout Manager

Post by fetaera » Wed Apr 02, 2014 12:45 pm

Has anybody encountered a problem when assigning images to a vbox? I have the strangest issue here and for the life of me, I can't work out why it's doing this.

Here's my element: http://imgur.com/0Cj513O

You'll see that three of the images are not displaying. My function is running through a for loop which makes this a double o.O.

Here's the function in question:
Code: [show] | [select all] lua
function draw_toggle_icons()
	local imgs = {
		"visualalerts",
		"genrunner",
		"autobasher",
		"clanannounce",
		"combatmode",
		"paused"
	}

	for _, icon in ipairs(imgs) do
		vboxes.tparent[icon] = Geyser.Label:new({
      		name = string.format("vboxes.tparent.%s", icon),
    	}, vboxes.tparent)
	end

	for _, t in ipairs(imgs) do
		vboxes.tparent[t]:setStyleSheet([[
			QLabel{
				border-color: rgb(75, 0, 130);	
				border-width: 3px;
				border-style: solid;
				border-radius: 12px;
				image: url("]] .. imagedir .. t .. [[_on.png");
			}

			QLabel::hover{
				border-color: rgb(244, 164, 96);	
				border-width: 2px;
				border-style: solid;
				border-radius: 12px;
				image: url("]] .. imagedir .. t  .. [[_off.png");
			}		
		]])
	end
end
And the parents:

Container:
Code: [show] | [select all] lua
	containers.toggles = Geyser.Container:new({
		name = "containers.toggles",
		x = "0%", y = "50%",
		width = "2%", height = "46%"
	}, containers.main)
VBox:
Code: [show] | [select all] lua
function draw_toggles_vbox()
	vboxes.tparent = Geyser.VBox:new({
    	name = "vboxes.tparent",
    	x = "0%", y = "0%",
    	width = "100%", height = "100%"
  	}, containers.toggles)
end
I've confirmed that everything is as it should be via the following methods:

lfs.attributes() on -all- image paths. All check out.
echo() out pertinent strings and tables. Again, all fine.
Passed the flash method to each label. Ditto.

I should add, these very same functions work just fine in Linux, suggesting a path/separator issue, but that also has been ruled out and further confirmed by the fact in Windows, it does at least show some of the images.

Am I missing something here?

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest