Fix tab label padding

This commit is contained in:
Marco Pesenti Gritti 2007-07-09 15:09:59 +02:00
parent 376cb91174
commit 40ed24f0fe
3 changed files with 6 additions and 3 deletions

1
NEWS
View File

@ -1,3 +1,4 @@
* #1825: Fix tab label padding. (marco)
* #1823: Margin at the toolbar tabs bottom. (marco) * #1823: Margin at the toolbar tabs bottom. (marco)
* #1872, #1934: Hide palettes when closing activities or switching views. (tomeu) * #1872, #1934: Hide palettes when closing activities or switching views. (tomeu)

View File

@ -43,6 +43,7 @@ class Font(object):
return pango.FontDescription(self._desc) return pango.FontDescription(self._desc)
_FOCUS_LINE_WIDTH = 2 _FOCUS_LINE_WIDTH = 2
_TAB_CURVATURE = 1
ZOOM_FACTOR = _compute_zoom_factor() ZOOM_FACTOR = _compute_zoom_factor()
@ -53,3 +54,5 @@ FONT_BOLD = Font('Bitstream Vera Sans bold %d' % FONT_SIZE)
TOOLBOX_SEPARATOR_HEIGHT = _zoom(9) TOOLBOX_SEPARATOR_HEIGHT = _zoom(9)
TOOLBOX_HORIZONTAL_PADDING = _zoom(75) TOOLBOX_HORIZONTAL_PADDING = _zoom(75)
TOOLBOX_TAB_VBORDER = int((_zoom(36) - FONT_SIZE - _FOCUS_LINE_WIDTH) / 2) TOOLBOX_TAB_VBORDER = int((_zoom(36) - FONT_SIZE - _FOCUS_LINE_WIDTH) / 2)
TOOLBOX_TAB_HBORDER = _zoom(15) - _FOCUS_LINE_WIDTH - _TAB_CURVATURE
TOOLBOX_TAB_LABEL_WIDTH = _zoom(150 - 15 * 2)

View File

@ -21,8 +21,6 @@ import gobject
from sugar.graphics.toolbutton import ToolButton from sugar.graphics.toolbutton import ToolButton
from sugar.graphics import style from sugar.graphics import style
_N_TABS = 8
class Toolbox(gtk.VBox): class Toolbox(gtk.VBox):
__gtype_name__ = 'SugarToolbox' __gtype_name__ = 'SugarToolbox'
@ -40,6 +38,7 @@ class Toolbox(gtk.VBox):
self._notebook.set_show_border(False) self._notebook.set_show_border(False)
self._notebook.set_show_tabs(False) self._notebook.set_show_tabs(False)
self._notebook.props.tab_vborder = style.TOOLBOX_TAB_VBORDER self._notebook.props.tab_vborder = style.TOOLBOX_TAB_VBORDER
self._notebook.props.tab_hborder = style.TOOLBOX_TAB_HBORDER
self.pack_start(self._notebook) self.pack_start(self._notebook)
self._notebook.show() self._notebook.show()
@ -65,7 +64,7 @@ class Toolbox(gtk.VBox):
def add_toolbar(self, name, toolbar): def add_toolbar(self, name, toolbar):
label = gtk.Label(name) label = gtk.Label(name)
label.set_size_request(gtk.gdk.screen_width() / _N_TABS, -1) label.set_size_request(style.TOOLBOX_TAB_LABEL_WIDTH, -1)
label.set_alignment(0.0, 0.5) label.set_alignment(0.0, 0.5)
toolbar_box = gtk.HBox() toolbar_box = gtk.HBox()