Geyser VBox add and remove [solved]

takilara
Posts: 24
Joined: Tue Jul 28, 2020 10:23 pm

Re: Geyser VBox add and remove

Post by takilara »

ok thanks, sorry for being so dense:)
I have stripped down my settings massively so i can try to get this sorted :) (GUI programming is not my favourite thing :) havent found a "safe" way to reset the gui, so doing it in an offline profile...

To summarize:
  • :hide() is needed on the gauge to hide it (will leave a hole)
  • Vbox/Sortbox/Containers need to remove the child gauge to "adapt" (remove hole, or resize or re-sort etc). Child gauge referances is kept elsewhere in Geyser, but removed from the container.
  • A removed gauge can/cannot be reused, and must be recreated?

takilara
Posts: 24
Joined: Tue Jul 28, 2020 10:23 pm

Re: Geyser VBox add and remove

Post by takilara »

Update: got it to work now, using first gaugeObject:hide(), then containerObj:remove(gaugeObject) caused correct removal and resize of the container object.
Now on to utilizing the Elasticity :)
Thanks alot for the help!

User avatar
demonnic
Posts: 711
Joined: Sat Dec 05, 2009 3:19 pm

Re: Geyser VBox add and remove [solved]

Post by demonnic »

So, in general make sure you give all your Geyser objects a name. IE
Code: [show] | [select all] lua
myGauge = Geyser.Gauge:new({
  name = "myGauge",
})
This way, if you do recreate myGauge later, it will reuse the actual UI objects which were created originally.

But also even if you :hide() myGauge you can always :show() it later and :add(myGauge) on your sortbox/vbox/hbox to readd it after it has been removed.

So, to summarize

removing:
gauge:hide() -> box:remove(gauge)

readding:
box:add(gauge) -> gauge:show()

Should be all you need =)

takilara
Posts: 24
Joined: Tue Jul 28, 2020 10:23 pm

Re: Geyser VBox add and remove [solved]

Post by takilara »

Yes this should work, (i just need to change my initial creation code to understand if the gauge exists or not, then use add instead of new if it has already been created).

I have always had a name, plus an object reference. I am not certain of the significance of the name though, as i would belive the :add takes the object referance and not the name though?

