Esempio n. 1
0
    def __init__(self, argparser):
        from gramps.gen.dbstate import DbState
        from guiQML.viewmanager import ViewManager
        from gramps.cli.arghandler import ArgHandler

        from PySide import QtGui
        self.app = QtGui.QApplication(sys.argv)
        dbstate = DbState()
        self.vm = ViewManager(dbstate)

        #act based on the given arguments
        ah = ArgHandler(dbstate, argparser, self.vm, self.argerrorfunc,
                        gui=True)
        ah.handle_args_gui()
        if ah.open or ah.imp_db_path:
            # if we opened or imported something, only show the interface
            self.vm.post_init_interface()
        elif config.get('paths.recent-file') and config.get('behavior.autoload'):
            # if we need to autoload last seen file, do so
            filename = config.get('paths.recent-file')
            if os.path.isdir(filename) and \
                    os.path.isfile(os.path.join(filename, "name.txt")) and \
                    ah.check_db(filename):
                self.vm.open_activate(filename)
                self.vm.post_init_interface()
            else:
                self.vm.post_init_interface()
        else:
            # open without fam tree loaded
            self.vm.post_init_interface()
        
        #start the QT loop
        self.app.exec_()
Esempio n. 2
0
class GrampsQML(object):
    """
    Main class corresponding to a running gramps process.

    There can be only one instance of this class per gramps application
    process. It may spawn several windows and control several databases.
    """
    def __init__(self, argparser):
        from gramps.gen.dbstate import DbState
        from guiQML.viewmanager import ViewManager
        from gramps.cli.arghandler import ArgHandler

        from PySide import QtGui
        self.app = QtGui.QApplication(sys.argv)
        dbstate = DbState()
        self.vm = ViewManager(dbstate)

        #act based on the given arguments
        ah = ArgHandler(dbstate,
                        argparser,
                        self.vm,
                        self.argerrorfunc,
                        gui=True)
        ah.handle_args_gui()
        if ah.open or ah.imp_db_path:
            # if we opened or imported something, only show the interface
            self.vm.post_init_interface()
        elif config.get('paths.recent-file') and config.get(
                'behavior.autoload'):
            # if we need to autoload last seen file, do so
            filename = config.get('paths.recent-file')
            if os.path.isdir(filename) and \
                    os.path.isfile(os.path.join(filename, "name.txt")) and \
                    ah.check_db(filename):
                self.vm.open_activate(filename)
                self.vm.post_init_interface()
            else:
                self.vm.post_init_interface()
        else:
            # open without fam tree loaded
            self.vm.post_init_interface()

        #start the QT loop
        self.app.exec_()

    def argerrorfunc(self, string):
        from guiQML.questiondialog import ErrorDialog
        """ Show basic errors in argument handling in GUI fashion"""
        ErrorDialog(_("Error parsing arguments"), string)
Esempio n. 3
0
    def __init__(self, argparser):
        from gramps.gen.dbstate import DbState
        from guiQML.viewmanager import ViewManager
        from gramps.cli.arghandler import ArgHandler

        from PySide import QtGui
        self.app = QtGui.QApplication(sys.argv)
        dbstate = DbState()
        self.vm = ViewManager(dbstate)

        #act based on the given arguments
        ah = ArgHandler(dbstate, argparser, self.vm, self.argerrorfunc,
                        gui=True)
        ah.handle_args_gui()
        if ah.open or ah.imp_db_path:
            # if we opened or imported something, only show the interface
            self.vm.post_init_interface()
        elif config.get('paths.recent-file') and config.get('behavior.autoload'):
            # if we need to autoload last seen file, do so
            filename = config.get('paths.recent-file')
            if os.path.isdir(filename) and \
                    os.path.isfile(os.path.join(filename, "name.txt")) and \
                    ah.check_db(filename):
                self.vm.open_activate(filename)
                self.vm.post_init_interface()
            else:
                self.vm.post_init_interface()
        else:
            # open without fam tree loaded
            self.vm.post_init_interface()
        
        #start the QT loop
        self.app.exec_()
Esempio n. 4
0
class GrampsQML(object):
    """
    Main class corresponding to a running gramps process.

    There can be only one instance of this class per gramps application
    process. It may spawn several windows and control several databases.
    """

    def __init__(self, argparser):
        from gramps.gen.dbstate import DbState
        from guiQML.viewmanager import ViewManager
        from gramps.cli.arghandler import ArgHandler

        from PySide import QtGui
        self.app = QtGui.QApplication(sys.argv)
        dbstate = DbState()
        self.vm = ViewManager(dbstate)

        #act based on the given arguments
        ah = ArgHandler(dbstate, argparser, self.vm, self.argerrorfunc,
                        gui=True)
        ah.handle_args_gui()
        if ah.open or ah.imp_db_path:
            # if we opened or imported something, only show the interface
            self.vm.post_init_interface()
        elif config.get('paths.recent-file') and config.get('behavior.autoload'):
            # if we need to autoload last seen file, do so
            filename = config.get('paths.recent-file')
            if os.path.isdir(filename) and \
                    os.path.isfile(os.path.join(filename, "name.txt")) and \
                    ah.check_db(filename):
                self.vm.open_activate(filename)
                self.vm.post_init_interface()
            else:
                self.vm.post_init_interface()
        else:
            # open without fam tree loaded
            self.vm.post_init_interface()
        
        #start the QT loop
        self.app.exec_()

    def argerrorfunc(self, string):
        from guiQML.questiondialog import ErrorDialog
        """ Show basic errors in argument handling in GUI fashion"""
        ErrorDialog(_("Error parsing arguments"), string)