WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   NoTaint_UIDropDownMenu conflicts with MoveAnything (https://www.wowinterface.com/forums/showthread.php?t=55387)

Ketho 05-10-17 08:09 PM

NoTaint_UIDropDownMenu conflicts with MoveAnything
 
I recently updated WardrobeSort but one of the older versions had a conflict with MoveAnything and Z-Perl
...at least the (bad) way I tried to grab the text from the dropdown did not work with the version / shared globals from MoveAnything
How we are supposed to embed NoTaint_UIDropDownMenu? (WoWI/Curse)
Since it's not using LibStub and is not on a repository :confused:

This makes me wonder what version of this library MoveAnything is usingElvUI embeds a slightly modified version of this library but it doesn't give any of the same problems when loaded

Would it otherwise be better to use MSA-DropDownMenu?

arith 05-11-17 01:06 AM

MoveEverything is not using the "NoTaint_UIDropDownMenu" published on WowInterface or CurseForge. This may not be very accurate, but based on one of the comment Resike posted, I would guess he got one of of the early version and then maintained his own revision within MoveEverything. That probably is because the original "author" (who created the project) did not keep updating it.

"NoTaint_UIDropDownMenu" is meant to provide a replacement for all UIDropDown related functions, or says it is to provide an alternative, kind of a clone version with different function name. So it was not packaged or created with a common lib we saw likes to use LibStub to call NewLibrary function.

To use NoTaint_UIDropDownMenu, 1st thing is to include it in ToC or one of your library XML with the following order:
  • UIDropDownMenuTemplates.xml
  • UIDropDownMenu.lua

Then, the usage would be exactly the same like the way you use the Blizzard's UIDropDownMenu.

A few examples:
1.
local info = Lib_UIDropDownMenu_CreateInfo()
This is one of the suggested way that you get a clean info to be used for the menu setting. The function call should has "Lib_" as the prefix.

2.
Lib_UIDropDownMenu_AddButton(info)
Once your menu setting is done, you use this function to add the button.

3.
LIB_UIDROPDOWNMENU_MENU_VALUE
If you need to use the constant, you need "LIB_" as the prefix.

You can refer to this old thread on WowAce: https://forums.wowace.com/showthread.php?t=15763
And also refer to the usage explanation here.

If you would like to see some more examples or codes, maybe one of my addon could help: https://wow.curseforge.com/projects/...cking-enhanced

I seldom enable MoveEverything while in WoW, but I can guess there could be some conflit with NoTaint_UIDropDown, since both use the same function prefix.

The one I maintained is trying to sync with Blizzard's version, so where there is any new function added (such as UIDropDownMenu_AddSeparator() ), I will do the same.

Hope this helps.

arith 05-11-17 02:41 AM

I spent a few time reading to the issue posted in your addon project, and did some test with MoveEverything and some of my addons which also use NoTaint_UIDropDown (such as Accountant Classic, or World Map Tracking Enhanced), I found something weird.
If I disable all addons, but only enable WardrobeSort and Accountant Classic (which we use exactly the same version of NoTaint_UIDropDown), and when I visit the transmogrifer and the UI pop-up, clicking on the Sort By menu, I can see the menu items from Accountant Classic is also showing there.
I am not sure where is going wrong, but this is the first time I saw such issue. I will look into the codes in my addons although I am not sure if there is anything wrong there.

Resike 05-11-17 03:48 AM

I do actually use an older version of the notaint dropdowns (my cleaned up version), since i didn't know there was an updated one. Using the two different libs together at the same time could cause some issues for sure, since they share global functions.

I'll try this new library since it might have some issues by it's own, so it needs some testing.
The old versions works fine 100%, but only if it's not used together with the new one.

Ketho 05-11-17 03:51 AM

Quote:

Originally Posted by arith (Post 323315)
I spent a few time reading to the issue posted in your addon project, and did some test with MoveEverything and some of my addons which also use NoTaint_UIDropDown (such as Accountant Classic, or World Map Tracking Enhanced), I found something weird.
If I disable all addons, but only enable WardrobeSort and Accountant Classic (which we use exactly the same version of NoTaint_UIDropDown), and when I visit the transmogrifer and the UI pop-up, clicking on the Sort By menu, I can see the menu items from Accountant Classic is also showing there.


That sounds weird... I tried to test this but I couldn't reproduce it yet

https://gfycat.com/AbsoluteAdeptCurassow

-----

About the issue, I was badly grabbing the text from the dropdown,
I tried to index the Text field but it apparently doesn't exist when MoveAnything's version is also loaded
Lua Code:
  1. local dropdown = CreateFrame("Frame", "TestDropDown", UIParent, "Lib_UIDropDownMenuTemplate")
  2. Lib_UIDropDownMenu_SetText(dropdown, "Hello World")
  3. print(Lib_UIDropDownMenu_GetText(dropdown))
  4. print(dropdown.Text:GetText())
Code:

Message: ..\AddOns\WardrobeSort\WardrobeSort.lua line 4:
  attempt to index field 'Text' (a nil value)


Ketho 05-11-17 03:52 AM

Quote:

Originally Posted by Resike (Post 323316)
I do actually use an older version of the notaint dropdowns (my cleaned up version), since i didn't know there was an updated one. Using the two different libs together at the same time could cause some issues for sure, since they share global functions.


Thanks for clarifying, Resike :)

