Giter VIP home page Giter VIP logo

sushi-3.1's Introduction

Preview News Donate Community

Sushi-3.2 ๐Ÿฃ

Sushi is a GUI framework for the game World of Warcraft, designed to be:

  • Completely object oriented.
  • Versatile and easily extendable.
  • A taint-free alternative to frequently used objects (for example, dropdowns)
  • Similar to Blizzard's API and hence, easy to learn.

Requires LibStub and Poncho-2.0.

How to Use

For instance, imagine you wish to create a dropdown choice menu. To do so, you can simply call the Sushi.Choice class:

local myMenu = LibStub('Sushi-3.2').Choice(MyParent)
myMenu:SetPoint('CENTER')

myMenu:SetLabel('My Awesome Dropdown')
myMenu:AddChoice('Salmon')
myMenu:AddChoice('Grouper')
myMenu:AddChoice('None')

myMenu:SetCall('OnInput', function(self, value)
	if value == 'None' then
		print('Not hungry?')
	else
		print('You cannot have it.')
	end
end)

๐Ÿ’ก Three things of note in this snippet:

  • Functionality is available as methods, never as attributes.
  • SetCall work much alike the native SetScript, except it is a method defined by the library. Multiple functions can be assigned to a single event.
  • If you release the frame myMenu, all attributes assigned to it and properties modified trough class methods will be cleared.

Available Classes

Each class is defined in it's own .lua file under the \classes directory. The library contains classes to display buttons, checkbuttons, dropdowns, editboxes, sliders, static popups, automatic layouts and more. Read the Class Reference for further details.

No class makes use of native code that can generate taint. For example, the Dropdown frame implementation does not make use of the UIDropDownMenu API.

โš ๏ธ Reminder!

If you use this library, please list it as one of your dependencies in the CurseForge admin system. It's a big help! ๐Ÿ‘

sushi-3.1's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

sushi-3.1's Issues

Leaked global variables

Just stumbled upon these leaked variables: x, y, line, breakLine. Putting them in local scope shouldn't break anything :)

function Group:Layout ()
    self.limit = self:GetLimit()
    x, y = 0, 0
    line = 0

    function breakLine()
        y = y + line
        line, x = 0, 0
    end

Wiki missing?

Am I blind or has the wiki that is linked to several times on the README gone completely missing?

Sushi adds ColorPickerFrame.SetupColorPickerAndShow and breaks version checks

Sushi adds the ColorPickerFrame.SetupColorPickerAndShow if it does not exist, breaking checks in other addons that might check for that function to be available, and assuming it is the original and works as expected - not some addon replacement function.

It is generally a bad idea to mess with global frames that other addons might use. If you want a handy fallback function, please make it local.

Drop:IsMouseInteracting Attempt to access forbidden object

I'm getting this error with the latest version of PetTracker (which includes Sushi-3.1), on WoW 9.0.1:

13x ...PetTracker\libs\Sushi-3.1-4\classes\drops\Dropdown.lua:148: Attempt to access forbidden object from code tainted by an AddOn
[string "=[C]"]: in function `IsMouseOver'
[string "@PetTracker\libs\Sushi-3.1-4\classes\drops\Dropdown.lua"]:148: in function <...PetTracker\libs\Sushi-3.1\classes\drops\Dropdown.lua:147>
[string "@PetTracker\libs\Sushi-3.1-4\classes\drops\Dropdown.lua"]:153: in function <...PetTracker\libs\Sushi-3.1\classes\drops\Dropdown.lua:147>
[string "=(tail call)"]: ?
[string "@PetTracker\libs\Sushi-3.1-4\classes\drops\Dropdown.lua"]:93: in function <...PetTracker\libs\Sushi-3.1\classes\drops\Dropdown.lua:92>

Locals:
(*temporary) = SimpleCheckout {
 0 = <userdata>
 RightOutside = <unnamed> {
 }
 RightInside = <unnamed> {
 }
 Background = <unnamed> {
 }
 CalculateDesiredSize = <function> defined @Blizzard_StoreUI\Blizzard_SimpleCheckout.lua:101
 OnShow = <function> defined @Blizzard_StoreUI\Blizzard_SimpleCheckout.lua:54
 OnLoad = <function> defined @Blizzard_StoreUI\Blizzard_SimpleCheckout.lua:25
 OnHide = <function> defined @Blizzard_StoreUI\Blizzard_SimpleCheckout.lua:61
 LeftOutside = <unnamed> {
 }
 OnExternalLink = <function> defined @Blizzard_StoreUI\Blizzard_SimpleCheckout.lua:83
 TopInside = <unnamed> {
 }
 BottomOutside = <unnamed> {
 }
 CloseButton = <unnamed> {
 }
 TopOutside = <unnamed> {
 }
 BottomInside = <unnamed> {
 }
 OnEvent = <function> defined @Blizzard_StoreUI\Blizzard_SimpleCheckout.lua:29
 LeftInside = <unnamed> {
 }
 RecalculateSize = <function> defined @Blizzard_StoreUI\Blizzard_SimpleCheckout.lua:139
 OnRequestNewSize = <function> defined @Blizzard_StoreUI\Blizzard_SimpleCheckout.lua:75
}

I'm not sure what SimpleCheckout even is, apparently part of the store UI.
I think the offending function needs an frame:IsForbidden() check on line 148: https://github.com/Jaliborc/Sushi-3.1/blob/master/classes/drops/Dropdown.lua#L148
And presumably on line 152 as well: https://github.com/Jaliborc/Sushi-3.1/blob/master/classes/drops/Dropdown.lua#L152
(https://wow.gamepedia.com/API_UIObject_IsForbidden)

[Low priority] Multiple errors on login

As a part of the Blitz addon, Sushi lib is giving me errors on startup.

As far as I can see, I don't think anything is broken so this has no priority, really.

I don't actually know what this means, I'm just here to copypaste. Does it conflict with OiLvL and FrameXML (whatever that is - is that just WoW itself)?

This did not happen with whatever Sushi version was packaged with the previous version of Blitz (I use the Twitch client to keep addons up to date).

The errors:

1x Blitz\libs\Sushi-3.1\Sushi-3.1-3.lua:27: attempt to index local 'Install' (a nil value)
[string "@Blitz\libs\Sushi-3.1\Sushi-3.1-3.lua"]:27: in main chunk
[string "=[C]"]: ?
[string "=[C]"]: in function `LoadAddOn'
[string "@Blitz\addons\main\main.lua"]:45: in function <Blitz\addons\main\main.lua:44>
[string "=[C]"]: in function `Show'
[string "@FrameXML\UIParent.lua"]:2723: in function `SetUIPanel'
[string "@FrameXML\UIParent.lua"]:2529: in function `ShowUIPanel'
[string "@FrameXML\UIParent.lua"]:2436: in function <FrameXML\UIParent.lua:2432>
[string "=[C]"]: in function `SetAttribute'
[string "@FrameXML\UIParent.lua"]:3290: in function <FrameXML\UIParent.lua:3273>
[string "=[C]"]: in function `ShowUIPanel'
[string "@Oilvl\Oilvl-v8.2.1 BFA.lua"]:5805: in function `?'
[string "@Oilvl\Oilvl-v8.2.1 BFA.lua"]:5952: in function <Oilvl\Oilvl.lua:5951>

Locals:
Lib = <table> {
}
Base = <table> {
 __index = <table> {
 }
 __super = <table> {
 }
}
Install = nil
Root = ""
(*temporary) = "^(.+)\Sushi[%d.-]+.lua"
(*temporary) = nil
(*temporary) = <table> {
 __index = <table> {
 }
 __super = <table> {
 }
}
(*temporary) = "Abstract"
(*temporary) = <table> {
 __index = <function> defined @Blitz\libs\Poncho-2.0\Poncho-2.0.lua:8
 __call = <function> defined @Blitz\libs\Poncho-2.0\Poncho-2.0.lua:12
}
(*temporary) = nil
(*temporary) = "Abstract"
(*temporary) = <table> {
 __index = <table> {
 }
 __super = <table> {
 }
}
(*temporary) = "__type"
(*temporary) = "Abstract"
(*temporary) = "attempt to index local 'Install' (a nil value)"


1x ...ddOns\Blitz\libs\Sushi-3.1-3\classes\core\Callable.lua:20: attempt to index field 'Base' (a nil value)
[string "@Blitz\libs\Sushi-3.1-3\classes\core\Callable.lua"]:20: in main chunk
[string "=[C]"]: ?
[string "=[C]"]: in function `LoadAddOn'
[string "@Blitz\addons\main\main.lua"]:45: in function <Blitz\addons\main\main.lua:44>
[string "=[C]"]: in function `Show'
[string "@FrameXML\UIParent.lua"]:2723: in function `SetUIPanel'
[string "@FrameXML\UIParent.lua"]:2529: in function `ShowUIPanel'
[string "@FrameXML\UIParent.lua"]:2436: in function <FrameXML\UIParent.lua:2432>
[string "=[C]"]: in function `SetAttribute'
[string "@FrameXML\UIParent.lua"]:3290: in function <FrameXML\UIParent.lua:3273>
[string "=[C]"]: in function `ShowUIPanel'
[string "@Oilvl\Oilvl-v8.2.1 BFA.lua"]:5805: in function `?'
[string "@Oilvl\Oilvl-v8.2.1 BFA.lua"]:5952: in function <Oilvl\Oilvl.lua:5951>

Locals:
(*temporary) = nil
(*temporary) = nil
(*temporary) = "Sushi-3.1"
(*temporary) = nil
(*temporary) = "attempt to index field 'Base' (a nil value)"


1x Blitz\libs\Sushi-3.1-3\classes\core\Tipped.lua:20: attempt to index field 'Callable' (a nil value)
[string "@Blitz\libs\Sushi-3.1-3\classes\core\Tipped.lua"]:20: in main chunk
[string "=[C]"]: ?
[string "=[C]"]: in function `LoadAddOn'
[string "@Blitz\addons\main\main.lua"]:45: in function <Blitz\addons\main\main.lua:44>
[string "=[C]"]: in function `Show'
[string "@FrameXML\UIParent.lua"]:2723: in function `SetUIPanel'
[string "@FrameXML\UIParent.lua"]:2529: in function `ShowUIPanel'
[string "@FrameXML\UIParent.lua"]:2436: in function <FrameXML\UIParent.lua:2432>
[string "=[C]"]: in function `SetAttribute'
[string "@FrameXML\UIParent.lua"]:3290: in function <FrameXML\UIParent.lua:3273>
[string "=[C]"]: in function `ShowUIPanel'
[string "@Oilvl\Oilvl-v8.2.1 BFA.lua"]:5805: in function `?'
[string "@Oilvl\Oilvl-v8.2.1 BFA.lua"]:5952: in function <Oilvl\Oilvl.lua:5951>

Locals:
(*temporary) = nil
(*temporary) = nil
(*temporary) = "Sushi-3.1"
(*temporary) = nil
(*temporary) = "attempt to index field 'Callable' (a nil value)"


1x Blitz\libs\Sushi-3.1-3\classes\core\Labeled.lua:20: attempt to index field 'Tipped' (a nil value)
[string "@Blitz\libs\Sushi-3.1-3\classes\core\Labeled.lua"]:20: in main chunk
[string "=[C]"]: ?
[string "=[C]"]: in function `LoadAddOn'
[string "@Blitz\addons\main\main.lua"]:45: in function <Blitz\addons\main\main.lua:44>
[string "=[C]"]: in function `Show'
[string "@FrameXML\UIParent.lua"]:2723: in function `SetUIPanel'
[string "@FrameXML\UIParent.lua"]:2529: in function `ShowUIPanel'
[string "@FrameXML\UIParent.lua"]:2436: in function <FrameXML\UIParent.lua:2432>
[string "=[C]"]: in function `SetAttribute'
[string "@FrameXML\UIParent.lua"]:3290: in function <FrameXML\UIParent.lua:3273>
[string "=[C]"]: in function `ShowUIPanel'
[string "@Oilvl\Oilvl-v8.2.1 BFA.lua"]:5805: in function `?'
[string "@Oilvl\Oilvl-v8.2.1 BFA.lua"]:5952: in function <Oilvl\Oilvl.lua:5951>

Locals:
(*temporary) = nil
(*temporary) = nil
(*temporary) = "Sushi-3.1"
(*temporary) = nil
(*temporary) = "attempt to index field 'Tipped' (a nil value)"


1x ...s\Blitz\libs\Sushi-3.1-3\classes\buttons\Clickable.lua:20: attempt to index field 'Tipped' (a nil value)
[string "@Blitz\libs\Sushi-3.1-3\classes\buttons\Clickable.lua"]:20: in main chunk
[string "=[C]"]: ?
[string "=[C]"]: in function `LoadAddOn'
[string "@Blitz\addons\main\main.lua"]:45: in function <Blitz\addons\main\main.lua:44>
[string "=[C]"]: in function `Show'
[string "@FrameXML\UIParent.lua"]:2723: in function `SetUIPanel'
[string "@FrameXML\UIParent.lua"]:2529: in function `ShowUIPanel'
[string "@FrameXML\UIParent.lua"]:2436: in function <FrameXML\UIParent.lua:2432>
[string "=[C]"]: in function `SetAttribute'
[string "@FrameXML\UIParent.lua"]:3290: in function <FrameXML\UIParent.lua:3273>
[string "=[C]"]: in function `ShowUIPanel'
[string "@Oilvl\Oilvl-v8.2.1 BFA.lua"]:5805: in function `?'
[string "@Oilvl\Oilvl-v8.2.1 BFA.lua"]:5952: in function <Oilvl\Oilvl.lua:5951>

Locals:
(*temporary) = nil
(*temporary) = nil
(*temporary) = "Sushi-3.1"
(*temporary) = nil
(*temporary) = "attempt to index field 'Tipped' (a nil value)"


1x ...dOns\Blitz\libs\Sushi-3.1-3\classes\buttons\Texted.lua:20: attempt to index field 'Clickable' (a nil value)
[string "@Blitz\libs\Sushi-3.1-3\classes\buttons\Texted.lua"]:20: in main chunk
[string "=[C]"]: ?
[string "=[C]"]: in function `LoadAddOn'
[string "@Blitz\addons\main\main.lua"]:45: in function <Blitz\addons\main\main.lua:44>
[string "=[C]"]: in function `Show'
[string "@FrameXML\UIParent.lua"]:2723: in function `SetUIPanel'
[string "@FrameXML\UIParent.lua"]:2529: in function `ShowUIPanel'
[string "@FrameXML\UIParent.lua"]:2436: in function <FrameXML\UIParent.lua:2432>
[string "=[C]"]: in function `SetAttribute'
[string "@FrameXML\UIParent.lua"]:3290: in function <FrameXML\UIParent.lua:3273>
[string "=[C]"]: in function `ShowUIPanel'
[string "@Oilvl\Oilvl-v8.2.1 BFA.lua"]:5805: in function `?'
[string "@Oilvl\Oilvl-v8.2.1 BFA.lua"]:5952: in function <Oilvl\Oilvl.lua:5951>

Locals:
(*temporary) = nil
(*temporary) = nil
(*temporary) = "Sushi-3.1"
(*temporary) = nil
(*temporary) = "attempt to index field 'Clickable' (a nil value)"


1x Blitz\libs\Sushi-3.1-3\classes\buttons\Help.lua:20: attempt to index field 'Clickable' (a nil value)
[string "@Blitz\libs\Sushi-3.1-3\classes\buttons\Help.lua"]:20: in main chunk
[string "=[C]"]: ?
[string "=[C]"]: in function `LoadAddOn'
[string "@Blitz\addons\main\main.lua"]:45: in function <Blitz\addons\main\main.lua:44>
[string "=[C]"]: in function `Show'
[string "@FrameXML\UIParent.lua"]:2723: in function `SetUIPanel'
[string "@FrameXML\UIParent.lua"]:2529: in function `ShowUIPanel'
[string "@FrameXML\UIParent.lua"]:2436: in function <FrameXML\UIParent.lua:2432>
[string "=[C]"]: in function `SetAttribute'
[string "@FrameXML\UIParent.lua"]:3290: in function <FrameXML\UIParent.lua:3273>
[string "=[C]"]: in function `ShowUIPanel'
[string "@Oilvl\Oilvl-v8.2.1 BFA.lua"]:5805: in function `?'
[string "@Oilvl\Oilvl-v8.2.1 BFA.lua"]:5952: in function <Oilvl\Oilvl.lua:5951>

Locals:
(*temporary) = nil
(*temporary) = nil
(*temporary) = "Sushi-3.1"
(*temporary) = nil
(*temporary) = <table> {
}
(*temporary) = "attempt to index field 'Clickable' (a nil value)"


1x Blitz\libs\Sushi-3.1-3\classes\buttons\Red.lua:20: attempt to index field 'TextedClickable' (a nil value)
[string "@Blitz\libs\Sushi-3.1-3\classes\buttons\Red.lua"]:20: in main chunk
[string "=[C]"]: ?
[string "=[C]"]: in function `LoadAddOn'
[string "@Blitz\addons\main\main.lua"]:45: in function <Blitz\addons\main\main.lua:44>
[string "=[C]"]: in function `Show'
[string "@FrameXML\UIParent.lua"]:2723: in function `SetUIPanel'
[string "@FrameXML\UIParent.lua"]:2529: in function `ShowUIPanel'
[string "@FrameXML\UIParent.lua"]:2436: in function <FrameXML\UIParent.lua:2432>
[string "=[C]"]: in function `SetAttribute'
[string "@FrameXML\UIParent.lua"]:3290: in function <FrameXML\UIParent.lua:3273>
[string "=[C]"]: in function `ShowUIPanel'
[string "@Oilvl\Oilvl-v8.2.1 BFA.lua"]:5805: in function `?'
[string "@Oilvl\Oilvl-v8.2.1 BFA.lua"]:5952: in function <Oilvl\Oilvl.lua:5951>

Locals:
(*temporary) = nil
(*temporary) = nil
(*temporary) = "Sushi-3.1"
(*temporary) = nil
(*temporary) = <table> {
}
(*temporary) = 3
(*temporary) = nil
(*temporary) = "attempt to index field 'TextedClickable' (a nil value)"


1x Blitz\libs\Sushi-3.1-3\classes\buttons\Gray.lua:20: attempt to index field 'RedButton' (a nil value)
[string "@Blitz\libs\Sushi-3.1-3\classes\buttons\Gray.lua"]:20: in main chunk
[string "=[C]"]: ?
[string "=[C]"]: in function `LoadAddOn'
[string "@Blitz\addons\main\main.lua"]:45: in function <Blitz\addons\main\main.lua:44>
[string "=[C]"]: in function `Show'
[string "@FrameXML\UIParent.lua"]:2723: in function `SetUIPanel'
[string "@FrameXML\UIParent.lua"]:2529: in function `ShowUIPanel'
[string "@FrameXML\UIParent.lua"]:2436: in function <FrameXML\UIParent.lua:2432>
[string "=[C]"]: in function `SetAttribute'
[string "@FrameXML\UIParent.lua"]:3290: in function <FrameXML\UIParent.lua:3273>
[string "=[C]"]: in function `ShowUIPanel'
[string "@Oilvl\Oilvl-v8.2.1 BFA.lua"]:5805: in function `?'
[string "@Oilvl\Oilvl-v8.2.1 BFA.lua"]:5952: in function <Oilvl\Oilvl.lua:5951>

Locals:
(*temporary) = nil
(*temporary) = nil
(*temporary) = "Sushi-3.1"
(*temporary) = nil
(*temporary) = "attempt to index field 'RedButton' (a nil value)"

Question: Dropdown taints

I have just stumbled upon this project of yours and am wondering ... Considering the enormous taint issues involved in Dropdown menus and the likes, did you consider this?
I've just had a peek at the code and it seems you rely on Blizzard's Dropdown menu API calls.

I've been looking for functioning dropdowns for a while and don't really want to rely on LibDropDown's predefined table format, so your framework would be heaven-sent if it does work as intended :)

Messed up backdrop texture & Missing CloseDropDownMenus issue

I am trying to use the dropdown class and I am having some issues. I am using the example code from the wiki page.

1.: After selecting an item I need two clicks on the arrow button to show the dropdown menu again. Adding the following line after line 104 in DropdownFrame.lua fixes this for me (this is the line with self:SetShown(data.keepShownOnClick)). Don't know if it is the correct position though: if not data.keepShownOnClick then CloseDropDownMenus() end

2.: After selecting an item and then clicking the arrow button again (twice, with the above issue) to show the menu will display the dropdown menu, but the backdrop texture will be all messed up (see the attached image). Just clicking the arrow button (without selecting any items) will display it just fine.
image

Shadowlands, 9.0.1 errors:

Date: 2020-08-29 13:23:05
ID: 1
Error occured in: Global
Count: 1
Message: ...PetTracker\libs\Sushi-3.1\classes\drops\Dropdown.lua line 136:
Invalid data provided for :SetBackdrop
Debug:
[string "=[C]"]: assert()
[string "@PetTracker\libs\Sushi-3.1\classes\drops\Dropdown.lua"]:136: SetBackdrop()
[string "@PetTracker\libs\Sushi-3.1\classes\drops\Dropdown.lua"]:48: New()
[string "@PetTracker\libs\Sushi-3.1\classes\drops\Dropdown.lua"]:57: Toggle()
[string "@PetTracker\addons\main\features\mapSearch.lua"]:124: ToggleTrackingTypes()
[string "@PetTracker\addons\main\features\mapSearch.lua"]:71:
...AddOns\PetTracker\addons\main\features\mapSearch.lua:71
Locals:
(*temporary) = false
(*temporary) = "Invalid data provided for :SetBackdrop"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.