Exemplo n.º 1
0
    def __init__(self, workspace):
        Observable.__init__(self)

        self.workspace = workspace
        self.view = ServiceLocator.get_main_window().help_panel

        self.path = 'file://' + os.path.join(
            ServiceLocator.get_resources_path(), 'help')
        self.home_uri = self.path + '/latex2e_0.html'
        self.current_uri = self.home_uri

        with open(
                os.path.join(ServiceLocator.get_resources_path(), 'help',
                             'search_index.pickle'), 'rb') as filehandle:
            self.search_index = pickle.load(filehandle)

        self.search_results_blank = list()
        self.search_results = self.search_results_blank
        self.query = ''

        self.controller = help_panel_controller.HelpPanelController(
            self, self.view)
        self.presenter = help_panel_presenter.HelpPanelPresenter(
            self, self.view)

        self.add_change_code('search_query_changed')
Exemplo n.º 2
0
    def setup(self):
        file_filter1 = Gtk.FileFilter()
        file_filter1.add_pattern('*.bib')
        file_filter1.set_name(_('BibTeX Files'))
        self.view.file_chooser_button.add_filter(file_filter1)

        first_button = None
        for name in self.style_names:
            style = name.lower()
            self.view.style_buttons[style] = Gtk.RadioButton()
            if first_button == None:
                first_button = self.view.style_buttons[style]
            box = Gtk.HBox()
            box.pack_start(Gtk.Label(name), False, False, 0)
            box.set_margin_right(6)
            box.set_margin_left(4)
            self.view.style_buttons[style].add(box)
            self.view.style_buttons[style].set_mode(False)
            if first_button != None:
                self.view.style_buttons[style].join_group(first_button)
            self.view.style_switcher.pack_start(self.view.style_buttons[style],
                                                False, False, 0)
            self.view.style_buttons[style].connect('toggled',
                                                   self.on_style_chosen, style)

            image = Gtk.Image.new_from_file(
                os.path.join(ServiceLocator.get_resources_path(),
                             'bibliography_styles', style + '.png'))
            self.view.preview_stack.add_named(image, style)

        first_button = None
        for name in self.natbib_style_names:
            style = name.lower()
            self.view.natbib_style_buttons[style] = Gtk.RadioButton()
            if first_button == None:
                first_button = self.view.natbib_style_buttons[style]
            box = Gtk.HBox()
            box.pack_start(Gtk.Label(name), False, False, 0)
            box.set_margin_right(6)
            box.set_margin_left(4)
            self.view.natbib_style_buttons[style].add(box)
            self.view.natbib_style_buttons[style].set_mode(False)
            if first_button != None:
                self.view.natbib_style_buttons[style].join_group(first_button)
            self.view.natbib_style_switcher.pack_start(
                self.view.natbib_style_buttons[style], False, False, 0)
            self.view.natbib_style_buttons[style].connect(
                'toggled', self.on_natbib_style_chosen, style)

            image = Gtk.Image.new_from_file(
                os.path.join(ServiceLocator.get_resources_path(),
                             'bibliography_styles', style + '.png'))
            self.view.natbib_preview_stack.add_named(image, style)

        self.view.topbox.show_all()

        self.view.file_chooser_button.connect('file-set', self.on_file_chosen)
        self.view.natbib_option.connect('toggled', self.on_natbib_toggled)
Exemplo n.º 3
0
 def load_beamer_images(self):
     with self.image_loading_lock:
         for name in self.view.theme_names:
             for i in range(0, 2):
                 pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(os.path.join(ServiceLocator.get_resources_path(), 'document_wizard', 'beamerpreview_' + name + '_page_' + str(i) + '.png'), 346, 260, False)
                 image = Gtk.Image.new_from_pixbuf(pixbuf)
                 self.view.preview_images[name].append(image)
                 pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(os.path.join(ServiceLocator.get_resources_path(), 'document_wizard', 'beamerpreview_' + name + '_page_' + str(i) + '.png'), 100, 75, False)
                 image = Gtk.Image.new_from_pixbuf(pixbuf)
                 self.view.preview_button_images[name].append(image)
         self.view.preview_stack.show_all()
Exemplo n.º 4
0
    def __init__(self, document):
        GtkSource.Buffer.__init__(self)

        self.document = document
        self.view = GtkSource.View.new_with_buffer(self)
        self.view.set_monospace(True)
        self.view.set_smart_home_end(True)
        self.view.set_auto_indent(True)
        self.view.set_left_margin(6)
        self.settings = ServiceLocator.get_settings()

        resources_path = ServiceLocator.get_resources_path()

        self.mover_mark = self.create_mark('mover', self.get_start_iter(),
                                           True)

        # set source language for syntax highlighting
        self.source_language_manager = GtkSource.LanguageManager()
        self.source_language_manager.set_search_path(
            (os.path.join(resources_path, 'gtksourceview',
                          'language-specs'), ))
        self.source_language = self.source_language_manager.get_language(
            self.document.get_gsv_language_name())
        self.set_language(self.source_language)

        self.source_style_scheme_manager = GtkSource.StyleSchemeManager()
        self.source_style_scheme_manager.set_search_path(
            (os.path.join(resources_path, 'gtksourceview', 'styles'), ))
        self.source_style_scheme_light = self.source_style_scheme_manager.get_scheme(
            'setzer')
        self.source_style_scheme_dark = self.source_style_scheme_manager.get_scheme(
            'setzer-dark')

        self.search_settings = GtkSource.SearchSettings()
        self.search_context = GtkSource.SearchContext.new(
            self, self.search_settings)
        self.search_context.set_highlight(True)

        self.insert_position = 0

        self.synctex_tag_count = 0
        self.synctex_highlight_tags = dict()

        self.indentation_update = None
        self.indentation_tags = dict()
        self.tab_width = self.settings.get_value('preferences', 'tab_width')
        self.settings.register_observer(self)

        self.placeholder_tag = self.create_tag('placeholder')
        self.placeholder_tag.set_property('background', '#fce94f')
        self.placeholder_tag.set_property('foreground', '#000')

        self.view.connect('key-press-event', self.on_keypress)

        self.connect('mark-set', self.on_mark_set)
        self.connect('mark-deleted', self.on_mark_deleted)
        self.connect('insert-text', self.on_insert_text)
        self.connect('delete-range', self.on_delete_range)

        self.document.add_change_code('buffer_ready')
Exemplo n.º 5
0
    def __init__(self, symbol_folder, symbol_width):
        Gtk.FlowBox.__init__(self)

        self.symbol_folder = symbol_folder
        self.symbol_width = symbol_width

        self.size = None

        # symbols: icon name, latex code
        self.symbols = list()
        self.visible_symbols = list()

        self.set_homogeneous(False)
        self.set_valign(Gtk.Align.START)
        self.set_max_children_per_line(20)

        xml_tree = ET.parse(
            os.path.join(ServiceLocator.get_resources_path(), 'symbols',
                         symbol_folder + '.xml'))
        xml_root = xml_tree.getroot()
        for symbol_tag in xml_root:
            self.symbols.append([
                symbol_tag.attrib['file'].rsplit('.')[0],
                symbol_tag.attrib['command'],
                symbol_tag.attrib.get('package', None),
                int(symbol_tag.attrib.get('original_width', 10)),
                int(symbol_tag.attrib.get('original_height', 10))
            ])

        self.init_symbols_list()
Exemplo n.º 6
0
    def init_buffer(self):
        self.source_buffer = GtkSource.Buffer()

        resources_path = ServiceLocator.get_resources_path()

        # set source language for syntax highlighting
        self.source_language_manager = GtkSource.LanguageManager()
        self.source_language_manager.set_search_path(
            (os.path.join(resources_path, 'gtksourceview',
                          'language-specs'), ))
        self.source_language = self.source_language_manager.get_language(
            self.get_gsv_language_name())
        self.source_buffer.set_language(self.source_language)

        self.source_style_scheme_manager = GtkSource.StyleSchemeManager()
        self.source_style_scheme_manager.set_search_path(
            (os.path.join(resources_path, 'gtksourceview', 'styles'), ))
        self.source_style_scheme_light = self.source_style_scheme_manager.get_scheme(
            'setzer')
        self.source_style_scheme_dark = self.source_style_scheme_manager.get_scheme(
            'setzer-dark')

        self.search_settings = GtkSource.SearchSettings()
        self.search_context = GtkSource.SearchContext.new(
            self.source_buffer, self.search_settings)
        self.search_context.set_highlight(True)

        self.source_buffer.connect('changed', self.on_buffer_changed)
        self.source_buffer.connect('insert-text', self.on_insert_text)

        self.add_change_code('buffer_ready')
Exemplo n.º 7
0
    def __init__(self, symbol_folder, symbol_width, is_dark_mode):
        SidebarPage.__init__(self)
        self.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        
        self.symbol_folder = symbol_folder
        self.symbol_width = symbol_width
        
        self.size = None
        
        # symbols: icon name, latex code
        self.symbols = list()
        self.images = list()
        
        self.flowbox = Gtk.FlowBox()
        self.flowbox.set_homogeneous(False)
        self.flowbox.set_valign(Gtk.Align.START)
        self.flowbox.set_max_children_per_line(20)
        
        self.parent_folder = 'dark' if is_dark_mode else 'light'

        xml_tree = ET.parse(os.path.join(ServiceLocator.get_resources_path(), 'symbols', symbol_folder + '.xml'))
        xml_root = xml_tree.getroot()
        for symbol_tag in xml_root:
            self.symbols.append([symbol_tag.attrib['file'].rsplit('.')[0], symbol_tag.attrib['command'], symbol_tag.attrib.get('package', None), int(symbol_tag.attrib.get('original_width', 10)), int(symbol_tag.attrib.get('original_height', 10))])
        
        self.init_symbols_list()

        self.add(self.flowbox)
Exemplo n.º 8
0
    def __init__(self, workspace):
        Observable.__init__(self)

        self.workspace = workspace
        self.view = ServiceLocator.get_main_window().help_panel

        self.path = 'file://' + os.path.join(
            ServiceLocator.get_resources_path(), 'help')
        self.home_uri = self.path + '/latex2e_0.html'
        self.current_uri = self.home_uri

        with open(
                os.path.join(ServiceLocator.get_resources_path(), 'help',
                             'search_index.pickle'), 'rb') as filehandle:
            self.search_index = pickle.load(filehandle)

        self.search_results_blank = list()
        self.search_results = self.search_results_blank
        self.query = ''

        GLib.idle_add(self.activate, priority=GLib.PRIORITY_LOW)
Exemplo n.º 9
0
    def __init__(self, workspace):
        self.count = 0

        self.workspace = workspace
        self.view = ServiceLocator.get_main_window().help_panel

        self.view.content.connect('decide-policy', self.on_policy_decision)
        self.view.content.connect('context-menu', self.on_context_menu)

        self.uri = 'file://' + os.path.join(ServiceLocator.get_resources_path(), 'help', 'latex2e_unofficial_reference_manual_october_2018')
        self.view.content.load_uri(self.uri)

        self.view.content.get_back_forward_list().connect('changed', self.on_back_forward_list_changed)
        self.view.back_button.connect('clicked', self.on_back_button_clicked)
        self.view.next_button.connect('clicked', self.on_next_button_clicked)
        self.view.up_button.connect('clicked', self.on_up_button_clicked)
Exemplo n.º 10
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()
Exemplo n.º 11
0
    def __init__(self, document):
        GtkSource.Buffer.__init__(self)

        self.document = document
        self.view = GtkSource.View.new_with_buffer(self)
        self.view.set_monospace(True)
        self.view.set_smart_home_end(True)
        self.view.set_auto_indent(True)
        self.view.set_left_margin(6)
        self.settings = ServiceLocator.get_settings()

        resources_path = ServiceLocator.get_resources_path()

        # set source language for syntax highlighting
        self.source_language_manager = GtkSource.LanguageManager()
        self.source_language = self.source_language_manager.get_language(
            self.document.get_gsv_language_name())
        self.set_language(self.source_language)

        self.source_style_scheme_manager = GtkSource.StyleSchemeManager()
        self.source_style_scheme_manager.set_search_path(
            (os.path.join(resources_path, 'gtksourceview', 'styles'), ))
        self.source_style_scheme_light = self.source_style_scheme_manager.get_scheme(
            'setzer')
        self.source_style_scheme_dark = self.source_style_scheme_manager.get_scheme(
            'setzer-dark')

        self.search_settings = GtkSource.SearchSettings()
        self.search_context = GtkSource.SearchContext.new(
            self, self.search_settings)
        self.search_context.set_highlight(True)

        self.synctex_tag_count = 0
        self.synctex_highlight_tags = dict()

        self.document.add_change_code('buffer_ready')
Exemplo n.º 12
0
    def add_recent_symbol_to_flowbox(self, item):
        (category, command) = item
        xml_tree = ET.parse(os.path.join(ServiceLocator.get_resources_path(), 'symbols', category + '.xml'))
        xml_root = xml_tree.getroot()
        elements = xml_root.findall('./symbol[@command=\'' + command + '\']')
        if len(elements) == 0:
            self.remove_recent_symbol(item)
        else:
            attrib = elements[0].attrib
            symbol = [attrib['file'].rsplit('.')[0], attrib['command'], attrib.get('package', None), int(attrib.get('original_width', 10)), int(attrib.get('original_height', 10))]
            size = max(symbol[3], symbol[4])

            image = Gtk.Image.new_from_icon_name('sidebar-' + symbol[0] + '-symbolic', 0)
            image.set_pixel_size(int(size * 1.5))
            tooltip_text = symbol[1]
            if symbol[2] != None: 
                tooltip_text += ' (' + _('Package') + ': ' + symbol[2] + ')'
            image.set_tooltip_text(tooltip_text)
            image.show_all()
            symbol.append(image)
            self.recent_details.append(symbol)

            self.view.symbols_view_recent.insert(image, 0)
            self.view.queue_draw()
Exemplo n.º 13
0
    def __init__(self, app):
        Gtk.Window.__init__(self, application=app)
        self.app = app
        self.set_size_request(-1, 550)
        self.add_events(Gdk.EventMask.KEY_PRESS_MASK)

        # window state variables
        self.current_width = 0
        self.current_height = 0
        self.ismaximized = False

        # headerbar
        self.headerbar = headerbar_view.HeaderBar()
        self.set_titlebar(self.headerbar)

        # latex notebook
        self.latex_notebook = Gtk.Notebook()
        self.latex_notebook.set_show_tabs(False)
        self.latex_notebook.set_show_border(False)
        self.latex_notebook.set_scrollable(True)
        self.latex_notebook.set_size_request(550, -1)
        self.latex_shortcuts_bar = latex_shortcutsbar_view.LaTeXShortcutsBar()
        self.latex_notebook_wrapper = Gtk.VBox()
        self.latex_notebook_wrapper.pack_start(self.latex_shortcuts_bar, False,
                                               False, 0)
        self.latex_notebook_wrapper.pack_start(self.latex_notebook, True, True,
                                               0)

        # bibtex notebook
        self.bibtex_notebook = Gtk.Notebook()
        self.bibtex_notebook.set_show_tabs(False)
        self.bibtex_notebook.set_show_border(False)
        self.bibtex_notebook.set_scrollable(True)
        self.bibtex_notebook.set_size_request(550, -1)
        self.bibtex_shortcuts_bar = bibtex_shortcutsbar_view.BibTeXShortcutsBar(
        )
        self.bibtex_notebook_wrapper = Gtk.VBox()
        self.bibtex_notebook_wrapper.pack_start(self.bibtex_shortcuts_bar,
                                                False, False, 0)
        self.bibtex_notebook_wrapper.pack_start(self.bibtex_notebook, True,
                                                True, 0)

        # others notebook
        self.others_notebook = Gtk.Notebook()
        self.others_notebook.set_show_tabs(False)
        self.others_notebook.set_show_border(False)
        self.others_notebook.set_scrollable(True)
        self.others_notebook.set_size_request(550, -1)
        self.others_shortcuts_bar = others_shortcutsbar_view.OthersShortcutsBar(
        )
        self.others_notebook_wrapper = Gtk.VBox()
        self.others_notebook_wrapper.pack_start(self.others_shortcuts_bar,
                                                False, False, 0)
        self.others_notebook_wrapper.pack_start(self.others_notebook, True,
                                                True, 0)

        # build log
        self.build_log = build_log_view.BuildLogView()
        self.build_log_paned = Gtk.VPaned()
        self.build_log_paned.pack1(self.latex_notebook_wrapper, True, False)
        self.build_log_paned.pack2(self.build_log, False, True)
        self.build_log_visible = None

        # preview
        self.preview_panel = preview_panel_view.PreviewPanelView()
        self.preview_visible = None

        # help
        self.help_panel = help_panel_view.HelpPanelView()
        self.help_visible = None

        # sidebar
        self.sidebar = sidebar_view.Sidebar()
        self.sidebar_visible = None

        # paneds
        self.preview_paned_overlay = Gtk.Overlay()
        self.overlay_widget = None
        self.preview_help_stack = Gtk.Stack()
        self.preview_help_stack.add_named(self.preview_panel, 'preview')
        self.preview_help_stack.add_named(self.help_panel, 'help')
        self.preview_paned = Gtk.HPaned()
        self.preview_paned.pack1(self.build_log_paned, True, False)
        self.preview_paned.pack2(self.preview_help_stack, False, True)
        self.preview_paned_overlay.add(self.preview_paned)
        self.sidebar_paned = Gtk.HPaned()
        self.sidebar_paned.pack1(self.sidebar, False, True)
        self.sidebar_paned.pack2(self.preview_paned_overlay, True, False)
        self.sidebar_paned.get_style_context().add_class('sidebar_paned')

        # welcome screen
        self.welcome_screen = welcome_screen_view.WelcomeScreenView()

        # mode stack
        self.mode_stack = Gtk.Stack()
        self.mode_stack.add_named(self.welcome_screen, 'welcome_screen')
        self.mode_stack.add_named(self.sidebar_paned, 'latex_documents')
        self.mode_stack.add_named(self.bibtex_notebook_wrapper,
                                  'bibtex_documents')
        self.mode_stack.add_named(self.others_notebook_wrapper,
                                  'other_documents')
        self.add(self.mode_stack)

        self.css_provider = Gtk.CssProvider()
        resources_path = ServiceLocator.get_resources_path()
        self.css_provider.load_from_path(
            os.path.join(resources_path, 'style_gtk.css'))
        self.style_context = Gtk.StyleContext()
        self.style_context.add_provider_for_screen(
            self.get_screen(), self.css_provider,
            Gtk.STYLE_PROVIDER_PRIORITY_USER)

        self.css_provider_font_size = Gtk.CssProvider()
        self.style_context.add_provider_for_screen(
            self.get_screen(), self.css_provider_font_size,
            Gtk.STYLE_PROVIDER_PRIORITY_USER)
Exemplo n.º 14
0
    def __init__(self, app, settings):
        Gtk.Window.__init__(self, application=app)
        self.app = app
        self.set_size_request(-1, 550)
        self.add_events(Gdk.EventMask.KEY_PRESS_MASK)
        resources_path = ServiceLocator.get_resources_path()
        app_icons_path = ServiceLocator.get_app_icons_path()
        Gtk.IconTheme.append_search_path(Gtk.IconTheme.get_default(),
                                         os.path.join(resources_path, 'icons'))
        Gtk.IconTheme.append_search_path(
            Gtk.IconTheme.get_default(),
            os.path.join(resources_path, 'symbols', 'arrows'))
        Gtk.IconTheme.append_search_path(
            Gtk.IconTheme.get_default(),
            os.path.join(resources_path, 'symbols', 'greek_letters'))
        Gtk.IconTheme.append_search_path(
            Gtk.IconTheme.get_default(),
            os.path.join(resources_path, 'symbols', 'misc_math'))
        Gtk.IconTheme.append_search_path(
            Gtk.IconTheme.get_default(),
            os.path.join(resources_path, 'symbols', 'misc_text'))
        Gtk.IconTheme.append_search_path(
            Gtk.IconTheme.get_default(),
            os.path.join(resources_path, 'symbols', 'operators'))
        Gtk.IconTheme.append_search_path(
            Gtk.IconTheme.get_default(),
            os.path.join(resources_path, 'symbols', 'relations'))
        Gtk.IconTheme.append_search_path(Gtk.IconTheme.get_default(),
                                         app_icons_path)

        # window state variables
        self.current_width = 0
        self.current_height = 0
        self.ismaximized = False

        # headerbar
        self.headerbar = headerbar_view.HeaderBar()
        self.set_titlebar(self.headerbar)

        # notebook
        self.notebook_wrapper = Gtk.VBox()
        self.notebook = DocumentViewWrapper()
        self.shortcuts_bar = shortcutsbar_view.ShortcutsBar()
        self.notebook_wrapper.pack_start(self.shortcuts_bar, False, False, 0)
        self.notebook_wrapper.pack_start(self.notebook, True, True, 0)

        # bibtex notebook
        self.bibtex_notebook = Gtk.Notebook()
        self.bibtex_notebook.set_show_tabs(False)
        self.bibtex_notebook.set_show_border(False)
        self.bibtex_notebook.set_scrollable(True)
        self.bibtex_shortcuts_bar = bibtex_shortcutsbar_view.BibTeXShortcutsBar(
        )
        self.bibtex_notebook_wrapper = Gtk.VBox()
        self.bibtex_notebook_wrapper.pack_start(self.bibtex_shortcuts_bar,
                                                False, False, 0)
        self.bibtex_notebook_wrapper.pack_start(self.bibtex_notebook, True,
                                                True, 0)

        # build log
        self.build_log = build_log_view.BuildLogView()
        self.build_log_paned = Gtk.VPaned()
        self.build_log_paned.pack1(self.notebook_wrapper, True, False)
        self.build_log_paned.pack2(self.build_log, False, True)
        self.build_log_visible = None

        # preview
        self.preview_panel = preview_panel_view.PreviewPanelView()
        self.preview_visible = None

        # sidebar
        self.sidebar = sidebar_view.Sidebar()
        self.sidebar_visible = None

        # paneds
        self.preview_paned_overlay = Gtk.Overlay()
        self.overlay_widget = None
        self.preview_paned = Gtk.HPaned()
        self.preview_paned.pack1(self.build_log_paned, True, False)
        self.preview_paned.pack2(self.preview_panel, False, True)
        self.preview_paned_overlay.add(self.preview_paned)
        self.sidebar_paned = Gtk.HPaned()
        self.sidebar_paned.pack1(self.sidebar, False, True)
        self.sidebar_paned.pack2(self.preview_paned_overlay, True, False)
        self.sidebar_paned.get_style_context().add_class('sidebar_paned')

        # blank slate
        self.blank_slate = BlankSlate()

        # mode stack
        self.mode_stack = Gtk.Stack()
        self.mode_stack.add_named(self.blank_slate, 'blank_slate')
        self.mode_stack.add_named(self.sidebar_paned, 'latex_documents')
        self.mode_stack.add_named(self.bibtex_notebook_wrapper,
                                  'bibtex_documents')
        self.add(self.mode_stack)

        self.css_provider = Gtk.CssProvider()
        self.css_provider.load_from_path(
            os.path.join(resources_path, 'style_gtk.css'))
        self.style_context = Gtk.StyleContext()
        self.style_context.add_provider_for_screen(
            self.get_screen(), self.css_provider,
            Gtk.STYLE_PROVIDER_PRIORITY_USER)

        # actions
        self.new_latex_document_action = Gio.SimpleAction.new(
            'new-latex-document', None)
        self.add_action(self.new_latex_document_action)

        self.new_bibtex_document_action = Gio.SimpleAction.new(
            'new-bibtex-document', None)
        self.add_action(self.new_bibtex_document_action)

        self.save_as_action = Gio.SimpleAction.new('save-as', None)
        self.add_action(self.save_as_action)

        self.save_all_action = Gio.SimpleAction.new('save-all', None)
        self.add_action(self.save_all_action)

        self.save_session_action = Gio.SimpleAction.new('save-session', None)
        self.add_action(self.save_session_action)

        self.restore_session_action = Gio.SimpleAction.new(
            'restore-session', GLib.VariantType('as'))
        self.add_action(self.restore_session_action)

        self.find_action = Gio.SimpleAction.new('find', None)
        self.add_action(self.find_action)

        self.find_next_action = Gio.SimpleAction.new('find-next', None)
        self.add_action(self.find_next_action)

        self.find_prev_action = Gio.SimpleAction.new('find-prev', None)
        self.add_action(self.find_prev_action)

        self.find_replace_action = Gio.SimpleAction.new('find-replace', None)
        self.add_action(self.find_replace_action)

        self.close_all_action = Gio.SimpleAction.new('close-all-documents',
                                                     None)
        self.add_action(self.close_all_action)

        self.close_document_action = Gio.SimpleAction.new(
            'close-active-document', None)
        self.add_action(self.close_document_action)

        self.insert_before_after_action = Gio.SimpleAction.new(
            'insert-before-after', GLib.VariantType('as'))
        self.add_action(self.insert_before_after_action)

        self.insert_symbol_action = Gio.SimpleAction.new(
            'insert-symbol', GLib.VariantType('as'))
        self.add_action(self.insert_symbol_action)

        self.insert_before_document_end_action = Gio.SimpleAction.new(
            'insert-before-document-end', GLib.VariantType('as'))
        self.add_action(self.insert_before_document_end_action)

        self.document_wizard_action = Gio.SimpleAction.new(
            'show-document-wizard', None)
        self.add_action(self.document_wizard_action)

        self.create_new_bibtex_entry_action = Gio.SimpleAction.new(
            'create-new-bibtex-entry', None)
        self.add_action(self.create_new_bibtex_entry_action)

        self.show_previous_bibtex_entries_action = Gio.SimpleAction.new(
            'show-previous-bibtex-entries', None)
        self.add_action(self.show_previous_bibtex_entries_action)

        self.search_online_for_bibtex_entries_action = Gio.SimpleAction.new(
            'search-online-for-bibtex-entries', None)
        self.add_action(self.search_online_for_bibtex_entries_action)

        self.include_bibtex_file_action = Gio.SimpleAction.new(
            'include-bibtex-file', None)
        self.add_action(self.include_bibtex_file_action)

        self.include_latex_file_action = Gio.SimpleAction.new(
            'include-latex-file', None)
        self.add_action(self.include_latex_file_action)

        self.add_remove_packages_dialog_action = Gio.SimpleAction.new(
            'add-remove-packages-dialog', None)
        self.add_action(self.add_remove_packages_dialog_action)

        self.add_packages_action = Gio.SimpleAction.new(
            'add-packages', GLib.VariantType('as'))
        self.add_action(self.add_packages_action)

        self.shortcuts_window_action = Gio.SimpleAction.new(
            'show-shortcuts-window', None)
        self.add_action(self.shortcuts_window_action)

        self.show_preferences_action = Gio.SimpleAction.new(
            'show-preferences-dialog', None)
        self.add_action(self.show_preferences_action)

        self.show_about_action = Gio.SimpleAction.new('show-about-dialog',
                                                      None)
        self.add_action(self.show_about_action)

        self.quit_action = Gio.SimpleAction.new('quit', None)
        self.add_action(self.quit_action)

        self.close_build_log_action = Gio.SimpleAction.new(
            'close-build-log', None)
        self.add_action(self.close_build_log_action)

        sc_default = GLib.Variant.new_boolean(
            settings.get_value('preferences', 'inline_spellchecking'))
        self.toggle_spellchecking_action = Gio.SimpleAction.new_stateful(
            'toggle-spellchecking', None, sc_default)
        self.add_action(self.toggle_spellchecking_action)

        self.set_spellchecking_language_action = Gio.SimpleAction.new(
            'set-spellchecking-language', None)
        self.add_action(self.set_spellchecking_language_action)

        self.spellchecking_action = Gio.SimpleAction.new('spellchecking', None)
        self.add_action(self.spellchecking_action)

        dm_default = GLib.Variant.new_boolean(
            settings.get_value('preferences', 'prefer_dark_mode'))
        self.toggle_dark_mode_action = Gio.SimpleAction.new_stateful(
            'toggle-dark-mode', None, dm_default)
        self.add_action(self.toggle_dark_mode_action)
        settings.gtksettings.get_default().set_property(
            'gtk-application-prefer-dark-theme', dm_default)