def __init__(self, argparser): from gramps.gen.dbstate import DbState from . import viewmanager from .viewmanager import ViewManager from gramps.cli.arghandler import ArgHandler from .tipofday import TipOfDay from .dialog import WarningDialog import gettext _display_welcome_message() # Append image directory to the theme search path theme = Gtk.IconTheme.get_default() theme.append_search_path(IMAGE_DIR) if lin() and glocale.lang != 'C' and not gettext.find(GTK_GETTEXT_DOMAIN): LOG.warn("GTK translations missing, GUI will be broken, especially for RTL languages!") # Note: the warning dialog below will likely have wrong stock icons! # Translators: the current language will be the one you translate into. WarningDialog( _("Gramps detected an incomplete GTK installation"), _("GTK translations for the current language (%(language)s) " "are missing.\n%(bold_start)sGramps%(bold_end)s will " "proceed nevertheless.\nThe GUI will likely be broken " "as a result, especially for RTL languages!\n\n" "See the Gramps README documentation for installation " "prerequisites,\ntypically located in " "/usr/share/doc/gramps.\n") % { 'language' : glocale.lang , 'bold_start' : '<b>' , 'bold_end' : '</b>' } ) dbstate = DbState() self.vm = ViewManager(dbstate, config.get("interface.view-categories")) self.vm.init_interface() #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(show_manager=False) 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.post_init_interface(show_manager=False) self.vm.open_activate(filename) else: self.vm.post_init_interface() else: # open without fam tree loaded self.vm.post_init_interface() if config.get('behavior.use-tips'): TipOfDay(self.vm.uistate)
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 __init__(self, argparser): from gramps.gen.dbstate import DbState from . import viewmanager from .viewmanager import ViewManager from gramps.cli.arghandler import ArgHandler from .tipofday import TipOfDay from .dialog import WarningDialog import gettext _display_welcome_message() register_stock_icons() if lin() and glocale.lang != 'C' and not gettext.find(GTK_GETTEXT_DOMAIN): LOG.warn("GTK translations missing, GUI will be broken, especially for RTL languages!") # Note: the warning dialog below will likely have wrong stock icons! # Translators: the current language will be the one you translate into. WarningDialog( _("Gramps detected an incomplete GTK installation"), _("GTK translations for the current language (%(language)s) " "are missing.\n%(bold_start)sGramps%(bold_end)s will " "proceed nevertheless.\nThe GUI will likely be broken " "as a result, especially for RTL languages!\n\n" "See the Gramps README documentation for installation " "prerequisites,\ntypically located in " "/usr/share/doc/gramps.\n") % { 'language' : glocale.lang , 'bold_start' : '<b>' , 'bold_end' : '</b>' } ) dbstate = DbState() self.vm = ViewManager(dbstate, config.get("interface.view-categories")) self.vm.init_interface() #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(show_manager=False) 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.post_init_interface(show_manager=False) self.vm.open_activate(filename) else: self.vm.post_init_interface() else: # open without fam tree loaded self.vm.post_init_interface() if config.get('behavior.use-tips'): TipOfDay(self.vm.uistate)
def __init__(self, argparser): from gramps.gen.dbstate import DbState from . import viewmanager from .viewmanager import ViewManager from gramps.cli.arghandler import ArgHandler from .tipofday import TipOfDay import gettext # Append image directory to the theme search path theme = Gtk.IconTheme.get_default() theme.append_search_path(IMAGE_DIR) dbstate = DbState() self._vm = ViewManager(dbstate, config.get("interface.view-categories")) if (lin() and glocale.lang != 'C' and not gettext.find(GTK_GETTEXT_DOMAIN)): _display_gtk_gettext_message(parent=self._vm.window) #_display_welcome_message(parent=self._vm.window) _display_translator_message(parent=self._vm.window) self._vm.init_interface() #act based on the given arguments arg_h = ArgHandler(dbstate, argparser, self._vm, self.argerrorfunc, gui=True) arg_h.handle_args_gui() if arg_h.open or arg_h.imp_db_path: # if we opened or imported something, only show the interface self._vm.post_init_interface(show_manager=False) 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 arg_h.check_db(filename)): self._vm.post_init_interface(show_manager=False) self._vm.open_activate(filename) else: self._vm.post_init_interface() else: # open without fam tree loaded self._vm.post_init_interface() if config.get('behavior.use-tips'): TipOfDay(self._vm.uistate)
def __init__(self, argparser): from gramps.gen.dbstate import DbState from . import viewmanager from .viewmanager import ViewManager from gramps.cli.arghandler import ArgHandler from .tipofday import TipOfDay import gettext # Append image directory to the theme search path theme = Gtk.IconTheme.get_default() theme.append_search_path(IMAGE_DIR) dbstate = DbState() self._vm = ViewManager(dbstate, config.get("interface.view-categories")) if (lin() and glocale.lang != 'C' and not gettext.find(GTK_GETTEXT_DOMAIN)): _display_gtk_gettext_message(parent=self._vm.window) _display_welcome_message(parent=self._vm.window) _display_translator_message(parent=self._vm.window) self._vm.init_interface() #act based on the given arguments arg_h = ArgHandler(dbstate, argparser, self._vm, self.argerrorfunc, gui=True) arg_h.handle_args_gui() if arg_h.open or arg_h.imp_db_path: # if we opened or imported something, only show the interface self._vm.post_init_interface(show_manager=False) 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 arg_h.check_db(filename)): self._vm.post_init_interface(show_manager=False) self._vm.open_activate(filename) else: self._vm.post_init_interface() else: # open without fam tree loaded self._vm.post_init_interface() if config.get('behavior.use-tips'): TipOfDay(self._vm.uistate)