Merge lp:~michael-sheldon/jokosher/freesound-improvements into lp:jokosher

Proposed by Michael Sheldon
Status: Merged
Merged at revision: not available
Proposed branch: lp:~michael-sheldon/jokosher/freesound-improvements
Merge into: lp:jokosher
Diff against target: None lines
To merge this branch: bzr merge lp:~michael-sheldon/jokosher/freesound-improvements
Reviewer Review Type Date Requested Status
Jokosher Code Pending
Review via email: mp+7189@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Fixes drag and drop creation of instruments, makes the usage message clearer and more permanent and uses gnome-keyring for storing passwords where available.

1099. By Michael Sheldon

Update FreeSound extenion to glade 3
Add LinkButton for creating new FreeSound accounts

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Jokosher/Project.py'
2--- Jokosher/Project.py 2009-05-29 01:23:25 +0000
3+++ Jokosher/Project.py 2009-06-08 12:42:25 +0000
4@@ -1320,7 +1320,13 @@
5 if not undoAction:
6 undoAction = self.NewAtomicUndoAction()
7
8- uris = [PlatformUtils.pathname2url(filename) for filename in fileList]
9+ uris = []
10+ for filename in fileList:
11+ if filename.find("://"):
12+ uris.append(filename)
13+ else:
14+ # We've been passed a path, so convert it to a URI
15+ uris.append(PlatformUtils.pathname2url(filename))
16
17 name, type, pixbuf, path = [x for x in Globals.getCachedInstruments() if x[1] == "audiofile"][0]
18 instr = self.AddInstrument(name, type, _undoAction_=undoAction)
19
20=== modified file 'extensions/FreesoundSearch-0.3-py2.6.egg'
21Binary files extensions/FreesoundSearch-0.3-py2.6.egg 2009-05-29 23:03:59 +0000 and extensions/FreesoundSearch-0.3-py2.6.egg 2009-06-08 12:42:25 +0000 differ
22=== modified file 'extensions/eggs/FreesoundSearch/src/FreesoundSearch.glade'
23--- extensions/eggs/FreesoundSearch/src/FreesoundSearch.glade 2009-05-29 23:03:59 +0000
24+++ extensions/eggs/FreesoundSearch/src/FreesoundSearch.glade 2009-06-08 11:45:11 +0000
25@@ -72,9 +72,11 @@
26 <child>
27 <widget class="GtkLabel" id="label1">
28 <property name="visible">True</property>
29- <property name="label" translatable="yes">Search the Freesound library samples</property>
30+ <property name="label" translatable="yes">Search the Freesound library samples.
31+
32+&lt;b&gt;Drag and drop&lt;/b&gt; samples on to your project to add them.</property>
33 <property name="use_underline">False</property>
34- <property name="use_markup">False</property>
35+ <property name="use_markup">True</property>
36 <property name="justify">GTK_JUSTIFY_LEFT</property>
37 <property name="wrap">False</property>
38 <property name="selectable">False</property>
39
40=== modified file 'extensions/eggs/FreesoundSearch/src/FreesoundSearch.py'
41--- extensions/eggs/FreesoundSearch/src/FreesoundSearch.py 2009-05-29 23:03:59 +0000
42+++ extensions/eggs/FreesoundSearch/src/FreesoundSearch.py 2009-06-08 12:07:25 +0000
43@@ -18,6 +18,12 @@
44 import freesound
45 import pkg_resources
46
47+try:
48+ import gnomekeyring as gkey
49+ keyring = True
50+except:
51+ keyring = False
52+
53 import gettext
54 _ = gettext.gettext
55
56@@ -36,7 +42,7 @@
57
58 # necessary extension attributes
59 EXTENSION_NAME = _("Freesound search")
60- EXTENSION_VERSION = "0.3"
61+ EXTENSION_VERSION = "0.4"
62 EXTENSION_DESCRIPTION = _("Searches the Freesound library of freely" + \
63 " licenceable and useable sound clips")
64
65@@ -161,7 +167,6 @@
66 self.scrollResults.add_with_viewport(self.vboxResults)
67 self.api.set_window_icon(self.window)
68 self.imageHeader.set_from_file(pkg_resources.resource_filename(__name__, "images/banner.png"))
69- self.statusbar.push(0, _("Tip: To add a sample to your project, drag and drop it into the recording view"))
70
71 self.window.show_all()
72
73@@ -363,12 +368,24 @@
74 self.buttonOK.set_flags(gtk.CAN_DEFAULT)
75 self.buttonOK.grab_default()
76 self.api.set_window_icon(self.loginWindow)
77+
78+ # set the entry text to the saved values
79+ username = self.api.get_config_value("fsUsername")
80+ if username is not None and keyring:
81+ password = None
82+ try:
83+ items = gkey.find_items_sync(gkey.ITEM_NETWORK_PASSWORD, {"username" : username})
84+ if len(items) > 0:
85+ password = items[0].secret
86+ except gkey.DeniedError, gkey.NoMatchError:
87+ pass
88+ else:
89+ password = self.api.get_config_value("fsPassword")
90
91- # set the entries's text to the saved values
92- if self.api.get_config_value("fsUsername") is not None:
93- self.entryUsername.set_text(self.api.get_config_value("fsUsername"))
94- if self.api.get_config_value("fsPassword") is not None:
95- self.entryPassword.set_text(self.api.get_config_value("fsPassword"))
96+ if username is not None:
97+ self.entryUsername.set_text(username)
98+ if password is not None:
99+ self.entryPassword.set_text(password)
100
101 if warning:
102 self.labelWarning.set_label(warning)
103@@ -399,7 +416,9 @@
104 def FinishLogin(self, username, password):
105 """
106 Attempts to login in to confirm the given credentials.
107- If successful, they're written to a local file for subsequent use.
108+ If successful, the username is written to a local file for subsequent use
109+ and the password is saved in the user's keyring (if available, or a local
110+ file otherwise).
111
112 The GUI calls are done using gobject.idle_add() to assure they're
113 within the main gtk thread.
114@@ -408,7 +427,16 @@
115
116 if self.freeSound.loggedIn:
117 self.api.set_config_value("fsUsername", username)
118- self.api.set_config_value("fsPassword", password)
119+ if keyring:
120+ gkey.item_create_sync(gkey.get_default_keyring_sync(),
121+ gkey.ITEM_NETWORK_PASSWORD,
122+ EXTENSION_DATA_NAME,
123+ {"username" : username},
124+ password,
125+ True)
126+ else:
127+ self.api.set_config_value("fsPassword", password)
128+
129 gobject.idle_add(self.loginWindow.destroy)
130
131 if self.showSearch:

Subscribers

People subscribed via source and target branches