Merge lp:~agateau/ubiquity/kde-no-fullscreen into lp:ubiquity
- kde-no-fullscreen
- Merge into trunk
Proposed by
Aurélien Gâteau
Status: | Merged |
---|---|
Merged at revision: | 6109 |
Proposed branch: | lp:~agateau/ubiquity/kde-no-fullscreen |
Merge into: | lp:ubiquity |
Diff against target: |
347 lines (+142/-51) 6 files modified
bin/ubiquity-dm (+74/-49) bin/ubiquity-qtsetbg (+56/-0) debian/ubiquity-frontend-kde.install (+1/-0) gui/qt/share/README (+1/-0) gui/qt/share/config/kwinrc (+5/-0) ubiquity/frontend/kde_ui.py (+5/-2) |
To merge this branch: | bzr merge lp:~agateau/ubiquity/kde-no-fullscreen |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jonathan Riddell | Pending | ||
Review via email: mp+203105@code.launchpad.net |
Commit message
Description of the change
When running in greeter mode, do not start in fullscreen, as it looks a bit dull and empty.
To post a comment you must log in.
- 6106. By Aurélien Gâteau
-
Improve logging support
- 6107. By Aurélien Gâteau
-
Hide all KWin buttons but the maximize/restore button
- 6108. By Aurélien Gâteau
-
Bring back default wallpaper behind Ubiquity window
The wallpaper has problem not been drawn for a long time but it went
unnoticed because the installer was fullscreen.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'bin/ubiquity-dm' |
2 | --- bin/ubiquity-dm 2013-12-17 18:08:56 +0000 |
3 | +++ bin/ubiquity-dm 2014-01-31 14:04:22 +0000 |
4 | @@ -11,6 +11,7 @@ |
5 | import signal |
6 | import subprocess |
7 | import sys |
8 | +import traceback |
9 | import time |
10 | |
11 | import debconf |
12 | @@ -25,6 +26,13 @@ |
13 | from ubiquity.misc import create_bool, utf8 |
14 | |
15 | |
16 | +logfile = None |
17 | + |
18 | + |
19 | +def log(msg): |
20 | + print('ubiquity-dm: ' + msg, file=logfile, flush=True) |
21 | + |
22 | + |
23 | def _pam_conv(auth, query_list, userData): |
24 | resp = [] |
25 | for query, type in query_list: |
26 | @@ -73,9 +81,13 @@ |
27 | with open('/etc/locale.gen', 'w') as locale_gen: |
28 | print('%s UTF-8' % locale, file=locale_gen) |
29 | |
30 | - with open('/var/log/installer/dm', 'a') as logfile: |
31 | - subprocess.call(['/usr/sbin/locale-gen', locale], |
32 | - stdout=logfile, stderr=logfile) |
33 | + subprocess.call(['/usr/sbin/locale-gen', locale], |
34 | + stdout=logfile, stderr=logfile) |
35 | + |
36 | + |
37 | +def add_ubiquity_kdedir(): |
38 | + os.environ['KDEDIRS'] = '/usr/share/ubiquity/qt:' + \ |
39 | + os.environ.get('KDEDIRS', '') |
40 | |
41 | |
42 | class XStartupError(EnvironmentError): |
43 | @@ -166,10 +178,9 @@ |
44 | if '.' not in entry] |
45 | for hookentry in hooks: |
46 | hook = os.path.join(hookdir, hookentry) |
47 | - with open('/var/log/installer/dm', 'a') as logfile: |
48 | - subprocess.call( |
49 | - hook, stdout=logfile, stderr=logfile, |
50 | - preexec_fn=self.drop_privileges) |
51 | + subprocess.call( |
52 | + hook, stdout=logfile, stderr=logfile, |
53 | + preexec_fn=self.drop_privileges) |
54 | |
55 | def pam_open_session(self): |
56 | self.auth.start('su') |
57 | @@ -206,7 +217,7 @@ |
58 | # be happy if someone already created the path |
59 | if e.errno != errno.EEXIST: |
60 | raise |
61 | - logfile = open('/var/log/installer/dm', 'w') |
62 | + log('starting') |
63 | |
64 | signal.signal(signal.SIGUSR1, self.sigusr1_handler) |
65 | signal.signal(signal.SIGTTIN, signal.SIG_IGN) |
66 | @@ -214,6 +225,7 @@ |
67 | |
68 | servercommand = ['X', '-br', '-ac', '-noreset', '-nolisten', 'tcp'] |
69 | |
70 | + log('plymouth') |
71 | try: |
72 | plymouth_running = subprocess.call(['plymouth', '--ping']) == 0 |
73 | except OSError: |
74 | @@ -229,6 +241,7 @@ |
75 | |
76 | servercommand.extend([self.vt, self.display]) |
77 | |
78 | + log('start X {}'.format(servercommand)) |
79 | for attempt in ('main', 'fbdev', 'vesa'): |
80 | command = list(servercommand) |
81 | if attempt == 'main' and self.force_failsafe: |
82 | @@ -298,6 +311,7 @@ |
83 | if self.server_started: |
84 | break |
85 | |
86 | + log('set vars') |
87 | os.environ['DISPLAY'] = self.display |
88 | os.environ['HOME'] = self.homedir |
89 | # Give ubiquity a UID and GID that it can drop privileges to. |
90 | @@ -306,19 +320,23 @@ |
91 | # Overlay scrollbars are now a gtk module |
92 | os.environ['GTK_MODULES'] = 'overlay-scrollbar' |
93 | |
94 | + log('pam_open_session') |
95 | self.pam_open_session() |
96 | |
97 | # run simple, custom scripts during install time |
98 | if program_basename == 'ubiquity': |
99 | + log('dm-scripts') |
100 | self.run_hooks('/usr/lib/ubiquity/dm-scripts/install') |
101 | |
102 | # run simple, custom scripts during oem-config |
103 | if program_basename == 'oem-config-wrapper': |
104 | + log('oem dm-scripts') |
105 | self.run_hooks('/usr/lib/ubiquity/dm-scripts/oem') |
106 | |
107 | # Session bus, apparently needed by most interfaces now |
108 | if ('DBUS_SESSION_BUS_ADDRESS' not in os.environ and |
109 | osextras.find_on_path('dbus-launch')): |
110 | + log('dbus') |
111 | dbus_subp = subprocess.Popen( |
112 | ['dbus-launch', '--exit-with-session'], |
113 | stdin=null, stdout=subprocess.PIPE, stderr=logfile, |
114 | @@ -334,6 +352,7 @@ |
115 | |
116 | # dconf writer |
117 | if os.path.exists("/usr/lib/dconf/dconf-service"): |
118 | + log('dconf-service') |
119 | extras.append(subprocess.Popen( |
120 | ['/usr/lib/dconf/dconf-service'], |
121 | stdin=null, stdout=logfile, stderr=logfile, |
122 | @@ -344,6 +363,7 @@ |
123 | with open('/proc/cmdline', 'r') as fp: |
124 | proc_cmdline = fp.readline().split() |
125 | |
126 | + log('start frontend {}'.format(self.frontend)) |
127 | if self.frontend == 'gtk_ui': |
128 | # Set a desktop wallpaper. |
129 | visual_a11y = 'access=v' in proc_cmdline |
130 | @@ -518,39 +538,26 @@ |
131 | stdin=null, stdout=logfile, stderr=logfile, |
132 | preexec_fn=self.drop_privileges)) |
133 | elif self.frontend == 'kde_ui': |
134 | - # Don't show the background image in v1 accessibility profile. |
135 | - os.setegid(self.gid) |
136 | - os.seteuid(self.uid) |
137 | - path = '/usr/share/wallpapers/kde-default.png' |
138 | - if (os.access(path, os.R_OK) and not 'access=v1' in proc_cmdline): |
139 | - # Draw a background image for the install progress window. |
140 | - from PyQt4.QtCore import Qt |
141 | - from PyQt4 import QtGui |
142 | - a = QtGui.QApplication(sys.argv) |
143 | - root_win = a.desktop() |
144 | - wallpaper = QtGui.QPixmap(path) |
145 | - wallpaper = wallpaper.scaled( |
146 | - root_win.width(), root_win.height(), |
147 | - Qt.KeepAspectRatioByExpanding, Qt.SmoothTransformation) |
148 | - palette = QtGui.QPalette() |
149 | - palette.setBrush(root_win.backgroundRole(), |
150 | - QtGui.QBrush(wallpaper)) |
151 | - root_win.setPalette(palette) |
152 | - root_win.setCursor(Qt.ArrowCursor) |
153 | - a.processEvents() |
154 | - # Force garbage collection so we don't end up with stray X |
155 | - # resources when we kill the X server (LP: #556555). |
156 | - del a |
157 | - os.seteuid(0) |
158 | - os.setegid(0) |
159 | + if not 'access=v1' in proc_cmdline: |
160 | + log('paint background') |
161 | + path = '/usr/share/wallpapers/kde-default.png' |
162 | + extras.append(subprocess.Popen( |
163 | + ['ubiquity-qtsetbg', path], |
164 | + stdin=null, stdout=logfile, stderr=logfile, |
165 | + preexec_fn=self.drop_privileges)) |
166 | |
167 | + log("add_ubiquity_kdedir") |
168 | + add_ubiquity_kdedir() |
169 | + log('start kwin') |
170 | wm = subprocess.Popen( |
171 | 'kwin', stdin=null, stdout=logfile, stderr=logfile, |
172 | preexec_fn=self.drop_privileges) |
173 | |
174 | + log('start greeter') |
175 | greeter = subprocess.Popen( |
176 | program, stdin=null, stdout=logfile, stderr=logfile) |
177 | ret = greeter.wait() |
178 | + log('greeter exited with code {}'.format(ret)) |
179 | |
180 | reboot = False |
181 | if ret != 0: |
182 | @@ -649,7 +656,6 @@ |
183 | kill_if_exists(server.pid, signal.SIGTERM) |
184 | server.wait() |
185 | |
186 | - logfile.close() |
187 | null.close() |
188 | |
189 | if reboot: |
190 | @@ -660,18 +666,37 @@ |
191 | return 1 |
192 | |
193 | |
194 | -if len(sys.argv) < 4: |
195 | - sys.stderr.write('Usage: %s <vt[1-N]> <:[0-N]> <username> <program> ' |
196 | - '[<arguments>]\n' % sys.argv[0]) |
197 | - sys.exit(1) |
198 | - |
199 | -vt, display, username = sys.argv[1:4] |
200 | -try: |
201 | - dm = DM(vt, display, username) |
202 | -except XStartupError: |
203 | - sys.exit(1) |
204 | -ret = dm.run(*sys.argv[4:]) |
205 | -if ret == 0: |
206 | - set_locale() |
207 | -dm.pam_close_session() |
208 | -sys.exit(ret) |
209 | +def run(vt, display, username): |
210 | + try: |
211 | + dm = DM(vt, display, username) |
212 | + except XStartupError: |
213 | + log("XStartupError") |
214 | + return 1 |
215 | + ret = dm.run(*sys.argv[4:]) |
216 | + if ret == 0: |
217 | + log("set_locale") |
218 | + set_locale() |
219 | + dm.pam_close_session() |
220 | + return ret |
221 | + |
222 | + |
223 | +def main(): |
224 | + global logfile |
225 | + |
226 | + if len(sys.argv) < 4: |
227 | + sys.stderr.write('Usage: %s <vt[1-N]> <:[0-N]> <username> <program> ' |
228 | + '[<arguments>]\n' % sys.argv[0]) |
229 | + return 1 |
230 | + vt, display, username = sys.argv[1:4] |
231 | + |
232 | + logfile = open('/var/log/installer/dm', 'w') |
233 | + try: |
234 | + ret = run(vt, display, username) |
235 | + log('Exiting with code {}'.format(ret)) |
236 | + except Exception: |
237 | + log('Failed with an exception:') |
238 | + log(traceback.format_exc()) |
239 | + return 1 |
240 | + |
241 | +if __name__ == '__main__': |
242 | + sys.exit(main()) |
243 | |
244 | === added file 'bin/ubiquity-qtsetbg' |
245 | --- bin/ubiquity-qtsetbg 1970-01-01 00:00:00 +0000 |
246 | +++ bin/ubiquity-qtsetbg 2014-01-31 14:04:22 +0000 |
247 | @@ -0,0 +1,56 @@ |
248 | +#!/usr/bin/python3 |
249 | + |
250 | +''' |
251 | +Helper program to draw a background image on each screen of the system. |
252 | +''' |
253 | + |
254 | +import sys |
255 | + |
256 | +from PyQt4.QtCore import Qt |
257 | +from PyQt4 import QtGui |
258 | + |
259 | + |
260 | +def die(msg): |
261 | + print(msg, file=sys.stderr) |
262 | + sys.exit(1) |
263 | + |
264 | + |
265 | +def create_window(wallpaper, geometry): |
266 | + win = QtGui.QWidget() |
267 | + |
268 | + wallpaper = wallpaper.scaled(geometry.size(), |
269 | + Qt.KeepAspectRatioByExpanding, |
270 | + Qt.SmoothTransformation) |
271 | + palette = QtGui.QPalette() |
272 | + palette.setBrush(win.backgroundRole(), QtGui.QBrush(wallpaper)) |
273 | + |
274 | + win.setPalette(palette) |
275 | + win.setAttribute(Qt.WA_X11NetWmWindowTypeDesktop) |
276 | + win.setGeometry(geometry) |
277 | + win.show() |
278 | + return win |
279 | + |
280 | + |
281 | +def main(): |
282 | + if len(sys.argv) != 2: |
283 | + die('usage: {} <path/to/wallpaper.png>'.format(sys.argv[0])) |
284 | + path = sys.argv[1] |
285 | + |
286 | + app = QtGui.QApplication(sys.argv) |
287 | + wallpaper = QtGui.QPixmap(path) |
288 | + if wallpaper.isNull(): |
289 | + die('Failed to load {}'.format(path)) |
290 | + |
291 | + desktop = app.desktop() |
292 | + # Keep a trace of the windows to ensure they are not garbage collected |
293 | + windows = [] |
294 | + for idx in range(desktop.screenCount()): |
295 | + geometry = desktop.screenGeometry(idx) |
296 | + win = create_window(wallpaper, geometry) |
297 | + windows.append(win) |
298 | + |
299 | + return app.exec_() |
300 | + |
301 | + |
302 | +if __name__ == '__main__': |
303 | + main() |
304 | |
305 | === modified file 'debian/ubiquity-frontend-kde.install' |
306 | --- debian/ubiquity-frontend-kde.install 2013-07-11 18:23:07 +0000 |
307 | +++ debian/ubiquity-frontend-kde.install 2014-01-31 14:04:22 +0000 |
308 | @@ -1,3 +1,4 @@ |
309 | +bin/ubiquity-qtsetbg usr/bin |
310 | data/ubiquity-kdeui.desktop usr/share/applications/kde4 |
311 | gui/qt usr/share/ubiquity |
312 | ubiquity/frontend/kde* usr/lib/ubiquity/ubiquity/frontend |
313 | |
314 | === added directory 'gui/qt/share' |
315 | === added file 'gui/qt/share/README' |
316 | --- gui/qt/share/README 1970-01-01 00:00:00 +0000 |
317 | +++ gui/qt/share/README 2014-01-31 14:04:22 +0000 |
318 | @@ -0,0 +1,1 @@ |
319 | +This folder is used by ubiquity-dm to customize some of KDE settings. |
320 | |
321 | === added directory 'gui/qt/share/config' |
322 | === added file 'gui/qt/share/config/kwinrc' |
323 | --- gui/qt/share/config/kwinrc 1970-01-01 00:00:00 +0000 |
324 | +++ gui/qt/share/config/kwinrc 2014-01-31 14:04:22 +0000 |
325 | @@ -0,0 +1,5 @@ |
326 | +# Disable all buttons but maximize/restore |
327 | +[Style] |
328 | +CustomButtonPositions=true |
329 | +ButtonsOnLeft= |
330 | +ButtonsOnRight=A |
331 | |
332 | === modified file 'ubiquity/frontend/kde_ui.py' |
333 | --- ubiquity/frontend/kde_ui.py 2013-12-11 15:05:41 +0000 |
334 | +++ ubiquity/frontend/kde_ui.py 2014-01-31 14:04:22 +0000 |
335 | @@ -180,8 +180,11 @@ |
336 | self.ui.content_widget.setVisible(False) |
337 | |
338 | if 'UBIQUITY_GREETER' in os.environ: |
339 | - self.ui.setWindowState( |
340 | - self.ui.windowState() ^ QtCore.Qt.WindowFullScreen) |
341 | + self.ui.setWindowFlags( |
342 | + QtCore.Qt.Dialog |
343 | + | QtCore.Qt.CustomizeWindowHint |
344 | + | QtCore.Qt.WindowTitleHint |
345 | + ) |
346 | |
347 | self.ui.setWizard(self) |
348 |