Skip to content

Commit

Permalink
Use window created by context menu for view requests (#3213)
Browse files Browse the repository at this point in the history
* Use window created by context menu for view requests

Prevents creating a ghost DFrame that lingers eternally every time the View Requests button is pressed

* Fix View Request menu duplication

* Fix linter warnings

---------

Co-authored-by: github-is-garbage <[email protected]>
Co-authored-by: Redox <[email protected]>
  • Loading branch information
3 people authored Dec 10, 2024
1 parent 254aa69 commit 43fc8dd
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lua/wire/client/e2_viewrequest_menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ end)
list.Set("DesktopWindows", "WireExpression2_ViewRequestMenu", {
title = "View Requests",
icon = "beer/wiremod/gate_e2", -- Use whatever icon you want here, I just picked my favourite out of the available E2 ones
onewindow = true,

init = function(icon, window)
local container = vgui.Create("DFrame")
container:SetTitle("Expression 2 View Requests")
window:SetTitle("Expression 2 View Requests")

container:SetSize(ScrW() * 0.3, ScrH() * 0.6)
container:SetSizable(true)
container:SetMinWidth(ScrW() * 0.1)
container:SetMinHeight(ScrH() * 0.2)
window:SetSize(ScrW() * 0.3, ScrH() * 0.6)
window:SetSizable(true)
window:SetMinWidth(ScrW() * 0.1)
window:SetMinHeight(ScrH() * 0.2)

container:Center()
container:MakePopup()
window:Center()

local reqList = vgui.Create("DListView", container)
local reqList = vgui.Create("DListView", window)
reqList:Dock(FILL)
reqList:SetMultiSelect(false)

Expand Down Expand Up @@ -99,7 +99,7 @@ list.Set("DesktopWindows", "WireExpression2_ViewRequestMenu", {
end

mnu:AddOption("Accept Once", function()
local confirm = Derma_Query(
Derma_Query(
"Are you SURE you want "..line.initiator:Nick().." to have complete access to the code in your chip '"..viewRequests[line.initiator][line.chip].name.."'?\nThis means they are able to steal and redistribute it, so you should only do this if you are certain you can trust them",
"Confirm",
"Yes", function()
Expand All @@ -113,7 +113,7 @@ list.Set("DesktopWindows", "WireExpression2_ViewRequestMenu", {
)
end)
mnu:AddOption("Accept Always", function()
local confirm = Derma_Query(
Derma_Query(
"Are you SURE you want "..line.initiator:Nick().." to have complete access to the code in your chip '"..viewRequests[line.initiator][line.chip].name.."' for the duration the chip entity exists?\nThis means they are able to steal and redistribute it, as well as view any modifications you make to the chip, so you should only do this if you are certain you can trust them",
"Confirm",
"Yes", function()
Expand Down

0 comments on commit 43fc8dd

Please sign in to comment.