• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

(2.1.0, API) Revising the Show/Hide mechanism

Scheduled Pinned Locked Moved Upcoming Features
14 Posts 5 Posters 13.7k Views 4 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    MichMich Admin
    last edited by MichMich Jun 21, 2016, 7:55 AM Jun 21, 2016, 7:55 AM

    It is a piece of cake to make a force flag, and I probably will. But I can’t really think of a case in which the use of a force flag is justified.

    1 Reply Last reply Reply Quote 0
    • K Offline
      KirAsh4 Moderator
      last edited by Jun 21, 2016, 4:05 PM

      Neither can I, but the moment we say that, someone will come up with a reason to need that. :)

      A Life? Cool! Where can I download one of those from?

      1 Reply Last reply Reply Quote 0
      • I Offline
        ianperrin
        last edited by Oct 11, 2016, 7:30 PM

        @MichMich

        Does this fit the use case?

        ModuleA is configured to be hidden at 9am and shown at 6pm by ModuleB using a schedule.

        At 9am ModuleB (the scheduler) hides ModuleA.

        At 11am ModuleC (Remote Control) is used to show ModuleA.

        At 11:30am ModuleC (Remote Control) is used to hide ModuleA.

        At 6pm, ModuleB (the scheduler) shows ModuleA

        Am I correct in thinking that without the force flag, neither ModuleB or ModuleC could show ModuleA at 11am or 6pm respectively?

        "Live as if you were to die tomorrow. Learn as if you were to live forever." - Mahatma Gandhi

        1 Reply Last reply Reply Quote 0
        • M Offline
          MichMich Admin
          last edited by Oct 11, 2016, 7:33 PM

          Yeah, but I think that is the exact reason why this method should be implemented. One can argue what the desired result is. But by implementing the force option, both scenarios will be possible. Implementing a force function isn’t really a big deal.

          Thanks for your input!

          1 Reply Last reply Reply Quote 0
          • I Offline
            ianperrin
            last edited by Oct 11, 2016, 7:42 PM

            Agreed.

            And perhaps best practice should be that any module wishing to show/hide other modules should include a config option to toggle the use of the force flag.

            Let the user decide!

            "Live as if you were to die tomorrow. Learn as if you were to live forever." - Mahatma Gandhi

            1 Reply Last reply Reply Quote 0
            • M Offline
              MichMich Admin
              last edited by Oct 11, 2016, 7:43 PM

              Agee! I’ll make sure to add that to the documentation.

              1 Reply Last reply Reply Quote 0
              • M Offline
                MichMich Admin
                last edited by Oct 13, 2016, 1:19 PM

                Method is implemented. See documentation:
                https://github.com/MichMich/MagicMirror/tree/develop/modules#thishidespeed-callback-options
                https://github.com/MichMich/MagicMirror/tree/develop/modules#thisshowspeed-callback-options
                https://github.com/MichMich/MagicMirror/tree/develop/modules#visibility-locking

                J 1 Reply Last reply Oct 14, 2016, 9:34 PM Reply Quote 4
                • J Offline
                  Jopyth Moderator @MichMich
                  last edited by Jopyth Oct 14, 2016, 9:34 PM Oct 14, 2016, 9:34 PM

                  @MichMich Did you have any concerns about making this an opt-out instead of an opt-in? I.e. make the default options {this.identifier} instead of {}. Or is there a specific reason against it? The overall concept seems reasonable, if we assume the meaning of the hide() method always was to “keep this module hidden until I want it to reappear”.

                  I do not think anyone does something like hiding module A from module B and then purposely showing module A again from module C. This is the only way I think of, which would make the default option using the modules identifier weird.

                  Helpful sticky: How to troubleshoot

                  S 1 Reply Last reply Oct 14, 2016, 9:37 PM Reply Quote 0
                  • S Offline
                    strawberry 3.141 Project Sponsor Module Developer @Jopyth
                    last edited by Oct 14, 2016, 9:37 PM

                    @Jopyth one way would be hide a module with the scheduler and show it again with the remote control or voice or something else

                    Please create a github issue if you need help, so I can keep track

                    1 Reply Last reply Reply Quote 1
                    • M Offline
                      MichMich Admin
                      last edited by Oct 15, 2016, 7:56 AM

                      @Jopyth: The problem is that there is no way to find out which module requested the hide method. Therefor I can’t use that identifier by default. This must be provided by the module itself.

                      1 Reply Last reply Reply Quote 0
                      • 1
                      • 2
                      • 1 / 2
                      • First post
                        Last post
                      Enjoying MagicMirror? Please consider a donation!
                      MagicMirror created by Michael Teeuw.
                      Forum managed by Sam, technical setup by Karsten.
                      This forum is using NodeBB as its core | Contributors
                      Contact | Privacy Policy