# &appname; &appversion; User Guide

## About This Guide

Quickly is a set of choices about writing apps for Ubuntu. Out of all the wonderful richness and variety of programming for Ubuntu, Quickly make some very opinionated choices about what tools to use, and how to combine them. The criteria for these choices was to make it easy and fun to write and release Ubuntu applications, even if it's your first time trying, but also in a way that delivers the full power and flexibility of the platform. One benefit of these choices, is that it's also easier to write tools that make it even easier and more fun. So Quickly is also a set of commands.

- Getting Started

## Getting Started

This is part 1 of the Quickly tutorial. This part will introduce some key Quickly commands, editing a user interface in Glade, and editing code in gedit. This part of the tutorial will familiarize you with these three tools, and how they work together with Python and GTK+ so that you can quickly build applications.

## Creating a Quickly Project

Creating an empty but working program couldn't be simpler. First, open a terminal window to type commands into. When it's open, type the command:

    quickly create ubuntu-application jotty

This will create a jotty subdirectory containing a complete directory tree and files for an empty Python application. The command finishes by running the newly created empty application.

## Testing the Empty Application

In the window that pops up you have a menubar, text and a statusbar. Notice that Quickly inferred that the application title is "Jotty". Only a few of menu items do anything in the empty application, Help->About, Edit->Preferences, and File->Close.

## Running the Application

Close the application by closing the window or using the File->Close menu item. Since the empty application isn't actually installed, you can't start the application from the application menu yet. To start the applicaton, use the terminal to first cd into the new subdirectory, and then use "quickly run".

    cd jotty
    quickly run

## Editing an Application

## Edit the User Interface in Glade

Quickly programs use Glade to edit the user interface. Start Glade with "quickly design" in order to set up Glade for editing the empty applicaton. Don't start Glade directly, or it won't load the necessary catalog files for editing the classes that were automatically generated by Quickly.

    quickly design

Glade will open with the project loaded up and ready to edit.

Click on "jotty_window" in the right pane to open the window for editing.

The first thing we want to do is create a text area for typing into. There are some default widgets added to the window already, but we won't need these so we'll start by deleting them. Click on the label and press Delete to make it disappear from the window.

Do the same with the image widget. This leave us two free slots.

We'll use the bottom slot to add a TextView widget for the user to type into. In the toolbox on the left, click on the "Text View" button in the "Controls and Display" section. Then click in the bottom empty slot.

Make sure you save the file in Glade, or your changes won't be kept! Then run the application from the terminal again. The window now has a place where the user can type.

Now we'll add the entry field for the title and also a label for it. We'll use the top empty slot for that. First, click on "Box" from the "Containers" section of the toolbox, and then click on the top slot. A dialog box will open; tell it that you want two items.

A Box is a container that arranges its contents either vertically or horizontally. We want a horizontal one, so on the right bottom pane, change the "Orientation" setting to "Horizontal". Then add a Label to the empty left hand slot, and a Text Entry to the right hand one.

Before going on, let's clean up the UI just a tad here. Select the horizontal box from the list on the right. Then go to the Packing tab in the bottom right, and set Expand and Fill to "No".

Go to the General tab, and set spacing to 6.

Select the label. On the General tab, set the Label field to "Name:". Set Expand and Fill to "No" for the label, and set them to "Yes" for the entry. Set the Padding for both to 6 (also on the Packing tab).

## Add the Save, Open, and New Features

After the user types something, they may want to save it. A File->Save menu item was automatically created when the empty applicaton was created, but it's not hooked up to any code. To make Save work, we need tell the menu item what function to call and then create a function to actually do the saving.

## Set the Signal Handler in Glade

First, we need to tell the menu item what function to call. If Glade is not still open, open up the application in Glade:

    quickly design

Click on the file menu, and the menu opens as if the application were running.

Choose the Save menu item, and it will be selected in Glade.

In GTK+, menu items are "activated" when a user chooses the item from the menu. Since we want a function to run when the user chooses Save, we want to specify a function to respond to the activate signal from the menu item. Note the name of the menu item is "mnu_save" in the right panel. You will use this in a second.

## Edit the Code in Gedit

## Create the Save File Signal Handler

Now you're ready to write some code. The code for the window is stored in the file "JottyWindow.py".

Use the "quickly edit" command to start editing your code files:

    quickly edit

