Minor ui updates and changes

Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
This commit is contained in:
TheJackiMonster 2022-10-31 13:00:21 +01:00
parent 995a78058c
commit 0f68c24b84
No known key found for this signature in database
GPG key ID: D850A5F772E880F9
8 changed files with 91 additions and 17 deletions

View file

@ -6,7 +6,9 @@ import os
from collections import OrderedDict
from enum import Enum, unique
from manuskript.data.goal import Goal
from manuskript.data.labels import LabelHost
from manuskript.data.plots import Plots
from manuskript.data.status import StatusHost
from manuskript.data.unique_id import UniqueIDHost
from manuskript.io.mmdFile import MmdFile
from manuskript.util import CounterKind, countText, validString
@ -207,10 +209,12 @@ class OutlineFolder(OutlineItem):
class Outline:
def __init__(self, path, plots: Plots):
def __init__(self, path, plots: Plots, labels: LabelHost, statuses: StatusHost):
self.dir_path = os.path.join(path, "outline")
self.host = UniqueIDHost()
self.plots = plots
self.labels = labels
self.statuses = statuses
self.items = list()
def __iter__(self):

View file

@ -32,7 +32,7 @@ class Project:
self.characters = Characters(self.file.dir_path)
self.plots = Plots(self.file.dir_path, self.characters)
self.world = World(self.file.dir_path)
self.outline = Outline(self.file.dir_path, self.plots)
self.outline = Outline(self.file.dir_path, self.plots, self.labels, self.statuses)
self.revisions = Revisions(self.file.dir_path)
def __del__(self):

View file

@ -55,11 +55,10 @@ class StatusHost:
self.statuses.clear()
return
if len(text) <= 1:
if (len(text) <= 1) or (text[len(text) - 1] != "\n"):
return
text = text[:-1]
if len(text) <= 0:
return

View file

@ -22,6 +22,12 @@ class OutlineView:
self.widget = builder.get_object("outline_view")
self.labelStore = builder.get_object("label_store")
self.refreshLabelStore()
self.statusStore = builder.get_object("status_store")
self.refreshStatusStore()
self.plotsStore = builder.get_object("plots_store")
self.refreshPlotsStore()
@ -83,6 +89,29 @@ class OutlineView:
self.unloadOutlineData()
def refreshLabelStore(self):
self.labelStore.clear()
for label in self.outline.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.outline.statuses:
tree_iter = self.statusStore.append()
if tree_iter is None:
continue
self.statusStore.set_value(tree_iter, 0, validString(status.name))
def refreshPlotsStore(self):
self.plotsStore.clear()

View file

@ -340,7 +340,7 @@ along with Manuskript. If not, see <http://www.gnu.org/licenses/>.
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">False</property>
<property name="shrink">True</property>
</packing>
</child>
<child>
@ -963,7 +963,7 @@ summary</property>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">False</property>
<property name="shrink">True</property>
</packing>
</child>
</object>

View file

@ -38,6 +38,14 @@ along with Manuskript. If not, see <http://www.gnu.org/licenses/>.
<object class="GtkTextBuffer" id="few_sentences_summary"/>
<object class="GtkEntryBuffer" id="filter_outline"/>
<object class="GtkEntryBuffer" id="goal"/>
<object class="GtkListStore" id="label_store">
<columns>
<!-- column-name name -->
<column type="gchararray"/>
<!-- column-name color -->
<column type="GdkPixbuf"/>
</columns>
</object>
<object class="GtkEntryBuffer" id="one_line_summary"/>
<object class="GtkTreeStore" id="outline_store">
<columns>
@ -81,6 +89,12 @@ along with Manuskript. If not, see <http://www.gnu.org/licenses/>.
<object class="GtkTreeModelFilter" id="secondary_plots_store">
<property name="child-model">plots_store</property>
</object>
<object class="GtkListStore" id="status_store">
<columns>
<!-- column-name name -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkScrolledWindow" id="outline_view">
<property name="visible">True</property>
<property name="can-focus">True</property>
@ -220,7 +234,7 @@ along with Manuskript. If not, see <http://www.gnu.org/licenses/>.
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">False</property>
<property name="shrink">True</property>
</packing>
</child>
<child>
@ -261,9 +275,14 @@ along with Manuskript. If not, see <http://www.gnu.org/licenses/>.
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="resizable">True</property>
<property name="min-width">50</property>
<property name="title" translatable="yes">Title</property>
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<object class="GtkCellRendererText">
<property name="editable">True</property>
</object>
<attributes>
<attribute name="text">1</attribute>
</attributes>
@ -272,9 +291,15 @@ along with Manuskript. If not, see <http://www.gnu.org/licenses/>.
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="resizable">True</property>
<property name="min-width">50</property>
<property name="title" translatable="yes">Label</property>
<child>
<object class="GtkCellRendererCombo"/>
<object class="GtkCellRendererCombo">
<property name="editable">True</property>
<property name="model">label_store</property>
<property name="text-column">0</property>
</object>
<attributes>
<attribute name="text">2</attribute>
</attributes>
@ -283,9 +308,15 @@ along with Manuskript. If not, see <http://www.gnu.org/licenses/>.
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="resizable">True</property>
<property name="min-width">50</property>
<property name="title" translatable="yes">Status</property>
<child>
<object class="GtkCellRendererCombo"/>
<object class="GtkCellRendererCombo">
<property name="editable">True</property>
<property name="model">status_store</property>
<property name="text-column">0</property>
</object>
<attributes>
<attribute name="text">3</attribute>
</attributes>
@ -294,6 +325,8 @@ along with Manuskript. If not, see <http://www.gnu.org/licenses/>.
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="resizable">True</property>
<property name="min-width">50</property>
<property name="title" translatable="yes">Compile</property>
<child>
<object class="GtkCellRendererToggle"/>
@ -305,9 +338,13 @@ along with Manuskript. If not, see <http://www.gnu.org/licenses/>.
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="resizable">True</property>
<property name="min-width">50</property>
<property name="title" translatable="yes">Word count</property>
<child>
<object class="GtkCellRendererSpin"/>
<object class="GtkCellRendererSpin">
<property name="editable">True</property>
</object>
<attributes>
<attribute name="text">5</attribute>
</attributes>
@ -316,9 +353,13 @@ along with Manuskript. If not, see <http://www.gnu.org/licenses/>.
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="resizable">True</property>
<property name="min-width">50</property>
<property name="title" translatable="yes">Goal</property>
<child>
<object class="GtkCellRendererSpin"/>
<object class="GtkCellRendererSpin">
<property name="editable">True</property>
</object>
<attributes>
<attribute name="text">6</attribute>
</attributes>
@ -327,6 +368,7 @@ along with Manuskript. If not, see <http://www.gnu.org/licenses/>.
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="min-width">50</property>
<property name="title" translatable="yes">%</property>
<child>
<object class="GtkCellRendererProgress"/>
@ -589,7 +631,7 @@ along with Manuskript. If not, see <http://www.gnu.org/licenses/>.
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">False</property>
<property name="shrink">True</property>
</packing>
</child>
</object>

View file

@ -330,7 +330,7 @@ along with Manuskript. If not, see <http://www.gnu.org/licenses/>.
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">False</property>
<property name="shrink">True</property>
</packing>
</child>
<child>
@ -850,7 +850,7 @@ along with Manuskript. If not, see <http://www.gnu.org/licenses/>.
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">False</property>
<property name="shrink">True</property>
</packing>
</child>
</object>

View file

@ -175,7 +175,7 @@ along with Manuskript. If not, see <http://www.gnu.org/licenses/>.
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">False</property>
<property name="shrink">True</property>
</packing>
</child>
<child>
@ -408,7 +408,7 @@ along with Manuskript. If not, see <http://www.gnu.org/licenses/>.
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">False</property>
<property name="shrink">True</property>
</packing>
</child>
</object>