Exemplo n.º 1
0
    def reload_model(self):
        '''Re-initialize the treeview model. This is called when
		reloading the index to get rid of out-of-sync model errors
		without need to close the app first.
		'''
        assert self.uistate['treeview'] in ('tagged', 'tags')
        self.treeview.disconnect_index()

        tags = [t.name for t in self.tagcloud.get_tag_filter()]
        if tags:
            model = TaggedPageTreeStore(self.index, tags,
                                        self.uistate['show_full_page_name'])
        elif self.uistate['treeview'] == 'tags':
            model = TagsPageTreeStore(self.index, (),
                                      self.uistate['show_full_page_name'])
        else:
            model = PageTreeStore(self.index)

        self.treeview.set_model(model)

        def handler(o, *a):
            signal = a[-1]
            path = a[0].to_string()

        for signal in ('row-inserted', 'row-changed', 'row-deleted',
                       'row-has-child-toggled'):
            model.connect(signal, handler, signal)
Exemplo n.º 2
0
	def on_properties_changed(self, properties):
		old_model = self.calendar_widget.treeview.get_model()
		self.disconnect_from(old_model)

		index = self.notebook.index
		namespace = properties['namespace']
		new_model = PageTreeStore(index, root=namespace, reverse=True)
		self.calendar_widget.treeview.set_model(new_model)

		self.connectto_all(new_model, ('row-inserted', 'row-deleted'), handler=self.on_pane_changed)
		self.on_pane_changed()
Exemplo n.º 3
0
	def reload_model(self):
		'''Re-initialize the treeview model. This is called when
		reloading the index to get rid of out-of-sync model errors
		without need to close the app first.
		'''
		assert self.uistate['treeview'] in ('tagged', 'tags')
		tags = [t.name for t in self.tagcloud.get_tag_filter()]

		if tags:
			model = TaggedPageTreeStore(self.index, tags, self.uistate['show_full_page_name'])
		elif self.uistate['treeview'] == 'tags':
			model = TagsPageTreeStore(self.index, (), self.uistate['show_full_page_name'])
		else:
			model = PageTreeStore(self.index)

		self.treeview.set_model(model)