summaryrefslogtreecommitdiff
path: root/jtlib/app.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-11-22 15:16:50 +0200
committerLars Wirzenius <liw@liw.fi>2017-11-22 15:16:50 +0200
commitdb3e6834c6c01b00a6ef7cbfc03c25edc732b695 (patch)
tree44c6ad8b6620c652568f1b9d159ec97719ead693 /jtlib/app.py
parent339049495dd8a82cc2d5058e805144e244bc7d72 (diff)
downloadjt-db3e6834c6c01b00a6ef7cbfc03c25edc732b695.tar.gz
Refactor: move layout specific parts to their own classes
Diffstat (limited to 'jtlib/app.py')
-rw-r--r--jtlib/app.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/jtlib/app.py b/jtlib/app.py
index 81fda8b..760b9a4 100644
--- a/jtlib/app.py
+++ b/jtlib/app.py
@@ -91,8 +91,20 @@ class JournalTool(cliapp.Application):
self.settings['pretend-time'], '%Y-%m-%d %H:%M:%S')
else:
self.now_tuple = time.localtime()
+ self.layout = self.create_layout()
cliapp.Application.process_args(self, args)
+ def create_layout(self):
+ layouts = {
+ 'pkb': jtlib.PkbLayout(),
+ 'ct': jtlib.CtLayout(),
+ }
+
+ layout = layouts[self.settings['layout']]
+ layout.set_settings(self.settings)
+ layout.set_time_tuple(self.now_tuple)
+ return layout
+
def merge_profile(self):
profile = self.settings['profile']
if profile: