Merge lp:~jbernard/acire/no-desktop-couch into lp:acire

Proposed by Andrea Colangelo on 2011-09-18
Status: Needs review
Proposed branch: lp:~jbernard/acire/no-desktop-couch
Merge into: lp:acire
Diff against target: 250 lines (+1/-217) 4 files modified
To merge this branch: bzr merge lp:~jbernard/acire/no-desktop-couch
Reviewer Review Type Date Requested Status
Jono Bacon 2011-09-18 Pending
Review via email: mp+75899@code.launchpad.net

Commit Message

Drop unused preferences dialog code and dependency on desktop-couch. Fixes: #531059

Description of the Change

Drop unused preferences dialog code and dependency on desktop-couch. Fixes: #531059

To post a comment you must log in.

Unmerged revisions

48. By Jon Bernard on 2010-03-26

Remove preferences files and dependency on desktop-couch

Preview Diff

1=== removed file 'acire/PreferencesAcireDialog.py'
2--- acire/PreferencesAcireDialog.py 2010-02-26 13:49:32 +0000
3+++ acire/PreferencesAcireDialog.py 1970-01-01 00:00:00 +0000
4@@ -1,131 +0,0 @@
5-# -*- coding: utf-8 -*-
6-### BEGIN LICENSE
7-# Copyright (C) 2009 Jono Bacon <jono@ubuntu.com>
8-#This program is free software: you can redistribute it and/or modify it
9-#under the terms of the GNU General Public License version 3, as published
10-#by the Free Software Foundation.
11-#
12-#This program is distributed in the hope that it will be useful, but
13-#WITHOUT ANY WARRANTY; without even the implied warranties of
14-#MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
15-#PURPOSE. See the GNU General Public License for more details.
16-#
17-#You should have received a copy of the GNU General Public License along
18-#with this program. If not, see <http://www.gnu.org/licenses/>.
19-### END LICENSE
20-
21-import sys
22-import os
23-import gtk
24-from desktopcouch.records.server import CouchDatabase
25-from desktopcouch.records.record import Record
26-
27-from acire.acireconfig import getdatapath
28-
29-class PreferencesAcireDialog(gtk.Dialog):
30- __gtype_name__ = "PreferencesAcireDialog"
31- prefernces = {}
32-
33- def __init__(self):
34- """__init__ - This function is typically not called directly.
35- Creation of a PreferencesAcireDialog requires redeading the associated ui
36- file and parsing the ui definition extrenally,
37- and then calling PreferencesAcireDialog.finish_initializing().
38-
39- Use the convenience function NewPreferencesAcireDialog to create
40- NewAboutAcireDialog objects.
41- """
42-
43- pass
44-
45- def finish_initializing(self, builder):
46- """finish_initalizing should be called after parsing the ui definition
47- and creating a AboutAcireDialog object with it in order to finish
48- initializing the start of the new AboutAcireDialog instance.
49- """
50-
51- #get a reference to the builder and set up the signals
52- self.builder = builder
53- self.builder.connect_signals(self)
54-
55- #set up couchdb and the preference info
56- self.__db_name = "acire"
57- self.__database = CouchDatabase(self.__db_name, create=True)
58- self.__preferences = None
59- self.__key = None
60-
61- #set the record type and then initalize the preferences
62- self.__record_type = "http://wiki.ubuntu.com/Quickly/RecordTypes/Acire/Preferences"
63- self.__preferences = self.get_preferences()
64- #TODO:code for other initialization actions should be added here
65-
66- def get_preferences(self):
67- """get_preferences -returns a dictionary object that contain
68- preferences for acire. Creates a couchdb record if
69- necessary.
70- """
71-
72- if self.__preferences == None: #the dialog is initializing
73- self.__load_preferences()
74-
75- #if there were no saved preference, this
76- return self.__preferences
77-
78- def __load_preferences(self):
79- #TODO: add prefernces to the self.__preferences dict
80- #default preferences that will be overwritten if some are saved
81- self.__preferences = {"record_type":self.__record_type}
82-
83- results = self.__database.get_records(record_type=self.__record_type, create_view=True)
84-
85- if len(results.rows) == 0:
86- #no preferences have ever been saved
87- #save them before returning
88- self.__key = self.__database.put_record(Record(self.__preferences))
89- else:
90- self.__preferences = results.rows[0].value
91- self.__key = results.rows[0].value["_id"]
92-
93- def __save_preferences(self):
94- self.__database.update_fields(self.__key, self.__preferences)
95-
96- def ok(self, widget, data=None):
97- """ok - The user has elected to save the changes.
98- Called before the dialog returns gtk.RESONSE_OK from run().
99- """
100-
101- #make any updates to self.__preferences here
102- #self.__preferences["preference1"] = "value2"
103- self.__save_preferences()
104-
105- def cancel(self, widget, data=None):
106- """cancel - The user has elected cancel changes.
107- Called before the dialog returns gtk.RESPONSE_CANCEL for run()
108- """
109-
110- #restore any changes to self.__preferences here
111- pass
112-
113-def NewPreferencesAcireDialog():
114- """NewPreferencesAcireDialog - returns a fully instantiated
115- PreferencesAcireDialog object. Use this function rather than
116- creating a PreferencesAcireDialog instance directly.
117- """
118-
119- #look for the ui file that describes the ui
120- ui_filename = os.path.join(getdatapath(), 'ui', 'PreferencesAcireDialog.ui')
121- if not os.path.exists(ui_filename):
122- ui_filename = None
123-
124- builder = gtk.Builder()
125- builder.set_translation_domain('acire')
126- builder.add_from_file(ui_filename)
127- dialog = builder.get_object("preferences_acire_dialog")
128- dialog.finish_initializing(builder)
129- return dialog
130-
131-if __name__ == "__main__":
132- dialog = NewPreferencesAcireDialog()
133- dialog.show()
134- gtk.main()
135-
136
137=== modified file 'bin/acire'
138--- bin/acire 2010-03-26 19:41:43 +0000
139+++ bin/acire 2011-09-18 14:44:26 +0000
140@@ -46,7 +46,7 @@
141 fullPath = os.getcwd()
142 sys.path.insert(0, os.path.dirname(fullPath))
143
144-from acire import AboutAcireDialog, PreferencesAcireDialog
145+from acire import AboutAcireDialog
146 from acire.acireconfig import getdatapath
147
148 # Set up translations
149@@ -471,15 +471,6 @@
150 response = about.run()
151 about.destroy()
152
153- def preferences(self, widget, data=None):
154- """preferences - display the preferences window for acire """
155- prefs = PreferencesAcireDialog.NewPreferencesAcireDialog()
156- response = prefs.run()
157- if response == gtk.RESPONSE_OK:
158- #make any updates based on changed preferences here
159- pass
160- prefs.destroy()
161-
162 def quit(self, widget, data=None):
163 """quit - signal handler for closing the AcireWindow"""
164 self.destroy()
165
166=== removed file 'data/ui/PreferencesAcireDialog.ui'
167--- data/ui/PreferencesAcireDialog.ui 2010-02-26 13:49:32 +0000
168+++ data/ui/PreferencesAcireDialog.ui 1970-01-01 00:00:00 +0000
169@@ -1,67 +0,0 @@
170-<?xml version="1.0"?>
171-<interface>
172- <requires lib="gtk+" version="2.16"/>
173- <!-- interface-requires preferences_acire_dialog 1.0 -->
174- <!-- interface-naming-policy project-wide -->
175- <object class="PreferencesAcireDialog" id="preferences_acire_dialog">
176- <property name="border_width">5</property>
177- <property name="icon">../media/icon.png</property>
178- <property name="type_hint">normal</property>
179- <property name="has_separator">False</property>
180- <child internal-child="vbox">
181- <object class="GtkVBox" id="dialog-vbox1">
182- <property name="visible">True</property>
183- <property name="orientation">vertical</property>
184- <property name="spacing">2</property>
185- <child>
186- <placeholder/>
187- </child>
188- <child internal-child="action_area">
189- <object class="GtkHButtonBox" id="dialog-action_area1">
190- <property name="visible">True</property>
191- <property name="layout_style">end</property>
192- <child>
193- <object class="GtkButton" id="button2">
194- <property name="label">gtk-cancel</property>
195- <property name="visible">True</property>
196- <property name="can_focus">True</property>
197- <property name="receives_default">True</property>
198- <property name="use_stock">True</property>
199- <signal name="clicked" handler="cancel"/>
200- </object>
201- <packing>
202- <property name="expand">False</property>
203- <property name="fill">False</property>
204- <property name="position">0</property>
205- </packing>
206- </child>
207- <child>
208- <object class="GtkButton" id="button1">
209- <property name="label">gtk-ok</property>
210- <property name="visible">True</property>
211- <property name="can_focus">True</property>
212- <property name="receives_default">True</property>
213- <property name="use_stock">True</property>
214- <signal name="clicked" handler="ok"/>
215- </object>
216- <packing>
217- <property name="expand">False</property>
218- <property name="fill">False</property>
219- <property name="position">1</property>
220- </packing>
221- </child>
222- </object>
223- <packing>
224- <property name="expand">False</property>
225- <property name="pack_type">end</property>
226- <property name="position">0</property>
227- </packing>
228- </child>
229- </object>
230- </child>
231- <action-widgets>
232- <action-widget response="-6">button2</action-widget>
233- <action-widget response="-5">button1</action-widget>
234- </action-widgets>
235- </object>
236-</interface>
237
238=== removed file 'data/ui/preferences_acire_dialog.xml'
239--- data/ui/preferences_acire_dialog.xml 2009-12-29 12:07:58 +0000
240+++ data/ui/preferences_acire_dialog.xml 1970-01-01 00:00:00 +0000
241@@ -1,9 +0,0 @@
242-<glade-catalog name="preferences_acire_dialog" domain="glade-3"
243- depends="gtk+" version="1.0">
244- <glade-widget-classes>
245- <glade-widget-class title="Acire Preferences Dialog" name="PreferencesAcireDialog"
246- generic-name="PreferenceAcireDialog" parent="GtkDialog"
247- icon-name="widget-gtk-dialog"/>
248- </glade-widget-classes>
249-
250-</glade-catalog>

Subscribers

People subscribed via source and target branches