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
=== modified file 'ubuntuone/controlpanel/gtk/gui.py'
--- ubuntuone/controlpanel/gtk/gui.py 2011-04-07 13:58:58 +0000
+++ ubuntuone/controlpanel/gtk/gui.py 2011-04-07 19:01:35 +0000
@@ -60,6 +60,13 @@
6060
61from ubuntuone.controlpanel.gtk import package_manager, TRANSLATION_DOMAIN61from ubuntuone.controlpanel.gtk import package_manager, TRANSLATION_DOMAIN
6262
63try:
64 from gi.repository import Unity # pylint: disable=E0611
65 USE_LIBUNITY = True
66 U1_DOTDESKTOP = "ubuntuone-control-panel-gtk.desktop"
67except ImportError:
68 USE_LIBUNITY = False
69
63logger = setup_logging('gtk.gui')70logger = setup_logging('gtk.gui')
64_ = gettext.gettext71_ = gettext.gettext
6572
@@ -1686,6 +1693,8 @@
16861693
1687 def __init__(self, switch_to='', alert=False):1694 def __init__(self, switch_to='', alert=False):
1688 super(ControlPanelWindow, self).__init__()1695 super(ControlPanelWindow, self).__init__()
1696
1697 self.connect('focus-in-event', self.remove_urgency)
1689 self.set_title(self.TITLE % {'app_name': U1_APP_NAME})1698 self.set_title(self.TITLE % {'app_name': U1_APP_NAME})
1690 self.set_position(gtk.WIN_POS_CENTER_ALWAYS)1699 self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
1691 self.set_icon_name('ubuntuone')1700 self.set_icon_name('ubuntuone')
@@ -1708,6 +1717,15 @@
1708 logger.debug('%s: started (window size %r).',1717 logger.debug('%s: started (window size %r).',
1709 self.__class__.__name__, self.get_size_request())1718 self.__class__.__name__, self.get_size_request())
17101719
1720 def remove_urgency(self, *args, **kwargs):
1721 """Remove urgency from the launcher entry."""
1722 if not USE_LIBUNITY:
1723 return
1724 entry = Unity.LauncherEntry.get_for_desktop_id(U1_DOTDESKTOP)
1725 if entry.props.urgent:
1726 self.switch_to('volumes')
1727 entry.props.urgent = False
1728
1711 def draw_attention(self):1729 def draw_attention(self):
1712 """Draw attention to the control panel."""1730 """Draw attention to the control panel."""
1713 self.present_with_time(1)1731 self.present_with_time(1)
17141732
=== modified file 'ubuntuone/controlpanel/gtk/tests/test_gui_basic.py'
--- ubuntuone/controlpanel/gtk/tests/test_gui_basic.py 2011-04-06 21:05:37 +0000
+++ ubuntuone/controlpanel/gtk/tests/test_gui_basic.py 2011-04-07 19:01:35 +0000
@@ -29,6 +29,28 @@
29# pylint: disable=W0201, W021229# pylint: disable=W0201, W0212
3030
3131
32class FakeLauncherEntryProps(object):
33 """A fake Unity.LauncherEntry.props"""
34
35 urgent = True
36
37
38THE_FLEP = FakeLauncherEntryProps()
39
40
41class FakeLauncherEntry(object):
42 """A fake Unity.LauncherEntry"""
43
44 def __init__(self):
45 """Initialize this fake instance."""
46 self.props = THE_FLEP
47
48 @staticmethod
49 def get_for_desktop_id(dotdesktop):
50 """Find the LauncherEntry for a given dotdesktop."""
51 return FakeLauncherEntry()
52
53
32class FakeControlPanelService(object):54class FakeControlPanelService(object):
33 """Fake service."""55 """Fake service."""
34 def __init__(self, window):56 def __init__(self, window):
@@ -116,6 +138,15 @@
116 """Max size is not bigger than 736x525 (LP: #645526, LP: #683164)."""138 """Max size is not bigger than 736x525 (LP: #645526, LP: #683164)."""
117 self.assertTrue(self.ui.get_size_request() <= (736, 525))139 self.assertTrue(self.ui.get_size_request() <= (736, 525))
118140
141 def test_focus_handler(self):
142 """When the window receives focus, the handler is called."""
143 THE_FLEP.urgent = True
144 self.patch(gui.Unity, "LauncherEntry", FakeLauncherEntry)
145 cp = gui.ControlPanelWindow()
146 cp.emit('focus-in-event', None)
147 self.assertEqual(
148 False, THE_FLEP.urgent, 'remove_urgency should have been called.')
149
119150
120class ControlPanelWindowAlertParamTestCase(BaseTestCase):151class ControlPanelWindowAlertParamTestCase(BaseTestCase):
121 """The test suite for the control panel window when passing params."""152 """The test suite for the control panel window when passing params."""
@@ -131,7 +162,7 @@
131 def test_alert(self):162 def test_alert(self):
132 """Can pass a 'alert' parameter to draw attention to the window."""163 """Can pass a 'alert' parameter to draw attention to the window."""
133 self.assertEqual(164 self.assertEqual(
134 self._called, ((), {}), 'draw_attention was not called.')165 ((), {}), self._called, 'draw_attention should have been called.')
135166
136167
137class ControlPanelWindowParamsTestCase(ControlPanelWindowTestCase):168class ControlPanelWindowParamsTestCase(ControlPanelWindowTestCase):

Subscribers

People subscribed via source and target branches