Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Edit
diff options
context:
space:
mode:
authoramartin <olpc@xo-05-28-21.localdomain>2007-08-18 04:46:45 (GMT)
committer amartin <olpc@xo-05-28-21.localdomain>2007-08-18 04:46:45 (GMT)
commit0c7820662df4a6b0ff2bd8a07018e44e6c3df765 (patch)
tree7d755d0957e373af2028f1e713b2501fd742d1b1 /Edit
parent7a13895d7ac1226007aff4d969b4de2185fa7ceb (diff)
tune interface centring
Diffstat (limited to 'Edit')
-rw-r--r--Edit/TuneInterface.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/Edit/TuneInterface.py b/Edit/TuneInterface.py
index 54095e6..63141a3 100644
--- a/Edit/TuneInterface.py
+++ b/Edit/TuneInterface.py
@@ -184,6 +184,7 @@ class TuneInterface( gtk.EventBox ):
self.baseWidth = allocation.width
self.visibleEndX = self.baseWidth
self.baseHeight = allocation.height
+ self.updateSize()
self.alloced = True
self.width = allocation.width
self.height = allocation.height
@@ -205,11 +206,16 @@ class TuneInterface( gtk.EventBox ):
self.visibleEndX = self.visibleX + self.baseWidth
def updateSize( self ):
- if not self.alloced: return
- width = self.pageOffset + self.noteDB.getPageCount()*Config.PAGE_THUMBNAIL_WIDTH
+ width = self.noteDB.getPageCount()*Config.PAGE_THUMBNAIL_WIDTH + 5 # add extra 5 for the first page
self.waitingForAlloc = True
- self.set_size_request( max( self.baseWidth, width), -1 )
- self.invalidate_rect( self.visibleX, 0, self.baseWidth, self.height )
+ if width < self.baseWidth:
+ self.pageOffset = ( self.baseWidth - width ) // 2 + 5
+ else:
+ self.pageOffset = 5
+
+ if self.alloced:
+ self.set_size_request( max( self.baseWidth, width), -1 )
+ self.invalidate_rect( self.visibleX, 0, self.baseWidth, self.height )
def handleButtonPress( self, widget, event ):
if event.button != 1: