changeset 469:050ffdec60d9

Fix the orientation problem * Highlights the project what is open.
author Magnus Schieder <mschieder@intevation.de>
date Tue, 08 May 2018 13:29:45 +0200
parents 74e550aa3b6a
children d379f8098bb3
files CHANGES TODO doc/old_issues.txt getan/config.py getan/nodes.py getan/project.py getan/states.py getan/view.py
diffstat 8 files changed, 39 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES	Fri May 04 15:36:50 2018 +0200
+++ b/CHANGES	Tue May 08 13:29:45 2018 +0200
@@ -1,10 +1,22 @@
 2.x 20xx-xx-xx UNRELEASED
 
+ * Better control of the walker.
+   If you move entries and switch back to the projects you get to the project
+   you were in. Before, you always got the first project.
+   Patch by Magnus Schieder
+
+ * You can now see which entries are displayed when you are in the entries
+   list.
+   The project you are in is highlighted in color.
+   The color can be changed in the getanrc with the key "open_project".
+   Patch by Magnus Schieder
+
  * Updated the source code to the latest version of pyhton (python 3) to better
    maintain it in the future.
    Python 2.7 will not be maintained past 2020.
    Therefore, the whole source code of'done' and'done/scripts' is updated to
    python 3.
+   Patch by Magnus Schieder
 
  * Update and clean up the source code to better maintain it in the future.
    optparse to argparse Migration.
--- a/TODO	Fri May 04 15:36:50 2018 +0200
+++ b/TODO	Tue May 08 13:29:45 2018 +0200
@@ -61,12 +61,6 @@
     (The last marked entry stays in its project)
 
 
-20180118 BER There should be an indication which entries are shown
-    when being in the right pane. When you use tab to go to the entries,
-    it cannot be seen anymore in which project I am.
-    This is a larger drawback after moving all entries somewhere,
-    it is unclear which task's entries are shown now.
-
 20170709 BER: Give scripts/getan-eval.py a more specific name and add
   it as a script to be installed.
 
--- a/doc/old_issues.txt	Fri May 04 15:36:50 2018 +0200
+++ b/doc/old_issues.txt	Tue May 08 13:29:45 2018 +0200
@@ -1,3 +1,9 @@
+20180118 BER There should be an indication which entries are shown
+    when being in the right pane. When you use tab to go to the entries,
+    it cannot be seen anymore in which project I am.
+    This is a larger drawback after moving all entries somewhere,
+    it is unclear which task's entries are shown now.
+
 20180117 Magnus Schieder
 
   20170317 BER: Reproduce and then fix a defect that it is surprising which
--- a/getan/config.py	Fri May 04 15:36:50 2018 +0200
+++ b/getan/config.py	Tue May 08 13:29:45 2018 +0200
@@ -208,6 +208,7 @@
     KEY_QUESTION = "question"
     KEY_RUNNING = "running"
     KEY_PAUSED_RUNNING = "paused_running"
+    KEY_OPEN_PROJECT = "open_project"
 
     DEFAULT_THEME = {
         KEY_HEADER: "white, dark blue",
@@ -224,6 +225,7 @@
         KEY_QUESTION: "white, dark red",
         KEY_RUNNING: "yellow, dark green",
         KEY_PAUSED_RUNNING: "white, dark red",
+        KEY_OPEN_PROJECT: "white, light blue"
     }
 
     def __init__(self, config):
--- a/getan/nodes.py	Fri May 04 15:36:50 2018 +0200
+++ b/getan/nodes.py	Tue May 08 13:29:45 2018 +0200
@@ -47,6 +47,12 @@
                 self._w.set_focus_map({None: 'entry'})
                 self._w.set_attr_map({None: 'entry'})
 
+        # Only projects can be open.
+        if self.item.open and not self.has_focus:
+                self._w.set_attr_map({None: 'open_project'})
+        else:
+            self.item.open = False
+
     def select(self):
         self.selected = not self.selected
         logger.debug("Node: update selection of item '%s' selected %s"
--- a/getan/project.py	Fri May 04 15:36:50 2018 +0200
+++ b/getan/project.py	Tue May 08 13:29:45 2018 +0200
@@ -30,6 +30,7 @@
         self.total = total
         self.start = None
         self.stop = None
+        self.open= None
 
     def year(self):
         total = 0
@@ -96,6 +97,7 @@
         self.end = end
         self.desc = desc
         self.workpackage = "-"
+        self.open = None
 
         # we add this attribute for use in jinja2 templates,
         # as filters like sort() or groupby() work only on attributes
--- a/getan/states.py	Fri May 04 15:36:50 2018 +0200
+++ b/getan/states.py	Tue May 08 13:29:45 2018 +0200
@@ -86,6 +86,7 @@
         if keys.get_switch_lists() in input:
             if not self.controller.entries_view.rows:
                 return True
+            self.view.highlight_open_project()
             new_state = DefaultEntryListState(self, self.controller,
                                               self.controller.entries_view)
             self.set_next_state(new_state)
--- a/getan/view.py	Fri May 04 15:36:50 2018 +0200
+++ b/getan/view.py	Tue May 08 13:29:45 2018 +0200
@@ -75,9 +75,12 @@
             self.rows = []
         self.set_node_rows(self.rows)
 
-    def set_node_rows(self, rows):
+    def set_node_rows(self, rows, position=None):
         """ Sets node_class rows in the walker """
         self.walker = ListWalker(self.rows, self)
+        # Set the position of the walker in the project list.
+        if position:
+            self.walker.set_focus(position)
         self.listbox = urwid.ListBox(self.walker)
         self.body = urwid.LineBox(self.listbox, title=self.title)
         self.frame = urwid.Frame(self.body, header=self.header,
@@ -96,6 +99,11 @@
             self.footer = urwid.AttrWrap(urwid.Text(text), attr)
         self.frame.set_footer(self.footer)
 
+    def highlight_open_project(self):
+        item = self.item_in_focus()
+        if item:
+            item.open = True
+
     def row_count(self):
         if not self.rows:
             return 0
@@ -171,7 +179,7 @@
 
     def update_rows(self):
         self.create_node_rows()
-        self.set_node_rows(self.rows)
+        self.set_node_rows(self.rows, position=self.get_focus_pos())
 
     def create_node_rows(self):
         """ Sets self.rows to node_class rows depending on the project_mode """
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)