Add a "don't show this message again" checkbox



  • On 14/10/2016 at 15:35, xxxxxxxx wrote:

    I used the script below to allow deactivation of the plugin update notifications, by writing a .txt file under the writeable startup directory of cinema 4d.
    Is it possible to do that without writing a .txt file?

    I have simplified this code, just to give you an idea of what I want to do.

      
    filePath = os.path.join(c4d.storage.GeGetStartupWritePath(), 'plugins', 'PluginName', 'notification.txt')  
    CHECKBOX = 1001  
      
    class updateDialog( c4d.gui.GeDialog) :  
      
      def CreateLayout(self) :  
          self.AddCheckbox(CHECKBOX, c4d.BFH_SCALEFIT, 0, 0, name=" Don't show this message again! ")  
      
          return True  
            
      def Command(self, id, msg) :  
                
          if self.GetBool(CHECKBOX) == True :          
              fn = os.open( filePath, os.O_WRONLY|os.O_TRUNC|os.O_CREAT, 0600)  
              os.write(fn, "Disable Update Notifications")  
              os.close(fn)  
          return True  
      
    class MyClass(c4d.plugins.CommandData) :  
      
      def Execute(self, doc) :  
          if not os.path.exists(filePath) :  
              dlg = updateDialog()  
              dlg.Open(c4d.DLG_TYPE_MODAL, xpos= 700, ypos= 250, defaultw=600, defaulth=0)  
          return True  
    


  • On 17/10/2016 at 08:15, xxxxxxxx wrote:

    Hi Mustapha,

    you could store this information in the "world container".
    You can get that BaseContainer via GetWorldContainerInstance().
    But please don't store the information directly in there. Instead get a PluginID and store a BaseContainer at that ID in the world container. Then you can store whatever you want in your own BaseContainer.


Log in to reply