forked from Mirrors/apostrophe
Uniformize main class <> file naming
parent
30df10cab6
commit
99641125ba
|
@ -15,15 +15,9 @@
|
||||||
### END LICENSE
|
### END LICENSE
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import locale
|
|
||||||
import os
|
|
||||||
|
|
||||||
import gettext
|
|
||||||
from gettext import gettext as _
|
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
|
|
||||||
gi.require_version('Gtk', '3.0')
|
gi.require_version('Gtk', '3.0')
|
||||||
from gi.repository import Gtk # pylint: disable=E0611
|
|
||||||
|
|
||||||
from uberwriter import window
|
from uberwriter import window
|
||||||
from uberwriter import application
|
from uberwriter import application
|
||||||
|
@ -34,17 +28,16 @@ from uberwriter.uberwriterconfig import get_version
|
||||||
def main():
|
def main():
|
||||||
'constructor for your class instances'
|
'constructor for your class instances'
|
||||||
# (options, args) = parse_options()
|
# (options, args) = parse_options()
|
||||||
|
|
||||||
# Run the application.
|
# Run the application.
|
||||||
app = application.Application()
|
app = application.Application()
|
||||||
|
|
||||||
# ~ if args:
|
# ~ if args:
|
||||||
# ~ for arg in args:
|
# ~ for arg in args:
|
||||||
# ~ pass
|
# ~ pass
|
||||||
# ~ else:
|
# ~ else:
|
||||||
# ~ pass
|
# ~ pass
|
||||||
# ~ if options.experimental_features:
|
# ~ if options.experimental_features:
|
||||||
# ~ window.use_experimental_features(True)
|
# ~ window.use_experimental_features(True)
|
||||||
|
|
||||||
app.run(sys.argv)
|
app.run(sys.argv)
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ from uberwriter.helpers import get_builder
|
||||||
|
|
||||||
LOGGER = logging.getLogger('uberwriter')
|
LOGGER = logging.getLogger('uberwriter')
|
||||||
|
|
||||||
class Export:
|
class UberwriterExportDialog:
|
||||||
"""
|
"""
|
||||||
Manages all the export operations and dialogs
|
Manages all the export operations and dialogs
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -20,12 +20,12 @@ from collections import namedtuple
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
|
|
||||||
gi.require_version('Gtk', '3.0')
|
gi.require_version('Gtk', '3.0')
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
from uberwriter.helpers import get_builder
|
from uberwriter.helpers import get_builder
|
||||||
from uberwriter.helpers import get_descendant
|
from uberwriter.helpers import get_descendant
|
||||||
|
|
||||||
from uberwriter.application import Application as app
|
|
||||||
|
|
||||||
class MainHeaderbar: #pylint: disable=too-few-public-methods
|
class MainHeaderbar: #pylint: disable=too-few-public-methods
|
||||||
"""Sets up the main application headerbar
|
"""Sets up the main application headerbar
|
||||||
|
@ -54,7 +54,7 @@ class MainHeaderbar: #pylint: disable=too-few-public-methods
|
||||||
self.hb.show_all()
|
self.hb.show_all()
|
||||||
|
|
||||||
|
|
||||||
class FsHeaderbar:
|
class FullscreenHeaderbar:
|
||||||
"""Sets up and manages the fullscreen headerbar and his events
|
"""Sets up and manages the fullscreen headerbar and his events
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -153,6 +153,7 @@ def buttons(app):
|
||||||
|
|
||||||
return btn
|
return btn
|
||||||
|
|
||||||
|
|
||||||
def pack_buttons(headerbar, btn, btn_exit=None):
|
def pack_buttons(headerbar, btn, btn_exit=None):
|
||||||
"""Pack the given buttons in the given headerbar
|
"""Pack the given buttons in the given headerbar
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ class UndoableDelete:
|
||||||
or self.text in ("\r", "\n", " "))
|
or self.text in ("\r", "\n", " "))
|
||||||
|
|
||||||
|
|
||||||
class TextEditor(Gtk.TextView):
|
class UberwriterTextEditor(Gtk.TextView):
|
||||||
"""TextEditor encapsulates management of TextBuffer and TextIter for
|
"""TextEditor encapsulates management of TextBuffer and TextIter for
|
||||||
common functionality, such as cut, copy, paste, undo, redo, and
|
common functionality, such as cut, copy, paste, undo, redo, and
|
||||||
highlighting of text.
|
highlighting of text.
|
||||||
|
@ -442,7 +442,7 @@ class TestWindow(Gtk.Window):
|
||||||
windowbox = Gtk.VBox(homogeneous=False, spacing=2)
|
windowbox = Gtk.VBox(homogeneous=False, spacing=2)
|
||||||
windowbox.show()
|
windowbox.show()
|
||||||
self.add(windowbox)
|
self.add(windowbox)
|
||||||
self.editor = TextEditor()
|
self.editor = UberwriterTextEditor()
|
||||||
self.editor.show()
|
self.editor.show()
|
||||||
windowbox.pack_end(self.editor, True, True, 0)
|
windowbox.pack_end(self.editor, True, True, 0)
|
||||||
self.set_size_request(200, 200)
|
self.set_size_request(200, 200)
|
||||||
|
|
|
@ -26,8 +26,9 @@ import webbrowser
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
from gi.repository.GObject import param_spec_string
|
|
||||||
|
|
||||||
|
from uberwriter.export_dialog import UberwriterExportDialog
|
||||||
|
from uberwriter.text_editor import UberwriterTextEditor
|
||||||
|
|
||||||
gi.require_version('Gtk', '3.0')
|
gi.require_version('Gtk', '3.0')
|
||||||
gi.require_version('WebKit2', '4.0') # pylint: disable=wrong-import-position
|
gi.require_version('WebKit2', '4.0') # pylint: disable=wrong-import-position
|
||||||
|
@ -36,24 +37,21 @@ from gi.repository import WebKit2 as WebKit
|
||||||
from gi.repository import Pango # pylint: disable=E0611
|
from gi.repository import Pango # pylint: disable=E0611
|
||||||
|
|
||||||
import cairo
|
import cairo
|
||||||
# import cairo.Pattern, cairo.SolidPattern
|
|
||||||
|
|
||||||
from uberwriter import headerbars
|
|
||||||
from uberwriter import helpers
|
from uberwriter import helpers
|
||||||
from uberwriter.theme import Theme
|
from uberwriter.theme import Theme
|
||||||
from uberwriter.helpers import get_builder
|
from uberwriter.helpers import get_builder
|
||||||
from uberwriter.gtkspellcheck import SpellChecker
|
from uberwriter.gtkspellcheck import SpellChecker
|
||||||
|
|
||||||
from uberwriter.markup_buffer import MarkupBuffer
|
from uberwriter.markup_buffer import MarkupBuffer
|
||||||
from uberwriter.text_editor import TextEditor
|
|
||||||
from uberwriter.inline_preview import InlinePreview
|
from uberwriter.inline_preview import InlinePreview
|
||||||
from uberwriter.sidebar import Sidebar
|
from uberwriter.sidebar import Sidebar
|
||||||
from uberwriter.search_and_replace import SearchAndReplace
|
from uberwriter.search_and_replace import SearchAndReplace
|
||||||
from uberwriter.settings import Settings
|
from uberwriter.settings import Settings
|
||||||
# from .auto_correct import AutoCorrect
|
|
||||||
|
|
||||||
from uberwriter.export_dialog import Export
|
from . import headerbars
|
||||||
# from .plugins.bibtex import BibTex
|
|
||||||
|
|
||||||
# Some Globals
|
# Some Globals
|
||||||
# TODO move them somewhere for better
|
# TODO move them somewhere for better
|
||||||
# accesibility from other files
|
# accesibility from other files
|
||||||
|
@ -89,7 +87,7 @@ class Window(Gtk.ApplicationWindow):
|
||||||
# Headerbars
|
# Headerbars
|
||||||
self.headerbar = headerbars.MainHeaderbar(app)
|
self.headerbar = headerbars.MainHeaderbar(app)
|
||||||
self.set_titlebar(self.headerbar.hb_container)
|
self.set_titlebar(self.headerbar.hb_container)
|
||||||
self.fs_headerbar = headerbars.FsHeaderbar(self.builder, app)
|
self.fs_headerbar = headerbars.FullscreenHeaderbar(self.builder, app)
|
||||||
|
|
||||||
self.title_end = " – UberWriter"
|
self.title_end = " – UberWriter"
|
||||||
self.set_headerbar_title("New File" + self.title_end)
|
self.set_headerbar_title("New File" + self.title_end)
|
||||||
|
@ -116,7 +114,7 @@ class Window(Gtk.ApplicationWindow):
|
||||||
self.add_accel_group(self.accel_group)
|
self.add_accel_group(self.accel_group)
|
||||||
|
|
||||||
# Setup text editor
|
# Setup text editor
|
||||||
self.text_editor = TextEditor()
|
self.text_editor = UberwriterTextEditor()
|
||||||
self.text_editor.set_name('UberwriterEditor')
|
self.text_editor.set_name('UberwriterEditor')
|
||||||
self.get_style_context().add_class('uberwriter_window')
|
self.get_style_context().add_class('uberwriter_window')
|
||||||
|
|
||||||
|
@ -964,7 +962,7 @@ class Window(Gtk.ApplicationWindow):
|
||||||
"""open the export and advanced export dialog
|
"""open the export and advanced export dialog
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.export = Export(self.filename)
|
self.export = UberwriterExportDialog(self.filename)
|
||||||
self.export.dialog.set_transient_for(self)
|
self.export.dialog.set_transient_for(self)
|
||||||
|
|
||||||
response = self.export.dialog.run()
|
response = self.export.dialog.run()
|
||||||
|
|
Loading…
Reference in New Issue