def __init__(self, containing_notebook, view_object): ViewManager.__init__(self, containing_notebook, view_object) # populate toolbar button = gtk.ToolButton(gtk.STOCK_NEW) button.show() button.connect('clicked', self._new_server_button_clicked) self._toolbar.insert(button, -1)
def _manager_children_changed(self, manager): print "children changed" child_uuids = [] # list of uuids as objects found object_uuids = {} # map uuid -> object menu_uuids = [] # uuids of managers already in menu manager_uuids = {} # map uuid -> manager # scan object for navigatable attributes obj = manager.view_object for attr_name in obj.get_attribute_list(): attr_def = obj.get_attribute_definition(attr_name) if attr_def.has_key("navigatable") and attr_def["navigatable"]: attr_value = obj.__getattr__(attr_name) if obj.is_attribute_collection(attr_name): for elem in attr_value: # add, if a viewmanager for the object exists if ViewManager.get_managerclass_for_object(elem): child_uuids.append(elem.uuid) object_uuids[elem.uuid] = elem else: # add, if a viewmanager for the object exists if ViewManager.get_managerclass_for_object(attr_value): child_uuids.append(attr_value.uuid) object_uuids[attr_value.uuid] = attr_value # collect uuid of children in treemenu it = self._uuid_to_treeiter[manager.get_uuid()] it = self._treestore.iter_children(it) while it: m = self._treestore.get_value(it, 0) manager_uuids[m.get_uuid()] = m menu_uuids.append(m.get_uuid()) it = self._treestore.iter_next(it) # remove items that got deleted for uuid in set(menu_uuids) - set(child_uuids): # print "removed "+str(uuid) raise Exception(_("Not implemented")) # add items that were inserted for uuid in set(child_uuids) - set(menu_uuids): # print "added "+str(uuid) self._build_menu(object_uuids[uuid], manager) menu_uuids.append(uuid)
def __init__(self, containing_notebook, view_object): ViewManager.__init__(self, containing_notebook, view_object) self.view_object.connect_signal('changed', self.on_server_changed) # populate toolbar self.connect_button = gtk.ToolButton(gtk.STOCK_CONNECT) self.connect_button.connect('clicked', self.action_connect) self._toolbar.insert(self.connect_button, -1) self.connect_button.show() self.disconnect_button = gtk.ToolButton(gtk.STOCK_DISCONNECT) self.disconnect_button.connect('clicked', self.action_disconnect) self._toolbar.insert(self.disconnect_button, -1) self.disconnect_button.show() self.install_key_button = gtk.ToolButton('condensation-install-key') self.install_key_button.connect('clicked', self.action_install_key) self._toolbar.insert(self.install_key_button, -1) self.install_key_button.show() self.update()
def __init__(self, argparser): import DbState from viewmanager import ViewManager from cli.arghandler import ArgHandler import TipOfDay register_stock_icons() dbstate = 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.TipOfDay(self.vm.uistate)
def __init__(self, containing_notebook, view_object): ViewManager.__init__(self, containing_notebook, view_object)
Resources.register_iconset('condensation-server-connected', 'images/icons/server-connected.svg') Resources.register_iconset('condensation-server-disconnected', 'images/icons/server-disconnected.svg') Resources.register_iconset('condensation-vhost-disabled', 'images/icons/vhost-disabled.svg') Resources.register_iconset('condensation-vhost-enabled', 'images/icons/vhost-enabled.svg') gtk.stock_add([ ('condensation', 'Condensation', 0, 0, 'Condensation'), ('condensation-configuration', '_Configuration', 0, 0, 'Condensation'), ('condensation-install-key', '_Install Key', 0, 0, 'Condensation'), ('condensation-server-connected', 'Server Connected', 0, 0, 'Condensation'), ('condensation-server-disconnected', 'Server Disconnected', 0, 0, 'Condensation'), ('condensation-vhost-disabled', 'VHost Disabled', 0, 0, 'Condensation'), ('condensation-vhost-enabled', 'VHost Enabled', 0, 0, 'Condensation'), ]) # register viewmanagers ViewManager.register_viewmanager('Main', CondensationViewManager) ViewManager.register_viewmanager("Server", ServerViewManager) ViewManager.register_viewmanager("VHost", VHostViewManager) # register views ViewManager.register_view('Server', ServerConfigView) ViewManager.register_view('VHost', VHostConfigView) # register form-widgets FormWidgetFactory.register_widget(BooleanFormWidget) FormWidgetFactory.register_widget(IntegerListFormWidget) FormWidgetFactory.register_widget(StringFormWidget) FormWidgetFactory.register_widget(StringListFormWidget)
def _create_manager_for_object(self, obj): manager = ViewManager.build_manager_for_object(self._notebook, obj) manager.connect("children-changed", self._manager_children_changed) manager.show() return manager
class Gramps(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): import DbState from viewmanager import ViewManager from cli.arghandler import ArgHandler import TipOfDay register_stock_icons() dbstate = 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.TipOfDay(self.vm.uistate) def argerrorfunc(self, string): from QuestionDialog import ErrorDialog """ Show basic errors in argument handling in GUI fashion""" ErrorDialog(_("Error parsing arguments"), string)