[Getan-commits] [PATCH 2 of 2] Merge

Wald Commits scm-commit at wald.intevation.org
Wed May 3 11:51:50 CEST 2017


# HG changeset patch
# User Bernhard Reiter <bernhard at intevation.de>
# Date 1493805099 -7200
# Node ID 0650c47e7a1c05288ed204b5d8d55932ef3ee588
# Parent  ac4dead3167205e2035bc60a568ff7482437f943
# Parent  7e27d2145007d34f28b220a1d642dd09a154a124
Merge.

diff -r ac4dead31672 -r 0650c47e7a1c getan/resources.py
--- a/getan/resources.py	Mon Apr 24 14:24:05 2017 +0200
+++ b/getan/resources.py	Wed May 03 11:51:39 2017 +0200
@@ -4,9 +4,9 @@
 _base_dir = os.path.join(os.path.dirname(__file__), os.pardir)
 share_dir = os.path.join(_base_dir, "share")
 
+
 def gettext(message):
     modir = os.path.join(share_dir, "locale")
     t = py_gettext.translation("getan", modir, fallback=True)
 
     return t.ugettext(message)
-
diff -r ac4dead31672 -r 0650c47e7a1c getan/states.py
--- a/getan/states.py	Mon Apr 24 14:24:05 2017 +0200
+++ b/getan/states.py	Wed May 03 11:51:39 2017 +0200
@@ -21,15 +21,14 @@
 
 
 class State(object):
-
     """ Represents a State of Getan
 
-    A State can be used to handle user input. The user input handling is done in
-    three phases. First it is possible to filter keys that shouldn't be passed
-    to a widget in input_filter. Afterwards it is possible to redirect a key to
-    a specific widget in keypress. In the third phase it is possible to act on
-    user input which isn't handled by a widget yet. The corresponing method is
-    handle_input.
+    A State can be used to handle user input. The user input handling is done
+    in three phases. First it is possible to filter keys that shouldn't be
+    passed to a widget in input_filter. Afterwards it is possible to redirect
+    a key to a specific widget in keypress. In the third phase it is possible
+    to act on user input which isn't handled by a widget yet. The corresponing
+    method is handle_input.
 
     Normally handle_input should be used to act on user input and change a
     state.
@@ -526,9 +525,8 @@
             else:
                 entry = self.view.item_in_focus()
                 self.set_next_state(DeleteEntryState(self.projectlist_state,
-                                                     self,
-                                                     self.controller, self.view,
-                                                     [entry]))
+                                                     self, self.controller,
+                                                     self.view, [entry]))
             return True
 
         if keys.get_entry_move() in key:
@@ -549,16 +547,16 @@
             entry = self.view.item_in_focus()
             if entry:
                 self.set_next_state(AdjustEntryState(self.projectlist_state,
-                                                     self.controller, self.view,
-                                                     entry))
+                                                     self.controller,
+                                                     self.view, entry))
             return True
 
         if keys.get_entry_length() in key:
             entry = self.view.item_in_focus()
             if entry:
                 self.set_next_state(LengthEntryState(self.projectlist_state,
-                                                     self.controller, self.view,
-                                                     entry))
+                                                     self.controller,
+                                                     self.view, entry))
             return True
 
         return False
@@ -618,7 +616,8 @@
 
     def set_project_footer(self):
         self.project_view.set_footer_text("Selecting project from "
-                                          "key: %s" % self.proj_keys, "running")
+                                          "key: %s" % self.proj_keys,
+                                          "running")
 
     def reset_project_footer(self):
         self.project_view.reset_footer()
@@ -756,7 +755,6 @@
 
 
 class EditEntryState(HandleUserInputState):
-
     messages = {
         'edit_entry': _('Edit entry text: '),
     }
@@ -792,8 +790,8 @@
         self.controller.view.set_focus("entries")
         self.view.frame.set_focus("footer")
 
+
 class AdjustEntryState(HandleUserInputState):
-
     messages = {
         'adjust_entry': _('Adjust datetime of entry: '),
     }
@@ -802,7 +800,7 @@
         view.set_footer_text(self.msg('adjust_entry'),
                              'question', True)
         super(AdjustEntryState, self).__init__(controller, view,
-                                             None, view.footer)
+                                               None, view.footer)
 
         # we only care up to seconds (which is 19 characters).
         # for usability the default value has to match the strptime fmt below.
@@ -813,13 +811,14 @@
         logger.debug("AdjustEntryState: Entry %s" % entry)
 
     def enter(self):
-        entry_datetime = self.footer.get_edit_text() #
+        entry_datetime = self.footer.get_edit_text()
 
         entry = self.entry
         duration = entry.get_duration()
 
         try:
-            entry.start = datetime.strptime(entry_datetime, "%Y-%m-%d %H:%M:%S")
+            entry.start = datetime.strptime(entry_datetime,
+                                            "%Y-%m-%d %H:%M:%S")
         except:
             return self
 
@@ -839,8 +838,8 @@
         self.controller.view.set_focus("entries")
         self.view.frame.set_focus("footer")
 
+
 class LengthEntryState(HandleUserInputState):
-
     messages = {
         'adjust_length_entry': _('Adjust length of entry: '),
     }
@@ -849,7 +848,7 @@
         view.set_footer_text(self.msg('adjust_length_entry'),
                              'question', True)
         super(LengthEntryState, self).__init__(controller, view,
-                                             None, view.footer)
+                                               None, view.footer)
 
         # format current duration as string that is also accepted by enter()
         total_minutes = int(entry.get_duration().total_seconds()/60)
@@ -906,7 +905,6 @@
         self.view.frame.set_focus("footer")
 
 
-
 class ProjectEditKeyState(AlterProjectState):
 
     messages = {
diff -r ac4dead31672 -r 0650c47e7a1c getan/walker.py
--- a/getan/walker.py	Mon Apr 24 14:24:05 2017 +0200
+++ b/getan/walker.py	Wed May 03 11:51:39 2017 +0200
@@ -12,6 +12,7 @@
 
 logger = logging.getLogger(__name__)
 
+
 class ListWalker(urwid.SimpleListWalker):
 
     def __init__(self, content, widget=None):
@@ -27,4 +28,3 @@
         if self.widget and self.position != position:
             self.position = position
             self.widget.content_focus_changed()
-


More information about the Getan-commits mailing list