From 53a7f1f621439aa66345584d99235e1294656b97 Mon Sep 17 00:00:00 2001
From: Aleksey Lim <alsroot@member.fsf.org>
Date: Fri, 17 Sep 2010 13:22:20 +0000
Subject: [PATCH] Default sugar-emulator window size does not follow HIG #1747
---
src/jarabe/util/emulator.py | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/jarabe/util/emulator.py b/src/jarabe/util/emulator.py
index 6a43044..e6455a0 100644
a
|
b
|
ERROR_NO_DISPLAY = 30 |
32 | 32 | ERROR_NO_SERVER = 31 |
33 | 33 | |
34 | 34 | |
35 | | default_dimensions = (800, 600) |
36 | 35 | def _run_xephyr(display, dpi, dimensions, fullscreen): |
37 | 36 | cmd = [ 'Xephyr' ] |
38 | 37 | cmd.append(':%d' % display) |
39 | 38 | cmd.append('-ac') |
40 | 39 | cmd += ['-title', _('Sugar in a window')] |
41 | 40 | |
| 41 | from sugar.graphics.style import GRID_CELL_SIZE |
| 42 | default_dimensions = (GRID_CELL_SIZE * 16, GRID_CELL_SIZE * 12) |
| 43 | |
42 | 44 | screen_size = (gtk.gdk.screen_width(), gtk.gdk.screen_height()) |
43 | 45 | |
44 | 46 | if (not dimensions) and (fullscreen is None) and \ |
… |
… |
def _start_window_manager(): |
118 | 120 | |
119 | 121 | gobject.spawn_async(cmd, flags=gobject.SPAWN_SEARCH_PATH) |
120 | 122 | |
121 | | def _setup_env(display, scaling, emulator_pid): |
| 123 | def _setup_env(display, emulator_pid): |
122 | 124 | os.environ['SUGAR_EMULATOR'] = 'yes' |
123 | 125 | os.environ['GABBLE_LOGFILE'] = os.path.join( |
124 | 126 | env.get_profile_path(), 'logs', 'telepathy-gabble.log') |
… |
… |
def _setup_env(display, scaling, emulator_pid): |
133 | 135 | os.environ['MC_ACCOUNT_DIR'] = os.path.join( |
134 | 136 | env.get_profile_path(), 'accounts') |
135 | 137 | |
136 | | if scaling: |
137 | | os.environ['SUGAR_SCALING'] = scaling |
138 | | |
139 | 138 | def main(): |
140 | 139 | """Script-level operations""" |
141 | 140 | |
… |
… |
def main(): |
143 | 142 | parser.add_option('-d', '--dpi', dest='dpi', type="int", |
144 | 143 | help='Emulator dpi') |
145 | 144 | parser.add_option('-s', '--scaling', dest='scaling', |
146 | | help='Sugar scaling in %') |
| 145 | help='Sugar scaling in %', default='72') |
147 | 146 | parser.add_option('-i', '--dimensions', dest='dimensions', |
148 | 147 | help='Emulator dimensions (ex. 1200x900)') |
149 | 148 | parser.add_option('-f', '--fullscreen', dest='fullscreen', |
… |
… |
def main(): |
158 | 157 | sys.stderr.write('DISPLAY not set, cannot connect to host X server.\n') |
159 | 158 | return ERROR_NO_DISPLAY |
160 | 159 | |
| 160 | # Set SUGAR_SCALING before importing sugar.graphics.style in _run_xephyr |
| 161 | os.environ['SUGAR_SCALING'] = options.scaling |
| 162 | |
161 | 163 | server, display = _start_xephyr(options.dpi, options.dimensions, |
162 | 164 | options.fullscreen) |
163 | 165 | if server is None: |
… |
… |
def main(): |
165 | 167 | ' for any error message.\n') |
166 | 168 | return ERROR_NO_SERVER |
167 | 169 | |
168 | | _setup_env(display, options.scaling, str(server.pid)) |
| 170 | _setup_env(display, str(server.pid)) |
169 | 171 | |
170 | 172 | command = ['dbus-launch', '--exit-with-session'] |
171 | 173 | |