summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Huuhko <kai.huuhko@gmail.com>2015-03-27 05:46:45 +0200
committerKai Huuhko <kai.huuhko@gmail.com>2015-03-27 05:46:45 +0200
commite2ddd24b2875840735d1eaedc8c1ff32d6e5265b (patch)
treebbf761a93d47737d22ead5b84b120223e87ca284
parentb8b438e0b8c9f479a02cde9444d288754a26f66c (diff)
Fix unnecessary scrolling caused by rounding errors, reduce logging
-rw-r--r--lekha/app.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/lekha/app.py b/lekha/app.py
index 244785e..4a11127 100644
--- a/lekha/app.py
+++ b/lekha/app.py
@@ -366,7 +366,14 @@ class Document(Table):
366 if pw > widest: 366 if pw > widest:
367 widest = pw 367 widest = pw
368 368
369 if widest == 0:
370 log.error("Widest page has width of 0!")
371 return
372
373 widest += 1 # won't trigger scrolling because of rounding error.
374
369 viewport_width = self.scr.region[2] 375 viewport_width = self.scr.region[2]
376
370 self.zoom *= viewport_width/widest 377 self.zoom *= viewport_width/widest
371 378
372 def _event_handler(self, obj, src, tp, ev): 379 def _event_handler(self, obj, src, tp, ev):
@@ -604,7 +611,7 @@ if __name__ == "__main__":
604 611
605 log = logging.getLogger("lekha") 612 log = logging.getLogger("lekha")
606 log.addHandler(handler) 613 log.addHandler(handler)
607 log.setLevel(logging.DEBUG) 614 log.setLevel(logging.WARN)
608 615
609 evas.init() 616 evas.init()
610 elm.init() 617 elm.init()