This will open the default Ubuntu text editor gedit with all the customizable Python files in the "jotty" directory.

When signals are emitted, if the window's class has a method called "on_WIDGET_SIGNAL", it will be called. In this case, we are interested in the "activate" signal on the "mnu_save" widget. So we want to create an "on_mnu_save_activate" method in the JottyWindow class. So simply switch to the JottyWindow.py file and add the following right under the finish_initializing method:

        def on_mnu_save_activate(self, widget, data=None):
            print "save"

This will print the word "save" to the terminal when run. The method signature is the standard signature expected in a signal handler. If you are new to python, be sure to copy the indentations exactly, as the indentation level is very important in python.

Save the file, and run it again:

    quickly run

Choose File->Save from the menu, and you'll see the word "save" printed out in the terminal. That's all there is to hooking up the signals!

## Implementing Save

Now we'll write a little code in the signal handler to actually save the text. This code will do the following:

- Import any new modules you'll need.

- Get the title of the document and the text from the user interface.

- Write the file to disk.

## Import new modules:

Add these import statements near the other imports at the top of the JottyWindow.py file. The comment on the right is there for the benefit of the Python static code analysis tool pylint, if you happen to use it.

    import os
    from gi.repository import GLib # pylint: disable=E0611

## Here's the code to pull the title out of the title entry:

Add this to the on_mnu_save_activate method.

            #get the title for the note
            title = self.ui.entry1.get_text()

## Here's the code to get pull the text out of the TextView:

In GTK+, TextView widgets have a text buffer that stores the text. So you ask the TextView for it's TextBuffer, and then you ask the TextBuffer for the text. You use iterators (iters) to determine from which part of the text buffer you want text. Since we want all the text, it's easy to just get the start and end iters.

            #get the string
            buff = self.ui.textview1.get_buffer()
            start_iter = buff.get_start_iter()
            end_iter = buff.get_end_iter()
            text = buff.get_text(start_iter, end_iter, True)

## Deciding where to save the note:

We'll store the document in the system hidden folder designated for user-specific data. It's simple enough to ask GLib where that folder is and then add a jotty subfolder.

            #create the filename
            data_dir = GLib.get_user_data_dir()
            jotty_dir = os.path.join(data_dir, "jotty")
            filename = os.path.join(jotty_dir, title)

## Saving a document to user's disk:

GLib provides a convenience function for directly writing a string to a file.

            #write the data
            GLib.mkdir_with_parents(jotty_dir, 0o700)
            GLib.file_set_contents(filename, text)

So the whole function should look like this:

        def on_mnu_save_activate(self, widget, data=None):
            #get the title for the note
            title = self.ui.entry1.get_text()

            #get the string
            buff = self.ui.textview1.get_buffer()
            start_iter = buff.get_start_iter()
            end_iter = buff.get_end_iter()
            text = buff.get_text(start_iter, end_iter, True)

            #create the filename
            data_dir = GLib.get_user_data_dir()
            jotty_dir = os.path.join(data_dir, "jotty")
            filename = os.path.join(jotty_dir, title)

            #write the data
            GLib.mkdir_with_parents(jotty_dir, 0o700)
            GLib.file_set_contents(filename, text)

It's easy to see if your save function is working. You can just explore the jotty data folder:

    gvfs-open ~/.local/share/jotty

## Implementing Open and New

To open a saved document, the user will type the title of the document that they want to open in the text entry, and choose "Open" from the main menu. If there is no matching document there, it will just clear out the text view, ready for input. This is probably not too intuitive, so we'll add a dialog box for prompting the user for the title, but that's for later in the tutorial. For now, we'll just use the same text entry field.

## Implementing Open is essentially the reverse of Save:

Follow these steps:

- Add the on_mnu_open_activate method to the JottyWindow class.

- Find all of the existing document names.

- Check if any have a matching title.

- If there is a match, pull out the text and display it in the text view.

So the on_mnu_open_activate method looks like so:

        def on_mnu_open_activate(self, widget, data=None):
            #get the name of the document to open
            title = self.ui.entry1.get_text()
            text = ""

            #create the filename
            data_dir = GLib.get_user_data_dir()
            jotty_dir = os.path.join(data_dir, "jotty")
            filename = os.path.join(jotty_dir, title)

            #try to get the data from the file if it exists
            try:
                success, text = GLib.file_get_contents(filename)
            except Exception:
                text = ""

            #set the UI to display the string
            buff = self.ui.textview1.get_buffer()
            buff.set_text(text)

## Implement New

Add the on_mnu_new_activate method to the JottyWindow class:

        def on_mnu_new_activate(self, widget, data=None):
            self.ui.entry1.set_text("Note Title")
            buff = self.ui.textview1.get_buffer()
            buff.set_text("")

Remember to save your JottyWindow.py file.

Complete JottyWindow.py file

## Saving Your Work

When Quickly created your application, it automatically added it to Bazaar, a source code versioning system. You can use Bazaar to roll back mistakes, see code history, compare versions, etc... Quickly has a convenience function for backing up your work:

    quickly save "First working version of Jotty"

This will call

    bzr add

and then

    bzr commit -m [your message]

for you.

## Using Dialogs

In part 1, we created an application that can read and write text files, and persist them on the disk. However, the application has a hideous usability flaw: the text box for specifying titles when saving and opening files is very confusing. In part 2, we'll fix that by adding a save and an open dialog.

## Creating an Empty Dialog

It's simple to add an empty, but working dialog to your project. Simply specify the name of the new dialog, and it will be added automatically. Assuming that you are in the jotty project directory:

    quickly add dialog save

This will add the dialog to your project.

## Editing the New Dialog

To edit the UI for the dialog, you'll need to load it into Glade again. If you already have an instance of Glade running, you might want to go ahead and close it first, as it may get confusing if you have more than one open at a time. After closing Glade, simply open it again:

    quickly design

Then use the Projects menu to switch to the newly created SaveDialog.ui file.

Then add some widgets for the UI. Start with a vertical Box with two items. Put a label in the top, and a horizontal Box in the bottom slot. In the horizontal box, add a label and a text entry, just like you did for JottyWindow in part 1. Set the expand property of the text entry to true.

## Code the Dialog

You can use the "quickly edit" command to open the SaveDialog.py file. This dialog needs very little additional code to work. Essentially, you just need a way to retrieve the string specified by the user. We'll add a quick accessor method for this:

        @property
        def title_text(self):
            return self.ui.entry1.get_text()

We don't need to write any code for the OK and Cancel buttons, as they were automatically hooked up by Quickly when it created the dialog.

Before we go on to invoking the dialog, delete the Box from the original JottyWindow that holds the text entry and label, as we won't be needing those.

## Calling the Save Dialog

To use the dialog in JottyWindow, we need to follow these steps:

- Import SaveDialog in JottyWindow

- In the on_mnu_save_activate method, create an instance of SaveDialog

- Run the Dialog

- Get the String

- Destroy the dialog

## Importing the SaveDialog

Add the SaveDialog to the list of the imported modules at the top of the JottyWindow.py file, like this:

    from jotty.SaveDialog import SaveDialog

## Create an instance of the dialog and run it

When the user chooses Save, we want to open the SaveDialog and collect the title of the note from the user. So we need to modify our on_mnu_save_activate method.

First, create an instance of the SaveDialog like this:

            saver = SaveDialog()

To make the dialog appear, simply use the run() method. However, we want to check the result, so we'll need to store that in a variable. After it runs, we want to collect the string from the user, like this:

            result = saver.run()
            title = saver.title_text

## Clean up the dialog

We need to tell the dialog to not show itself anymore. We could call saver.hide() to make it hide, but since we don't need it hanging around, we'll just destroy it. Before we go on, though, we need to ensure that the user actually wants to save, so if we didn't get the OK result, we should just return out of the method:

            saver.destroy()
            if result != Gtk.ResponseType.OK:
                return

Since we're now getting the title from the dialog instead of the text entry, we should delete the line of the code that gets it from the text entry. So except for the addition of the dialog code, the on_mnu_save_activate method looks pretty much the same as it did in part 1:

        def save_file(self, widget, data=None):
            #get the title from the user
            saver = SaveDialog()
            result = saver.run()
            title = saver.title_text

            saver.destroy()
            if result != Gtk.ResponseType.OK:
                return

            #get the string
            buff = self.ui.textview1.get_buffer()
            start_iter = buff.get_start_iter()
            end_iter = buff.get_end_iter()
            text = buff.get_text(start_iter, end_iter, True)

            #create the filename
            data_dir = GLib.get_user_data_dir()
            jotty_dir = os.path.join(data_dir, "jotty")
            filename = os.path.join(jotty_dir, title)

            #write the data
            GLib.mkdir_with_parents(jotty_dir, 0o700)
            GLib.file_set_contents(filename, text)

