Skip to content

Geyser:show only unhidden children#3336

Merged
vadi2 merged 2 commits intoMudlet:developmentfrom
Edru2:Geyser
Feb 21, 2020
Merged

Geyser:show only unhidden children#3336
vadi2 merged 2 commits intoMudlet:developmentfrom
Edru2:Geyser

Conversation

@Edru2
Copy link
Copy Markdown
Member

@Edru2 Edru2 commented Feb 12, 2020

Brief overview of PR changes/additions

When using container:show() hidden elements also will appear.
With this change the elements which have the property hidden will stay hidden.

Motivation for adding to Mudlet

Especially when using the GUIFrame with anitimer or other elements which use hide()
it can cause a mess to show everything. The problem appeared on Discord
for example:
Brax Last Sunday at 10:12
I am playing with anitimers in the drag and drop framework, if I drag a container all the 'dead' timers reappear ? What am I doing wrong hehe

Other info (issues closed, discussion etc)

@Edru2 Edru2 requested a review from a team February 12, 2020 18:02
@add-deployment-links
Copy link
Copy Markdown

add-deployment-links bot commented Feb 12, 2020

Hey there! Thanks for helping Mudlet improve. 🌟

Test versions

You can directly test the changes here:

No need to install anything - just unzip and run.
Let us know if it works well, and if it doesn't, please give details.

@vadi2
Copy link
Copy Markdown
Member

vadi2 commented Feb 13, 2020

@wiploo @Xekon can you help test that this doesn't break your geyser interfaces?

@vadi2
Copy link
Copy Markdown
Member

vadi2 commented Feb 13, 2020

@Edru2 can you provide a way to replicate the original problem / see what your fix does?

Based on your description I've made the following:

function makestuff()
  testlabel = Geyser.Label:new({
    name = "testlabel",
    x = "25%", y = "25%",
    width = "50%", height = "50%",
    fgColor = "black",
    message = "<center>heey</center>"
  })
  testlabel:setColor(0,255,0,150)
  
  testlabel2 = Geyser.Label:new({
    name = "testlabel2",
    x = "25%", y = "25%",
    width = "50%", height = "50%",
    fgColor = "black",
    message = "<center>heey</center>"
  }, testlabel2)
  
  testlabel2:hide()
  testlabel:show()
end

At the end however only testlabel is showing, not testlabel2 as you say it would - using latest Mudlet.

@demonnic
Copy link
Copy Markdown
Member

demonnic commented Feb 13, 2020

@Edru2 can you provide a way to replicate the original problem / see what your fix does?

Based on your description I've made the following:

function makestuff()
  testlabel = Geyser.Label:new({
    name = "testlabel",
    x = "25%", y = "25%",
    width = "50%", height = "50%",
    fgColor = "black",
    message = "<center>heey</center>"
  })
  testlabel:setColor(0,255,0,150)
  
  testlabel2 = Geyser.Label:new({
    name = "testlabel2",
    x = "25%", y = "25%",
    width = "50%", height = "50%",
    fgColor = "black",
    message = "<center>heey</center>"
  }, testlabel2)
  
  testlabel2:hide()
  testlabel:show()
end

At the end however only testlabel is showing, not testlabel2 as you say it would - using latest Mudlet.

You accidentally set testlabel2 as the parent for itself(actually, I think nil because it isn't defined yet when it's run), I think this is saying testlabel2 will show is testlabel is the parent.

@vadi2
Copy link
Copy Markdown
Member

vadi2 commented Feb 13, 2020

Good find - though it still works as expected with:

function makestuff()
  testlabel = Geyser.Label:new({
    name = "testlabel",
    x = "25%", y = "25%",
    width = "50%", height = "50%",
    fgColor = "black",
    message = "<center>heey</center>"
  })
  testlabel:setColor(0,255,0,150)
  
  testlabel2 = Geyser.Label:new({
    name = "testlabel2",
    x = "25%", y = "25%",
    width = "50%", height = "50%",
    fgColor = "black",
    message = "<center>heey</center>"
  }, testlabel)
  
  testlabel2:hide()
  testlabel:show()
end

@demonnic
Copy link
Copy Markdown
Member

ahh, indeed. Just tested it myself and it seems to be working as expected.

@Edru2
Copy link
Copy Markdown
Member Author

Edru2 commented Feb 13, 2020

I just noticed that it mostly only happens to Geyser.Gauges.
Also when the container is hidden a gauge is still be shown with gauge:show()

But in some cases it happened to me also for Labels but I don't know how to reproduce it.

testcont = testcont or Geyser.Container:new({x=50,y=50,width=500,height=500})
testlabel = testlabel or Geyser.Label:new({x=0,y=0,width=20,height=20,color = "green",fontSize=8},testcont)
testlabel2 = testlabel2  or Geyser.Label:new({x=20,y=0,width=20,height=20,color = "red"},testcont)
testlabel3 = testlabel3 or Geyser.Label:new({x=40,y=0,width=20,height=20,color="yellow"},testcont)
testgauge = testgauge or Geyser.Gauge:new({x=40,y=40,width=200,height=20,color="yellow"},testcont)
testgauge:hide()
testcont:show()
--still shows the testgauge

