Exemplo n.º 1
0
    def __init__(self, assistant):
        AssistantPage.__init__(self, assistant)

        self.add_form(
            (
                ('output:multi_file', 'option',
                 _('Export each page to a separate file')),
                # T: Label for option in export dialog
                ('output:single_file', 'option',
                 _('Export all pages to a single file')),
                # T: Label for option in export dialog
                None,
                ('folder', 'dir', _('Output folder')),
                # T: Label for folder selection in export dialog
                ('index', 'string', _('Index page')),
                # T: Label for setting a name for the index of exported pages
                # TODO validation for this entry - valid name, but not existing
                ('file', 'output-file', _('Output file')),
                # T: Label for file selection in export dialog
            ),
            depends={
                'index': 'folder',
            })

        for widget in self.form.widgets:
            self.form.widgets[widget].set_no_show_all(True)

        self.form.widgets['output:single_file'].connect(
            'toggled', self.on_output_changed)
Exemplo n.º 2
0
    def __init__(self, assistant):
        AssistantPage.__init__(self, assistant)
        self.export_formats = zim.formats.list_formats(
            zim.formats.EXPORT_FORMAT)

        self.add_form(
            (
                ('format', 'choice', _('Format'),
                 self.export_formats),  # T: Input label in the export dialog
                ('template', 'choice', _('Template'),
                 ()),  # T: Input label in the export dialog
                ('template_file', 'file', None),
                None,
                ('document_root:absolute', 'option',
                 _('Link files under document root with full file path')
                 ),  # T: radio option in export dialog
                ('document_root:url', 'option', _('Map document root to URL') +
                 ': '),  # T: radio option in export dialog
                ('document_root_url', 'string', None),
            ),
            depends={'document_root_url': 'document_root:url'})

        # Set template list based on selected format
        def set_templates(self):
            format = self.form['format']
            format = zim.formats.canonical_name(format)
            combobox = self.form.widgets['template']
            combobox.get_model().clear()

            for name, _ in zim.templates.list_templates(format):
                combobox.append_text(name)
            combobox.append_text(self.CHOICE_OTHER)
            combobox.set_sensitive(True)

            template = self.uistate['template']
            if template == '__file__':
                # Select "Other..."
                combobox.set_active(len(templates))
            else:
                try:
                    self.form['template'] = template
                except ValueError:
                    combobox.set_active(0)

        self.form.widgets['format'].connect_object('changed', set_templates,
                                                   self)

        # Hook template entry to be sensitive on "Other.."
        self.form.widgets['template_file'].set_sensitive(False)
        self.form.widgets['template'].connect(
            'changed', lambda o: self.form.widgets['template_file'].
            set_sensitive(o.get_active_text() == self.CHOICE_OTHER))

        # Check if we have a document root - if not disable all options
        docroot = assistant.ui.notebook.document_root
        if not docroot:
            for widget in self.form.widgets:
                if widget.startswith('document_root:'):
                    self.form.widgets[widget].set_sensitive(False)
            self.uistate.input(document_root_url='')
Exemplo n.º 3
0
    def __init__(self, assistant):
        AssistantPage.__init__(self, assistant)

        self.add_form(
            (
                ('selection:all', 'option', _('Complete _notebook')),
                # T: Option in export dialog to export complete notebook
                #~ ('selection:selection', 'option', _('_Selection')),
                # T: Option in export dialog to export selection
                #~ ('selection_query', 'string', None),
                ('selection:page', 'option', _('Single _page')),
                # T: Option in export dialog to export selection
                None,
                ('page', 'page', _('Page')),  # T: Input field in export dialog
                ('recursive', 'bool',
                 _('Include subpages')),  # T: Input field in export dialog
            ),
            {
                'page': assistant.ui.page,
                'recursive': True,
            },
            depends={
                'page': 'selection:page',
                'recursive': 'selection:page',
            })
        self.form.widgets['page'].existing_only = True
Exemplo n.º 4
0
    def __init__(self, assistant):
        AssistantPage.__init__(self, assistant)
        self.export_formats = zim.formats.list_formats(zim.formats.EXPORT_FORMAT)

        self.add_form((
            ('format', 'choice', _('Format'), self.export_formats), # T: Input label in the export dialog
            ('template', 'choice', _('Template'), ()), # T: Input label in the export dialog
            ('template_file', 'file', None),
            None,
            ('document_root:absolute', 'option', _('Link files under document root with full file path')), # T: radio option in export dialog
            ('document_root:url', 'option', _('Map document root to URL')+': '), # T: radio option in export dialog
            ('document_root_url', 'string', None),
        ), depends={
            'document_root_url': 'document_root:url'
        } )

        # Set template list based on selected format
        def set_templates(self):
            format = self.form['format']
            format = zim.formats.canonical_name(format)
            combobox = self.form.widgets['template']
            combobox.get_model().clear()

            for name, _ in zim.templates.list_templates(format):
                combobox.append_text(name)
            combobox.append_text(self.CHOICE_OTHER)
            combobox.set_sensitive(True)

            template = self.uistate['template']
            if template == '__file__':
                # Select "Other..."
                combobox.set_active(len(templates))
            else:
                try:
                    self.form['template'] = template
                except ValueError:
                    combobox.set_active(0)

        self.form.widgets['format'].connect_object('changed', set_templates, self)

        # Hook template entry to be sensitive on "Other.."
        self.form.widgets['template_file'].set_sensitive(False)
        self.form.widgets['template'].connect('changed',
            lambda o: self.form.widgets['template_file'].set_sensitive(
                            o.get_active_text() == self.CHOICE_OTHER) )

        # Check if we have a document root - if not disable all options
        docroot = assistant.ui.notebook.document_root
        if not docroot:
            for widget in self.form.widgets:
                if widget.startswith('document_root:'):
                    self.form.widgets[widget].set_sensitive(False)
            self.uistate['document_root_url'] = ''
Exemplo n.º 5
0
    def __init__(self, assistant):
        AssistantPage.__init__(self, assistant)

        self.add_form((
            ('folder', 'dir', _('Output folder')),
                # T: Label for folder selection in export dialog
            ('index', 'string', _('Index page')),
                # T: Label for setting a name for the index of exported pages
                # TODO validation for this entry - valid name, but not existing
            ('file', 'output-file', _('Output file')),
                # T: Label for file selection in export dialog
        ), depends={
            'index': 'folder',
        } )

        for widget in self.form.widgets:
            self.form.widgets[widget].set_no_show_all(True)
Exemplo n.º 6
0
    def __init__(self, assistant):
        AssistantPage.__init__(self, assistant)

        self.add_form(
            (
                ('folder', 'dir', _('Output folder')),
                # T: Label for folder selection in export dialog
                ('index', 'string', _('Index page')),
                # T: Label for setting a name for the index of exported pages
                # TODO validation for this entry - valid name, but not existing
                ('file', 'output-file', _('Output file')),
                # T: Label for file selection in export dialog
            ),
            depends={
                'index': 'folder',
            })

        for widget in self.form.widgets:
            self.form.widgets[widget].set_no_show_all(True)
Exemplo n.º 7
0
    def __init__(self, assistant):
        AssistantPage.__init__(self, assistant)

        self.add_form((
            ('selection:all', 'option', _('Complete _notebook')),
                # T: Option in export dialog to export complete notebook
            #~ ('selection:selection', 'option', _('_Selection')),
                # T: Option in export dialog to export selection
            #~ ('selection_query', 'string', None),
            ('selection:page', 'option', _('Single _page')),
                # T: Option in export dialog to export selection
            None,
            ('page', 'page', _('Page')), # T: Input field in export dialog
            #~ ('recursive', 'bool', _('Recursive')),
        ), {
            'page': assistant.ui.page,
        },
        depends={
            'page': 'selection:page',
            #~ 'recursive': 'selection:page',
        } )
        self.form.widgets['page'].existing_only = True
Exemplo n.º 8
0
	def __init__(self, assistant):
		AssistantPage.__init__(self, assistant)

		self.add_form((
			('output:multi_file', 'option', _('Export each page to a separate file')),
				# T: Label for option in export dialog
			('output:single_file', 'option', _('Export all pages to a single file')),
				# T: Label for option in export dialog
			None,
			('folder', 'dir', _('Output folder')),
				# T: Label for folder selection in export dialog
			('index', 'string', _('Index page')),
				# T: Label for setting a name for the index of exported pages
				# TODO validation for this entry - valid name, but not existing
			('file', 'output-file', _('Output file')),
				# T: Label for file selection in export dialog
		), depends={
			'index': 'folder',
		} )

		for widget in self.form.widgets:
			self.form.widgets[widget].set_no_show_all(True)

		self.form.widgets['output:single_file'].connect('toggled', self.on_output_changed)
