~timo-jyrinki/ubuntu/trusty/pitivi/backport_utopic_fixes

« back to all changes in this revision

Viewing changes to pitivi/ui/startupwizard.py

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2011-05-26 15:29:58 UTC
  • mfrom: (3.1.20 experimental)
  • Revision ID: james.westby@ubuntu.com-20110526152958-90je1myzzjly26vw
Tags: 0.13.9.90-1ubuntu1
* Resynchronize on Debian
* debian/control:
  - Depend on python-launchpad-integration
  - Drop hal from Recommends to Suggests. This version has the patch applied
    to not crash without hal.
* debian/patches/01_lpi.patch:
  - launchpad integration  
* debian/rules:
  - Use gnome.mk so a translation template is built

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
"""Dialog box to quickstart Pitivi"""
 
2
 
 
3
import os
 
4
import gtk
 
5
import webbrowser
 
6
 
 
7
from pitivi.configure import LIBDIR
 
8
from projectsettings import ProjectSettingsDialog
 
9
from pitivi.configure import APPMANUALURL
 
10
 
 
11
from urllib import unquote
 
12
 
 
13
class StartUpWizard(object):
 
14
    """A Wizard displaying recent projects and allowing the user to either:
 
15
 
 
16
    load one, skip,see the quick start manual or
 
17
 
 
18
    configure a new project with the settings dialog.
 
19
 
 
20
    """
 
21
 
 
22
    def __init__(self, app):
 
23
        if 'pitivi.exe' in __file__.lower():
 
24
            glade_dir = LIBDIR
 
25
        else:
 
26
            glade_dir = os.path.dirname(os.path.abspath(__file__))
 
27
        self.app = app
 
28
        self.builder = gtk.Builder()
 
29
        gladefile = os.path.join(glade_dir, "startupwizard.glade")
 
30
        self.builder.add_from_file(gladefile)
 
31
        self.builder.connect_signals(self)
 
32
 
 
33
        self.window = self.builder.get_object("window1")
 
34
        self.window.connect("key-press-event", self._keypressCb)
 
35
 
 
36
        chooser = self.builder.get_object("recentchooser2")
 
37
        # FIXME: gtk creates a combo box with only one item, but there is no
 
38
        # simple way to hide it.
 
39
        filtre = gtk.RecentFilter()
 
40
        filtre.set_name("Projects")
 
41
        filtre.add_pattern("*.xptv")
 
42
        chooser.add_filter(filtre)
 
43
 
 
44
    def _newProjectCb(self, unused_button4):
 
45
        self.hide()
 
46
        self.app.gui.showProjectSettingsDialog()
 
47
 
 
48
    def _loadCb(self, unused_button3):
 
49
        self.data = unquote(self.data)
 
50
        self.app.projectManager.loadProject(self.data)
 
51
 
 
52
    def _keypressCb(self, widget, event):
 
53
        if event.keyval == gtk.keysyms.Escape:  # If the user presses "Esc"
 
54
            self.hide()
 
55
 
 
56
    def _onBrowseButtonClickedCb(self, unused_button6):
 
57
        self.app.gui.openProject()
 
58
 
 
59
    def _getFileNameCb(self, chooser):
 
60
        self.data = chooser.get_current_uri()
 
61
        return self.data
 
62
 
 
63
    def _quick_start_manual(self, unused_button5):
 
64
        webbrowser.open(APPMANUALURL)
 
65
 
 
66
    def _dialogCloseCb(self, unused_widget):
 
67
        self.hide()
 
68
 
 
69
    def show(self):
 
70
        self.window.set_transient_for(self.app.gui)
 
71
        self.window.show()
 
72
        self.window.grab_focus()
 
73
 
 
74
    def hide(self):
 
75
        self.window.hide()