Sync gtk theme values and style.py. Add a comment at the top
of style.py about the reference zoom value.
This commit is contained in:
parent
8b326fda61
commit
e25847c375
@ -1,7 +1,7 @@
|
|||||||
@{
|
@{
|
||||||
if theme == 'sugar':
|
if theme == 'sugar':
|
||||||
font_name = 'Sans Serif 10'
|
font_name = 'Sans Serif 10'
|
||||||
icon_sizes = 'gtk-large-toolbar=32,32'
|
icon_sizes = 'gtk-large-toolbar=40,40'
|
||||||
else:
|
else:
|
||||||
font_name = 'Sans Serif 7'
|
font_name = 'Sans Serif 7'
|
||||||
icon_sizes = 'gtk-large-toolbar=55,55'
|
icon_sizes = 'gtk-large-toolbar=55,55'
|
||||||
|
@ -15,24 +15,36 @@
|
|||||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
# Boston, MA 02111-1307, USA.
|
# Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
"""
|
||||||
|
All the constants are expressed in pixels. They are defined for the XO screen
|
||||||
|
and are usually adapted to different resolution by applying a zoom factor. The
|
||||||
|
factor for traditional 96 dpi screen is currently 0.72 which is the inverse
|
||||||
|
of the one we are using to adapt web pages to the XO screen. It should be
|
||||||
|
considered a reference value rather then a scale constant which has to be
|
||||||
|
automatically applied and always respected.
|
||||||
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import gtk
|
import gtk
|
||||||
import pango
|
import pango
|
||||||
|
|
||||||
|
_XO_DPI = 200.0
|
||||||
|
|
||||||
|
_FOCUS_LINE_WIDTH = 2
|
||||||
|
_TAB_CURVATURE = 1
|
||||||
|
|
||||||
def _get_screen_dpi():
|
def _get_screen_dpi():
|
||||||
xft_dpi = gtk.settings_get_default().get_property('gtk-xft-dpi')
|
xft_dpi = gtk.settings_get_default().get_property('gtk-xft-dpi')
|
||||||
return float(xft_dpi / 1024)
|
return float(xft_dpi / 1024)
|
||||||
|
|
||||||
def _compute_zoom_factor():
|
def _compute_zoom_factor():
|
||||||
if os.environ.has_key('SUGAR_XO_STYLE'):
|
if _get_screen_dpi() == 96.0:
|
||||||
if os.environ['SUGAR_XO_STYLE'] == 'yes':
|
if not os.environ.has_key('SUGAR_XO_STYLE') or \
|
||||||
return 1.0
|
not os.environ['SUGAR_XO_STYLE'] == 'yes':
|
||||||
|
return 0.72
|
||||||
|
|
||||||
return gtk.gdk.screen_width() / 1200.0
|
return 1.0
|
||||||
|
|
||||||
def zoom(units):
|
|
||||||
return int(ZOOM_FACTOR * units)
|
|
||||||
|
|
||||||
def _compute_font_height(font):
|
def _compute_font_height(font):
|
||||||
widget = gtk.Label('')
|
widget = gtk.Label('')
|
||||||
@ -93,10 +105,8 @@ class Color(object):
|
|||||||
else:
|
else:
|
||||||
return self.get_html()
|
return self.get_html()
|
||||||
|
|
||||||
_XO_DPI = 200.0
|
def zoom(units):
|
||||||
|
return int(ZOOM_FACTOR * units)
|
||||||
_FOCUS_LINE_WIDTH = 2
|
|
||||||
_TAB_CURVATURE = 1
|
|
||||||
|
|
||||||
ZOOM_FACTOR = _compute_zoom_factor()
|
ZOOM_FACTOR = _compute_zoom_factor()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user