Now when we choose save, we get the SaveDialog instead:

## Creating a Dialog with a DictionaryGrid

We'll use a similar approach in the Open dialog that we did with Save. However, there is one big difference, we want to provide the user with a list of documents that you could choose to open. We'll use a widget called DictionaryGrid, which is included in the Quickly Widgets library.

## Installing the Quickly Widgets library

    sudo apt-get install python-quickly.widgets

## Create the Open Dialog

    quickly add dialog open

## Editing the New Dialog

Start out by closing, and then reopening Glade again:

    quickly design

Start by adding a vertical Box and a label in the same manner as in the Save Dialog above. Leave an empty space in the Box, we will use code to put the DictionaryGrid there.

## Coding the Open Dialog

## Creating and Adding a DictionaryGrid

It just takes a little bit of code to add a DictionaryGrid to the dialog. We need to:

- Import the DictionaryGrid class.

- Get the list of jotty files.

- Throw that list into a DictionaryGrid.

- Add the DictionaryGrid to the Dialog.

- Create the get_selection function.

## Import the DictionaryGrid class

Open the "OpenDialog.py" file with "quickly edit". DictionaryGrid is part of the quickly.widgets library, so we import it as below. Note we also want to import GLib and os, since we'll use some of their functions.

    import os
    from quickly.widgets.dictionary_grid import DictionaryGrid
    from gi.repository import GLib # pylint: disable=E0611

## Get the list of jotty files

First things first, we need to know the names of the existing documents. If you recall, we stored the files in the user's data directory. So we just need to list the files in that directory. This set up should be done in the OpenDialog's finish_initializing function.

            #get the jotty document names
            data_dir = GLib.get_user_data_dir()
            jotty_dir = os.path.join(data_dir, "jotty")
            filenames = os.listdir(jotty_dir)

## Throw that list into a DictionaryGrid

Now that we have a list of files, we need to massage it into the format DictionaryGrid expects. Namely, a list of dictionaries that hold header/value pairs. So we'll add a header to each filename and keep track of the full filename.

            #put them into a grid
            dicts = [{'Name': x, 'File': os.path.join(jotty_dir, x)} for x in filenames]
            self.grid = DictionaryGrid(dictionaries=dicts, keys=['Name'])

## Add the DictionaryGrid to the Dialog

When we added the vertical Box to the dialog, we left an open space at the bottom. We'll use this by "packing" the DictionaryGrid into the Box. We need to show it as well. So add the following lines to the finish_initializing function as well:

            #add grid to dialog
            self.grid.show()
            self.ui.box1.pack_end(self.grid, True, True, 0)

## Create the get_selection function

The dialog still needs a bit more code to work. It needs to return the user's selection, if there is one. To do this, we need to ask the DictionaryGrid what is selected. This is easy using the widget's selected_rows member. But DictionaryGrid supports multiple selection, so we'll do the following:

- Use a decorator to define the function as a property accessor.

- Get all the selected rows.

- If none are selected, return None.

- Pick the first one and return it.

So the function to add to OpenDialog looks like this:

        @property
        def selected_file(self):
            rows = self.grid.selected_rows
            if len(rows) < 1:
                return None
            else:
                return rows[0]['Name']

## Using the Open Dialog

Now we want to use the Open Dialog in JottyWindow's on_mnu_open_activate method. To use it, we'll follow these steps:

- Import OpenDialog in JottyWindow

- In the on_mnu_open_activate method, create an instance of OpenDialog

- Run the Dialog

- Get the filename for the selected title

- Destroy the dialog

- Check the response before proceeding

- Get the file contents

- Update the UI

## Import OpenDialog

Just like the SaveDialog, add the import line to the list of imports:

    from jotty.OpenDialog import OpenDialog

## Create an instance of the dialog and run it

So now we're ready to call the dialog from the JottyWindow's on_mnu_open_activate method. Creating the OpenDialog is exactly the same as creating the SaveDialog, except we also want to tell it to load the titles before we run it:

            opener = OpenDialog()
            result = opener.run()

## Get the filename for the selected title

Now use the property that we created to retrieve the title and text from the dialog. Don't forget to check the response type before going on.

            filename = opener.selected_file

            #close the dialog, and check whether to proceed
            opener.destroy()
            if result != Gtk.ResponseType.OK:
                return

## Get the file contents

If nothing was selected, we'll just return. Otherwise, we'll retrieve the file contents just like we did before and update the UI. That is, this code does not need to change, but is presented again here for completeness.

            #try to get the data from the file if it exists
            try:
                success, text = GLib.file_get_contents(filename)
            except Exception:
                text = ""

            #set the UI to display the string
            buff = self.ui.textview1.get_buffer()
            buff.set_text(text)

That's all there is to it. So the whole open_file function looks like this:

        def open_file(self, widget, data=None):
            #get the name of the document to open
            opener = OpenDialog()
            result = opener.run()
            filename = opener.selected_file

            #close the dialog, and check whether to proceed
            opener.destroy()
            if result != Gtk.ResponseType.OK:
                return

            #try to get the data from the file if it exists
            try:
                success, text = GLib.file_get_contents(filename)
            except Exception:
                text = ""

            #set the UI to display the string
            buff = self.ui.textview1.get_buffer()
            buff.set_text(text)

Now users get a nice open dialog:

However, the application is not complete. There are a few things left for you to do:

- Set the title of the JottyWindow to display the note title. Try self.set_text(title).

- The Save command works more like "Save As". The application probably shouldn't pop up a SaveDialog every time you want to save. If it's already been saved, you probably just want to save it, but use a SaveDialog when the user choose Save As, or is saving a document for the first time.

- The OpenDialog should probably return when the user double clicks on an item in the list. Try connecting to the "select-cursor-row" signal on the TreeView, and calling self.response(Gtk.ResponseType.OK) in the handler.

- Perhaps the OK button in the OpenDialog should be disabled if nothing is selected. Try setting the "sensitivity" in Glade to "False" to start, and using the set_sensitive method on the OK button to adjust it as the selection changes.

- It would be more consistent for the Open and Close dialogs to have "Open" and "Close" for buttons instead of "OK". You can set a different type in the properties window in Glade.

## Packaging

In parts 1 and 2, we showed how to create a simple Ubuntu application using Quickly. This section will cover how to package an application so that it is easy for you to share, and easy for other people to install.

## License your Application

It's important to license your code so users and other programmers know their rights in terms of redistributing or modifying it. To quickly grant a GPL license to your code, simply:

- Specify your name and email address in the AUTHORS file.

- Run the "license" command.

## Specify your name and email

When Quickly created your Ubuntu application, it added a file named AUTHORS in the top level of the directory. Open this file in your text editor, and modify the top line so it has your name and email included. For example, I would change the entire file to look like this:

    Copyright (C) 2011 Rick Spencer rick.spencer@canonical.com

## Run the "License" Command

By default, Quickly will use a GPL 3 license for your project. To use this license, use this command:

    quickly license

This will add the GPL 3 license to all of your code files that you've added to your project using Quickly.

Keep in mind a couple of things:

- This is a one way trip. Once you license the project, changes to the license must be done manually.

- If you prefer a GPL 2 license, you can specify that when you issue the license command:

      quickly license GPL-2

- Quickly doesn't care what license you use, but only knows natively what files and headers to include for BSD, GPL-2, GPL-3, LGPL-2 and LGPL-3. If you prefer another license, you can simply add whatever you license you like by creating a COPYING file and putting it there. Then run:

      quickly license

  to license every file.

- If you've added code files or other files to your project manually, you will need to add the license to those files manually or add those tags at the beginning of the file:

      ### BEGIN LICENSE
      ### END LICENSE

## Translate Your Application

To allow for users from other countries to use your application you may want to translate it. Glade automatically creates a pot file for you but to translate strings in your code you have to:

    import gettext

    gettext.gettext("What you want translated")

## Specify Application Settings

You should personalize your application a little before creating the archive. This is very easy to do, as all of the files that you need have already been created, and only need a few lines changed to make them your own. To do this you should:

- Personalize the Application Icon

- Edit the Desktop File

- Edit the setup.py File

## Personalize your Application Icon

When users install your application, Ubuntu will display an icon next to it in the menus. You can create your own icon or edit the file called "jotty.svg" in the media directory (jotty/data/media). Ubuntu comes with a great image editing program called "Inkscape." So you can go:

    inkscape data/media/jotty.svg

If you don't personalize the icon, it's ok, your app will just have the default icon, such as in the image above.

## Edit the Desktop File

By default, Quickly Ubuntu applications are classified as "utilities", so they show up under the Accessories category in Ubuntu. If we wanted to make Jotty show up in another category, we can do this by editing the desktop file. A desktop file is a file that describes your application to Ubuntu. The file "jotty.desktop.in" was automatically created in your project directory. To change Jotty from a Utility to an Office application, edit jotty.desktop.in and change this:

    [Desktop Entry]
    Name=Jotty
    Comment=Jotty application
    Categories=GNOME;Utility;
    Exec=jotty
    Icon=jotty
    Terminal=false
    Type=Application

to this:

    [Desktop Entry]
    Name=Jotty
    Comment=Jotty application
    Categories=GNOME;Office;
    Exec=jotty
    Icon=jotty
    Terminal=false
    Type=Application

There are lots more categories that you can use, all defined by the FreeDesktop spec. You can see the complete list in the menu spec.

## Edit Setup.py

Finally, you should include some information in the setup.py file to tell your users a little about yourself. The setup.py file was created for you, just like the desktop file. Most of of the setup.py file shouldn't be modified, as it is just boiler plate that makes your application work properly after it has been installed. However, there is a section at the bottom of the setup.py file that you should edit to describe yourself and the application.

So I would change this section:

    DistUtilsExtra.auto.setup(
        name='jotty',
        version='0.1',
        license='GPL-3',
        #author='Your Name',
        #author_email='email@ubuntu.com',
        #description='UI for managing …',
        #long_description='Here a longer description',
        #url='https://launchpad.net/jotty',
        cmdclass={'install': InstallAndUpdateDataDirectory}
        )

To look like this:

    DistUtilsExtra.auto.setup(
        name='jotty',
        version='0.1',
        license='GPL-3',
        author='Rick Spencer',
        author_email='rick.spencer@canonical.com',
        description='Note taking application',
        long_description='Note taking application that uses CouchDB as the backend.',
        #url='https://launchpad.net/jotty',
        cmdclass={'install': InstallAndUpdateDataDirectory}
        )

Note that the license has already been set up for you, author and author_email are updated each time you connect to Launchpad (with quickly release or quickly share) with your Launchpad real name and preferred email adress.

Notice that Jotty doesn't have a web page yet, so I just left that line commented out. Also, you don't have to increment the version number as quickly share and quickly release commands will do that for you.

## Create and Test the Debian Archive

After personalizing the project, we are now ready to create the package. This is easily done by issuing the package command:

    quickly package

This command will take a little while to discover dependencies and create all the required archives, etc... It will also report some errors as we haven't created a PGP key, for instance. Nonetheless, when it is done, the package will be created. Using the file browser, you can see the created package next to the project directory:

Right now, the specific file we are interested in is "jotty_0.1_all.deb". To test it out, double click on it to open it in the Ubuntu Software Center:

Click "Install" to see how it installs onto your desktop. After chugging for a bit, you'll see that it is installed in the Applications Office category. If you customized your icon, you'll see that the it uses your custom icon as well.

## Now that you have a package

Now that you've packaged your application, you can share the .deb file. However, if your users install your application this way, and you update the application, your users will have to find this out and reinstall the newer version themselves. This hassle can be avoided in Ubuntu by using Personal Package Archives (or PPAs). Distrubuting your applications in this manner is covered in section 4 (not yet available).

## Quickly: Quickly Command Reference

The ubuntu-application template template contains the following commands.

- createcreate
- dialogadd dialog
- editedit
- designdesign
- helphelp
- licenselicense
- packagepackage
- releaserelease
- runrun
- savesave
- shareshare

### create

Usage:

    quickly create ubuntu-application path/to/project_name

where "project_name" is one or more words separated by an underscore and path/to can be any existing path.

This will create and run a new project, including Python code, Glade files, and packaging files to make the project work. After creating the project, get started by:

- Changing your working directory to the new project:

      cd path/to/project_name

- Edit the UI with Glade:

      quickly design

- Edit the Python code:

      quickly edit

### add dialog

### dialog

Usage:

    quickly add dialog dialog-name

where dialog-name is one or more words seperated with a dash

This will create:

- A subclass of gtk.Dialog called DialogNameDialog in the module DialogNameDialog.py

