diff --git a/manuskript/ui/mainWindow.py b/manuskript/ui/mainWindow.py
index 104f7ffa..87756323 100644
--- a/manuskript/ui/mainWindow.py
+++ b/manuskript/ui/mainWindow.py
@@ -69,7 +69,7 @@ class MainWindow:
self.plotView = MainWindow.packViewIntoSlot(builder, "plot_slot", PlotView, self.project.plots)
self.worldView = MainWindow.packViewIntoSlot(builder, "world_slot", WorldView, self.project.world)
self.outlineView = MainWindow.packViewIntoSlot(builder, "outline_slot", OutlineView, self.project.outline)
- self.editorView = MainWindow.packViewIntoSlot(builder, "editor_slot", EditorView)
+ self.editorView = MainWindow.packViewIntoSlot(builder, "editor_slot", EditorView, self.project)
self.startupWindow = StartupWindow(self)
self.aboutDialog = AboutDialog(self)
@@ -144,5 +144,5 @@ class MainWindow:
self.window.destroy()
- def _notifyProperty(self, window, property):
- print(property.name)
+ def _notify(self, obj: GObject.Object, pspec: GObject.ParamSpec):
+ print(pspec.name + " = " + str(obj.get_property(pspec.name)))
diff --git a/manuskript/ui/views/editorView.py b/manuskript/ui/views/editorView.py
index 40a71244..079435a6 100644
--- a/manuskript/ui/views/editorView.py
+++ b/manuskript/ui/views/editorView.py
@@ -6,14 +6,89 @@ import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
+from manuskript.data import Project, Outline, OutlineFolder, OutlineText, OutlineItem, OutlineState, Plots, PlotLine, Characters, Character, Importance, Goal
+from manuskript.ui.util import rgbaFromColor, pixbufFromColor
+from manuskript.util import validString, invalidString, validInt, invalidInt, CounterKind, countText
+
class EditorView:
- def __init__(self):
+ def __init__(self, project: Project):
+ self.project = project
+
builder = Gtk.Builder()
builder.add_from_file("ui/editor.glade")
self.widget = builder.get_object("editor_view")
+ self.labelStore = builder.get_object("label_store")
+ self.refreshLabelStore()
+
+ self.statusStore = builder.get_object("status_store")
+ self.refreshStatusStore()
+
+ self.outlineStore = builder.get_object("outline_store")
+ self.refreshOutlineStore()
+
+ def refreshLabelStore(self):
+ self.labelStore.clear()
+
+ for label in self.project.labels:
+ tree_iter = self.labelStore.append()
+
+ if tree_iter is None:
+ continue
+
+ self.labelStore.set_value(tree_iter, 0, validString(label.name))
+ self.labelStore.set_value(tree_iter, 1, pixbufFromColor(label.color))
+
+ def refreshStatusStore(self):
+ self.statusStore.clear()
+
+ for status in self.project.statuses:
+ tree_iter = self.statusStore.append()
+
+ if tree_iter is None:
+ continue
+
+ self.statusStore.set_value(tree_iter, 0, validString(status.name))
+
+ def __appendOutlineItem(self, outlineItem: OutlineItem, parent_iter=None):
+ tree_iter = self.outlineStore.append(parent_iter)
+
+ if tree_iter is None:
+ return
+
+ if outlineItem.state != OutlineState.COMPLETE:
+ outlineItem.load(False)
+
+ if type(outlineItem) is OutlineFolder:
+ for item in outlineItem:
+ self.__appendOutlineItem(item, tree_iter)
+
+ wordCount = validInt(outlineItem.textCount())
+ goal = validInt(outlineItem.goalCount())
+ progress = 0
+
+ if goal > wordCount:
+ progress = 100 * wordCount / goal
+ elif goal > 0:
+ progress = 100
+
+ self.outlineStore.set_value(tree_iter, 0, outlineItem.UID.value)
+ self.outlineStore.set_value(tree_iter, 1, validString(outlineItem.title))
+ self.outlineStore.set_value(tree_iter, 2, validString(outlineItem.label))
+ self.outlineStore.set_value(tree_iter, 3, validString(outlineItem.status))
+ self.outlineStore.set_value(tree_iter, 4, outlineItem.compile)
+ self.outlineStore.set_value(tree_iter, 5, wordCount)
+ self.outlineStore.set_value(tree_iter, 6, goal)
+ self.outlineStore.set_value(tree_iter, 7, progress)
+
+ def refreshOutlineStore(self):
+ self.outlineStore.clear()
+
+ for item in self.project.outline.items:
+ self.__appendOutlineItem(item)
+
def show(self):
self.widget.show_all()
diff --git a/ui/editor.glade b/ui/editor.glade
index 9b466c11..8c083771 100644
--- a/ui/editor.glade
+++ b/ui/editor.glade
@@ -1,5 +1,5 @@
-
+
+
+
+
+
+
@@ -423,4 +630,10 @@ along with Manuskript. If not, see .
+
+
+
+
+
+
diff --git a/ui/main.glade b/ui/main.glade
index ad5268d7..32d9a619 100644
--- a/ui/main.glade
+++ b/ui/main.glade
@@ -664,7 +664,7 @@ along with Manuskript. If not, see .
True
False
- paned1
+ paned
-
+
300
True
True
True
True
-
- 20
+
+ 50
True
False
- vertical
-
+
+ True
+ False
+ vertical
+
+
+
+
+
+ page_overview
+ General
+ view-dual-symbolic
+
+
+
+
+ True
+ False
+ vertical
+
+
+
+
+
+ page_summary
+ Summary
+ emblem-documents-symbolic
+ 1
+
+
+
+
+ True
+ False
+ vertical
+
+
+
+
+
+ page_characters
+ Characters
+ system-users-symbolic
+ 2
+
+
+
+
+ True
+ False
+ vertical
+
+
+
+
+
+ page_plot
+ Plot
+ network-wired-symbolic
+ 3
+
+
+
+
+ True
+ False
+ vertical
+
+
+
+
+
+ page_world
+ World
+ weather-few-clouds-symbolic
+ 4
+
+
+
+
+ True
+ False
+ vertical
+
+
+
+
+
+ page_outline
+ Outline
+ view-list-symbolic
+ 5
+
+
+
+
+ True
+ False
+ vertical
+
+
+
+
+
+ page_editor
+ Editor
+ document-edit-symbolic
+ 6
+
@@ -702,164 +809,31 @@ along with Manuskript. If not, see .
True
True
+ vertical
+ 300
+ True
True
-
- 50
+
True
False
+ vertical
-
- True
- False
- vertical
-
-
-
-
-
- page_overview
- General
- view-dual-symbolic
-
-
-
-
- True
- False
- vertical
-
-
-
-
-
- page_summary
- Summary
- emblem-documents-symbolic
- 1
-
-
-
-
- True
- False
- vertical
-
-
-
-
-
- page_characters
- Characters
- system-users-symbolic
- 2
-
-
-
-
- True
- False
- vertical
-
-
-
-
-
- page_plot
- Plot
- network-wired-symbolic
- 3
-
-
-
-
- True
- False
- vertical
-
-
-
-
-
- page_world
- World
- weather-few-clouds-symbolic
- 4
-
-
-
-
- True
- False
- vertical
-
-
-
-
-
- page_outline
- Outline
- view-list-symbolic
- 5
-
-
-
-
- True
- False
- vertical
-
-
-
-
-
- page_editor
- Editor
- document-edit-symbolic
- 6
-
+
True
- False
+ True
-
+
True
- True
+ False
vertical
- 300
- True
- True
-
- True
- False
- vertical
-
-
-
-
-
- True
- True
-
-
-
-
- True
- False
- vertical
-
-
-
-
-
- True
- True
-
+