Merge lp:~jonobacon/lolocopter/importing-sounds into lp:lolocopter

Proposed by Jono Bacon
Status: Merged
Approved by: Jono Bacon
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~jonobacon/lolocopter/importing-sounds
Merge into: lp:lolocopter
Diff against target: 184 lines (+66/-57)
2 files modified
data/ui/AddSoundLolocopterDialog.ui (+42/-28)
lolocopter/AddSoundLolocopterDialog.py (+24/-29)
To merge this branch: bzr merge lp:~jonobacon/lolocopter/importing-sounds
Reviewer Review Type Date Requested Status
Stuart Langridge (community) Approve
Review via email: mp+14872@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jono Bacon (jonobacon) wrote :

 * Adding functionality to import a lol to the lolobase.

Revision history for this message
Stuart Langridge (sil) wrote :

Nice.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/ui/AddSoundLolocopterDialog.ui'
2--- data/ui/AddSoundLolocopterDialog.ui 2009-11-14 17:18:08 +0000
3+++ data/ui/AddSoundLolocopterDialog.ui 2009-11-14 19:30:23 +0000
4@@ -5,6 +5,7 @@
5 <!-- interface-naming-policy project-wide -->
6 <object class="AddSoundLolocopterDialog" id="addsound_lolocopter_dialog">
7 <property name="border_width">5</property>
8+ <property name="title" translatable="yes">Add a sound to LOL at</property>
9 <property name="icon">../media/icon.png</property>
10 <property name="type_hint">normal</property>
11 <property name="has_separator">False</property>
12@@ -18,48 +19,61 @@
13 <property name="visible">True</property>
14 <property name="orientation">vertical</property>
15 <child>
16- <object class="GtkTreeView" id="sound_treeview">
17+ <object class="GtkLabel" id="label1">
18 <property name="visible">True</property>
19- <property name="can_focus">True</property>
20+ <property name="label" translatable="yes">Choosing a sound to LOL at is as
21+simple as following these two steps.</property>
22+ <property name="use_markup">True</property>
23 </object>
24 <packing>
25 <property name="position">0</property>
26 </packing>
27 </child>
28 <child>
29- <object class="GtkHButtonBox" id="hbuttonbox1">
30+ <object class="GtkTable" id="table1">
31 <property name="visible">True</property>
32- <property name="layout_style">end</property>
33- <child>
34- <object class="GtkButton" id="delete_sound">
35- <property name="label">gtk-delete</property>
36+ <property name="n_rows">2</property>
37+ <property name="n_columns">2</property>
38+ <child>
39+ <object class="GtkLabel" id="label2">
40+ <property name="visible">True</property>
41+ <property name="label" translatable="yes">1. Choose a sound to LOL to</property>
42+ </object>
43+ </child>
44+ <child>
45+ <object class="GtkFileChooserButton" id="filechooser_sound">
46+ <property name="visible">True</property>
47+ <property name="create_folders">False</property>
48+ </object>
49+ <packing>
50+ <property name="left_attach">1</property>
51+ <property name="right_attach">2</property>
52+ </packing>
53+ </child>
54+ <child>
55+ <object class="GtkLabel" id="label3">
56+ <property name="visible">True</property>
57+ <property name="label" translatable="yes">2. Give said LOL a name</property>
58+ </object>
59+ <packing>
60+ <property name="top_attach">1</property>
61+ <property name="bottom_attach">2</property>
62+ </packing>
63+ </child>
64+ <child>
65+ <object class="GtkEntry" id="tb_soundname">
66 <property name="visible">True</property>
67 <property name="can_focus">True</property>
68- <property name="receives_default">True</property>
69- <property name="use_stock">True</property>
70- </object>
71- <packing>
72- <property name="expand">False</property>
73- <property name="fill">False</property>
74- <property name="position">0</property>
75- </packing>
76- </child>
77- <child>
78- <object class="GtkFileChooserButton" id="filechooserbutton1">
79- <property name="visible">True</property>
80- <property name="create_folders">False</property>
81- <property name="use_preview_label">False</property>
82- </object>
83- <packing>
84- <property name="expand">False</property>
85- <property name="fill">False</property>
86- <property name="position">1</property>
87+ </object>
88+ <packing>
89+ <property name="left_attach">1</property>
90+ <property name="right_attach">2</property>
91+ <property name="top_attach">1</property>
92+ <property name="bottom_attach">2</property>
93 </packing>
94 </child>
95 </object>
96 <packing>
97- <property name="expand">False</property>
98- <property name="fill">False</property>
99 <property name="position">1</property>
100 </packing>
101 </child>
102
103=== modified file 'lolocopter/AddSoundLolocopterDialog.py'
104--- lolocopter/AddSoundLolocopterDialog.py 2009-11-14 17:18:08 +0000
105+++ lolocopter/AddSoundLolocopterDialog.py 2009-11-14 19:30:23 +0000
106@@ -17,6 +17,8 @@
107 import sys
108 import os
109 import gtk
110+import xdg.BaseDirectory
111+import shutil
112
113 from lolocopter.lolocopterconfig import getdatapath
114
115@@ -45,40 +47,31 @@
116 self.builder = builder
117 self.builder.connect_signals(self)
118
119- self.sound_treeview = builder.get_object("sound_treeview")
120-
121- self.sound_model = gtk.ListStore(str, str)
122- self.sound_treeview.set_model(self.sound_model)
123-
124- self.tvcolumn = gtk.TreeViewColumn('Available LOLs')
125- self.cellsound = gtk.CellRendererPixbuf()
126- self.cell = gtk.CellRendererText()
127-
128- self.tvcolumn.pack_start(self.cellsound, False)
129- self.tvcolumn.pack_start(self.cell, True)
130-
131- self.tvcolumn.set_attributes(self.cellsound, stock_id=0)
132- self.tvcolumn.set_attributes(self.cell, text=1)
133-
134- self.sound_treeview.append_column(self.tvcolumn)
135-
136- lis = ["foo", "bar", "bas"]
137-
138- templist = []
139-
140- for l in lis:
141- templist.append(gtk.STOCK_DND)
142- templist.append(l)
143- self.sound_model.append(templist)
144- templist = []
145-
146-
147+ self.lolfile = builder.get_object("filechooser_sound")
148+ self.lolname = builder.get_object("tb_soundname")
149+
150+ # create the sounds directory if not there
151+ self.lolofolder = xdg.BaseDirectory.save_data_path('lolocopter')
152+ self.lolofolder_sounds = os.path.join(self.lolofolder,"sounds")
153+
154+ try:
155+ os.mkdir(self.lolofolder_sounds)
156+ except:
157+ pass
158+
159 def ok(self, widget, data=None):
160 """ok - The user has elected to save the changes.
161 Called before the dialog returns gtk.RESONSE_OK from run().
162+ Copies the sound over to the 'lolocopter/sounds' folder
163 """
164
165- print "ok"
166+ # copy the file to the sounds folder
167+ shutil.copy(self.lolfile.get_filename(), self.lolofolder_sounds)
168+
169+ # this is the label of the sound
170+ self.lol_name = self.lolname.get_text()
171+
172+
173
174 def cancel(self, widget, data=None):
175 """cancel - The user has elected cancel changes.
176@@ -87,6 +80,8 @@
177
178 #restore any changes to self.__preferences here
179 pass
180+
181+
182
183 def NewAddSoundLolocopterDialog():
184 """NewAddSoundLolocopterDialog - returns a fully instantiated

Subscribers

People subscribed via source and target branches

to all changes: