Exemplo n.º 1
0
    def create(self, Name, **properties):
        '''Create a new custom tool

		@param Name: the name to show in the Tools menu
		@param properties: properties for the custom tool, e.g.:
		  - Comment
		  - Icon
		  - X-Zim-ExecTool
		  - X-Zim-ReadOnly
		  - X-Zim-ShowInToolBar

		@returns: a new L{CustomTool} object.
		'''
        properties['Type'] = 'X-Zim-CustomTool'
        dir = XDG_CONFIG_HOME.subdir('zim/customtools')
        tool = _create_application(dir,
                                   Name,
                                   '',
                                   klass=CustomTool,
                                   NoDisplay=False,
                                   **properties)

        # XXX - hack to ensure we link to configmanager
        file = ConfigManager.get_config_file('customtools/' +
                                             tool.file.basename)
        tool.file = file
        file.connect('changed', partial(self._on_tool_changed, tool))

        self._tools[tool.key] = tool
        self._names.append(tool.key)
        self._write_list()

        return tool
Exemplo n.º 2
0
    def create(self, Name, **properties):
        '''Create a new custom tool

		@param Name: the name to show in the Tools menu
		@param properties: properties for the custom tool, e.g.:
		  - Comment
		  - Icon
		  - X-Zim-ExecTool
		  - X-Zim-ReadOnly
		  - X-Zim-ShowInToolBar

		@returns: a new L{CustomTool} object.
		'''
        properties['Type'] = 'X-Zim-CustomTool'
        dir = XDG_CONFIG_HOME.subdir('zim/customtools')
        tool = _create_application(dir,
                                   Name,
                                   '',
                                   klass=CustomTool,
                                   NoDisplay=False,
                                   **properties)
        self.tools[tool.key] = tool
        self.names.append(tool.key)
        self._write_list()

        return tool
Exemplo n.º 3
0
    def create(self, Name, **properties):
        '''Create a new custom tool

        @param Name: the name to show in the Tools menu
        @param properties: properties for the custom tool, e.g.:
          - Comment
          - Icon
          - X-Zim-ExecTool
          - X-Zim-ReadOnly
          - X-Zim-ShowInToolBar

        @returns: a new L{CustomTool} object.
        '''
        properties['Type'] = 'X-Zim-CustomTool'
        dir = XDG_CONFIG_HOME.subdir('zim/customtools')
        tool = _create_application(dir, Name, '', klass=CustomTool, NoDisplay=False, **properties)
        self.tools[tool.key] = tool
        self.names.append(tool.key)
        self._write_list()

        return tool