Merge lp:~agateau/ubiquity/kde-no-fullscreen into lp:ubiquity

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
Reviewer Review Type Date Requested Status
Jonathan Riddell Pending
Review via email: mp+203105@code.launchpad.net

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
=== modified file 'bin/ubiquity-dm'
--- bin/ubiquity-dm 2013-12-17 18:08:56 +0000
+++ bin/ubiquity-dm 2014-01-31 14:04:22 +0000
@@ -11,6 +11,7 @@
11import signal11import signal
12import subprocess12import subprocess
13import sys13import sys
14import traceback
14import time15import time
1516
16import debconf17import debconf
@@ -25,6 +26,13 @@
25from ubiquity.misc import create_bool, utf826from ubiquity.misc import create_bool, utf8
2627
2728
29logfile = None
30
31
32def log(msg):
33 print('ubiquity-dm: ' + msg, file=logfile, flush=True)
34
35
28def _pam_conv(auth, query_list, userData):36def _pam_conv(auth, query_list, userData):
29 resp = []37 resp = []
30 for query, type in query_list:38 for query, type in query_list:
@@ -73,9 +81,13 @@
73 with open('/etc/locale.gen', 'w') as locale_gen:81 with open('/etc/locale.gen', 'w') as locale_gen:
74 print('%s UTF-8' % locale, file=locale_gen)82 print('%s UTF-8' % locale, file=locale_gen)
7583
76 with open('/var/log/installer/dm', 'a') as logfile:84 subprocess.call(['/usr/sbin/locale-gen', locale],
77 subprocess.call(['/usr/sbin/locale-gen', locale],85 stdout=logfile, stderr=logfile)
78 stdout=logfile, stderr=logfile)86
87
88def add_ubiquity_kdedir():
89 os.environ['KDEDIRS'] = '/usr/share/ubiquity/qt:' + \
90 os.environ.get('KDEDIRS', '')
7991
8092
81class XStartupError(EnvironmentError):93class XStartupError(EnvironmentError):
@@ -166,10 +178,9 @@
166 if '.' not in entry]178 if '.' not in entry]
167 for hookentry in hooks:179 for hookentry in hooks:
168 hook = os.path.join(hookdir, hookentry)180 hook = os.path.join(hookdir, hookentry)
169 with open('/var/log/installer/dm', 'a') as logfile:181 subprocess.call(
170 subprocess.call(182 hook, stdout=logfile, stderr=logfile,
171 hook, stdout=logfile, stderr=logfile,183 preexec_fn=self.drop_privileges)
172 preexec_fn=self.drop_privileges)
173184
174 def pam_open_session(self):185 def pam_open_session(self):
175 self.auth.start('su')186 self.auth.start('su')
@@ -206,7 +217,7 @@
206 # be happy if someone already created the path217 # be happy if someone already created the path
207 if e.errno != errno.EEXIST:218 if e.errno != errno.EEXIST:
208 raise219 raise
209 logfile = open('/var/log/installer/dm', 'w')220 log('starting')
210221
211 signal.signal(signal.SIGUSR1, self.sigusr1_handler)222 signal.signal(signal.SIGUSR1, self.sigusr1_handler)
212 signal.signal(signal.SIGTTIN, signal.SIG_IGN)223 signal.signal(signal.SIGTTIN, signal.SIG_IGN)
@@ -214,6 +225,7 @@
214225
215 servercommand = ['X', '-br', '-ac', '-noreset', '-nolisten', 'tcp']226 servercommand = ['X', '-br', '-ac', '-noreset', '-nolisten', 'tcp']
216227
228 log('plymouth')
217 try:229 try:
218 plymouth_running = subprocess.call(['plymouth', '--ping']) == 0230 plymouth_running = subprocess.call(['plymouth', '--ping']) == 0
219 except OSError:231 except OSError:
@@ -229,6 +241,7 @@
229241
230 servercommand.extend([self.vt, self.display])242 servercommand.extend([self.vt, self.display])
231243
244 log('start X {}'.format(servercommand))
232 for attempt in ('main', 'fbdev', 'vesa'):245 for attempt in ('main', 'fbdev', 'vesa'):
233 command = list(servercommand)246 command = list(servercommand)
234 if attempt == 'main' and self.force_failsafe:247 if attempt == 'main' and self.force_failsafe:
@@ -298,6 +311,7 @@
298 if self.server_started:311 if self.server_started:
299 break312 break
300313
314 log('set vars')
301 os.environ['DISPLAY'] = self.display315 os.environ['DISPLAY'] = self.display
302 os.environ['HOME'] = self.homedir316 os.environ['HOME'] = self.homedir
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.
@@ -306,19 +320,23 @@
306 # Overlay scrollbars are now a gtk module320 # Overlay scrollbars are now a gtk module
307 os.environ['GTK_MODULES'] = 'overlay-scrollbar'321 os.environ['GTK_MODULES'] = 'overlay-scrollbar'
308322
323 log('pam_open_session')
309 self.pam_open_session()324 self.pam_open_session()
310325
311 # run simple, custom scripts during install time326 # run simple, custom scripts during install time
312 if program_basename == 'ubiquity':327 if program_basename == 'ubiquity':
328 log('dm-scripts')
313 self.run_hooks('/usr/lib/ubiquity/dm-scripts/install')329 self.run_hooks('/usr/lib/ubiquity/dm-scripts/install')
314330
315 # run simple, custom scripts during oem-config331 # run simple, custom scripts during oem-config
316 if program_basename == 'oem-config-wrapper':332 if program_basename == 'oem-config-wrapper':
333 log('oem dm-scripts')
317 self.run_hooks('/usr/lib/ubiquity/dm-scripts/oem')334 self.run_hooks('/usr/lib/ubiquity/dm-scripts/oem')
318335
319 # Session bus, apparently needed by most interfaces now336 # Session bus, apparently needed by most interfaces now
320 if ('DBUS_SESSION_BUS_ADDRESS' not in os.environ and337 if ('DBUS_SESSION_BUS_ADDRESS' not in os.environ and
321 osextras.find_on_path('dbus-launch')):338 osextras.find_on_path('dbus-launch')):
339 log('dbus')
322 dbus_subp = subprocess.Popen(340 dbus_subp = subprocess.Popen(
323 ['dbus-launch', '--exit-with-session'],341 ['dbus-launch', '--exit-with-session'],
324 stdin=null, stdout=subprocess.PIPE, stderr=logfile,342 stdin=null, stdout=subprocess.PIPE, stderr=logfile,
@@ -334,6 +352,7 @@
334352
335 # dconf writer353 # dconf writer
336 if os.path.exists("/usr/lib/dconf/dconf-service"):354 if os.path.exists("/usr/lib/dconf/dconf-service"):
355 log('dconf-service')
337 extras.append(subprocess.Popen(356 extras.append(subprocess.Popen(
338 ['/usr/lib/dconf/dconf-service'],357 ['/usr/lib/dconf/dconf-service'],
339 stdin=null, stdout=logfile, stderr=logfile,358 stdin=null, stdout=logfile, stderr=logfile,
@@ -344,6 +363,7 @@
344 with open('/proc/cmdline', 'r') as fp:363 with open('/proc/cmdline', 'r') as fp:
345 proc_cmdline = fp.readline().split()364 proc_cmdline = fp.readline().split()
346365
366 log('start frontend {}'.format(self.frontend))
347 if self.frontend == 'gtk_ui':367 if self.frontend == 'gtk_ui':
348 # Set a desktop wallpaper.368 # Set a desktop wallpaper.
349 visual_a11y = 'access=v' in proc_cmdline369 visual_a11y = 'access=v' in proc_cmdline
@@ -518,39 +538,26 @@
518 stdin=null, stdout=logfile, stderr=logfile,538 stdin=null, stdout=logfile, stderr=logfile,
519 preexec_fn=self.drop_privileges))539 preexec_fn=self.drop_privileges))
520 elif self.frontend == 'kde_ui':540 elif self.frontend == 'kde_ui':
521 # Don't show the background image in v1 accessibility profile.541 if not 'access=v1' in proc_cmdline:
522 os.setegid(self.gid)542 log('paint background')
523 os.seteuid(self.uid)543 path = '/usr/share/wallpapers/kde-default.png'
524 path = '/usr/share/wallpapers/kde-default.png'544 extras.append(subprocess.Popen(
525 if (os.access(path, os.R_OK) and not 'access=v1' in proc_cmdline):545 ['ubiquity-qtsetbg', path],
526 # Draw a background image for the install progress window.546 stdin=null, stdout=logfile, stderr=logfile,
527 from PyQt4.QtCore import Qt547 preexec_fn=self.drop_privileges))
528 from PyQt4 import QtGui
529 a = QtGui.QApplication(sys.argv)
530 root_win = a.desktop()
531 wallpaper = QtGui.QPixmap(path)
532 wallpaper = wallpaper.scaled(
533 root_win.width(), root_win.height(),
534 Qt.KeepAspectRatioByExpanding, Qt.SmoothTransformation)
535 palette = QtGui.QPalette()
536 palette.setBrush(root_win.backgroundRole(),
537 QtGui.QBrush(wallpaper))
538 root_win.setPalette(palette)
539 root_win.setCursor(Qt.ArrowCursor)
540 a.processEvents()
541 # Force garbage collection so we don't end up with stray X
542 # resources when we kill the X server (LP: #556555).
543 del a
544 os.seteuid(0)
545 os.setegid(0)
546548
549 log("add_ubiquity_kdedir")
550 add_ubiquity_kdedir()
551 log('start kwin')
547 wm = subprocess.Popen(552 wm = subprocess.Popen(
548 'kwin', stdin=null, stdout=logfile, stderr=logfile,553 'kwin', stdin=null, stdout=logfile, stderr=logfile,
549 preexec_fn=self.drop_privileges)554 preexec_fn=self.drop_privileges)
550555
556 log('start greeter')
551 greeter = subprocess.Popen(557 greeter = subprocess.Popen(
552 program, stdin=null, stdout=logfile, stderr=logfile)558 program, stdin=null, stdout=logfile, stderr=logfile)
553 ret = greeter.wait()559 ret = greeter.wait()
560 log('greeter exited with code {}'.format(ret))
554561
555 reboot = False562 reboot = False
556 if ret != 0:563 if ret != 0:
@@ -649,7 +656,6 @@
649 kill_if_exists(server.pid, signal.SIGTERM)656 kill_if_exists(server.pid, signal.SIGTERM)
650 server.wait()657 server.wait()
651658
652 logfile.close()
653 null.close()659 null.close()
654660
655 if reboot:661 if reboot:
@@ -660,18 +666,37 @@
660 return 1666 return 1
661667
662668
663if len(sys.argv) < 4:669def run(vt, display, username):
664 sys.stderr.write('Usage: %s <vt[1-N]> <:[0-N]> <username> <program> '670 try:
665 '[<arguments>]\n' % sys.argv[0])671 dm = DM(vt, display, username)
666 sys.exit(1)672 except XStartupError:
667673 log("XStartupError")
668vt, display, username = sys.argv[1:4]674 return 1
669try:675 ret = dm.run(*sys.argv[4:])
670 dm = DM(vt, display, username)676 if ret == 0:
671except XStartupError:677 log("set_locale")
672 sys.exit(1)678 set_locale()
673ret = dm.run(*sys.argv[4:])679 dm.pam_close_session()
674if ret == 0:680 return ret
675 set_locale()681
676dm.pam_close_session()682
677sys.exit(ret)683def main():
684 global logfile
685
686 if len(sys.argv) < 4:
687 sys.stderr.write('Usage: %s <vt[1-N]> <:[0-N]> <username> <program> '
688 '[<arguments>]\n' % sys.argv[0])
689 return 1
690 vt, display, username = sys.argv[1:4]
691
692 logfile = open('/var/log/installer/dm', 'w')
693 try:
694 ret = run(vt, display, username)
695 log('Exiting with code {}'.format(ret))
696 except Exception:
697 log('Failed with an exception:')
698 log(traceback.format_exc())
699 return 1
700
701if __name__ == '__main__':
702 sys.exit(main())
678703
=== added file 'bin/ubiquity-qtsetbg'
--- bin/ubiquity-qtsetbg 1970-01-01 00:00:00 +0000
+++ bin/ubiquity-qtsetbg 2014-01-31 14:04:22 +0000
@@ -0,0 +1,56 @@
1#!/usr/bin/python3
2
3'''
4Helper program to draw a background image on each screen of the system.
5'''
6
7import sys
8
9from PyQt4.QtCore import Qt
10from PyQt4 import QtGui
11
12
13def die(msg):
14 print(msg, file=sys.stderr)
15 sys.exit(1)
16
17
18def create_window(wallpaper, geometry):
19 win = QtGui.QWidget()
20
21 wallpaper = wallpaper.scaled(geometry.size(),
22 Qt.KeepAspectRatioByExpanding,
23 Qt.SmoothTransformation)
24 palette = QtGui.QPalette()
25 palette.setBrush(win.backgroundRole(), QtGui.QBrush(wallpaper))
26
27 win.setPalette(palette)
28 win.setAttribute(Qt.WA_X11NetWmWindowTypeDesktop)
29 win.setGeometry(geometry)
30 win.show()
31 return win
32
33
34def main():
35 if len(sys.argv) != 2:
36 die('usage: {} <path/to/wallpaper.png>'.format(sys.argv[0]))
37 path = sys.argv[1]
38
39 app = QtGui.QApplication(sys.argv)
40 wallpaper = QtGui.QPixmap(path)
41 if wallpaper.isNull():
42 die('Failed to load {}'.format(path))
43
44 desktop = app.desktop()
45 # Keep a trace of the windows to ensure they are not garbage collected
46 windows = []
47 for idx in range(desktop.screenCount()):
48 geometry = desktop.screenGeometry(idx)
49 win = create_window(wallpaper, geometry)
50 windows.append(win)
51
52 return app.exec_()
53
54
55if __name__ == '__main__':
56 main()
057
=== modified file 'debian/ubiquity-frontend-kde.install'
--- debian/ubiquity-frontend-kde.install 2013-07-11 18:23:07 +0000
+++ debian/ubiquity-frontend-kde.install 2014-01-31 14:04:22 +0000
@@ -1,3 +1,4 @@
1bin/ubiquity-qtsetbg usr/bin
1data/ubiquity-kdeui.desktop usr/share/applications/kde42data/ubiquity-kdeui.desktop usr/share/applications/kde4
2gui/qt usr/share/ubiquity3gui/qt usr/share/ubiquity
3ubiquity/frontend/kde* usr/lib/ubiquity/ubiquity/frontend4ubiquity/frontend/kde* usr/lib/ubiquity/ubiquity/frontend
45
=== added directory 'gui/qt/share'
=== added file 'gui/qt/share/README'
--- gui/qt/share/README 1970-01-01 00:00:00 +0000
+++ gui/qt/share/README 2014-01-31 14:04:22 +0000
@@ -0,0 +1,1 @@
1This folder is used by ubiquity-dm to customize some of KDE settings.
02
=== added directory 'gui/qt/share/config'
=== added file 'gui/qt/share/config/kwinrc'
--- gui/qt/share/config/kwinrc 1970-01-01 00:00:00 +0000
+++ gui/qt/share/config/kwinrc 2014-01-31 14:04:22 +0000
@@ -0,0 +1,5 @@
1# Disable all buttons but maximize/restore
2[Style]
3CustomButtonPositions=true
4ButtonsOnLeft=
5ButtonsOnRight=A
06
=== modified file 'ubiquity/frontend/kde_ui.py'
--- ubiquity/frontend/kde_ui.py 2013-12-11 15:05:41 +0000
+++ ubiquity/frontend/kde_ui.py 2014-01-31 14:04:22 +0000
@@ -180,8 +180,11 @@
180 self.ui.content_widget.setVisible(False)180 self.ui.content_widget.setVisible(False)
181181
182 if 'UBIQUITY_GREETER' in os.environ:182 if 'UBIQUITY_GREETER' in os.environ:
183 self.ui.setWindowState(183 self.ui.setWindowFlags(
184 self.ui.windowState() ^ QtCore.Qt.WindowFullScreen)184 QtCore.Qt.Dialog
185 | QtCore.Qt.CustomizeWindowHint
186 | QtCore.Qt.WindowTitleHint
187 )
185188
186 self.ui.setWizard(self)189 self.ui.setWizard(self)
187190

Subscribers

People subscribed via source and target branches

to status/vote changes: