Merge lp:~gabor-karsay/awn-extras/various-fixes into lp:awn-extras
- various-fixes
- Merge into trunk
Status: | Merged | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Merged at revision: | 1395 | ||||||||||||||||||||
Proposed branch: | lp:~gabor-karsay/awn-extras/various-fixes | ||||||||||||||||||||
Merge into: | lp:awn-extras | ||||||||||||||||||||
Diff against target: |
292 lines (+67/-29) 2 files modified
applets/maintained/mail/mail.py (+30/-24) shared/python/awnlib.py (+37/-5) |
||||||||||||||||||||
To merge this branch: | bzr merge lp:~gabor-karsay/awn-extras/various-fixes | ||||||||||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
onox (community) | Approve | ||
Review via email: mp+35450@code.launchpad.net |
Commit message
Description of the change
onox, you have more experience in python, could you please have a look at this method before I add it to awnlib.py? Is it okay for you, e.g. description-wise? As you'll see, it tries to unlock the gnome keyring, with a little workaround though.
It fixes bug #581075, probably bug #549246. I don't know why, but it also fixes bug #610088 (the Gmail part).
btw, how do you decide which bugs are milestones?
Alberto Aldegheri (albyrock87) wrote : | # |
Gabor Karsay (gabor-karsay) wrote : | # |
You are right, that is a mistake. But in a test it works as it should, so I guess that the lock state is not updated and it uses the old one, updating soon.
- 1415. By Gabor Karsay
-
Fix logic mistake, thanks alberto
onox (onox) wrote : | # |
Gabor, it seems the linked bug reports on this page are different from those in your description. Could you fix this? Please try to avoid reusing some branch for different things. (It's good, however, that you use branches, allows people to review the code :)) Furthermore, about those bugs you described, set them to "Confirmed" once you can reproduce them. Their status still seems to be "New". Use "In Progress" if you're working on them.
About the milestones: some people set bugs to milestone 0.4.2 if the bug occurs in a previous version and will be fixed in 0.4.2. Personally I use 0.4.2 whenever the fix ends up in 0.4.2, this including bugs that were introduced in between 0.4.0 and 0.4.2 (0.4.1 / trunk)
About the code: I haven't tested it (because I don't (want) / can't use the mail applet) so I don't know whether the changes are functional correct. One thing you could do, however, is change def unlock to:
if not info.get_
return True
# here the indented code
return not info.get_
This way, the most important piece of code of the function is 1 indention less. One could argue it's a little big more readable.
Oh, and you could replace the url to "launchpad bug #432882"
onox (onox) wrote : | # |
And make sure the code is PEP8 compliant.
On Tue, Sep 14, 2010 at 10:47 PM, onox <email address hidden> wrote:
> Gabor, it seems the linked bug reports on this page are different from
> those in your description. Could you fix this? Please try to avoid reusing
> some branch for different things. (It's good, however, that you use
> branches, allows people to review the code :)) Furthermore, about those bugs
> you described, set them to "Confirmed" once you can reproduce them. Their
> status still seems to be "New". Use "In Progress" if you're working on them.
>
> About the milestones: some people set bugs to milestone 0.4.2 if the bug
> occurs in a previous version and will be fixed in 0.4.2. Personally I use
> 0.4.2 whenever the fix ends up in 0.4.2, this including bugs that were
> introduced in between 0.4.0 and 0.4.2 (0.4.1 / trunk)
>
> About the code: I haven't tested it (because I don't (want) / can't use the
> mail applet) so I don't know whether the changes are functional correct. One
> thing you could do, however, is change def unlock to:
>
> if not info.get_
> return True
>
> # here the indented code
>
> return not info.get_
>
> This way, the most important piece of code of the function is 1 indention
> less. One could argue it's a little big more readable.
> Oh, and you could replace the url to "launchpad bug #432882"
> --
>
> https:/
> You are requested to review the proposed merge of
> lp:~gabor-karsay/awn-extras/various-fixes into lp:awn-extras.
>
Alberto Aldegheri (albyrock87) wrote : | # |
Onox: can this help? http://
onox (onox) wrote : | # |
http://
On Tue, Sep 14, 2010 at 11:08 PM, Alberto
<<email address hidden>
> wrote:
> Onox: can this help? http://
> --
>
> https:/
> You are requested to review the proposed merge of
> lp:~gabor-karsay/awn-extras/various-fixes into lp:awn-extras.
>
onox (onox) wrote : | # |
@Gabor: see launchpad bug #432957. Seems related to this branch also.
On Tue, Sep 14, 2010 at 11:28 PM, onox <email address hidden> wrote:
> http://
>
> On Tue, Sep 14, 2010 at 11:08 PM, Alberto
> <<email address hidden> <albyrock87%<email address hidden>><
> albyrock87%<email address hidden> <albyrock87%<email address hidden>>>
> > wrote:
>
> > Onox: can this help? http://
> > --
> >
> >
> https:/
> > You are requested to review the proposed merge of
> > lp:~gabor-karsay/awn-extras/various-fixes into lp:awn-extras.
> >
>
> --
>
> https:/
> You are requested to review the proposed merge of
> lp:~gabor-karsay/awn-extras/various-fixes into lp:awn-extras.
>
- 1416. By Gabor Karsay
-
Change as reviewed by onox, make awnlib.py PEP 8 compliant
- 1417. By Gabor Karsay
-
Make mail.py PEP 8 compliant
Gabor Karsay (gabor-karsay) wrote : | # |
Thanks Alberto, thanks onox, applied all your suggestions. The code is tested and functional. I go ahead and commit it now.
onox (onox) : | # |
Preview Diff
1 | === modified file 'applets/maintained/mail/mail.py' | |||
2 | --- applets/maintained/mail/mail.py 2010-09-13 16:49:15 +0000 | |||
3 | +++ applets/maintained/mail/mail.py 2010-09-15 19:43:46 +0000 | |||
4 | @@ -83,7 +83,7 @@ | |||
5 | 83 | """ | 83 | """ |
6 | 84 | Login. Try to login from saved key, if this does not exist or | 84 | Login. Try to login from saved key, if this does not exist or |
7 | 85 | force is True, show login dialog | 85 | force is True, show login dialog |
9 | 86 | 86 | ||
10 | 87 | """ | 87 | """ |
11 | 88 | self.awn.theme.icon("login") | 88 | self.awn.theme.icon("login") |
12 | 89 | 89 | ||
13 | @@ -107,6 +107,9 @@ | |||
14 | 107 | 107 | ||
15 | 108 | key = self.awn.keyring.from_token(token) | 108 | key = self.awn.keyring.from_token(token) |
16 | 109 | 109 | ||
17 | 110 | if not self.awn.keyring.unlock(): | ||
18 | 111 | return self.login(True) | ||
19 | 112 | |||
20 | 110 | self.perform_login(key) | 113 | self.perform_login(key) |
21 | 111 | 114 | ||
22 | 112 | def logout(self): | 115 | def logout(self): |
23 | @@ -116,9 +119,8 @@ | |||
24 | 116 | self.awn.settings["login-token"] = 0 | 119 | self.awn.settings["login-token"] = 0 |
25 | 117 | 120 | ||
26 | 118 | def perform_login(self, key): | 121 | def perform_login(self, key): |
30 | 119 | # if key.token == 0: | 122 | if key.token == 0: |
31 | 120 | # self.__dialog.login_form(True, "Both username and password must be specified.") | 123 | return |
29 | 121 | # return | ||
32 | 122 | 124 | ||
33 | 123 | try: | 125 | try: |
34 | 124 | self.mail = self.back(key) # Login | 126 | self.mail = self.back(key) # Login |
35 | @@ -210,11 +212,11 @@ | |||
36 | 210 | 212 | ||
37 | 211 | """ | 213 | """ |
38 | 212 | states = { | 214 | states = { |
44 | 213 | "error" : "error", | 215 | "error": "error", |
45 | 214 | "login" : "login", | 216 | "login": "login", |
46 | 215 | "read" : "mail-read", | 217 | "read": "mail-read", |
47 | 216 | "unread": "mail-unread" | 218 | "unread": "mail-unread"} |
48 | 217 | } | 219 | |
49 | 218 | self.awn.theme.set_states(states) | 220 | self.awn.theme.set_states(states) |
50 | 219 | theme = self.awn.settings["theme"] if self.awn.settings["theme"] != system_theme_name else None | 221 | theme = self.awn.settings["theme"] if self.awn.settings["theme"] != system_theme_name else None |
51 | 220 | self.awn.theme.theme(theme) | 222 | self.awn.theme.theme(theme) |
52 | @@ -280,7 +282,7 @@ | |||
53 | 280 | def email_list(self): | 282 | def email_list(self): |
54 | 281 | """ | 283 | """ |
55 | 282 | Creates a dialog with mail subjects and 3-4 buttons | 284 | Creates a dialog with mail subjects and 3-4 buttons |
57 | 283 | 285 | ||
58 | 284 | """ | 286 | """ |
59 | 285 | self.__remove_current() | 287 | self.__remove_current() |
60 | 286 | self.__current_type = "email_list" | 288 | self.__current_type = "email_list" |
61 | @@ -301,7 +303,7 @@ | |||
62 | 301 | 303 | ||
63 | 302 | # This'll be the "show web interface" button | 304 | # This'll be the "show web interface" button |
64 | 303 | b = gtk.Button() | 305 | b = gtk.Button() |
66 | 304 | b.set_relief(gtk.RELIEF_NONE) # Found it; that's a relief | 306 | b.set_relief(gtk.RELIEF_NONE) # Found it; that's a relief |
67 | 305 | b.set_image(gtk.image_new_from_stock(gtk.STOCK_NETWORK, | 307 | b.set_image(gtk.image_new_from_stock(gtk.STOCK_NETWORK, |
68 | 306 | gtk.ICON_SIZE_BUTTON)) | 308 | gtk.ICON_SIZE_BUTTON)) |
69 | 307 | b.set_tooltip_text(_("Open Web Mail")) | 309 | b.set_tooltip_text(_("Open Web Mail")) |
70 | @@ -405,7 +407,7 @@ | |||
71 | 405 | def login_form(self, error=False, message=_("Wrong username or password")): | 407 | def login_form(self, error=False, message=_("Wrong username or password")): |
72 | 406 | """ | 408 | """ |
73 | 407 | Creates a dialog the login form | 409 | Creates a dialog the login form |
75 | 408 | 410 | ||
76 | 409 | """ | 411 | """ |
77 | 410 | self.__remove_current() | 412 | self.__remove_current() |
78 | 411 | self.__current_type = "login_form" | 413 | self.__current_type = "login_form" |
79 | @@ -473,6 +475,7 @@ | |||
80 | 473 | gtk.ICON_SIZE_BUTTON) | 475 | gtk.ICON_SIZE_BUTTON) |
81 | 474 | submit_button = gtk.Button(label=_("Log In"), use_underline=False) | 476 | submit_button = gtk.Button(label=_("Log In"), use_underline=False) |
82 | 475 | submit_button.set_image(image_login) | 477 | submit_button.set_image(image_login) |
83 | 478 | |||
84 | 476 | def onsubmit(widget): | 479 | def onsubmit(widget): |
85 | 477 | self.__parent.perform_login( | 480 | self.__parent.perform_login( |
86 | 478 | t["callback"](t["widgets"], self.__parent.awn)) | 481 | t["callback"](t["widgets"], self.__parent.awn)) |
87 | @@ -506,7 +509,7 @@ | |||
88 | 506 | 509 | ||
89 | 507 | def update(self): | 510 | def update(self): |
90 | 508 | 511 | ||
92 | 509 | if not self.key.attrs.has_key("username"): | 512 | if not "username" in self.key.attrs: |
93 | 510 | raise RuntimeError(_("Could not log in: No username")) | 513 | raise RuntimeError(_("Could not log in: No username")) |
94 | 511 | return | 514 | return |
95 | 512 | 515 | ||
96 | @@ -528,8 +531,8 @@ | |||
97 | 528 | self.subjects.append(i.title) | 531 | self.subjects.append(i.title) |
98 | 529 | 532 | ||
99 | 530 | def __cleanGmailSubject(self, n): | 533 | def __cleanGmailSubject(self, n): |
102 | 531 | n = re.sub(r"^[^>]*\\>", "", n) # "sadf\>fdas" -> "fdas" | 534 | n = re.sub(r"^[^>]*\\>", "", n) # "sadf\>fdas" -> "fdas" |
103 | 532 | n = re.sub(r"\\[^>]*\\>$", "", n) # "asdf\afdsasdf\>" -> "asdf" | 535 | n = re.sub(r"\\[^>]*\\>$", "", n) # "asdf\afdsasdf\>" -> "asdf" |
104 | 533 | n = n.replace(""", "\"") | 536 | n = n.replace(""", "\"") |
105 | 534 | n = n.replace("&", "&") | 537 | n = n.replace("&", "&") |
106 | 535 | n = n.replace(" ", "") | 538 | n = n.replace(" ", "") |
107 | @@ -543,7 +546,7 @@ | |||
108 | 543 | def __cleanMsg(self, n): | 546 | def __cleanMsg(self, n): |
109 | 544 | n = re.sub("\n\s*\n", "\n", n) | 547 | n = re.sub("\n\s*\n", "\n", n) |
110 | 545 | n = re.sub("&[#x(0x)]?\w*;", " ", n) | 548 | n = re.sub("&[#x(0x)]?\w*;", " ", n) |
112 | 546 | n = re.sub("\<[^\<\>]*?\>", "", n) # "<h>asdf<a></h>" -> "asdf" | 549 | n = re.sub("\<[^\<\>]*?\>", "", n) # "<h>asdf<a></h>" -> "asdf" |
113 | 547 | 550 | ||
114 | 548 | f = False | 551 | f = False |
115 | 549 | h = [] | 552 | h = [] |
116 | @@ -569,8 +572,8 @@ | |||
117 | 569 | 572 | ||
118 | 570 | def update(self): | 573 | def update(self): |
119 | 571 | 574 | ||
122 | 572 | if not self.key.attrs.has_key("username") or \ | 575 | if not "username" in self.key.attrs or \ |
123 | 573 | not self.key.attrs.has_key("domain"): | 576 | not "domain" in self.key.attrs: |
124 | 574 | raise RuntimeError(_("Could not log in: No username or domain")) | 577 | raise RuntimeError(_("Could not log in: No username or domain")) |
125 | 575 | return | 578 | return |
126 | 576 | 579 | ||
127 | @@ -593,8 +596,8 @@ | |||
128 | 593 | self.subjects.append(i.title) | 596 | self.subjects.append(i.title) |
129 | 594 | 597 | ||
130 | 595 | def __cleanGmailSubject(self, n): | 598 | def __cleanGmailSubject(self, n): |
133 | 596 | n = re.sub(r"^[^>]*\\>", "", n) # "sadf\>fdas" -> "fdas" | 599 | n = re.sub(r"^[^>]*\\>", "", n) # "sadf\>fdas" -> "fdas" |
134 | 597 | n = re.sub(r"\\[^>]*\\>$", "", n) # "asdf\afdsasdf\>" -> "asdf" | 600 | n = re.sub(r"\\[^>]*\\>$", "", n) # "asdf\afdsasdf\>" -> "asdf" |
135 | 598 | n = n.replace(""", "\"") | 601 | n = n.replace(""", "\"") |
136 | 599 | n = n.replace("&", "&") | 602 | n = n.replace("&", "&") |
137 | 600 | n = n.replace(" ", "") | 603 | n = n.replace(" ", "") |
138 | @@ -608,7 +611,7 @@ | |||
139 | 608 | def __cleanMsg(self, n): | 611 | def __cleanMsg(self, n): |
140 | 609 | n = re.sub("\n\s*\n", "\n", n) | 612 | n = re.sub("\n\s*\n", "\n", n) |
141 | 610 | n = re.sub("&[#x(0x)]?\w*;", " ", n) | 613 | n = re.sub("&[#x(0x)]?\w*;", " ", n) |
143 | 611 | n = re.sub("\<[^\<\>]*?\>", "", n) # "<h>asdf<a></h>" -> "asdf" | 614 | n = re.sub("\<[^\<\>]*?\>", "", n) # "<h>asdf<a></h>" -> "asdf" |
144 | 612 | 615 | ||
145 | 613 | f = False | 616 | f = False |
146 | 614 | h = [] | 617 | h = [] |
147 | @@ -653,6 +656,7 @@ | |||
148 | 653 | except: | 656 | except: |
149 | 654 | pass | 657 | pass |
150 | 655 | else: | 658 | else: |
151 | 659 | |||
152 | 656 | class UnixSpool: | 660 | class UnixSpool: |
153 | 657 | 661 | ||
154 | 658 | title = _("Unix Spool") | 662 | title = _("Unix Spool") |
155 | @@ -699,6 +703,7 @@ | |||
156 | 699 | except: | 703 | except: |
157 | 700 | pass | 704 | pass |
158 | 701 | else: | 705 | else: |
159 | 706 | |||
160 | 702 | class POP: | 707 | class POP: |
161 | 703 | 708 | ||
162 | 704 | title = "POP" | 709 | title = "POP" |
163 | @@ -715,7 +720,7 @@ | |||
164 | 715 | raise RuntimeError(_("Could not log in: ") + str(message)) | 720 | raise RuntimeError(_("Could not log in: ") + str(message)) |
165 | 716 | 721 | ||
166 | 717 | else: | 722 | else: |
168 | 718 | if not key.attrs.has_key("username"): | 723 | if not "username" in key.attrs: |
169 | 719 | raise RuntimeError(_("Could not log in: No username")) | 724 | raise RuntimeError(_("Could not log in: No username")) |
170 | 720 | self.server.user(key.attrs["username"]) | 725 | self.server.user(key.attrs["username"]) |
171 | 721 | try: | 726 | try: |
172 | @@ -787,6 +792,7 @@ | |||
173 | 787 | except: | 792 | except: |
174 | 788 | pass | 793 | pass |
175 | 789 | else: | 794 | else: |
176 | 795 | |||
177 | 790 | class IMAP: | 796 | class IMAP: |
178 | 791 | 797 | ||
179 | 792 | title = "IMAP" | 798 | title = "IMAP" |
180 | @@ -823,7 +829,7 @@ | |||
181 | 823 | s = self.server.fetch(i, '(BODY[HEADER.FIELDS (SUBJECT)])')[1][0] | 829 | s = self.server.fetch(i, '(BODY[HEADER.FIELDS (SUBJECT)])')[1][0] |
182 | 824 | 830 | ||
183 | 825 | if s is not None: | 831 | if s is not None: |
185 | 826 | self.subjects.append(s[1][9:].replace("\r\n", "\n").replace("\n", "")) # Don't ask | 832 | self.subjects.append(s[1][9:].replace("\r\n", "\n").replace("\n", "")) # Don't ask |
186 | 827 | else: | 833 | else: |
187 | 828 | mboxs = [re.search("(\W*) (\W*) (.*)", i).groups()[2] for i in self.server.list()[1]] | 834 | mboxs = [re.search("(\W*) (\W*) (.*)", i).groups()[2] for i in self.server.list()[1]] |
188 | 829 | mboxs = [i for i in mboxs if i not in ("Sent", "Trash") and i[:6] != "[Gmail]"] | 835 | mboxs = [i for i in mboxs if i not in ("Sent", "Trash") and i[:6] != "[Gmail]"] |
189 | @@ -843,7 +849,7 @@ | |||
190 | 843 | s = self.server.fetch(i, '(BODY[HEADER.FIELDS (SUBJECT)])')[1][0] | 849 | s = self.server.fetch(i, '(BODY[HEADER.FIELDS (SUBJECT)])')[1][0] |
191 | 844 | 850 | ||
192 | 845 | if s is not None: | 851 | if s is not None: |
194 | 846 | self.subjects.append(s[1][9:].replace("\r\n", "\n").replace("\n", "")) # Don't ask | 852 | self.subjects.append(s[1][9:].replace("\r\n", "\n").replace("\n", "")) # Don't ask |
195 | 847 | 853 | ||
196 | 848 | @classmethod | 854 | @classmethod |
197 | 849 | def drawLoginWindow(cls, *groups): | 855 | def drawLoginWindow(cls, *groups): |
198 | 850 | 856 | ||
199 | === modified file 'shared/python/awnlib.py' | |||
200 | --- shared/python/awnlib.py 2010-09-09 21:56:36 +0000 | |||
201 | +++ shared/python/awnlib.py 2010-09-15 19:43:46 +0000 | |||
202 | @@ -568,6 +568,7 @@ | |||
203 | 568 | 568 | ||
204 | 569 | def set_error_icon_and_click_to_restart(self): | 569 | def set_error_icon_and_click_to_restart(self): |
205 | 570 | self.__parent.icon.theme("dialog-error") | 570 | self.__parent.icon.theme("dialog-error") |
206 | 571 | |||
207 | 571 | def crash_applet(widget=None, event=None): | 572 | def crash_applet(widget=None, event=None): |
208 | 572 | gtk.main_quit() | 573 | gtk.main_quit() |
209 | 573 | self.__parent.connect("clicked", crash_applet) | 574 | self.__parent.connect("clicked", crash_applet) |
210 | @@ -594,7 +595,7 @@ | |||
211 | 594 | error_type = type(error).__name__ | 595 | error_type = type(error).__name__ |
212 | 595 | error = str(error) | 596 | error = str(error) |
213 | 596 | if traceback is not None: | 597 | if traceback is not None: |
215 | 597 | print "\n".join(["-"*80, traceback, "-"*80]) | 598 | print "\n".join(["-" * 80, traceback, "-" * 80]) |
216 | 598 | summary = "%s in %s: %s" % (error_type, self.__parent.meta["name"], error) | 599 | summary = "%s in %s: %s" % (error_type, self.__parent.meta["name"], error) |
217 | 599 | if self.__parent.meta["version"] == __version__: | 600 | if self.__parent.meta["version"] == __version__: |
218 | 600 | args["message"] = "Visit Launchpad and report the bug by following these steps:\n\n" \ | 601 | args["message"] = "Visit Launchpad and report the bug by following these steps:\n\n" \ |
219 | @@ -637,6 +638,7 @@ | |||
220 | 637 | copy_summary_button.connect("clicked", clicked_cb, summary) | 638 | copy_summary_button.connect("clicked", clicked_cb, summary) |
221 | 638 | 639 | ||
222 | 639 | if callable(callback): | 640 | if callable(callback): |
223 | 641 | |||
224 | 640 | def response_cb(widget, response): | 642 | def response_cb(widget, response): |
225 | 641 | if response < 0: | 643 | if response < 0: |
226 | 642 | callback() | 644 | callback() |
227 | @@ -782,7 +784,7 @@ | |||
228 | 782 | 784 | ||
229 | 783 | """ | 785 | """ |
230 | 784 | self.__config_object = None | 786 | self.__config_object = None |
232 | 785 | 787 | ||
233 | 786 | type_client = type(client) | 788 | type_client = type(client) |
234 | 787 | if client is None: | 789 | if client is None: |
235 | 788 | self.__client = awn.config_get_default(awn.PANEL_ID_DEFAULT) | 790 | self.__client = awn.config_get_default(awn.PANEL_ID_DEFAULT) |
236 | @@ -932,6 +934,33 @@ | |||
237 | 932 | k.token = token | 934 | k.token = token |
238 | 933 | return k | 935 | return k |
239 | 934 | 936 | ||
240 | 937 | def unlock(self): | ||
241 | 938 | """Unlock keyring. | ||
242 | 939 | |||
243 | 940 | @return: True if keyring is unlocked, False if locked. | ||
244 | 941 | |||
245 | 942 | """ | ||
246 | 943 | |||
247 | 944 | info = gnomekeyring.get_info_sync(None) | ||
248 | 945 | if not info.get_is_locked(): | ||
249 | 946 | return True | ||
250 | 947 | |||
251 | 948 | # The straight way would be: | ||
252 | 949 | # gnomekeyring.unlock_sync(None, None) | ||
253 | 950 | # But this results in a type error, see launchpad bugs #432882. | ||
254 | 951 | # We set a dummy key instead and delete it immediately, | ||
255 | 952 | # this triggers a user dialog to unlock the keyring. | ||
256 | 953 | try: | ||
257 | 954 | tmp = gnomekeyring.item_create_sync(None, \ | ||
258 | 955 | gnomekeyring.ITEM_GENERIC_SECRET, "awn-extras dummy", \ | ||
259 | 956 | {"dummy_attr": "none"}, "dummy_pwd", True) | ||
260 | 957 | except gnomekeyring.CancelledError: | ||
261 | 958 | return False | ||
262 | 959 | gnomekeyring.item_delete_sync(None, tmp) | ||
263 | 960 | |||
264 | 961 | info = gnomekeyring.get_info_sync(None) | ||
265 | 962 | return not info.get_is_locked() | ||
266 | 963 | |||
267 | 935 | class Key(object): | 964 | class Key(object): |
268 | 936 | 965 | ||
269 | 937 | def __init__(self, token=0): | 966 | def __init__(self, token=0): |
270 | @@ -966,8 +995,11 @@ | |||
271 | 966 | else: # Generic included | 995 | else: # Generic included |
272 | 967 | type = gnomekeyring.ITEM_GENERIC_SECRET | 996 | type = gnomekeyring.ITEM_GENERIC_SECRET |
273 | 968 | 997 | ||
276 | 969 | self.token = gnomekeyring.item_create_sync(None, type, name, \ | 998 | try: |
277 | 970 | attrs, pwd, True) | 999 | self.token = gnomekeyring.item_create_sync(None, type, name, \ |
278 | 1000 | attrs, pwd, True) | ||
279 | 1001 | except gnomekeyring.CancelledError: | ||
280 | 1002 | self.token = 0 | ||
281 | 971 | 1003 | ||
282 | 972 | def delete(self): | 1004 | def delete(self): |
283 | 973 | """Delete the current key. Will also reset the token. Note that | 1005 | """Delete the current key. Will also reset the token. Note that |
284 | @@ -1220,7 +1252,7 @@ | |||
285 | 1220 | self.__notification.set_timeout(timeout * 1000) | 1252 | self.__notification.set_timeout(timeout * 1000) |
286 | 1221 | 1253 | ||
287 | 1222 | def show(self): | 1254 | def show(self): |
289 | 1223 | self.__notification.show() | 1255 | self.__notification.show() |
290 | 1224 | 1256 | ||
291 | 1225 | 1257 | ||
292 | 1226 | class Meta: | 1258 | class Meta: |
Forgive me but I don't understand one thing in unlock() method:
- line 43: if "info.get_ is_locked( )" is False, it jumps to line 59 and returns <<True>> is_locked( )" is False, it returns <<False>>
- line 57: if "info.get_
Why?