예제 #1
0
    def __init__(self):
        PageView.__init__(self)
        self.set_document_settings_page()
            
        self.header.set_text(_('Article settings'))
        self.headerbar_subtitle = _('Step') + ' 2: ' + _('Article settings')

        self.subheader_options = Gtk.Label('Options')
        self.subheader_options.get_style_context().add_class('document-wizard-subheader')
        self.subheader_options.set_xalign(0)
        self.subheader_options.set_margin_top(18)

        self.option_twocolumn = Gtk.CheckButton.new_with_label(_('Two-column layout'))

        self.pack_start(self.header, False, False, 0)

        self.left_content.pack_start(self.subheader_page_format, False, False, 0)
        self.left_content.pack_start(self.page_format_list, False, False, 0)
        self.left_content.pack_start(self.orientation_box, False, False, 0)
        self.left_content.pack_start(self.subheader_margins, False, False, 0)
        self.left_content.pack_start(self.option_default_margins, False, False, 0)
        self.left_content.pack_start(self.margins_box, False, False, 0)
        self.left_content.pack_start(self.margins_description, False, False, 0)

        self.right_content.pack_start(self.subheader_font_size, False, False, 0)
        self.right_content.pack_start(self.font_size_entry, False, False, 0)
        self.right_content.pack_start(self.subheader_options, False, False, 0)
        self.right_content.pack_start(self.option_twocolumn, False, False, 0)

        self.content.pack_start(self.left_content, False, False, 0)
        self.content.pack_start(self.right_content, False, False, 0)
        self.pack_start(self.content, False, False, 0)
        self.show_all()
예제 #2
0
    def __init__(self):
        PageView.__init__(self)
        self.set_document_settings_page()

        self.header.set_text(_('Letter settings'))
        self.headerbar_subtitle = _('Step') + ' 2: ' + _('Letter settings')

        self.pack_start(self.header, False, False, 0)

        self.left_content.pack_start(self.subheader_page_format, False, False,
                                     0)
        self.left_content.pack_start(self.page_format_list, False, False, 0)
        self.left_content.pack_start(self.subheader_margins, False, False, 0)
        self.left_content.pack_start(self.option_default_margins, False, False,
                                     0)
        self.left_content.pack_start(self.margins_box, False, False, 0)

        self.right_content.pack_start(self.subheader_font_size, False, False,
                                      0)
        self.right_content.pack_start(self.font_size_entry, False, False, 0)

        self.content.pack_start(self.left_content, False, False, 0)
        self.content.pack_start(self.right_content, False, False, 0)
        self.pack_start(self.content, False, False, 0)
        self.show_all()
예제 #3
0
 def __init__(self):
     PageView.__init__(self)
         
     self.header.set_text(_('Choose a document class'))
     self.headerbar_subtitle = _('Step') + ' 1: ' + _('Choose a document class')
     self.content = Gtk.HBox()
     
     self.list = Gtk.ListBox()
     self.list.set_can_focus(True)
     self.list.set_size_request(348, -1)
     self.list_rows = dict()
     for document_class in ['beamer', 'letter', 'book', 'report', 'article']:
         label = Gtk.Label(document_class.title())
         label.set_xalign(0)
         self.list.prepend(label)
     for row in self.list.get_children():
         self.list_rows[row.get_child().get_text().lower()] = row
         row.set_can_focus(True)
     self.list.set_margin_right(0)
     self.list.set_vexpand(False)
     self.list.get_style_context().add_class('document-wizard-list1')
     
     self.preview_container = Gtk.Stack()
     self.preview_container.set_size_request(366, -1)
     self.preview_data = list()
     self.preview_data.append({'name': 'article', 'image': 'article1.svg', 'text': _('<b>Article:</b>  For articles in scientific journals, term\npapers, handouts, short reports, ...\n\nThis class on its own is pretty simplistic and\nis often used as a starting point for more\ncustom layouts.')})
     self.preview_data.append({'name': 'book', 'image': 'book1.svg', 'text': _('<b>Book:</b>  For actual books containing many chapters\nand sections.')})
     self.preview_data.append({'name': 'report', 'image': 'report1.svg', 'text': _('<b>Report:</b>  For longer reports and articles containing\nmore than one chapter, small books, thesis.')})
     self.preview_data.append({'name': 'letter', 'image': 'letter1.svg', 'text': _('<b>Letter:</b>  For writing letters.')})
     self.preview_data.append({'name': 'beamer', 'image': 'beamer1.svg', 'text': _('<b>Beamer:</b>  A class for making presentation slides\nwith LaTeX.\n\nThere are many predefined presentation styles.')})
     for item in self.preview_data:
         box = Gtk.VBox()
         image = Gtk.Image.new_from_file(os.path.join(ServiceLocator.get_resources_path(), 'document_wizard', item['image']))
         image.set_margin_bottom(6)
         label = Gtk.Label()
         label.set_markup(item['text'])
         label.set_xalign(0)
         label.set_margin_start(19)
         box.pack_start(image, False, False, 0)
         box.pack_start(label, False, False, 0)
         self.preview_container.add_named(box, item['name'])
     
     self.pack_start(self.header, False, False, 0)
     self.content.pack_start(self.list, False, False, 0)
     self.content.pack_start(self.preview_container, False, False, 0)
     self.pack_start(self.content, False, False, 0)
     self.show_all()
예제 #4
0
    def __init__(self):
        PageView.__init__(self)

        self.header.set_text(_('General document settings'))
        self.headerbar_subtitle = _('Step') + ' 3: ' + _(
            'General document settings')
        self.content = Gtk.HBox()
        self.form = Gtk.VBox()

        self.subheader_title = Gtk.Label(_('Title'))
        self.subheader_title.get_style_context().add_class(
            'document-wizard-subheader')
        self.subheader_title.set_xalign(0)
        self.title_entry = Gtk.Entry()
        self.title_entry.set_margin_right(280)
        self.subheader_author = Gtk.Label(_('Author'))
        self.subheader_author.get_style_context().add_class(
            'document-wizard-subheader')
        self.subheader_author.set_xalign(0)
        self.author_entry = Gtk.Entry()
        self.author_entry.set_margin_right(100)
        self.author_box = Gtk.VBox()
        self.author_box.pack_start(self.subheader_author, False, False, 0)
        self.author_box.pack_start(self.author_entry, False, False, 0)
        self.author_box.set_size_request(348, -1)
        self.subheader_date = Gtk.Label(_('Date'))
        self.subheader_date.get_style_context().add_class(
            'document-wizard-subheader')
        self.subheader_date.set_xalign(0)
        self.date_entry = Gtk.Entry()
        self.date_entry.set_margin_right(100)
        self.date_box = Gtk.VBox()
        self.date_box.pack_start(self.subheader_date, False, False, 0)
        self.date_box.pack_start(self.date_entry, False, False, 0)
        self.date_box.set_size_request(348, -1)
        self.document_properties_hbox = Gtk.HBox()
        self.document_properties_hbox.set_margin_top(18)
        self.document_properties_hbox.pack_start(self.author_box, False, False,
                                                 0)
        self.document_properties_hbox.pack_start(self.date_box, False, False,
                                                 0)

        self.subheader_packages = Gtk.Label(_('Packages'))
        self.subheader_packages.get_style_context().add_class(
            'document-wizard-subheader')
        self.subheader_packages.set_margin_top(18)
        self.subheader_packages.set_xalign(0)

        self.packages_box = Gtk.HBox()
        self.packages_leftbox = Gtk.VBox()
        self.packages_leftbox.set_size_request(348, -1)
        self.packages_rightbox = Gtk.VBox()
        self.packages_rightbox.set_size_request(348, -1)
        self.option_packages = dict()
        self.option_packages['ams'] = Gtk.CheckButton.new_with_label(
            _('AMS math packages'))
        self.option_packages['textcomp'] = Gtk.CheckButton.new_with_label(
            'textcomp')
        self.option_packages['graphicx'] = Gtk.CheckButton.new_with_label(
            'graphicx')
        self.option_packages['xcolor'] = Gtk.CheckButton.new_with_label(
            'xcolor')
        self.option_packages['url'] = Gtk.CheckButton.new_with_label('url')
        self.option_packages['hyperref'] = Gtk.CheckButton.new_with_label(
            'hyperref')
        self.option_packages['theorem'] = Gtk.CheckButton.new_with_label(
            'theorem')
        self.option_packages['listings'] = Gtk.CheckButton.new_with_label(
            'listings')
        self.option_packages['glossaries'] = Gtk.CheckButton.new_with_label(
            'glossaries')
        self.option_packages['parskip'] = Gtk.CheckButton.new_with_label(
            'parskip')
        self.packages_leftbox.pack_start(self.option_packages['ams'], False,
                                         False, 0)
        self.packages_leftbox.pack_start(self.option_packages['textcomp'],
                                         False, False, 0)
        self.packages_leftbox.pack_start(self.option_packages['graphicx'],
                                         False, False, 0)
        self.packages_leftbox.pack_start(self.option_packages['xcolor'], False,
                                         False, 0)
        self.packages_leftbox.pack_start(self.option_packages['url'], False,
                                         False, 0)
        self.packages_rightbox.pack_start(self.option_packages['hyperref'],
                                          False, False, 0)
        self.packages_rightbox.pack_start(self.option_packages['theorem'],
                                          False, False, 0)
        self.packages_rightbox.pack_start(self.option_packages['listings'],
                                          False, False, 0)
        self.packages_rightbox.pack_start(self.option_packages['glossaries'],
                                          False, False, 0)
        self.packages_rightbox.pack_start(self.option_packages['parskip'],
                                          False, False, 0)
        self.packages_box.pack_start(self.packages_leftbox, False, False, 0)
        self.packages_box.pack_start(self.packages_rightbox, False, False, 0)

        self.packages_tooltip = Gtk.Label()
        self.packages_tooltip_data = dict()
        self.packages_tooltip_data['ams'] = _(
            '<b>AMS packages:</b> provide mathematical symbols, math-related environments, ...'
        ) + ' (' + _('recommended') + ')'
        self.packages_tooltip_data['textcomp'] = '<b>textcomp:</b> ' + _(
            'contains symbols to be used in textmode.') + ' (' + _(
                'recommended') + ')'
        self.packages_tooltip_data['graphicx'] = '<b>graphicx:</b> ' + _(
            'include graphics in your document.') + ' (' + _(
                'recommended') + ')'
        self.packages_tooltip_data['xcolor'] = '<b>xcolor:</b> ' + _(
            'enables colored text.') + ' (' + _('recommended') + ')'
        self.packages_tooltip_data['url'] = '<b>url:</b> ' + _(
            'type urls with the \\url{..} command without escaping them.'
        ) + ' (' + _('recommended') + ')'
        self.packages_tooltip_data['hyperref'] = '<b>hyperref:</b> ' + _(
            'create hyperlinks within your document.')
        self.packages_tooltip_data['theorem'] = '<b>theorem:</b> ' + _(
            'define theorem environments (like "definition", "lemma", ...) with custom styling.'
        )
        self.packages_tooltip_data['listings'] = '<b>listings:</b> ' + _(
            'provides the \\listing environment for embedding programming code.'
        )
        self.packages_tooltip_data['glossaries'] = '<b>glossaries:</b> ' + _(
            'create a glossary for your document.')
        self.packages_tooltip_data['parskip'] = '<b>parskip:</b> ' + _(
            'paragraphs without indentation.')
        self.packages_tooltip.set_markup(' ')
        self.packages_tooltip.set_xalign(0)
        self.packages_tooltip.set_line_wrap(True)
        self.packages_tooltip.set_margin_top(12)
        self.packages_tooltip.set_margin_right(18)
        self.packages_tooltip.set_size_request(714, -1)

        self.pack_start(self.header, False, False, 0)
        self.form.pack_start(self.subheader_title, False, False, 0)
        self.form.pack_start(self.title_entry, False, False, 0)
        self.form.pack_start(self.document_properties_hbox, False, False, 0)
        self.form.pack_start(self.subheader_packages, False, False, 0)
        self.form.pack_start(self.packages_box, False, False, 0)
        self.form.pack_start(self.packages_tooltip, False, False, 0)
        self.content.pack_start(self.form, False, False, 0)
        self.pack_start(self.content, False, False, 0)
        self.show_all()
예제 #5
0
    def __init__(self):
        PageView.__init__(self)
            
        self.header.set_text('Beamer settings')
        self.headerbar_subtitle = 'Step 2: Beamer settings'
        self.content = Gtk.HBox()
        self.form = Gtk.VBox()
        
        self.theme_names = ['Warsaw', 'Malmoe', 'Luebeck', 'Copenhagen', 'Szeged', 'Singapore', 'Frankfurt', 'Darmstadt', 'Dresden', 'Ilmenau', 'Berlin', 'Hannover', 'Marburg', 'Goettingen', 'PaloAlto', 'Berkeley', 'Montpellier', 'JuanLesPins', 'Antibes', 'Rochester', 'Pittsburgh', 'EastLansing', 'CambridgeUS', 'AnnArbor', 'Madrid', 'Boadilla', 'Bergen', 'Default']

        self.subheader_themes = Gtk.Label('Themes')
        self.subheader_themes.get_style_context().add_class('document-wizard-subheader')
        self.subheader_themes.set_xalign(0)

        self.themes_list_scrolled_window = Gtk.ScrolledWindow()
        self.themes_list_scrolled_window.set_size_request(348, 230)
        self.themes_list_scrolled_window.get_style_context().add_class('document-wizard-scrolledwindow')
        self.themes_list = Gtk.ListBox()
        self.themes_list.set_can_focus(True)
        self.themes_list.set_size_request(346, -1)
        self.themes_list_rows = dict()
        for name in self.theme_names:
            label = Gtk.Label(name)
            label.set_xalign(0)
            self.themes_list.prepend(label)
        for row in self.themes_list.get_children():
            self.themes_list_rows[row.get_child().get_text()] = row
        self.themes_list.set_margin_right(0)
        self.themes_list.set_vexpand(False)
        self.themes_list.get_style_context().add_class('document-wizard-list2')
        self.themes_list_scrolled_window.add(self.themes_list)
        
        self.subheader_options = Gtk.Label('Options')
        self.subheader_options.get_style_context().add_class('document-wizard-subheader')
        self.subheader_options.set_margin_top(18)
        self.subheader_options.set_xalign(0)
        
        self.option_show_navigation = Gtk.CheckButton.new_with_label('Show navigation buttons')
        self.option_top_align = Gtk.CheckButton.new_with_label('Align content to the top of pages')
        self.option_top_align.get_style_context().add_class('has-desc')
        self.option_top_align_desc = Gtk.Label('("t" option, it\'s centered by default)')
        self.option_top_align_desc.get_style_context().add_class('document-wizard-option-desc')
        self.option_top_align_desc.set_xalign(0)
        
        self.preview = Gtk.VBox()
        self.preview_stack_wrapper = Gtk.VBox()
        self.preview_stack_wrapper.get_style_context().add_class('document-wizard-beamer-preview-stack-wrapper')
        self.preview_stack = Gtk.Stack()
        self.preview_button_stack = Gtk.Stack()
        self.preview_button_stack.set_transition_type(Gtk.StackTransitionType.NONE)
        self.preview_images = dict()
        self.preview_image_boxes = dict()
        self.preview_buttons = dict()
        self.preview_button_widgets = dict()
        self.preview_button_images = dict()
        for name in self.theme_names:
            self.preview_images[name] = list()
            self.preview_image_boxes[name] = list()
            self.preview_buttons[name] = list()
            button_box =  Gtk.HBox()
            button_box.get_style_context().add_class('document-wizard-beamer-preview-buttons')
            self.preview_button_widgets[name] = button_box
            self.preview_button_stack.add_named(button_box, name)
            for i in range(0, 2):
                image_box = Gtk.HBox()
                self.preview_image_boxes[name].append(image_box)
                self.preview_stack.add_named(image_box, name + '_' + str(i))
                button = Gtk.Button()
                button.set_margin_end(12)
                button.set_margin_top(12)
                button.set_relief(Gtk.ReliefStyle.NONE)
                self.preview_buttons[name].append(button)
                self.preview_button_images[name] = list()
                self.preview_button_widgets[name].pack_start(button, False, False, 0)
        self.preview_stack_wrapper.pack_start(self.preview_stack, False, False, 0)
        self.preview.pack_start(self.preview_stack_wrapper, False, False, 0)
        self.preview.pack_start(self.preview_button_stack, False, False, 0)
        self.preview.set_margin_top(30)
        self.preview.set_margin_start(18)
        self.preview.set_margin_end(18)

        self.pack_start(self.header, False, False, 0)
        self.form.pack_start(self.subheader_themes, False, False, 0)
        self.form.pack_start(self.themes_list_scrolled_window, False, False, 0)
        self.form.pack_start(self.subheader_options, False, False, 0)
        self.form.pack_start(self.option_show_navigation, False, False, 0)
        self.form.pack_start(self.option_top_align, False, False, 0)
        self.form.pack_start(self.option_top_align_desc, False, False, 0)
        self.content.pack_start(self.form, False, False, 0)
        self.content.pack_start(self.preview, False, False, 0)
        self.pack_start(self.content, False, False, 0)
        self.show_all()