Vyzor, UI Manager for Mudlet

Share your scripts and packages with other Mudlet users.
Post Reply
User avatar
keneanung
Site Admin
Posts: 94
Joined: Mon Mar 21, 2011 9:36 am
Discord: keneanung#2803

Re: Vyzor, UI Manager for Mudlet [Beta?]

Post by keneanung »

The GUI is drawing correctly with the exception of the tabs. The Chat console starts correctly below the place where the headings_frame should be.

There are no errors showing up at all. Is there a way to echo the contents of a frame?

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

Re: Vyzor, UI Manager for Mudlet [Beta?]

Post by Oneymus »

You can access their Components and Stylesheet with those properties. Components will return a dictionary and Stylesheet will return a string. If there's a Stylesheet issue, Mudlet usually draws labels as plain ol' grey.

User avatar
keneanung
Site Admin
Posts: 94
Joined: Mon Mar 21, 2011 9:36 am
Discord: keneanung#2803

Re: Vyzor, UI Manager for Mudlet [Beta?]

Post by keneanung »

All right, I played around with Vyzor a little and it seems, that only the colored echo functions don't work on frames. The text is echoed, but without color. But neither the wrapped nor the normal functions show colors on frames. Are the frames "normal" mudlet Labels? Basically my question is: is it a Vyzor or Mudlet bug?

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

Re: Vyzor, UI Manager for Mudlet [Beta?]

Post by Oneymus »

Frames normal Mudlet Labels. Here's the relevant portion of the Draw call (vyzor/base/frames.lua):
Code: [show] | [select all] lua
	function new_frame:Draw ()
		-- We don't draw the master Frame, because it covers
		-- everything. Think of it as a virtual Frame.
		if not is_first then
			createLabel( name,
				position.AbsoluteX, position.AbsoluteY,
				size.AbsoluteWidth, size.AbsoluteHeight, 1
			)
			updateStylesheet()
			if stylesheet then
				setLabelStyleSheet( name, stylesheet )
			end

			if mini_console_count > 0 then
				for _, console in pairs(mini_consoles) do
					console:Draw()
				end
			end
			if components["Map"] then
				components["Map"]:Draw()
			end

			if callback then
				if callback_args then
					setLabelClickCallback( name, callback, unpack(callback_args) )
				else
					setLabelClickCallback( name, callback )
				end
			end
		end
                ...
Vyzor is high-end manager for Mudlet Labels. I have had issues in the past when testing for (and before) Vyzor as concerns Stylesheets and echo'd text, so I'm thinking it's a Mudlet bug. I can't make any claims to the various echo functions; I simply redirect the calls on Vyzor objects to the named label. I don't know whether or not any of them are supposed to work on labels, or simply console text.

A look at Geyser (Mudlet/mudlet-lua/lua/geyser/GeyserLabel.lua) shows only a single echo function which supplies using css/html markup in the echo itself.
Code: [show] | [select all] lua
function Geyser.Label:echo(message, color, format)
   message = message or self.message
   self.message = self.message
   format = format or self.format
   self.format = format
   color = color or self.fgColor
   self.fgColor = color
   
   local fs = ""
   -- check for formatting commands
   if format then
      if string.find(format, "b") then message = "<b>" .. message .. "</b>" end
      if string.find(format, "i") then message = "<i>" .. message .. "</i>" end
      if string.find(format, "c") then message = "<center>" .. message .. "</i>" end
      if string.find(format, "u") then message = "<u>" .. message .. "</u>" end
      fs = string.gmatch(format, "%d+")()
      if not fs then fs = tostring(self.fontSize) end
      fs = "font-size: " .. fs .. "pt; "
   end
   message = [[<div style="color: ]] .. Geyser.Color.hex(self.fgColor) .. "; " .. fs ..
             [[">]] .. message .. [[</div>]]
   echo(self.name, message)
end
So, the issue here may be my ignorance. If that's the case, I'll remove the various echo's from Frames (should still work on consoles?) and replace it with something similar to Geyser's implementation.

Also, keneanung, have you had any success with your tabbed chat? I apologize for not looking into it yet (received a design test in response to my application to Rockstar *fingers crossed*), but I hope to get the next Vyzor update out this coming week and it'd be helpful if you had any more to go on.

User avatar
keneanung
Site Admin
Posts: 94
Joined: Mon Mar 21, 2011 9:36 am
Discord: keneanung#2803

Re: Vyzor, UI Manager for Mudlet [Beta?]

Post by keneanung »

The echoes work perfectly for minicinsoles. So nothing to complain there. And I've been fiddling with those colored echoes, so I didn't get far with the chats I fear.

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

Re: Vyzor, UI Manager for Mudlet [Beta?]

Post by Oneymus »

If you add a Color Component directly (Brush isn't necessary) to a Frame, it will color the text.
Code: [show] | [select all] lua
local test = Vyzor.Frame("color_test", .3, .3, .3, .3)
test:Add( Vyzor.Color(Vyzor.ColorMode.Name, "green"))
test:Add( Vyzor.Background(
	Vyzor.Brush(
		Vyzor.Color( Vyzor.ColorMode.RGBA, 100, 0, 0 )
	)
))

Vyzor.HUD.Frames["VyzorLeft"]:Add(test)

echo(test.Stylesheet)

Vyzor.HUD:Draw()

test:Echo("This is only a test.\n")
Will add this to the original post, but I used http://developer.qt.nokia.com/doc/qt-4. ... rence.html extensively when developing Vyzor. Each of Vyzor's components maps directly to each of the properties (that worked in Mudlet) listed there.

Edited to add:
A Color Component, combined with a Font Component, should provide all possible text manipulations outside of alignment to Labels.

User avatar
keneanung
Site Admin
Posts: 94
Joined: Mon Mar 21, 2011 9:36 am
Discord: keneanung#2803

Re: Vyzor, UI Manager for Mudlet [Beta?]

Post by keneanung »

Hrm... I added the color to the Frame and echoed to it, but it is still grey. The Stylesheet shows green as color though...

Oh, wait... After a Vyzor.HUD:Draw() it showed up correctly. So we need to call draw after each change to the Stylesheet?

User avatar
keneanung
Site Admin
Posts: 94
Joined: Mon Mar 21, 2011 9:36 am
Discord: keneanung#2803

Re: Vyzor, UI Manager for Mudlet [Beta?]

Post by keneanung »

And I did fiddle with tabs now. I got the callback wrapper working, but the documentation seems a bit off there. The Callback property is lowercase and the CallbackArguments are labeled as "callback_args" in the docs.

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

Re: Vyzor, UI Manager for Mudlet [Beta?]

Post by Oneymus »

Internal variables are lowercase. The property (as it's called externally) is capitalized; internally it's stored lowercase. And "callback_args" was me being lazy; externally those are called with CallbackArguments.

And, currently, yes, you will need to redraw the Frame (shouldn't need to be the whole HUD). I have been considering different ways of handling dynamically changing values during runtime. Stylesheets should be a simple setLabel call, but I'm hoping to develop a better, generalized system.

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Vyzor, UI Manager for Mudlet [Beta?]

Post by Vadi »

Noticed Mudlet printing this to stdout when playing with Vyzor:

Unknown property border-image-position

Post Reply