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 | 11 | import signal | 11 | import signal |
6 | 12 | import subprocess | 12 | import subprocess |
7 | 13 | import sys | 13 | import sys |
8 | 14 | import traceback | ||
9 | 14 | import time | 15 | import time |
10 | 15 | 16 | ||
11 | 16 | import debconf | 17 | import debconf |
12 | @@ -25,6 +26,13 @@ | |||
13 | 25 | from ubiquity.misc import create_bool, utf8 | 26 | from ubiquity.misc import create_bool, utf8 |
14 | 26 | 27 | ||
15 | 27 | 28 | ||
16 | 29 | logfile = None | ||
17 | 30 | |||
18 | 31 | |||
19 | 32 | def log(msg): | ||
20 | 33 | print('ubiquity-dm: ' + msg, file=logfile, flush=True) | ||
21 | 34 | |||
22 | 35 | |||
23 | 28 | def _pam_conv(auth, query_list, userData): | 36 | def _pam_conv(auth, query_list, userData): |
24 | 29 | resp = [] | 37 | resp = [] |
25 | 30 | for query, type in query_list: | 38 | for query, type in query_list: |
26 | @@ -73,9 +81,13 @@ | |||
27 | 73 | with open('/etc/locale.gen', 'w') as locale_gen: | 81 | with open('/etc/locale.gen', 'w') as locale_gen: |
28 | 74 | print('%s UTF-8' % locale, file=locale_gen) | 82 | print('%s UTF-8' % locale, file=locale_gen) |
29 | 75 | 83 | ||
33 | 76 | with open('/var/log/installer/dm', 'a') as logfile: | 84 | subprocess.call(['/usr/sbin/locale-gen', locale], |
34 | 77 | subprocess.call(['/usr/sbin/locale-gen', locale], | 85 | stdout=logfile, stderr=logfile) |
35 | 78 | stdout=logfile, stderr=logfile) | 86 | |
36 | 87 | |||
37 | 88 | def add_ubiquity_kdedir(): | ||
38 | 89 | os.environ['KDEDIRS'] = '/usr/share/ubiquity/qt:' + \ | ||
39 | 90 | os.environ.get('KDEDIRS', '') | ||
40 | 79 | 91 | ||
41 | 80 | 92 | ||
42 | 81 | class XStartupError(EnvironmentError): | 93 | class XStartupError(EnvironmentError): |
43 | @@ -166,10 +178,9 @@ | |||
44 | 166 | if '.' not in entry] | 178 | if '.' not in entry] |
45 | 167 | for hookentry in hooks: | 179 | for hookentry in hooks: |
46 | 168 | hook = os.path.join(hookdir, hookentry) | 180 | hook = os.path.join(hookdir, hookentry) |
51 | 169 | with open('/var/log/installer/dm', 'a') as logfile: | 181 | subprocess.call( |
52 | 170 | subprocess.call( | 182 | hook, stdout=logfile, stderr=logfile, |
53 | 171 | hook, stdout=logfile, stderr=logfile, | 183 | preexec_fn=self.drop_privileges) |
50 | 172 | preexec_fn=self.drop_privileges) | ||
54 | 173 | 184 | ||
55 | 174 | def pam_open_session(self): | 185 | def pam_open_session(self): |
56 | 175 | self.auth.start('su') | 186 | self.auth.start('su') |
57 | @@ -206,7 +217,7 @@ | |||
58 | 206 | # be happy if someone already created the path | 217 | # be happy if someone already created the path |
59 | 207 | if e.errno != errno.EEXIST: | 218 | if e.errno != errno.EEXIST: |
60 | 208 | raise | 219 | raise |
62 | 209 | logfile = open('/var/log/installer/dm', 'w') | 220 | log('starting') |
63 | 210 | 221 | ||
64 | 211 | signal.signal(signal.SIGUSR1, self.sigusr1_handler) | 222 | signal.signal(signal.SIGUSR1, self.sigusr1_handler) |
65 | 212 | signal.signal(signal.SIGTTIN, signal.SIG_IGN) | 223 | signal.signal(signal.SIGTTIN, signal.SIG_IGN) |
66 | @@ -214,6 +225,7 @@ | |||
67 | 214 | 225 | ||
68 | 215 | servercommand = ['X', '-br', '-ac', '-noreset', '-nolisten', 'tcp'] | 226 | servercommand = ['X', '-br', '-ac', '-noreset', '-nolisten', 'tcp'] |
69 | 216 | 227 | ||
70 | 228 | log('plymouth') | ||
71 | 217 | try: | 229 | try: |
72 | 218 | plymouth_running = subprocess.call(['plymouth', '--ping']) == 0 | 230 | plymouth_running = subprocess.call(['plymouth', '--ping']) == 0 |
73 | 219 | except OSError: | 231 | except OSError: |
74 | @@ -229,6 +241,7 @@ | |||
75 | 229 | 241 | ||
76 | 230 | servercommand.extend([self.vt, self.display]) | 242 | servercommand.extend([self.vt, self.display]) |
77 | 231 | 243 | ||
78 | 244 | log('start X {}'.format(servercommand)) | ||
79 | 232 | for attempt in ('main', 'fbdev', 'vesa'): | 245 | for attempt in ('main', 'fbdev', 'vesa'): |
80 | 233 | command = list(servercommand) | 246 | command = list(servercommand) |
81 | 234 | if attempt == 'main' and self.force_failsafe: | 247 | if attempt == 'main' and self.force_failsafe: |
82 | @@ -298,6 +311,7 @@ | |||
83 | 298 | if self.server_started: | 311 | if self.server_started: |
84 | 299 | break | 312 | break |
85 | 300 | 313 | ||
86 | 314 | log('set vars') | ||
87 | 301 | os.environ['DISPLAY'] = self.display | 315 | os.environ['DISPLAY'] = self.display |
88 | 302 | os.environ['HOME'] = self.homedir | 316 | os.environ['HOME'] = self.homedir |
89 | 303 | # Give ubiquity a UID and GID that it can drop privileges to. | 317 | # Give ubiquity a UID and GID that it can drop privileges to. |
90 | @@ -306,19 +320,23 @@ | |||
91 | 306 | # Overlay scrollbars are now a gtk module | 320 | # Overlay scrollbars are now a gtk module |
92 | 307 | os.environ['GTK_MODULES'] = 'overlay-scrollbar' | 321 | os.environ['GTK_MODULES'] = 'overlay-scrollbar' |
93 | 308 | 322 | ||
94 | 323 | log('pam_open_session') | ||
95 | 309 | self.pam_open_session() | 324 | self.pam_open_session() |
96 | 310 | 325 | ||
97 | 311 | # run simple, custom scripts during install time | 326 | # run simple, custom scripts during install time |
98 | 312 | if program_basename == 'ubiquity': | 327 | if program_basename == 'ubiquity': |
99 | 328 | log('dm-scripts') | ||
100 | 313 | self.run_hooks('/usr/lib/ubiquity/dm-scripts/install') | 329 | self.run_hooks('/usr/lib/ubiquity/dm-scripts/install') |
101 | 314 | 330 | ||
102 | 315 | # run simple, custom scripts during oem-config | 331 | # run simple, custom scripts during oem-config |
103 | 316 | if program_basename == 'oem-config-wrapper': | 332 | if program_basename == 'oem-config-wrapper': |
104 | 333 | log('oem dm-scripts') | ||
105 | 317 | self.run_hooks('/usr/lib/ubiquity/dm-scripts/oem') | 334 | self.run_hooks('/usr/lib/ubiquity/dm-scripts/oem') |
106 | 318 | 335 | ||
107 | 319 | # Session bus, apparently needed by most interfaces now | 336 | # Session bus, apparently needed by most interfaces now |
108 | 320 | if ('DBUS_SESSION_BUS_ADDRESS' not in os.environ and | 337 | if ('DBUS_SESSION_BUS_ADDRESS' not in os.environ and |
109 | 321 | osextras.find_on_path('dbus-launch')): | 338 | osextras.find_on_path('dbus-launch')): |
110 | 339 | log('dbus') | ||
111 | 322 | dbus_subp = subprocess.Popen( | 340 | dbus_subp = subprocess.Popen( |
112 | 323 | ['dbus-launch', '--exit-with-session'], | 341 | ['dbus-launch', '--exit-with-session'], |
113 | 324 | stdin=null, stdout=subprocess.PIPE, stderr=logfile, | 342 | stdin=null, stdout=subprocess.PIPE, stderr=logfile, |
114 | @@ -334,6 +352,7 @@ | |||
115 | 334 | 352 | ||
116 | 335 | # dconf writer | 353 | # dconf writer |
117 | 336 | if os.path.exists("/usr/lib/dconf/dconf-service"): | 354 | if os.path.exists("/usr/lib/dconf/dconf-service"): |
118 | 355 | log('dconf-service') | ||
119 | 337 | extras.append(subprocess.Popen( | 356 | extras.append(subprocess.Popen( |
120 | 338 | ['/usr/lib/dconf/dconf-service'], | 357 | ['/usr/lib/dconf/dconf-service'], |
121 | 339 | stdin=null, stdout=logfile, stderr=logfile, | 358 | stdin=null, stdout=logfile, stderr=logfile, |
122 | @@ -344,6 +363,7 @@ | |||
123 | 344 | with open('/proc/cmdline', 'r') as fp: | 363 | with open('/proc/cmdline', 'r') as fp: |
124 | 345 | proc_cmdline = fp.readline().split() | 364 | proc_cmdline = fp.readline().split() |
125 | 346 | 365 | ||
126 | 366 | log('start frontend {}'.format(self.frontend)) | ||
127 | 347 | if self.frontend == 'gtk_ui': | 367 | if self.frontend == 'gtk_ui': |
128 | 348 | # Set a desktop wallpaper. | 368 | # Set a desktop wallpaper. |
129 | 349 | visual_a11y = 'access=v' in proc_cmdline | 369 | visual_a11y = 'access=v' in proc_cmdline |
130 | @@ -518,39 +538,26 @@ | |||
131 | 518 | stdin=null, stdout=logfile, stderr=logfile, | 538 | stdin=null, stdout=logfile, stderr=logfile, |
132 | 519 | preexec_fn=self.drop_privileges)) | 539 | preexec_fn=self.drop_privileges)) |
133 | 520 | elif self.frontend == 'kde_ui': | 540 | elif self.frontend == 'kde_ui': |
159 | 521 | # Don't show the background image in v1 accessibility profile. | 541 | if not 'access=v1' in proc_cmdline: |
160 | 522 | os.setegid(self.gid) | 542 | log('paint background') |
161 | 523 | os.seteuid(self.uid) | 543 | path = '/usr/share/wallpapers/kde-default.png' |
162 | 524 | path = '/usr/share/wallpapers/kde-default.png' | 544 | extras.append(subprocess.Popen( |
163 | 525 | if (os.access(path, os.R_OK) and not 'access=v1' in proc_cmdline): | 545 | ['ubiquity-qtsetbg', path], |
164 | 526 | # Draw a background image for the install progress window. | 546 | stdin=null, stdout=logfile, stderr=logfile, |
165 | 527 | from PyQt4.QtCore import Qt | 547 | preexec_fn=self.drop_privileges)) |
141 | 528 | from PyQt4 import QtGui | ||
142 | 529 | a = QtGui.QApplication(sys.argv) | ||
143 | 530 | root_win = a.desktop() | ||
144 | 531 | wallpaper = QtGui.QPixmap(path) | ||
145 | 532 | wallpaper = wallpaper.scaled( | ||
146 | 533 | root_win.width(), root_win.height(), | ||
147 | 534 | Qt.KeepAspectRatioByExpanding, Qt.SmoothTransformation) | ||
148 | 535 | palette = QtGui.QPalette() | ||
149 | 536 | palette.setBrush(root_win.backgroundRole(), | ||
150 | 537 | QtGui.QBrush(wallpaper)) | ||
151 | 538 | root_win.setPalette(palette) | ||
152 | 539 | root_win.setCursor(Qt.ArrowCursor) | ||
153 | 540 | a.processEvents() | ||
154 | 541 | # Force garbage collection so we don't end up with stray X | ||
155 | 542 | # resources when we kill the X server (LP: #556555). | ||
156 | 543 | del a | ||
157 | 544 | os.seteuid(0) | ||
158 | 545 | os.setegid(0) | ||
166 | 546 | 548 | ||
167 | 549 | log("add_ubiquity_kdedir") | ||
168 | 550 | add_ubiquity_kdedir() | ||
169 | 551 | log('start kwin') | ||
170 | 547 | wm = subprocess.Popen( | 552 | wm = subprocess.Popen( |
171 | 548 | 'kwin', stdin=null, stdout=logfile, stderr=logfile, | 553 | 'kwin', stdin=null, stdout=logfile, stderr=logfile, |
172 | 549 | preexec_fn=self.drop_privileges) | 554 | preexec_fn=self.drop_privileges) |
173 | 550 | 555 | ||
174 | 556 | log('start greeter') | ||
175 | 551 | greeter = subprocess.Popen( | 557 | greeter = subprocess.Popen( |
176 | 552 | program, stdin=null, stdout=logfile, stderr=logfile) | 558 | program, stdin=null, stdout=logfile, stderr=logfile) |
177 | 553 | ret = greeter.wait() | 559 | ret = greeter.wait() |
178 | 560 | log('greeter exited with code {}'.format(ret)) | ||
179 | 554 | 561 | ||
180 | 555 | reboot = False | 562 | reboot = False |
181 | 556 | if ret != 0: | 563 | if ret != 0: |
182 | @@ -649,7 +656,6 @@ | |||
183 | 649 | kill_if_exists(server.pid, signal.SIGTERM) | 656 | kill_if_exists(server.pid, signal.SIGTERM) |
184 | 650 | server.wait() | 657 | server.wait() |
185 | 651 | 658 | ||
186 | 652 | logfile.close() | ||
187 | 653 | null.close() | 659 | null.close() |
188 | 654 | 660 | ||
189 | 655 | if reboot: | 661 | if reboot: |
190 | @@ -660,18 +666,37 @@ | |||
191 | 660 | return 1 | 666 | return 1 |
192 | 661 | 667 | ||
193 | 662 | 668 | ||
209 | 663 | if len(sys.argv) < 4: | 669 | def run(vt, display, username): |
210 | 664 | sys.stderr.write('Usage: %s <vt[1-N]> <:[0-N]> <username> <program> ' | 670 | try: |
211 | 665 | '[<arguments>]\n' % sys.argv[0]) | 671 | dm = DM(vt, display, username) |
212 | 666 | sys.exit(1) | 672 | except XStartupError: |
213 | 667 | 673 | log("XStartupError") | |
214 | 668 | vt, display, username = sys.argv[1:4] | 674 | return 1 |
215 | 669 | try: | 675 | ret = dm.run(*sys.argv[4:]) |
216 | 670 | dm = DM(vt, display, username) | 676 | if ret == 0: |
217 | 671 | except XStartupError: | 677 | log("set_locale") |
218 | 672 | sys.exit(1) | 678 | set_locale() |
219 | 673 | ret = dm.run(*sys.argv[4:]) | 679 | dm.pam_close_session() |
220 | 674 | if ret == 0: | 680 | return ret |
221 | 675 | set_locale() | 681 | |
222 | 676 | dm.pam_close_session() | 682 | |
223 | 677 | sys.exit(ret) | 683 | def main(): |
224 | 684 | global logfile | ||
225 | 685 | |||
226 | 686 | if len(sys.argv) < 4: | ||
227 | 687 | sys.stderr.write('Usage: %s <vt[1-N]> <:[0-N]> <username> <program> ' | ||
228 | 688 | '[<arguments>]\n' % sys.argv[0]) | ||
229 | 689 | return 1 | ||
230 | 690 | vt, display, username = sys.argv[1:4] | ||
231 | 691 | |||
232 | 692 | logfile = open('/var/log/installer/dm', 'w') | ||
233 | 693 | try: | ||
234 | 694 | ret = run(vt, display, username) | ||
235 | 695 | log('Exiting with code {}'.format(ret)) | ||
236 | 696 | except Exception: | ||
237 | 697 | log('Failed with an exception:') | ||
238 | 698 | log(traceback.format_exc()) | ||
239 | 699 | return 1 | ||
240 | 700 | |||
241 | 701 | if __name__ == '__main__': | ||
242 | 702 | sys.exit(main()) | ||
243 | 678 | 703 | ||
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 | 1 | #!/usr/bin/python3 | ||
249 | 2 | |||
250 | 3 | ''' | ||
251 | 4 | Helper program to draw a background image on each screen of the system. | ||
252 | 5 | ''' | ||
253 | 6 | |||
254 | 7 | import sys | ||
255 | 8 | |||
256 | 9 | from PyQt4.QtCore import Qt | ||
257 | 10 | from PyQt4 import QtGui | ||
258 | 11 | |||
259 | 12 | |||
260 | 13 | def die(msg): | ||
261 | 14 | print(msg, file=sys.stderr) | ||
262 | 15 | sys.exit(1) | ||
263 | 16 | |||
264 | 17 | |||
265 | 18 | def create_window(wallpaper, geometry): | ||
266 | 19 | win = QtGui.QWidget() | ||
267 | 20 | |||
268 | 21 | wallpaper = wallpaper.scaled(geometry.size(), | ||
269 | 22 | Qt.KeepAspectRatioByExpanding, | ||
270 | 23 | Qt.SmoothTransformation) | ||
271 | 24 | palette = QtGui.QPalette() | ||
272 | 25 | palette.setBrush(win.backgroundRole(), QtGui.QBrush(wallpaper)) | ||
273 | 26 | |||
274 | 27 | win.setPalette(palette) | ||
275 | 28 | win.setAttribute(Qt.WA_X11NetWmWindowTypeDesktop) | ||
276 | 29 | win.setGeometry(geometry) | ||
277 | 30 | win.show() | ||
278 | 31 | return win | ||
279 | 32 | |||
280 | 33 | |||
281 | 34 | def main(): | ||
282 | 35 | if len(sys.argv) != 2: | ||
283 | 36 | die('usage: {} <path/to/wallpaper.png>'.format(sys.argv[0])) | ||
284 | 37 | path = sys.argv[1] | ||
285 | 38 | |||
286 | 39 | app = QtGui.QApplication(sys.argv) | ||
287 | 40 | wallpaper = QtGui.QPixmap(path) | ||
288 | 41 | if wallpaper.isNull(): | ||
289 | 42 | die('Failed to load {}'.format(path)) | ||
290 | 43 | |||
291 | 44 | desktop = app.desktop() | ||
292 | 45 | # Keep a trace of the windows to ensure they are not garbage collected | ||
293 | 46 | windows = [] | ||
294 | 47 | for idx in range(desktop.screenCount()): | ||
295 | 48 | geometry = desktop.screenGeometry(idx) | ||
296 | 49 | win = create_window(wallpaper, geometry) | ||
297 | 50 | windows.append(win) | ||
298 | 51 | |||
299 | 52 | return app.exec_() | ||
300 | 53 | |||
301 | 54 | |||
302 | 55 | if __name__ == '__main__': | ||
303 | 56 | main() | ||
304 | 0 | 57 | ||
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 | 1 | bin/ubiquity-qtsetbg usr/bin | ||
310 | 1 | data/ubiquity-kdeui.desktop usr/share/applications/kde4 | 2 | data/ubiquity-kdeui.desktop usr/share/applications/kde4 |
311 | 2 | gui/qt usr/share/ubiquity | 3 | gui/qt usr/share/ubiquity |
312 | 3 | ubiquity/frontend/kde* usr/lib/ubiquity/ubiquity/frontend | 4 | ubiquity/frontend/kde* usr/lib/ubiquity/ubiquity/frontend |
313 | 4 | 5 | ||
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 | 1 | This folder is used by ubiquity-dm to customize some of KDE settings. | ||
320 | 0 | 2 | ||
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 | 1 | # Disable all buttons but maximize/restore | ||
327 | 2 | [Style] | ||
328 | 3 | CustomButtonPositions=true | ||
329 | 4 | ButtonsOnLeft= | ||
330 | 5 | ButtonsOnRight=A | ||
331 | 0 | 6 | ||
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 | 180 | self.ui.content_widget.setVisible(False) | 180 | self.ui.content_widget.setVisible(False) |
337 | 181 | 181 | ||
338 | 182 | if 'UBIQUITY_GREETER' in os.environ: | 182 | if 'UBIQUITY_GREETER' in os.environ: |
341 | 183 | self.ui.setWindowState( | 183 | self.ui.setWindowFlags( |
342 | 184 | self.ui.windowState() ^ QtCore.Qt.WindowFullScreen) | 184 | QtCore.Qt.Dialog |
343 | 185 | | QtCore.Qt.CustomizeWindowHint | ||
344 | 186 | | QtCore.Qt.WindowTitleHint | ||
345 | 187 | ) | ||
346 | 185 | 188 | ||
347 | 186 | self.ui.setWizard(self) | 189 | self.ui.setWizard(self) |
348 | 187 | 190 |