Exemplo n.º 9
0
    def __init__(self, assistant):
        AssistantPage.__init__(self, assistant)
        self.export_formats = zim.formats.list_formats(
            zim.formats.EXPORT_FORMAT)
        self.export_formats.insert(
            1, 'MHTML (Web Page Archive)')  # TODO translatable

        self.add_form(
            (
                ('format', 'choice', _('Format'),
                 self.export_formats),  # T: Input label in the export dialog
                ('template', 'choice', _('Template'),
                 ()),  # T: Input label in the export dialog
                ('template_file', 'file', None),
                None,
                ('document_root:absolute', 'option',
                 _('Link files under document root with full file path')
                 ),  # T: radio option in export dialog
                ('document_root:url', 'option', _('Map document root to URL') +
                 ': '),  # T: radio option in export dialog
                ('document_root_url', 'string', None),
            ),
            depends={'document_root_url': 'document_root:url'})

        ## Same button appears in edit preferences dialog
        if gtk.gtk_version >= (2, 10) \
        and gtk.pygtk_version >= (2, 10):
            url_button = gtk.LinkButton(
                'https://github.com/jaap-karssenberg/zim-wiki/wiki/Templates',
                _('Get more templates online')  # T: label for button with URL
            )
            self.pack_start(url_button, False)

        # Set template list based on selected format
        def set_templates(self):
            format = self.form['format']
            format = zim.formats.canonical_name(format)
            if format == 'mhtml':
                format = 'html'
            combobox = self.form.widgets['template']
            combobox.get_model().clear()

            for name, _ in zim.templates.list_templates(format):
                combobox.append_text(name)
            combobox.append_text(self.CHOICE_OTHER)
            combobox.set_sensitive(True)

            template = self.uistate['template']
            if template == '__file__':
                # Select "Other..."
                combobox.set_active(len(templates))
            else:
                try:
                    self.form['template'] = template
                except ValueError:
                    combobox.set_active(0)

        self.form.widgets['format'].connect_object('changed', set_templates,
                                                   self)

        # Hook template entry to be sensitive on "Other.."
        self.form.widgets['template_file'].set_sensitive(False)
        self.form.widgets['template'].connect(
            'changed', lambda o: self.form.widgets['template_file'].
            set_sensitive(o.get_active_text() == self.CHOICE_OTHER))

        # Check if we have a document root - if not disable all options
        docroot = assistant.ui.notebook.document_root
        if not docroot:
            for widget in self.form.widgets:
                if widget.startswith('document_root:'):
                    self.form.widgets[widget].set_sensitive(False)
            self.uistate.input(document_root_url='')
Exemplo n.º 10
0
	def __init__(self, assistant):
		AssistantPage.__init__(self, assistant)
		self.export_formats = zim.formats.list_formats(zim.formats.EXPORT_FORMAT)
		self.export_formats.insert(1, 'MHTML (Web Page Archive)') # TODO translatable

		self.add_form((
			('format', 'choice', _('Format'), self.export_formats), # T: Input label in the export dialog
			('template', 'choice', _('Template'), ()), # T: Input label in the export dialog
			('template_file', 'file', None),
			None,
			('document_root:absolute', 'option', _('Link files under document root with full file path')), # T: radio option in export dialog
			('document_root:url', 'option', _('Map document root to URL')+': '), # T: radio option in export dialog
			('document_root_url', 'string', None),
		), depends={
			'document_root_url': 'document_root:url'
		} )

		## Same button appears in edit preferences dialog
		if gtk.gtk_version >= (2, 10) \
		and gtk.pygtk_version >= (2, 10):
			url_button = gtk.LinkButton(
				'https://github.com/jaap-karssenberg/zim-wiki/wiki/Templates',
				_('Get more templates online') # T: label for button with URL
			)
			self.pack_start(url_button, False)


		# Set template list based on selected format
		def set_templates(self):
			format = self.form['format']
			format = zim.formats.canonical_name(format)
			if format == 'mhtml':
				format = 'html'
			combobox = self.form.widgets['template']
			combobox.get_model().clear()

			for name, _ in zim.templates.list_templates(format):
				combobox.append_text(name)
			combobox.append_text(self.CHOICE_OTHER)
			combobox.set_sensitive(True)

			template = self.uistate['template']
			if template == '__file__':
				# Select "Other..."
				combobox.set_active(len(templates))
			else:
				try:
					self.form['template'] = template
				except ValueError:
					combobox.set_active(0)

		self.form.widgets['format'].connect_object('changed', set_templates, self)

		# Hook template entry to be sensitive on "Other.."
		self.form.widgets['template_file'].set_sensitive(False)
		self.form.widgets['template'].connect('changed',
			lambda o: self.form.widgets['template_file'].set_sensitive(
							o.get_active_text() == self.CHOICE_OTHER) )

		# Check if we have a document root - if not disable all options
		docroot = assistant.ui.notebook.document_root
		if not docroot:
			for widget in self.form.widgets:
				if widget.startswith('document_root:'):
					self.form.widgets[widget].set_sensitive(False)
			self.uistate.input(document_root_url='')