Btw, I have seen you have opinions on the following matter :) where would i best stick the library files for me to use them in my settings? Note that I have some 10 profiles, using Module manager, and synced modules between all profiles. The XML's are synced between machines using git. I am not building settings for external consumption, only my own.
  • I could put them under each profile, in the MDK-1 folder (as i have done for initial testing), then require them as docs describe (e.g. local SortBox = require("MDK-1.sortbox") (this is abit clunky, at least in initial setup as i have multiple machines i run the same profiles on, should be fine during mudlet updates or new profiles (i tend to copy existing profile)
  • I could put them in the mudlet path, though this seems to be some weird hex-identifier after the mudlet version (c:\users\xxxx\AppData\Local\Mudlet\app-4.9.1-ptb9e6fdb7) (this would probably only require me to copy it in once, but might cause issues when i upgrade mutlet?
  • modify package.path temporarily (as demonstrated for Vyzor in viewtopic.php?p=21960#p21960)
thanks again :)

User avatar
demonnic
Posts: 711
Joined: Sat Dec 05, 2009 3:19 pm

Re: Geyser VBox add and remove [solved]

Post by demonnic »

10 profiles on multiple machines is a bit less wieldy than most. For that usecase I would probably clone the entire MDK to the same place on your harddrive and modify package.path temporarily.

If it's all just for you, you don't -have- to use local for the requires. I specifically do that because part of the MDK's point is to make it easy to use a version of class X without worrying if someone else has overwritten the global EMCO, for instance. Cloning the mdk git repo and adding the src directory to your package.path (even permanently) might make the most sense for you. Easy upgrades too.

takilara
Posts: 24
Joined: Tue Jul 28, 2020 10:23 pm

Re: Geyser VBox add and remove [solved]

Post by takilara »

Thanks,
I like that last proposal, Indeed i think i would prefer that for my own settings due to fairly frequent crashes while using the builtin editor.

However i believe i saw in a different thread that most packet maintainers were moving away from imported files in preference of mudlet editable scripts.
- This might just be because the topics in that discussion was for shareable code and not for developers though.

- Looking at the Vyzor example, are there ways to access folders relative to the mudlet application? or alternatively "up" from the profile, to have a common shared relative folder? (i could of course use something like c:\mudlet_libraries, but I would prefer something that follows the application or lives near the profiles without living inside the profiles)

- Will a require("lua source file") reload the external file when saved inside Mudlet? Or will updating be more clunkly when using external files (i dont want to have to restart mudlet to reload after change)
(ideally i might build something that monitors the timestamp of the file, and re-requires upon change) (given that it is possible to reload by re-requiring)

User avatar
demonnic
Posts: 711
Joined: Sat Dec 05, 2009 3:19 pm

Re: Geyser VBox add and remove [solved]

Post by demonnic »

You have to do a little bit more work to re-require, as it caches the result as an optimization to not load the same code in four times.

As for whether folks are moving towards or away from using .lua files, it seems to largely be a matter of preference. For most people (non developers) I tend to recommend they just use the Mudlet editor. I still think the right path for most people is using the built in editor and not complicate their lives.

But if you're a developer, know what you're doing, and care to muck about with it, the below will actually do a reload of the myModule module via require.
Code: [show] | [select all] lua
package.loaded["myModule") = nil
require("myModule")

User avatar
Zaphob
Posts: 151
Joined: Wed May 09, 2012 8:07 am
Location: mg.mud.de

Re: Geyser VBox add and remove [solved]

Post by Zaphob »

takilara wrote:
Thu Nov 05, 2020 2:29 pm
fairly frequent crashes while using the builtin editor.
Hi takilara, could you please elaborate? Mudlet should never crash on you, especially not during regular tasks. :o

If you think you've found a bug, please enter details here or on https://github.com/Mudlet/Mudlet/issues/new

takilara
Posts: 24
Joined: Tue Jul 28, 2020 10:23 pm

Re: Geyser VBox add and remove [solved]

Post by takilara »

Zaphob wrote:
Thu Nov 05, 2020 10:37 pm
takilara wrote:
Thu Nov 05, 2020 2:29 pm
fairly frequent crashes while using the builtin editor.
Hi takilara, could you please elaborate? Mudlet should never crash on you, especially not during regular tasks. :o

If you think you've found a bug, please enter details here or on https://github.com/Mudlet/Mudlet/issues/new
Hi Zaphob,
The crash i mention, I posted about here: viewtopic.php?f=9&t=22937 awhile ago. I can add it to the github also. I have not tested to perform a debug build myself.
Basically there is a random chance of crash when using the editor in Mudlet (i've only encountered it in the Script editor, and most frequently if i scroll using the scroll bar, but also just by "clicking" in the main text field of the editor).

I also have a secondary, less problematic "GUI" issue, where after prolonged use (client running for 5 days or more), with multiple profiles, the main GUI (with the mud output), starts to "blink", where only the bottom most line is rendered and everything else is black.

This last issue might be related to very large memory usage at this point (1.5 GB) (probably a leak caused by my settings).
OR have some relation to the fact that this is running on a virtual machine that i RDP to. This happens "faster" on the instance running 10 profiles, than an instance that is running 2 profiles.
- Instance 1 has no impact on instance 2.
- Restart of the instance solves the issue.

User avatar
demonnic
Posts: 711
Joined: Sat Dec 05, 2009 3:19 pm

Re: Geyser VBox add and remove [solved]

Post by demonnic »

10 profiles? Someone is controlling a robot army ;)

Post Reply