- A Glade file called DialogNameDialog.ui in the ui directory

- A catalog file called dialog_name_dialog.xml also in the ui directory

To edit the UI for the dialog, run:

    quickly design

To edit the behavior, run:

    quickly edit

To use the dialog you have to invoke it from another python file:

-     Import the dialog
      import DialogNameDialog

-     Create an instance of the dialog
      dialog = DialogNameDialog.NewDialogNameDialog()

-     Run the dialog and hide the dialog
      result = dialog.run()
      dialog.hide()

### edit

Usage:

    quickly edit

A convenience command to open all of your python files in your project directory in your default editor, ready for editing.

### design

Usage:

    quickly design

Opens Glade UI editor so that you can edit the UI for dialogs and windows in your project. Note that you *must* open Glade in this manner for Quickly to work. If you try to open Glade directly, and the open the UI files, Glade will throw errors and won't open the files.

### help

Usage:

    quickly help

Opens a web browser with the help index.

### license

Usage:

    quickly license <Your_Licence=

Adds license to project files. Before using this command, you should:

- run "quickly save" in case something goes wrong

- Edit the file Copyright to include your authorship.

- If you want to put your own Quickly unsupported Licence, remove and replace the tags ### BEGIN AUTOMATIC LICENCE GENERATION and ### END AUTOMATIC LICENCE GENERATION in it by your own licence.

- Executes either

      quickly license

  or

      quickly licence <License=

  where <License= can be either: - GPL-3 (default) - GPL-2

This will modify the Copyright file with the chosen licence (with GPL-3 by default). Updating previous chosen Licence if needed. If you previously removed the tags to add your own licence, it will leave it pristine. If no name is attributed to the Copyright, it will try to retrieve it from Launchpad (in Quickly release or Quickly share command only)

Finally, this will copy the Copyright at the head of every files.

Note that if you don't run Quickly licence before calling Quickly release or Quickly share, this one will execute it for you and guess the copyright holder from your launchpad account if you didn't update it.

### package

Usage:

    quickly package

Creates a debian file (deb) from your project. Before running the package command you can edit the Icon and Category entry of *.desktop.in file, where * is the name of your project.

Note that if you didn't run Quickly release, Quickly share or Quickly change-lp-project you may miss the name, email in setup.py. You can edit them if you don't want to use any of these commands afterwards. Those changes are not a mandatory at all for testing purpose.

### release

Usage:

    quickly release

Posts a release of your project to a PPA on launchpad so that users can install the application on their system.

You can also execute:

    quickly release <release_number=

of you don't want to use current release_number. The release_number must be a number.

    quickly release <release_number=

notes about changes where "notes about changes" is optional text describing what changes were made since the last save

Before running Quickly release, you should: create your account and a project page on http://launchpad.net. You also have to add a PPA to your launchpad account.

Name, email and version setup.py will be automatically changed. (version will be <current_release= and bzr will commit and tagged. Once the release is done, <current_release= will be incremented by 0.1 to be ready for next release.

If you previously used Quickly shared <current_release=~publicX will be dropped to release <current_release= version (<current_release=~publicX <current_release=) You can modify the description and long description if you wish.

You can run

    quickly package

and test your package to make sure it installs as expected. (This is not mandatory)

### run

Usage:

    quickly run

Runs your application. This is the best way to try test it out while you are developing it. It starts up the main project window.

### save

Usage:

    quickly save notes about changes

where "notes about changes" is optional text describing what changes were made since the last save.

This command commits all changes since the last save to bzr. Note that it does not push changes to any back up location. If you need revert or otherwise use the revision control, use bzr directly:

    bzr help

Before running "save" for the first time, you should tell bzr who you are:

    bzr whoami "My Name <my@email.com>"

### share

Usage:

    quickly share

Updates your PPA with the the latest saved project changes.

Before running Quickly release, you should: create your account on http://launchpad.net. You also have to add a PPA to your launchpad account.

Name, email and version setup.py will be automatically changed. (version will be <current_release~publicX= where X will be incremented at each Quickly share execution) You can modify the description and long description if you wish.

## Links

- Ubuntu App Developer portal

- Blog series on Quickly

- Language: Python Language Reference

- Core Library: Python 2.7 Library Reference

- UI Library: Python GTK+ 3 Tutorial

- UI Editing: Glade User Documentation
- Editor: Gedit Help
- Version Control: Bazaar