Exemple #1
0
 def sign_file(self, filepath):
     """Signs file if possible"""
     
     if is_pyme_present() and not self.code_array.safe_mode:
         signature = sign(filepath)
         signfile = open(filepath + '.sig','wb')
         signfile.write(signature)
         signfile.close()
         msg = 'File successfully saved and signed.'
         statustext = 'File saved and signed'
         post_command_event(self.main_window, StatusBarMsg, 
                            text=statustext)
     else:
         msg = 'Cannot sign the file. Maybe PyMe is not installed.'
         short_msg = 'Cannot sign file!'
         self.main_window.interfaces.display_warning(msg, short_msg)
Exemple #2
0
    def OnInit(self):
        """Init class that is automatically run on __init__"""
        
        # Get command line options and arguments
        self.get_cmd_args()

        # Initialize the prerequisitions to construct the main window
        InitAllImageHandlers()

        # Main window creation
        from gui._main_window import MainWindow
        
        self.main_window = MainWindow(None, title="pyspread")
        
        ## Set dimensions
        
        ## Initialize file loading via event
        
        # Create GPG key if not present
        
        from lib._interfaces import is_pyme_present
        
        if is_pyme_present():
            from lib._interfaces import genkey
            genkey()
            
        # Show application window
        self.SetTopWindow(self.main_window)
        self.main_window.Show()

        # Load filename if provided
        if self.filepath is not None:
            post_command_event(self.main_window, GridActionOpenMsg, 
                               attr={"filepath": self.filepath})
            self.main_window.filepath = self.filepath
        
        return True