← Back to team overview

aesthete-team team mailing list archive

Welcome dialogue preference patch

 

Hi all,

Please find attached a patch which allows one to set in the preferences dialogue whether the welcome dialogue should be shown on start-up or not. This allows someone who previously un-checked the box on the welcome dialogue to view it again, without having to delete ~/.aesthete/welcomed.

Cheers,
Chris.
=== modified file 'aesthete_ime.py'
--- aesthete_ime.py	2011-10-26 21:54:34 +0000
+++ aesthete_ime.py	2011-10-26 23:39:02 +0000
@@ -44,6 +44,7 @@
     active_plot = None
     concise_property_notebook = True
     show_logger = False
+    show_welcome = False
 
     def add_icons(self) :
         icon_factory = gtk.IconFactory()
@@ -83,6 +84,8 @@
         G(env=self.get_aenv())
 
         if not os.path.exists(paths.get_user_location()+'welcomed') :
+            self.show_welcome = True
+        if self.show_welcome :
             dialog = gtk.Dialog('Welcome to Aesthete!', self,
                                 gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
                                 (gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
@@ -148,7 +151,8 @@
     def get_aesthete_properties(self):
         return { 'active_plot' : [self.change_active_plot, self.get_active_plot, True], \
              'concise_property_notebook' : [self.change_concise_property_notebook, self.get_concise_property_notebook, True], \
-             'show_logger' : [self.change_show_logger, self.get_show_logger, True] }
+             'show_logger' : [self.change_show_logger, self.get_show_logger, True], \
+				 'show_welcome' : [self.change_show_welcome, self.get_show_welcome, True] } 
     #BEGIN PROPERTIES FUNCTIONS
     def get_active_plot(self, val=None): return (self.active_plot.get_aname() if self.active_plot != None else '') if val==None else val
     def change_active_plot(self, aname):
@@ -165,6 +169,16 @@
         if self.logger_view :
             self.logger_view.show() if val else self.logger_view.hide()
         self.show_logger = val
+    def get_show_welcome(self, val=None) :
+        return self.show_welcome if val==None else str(val)=='True'
+    def change_show_welcome(self, val) :
+        if self.show_welcome :
+            with open(paths.get_user_location()+'welcomed', 'w') as f :
+                    f.write(details.get_version())
+                    f.write(str(time.time()))
+        elif os.path.exists(paths.get_user_location()+'welcomed') :
+            os.remove(paths.get_user_location()+'welcomed')
+        self.show_welcome = val
     #END PROPERTIES FUNCTIONS
 
     def to_action_panel(self, window) :
@@ -186,6 +200,7 @@
         tm = tablemaker.PreferencesTableMaker()
         tm.append_row("Concise property notebook", self.aes_method_check_button('concise_property_notebook'))
         tm.append_row("Show logger window", self.aes_method_check_button('show_logger'))
+        tm.append_row("Show welcome dialogue on startup", self.aes_method_check_button('show_welcome'))
         win = tm.make_table()
         return win
 


Follow ups