Resike 05-11-17 04:10 AM

Quote:

Originally Posted by Ketho (Post 323318)
Thanks for clarifying Resike :)

Tha main issue on your part is that, since (alphabetically) Z-Perl loads last, and overrides all the global funcions (within an evil laugh) so you think you are working with the new lib functions but you really not. :)

The problems:
If any addon will update to a newer version of the lib it will always cause troubles since the global namespace.
The lib designed to work as a standalone lib, however it looks dumb if you just add another folder to your addon, and not incude it inside. And other addons would blindly owerwrite this lib to their versions.
If you think the users will properly install/update and use this lib as a standalone nolib, thats not gonna work either.

Mainly thats why i went and any of my new addons i'll use my own dropdown functions with no global access and whatsoever. However currently i still have 3 old addons which depending on this lib.

Now i wonder how the hell did nobody reported this issue for me for 5 months?

arith 05-11-17 04:19 AM

for the issue that Accountant Classic's menu will be showing in WardrobeSort, I can do some enhancement to see if the problem will be gone.
But like Resike said, even with the NoTaint_UIDropDown which I revised, still need some more test as I can 100% sure it should work just fine.

For your information, I did add some enhancement in the function Lib_UIDropDownMenu_AddButton():
1.
old codes:
Lua Code:
  1. ....
  2.     local listFrame = _G["DropDownList"..level];
  3.     local index = listFrame and (listFrame.numButtons + 1) or 1;
  4.     local width;
new codes:
Lua Code:
  1. ....
  2.     local index;
  3.     local listFrame = _G["Lib_DropDownList"..level];
  4.     if (listFrame and listFrame.numButtons) then
  5.         index = listFrame.numButtons + 1;
  6.     else
  7.         index = 1;
  8.     end
  9.     local width;

2.
old codes:
Lua Code:
  1. ....
  2.     width = max(UIDropDownMenu_GetButtonWidth(button), info.minWidth or 0);
  3.     --Set maximum button width
  4.     if ( width > listFrame.maxWidth ) then
  5.         listFrame.maxWidth = width;
  6.     end
new codes:
Lua Code:
  1. ....
  2.     width = max(Lib_UIDropDownMenu_GetButtonWidth(button), info.minWidth or 0);
  3.     --Set maximum button width
  4.     if ( listFrame.maxWidth and width > listFrame.maxWidth ) then
  5.         listFrame.maxWidth = width;
  6.     end

