[pitivi: 2/19] Check in and distribute new files for PiTiVi sartup wizard



commit 56c700c33bbd660771eab59632ee58f88aa54e3a
Author: Mathieu Duponchelle <seeed laposte net>
Date:   Tue Nov 16 11:03:56 2010 +0000

    Check in and distribute new files for PiTiVi sartup wizard

 pitivi/ui/Makefile.am         |    4 +-
 pitivi/ui/startupwizard.glade |  142 +++++++++++++++++++++++++++++++++++++++++
 pitivi/ui/startupwizard.py    |   67 +++++++++++++++++++
 3 files changed, 212 insertions(+), 1 deletions(-)
---
diff --git a/pitivi/ui/Makefile.am b/pitivi/ui/Makefile.am
index eaf29eb..a3e33c2 100644
--- a/pitivi/ui/Makefile.am
+++ b/pitivi/ui/Makefile.am
@@ -28,6 +28,7 @@ ui_PYTHON =			\
 	ruler.py		\
 	screencast_managerdialog.py \
 	sourcelist.py		\
+	startupwizard.py 	\
 	timelinecanvas.py	\
 	timelinecontrols.py	\
 	timeline.py		\
@@ -52,7 +53,8 @@ ui_DATA =				\
 	net_capture.glade		\
 	projectsettings.glade		\
 	pluginmanagerdialog.glade	\
-	screencast_manager.glade
+	screencast_manager.glade	\
+	startupwizard.glade
 
 clean-local:
 	rm -rf *.pyc *.pyo
diff --git a/pitivi/ui/startupwizard.glade b/pitivi/ui/startupwizard.glade
new file mode 100644
index 0000000..b291146
--- /dev/null
+++ b/pitivi/ui/startupwizard.glade
@@ -0,0 +1,142 @@
+<?xml version="1.0"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy project-wide -->
+  <object class="GtkWindow" id="window1">
+    <property name="visible">True</property>
+    <property name="border_width">10</property>
+    <property name="title" translatable="yes">Startup Wizard</property>
+    <property name="resizable">False</property>
+    <property name="modal">True</property>
+    <property name="window_position">center</property>
+    <property name="type_hint">dialog</property>
+    <property name="skip_taskbar_hint">True</property>
+    <signal name="destroy_event" handler="_quitWizardCb"/>
+    <child>
+      <object class="GtkHBox" id="hbox2">
+        <property name="visible">True</property>
+        <property name="spacing">12</property>
+        <child>
+          <object class="GtkVBox" id="vbox1">
+            <property name="visible">True</property>
+            <child>
+              <object class="GtkLabel" id="label1">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">Double-click a project below to load it:</property>
+              </object>
+              <packing>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkRecentChooserWidget" id="recentchooser2">
+                <property name="width_request">300</property>
+                <property name="height_request">200</property>
+                <property name="visible">True</property>
+                <property name="sort_type">mru</property>
+                <property name="show_tips">True</property>
+                <property name="show_not_found">False</property>
+                <property name="limit">6</property>
+                <signal name="item_activated" handler="_loadCb"/>
+                <signal name="selection_changed" handler="_getFileNameCb"/>
+              </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkVButtonBox" id="vbuttonbox2">
+            <property name="visible">True</property>
+            <property name="spacing">14</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="button1">
+                <property name="label" translatable="yes">Start new project...</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <signal name="clicked" handler="_newProjectCb"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button7">
+                <property name="label" translatable="yes">Quick start manual</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <signal name="clicked" handler="_quick_start_manual"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button8">
+                <property name="label" translatable="yes">Browse projects...</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <signal name="clicked" handler="_onBrowseButtonClickedCb"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkHSeparator" id="hseparator1">
+                <property name="visible">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">3</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button2">
+                <property name="label" translatable="yes">Skip</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <signal name="clicked" handler="_quitWizardCb"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="pack_type">end</property>
+                <property name="position">4</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+  <object class="GtkVPaned" id="vpaned2">
+    <property name="visible">True</property>
+    <property name="can_focus">True</property>
+    <child>
+      <placeholder/>
+    </child>
+    <child>
+      <placeholder/>
+    </child>
+  </object>
+</interface>
diff --git a/pitivi/ui/startupwizard.py b/pitivi/ui/startupwizard.py
new file mode 100644
index 0000000..8a32b94
--- /dev/null
+++ b/pitivi/ui/startupwizard.py
@@ -0,0 +1,67 @@
+"""Dialog box to quickstart Pitivi"""
+
+import os
+import gtk
+import webbrowser
+
+from pitivi.configure import LIBDIR
+from projectsettings import ProjectSettingsDialog
+from pitivi.configure import APPMANUALURL
+
+from urllib import unquote
+class StartUpWizard:
+    """A Wizard displaying recent projects and allowing the user to either:
+
+     load one, skip,see the quick start manual or
+
+     configure a new project with the settings dialog.
+
+     """
+    def __init__(self, app):
+        if 'pitivi.exe' in __file__.lower():
+            glade_dir = LIBDIR
+        else:
+            glade_dir = os.path.dirname(os.path.abspath(__file__))
+        self.app = app
+        self.builder = gtk.Builder()
+        gladefile = os.path.join(glade_dir, "startupwizard.glade")
+        self.builder.add_from_file(gladefile)
+        self.builder.connect_signals(self)
+
+        chooser = self.builder.get_object("recentchooser2")
+        #FIXME useless combobox
+        filtre = gtk.RecentFilter()
+        filtre.set_name("Projects")
+        filtre.add_pattern("*.xptv")
+        chooser.add_filter(filtre)
+        chooser.get_children()[0].get_children()[1].\
+        get_children()[0].hide()
+        
+
+    def _newProjectCb(self, unused_button4):
+        self.quit()
+        ProjectSettingsDialog(self.app.gui, self.app.current).show()
+
+    def _loadCb(self, unused_button3):
+        self.data = unquote(self.data)
+        self.app.projectManager.connect("new-project-loaded",self.app.gui.
+                _quitWizardCb)
+        self.app.projectManager.loadProject(self.data)
+
+    def _onBrowseButtonClickedCb(self, unused_button6):
+        self.app.projectManager.connect("new-project-loaded",self.app.gui.
+                    _quitWizardCb)
+        self.app.gui.openProject()
+
+    def _getFileNameCb(self, chooser):
+        self.data = chooser.get_current_uri()
+        return self.data
+
+    def _quick_start_manual(self, unused_button5):
+        webbrowser.open(APPMANUALURL)
+
+    def _quitWizardCb(self,unused_button2):
+        self.quit()
+
+    def quit(self):
+        self.builder.get_object("window1").destroy()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]