Merge lp:~thisfred/ubuntuone-control-panel/remove-urgency-on-focus into lp:ubuntuone-control-panel

Proposed by Eric Casteleijn
Status: Merged
Approved by: Eric Casteleijn
Approved revision: 127
Merged at revision: 130
Proposed branch: lp:~thisfred/ubuntuone-control-panel/remove-urgency-on-focus
Merge into: lp:ubuntuone-control-panel
Diff against target: 100 lines (+50/-1)
2 files modified
ubuntuone/controlpanel/gtk/gui.py (+18/-0)
ubuntuone/controlpanel/gtk/tests/test_gui_basic.py (+32/-1)
To merge this branch: bzr merge lp:~thisfred/ubuntuone-control-panel/remove-urgency-on-focus
Reviewer Review Type Date Requested Status
Alejandro J. Cura (community) Approve
Roberto Alsina (community) Approve
Review via email: mp+56250@code.launchpad.net

Commit message

Now that we set the launcher urgency from ubuntuone-client, the control panel needs to remove it when its window receives focus.

Description of the change

Now that we set the launcher urgency from ubuntuone-client, the control panel needs to remove it when its window receives focus.

To post a comment you must log in.
Revision history for this message
Roberto Alsina (ralsina) wrote :

+1

review: Approve
Revision history for this message
Alejandro J. Cura (alecu) wrote :

It seems that pylint (as used here) is not as smart about GI as pyflakes (as used in u1-client) so it spits this after running ./run-tests

E0611: 64: No name 'repository' in module 'gi'

review: Needs Fixing
Revision history for this message
Alejandro J. Cura (alecu) wrote :

After checking that pylint has been updated and that it's currently breaking a lot on our codebase, I'm approving this branch as it's unrelated to the pylint issue.

review: Approve
Revision history for this message
Natalia Bidart (nataliabidart) wrote :
Download full text (96.3 KiB)

The attempt to merge lp:~thisfred/ubuntuone-control-panel/remove-urgency-on-focus into lp:ubuntuone-control-panel failed. Below is the output from the failed tests.

Running test suite for ubuntuone/controlpanel
Xlib: extension "RANDR" missing on display ":99".
ubuntuone.controlpanel.gtk.tests
  BaseTestCase
    runTest ... [OK]
ubuntuone.controlpanel.gtk.tests.test_gui_basic
  ControlPanelMixinTestCase
    test_is_a_control_panel_mixin ... [OK]
    test_ui_can_be_created ... [OK]
  ControlPanelTestCase
    test_backend_is_shutdown_on_close ... [OK]
    test_credentials_found_connects_syncdaemon ... [OK]
    test_credentials_found_shows_dashboard_panel ... [OK]
    test_credentials_found_shows_services_panel ... [OK]
    test_is_a_notebook ... [OK]
    test_local_device_removed_shows_overview_panel ... [OK]
    test_main_window_is_passed_to_child ... [OK]
    test_on_show_management_panel ... [OK]
    test_on_show_management_panel_is_idempotent ... [OK]
    test_overview_is_shown_at_startup ... [OK]
    test_startup_props ... [OK]
    test_startup_visibility ... [OK]
  ControlPanelWindowAlertParamTestCase
    test_alert ... [OK]
  ControlPanelWindowInvalidParamsTestCase
    test_closing_stops_the_main_lopp ... [OK]
    test_control_panel_is_the_only_child ... [OK]
    test_focus_handler ... [OK]
    test_icon_name_is_correct ... [OK]
    test_is_a_window ... [OK]
    test_main_start_gtk_main_loop ... [OK]
    test_main_window_is_passed_to_child ... [OK]
    test_max_size ... [OK]
    test_startup_visibility ... [OK]
    test_switch_to ... [OK]
    test_title_is_correct ... [OK]
  ControlPanelWindowParamsNoneTestCase
    test_closing_stops_the_main_lopp ... [OK]
    test_control_panel_is_the_only_child ... [OK]
    test_focus_handler ... [OK]
    test_icon_name_is_correct ... [OK]
    test_is_a_window ... [OK]
    test_main_start_gtk_main_loop ... [OK]
    test_main_window_is_passed...

Revision history for this message
Natalia Bidart (nataliabidart) wrote :
Download full text (78.3 KiB)

The attempt to merge lp:~thisfred/ubuntuone-control-panel/remove-urgency-on-focus into lp:ubuntuone-control-panel failed. Below is the output from the failed tests.

Running test suite for ubuntuone/controlpanel
Xlib: extension "RANDR" missing on display ":99".
ubuntuone.controlpanel.gtk.tests
  BaseTestCase
    runTest ... [OK]
ubuntuone.controlpanel.gtk.tests.test_gui_basic
  ControlPanelMixinTestCase
    test_is_a_control_panel_mixin ... [OK]
    test_ui_can_be_created ... [OK]
  ControlPanelTestCase
    test_backend_is_shutdown_on_close ... [OK]
    test_credentials_found_connects_syncdaemon ... [OK]
    test_credentials_found_shows_dashboard_panel ... [OK]
    test_credentials_found_shows_services_panel ... [OK]
    test_is_a_notebook ... [OK]
    test_local_device_removed_shows_overview_panel ... [OK]
    test_main_window_is_passed_to_child ... [OK]
    test_on_show_management_panel ... [OK]
    test_on_show_management_panel_is_idempotent ... [OK]
    test_overview_is_shown_at_startup ... [OK]
    test_startup_props ... [OK]
    test_startup_visibility ... [OK]
    test_unauthorized_shows_overview_panel ... [OK]
  ControlPanelWindowAlertParamTestCase
    test_alert ... [OK]
  ControlPanelWindowInvalidParamsTestCase
    test_closing_stops_the_main_lopp ... [OK]
    test_control_panel_is_the_only_child ... [OK]
    test_focus_handler ... [OK]
    test_icon_name_is_correct ... [OK]
    test_is_a_window ... [OK]
    test_main_start_gtk_main_loop ... [OK]
    test_main_window_is_passed_to_child ... [OK]
    test_max_size ... [OK]
    test_startup_visibility ... [OK]
    test_switch_to ... [OK]
    test_title_is_correct ... [OK]
  ControlPanelWindowParamsNoneTestCase
    test_closing_stops_the_main_lopp ... [OK]
    test_control_panel_is_the_only_child ... [OK]
    test_focus_handler ... [OK]
    test_icon_name_is_correct ... [OK]
    test_is_a_window ... [OK]
    test_main_start_gtk_main_l...

126. By Eric Casteleijn

escape pylint craziness

127. By Eric Casteleijn

remerged trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone/controlpanel/gtk/gui.py'
2--- ubuntuone/controlpanel/gtk/gui.py 2011-04-07 13:58:58 +0000
3+++ ubuntuone/controlpanel/gtk/gui.py 2011-04-07 19:01:35 +0000
4@@ -60,6 +60,13 @@
5
6 from ubuntuone.controlpanel.gtk import package_manager, TRANSLATION_DOMAIN
7
8+try:
9+ from gi.repository import Unity # pylint: disable=E0611
10+ USE_LIBUNITY = True
11+ U1_DOTDESKTOP = "ubuntuone-control-panel-gtk.desktop"
12+except ImportError:
13+ USE_LIBUNITY = False
14+
15 logger = setup_logging('gtk.gui')
16 _ = gettext.gettext
17
18@@ -1686,6 +1693,8 @@
19
20 def __init__(self, switch_to='', alert=False):
21 super(ControlPanelWindow, self).__init__()
22+
23+ self.connect('focus-in-event', self.remove_urgency)
24 self.set_title(self.TITLE % {'app_name': U1_APP_NAME})
25 self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
26 self.set_icon_name('ubuntuone')
27@@ -1708,6 +1717,15 @@
28 logger.debug('%s: started (window size %r).',
29 self.__class__.__name__, self.get_size_request())
30
31+ def remove_urgency(self, *args, **kwargs):
32+ """Remove urgency from the launcher entry."""
33+ if not USE_LIBUNITY:
34+ return
35+ entry = Unity.LauncherEntry.get_for_desktop_id(U1_DOTDESKTOP)
36+ if entry.props.urgent:
37+ self.switch_to('volumes')
38+ entry.props.urgent = False
39+
40 def draw_attention(self):
41 """Draw attention to the control panel."""
42 self.present_with_time(1)
43
44=== modified file 'ubuntuone/controlpanel/gtk/tests/test_gui_basic.py'
45--- ubuntuone/controlpanel/gtk/tests/test_gui_basic.py 2011-04-06 21:05:37 +0000
46+++ ubuntuone/controlpanel/gtk/tests/test_gui_basic.py 2011-04-07 19:01:35 +0000
47@@ -29,6 +29,28 @@
48 # pylint: disable=W0201, W0212
49
50
51+class FakeLauncherEntryProps(object):
52+ """A fake Unity.LauncherEntry.props"""
53+
54+ urgent = True
55+
56+
57+THE_FLEP = FakeLauncherEntryProps()
58+
59+
60+class FakeLauncherEntry(object):
61+ """A fake Unity.LauncherEntry"""
62+
63+ def __init__(self):
64+ """Initialize this fake instance."""
65+ self.props = THE_FLEP
66+
67+ @staticmethod
68+ def get_for_desktop_id(dotdesktop):
69+ """Find the LauncherEntry for a given dotdesktop."""
70+ return FakeLauncherEntry()
71+
72+
73 class FakeControlPanelService(object):
74 """Fake service."""
75 def __init__(self, window):
76@@ -116,6 +138,15 @@
77 """Max size is not bigger than 736x525 (LP: #645526, LP: #683164)."""
78 self.assertTrue(self.ui.get_size_request() <= (736, 525))
79
80+ def test_focus_handler(self):
81+ """When the window receives focus, the handler is called."""
82+ THE_FLEP.urgent = True
83+ self.patch(gui.Unity, "LauncherEntry", FakeLauncherEntry)
84+ cp = gui.ControlPanelWindow()
85+ cp.emit('focus-in-event', None)
86+ self.assertEqual(
87+ False, THE_FLEP.urgent, 'remove_urgency should have been called.')
88+
89
90 class ControlPanelWindowAlertParamTestCase(BaseTestCase):
91 """The test suite for the control panel window when passing params."""
92@@ -131,7 +162,7 @@
93 def test_alert(self):
94 """Can pass a 'alert' parameter to draw attention to the window."""
95 self.assertEqual(
96- self._called, ((), {}), 'draw_attention was not called.')
97+ ((), {}), self._called, 'draw_attention should have been called.')
98
99
100 class ControlPanelWindowParamsTestCase(ControlPanelWindowTestCase):

Subscribers

People subscribed via source and target branches