Merge lp:~ralsina/ubuntuone-windows-installer/put-in-autostart into lp:ubuntuone-windows-installer
- put-in-autostart
- Merge into trunk
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Approved by: | Roberto Alsina | ||||||||
Approved revision: | 66 | ||||||||
Merged at revision: | 59 | ||||||||
Proposed branch: | lp:~ralsina/ubuntuone-windows-installer/put-in-autostart | ||||||||
Merge into: | lp:ubuntuone-windows-installer | ||||||||
Diff against target: |
393 lines (+200/-20) 9 files modified
data/qt/congratulations.ui (+44/-9) ubuntuone_installer/gui/qt/gui.py (+3/-0) ubuntuone_installer/gui/qt/setup_account.py (+11/-7) ubuntuone_installer/gui/qt/tests/test_gui.py (+12/-1) ubuntuone_installer/gui/qt/tests/test_setup_account.py (+10/-1) ubuntuone_installer/gui/qt/utils/__init__.py (+2/-0) ubuntuone_installer/gui/qt/utils/linux.py (+8/-0) ubuntuone_installer/gui/qt/utils/tests/test_windows.py (+83/-0) ubuntuone_installer/gui/qt/utils/windows.py (+27/-2) |
||||||||
To merge this branch: | bzr merge lp:~ralsina/ubuntuone-windows-installer/put-in-autostart | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Natalia Bidart (community) | Approve | ||
Review via email:
|
Commit message
* Adds a missing image to the final page of the wizard
* Adds syncdaemon to autostart
Description of the change
* Adds a missing image to the final page of the wizard
* Adds syncdaemon to autostart
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Roberto Alsina (ralsina) wrote : | # |
Most of those were a missing push, the last one only appears on Linux, so added a disable for it.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Leo Arias (elopio) wrote : | # |
Why did you kept the empty label?
+ <string/>
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Roberto Alsina (ralsina) wrote : | # |
> Why did you kept the empty label?
>
> + <string/>
There is probably going to be another branch to add an image there after design sees how this looks, and didn't want to make the diff grow more than what's needed.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Leo Arias (elopio) wrote : | # |
Good. I still don't understand the whole registry thing, but you have my full confidence and a symbolic +1. :)
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Natalia Bidart (nataliabidart) wrote : | # |
The branch looks good, but after testing IRL I'm not sure that syncdaemon was added to the startup. Roberto said he will do some more work on this.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Roberto Alsina (ralsina) wrote : | # |
The tests IRL don't work unless ubuntuone-
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Natalia Bidart (nataliabidart) wrote : | # |
Tested IRL with the beta2 bundle and works fine.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Natalia Bidart (nataliabidart) wrote : | # |
Oh, I just realized tests are broken:
Traceback (most recent call last):
File "/home/
self.
exceptions.
- 61. By Roberto Alsina
-
fix tests
- 62. By Roberto Alsina
-
pep8
- 63. By Roberto Alsina
-
cleaner fix for set_up_button noise.
- 64. By Roberto Alsina
-
added missing super call
- 65. By Roberto Alsina
-
ARGH
- 66. By Roberto Alsina
-
push
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Natalia Bidart (nataliabidart) wrote : | # |
Looks good!
Preview Diff
1 | === modified file 'data/qt/congratulations.ui' | |||
2 | --- data/qt/congratulations.ui 2011-09-02 12:58:29 +0000 | |||
3 | +++ data/qt/congratulations.ui 2011-09-12 19:52:24 +0000 | |||
4 | @@ -6,8 +6,8 @@ | |||
5 | 6 | <rect> | 6 | <rect> |
6 | 7 | <x>0</x> | 7 | <x>0</x> |
7 | 8 | <y>0</y> | 8 | <y>0</y> |
10 | 9 | <width>521</width> | 9 | <width>622</width> |
11 | 10 | <height>387</height> | 10 | <height>331</height> |
12 | 11 | </rect> | 11 | </rect> |
13 | 12 | </property> | 12 | </property> |
14 | 13 | <property name="windowTitle"> | 13 | <property name="windowTitle"> |
15 | @@ -35,11 +35,44 @@ | |||
16 | 35 | </widget> | 35 | </widget> |
17 | 36 | </item> | 36 | </item> |
18 | 37 | <item> | 37 | <item> |
24 | 38 | <widget class="QLabel" name="label_2"> | 38 | <layout class="QHBoxLayout" name="horizontalLayout_2"> |
25 | 39 | <property name="text"> | 39 | <item> |
26 | 40 | <string>Nice picture goes here</string> | 40 | <spacer name="horizontalSpacer"> |
27 | 41 | </property> | 41 | <property name="orientation"> |
28 | 42 | </widget> | 42 | <enum>Qt::Horizontal</enum> |
29 | 43 | </property> | ||
30 | 44 | <property name="sizeHint" stdset="0"> | ||
31 | 45 | <size> | ||
32 | 46 | <width>40</width> | ||
33 | 47 | <height>20</height> | ||
34 | 48 | </size> | ||
35 | 49 | </property> | ||
36 | 50 | </spacer> | ||
37 | 51 | </item> | ||
38 | 52 | <item> | ||
39 | 53 | <widget class="QLabel" name="label_2"> | ||
40 | 54 | <property name="text"> | ||
41 | 55 | <string/> | ||
42 | 56 | </property> | ||
43 | 57 | <property name="pixmap"> | ||
44 | 58 | <pixmap resource="images.qrc">:/win_installer_graphic.png</pixmap> | ||
45 | 59 | </property> | ||
46 | 60 | </widget> | ||
47 | 61 | </item> | ||
48 | 62 | <item> | ||
49 | 63 | <spacer name="horizontalSpacer_2"> | ||
50 | 64 | <property name="orientation"> | ||
51 | 65 | <enum>Qt::Horizontal</enum> | ||
52 | 66 | </property> | ||
53 | 67 | <property name="sizeHint" stdset="0"> | ||
54 | 68 | <size> | ||
55 | 69 | <width>40</width> | ||
56 | 70 | <height>20</height> | ||
57 | 71 | </size> | ||
58 | 72 | </property> | ||
59 | 73 | </spacer> | ||
60 | 74 | </item> | ||
61 | 75 | </layout> | ||
62 | 43 | </item> | 76 | </item> |
63 | 44 | <item> | 77 | <item> |
64 | 45 | <widget class="QLabel" name="label_3"> | 78 | <widget class="QLabel" name="label_3"> |
65 | @@ -60,7 +93,7 @@ | |||
66 | 60 | <item> | 93 | <item> |
67 | 61 | <widget class="QLabel" name="label_4"> | 94 | <widget class="QLabel" name="label_4"> |
68 | 62 | <property name="text"> | 95 | <property name="text"> |
70 | 63 | <string>IMAGE GOES HERE?</string> | 96 | <string/> |
71 | 64 | </property> | 97 | </property> |
72 | 65 | </widget> | 98 | </widget> |
73 | 66 | </item> | 99 | </item> |
74 | @@ -109,6 +142,8 @@ | |||
75 | 109 | </item> | 142 | </item> |
76 | 110 | </layout> | 143 | </layout> |
77 | 111 | </widget> | 144 | </widget> |
79 | 112 | <resources/> | 145 | <resources> |
80 | 146 | <include location="images.qrc"/> | ||
81 | 147 | </resources> | ||
82 | 113 | <connections/> | 148 | <connections/> |
83 | 114 | </ui> | 149 | </ui> |
84 | 115 | 150 | ||
85 | === modified file 'ubuntuone_installer/gui/qt/gui.py' | |||
86 | --- ubuntuone_installer/gui/qt/gui.py 2011-09-08 14:18:30 +0000 | |||
87 | +++ ubuntuone_installer/gui/qt/gui.py 2011-09-12 19:52:24 +0000 | |||
88 | @@ -243,6 +243,9 @@ | |||
89 | 243 | self.wizard().button(QtGui.QWizard.FinishButton).style().polish( | 243 | self.wizard().button(QtGui.QWizard.FinishButton).style().polish( |
90 | 244 | self.wizard().button(QtGui.QWizard.FinishButton)) | 244 | self.wizard().button(QtGui.QWizard.FinishButton)) |
91 | 245 | 245 | ||
92 | 246 | # Add syncdaemon to autostart | ||
93 | 247 | qt.utils.add_syncdaemon_to_autostart() | ||
94 | 248 | |||
95 | 246 | 249 | ||
96 | 247 | class MainWindow(QtGui.QWizard): | 250 | class MainWindow(QtGui.QWizard): |
97 | 248 | 251 | ||
98 | 249 | 252 | ||
99 | === modified file 'ubuntuone_installer/gui/qt/setup_account.py' | |||
100 | --- ubuntuone_installer/gui/qt/setup_account.py 2011-09-08 13:41:10 +0000 | |||
101 | +++ ubuntuone_installer/gui/qt/setup_account.py 2011-09-12 19:52:24 +0000 | |||
102 | @@ -178,25 +178,29 @@ | |||
103 | 178 | """Set set_up_button as default button when the page is shown.""" | 178 | """Set set_up_button as default button when the page is shown.""" |
104 | 179 | # This method should stays here because if we move it to initializePage | 179 | # This method should stays here because if we move it to initializePage |
105 | 180 | # set_up_button won't take the proper style for hover and press | 180 | # set_up_button won't take the proper style for hover and press |
112 | 181 | self.set_up_button.setVisible(True) | 181 | if self.set_up_button is not None: |
113 | 182 | self.set_up_button.setDefault(True) | 182 | self.set_up_button.setVisible(True) |
114 | 183 | if not self.set_up_button.isEnabled(): | 183 | self.set_up_button.setDefault(True) |
115 | 184 | self.set_up_button.setProperty("DisabledState", True) | 184 | if not self.set_up_button.isEnabled(): |
116 | 185 | self.set_up_button.style().unpolish(self.set_up_button) | 185 | self.set_up_button.setProperty("DisabledState", True) |
117 | 186 | self.set_up_button.style().polish(self.set_up_button) | 186 | self.set_up_button.style().unpolish(self.set_up_button) |
118 | 187 | self.set_up_button.style().polish(self.set_up_button) | ||
119 | 187 | self.connect(QtGui.QApplication.instance(), | 188 | self.connect(QtGui.QApplication.instance(), |
120 | 188 | QtCore.SIGNAL("focusChanged(QWidget*, QWidget*)"), | 189 | QtCore.SIGNAL("focusChanged(QWidget*, QWidget*)"), |
121 | 189 | self.focus_changed) | 190 | self.focus_changed) |
122 | 191 | super(SetupAccountPage, self).showEvent(event) | ||
123 | 190 | 192 | ||
124 | 191 | def hideEvent(self, event): | 193 | def hideEvent(self, event): |
125 | 192 | """Disconnect the focusChanged signal when the page change.""" | 194 | """Disconnect the focusChanged signal when the page change.""" |
127 | 193 | self.set_up_button.setVisible(False) | 195 | if self.set_up_button is not None: |
128 | 196 | self.set_up_button.setVisible(False) | ||
129 | 194 | try: | 197 | try: |
130 | 195 | self.disconnect(QtGui.QApplication.instance(), | 198 | self.disconnect(QtGui.QApplication.instance(), |
131 | 196 | QtCore.SIGNAL("focusChanged(QWidget*, QWidget*)"), | 199 | QtCore.SIGNAL("focusChanged(QWidget*, QWidget*)"), |
132 | 197 | self.focus_changed) | 200 | self.focus_changed) |
133 | 198 | except TypeError: | 201 | except TypeError: |
134 | 199 | pass | 202 | pass |
135 | 203 | super(SetupAccountPage, self).hideEvent(event) | ||
136 | 200 | 204 | ||
137 | 201 | 205 | ||
138 | 202 | def is_min_required_password(password): | 206 | def is_min_required_password(password): |
139 | 203 | 207 | ||
140 | === modified file 'ubuntuone_installer/gui/qt/tests/test_gui.py' | |||
141 | --- ubuntuone_installer/gui/qt/tests/test_gui.py 2011-09-12 18:18:54 +0000 | |||
142 | +++ ubuntuone_installer/gui/qt/tests/test_gui.py 2011-09-12 19:52:24 +0000 | |||
143 | @@ -30,7 +30,7 @@ | |||
144 | 30 | 30 | ||
145 | 31 | from ubuntuone_installer.gui import NEXT | 31 | from ubuntuone_installer.gui import NEXT |
146 | 32 | from ubuntuone_installer.gui.qt import gui, forgotten, utils | 32 | from ubuntuone_installer.gui.qt import gui, forgotten, utils |
148 | 33 | from ubuntuone_installer.gui.qt.tests import BaseTestCase | 33 | from ubuntuone_installer.gui.qt.tests import BaseTestCase, NO_OP |
149 | 34 | 34 | ||
150 | 35 | 35 | ||
151 | 36 | class FakeController(object): | 36 | class FakeController(object): |
152 | @@ -150,6 +150,7 @@ | |||
153 | 150 | self.patch(gui, "LocalFoldersPage", FakeLocalFoldersPage) | 150 | self.patch(gui, "LocalFoldersPage", FakeLocalFoldersPage) |
154 | 151 | self.patch(qt.preferences, "PreferencesPanel", FakePreferencesPanel) | 151 | self.patch(qt.preferences, "PreferencesPanel", FakePreferencesPanel) |
155 | 152 | self.patch(qt.folders, "FoldersPanel", FakeFoldersPanel) | 152 | self.patch(qt.folders, "FoldersPanel", FakeFoldersPanel) |
156 | 153 | self.patch(gui.qt.utils, "add_syncdaemon_to_autostart", NO_OP) | ||
157 | 153 | super(MainWindowTestCase, self).setUp() | 154 | super(MainWindowTestCase, self).setUp() |
158 | 154 | setup_page = self.ui.page(self.ui.setup_account_page_id) | 155 | setup_page = self.ui.page(self.ui.setup_account_page_id) |
159 | 155 | setup_page.initializePage() | 156 | setup_page.initializePage() |
160 | @@ -561,6 +562,16 @@ | |||
161 | 561 | QtCore.QCoreApplication.instance().processEvents() | 562 | QtCore.QCoreApplication.instance().processEvents() |
162 | 562 | self.assertEqual(self.ui.result(), self.ui.Rejected) | 563 | self.assertEqual(self.ui.result(), self.ui.Rejected) |
163 | 563 | 564 | ||
164 | 565 | def test_congratulations_adds_to_autostart(self): | ||
165 | 566 | """Test that syncdaemon is now on autostart.""" | ||
166 | 567 | self.patch(gui.qt.utils, "add_syncdaemon_to_autostart", | ||
167 | 568 | self._set_called) | ||
168 | 569 | # Show the Congratulations page | ||
169 | 570 | self.ui.setStartId(self.ui.CONGRATULATIONS_PAGE) | ||
170 | 571 | self.ui.restart() | ||
171 | 572 | # Check if syncdaemon was added to autostart | ||
172 | 573 | self.assertEqual(self._called, ((), {})) | ||
173 | 574 | |||
174 | 564 | 575 | ||
175 | 565 | class FakeSignal(object): | 576 | class FakeSignal(object): |
176 | 566 | 577 | ||
177 | 567 | 578 | ||
178 | === modified file 'ubuntuone_installer/gui/qt/tests/test_setup_account.py' | |||
179 | --- ubuntuone_installer/gui/qt/tests/test_setup_account.py 2011-09-07 14:15:39 +0000 | |||
180 | +++ ubuntuone_installer/gui/qt/tests/test_setup_account.py 2011-09-12 19:52:24 +0000 | |||
181 | @@ -229,7 +229,6 @@ | |||
182 | 229 | # so we don't rely on any SSO behaviour | 229 | # so we don't rely on any SSO behaviour |
183 | 230 | super(SetupAccountFakeWizardTestCase, self).setUp() | 230 | super(SetupAccountFakeWizardTestCase, self).setUp() |
184 | 231 | self.patch(self.ui, 'wizard', FakeWizard) | 231 | self.patch(self.ui, 'wizard', FakeWizard) |
185 | 232 | self.patch(self.ui, "set_up_button", QtGui.QPushButton()) | ||
186 | 233 | 232 | ||
187 | 234 | def test_blank_name(self): | 233 | def test_blank_name(self): |
188 | 235 | """Status when the name field is blank (spaces). | 234 | """Status when the name field is blank (spaces). |
189 | @@ -322,3 +321,13 @@ | |||
190 | 322 | self.addCleanup(self.ui.hide) | 321 | self.addCleanup(self.ui.hide) |
191 | 323 | self.ui.focus_changed(None, self.ui.ui.password_edit) | 322 | self.ui.focus_changed(None, self.ui.ui.password_edit) |
192 | 324 | self.assertTrue(self.ui.ui.password_assistance.isVisible()) | 323 | self.assertTrue(self.ui.ui.password_assistance.isVisible()) |
193 | 324 | |||
194 | 325 | def test_hide_event(self): | ||
195 | 326 | """Check that hide_event works when set_up_button is none.""" | ||
196 | 327 | self.assertEqual(self.ui.set_up_button, None) | ||
197 | 328 | self.ui.hideEvent(QtGui.QHideEvent()) | ||
198 | 329 | |||
199 | 330 | def test_show_event(self): | ||
200 | 331 | """Check that show_event works when set_up_button is none.""" | ||
201 | 332 | self.assertEqual(self.ui.set_up_button, None) | ||
202 | 333 | self.ui.showEvent(QtGui.QShowEvent()) | ||
203 | 325 | 334 | ||
204 | === modified file 'ubuntuone_installer/gui/qt/utils/__init__.py' | |||
205 | --- ubuntuone_installer/gui/qt/utils/__init__.py 2011-08-30 14:11:48 +0000 | |||
206 | +++ ubuntuone_installer/gui/qt/utils/__init__.py 2011-09-12 19:52:24 +0000 | |||
207 | @@ -26,9 +26,11 @@ | |||
208 | 26 | from ubuntuone_installer.gui.qt.utils import windows | 26 | from ubuntuone_installer.gui.qt.utils import windows |
209 | 27 | uninstall_application = windows.uninstall_application | 27 | uninstall_application = windows.uninstall_application |
210 | 28 | start_control_panel = windows.start_control_panel | 28 | start_control_panel = windows.start_control_panel |
211 | 29 | add_syncdaemon_to_autostart = windows.add_syncdaemon_to_autostart | ||
212 | 29 | default_folders = windows.default_folders | 30 | default_folders = windows.default_folders |
213 | 30 | else: | 31 | else: |
214 | 31 | from ubuntuone_installer.gui.qt.utils import linux | 32 | from ubuntuone_installer.gui.qt.utils import linux |
215 | 32 | uninstall_application = linux.uninstall_application | 33 | uninstall_application = linux.uninstall_application |
216 | 33 | start_control_panel = linux.start_control_panel | 34 | start_control_panel = linux.start_control_panel |
217 | 35 | add_syncdaemon_to_autostart = linux.add_syncdaemon_to_autostart | ||
218 | 34 | default_folders = linux.default_folders | 36 | default_folders = linux.default_folders |
219 | 35 | 37 | ||
220 | === modified file 'ubuntuone_installer/gui/qt/utils/linux.py' | |||
221 | --- ubuntuone_installer/gui/qt/utils/linux.py 2011-09-01 11:15:49 +0000 | |||
222 | +++ ubuntuone_installer/gui/qt/utils/linux.py 2011-09-12 19:52:24 +0000 | |||
223 | @@ -32,6 +32,14 @@ | |||
224 | 32 | subprocess.Popen(["ubuntuone-control-panel-qt", ]) | 32 | subprocess.Popen(["ubuntuone-control-panel-qt", ]) |
225 | 33 | 33 | ||
226 | 34 | 34 | ||
227 | 35 | def remove_syncdaemon_from_autostart(): | ||
228 | 36 | """Remove syncdaemon from the session's autostart.""" | ||
229 | 37 | |||
230 | 38 | |||
231 | 39 | def add_syncdaemon_to_autostart(): | ||
232 | 40 | """Add syncdaemon to the session's autostart.""" | ||
233 | 41 | |||
234 | 42 | |||
235 | 35 | def default_folders(): | 43 | def default_folders(): |
236 | 36 | """Return a list of the folders to add by default.""" | 44 | """Return a list of the folders to add by default.""" |
237 | 37 | # FIXME: this should be taken from ~/.config/user-dirs.dirs | 45 | # FIXME: this should be taken from ~/.config/user-dirs.dirs |
238 | 38 | 46 | ||
239 | === modified file 'ubuntuone_installer/gui/qt/utils/tests/test_windows.py' | |||
240 | --- ubuntuone_installer/gui/qt/utils/tests/test_windows.py 2011-09-01 18:25:44 +0000 | |||
241 | +++ ubuntuone_installer/gui/qt/utils/tests/test_windows.py 2011-09-12 19:52:24 +0000 | |||
242 | @@ -86,6 +86,89 @@ | |||
243 | 86 | self.assertTrue(0 == self._called[0][5]) | 86 | self.assertTrue(0 == self._called[0][5]) |
244 | 87 | 87 | ||
245 | 88 | 88 | ||
246 | 89 | class FakeRegistry(object): | ||
247 | 90 | """A fake registry.""" | ||
248 | 91 | # pylint: disable=C0103 | ||
249 | 92 | HKEY_CURRENT_USER = 2 | ||
250 | 93 | KEY_ALL_ACCESS = 4 | ||
251 | 94 | REG_SZ = 1 | ||
252 | 95 | |||
253 | 96 | def __init__(self): | ||
254 | 97 | self.HKEY_CURRENT_USER = 2 | ||
255 | 98 | self.KEY_ALL_ACCESS = 4 | ||
256 | 99 | self.connect_args = None | ||
257 | 100 | self.openkey_args = None | ||
258 | 101 | self.closekey_args = None | ||
259 | 102 | self.query_args = None | ||
260 | 103 | self.set_args = [] | ||
261 | 104 | |||
262 | 105 | def ConnectRegistry(self, *args, **kwargs): | ||
263 | 106 | """Fake ConnectRegistry.""" | ||
264 | 107 | self.connect_args = (args, kwargs) | ||
265 | 108 | return "REGISTRY" | ||
266 | 109 | |||
267 | 110 | def OpenKey(self, *args, **kwargs): | ||
268 | 111 | """Fake OpenKey.""" | ||
269 | 112 | self.openkey_args = (args, kwargs) | ||
270 | 113 | return "KEY" | ||
271 | 114 | |||
272 | 115 | def CloseKey(self, *args, **kwargs): | ||
273 | 116 | """Fake CloseKey.""" | ||
274 | 117 | self.closekey_args = (args, kwargs) | ||
275 | 118 | |||
276 | 119 | def QueryValueEx(self, *args, **kwargs): | ||
277 | 120 | """Fake QueryValueEx.""" | ||
278 | 121 | self.query_args = (args, kwargs) | ||
279 | 122 | |||
280 | 123 | def SetValueEx(self, *args, **kwargs): | ||
281 | 124 | """Fake SetValueEx.""" | ||
282 | 125 | self.set_args.append((args, kwargs)) | ||
283 | 126 | |||
284 | 127 | |||
285 | 128 | class AutostartTestCase(BaseTestCase): | ||
286 | 129 | """Test add_syncdaemon_to_autostart.""" | ||
287 | 130 | |||
288 | 131 | def setUp(self): | ||
289 | 132 | """Initialize this test instance.""" | ||
290 | 133 | self.registry = FakeRegistry() | ||
291 | 134 | self.patch(utils.windows, "_winreg", self.registry) | ||
292 | 135 | super(AutostartTestCase, self).setUp() | ||
293 | 136 | |||
294 | 137 | def test_add_syncdaemon_to_autostart(self): | ||
295 | 138 | """Check that the registry is updated correctly.""" | ||
296 | 139 | # I can't patch sys because frozen is not there by default | ||
297 | 140 | sys.frozen = True | ||
298 | 141 | |||
299 | 142 | def clean_frozen(): | ||
300 | 143 | """Remove sys.frozen.""" | ||
301 | 144 | del sys.frozen | ||
302 | 145 | |||
303 | 146 | self.addCleanup(clean_frozen) | ||
304 | 147 | utils.windows.add_syncdaemon_to_autostart() | ||
305 | 148 | self.assertEqual(self.registry.connect_args, | ||
306 | 149 | ((None, self.registry.HKEY_CURRENT_USER), {})) | ||
307 | 150 | self.assertEqual(self.registry.openkey_args, | ||
308 | 151 | (('REGISTRY', utils.windows.AUTORUN_KEY, 0, | ||
309 | 152 | self.registry.KEY_ALL_ACCESS), {})) | ||
310 | 153 | self.assertEqual(self.registry.closekey_args, (('KEY',), {})) | ||
311 | 154 | self.assertEqual(self.registry.query_args, None) | ||
312 | 155 | self.assertEqual(self.registry.set_args, | ||
313 | 156 | [(('KEY', 'Ubuntu One', 0, 1, | ||
314 | 157 | 'C:\\Python27\\ubuntuone-syncdaemon.exe'), {}), | ||
315 | 158 | (('KEY', 'Ubuntu One Icon', 0, 1, | ||
316 | 159 | 'C:\\Python27\\ubuntuone-control-panel-qt.exe --minimized'), | ||
317 | 160 | {})]) | ||
318 | 161 | |||
319 | 162 | def test_not_added_if_not_frozen(self): | ||
320 | 163 | """Not frozen binaries are not added to the registry.""" | ||
321 | 164 | utils.windows.add_syncdaemon_to_autostart() | ||
322 | 165 | self.assertEqual(self.registry.connect_args, None) | ||
323 | 166 | self.assertEqual(self.registry.openkey_args, None) | ||
324 | 167 | self.assertEqual(self.registry.closekey_args, None) | ||
325 | 168 | self.assertEqual(self.registry.query_args, None) | ||
326 | 169 | self.assertEqual(self.registry.set_args, []) | ||
327 | 170 | |||
328 | 171 | |||
329 | 89 | class DefaultFoldersTestCase(BaseTestCase): | 172 | class DefaultFoldersTestCase(BaseTestCase): |
330 | 90 | 173 | ||
331 | 91 | """Test the default suggested UDFs.""" | 174 | """Test the default suggested UDFs.""" |
332 | 92 | 175 | ||
333 | === modified file 'ubuntuone_installer/gui/qt/utils/windows.py' | |||
334 | --- ubuntuone_installer/gui/qt/utils/windows.py 2011-09-01 10:32:51 +0000 | |||
335 | +++ ubuntuone_installer/gui/qt/utils/windows.py 2011-09-12 19:52:24 +0000 | |||
336 | @@ -19,6 +19,7 @@ | |||
337 | 19 | """Utils Functions Windows specific.""" | 19 | """Utils Functions Windows specific.""" |
338 | 20 | 20 | ||
339 | 21 | 21 | ||
340 | 22 | import ctypes | ||
341 | 22 | import os | 23 | import os |
342 | 23 | import subprocess | 24 | import subprocess |
343 | 24 | import sys | 25 | import sys |
344 | @@ -26,8 +27,10 @@ | |||
345 | 26 | # Avoid pylint error on Linux | 27 | # Avoid pylint error on Linux |
346 | 27 | # pylint: disable=F0401 | 28 | # pylint: disable=F0401 |
347 | 28 | import win32api | 29 | import win32api |
348 | 30 | import _winreg | ||
349 | 29 | # pylint: enable=F0401 | 31 | # pylint: enable=F0401 |
351 | 30 | import ctypes | 32 | |
352 | 33 | AUTORUN_KEY = r"Software\Microsoft\Windows\CurrentVersion\Run" | ||
353 | 31 | 34 | ||
354 | 32 | 35 | ||
355 | 33 | def uninstall_application(): | 36 | def uninstall_application(): |
356 | @@ -48,7 +51,7 @@ | |||
357 | 48 | """Start the control panel.""" | 51 | """Start the control panel.""" |
358 | 49 | # If we are in windows and "frozen", assume it's in | 52 | # If we are in windows and "frozen", assume it's in |
359 | 50 | # the same folder as this .exe | 53 | # the same folder as this .exe |
361 | 51 | if sys.platform == "win32" and hasattr(sys, "frozen"): | 54 | if hasattr(sys, "frozen"): |
362 | 52 | cp_path = os.path.join(os.path.dirname( | 55 | cp_path = os.path.join(os.path.dirname( |
363 | 53 | os.path.abspath(sys.executable)), | 56 | os.path.abspath(sys.executable)), |
364 | 54 | "ubuntuone-control-panel-qt.exe") | 57 | "ubuntuone-control-panel-qt.exe") |
365 | @@ -57,6 +60,28 @@ | |||
366 | 57 | subprocess.Popen([cp_path, ]) | 60 | subprocess.Popen([cp_path, ]) |
367 | 58 | 61 | ||
368 | 59 | 62 | ||
369 | 63 | def add_syncdaemon_to_autostart(): | ||
370 | 64 | """Add syncdaemon to the session's autostart.""" | ||
371 | 65 | if hasattr(sys, "frozen"): | ||
372 | 66 | sd_path = os.path.join(os.path.dirname( | ||
373 | 67 | os.path.abspath(sys.executable)), | ||
374 | 68 | "ubuntuone-syncdaemon.exe") | ||
375 | 69 | u1cp_path = os.path.join(os.path.dirname( | ||
376 | 70 | os.path.abspath(sys.executable)), | ||
377 | 71 | "ubuntuone-control-panel-qt.exe") | ||
378 | 72 | else: | ||
379 | 73 | return | ||
380 | 74 | registry = _winreg.ConnectRegistry(None, _winreg.HKEY_CURRENT_USER) | ||
381 | 75 | key = _winreg.OpenKey(registry, | ||
382 | 76 | AUTORUN_KEY, | ||
383 | 77 | 0, _winreg.KEY_ALL_ACCESS) | ||
384 | 78 | # pylint: disable=E0602 | ||
385 | 79 | _winreg.SetValueEx(key, "Ubuntu One", 0, _winreg.REG_SZ, sd_path) | ||
386 | 80 | _winreg.SetValueEx(key, "Ubuntu One Icon", 0, _winreg.REG_SZ, | ||
387 | 81 | u1cp_path + " --minimized") | ||
388 | 82 | _winreg.CloseKey(key) | ||
389 | 83 | |||
390 | 84 | |||
391 | 60 | def default_folders(): | 85 | def default_folders(): |
392 | 61 | """Return a list of the folders to add by default.""" | 86 | """Return a list of the folders to add by default.""" |
393 | 62 | # XXXX to be replaced by calls to xdg_base_directory's | 87 | # XXXX to be replaced by calls to xdg_base_directory's |
ubuntuone_ installer/ gui/qt/ utils/tests/ test_windows. py: ConnectRegistry ] Invalid name "ConnectRegistry" (should match ([a-z_] [a-z0-9_ ]{2,79} $|setUp| tearDown) ) ConnectRegistry ] Missing docstring OpenKey] Invalid name "OpenKey" (should match ([a-z_] [a-z0-9_ ]{2,79} $|setUp| tearDown) ) OpenKey] Missing docstring CloseKey] Invalid name "CloseKey" (should match ([a-z_] [a-z0-9_ ]{2,79} $|setUp| tearDown) ) CloseKey] Missing docstring QueryValueEx] Invalid name "QueryValueEx" (should match ([a-z_] [a-z0-9_ ]{2,79} $|setUp| tearDown) ) QueryValueEx] Missing docstring QueryValueEx] Attribute 'query_args' defined outside __init__ OpenKey] Attribute 'openkey_args' defined outside __init__ CloseKey] Attribute 'closekey_args' defined outside __init__ ConnectRegistry ] Attribute 'connect_args' defined outside __init__
96: [C0301] Line too long (89/79)
97: [C0301] Line too long (148/79)
73: [C0103, FakeRegistry.
73: [C0111, FakeRegistry.
77: [C0103, FakeRegistry.
77: [C0111, FakeRegistry.
81: [C0103, FakeRegistry.
81: [C0111, FakeRegistry.
84: [C0103, FakeRegistry.
84: [C0111, FakeRegistry.
85: [W0201, FakeRegistry.
78: [W0201, FakeRegistry.
82: [W0201, FakeRegistry.
74: [W0201, FakeRegistry.
27: [W0611] Unused import _winreg
ubuntuone_ installer/ gui/qt/ utils/windows. py: to_autostart] Undefined variable 'WindowsError'
74: [C0301] Line too long (112/79)
78: [E0602, add_syncdaemon_