Edit:
Was able to reproduce it also with labels.

testcont = testcont or Geyser.Container:new({x=50,y=50,width=500,height=500})
testlabel = testlabel or Geyser.Label:new({x=0,y=0,width=30,height=30,color = "green",fontSize=8},testcont)
testinslabel = testinslabel  or Geyser.Label:new({x=0,y=0,width=20,height=20,color = "red"},testlabel)
testlabel2 = testlabel2 or Geyser.Label:new({x=40,y=0,width=20,height=20,color="yellow"},testcont)
testgauge = testgauge or Geyser.Gauge:new({x=40,y=40,width=200,height=20,color="yellow"},testcont)
testgauge:hide()
testlabel:hide()
testcont:show()
-- gauge and inside Label (red) are still shown

@vadi2 vadi2 changed the title Geyser:show Geyser:show only unhidden children Feb 13, 2020
@vadi2
Copy link
Copy Markdown
Member

vadi2 commented Feb 13, 2020

Some issue with this PR:

NyyrazzilyssToday at 17:22
@Vadi I've installed it. Believe I might be seeing some issues with it (I do use a complex geyser gui). Will confirm that it is specific to the new version later today and try and isolate the cause
NyyrazzilyssToday at 17:43
Hopefully it's not intended for incorporation this weekend. Will probably take me a few hours when I have a chance to figure out why it's happening, but I have a trigger that captures a series of lines into a hidden buffer, then on receipt of the final line in the set copys the buffer to a seperate window in the display - That's no longer displaying properly for me (window is just blank)
demonnicToday at 17:45
hmm, I don't think that would be effected by the change in that particular PR, that codepath should only be hit on using :show() against a Geyser object. May be something else that's made it into the development branch which is causing that
might see if you have the same problem in the latest branch snapshot from https://make.mudlet.org/snapshots/
NyyrazzilyssToday at 17:46
Any particular one I should install from there?
demonnicToday at 17:47

any of those
depending on your OS :slight_smile:
those should be whatever is already merged into the develop branch
NyyrazzilyssToday at 17:56
OK retested. Doesn't occur using the branch snapshot, it's only with the posted link. It occurs when I hide and then redislay that specific capture window
demonnicToday at 17:57
ahh ok, the way you said it I thought it was happening during the append and was like... that's not right
NyyrazzilyssToday at 17:57
It works properly before I hide it, but after I hide then show it again it's just a blank grey window
demonnicToday at 17:57
carry on then
NyyrazzilyssToday at 18:03
I update it by copying a buffer into it. I'll need to trace through things though to figure out where it's bugging
(i.e. it stops updating)
I'm guessing will end up related to how I build/show/hide the window

@Jieiku
Copy link
Copy Markdown
Contributor

Jieiku commented Feb 13, 2020

Just built with this pull request included, does not appear to have broken anything with my UI as far as I can tell.

My build is based on git clone of: https://github.com/Mudlet/Mudlet.git

So I just:

cd ~/source/Mudlet
git pull
git pull origin pull/3336/head
cd ~/source/Mudlet/build
qmake ../src/mudlet.pro
make -j `nproc`
sudo make install

@Edru2
Copy link
Copy Markdown
Member Author

Edru2 commented Feb 13, 2020

Yes this PR has issues just found out myself.

testcont = testcont or Geyser.Container:new({x=50,y=50,width=500,height=500})
testlabel = testlabel or Geyser.Label:new({x=0,y=0,width=30,height=30,color = "green",fontSize=8},testcont)
testlabel:hide()
testcont:hide()
testcont:show()
testlabel:show()
--label doesn't show anymore because auto_hide is still on

Sorry should have tested more :(
I think I have a solution but this time I will test more before I send it again.

It should work now as expected.
Testing needed.
@Edru2
Copy link
Copy Markdown
Member Author

Edru2 commented Feb 17, 2020

Should work now as expected.
But further testing is needed :)

@vadi2
Copy link
Copy Markdown
Member

vadi2 commented Feb 17, 2020

Awesome!

@Xekon mind retesting?

@Nyyrazzilyss
Copy link
Copy Markdown
Contributor

Installed the latest version. The problem I was seeing (after hiding then redisplaying a window) is no longer occuring for me.

@vadi2 vadi2 merged commit b7c569f into Mudlet:development Feb 21, 2020
@Edru2 Edru2 mentioned this pull request Mar 2, 2020
vadi2 added a commit that referenced this pull request Mar 3, 2020
@Edru2 Edru2 deleted the Geyser branch September 1, 2020 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants