From f85e85a1592b23e4c67e5c767aad4c9b0c9bb23d Mon Sep 17 00:00:00 2001 From: TheJackiMonster Date: Thu, 8 Jun 2023 15:58:19 +0200 Subject: [PATCH] Start implementing import and compile dialog Signed-off-by: TheJackiMonster --- manuskript/ui/__init__.py | 2 + manuskript/ui/compileWindow.py | 53 ++ manuskript/ui/importWindow.py | 51 ++ manuskript/ui/mainWindow.py | 12 + ui/compile.glade | 875 +++++++++++++++++++++++++++++++++ ui/import.glade | 114 +++-- 6 files changed, 1053 insertions(+), 54 deletions(-) create mode 100644 manuskript/ui/compileWindow.py create mode 100644 manuskript/ui/importWindow.py create mode 100644 ui/compile.glade diff --git a/manuskript/ui/__init__.py b/manuskript/ui/__init__.py index 9b8ce307..51d8e08e 100644 --- a/manuskript/ui/__init__.py +++ b/manuskript/ui/__init__.py @@ -4,6 +4,8 @@ from manuskript.ui.util import * from manuskript.ui.aboutDialog import AboutDialog +from manuskript.ui.compileWindow import CompileWindow +from manuskript.ui.importWindow import ImportWindow from manuskript.ui.mainWindow import MainWindow from manuskript.ui.settingsWindow import SettingsWindow from manuskript.ui.startupWindow import StartupWindow diff --git a/manuskript/ui/compileWindow.py b/manuskript/ui/compileWindow.py new file mode 100644 index 00000000..03e46755 --- /dev/null +++ b/manuskript/ui/compileWindow.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import GObject, Gtk, Handy + +Handy.init() + +from manuskript.ui.abstractDialog import AbstractDialog + +from manuskript.data import Project + + +class CompileWindow(AbstractDialog): + + def __init__(self, mainWindow): + AbstractDialog.__init__(self, mainWindow, "ui/compile.glade", "compile_window") + + self.headerBar = None + self.back = None + self.forward = None + self.previewLeaflet = None + self.manageExportersButton = None + + def initWindow(self, builder, window): + self.headerBar = builder.get_object("header_bar") + self.back = builder.get_object("back") + self.forward = builder.get_object("forward") + self.previewLeaflet = builder.get_object("preview_leaflet") + self.manageExportersButton = builder.get_object("manage_exporters") + + self.previewLeaflet.bind_property("folded", self.back, "visible", + GObject.BindingFlags.SYNC_CREATE) + self.previewLeaflet.bind_property("folded", self.forward, "visible", + GObject.BindingFlags.SYNC_CREATE) + self.previewLeaflet.bind_property("folded", self.headerBar, "show-close-button", + GObject.BindingFlags.SYNC_CREATE | + GObject.BindingFlags.INVERT_BOOLEAN) + + self.back.connect("clicked", self._backClicked) + self.forward.connect("clicked", self._forwardClicked) + + def _backClicked(self, button: Gtk.Button): + if self.previewLeaflet.get_visible_child_name() == "preview_box": + self.previewLeaflet.set_visible_child_name("settings_box") + else: + self.hide() + + def _forwardClicked(self, button: Gtk.Button): + if self.previewLeaflet.get_visible_child_name() == "settings_box": + self.previewLeaflet.set_visible_child_name("preview_box") diff --git a/manuskript/ui/importWindow.py b/manuskript/ui/importWindow.py new file mode 100644 index 00000000..56a8a910 --- /dev/null +++ b/manuskript/ui/importWindow.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import GObject, Gtk, Handy + +Handy.init() + +from manuskript.ui.abstractDialog import AbstractDialog + +from manuskript.data import Project + + +class ImportWindow(AbstractDialog): + + def __init__(self, mainWindow): + AbstractDialog.__init__(self, mainWindow, "ui/import.glade", "import_window") + + self.headerBar = None + self.back = None + self.forward = None + self.previewLeaflet = None + + def initWindow(self, builder, window): + self.headerBar = builder.get_object("header_bar") + self.back = builder.get_object("back") + self.forward = builder.get_object("forward") + self.previewLeaflet = builder.get_object("preview_leaflet") + + self.previewLeaflet.bind_property("folded", self.back, "visible", + GObject.BindingFlags.SYNC_CREATE) + self.previewLeaflet.bind_property("folded", self.forward, "visible", + GObject.BindingFlags.SYNC_CREATE) + self.previewLeaflet.bind_property("folded", self.headerBar, "show-close-button", + GObject.BindingFlags.SYNC_CREATE | + GObject.BindingFlags.INVERT_BOOLEAN) + + self.back.connect("clicked", self._backClicked) + self.forward.connect("clicked", self._forwardClicked) + + def _backClicked(self, button: Gtk.Button): + if self.previewLeaflet.get_visible_child_name() == "preview_box": + self.previewLeaflet.set_visible_child_name("settings_box") + else: + self.hide() + + def _forwardClicked(self, button: Gtk.Button): + if self.previewLeaflet.get_visible_child_name() == "settings_box": + self.previewLeaflet.set_visible_child_name("preview_box") diff --git a/manuskript/ui/mainWindow.py b/manuskript/ui/mainWindow.py index 9efbf75e..15edfc18 100644 --- a/manuskript/ui/mainWindow.py +++ b/manuskript/ui/mainWindow.py @@ -16,6 +16,8 @@ from manuskript.ui.views import * from manuskript.ui.chooser import openFileDialog, saveFileDialog, FileFilter from manuskript.ui.tools import * from manuskript.ui.aboutDialog import AboutDialog +from manuskript.ui.compileWindow import CompileWindow +from manuskript.ui.importWindow import ImportWindow from manuskript.ui.settingsWindow import SettingsWindow from manuskript.ui.startupWindow import StartupWindow from manuskript.ui.util import bindMenuItem, packViewIntoSlot, unpackFromSlot @@ -61,6 +63,8 @@ class MainWindow: self.aboutDialog = AboutDialog(self) self.frequencyWindow = FrequencyWindow(self) self.settingsWindow = SettingsWindow(self) + self.importWindow = ImportWindow(self) + self.compileWindow = CompileWindow(self) self.windows = [ self.startupWindow, @@ -76,6 +80,8 @@ class MainWindow: bindMenuItem(builder, "save_menu_item", self._saveAction) bindMenuItem(builder, "saveas_menu_item", self._saveAsAction) bindMenuItem(builder, "close_menu_item", self._closeAction) + bindMenuItem(builder, "import_menu_item", self._importAction) + bindMenuItem(builder, "compile_menu_item", self._compileAction) bindMenuItem(builder, "quit_menu_item", self._quitAction) bindMenuItem(builder, "settings_menu_item", self._settingsAction) @@ -157,6 +163,12 @@ class MainWindow: def _closeAction(self, menuItem: Gtk.MenuItem): self.closeProject() + + def _importAction(self, menuItem: Gtk.MenuItem): + self.importWindow.show() + + def _compileAction(self, menuItem: Gtk.MenuItem): + self.compileWindow.show() def _quitAction(self, menuItem: Gtk.MenuItem): self.exit(True) diff --git a/ui/compile.glade b/ui/compile.glade new file mode 100644 index 00000000..64d054b2 --- /dev/null +++ b/ui/compile.glade @@ -0,0 +1,875 @@ + + + + + + + + + + + + + + + + + + + + + + Markdown + text/markdown + text-x-generic + + + Folder + directory + folder + + + OPML + text/opml + text-x-generic-template + + + Mind Map + text/mind-map + text-x-generic-template + + + + + False + + + True + False + vertical + + + True + False + + + True + False + Export + + + True + True + True + + + True + False + go-previous-symbolic + + + + + + + True + True + True + + + True + False + go-next-symbolic + + + + + end + 1 + + + + + + + False + True + 0 + + + + + True + False + + + 300 + True + False + vertical + + + True + False + + + True + False + 4 + 4 + 8 + + + True + False + Format: + + + + + + False + True + 0 + + + + + True + False + file_format_store + 0 + + + + 2 + + + + + + 0 + + + + + False + True + 1 + + + + + True + True + True + + + True + False + 4 + + + True + False + preferences-other-symbolic + + + False + True + 0 + + + + + True + False + Manage Exporters + end + + + False + True + 1 + + + + + + + False + True + 2 + + + + + + + False + True + end + 4 + + + + + True + False + 8 + 8 + 8 + 8 + vertical + 8 + + + True + False + 6 + 6 + Settings + 0 + + + + + + False + True + 0 + + + + + True + True + + + True + False + 8 + vertical + + + True + False + Decide here what will be included in the final export. + True + word-char + end + 0 + + + False + True + 0 + + + + + + True + False + 4 + True + + + True + False + Type + + + 0 + 0 + + + + + True + False + Title + + + 1 + 0 + + + + + True + False + Text + + + 2 + 0 + + + + + + True + True + False + True + + + 1 + 1 + + + + + + True + True + False + True + + + 2 + 2 + + + + + + True + True + False + True + + + 1 + 2 + + + + + True + False + 4 + + + True + False + folder-symbolic + + + False + True + 0 + + + + + True + False + Folder + + + False + True + 1 + + + + + 0 + 1 + + + + + True + False + 4 + + + True + False + text-x-generic-symbolic + + + False + True + 0 + + + + + True + False + Folder + + + False + True + 1 + + + + + 0 + 2 + + + + + + + + False + True + 1 + + + + + I need more granularity + True + True + False + True + + + False + True + 2 + + + + + True + False + + + False + True + 3 + + + + + True + False + 4 + vertical + + + True + True + + + True + False + vertical + + + True + False + Filters what items will be included in the final export. +(Not fully implemented yet.) + True + word-char + end + 0 + + + False + True + 0 + + + + + Ignore compile status (include all items) + True + True + False + True + + + False + True + 1 + + + + + Subitems of: + True + True + False + True + + + False + True + 2 + + + + + Labels + True + True + False + True + + + False + True + 3 + + + + + Status + True + True + False + True + + + False + True + 4 + + + + + + + True + False + Filters + + + + + False + True + 0 + + + + + False + True + 4 + + + + + + + True + False + Content + + + + + False + True + 1 + + + + + True + True + + + + + + True + False + Separations + + + + + False + True + 2 + + + + + True + True + + + + + + True + False + Transformations + + + + + False + True + 3 + + + + + True + True + + + + + + True + False + Preview + + + + + False + True + 4 + + + + + True + True + 5 + + + + + settings_box + + + + + 250 + True + False + True + vertical + + + True + False + 8 + 8 + 8 + 8 + vertical + 8 + + + True + False + 6 + 6 + Preview + 0 + + + + + + False + True + 0 + + + + + True + False + vertical + + + + + + True + True + 1 + + + + + True + True + 0 + + + + + True + False + False + 8 + + + True + False + 4 + 4 + 8 + + + True + True + True + + + True + False + 4 + + + True + False + emblem-synchronizing-symbolic + + + False + True + 0 + + + + + True + False + Preview + + + False + True + 1 + + + + + + + False + True + 0 + + + + + True + True + True + + + True + False + 4 + + + True + False + document-revert-symbolic + + + False + True + 0 + + + + + True + False + Export + + + False + True + 1 + + + + + + + False + True + 1 + + + + + end + 1 + + + + + False + True + end + 2 + + + + + preview_box + + + + + True + True + 1 + + + + + + + + + + + + + + + + + + + + + + diff --git a/ui/import.glade b/ui/import.glade index cc89e89d..2a8a9689 100644 --- a/ui/import.glade +++ b/ui/import.glade @@ -1,5 +1,5 @@ - - + + + + + + + + + + + + Markdown + text/markdown + text-x-generic + + + Folder + directory + folder + + + OPML + text/opml + text-x-generic-template + + + Mind Map + text/mind-map + text-x-generic-template + + + + + + + + + + + + + + + + + + + + False @@ -39,12 +87,12 @@ along with Manuskript. If not, see . True False - + True False Import - + True True True @@ -58,7 +106,7 @@ along with Manuskript. If not, see . - + True True True @@ -85,7 +133,7 @@ along with Manuskript. If not, see . - + True False @@ -366,6 +414,9 @@ along with Manuskript. If not, see . + + settings_box + @@ -609,6 +660,9 @@ along with Manuskript. If not, see . + + preview_box + @@ -620,52 +674,4 @@ along with Manuskript. If not, see . - - - - - - - - - - - - Markdown - text/markdown - text-x-generic - - - Folder - directory - folder - - - OPML - text/opml - text-x-generic-template - - - Mind Map - text/mind-map - text-x-generic-template - - - - - - - - - - - - - - - - - - -