Пример #1
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 src.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 src.lib.gpg 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, self.GridActionOpenMsg,
                               attr={"filepath": self.filepath})
            self.main_window.filepath = self.filepath

        return True
Пример #2
0
    def OnInit(self):
        """Init class that is automatically run on __init__"""

        # Get command line options and arguments
        cmdp = Commandlineparser()
        options, filename = cmdp.parse()

        kwargs = {
            "title": "pyspread",
            "S": self.S
        }

        # Store command line input in config if no file is provided
        if filename is None:
            kwargs["dimensions"] = options.dimensions

        # Main window creation
        from src.gui._main_window import MainWindow

        self.main_window = MainWindow(None, **kwargs)

        # Initialize file loading via event

        if gnupg is not None and options.new_gpgkey:
            # Create GPG key if not present

            try:
                from src.lib.gpg import genkey
                self.config["gpg_key_fingerprint"] = repr("")
                genkey()

            except ImportError:
                pass

            except ValueError:
                # python-gnupg is installed but gnupg is not installed
                pass

        # Show application window
        self.SetTopWindow(self.main_window)
        self.main_window.Show()

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

        return True
Пример #3
0
    def OnNewGpgKey(self, event):
        """New GPG key event handler.

        Launches GPG choice and creation dialog

        """

        if genkey is None:
            # gnupg is not present
            self.interfaces.display_warning(
                _("Python gnupg not found. No key selected."),
                _("Key selection failed."))
        else:
            # gnupg is present
            genkey()
Пример #4
0
    def OnInit(self):
        """Init class that is automatically run on __init__"""

        # Get command line options and arguments
        cmdp = Commandlineparser()
        options, filename = cmdp.parse()

        kwargs = {"title": "pyspread", "S": self.S}

        # Store command line input in config if no file is provided
        if filename is None:
            kwargs["dimensions"] = options.dimensions

        # Main window creation
        from src.gui._main_window import MainWindow

        self.main_window = MainWindow(None, **kwargs)

        # Initialize file loading via event

        if options.new_gpgkey:
            # Create GPG key if not present

            try:
                from src.lib.gpg import genkey
                self.config["gpg_key_fingerprint"] = repr("")
                genkey()

            except ImportError:
                pass

            except ValueError:
                # python-gnupg is installed but gnupg is not installed
                pass

        # Show application window
        self.SetTopWindow(self.main_window)
        self.main_window.Show()

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

        return True
Пример #5
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
        wx.InitAllImageHandlers()

        # Main window creation
        from src.gui._main_window import MainWindow

        self.main_window = MainWindow(None, title="pyspread", S=self.S)

        ## Initialize file loading via event

        # Create GPG key if not present

        try:
            from src.lib.gpg import genkey
            genkey()

        except ImportError:
            pass

        except ValueError:
            # python-gnupg is installed but gnupg is not insatlled

            pass

        # 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,
                               self.GridActionOpenMsg,
                               attr={"filepath": self.filepath})
            self.main_window.filepath = self.filepath

        return True
Пример #6
0
    def OnInit(self):
        """Init class that is automatically run on __init__"""

        # Get command line options and arguments
        self.get_cmd_args()


        # Main window creation
        from src.gui._main_window import MainWindow

        self.main_window = MainWindow(None, title="pyspread", S=self.S)

        ## Initialize file loading via event

        # Create GPG key if not present

        try:
            from src.lib.gpg import genkey
            genkey()

        except ImportError:
            pass

        except ValueError:
            # python-gnupg is installed but gnupg is not insatlled

            pass

        # 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, self.GridActionOpenMsg,
                               attr={"filepath": self.filepath})
            self.main_window.filepath = self.filepath

        return True
Пример #7
0
def setup_function(function):
    """Creates a GPG key if necessary"""

    if gnupg is None:
        # gnupg is not installed
        return

    global fingerprint
    if fingerprint2keyid(config["gpg_key_fingerprint"]) is None:
        # No GPG key is configured
        fingerprint = genkey(key_name="pyspread_test_key")
    else:
        # Use preconfigured key
        fingerprint = config_fingerprint
Пример #8
0
def setup_function(function):
    """Creates a GPG key if necessary"""

    if gnupg is None:
        # gnupg is not installed
        return

    global fingerprint
    if fingerprint2keyid(config["gpg_key_fingerprint"]) is None:
        # No GPG key is configured
        fingerprint = genkey(key_name="pyspread_test_key")
    else:
        # Use preconfigured key
        fingerprint = config_fingerprint
Пример #9
0
    def setup_method(self, method):

        # Generate a GPG key if not present
        if fingerprint2keyid(config["gpg_key_fingerprint"]) is None and \
           genkey is not None:
            # No GPG key is configured
            self.fingerprint = genkey(key_name="pyspread_test_key")
        else:
            # Use preconfigured key
            self.fingerprint = config["gpg_key_fingerprint"]

        self.main_window = MainWindow(None, title="pyspread", S=None)
        self.grid = self.main_window.grid
        self.code_array = self.grid.code_array

        # Sign files in order to get valid signatures for current key
        self.grid.actions.sign_file(self.filename_valid_sig)
        self.grid.actions.sign_file(self.filename_gridsize)
Пример #10
0
    def setup_method(self, method):

        # Generate a GPG key if not present
        if fingerprint2keyid(config["gpg_key_fingerprint"]) is None and \
           genkey is not None:
            # No GPG key is configured
            self.fingerprint = genkey(key_name="pyspread_test_key")
        else:
            # Use preconfigured key
            self.fingerprint = config["gpg_key_fingerprint"]

        self.main_window = MainWindow(None, title="pyspread", S=None)
        self.grid = self.main_window.grid
        self.code_array = self.grid.code_array

        # Sign files in order to get valid signatures for current key
        self.grid.actions.sign_file(self.filename_valid_sig)
        self.grid.actions.sign_file(self.filename_gridsize)
Пример #11
0
    def setup_method(self, method):

        # Generate a GPG key if not present
        if genkey is not None:
            self.fingerprint = genkey(key_name="pyspread_test_key")

        self.main_window = MainWindow(None, title="pyspread", S=None)
        self.grid = self.main_window.grid
        self.code_array = self.grid.code_array

        # Filenames
        # ---------

        # File with valid signature
        self.filename_valid_sig = TESTPATH + "test1.pys"
        self.grid.actions.sign_file(self.filename_valid_sig)

        # File without signature
        self.filename_no_sig = TESTPATH + "test2.pys"

        # File with invalid signature
        self.filename_invalid_sig = TESTPATH + "test3.pys"

        # File for self.grid size test
        self.filename_gridsize = TESTPATH + "test4.pys"
        self.grid.actions.sign_file(self.filename_gridsize)

        # Empty file
        self.filename_empty = TESTPATH + "test5.pys"

        # File name that cannot be accessed
        self.filename_not_permitted = TESTPATH + "test6.pys"

        # File name without file
        self.filename_wrong = TESTPATH + "test-1.pys"

        # File for testing save
        self.filename_save = TESTPATH + "test_save.pys"
Пример #12
0
def setup_function(function):
    """Creates a GPG key if necessary"""

    global fingerprint
    fingerprint = genkey(key_name="pyspread_test_key")