~ubuntu-branches/ubuntu/natty/quickly/natty

« back to all changes in this revision

Viewing changes to data/templates/ubuntu-project/python/Preferencescamel_case_nameDialog.py

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-03-29 19:00:48 UTC
  • mfrom: (8.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100329190048-olhobq492x3xnztz
Tags: 0.3.90-0ubuntu1
* New release:
  Quickly core:
  - check now that --template has one argument
  - -- enables to give options to templates (unknown options and arguments
    are still given to templates but -- specify explicity what to give to
    templates commands like -h, --version...)
  - check and enable recreation of the credential if user deletes it on
    Launchpad
  - Use realpath so that we can symlink to the binary in trunk.
    (Jonathan Lange)
  - project_path_not_found is raised when data_path_not_found should be
    (originated from Philip Peitsch's patch). (LP: #497688)
  - importing command in one template from another template is now possible
    support as well "all" keyword to import all commands from a template
    into another one (take care of overridden commands too)
    (LP: #452306, #487301)
  - add an apport hook to get installed templates (LP: #411127)
  - enable option completion for templates
  - handle now version upgrade, launching script for templates and handling
    versionning on them
  - change getstarted wording (LP: #486180) - Grant
  - Quickly ship now "version" tag instead of "format" tag
  - add some templatetools to check X display
  - if a commands exit with 4, do not show "ERROR:" (case of wrong command
    usage, for instance)
  - Rewrote importing module in both bin/quickly and ubuntu-project binary
  - Add get_camel_case_name() and get_sentence_name() to templatetools
  - Refactor some code in pre_create hook()
  - Now dashes and spaces support in project name! Dealing with python and
    packaging issues for you. (LP: #493130)
  - Provide Quickly API (LP: #426480)
  - Fix some issues in the man page
  ubuntu-application Template:
  - Enabling upload to team or user ppa, as well as any ppa.
    Use --ppa ppaname or --ppa team/ppaname
    .quickly file can be used as well with ppa = ppaname or
    ppa = team/ppaname (LP: #470192)
    ppa completion is also available
  - Change BSD header by full license
  - Add MIT license
  - Fixes an error when launchpad display name contains unicode character
    (Petar Vasić)
  - Fix typo in quickly help save (Petar Vasić)
  - Adds logo.png as logo property in about dialog (LP: #478389)
    (Petar Vasić)
  - Remove lp-project-change command and add configure command.
    configure lp-project [project_name] to set/reset lp project binded to
    your Quickly project
    ppa <ppa name> to set a default ppa with your project
  - Fix ~/.selected-editor being ignored (LP: #484730)
  - Fix wrong shell completion when in a template (it wrongly proposed
    all commands followed by templates)
  - Check if we have a X display available before running "run" or launching
    GUI in "create" command.
  - add -- support in quickly run to pass options like --help, --version so
    that Quickly core don't take them.
  - enable preferences save call being called multiple times (Philip Peitsch)
  - Use realpath so that we can symlink to the binary in trunk.
  - Fixed some errors in the tutorial (Brian) (LP: #499356)
  - Fix missing import sys in setup.py (Philip Peitsch) (LP: #499712)
  - rename ubuntu-project to ubuntu-application
  - enhance quickly license (no more Copyright file, only one AUTHORS file)
    personal license needs COPYING file now (and the header will be copied in
    every files). No more # needed in those files too. Some other little
    refactoring too (LP: #469330)
  - autolicence by default on first share/release (with LP info and on GPL-3)
  - change versionning support in ubuntu application: (LP: #476814)
   + quickly share just adds -publicX to current version where X is bumped
     at each "quicky share" execution
   + quickly release remove -publicX (if any) and release with current YY.MM.
     If there is already a release with that version, it will be YY.MM.1, 
     then YY.MM.2
  - add accelerators to menu items (jens persson)
  - set correctly title dialog (Philip Peitsch) (LP: #501999)
  - about dialog box is now fully automated: (LP: #478414)
   + update copyright, authors, license (when licensing)
   + version (when sharing and releasing)
   + homepage (when changing launchpad project: release and configure)
  - add an 'add' command. $ quickly dialog … is now $ quickly add dialog …
    (LP: #438320)
  - enable automatic release and milestone built in LP, releasing and pushing
    upstream tarball (LP: #470344)
  - automatic collect and publish changelog message from commits and save
    messages used during devlopment. (LP: #476572)
  - add i18n to boiler plate (LP: #423529)
  - enable adding manual depdencies to quickly project (LP: #474639)
  - enable configure its own bzr branch and resetting parent branch even once
    already configured (quickly configure bzr <branch-path>)
  - now recommends seahorse-plugins to have a graphical prompt for signing
    package
  - rename quickly glade to quickly design (LP: #528664)
  - create command is now more flexible and enable people to inherit from
    other template more easily
  - add translation domain to gtkbuilder and fix some items that shouldn't
    been translatable (Łukasz Jernaś)
  - add apport and launchpadintegration to new and existing project once
    bounded to LP (Philip Peitsch)
  - fix spelling mistake "connexion" (Łukasz Jernaś) (LP: #532667)
  - the ubuntu-application tutorial is now internationalized and use docbook
    format. Translators, it's yours! (Shane Fagan) (LP: #525168)
  - package/share/release are now more quiet and only print something on error
    warning as a summary as with unfound packages, and so on (LP: #482915)
  - new algorithm to select good email automatically. Try to get the preferred
    email and update the AUTHOR file with it.
  - test GPG key and create one automatically if none is available. The
    corresponding public key availabity in launchpad is also checked.
    (LP: #427730, #408993)
  - add devscripts as a dependency (bug #465833), will fix all the depends
    mess later
  - bump python-distutils-extra (>= 2.18bzr1)
  ubuntu-cli Template:
  - first release using import command feature (no command written into the
    template itself). This is a basic ubuntu CLI application
  ubuntu-pygame Template:
  - first release using import command feature. python-pygame added as a
    depends
* debian/control:
  - renamed and separate in multiple packages to get a -common used with
    Quickly widgets (LP: #519633)
  - suggests python-quickly-widgets

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- coding: utf-8 -*-
2
 
### BEGIN LICENSE
3
 
# This file is in the public domain
4
 
### END LICENSE
5
 
 
6
 
import sys
7
 
import os
8
 
import gtk
9
 
from desktopcouch.records.server import CouchDatabase
10
 
from desktopcouch.records.record import Record
11
 
 
12
 
from project_name.project_nameconfig import getdatapath
13
 
 
14
 
class Preferencescamel_case_nameDialog(gtk.Dialog):
15
 
    __gtype_name__ = "Preferencescamel_case_nameDialog"
16
 
    prefernces = {}
17
 
 
18
 
    def __init__(self):
19
 
        """__init__ - This function is typically not called directly.
20
 
        Creation of a Preferencescamel_case_nameDialog requires redeading the associated ui
21
 
        file and parsing the ui definition extrenally,
22
 
        and then calling Preferencescamel_case_nameDialog.finish_initializing().
23
 
 
24
 
        Use the convenience function NewPreferencescamel_case_nameDialog to create
25
 
        NewAboutcamel_case_nameDialog objects.
26
 
        """
27
 
 
28
 
        pass
29
 
 
30
 
    def finish_initializing(self, builder):
31
 
        """finish_initalizing should be called after parsing the ui definition
32
 
        and creating a Aboutcamel_case_nameDialog object with it in order to finish
33
 
        initializing the start of the new Aboutcamel_case_nameDialog instance.
34
 
        """
35
 
 
36
 
        #get a reference to the builder and set up the signals
37
 
        self.builder = builder
38
 
        self.builder.connect_signals(self)
39
 
 
40
 
        #set up couchdb and the preference info
41
 
        self.__db_name = "project_name"
42
 
        self.__database = CouchDatabase(self.__db_name, create=True)
43
 
        self.__preferences = None
44
 
        self.__key = None
45
 
 
46
 
        #set the record type and then initalize the preferences
47
 
        self.__record_type = "http://wiki.ubuntu.com/Quickly/RecordTypes/camel_case_name/Preferences"
48
 
        self.__preferences = self.get_preferences()
49
 
        #TODO:code for other initialization actions should be added here
50
 
 
51
 
    def get_preferences(self):
52
 
        """get_preferences  -returns a dictionary object that contain
53
 
        preferences for project_name. Creates a couchdb record if
54
 
        necessary.
55
 
        """
56
 
 
57
 
        if self.__preferences == None: #the dialog is initializing
58
 
            self.__load_preferences()
59
 
            
60
 
        #if there were no saved preference, this 
61
 
        return self.__preferences
62
 
 
63
 
    def __load_preferences(self):
64
 
        #TODO: add prefernces to the self.__preferences dict
65
 
        #default preferences that will be overwritten if some are saved
66
 
        self.__preferences = {"record_type":self.__record_type}
67
 
        
68
 
        results = self.__database.get_records(record_type=self.__record_type, create_view=True)
69
 
       
70
 
        if len(results.rows) == 0:
71
 
            #no preferences have ever been saved
72
 
            #save them before returning
73
 
            self.__key = self.__database.put_record(Record(self.__preferences))
74
 
        else:
75
 
            self.__preferences = results.rows[0].value
76
 
            self.__key = results.rows[0].value["_id"]
77
 
        
78
 
    def __save_preferences(self):
79
 
        self.__database.update_fields(self.__key, self.__preferences)
80
 
 
81
 
    def ok(self, widget, data=None):
82
 
        """ok - The user has elected to save the changes.
83
 
        Called before the dialog returns gtk.RESONSE_OK from run().
84
 
        """
85
 
 
86
 
        #make any updates to self.__preferences here
87
 
        #self.__preferences["preference1"] = "value2"
88
 
        self.__save_preferences()
89
 
 
90
 
    def cancel(self, widget, data=None):
91
 
        """cancel - The user has elected cancel changes.
92
 
        Called before the dialog returns gtk.RESPONSE_CANCEL for run()
93
 
        """
94
 
 
95
 
        #restore any changes to self.__preferences here
96
 
        pass
97
 
 
98
 
def NewPreferencescamel_case_nameDialog():
99
 
    """NewPreferencescamel_case_nameDialog - returns a fully instantiated
100
 
    Preferencescamel_case_nameDialog object. Use this function rather than
101
 
    creating a Preferencescamel_case_nameDialog instance directly.
102
 
    """
103
 
 
104
 
    #look for the ui file that describes the ui
105
 
    ui_filename = os.path.join(getdatapath(), 'ui', 'Preferencescamel_case_nameDialog.ui')
106
 
    if not os.path.exists(ui_filename):
107
 
        ui_filename = None
108
 
 
109
 
    builder = gtk.Builder()
110
 
    builder.add_from_file(ui_filename)
111
 
    dialog = builder.get_object("preferences_project_name_dialog")
112
 
    dialog.finish_initializing(builder)
113
 
    return dialog
114
 
 
115
 
if __name__ == "__main__":
116
 
    dialog = NewPreferencescamel_case_nameDialog()
117
 
    dialog.show()
118
 
    gtk.main()
119