Ketho 05-11-17 04:43 AM

Looking forward to the update. It's nice to not die from taint =)

Resike 05-11-17 05:09 AM

Quote:

Originally Posted by Ketho (Post 323321)
Looking forward to the update. It's nice to not die from taint =)

Do you still need any help how to use the lib itself, or everything works now if you disable other addons with older notaint lib?

I did some testing the the new dropdown lib seems okay atm. Will push an update with it for my addons.

On sidenote, currently the biggest addon which still taints the dropdowns is OmniCC (which could blame some other addons for the taint), however only in it's config function so if you disable OmniCC Config you are golden. I'll talk with Tuller to fix this tho.

Ketho 05-11-17 05:25 AM

Quote:

Originally Posted by Resike (Post 323322)
Do you still need any help how to use the lib itself, or everything works now if you disable other addons with older notaint lib?


It looks like everything is working fine now after that commit even with MoveAnything / Z-Perl loaded

But I originally didn't use the lib properly anyway ;)

Resike 05-11-17 06:10 AM

Quote:

Originally Posted by arith (Post 323315)
I spent a few time reading to the issue posted in your addon project, and did some test with MoveEverything and some of my addons which also use NoTaint_UIDropDown (such as Accountant Classic, or World Map Tracking Enhanced), I found something weird.
If I disable all addons, but only enable WardrobeSort and Accountant Classic (which we use exactly the same version of NoTaint_UIDropDown), and when I visit the transmogrifer and the UI pop-up, clicking on the Sort By menu, I can see the menu items from Accountant Classic is also showing there.
I am not sure where is going wrong, but this is the first time I saw such issue. I will look into the codes in my addons although I am not sure if there is anything wrong there.

This could mean that one of the addons is not using some calls properly using the Lib_ and the standard Blizzard functions at the same time.

If you call ToggleDropDownMenu and Lib_ToggleDropDownMenu at the same time that would populate the menu twice, which could cause some elements to stuck there even if you open another dropdown. Because the Blizzard funcitons might still think the dropdown is open, while the lib thinks the dropdown is closed.

arith 05-11-17 09:29 AM

Tested with WardrobeSort + Accountant Classic or WardrobeSort + Atlas, somehow the menu item from other addon will be showing in WardrobeSort's menu.
See the screenshot:

My solution for both of my addons is to move the Lib_UIDropDownMenu_Initialize() from the addon or the frame's OnLoad to OnShow. Doesn't make much sense to me though...

Resike 05-11-17 11:09 AM

I can also reproduce it it seems like if you open dropdown with more then 8 elements then open a smaller one while the bigger dropdown is opened, and if they use the same template and two dropdown is populated by two different addons (you still wih me? :P), then it will only clear the info for the first 8 elements, and show any older info from element 9 to the size of the previous dropdown.

I'm not sure where is the issue tho.

Ketho 05-11-17 04:54 PM

Quote:

Originally Posted by Ketho (Post 323317)
That sounds weird... I tried to test this but I couldn't reproduce it yet

https://gfycat.com/AbsoluteAdeptCurassow

Only now I realize I was looking at the Ace3 dropdowns instead of the Accountant Classic NoTaint_UIDropDownMenu dropdowns /facepalm

Quote:

Originally Posted by arith (Post 323327)
Tested with WardrobeSort + Accountant Classic or WardrobeSort + Atlas, somehow the menu item from other addon will be showing in WardrobeSort's menu.

I still have no idea why that was happening even after reading your posts or where the issue lies. Hopefully it's not because WardrobeSort (LoadOnDemand) is initializing the dropdowns on WardrobeCollectionFrame.ItemsCollectionFrame:HookScript("OnShow", func) or something

arith 05-12-17 12:02 AM

Quote:

Originally Posted by Ketho (Post 323333)
I still have no idea why that was happening even after reading your posts or where the issue lies. Hopefully it's not because WardrobeSort (LoadOnDemand) is initializing the dropdowns on WardrobeCollectionFrame.ItemsCollectionFrame:HookScript("OnShow", func) or something

Not sure if it's related to the hootscript, but I also suspect it could related to the customized codes below:
Lua Code:
  1. for i = 1, LIB_UIDROPDOWNMENU_MAXLEVELS do
  2.     local listFrameName = "Lib_DropDownList"..i;   
  3.     local f = CreateFrame("Button", listFrameName, nil, "Lib_UIDropDownListTemplate");
  4.     f:SetID(i);
  5.     f:SetSize(180, 10);
  6.     f:SetFrameStrata("FULLSCREEN_DIALOG");
  7.     local fontName, fontHeight, fontFlags = _G["Lib_DropDownList1Button1NormalText"]:GetFont();
  8.     LIB_UIDROPDOWNMENU_DEFAULT_TEXT_HEIGHT = fontHeight;
  9.     for j = 1, LIB_UIDROPDOWNMENU_MAXBUTTONS do
  10.         local b = CreateFrame("Button", listFrameName.."Button"..j, f, "Lib_UIDropDownMenuButtonTemplate");
  11.         b:SetID(j);
  12.     end
  13. end

This was added in the very early version of the NoTaint_DropDownMenu.

arith 05-12-17 01:43 AM

Guys, could you try the latest revision on SVN Repository here?
svn://svn.wowinterface.com/NoTaint_UIDropDownMenu_Update-1134/trunk

I think by adding UIDropDownMenu.xml back might be a good idea.
With revision 16, you will need to load UIDropDownMenu.xml instead of loading UIDropDownMenuTemplates.xml and UIDropDownMenu.lua.
I also remove the customized codes, tried tested in my addons Accountant Classic, Atlas, and also tested in WardrobeSort, everything looks fine.

Though this didn't resolve the menu item from Accountant Classic or Atlas showing in WardrobeSort's dropdown.
I look into the UIDropDownMenu.lua and UIDropDownMenuTemplates.xml deeper, the default codes assume the max button to be 8 and will do some initialization. The default codes also can handle the situation when menu item is greater than 8.
It looks a little bit confused as the constant LIB_UIDROPDOWNMENU_MAXBUTTONS was set to 8, but it also will grow when you have more than 8 menu items to be showed.

I think maybe it's a design issue in my addons that I should not do the menu initialization in OnLoad event, instead, should do it in OnShow? I can't say it for sure as I can see Blizzard's EncounterJournal also do the menu initialization in OnLoad event.
Anyway, I will change my codes in my addons to manage the menu initialization in OnShow as it looks to resolve the conflict issue with WardrobeSort.

BTW, Titan is also using NoTaint_UIDropDown, I will inform the author to update the library.

HonorGoG 05-12-17 03:30 AM

Quote:

Originally Posted by arith (Post 323340)
BTW, Titan is also using NoTaint_UIDropDown, I will inform the author to update the library.

Thanks for the heads-up Arith. I'll get the updated lib into Titan Panel ASAP and push out an update.

arith 05-12-17 05:13 AM

Just commit revision 17 to add LibStub and introduce LibStub:NewLibrary to set version number.
Since LibStub has been used, this will need to be loaded after LibStub.
Please test it and let me know if any issue.

Resike 05-12-17 01:37 PM

Quote:

Originally Posted by arith (Post 323344)
Just commit revision 17 to add LibStub and introduce LibStub:NewLibrary to set version number.
Since LibStub has been used, this will need to be loaded after LibStub.
Please test it and let me know if any issue.

I think the issue is that every addon has it's own functions and sometimes the library calls a function from on addon's file, and sometimes from an another addons file, which could create mismatch numbers even in global variables. If every addon updates to a version which won't let the lib load twice or load an older versions the issue will be gone.

You can eliminate the problem by putting this hack into the Lib_ToggleDropDownMenu funcitons, however you gonna need to put this into every addon's function:

Lua Code:
  1. for i = listFrame.numButtons + 1, 1000 do
  2.     local button = _G["Lib_DropDownList"..level.."Button"..i]
  3.     if button then
  4.         button:Hide()
  5.     else
  6.         break
  7.     end
  8. end

Also this only deals with the visible issues the global mismatch between addons still gonna reamain. The total solution is that the versioning system which will only allow one instance of the lib and it's functions.

Ketho 05-12-17 03:27 PM

Quote:

Originally Posted by arith (Post 323344)
Just commit revision 17 to add LibStub and introduce LibStub:NewLibrary to set version number.
Since LibStub has been used, this will need to be loaded after LibStub.
Please test it and let me know if any issue.


Don't know if I'm doing something wrong, but I can't get Curse to package when I add the .pkgmeta external
Code:

package-as: WardrobeSort

externals:
  Libs/LibStub: svn://svn.wowace.com/wow/ace3/mainline/trunk/LibStub
  Libs/NoTaint_UIDropDownMenu: svn://svn.wowinterface.com/NoTaint_UIDropDownMenu_Update-1134/trunk

move-folders:
  WardrobeSort/Data: WardrobeSortData


When I tested it with just LibStub, it packaged but not after adding NoTaint_UIDropDownMenu

I could still access svn://svn.wowinterface.com/NoTaint_U...ate-1134/trunk from the SVN browser at least

Resike 05-12-17 03:40 PM

I'm not sure if you can actually pull data from wowi in the curse packager, never tried it.

Ketho 05-14-17 11:52 PM

Arith I don't know where is the best place to post tickets, I don't see any place for that on wowi / curse

I'm getting 2 errors with 7.2.0.24015, no clue what's going wrong
https://gist.github.com/anonymous/85...65d2c4909c1d11
Code:

Message: ...eSort\Libs\NoTaint_UIDropDownMenu\UIDropDownMenu.lua line 73:
  attempt to index local 'dropDownList' (a nil value)
Debug:
  ...eSort\Libs\NoTaint_UIDropDownMenu\UIDropDownMenu.lua:73:
      ...eSort\Libs\NoTaint_UIDropDownMenu\UIDropDownMenu.lua:59
  [C]: ?
  ...eSort\Libs\NoTaint_UIDropDownMenu\UIDropDownMenu.lua:88: Lib_UIDropDownMenu_Initialize()
  WardrobeSort\WardrobeSort.lua:184:
      WardrobeSort\WardrobeSort.lua:180
  WardrobeSort\WardrobeSort.lua:225:
      WardrobeSort\WardrobeSort.lua:209


https://gist.github.com/anonymous/7a...88e5346908eb43
Code:

Message: ...eSort\Libs\NoTaint_UIDropDownMenu\UIDropDownMenu.lua line 310:
  attempt to index local 'listFrame' (a nil value)
Debug:
  ...eSort\Libs\NoTaint_UIDropDownMenu\UIDropDownMenu.lua:310: Lib_UIDropDownMenu_AddButton()
  WardrobeSort\WardrobeSort.lua:198: initFunction()
  ...eSort\Libs\NoTaint_UIDropDownMenu\UIDropDownMenu.lua:93: Lib_UIDropDownMenu_Initialize()
  WardrobeSort\WardrobeSort.lua:184:
      WardrobeSort\WardrobeSort.lua:180
  WardrobeSort\WardrobeSort.lua:225:
      WardrobeSort\WardrobeSort.lua:209


Quote:

Originally Posted by Resike (Post 323353)
I'm not sure if you can actually pull data from wowi in the curse packager, never tried it.


Yeah, I guess it probably would be a security liability anyway if that was possible

arith 05-15-17 12:16 AM

Hi there,
* curseforge / wowace's .pkgmeta
I forgot to mention, adding external in .pkgmeta won't work. Probably due to cueseforge / wowace don't allow to pull external lib from wowinterface, or due to it's using "svn://".
So don't add it in .pkgmeta. For me I set the external in my lib folder's "external" property. But this probably only works for SVN repository.

* errors regarding to "dropdownList" and "listFrame"
Please include UIDropDownMenu.xml to your toc file only. The new change now need to load this file.

Ketho 05-15-17 12:44 AM

Quote:

Originally Posted by arith (Post 323392)
* errors regarding to "dropdownList" and "listFrame"
Please include UIDropDownMenu.xml to your toc file only. The new change now need to load this file.


Oops, thanks! It's working fine now :o

HonorGoG 05-17-17 12:03 AM

Strange Error
 
So I put in the new library and people complained about an error. Yep, I forgot to modify the .toc file to load the new xml file only. So I did that and continued testing. To make sure there are no conflicts with other addons, I'm only loading Swatter and Titan Panel. Now I'm seeing the following and I have no idea why this is happening as I don't see anything wrong with the xml file. But, it's late and work is pounding on me hard this week so my brain is pretty much fried by the time I get home. Any ideas?

Code:

Date: 2017-05-16 22:55:50
ID: 1
Error occured in: Global
Count: 1
Message: ..\AddOns\Titan\libs\NoTaint_UIDropDownMenu\UIDropDownMenu.xml line 1:
  unexpected symbol near '<'
Debug:
 
Locals:

AddOns:
  Swatter, v7.4.5714 (TasmanianThylacine)
  Titan, v5.11.4.70200
  BlizRuntimeLib_enUS v7.2.0.70200 <none>
  (ck=6b)


arith 05-17-17 12:14 AM

Quote:

Originally Posted by HonorGoG (Post 323426)
So I put in the new library and people complained about an error. Yep, I forgot to modify the .toc file to load the new xml file only. So I did that and continued testing. To make sure there are no conflicts with other addons, I'm only loading Swatter and Titan Panel. Now I'm seeing the following and I have no idea why this is happening as I don't see anything wrong with the xml file. But, it's late and work is pounding on me hard this week so my brain is pretty much fried by the time I get home. Any ideas?

Code:

Date: 2017-05-16 22:55:50
ID: 1
Error occured in: Global
Count: 1
Message: ..\AddOns\Titan\libs\NoTaint_UIDropDownMenu\UIDropDownMenu.xml line 1:
  unexpected symbol near '<'
Debug:
 
Locals:

AddOns:
  Swatter, v7.4.5714 (TasmanianThylacine)
  Titan, v5.11.4.70200
  BlizRuntimeLib_enUS v7.2.0.70200 <none>
  (ck=6b)



I look at your ToC file and you use embeds.xml to specify the path for libraries.
So then I look into the embeds.xml, my best guess it's you specify it by using Script:
Code:

<Script file="libs\NoTaint_UIDropDownMenu\UIDropDownMenu.xml"/>
You should use Include:
Code:

<Include file="libs\NoTaint_UIDropDownMenu\UIDropDownMenu.xml"/>
I did a test and once change it to Include, then everything works great.

arith 05-24-17 10:12 PM

Alright, just cloned and created a new one: https://www.wowace.com/projects/libuidropdownmenu
and the one in WowInterface: http://www.wowinterface.com/download...pDownMenu.html
SVN source:
Code:

https://repos.wowace.com/wow/libuidropdownmenu/trunk
I hope this will make things easier.

Ketho 05-25-17 09:44 AM

Quote:

Originally Posted by arith (Post 323539)
I hope this will make things easier.


The new lib is working fine thanks :)
https://github.com/Ketho/WardrobeSor...48a81dccadc810
https://www.wowace.com/projects/ward.../files/2424630

arith 05-25-17 10:35 AM

Quote:

Originally Posted by Ketho (Post 323549)

Good to know.


All times are GMT -6. The time now is 12:01 PM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI