[Debian-live-changes] r2468 - in dists/trunk/live-magic: . glade livemagic/controllers livemagic/views

lamby-guest at alioth.debian.org lamby-guest at alioth.debian.org
Thu Jul 12 21:36:51 UTC 2007


Author: lamby-guest
Date: 2007-07-12 21:36:51 +0000 (Thu, 12 Jul 2007)
New Revision: 2468

Added:
   dists/trunk/live-magic/livemagic/controllers/wizard.py
   dists/trunk/live-magic/livemagic/views/wizard.py
Modified:
   dists/trunk/live-magic/glade/main.glade
   dists/trunk/live-magic/live-magic
   dists/trunk/live-magic/livemagic/controllers/__init__.py
   dists/trunk/live-magic/livemagic/controllers/build.py
   dists/trunk/live-magic/livemagic/controllers/main.py
   dists/trunk/live-magic/livemagic/views/__init__.py
   dists/trunk/live-magic/livemagic/views/build.py
   dists/trunk/live-magic/livemagic/views/main.py
Log:


Modified: dists/trunk/live-magic/glade/main.glade
===================================================================
--- dists/trunk/live-magic/glade/main.glade	2007-07-12 19:56:49 UTC (rev 2467)
+++ dists/trunk/live-magic/glade/main.glade	2007-07-12 21:36:51 UTC (rev 2468)
@@ -2934,7 +2934,7 @@
           <widget class="GtkLabel" id="label80">
             <property name="visible">True</property>
             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-            <property name="label" translatable="yes">Welcome to Debian Live Magic</property>
+            <property name="label" translatable="yes">Welcome to Debian Live Magic!</property>
           </widget>
           <packing>
             <property name="type">tab</property>
@@ -2970,7 +2970,7 @@
                       <widget class="GtkLabel" id="label36">
                         <property name="visible">True</property>
                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                        <property name="label" translatable="yes">Choose the type of image you want.</property>
+                        <property name="label" translatable="yes">What type of image would you like?</property>
                       </widget>
                       <packing>
                         <property name="left_attach">1</property>
@@ -3082,7 +3082,7 @@
                               <widget class="GtkLabel" id="label119">
                                 <property name="visible">True</property>
                                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                <property name="label" translatable="yes">Gnome desktop environment</property>
+                                <property name="label" translatable="yes">GNOME desktop environment</property>
                               </widget>
                               <packing>
                                 <property name="position">1</property>
@@ -3347,7 +3347,7 @@
                       <widget class="GtkLabel" id="label74">
                         <property name="visible">True</property>
                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                        <property name="label" translatable="yes">What type of image would you like?</property>
+                        <property name="label" translatable="yes">What media type would you like to target?</property>
                       </widget>
                       <packing>
                         <property name="left_attach">1</property>
@@ -3595,7 +3595,7 @@
                       <widget class="GtkLabel" id="label104">
                         <property name="visible">True</property>
                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                        <property name="label" translatable="yes">What type of machine is your Debian Live system for? (If unsure, select i386.)</property>
+                        <property name="label" translatable="yes">What type of machine is your Debian Live system for? (If unsure, select i386)</property>
                       </widget>
                       <packing>
                         <property name="left_attach">1</property>
@@ -3739,7 +3739,154 @@
           </packing>
         </child>
         <child>
-          <placeholder/>
+          <widget class="GtkVBox" id="vbox19">
+            <property name="visible">True</property>
+            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+            <child>
+              <widget class="GtkVBox" id="vbox20">
+                <property name="visible">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <child>
+                  <widget class="GtkTable" id="table15">
+                    <property name="visible">True</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                    <property name="n_rows">1</property>
+                    <property name="n_columns">2</property>
+                    <child>
+                      <widget class="GtkLabel" id="label83">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                      </widget>
+                      <packing>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options">GTK_FILL</property>
+                        <property name="x_padding">20</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkLabel" id="label77">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="label" translatable="yes">Please choose a mirror.
+
+To select a mirror that is not on the list, simply enter it below.</property>
+                      </widget>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="x_options">GTK_FILL</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="padding">14</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkTable" id="table16">
+                    <property name="visible">True</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                    <property name="n_rows">1</property>
+                    <property name="n_columns">3</property>
+                    <child>
+                      <widget class="GtkComboBoxEntry" id="comboboxentry5">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="items">http://ftp.debian.org/debian
+http://ftp.at.debian.org/debian
+http://ftp.wa.au.debian.org/debian
+http://ftp.au.debian.org/debian
+http://ftp.bg.debian.org/debian
+http://ftp.br.debian.org/debian
+http://ftp.ch.debian.org/debian
+http://ftp.cl.debian.org/debian
+http://ftp.cz.debian.org/debian
+http://ftp.de.debian.org/debian
+http://ftp2.de.debian.org/debian
+http://ftp.dk.debian.org/debian
+http://ftp.ee.debian.org/debian
+http://ftp.es.debian.org/debian
+http://ftp.fi.debian.org/debian
+http://ftp.fr.debian.org/debian
+http://ftp2.fr.debian.org/debian
+http://ftp.hk.debian.org/debian
+http://ftp.hr.debian.org/debian
+http://ftp.hu.debian.org/debian
+http://ftp.ie.debian.org/debian
+http://ftp.is.debian.org/debian
+http://ftp.it.debian.org/debian
+http://ftp.jp.debian.org/debian
+http://ftp2.jp.debian.org/debian
+http://ftp.kr.debian.org/debian
+http://ftp.mx.debian.org/debian
+http://ftp.nl.debian.org/debian
+http://ftp.no.debian.org/debian
+http://ftp.nz.debian.org/debian
+http://ftp.pl.debian.org/debian
+http://ftp.pt.debian.org/debian
+http://ftp.ro.debian.org/debian
+http://ftp.ru.debian.org/debian
+http://ftp.se.debian.org/debian
+http://ftp.si.debian.org/debian
+http://ftp.sk.debian.org/debian
+http://ftp.tr.debian.org/debian
+http://ftp.tw.debian.org/debian
+http://ftp.us.debian.org/debian
+http://ftp.uk.debian.org/debian
+</property>
+                        <child internal-child="entry">
+                          <widget class="GtkEntry" id="comboboxentry-entry5">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                          </widget>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkLabel" id="label90">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                      </widget>
+                      <packing>
+                        <property name="left_attach">2</property>
+                        <property name="right_attach">3</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="x_padding">30</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkLabel" id="label88">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                      </widget>
+                      <packing>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="x_padding">20</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </widget>
+              <packing>
+                <property name="fill">False</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="position">4</property>
+            <property name="tab_expand">False</property>
+          </packing>
         </child>
         <child>
           <widget class="GtkLabel" id="label82">

Modified: dists/trunk/live-magic/live-magic
===================================================================
--- dists/trunk/live-magic/live-magic	2007-07-12 19:56:49 UTC (rev 2467)
+++ dists/trunk/live-magic/live-magic	2007-07-12 21:36:51 UTC (rev 2468)
@@ -19,21 +19,23 @@
     def __setattr__(self, k, v):
         self.__dict__[k] = v
 
-class View(MainView, BuildView, HooksView):
+class View(MainView, BuildView, HooksView, WizardView):
     def __init__(self, controller):
         self.xml = gtk.glade.XML(glade_filename())
         self.controller = controller
         MainView.__init__(self)
         BuildView.__init__(self)
         HooksView.__init__(self)
+        WizardView.__init__(self)
         self.xml.signal_autoconnect(self.controller)
 
-class Controller(MainController, BuildController, HooksController):
-    def __init__(self, model):
+class Controller(MainController, BuildController, HooksController, WizardController):
+    def __init__(self, model, args):
         self.model = model
-        MainController.__init__(self)
+        MainController.__init__(self, args)
         BuildController.__init__(self)
         HooksController.__init__(self)
+        WizardController.__init__(self)
 
 def glade_filename():
     suffix = "main.glade"
@@ -48,50 +50,9 @@
             return path
 
 if __name__ == "__main__":
-    if "wizard" in sys.argv:
-        xml = gtk.glade.XML(glade_filename())
-        asst = gtk.Assistant()
-        asst.set_title('Debian Live Magic')
-        asst.set_default_size(640, 480)
+    m = Model()
+    c = Controller(m, sys.argv[1:])
+    v = View(c)
+    c.ready()
 
-        asst.connect('close', lambda _: gtk.main_quit())
-        asst.connect('delete_event', lambda _, __: gtk.main_quit())
-
-
-        vbox = gtk.HBox(spacing=4)
-        label = gtk.Label('Expert mode')
-        label.show()
-        image = gtk.Image()
-        image.set_from_stock(gtk.STOCK_EDIT, gtk.ICON_SIZE_BUTTON)
-        image.show()
-        vbox.add(image)
-        vbox.add(label)
-        vbox.show()
-        btn = gtk.Button()
-        btn.add(vbox)
-        btn.show()
-        asst.add_action_widget(btn)
-
-        notebook = xml.get_widget('notebook_wizard')
-        page_types = [gtk.ASSISTANT_PAGE_INTRO] + \
-            [gtk.ASSISTANT_PAGE_CONTENT] * (notebook.get_n_pages() - 2) + \
-            [gtk.ASSISTANT_PAGE_CONFIRM]
-
-        for i in range(notebook.get_n_pages()):
-            page = notebook.get_nth_page(i)
-            page.unparent()
-            asst.append_page(page)
-            asst.set_page_complete(page, True)
-            asst.set_page_type(page, page_types[i])
-
-            asst.set_page_title(page, notebook.get_tab_label_text(page))
-
-        asst.show()
-
-    else:
-        m = Model()
-        c = Controller(m)
-        v = View(c)
-        c.ready()
-
     gtk.main()

Modified: dists/trunk/live-magic/livemagic/controllers/__init__.py
===================================================================
--- dists/trunk/live-magic/livemagic/controllers/__init__.py	2007-07-12 19:56:49 UTC (rev 2467)
+++ dists/trunk/live-magic/livemagic/controllers/__init__.py	2007-07-12 21:36:51 UTC (rev 2468)
@@ -1,3 +1,4 @@
 from build import *
 from main import *
 from hooks import *
+from wizard import *

Modified: dists/trunk/live-magic/livemagic/controllers/build.py
===================================================================
--- dists/trunk/live-magic/livemagic/controllers/build.py	2007-07-12 19:56:49 UTC (rev 2467)
+++ dists/trunk/live-magic/livemagic/controllers/build.py	2007-07-12 21:36:51 UTC (rev 2468)
@@ -12,6 +12,9 @@
         if self.model.altered():
             self.model.save()
 
+        self.do_show_build_window(self.set_window_main_sensitive)
+
+    def do_show_build_window(self, build_close_callback):
         # Set initial titles and state
         self.view.set_build_titles("Generating Debian Live system...", \
             "Generating Debian Live system.", \
@@ -20,10 +23,9 @@
         self.view.set_build_status_change(initial=True)
 
         # Show window
-        self.view.do_show_window_build()
+        self.view.do_show_window_build(build_close_callback)
 
         # Fork command
-        cmd = ['gksu', 'sleep 1005']
         cmd = ['gksu', 'lh_build']
         self.pid = self.view.vte_terminal.fork_command(cmd[0], cmd, None, self.model.dir)
 

Modified: dists/trunk/live-magic/livemagic/controllers/main.py
===================================================================
--- dists/trunk/live-magic/livemagic/controllers/main.py	2007-07-12 19:56:49 UTC (rev 2467)
+++ dists/trunk/live-magic/livemagic/controllers/main.py	2007-07-12 21:36:51 UTC (rev 2468)
@@ -2,8 +2,9 @@
 from livemagic.model import KeyVarConfigFile
 
 class MainController(object):
-    def __init__(self):
+    def __init__(self, args):
         self.model.attach_load_observer(self.notify_load)
+        self.args = args
 
     def notify_load(self):
         for child in self.model.children:
@@ -23,6 +24,11 @@
         # Notify all the observers that depend on the model
         self.model.notify_load_observers()
 
+        if len(self.args) == 0:
+            self.view.do_show_wizard()
+        else:
+            self.view.do_show_main_window()
+
     # GTK callbacks
     def on_live_helper_value_changed(self, widget):
         namespace, key = widget.name.split("/")
@@ -84,3 +90,6 @@
 
     def on_about_activate(self, *_):
         self.view.do_show_about_dialog()
+
+    def set_window_main_sensitive():
+        self.view.do_show_main_window(True)

Added: dists/trunk/live-magic/livemagic/controllers/wizard.py
===================================================================
--- dists/trunk/live-magic/livemagic/controllers/wizard.py	                        (rev 0)
+++ dists/trunk/live-magic/livemagic/controllers/wizard.py	2007-07-12 21:36:51 UTC (rev 2468)
@@ -0,0 +1,14 @@
+
+class WizardController(object):
+
+    def on_wizard_apply(self, _):
+        self.view.do_hide_wizard()
+        self.do_show_build_window(self.on_wizard_build_completed)
+
+    def on_wizard_expert_mode_selected(self, _):
+        self.view.do__wizard()
+        self.view.do_show_main_window()
+
+    def on_wizard_build_completed(self):
+        import gtk
+        gtk.main_quit()

Modified: dists/trunk/live-magic/livemagic/views/__init__.py
===================================================================
--- dists/trunk/live-magic/livemagic/views/__init__.py	2007-07-12 19:56:49 UTC (rev 2467)
+++ dists/trunk/live-magic/livemagic/views/__init__.py	2007-07-12 21:36:51 UTC (rev 2468)
@@ -1,3 +1,4 @@
 from build import *
 from main import *
 from hooks import *
+from wizard import *

Modified: dists/trunk/live-magic/livemagic/views/build.py
===================================================================
--- dists/trunk/live-magic/livemagic/views/build.py	2007-07-12 19:56:49 UTC (rev 2467)
+++ dists/trunk/live-magic/livemagic/views/build.py	2007-07-12 21:36:51 UTC (rev 2468)
@@ -5,7 +5,8 @@
         # Init custom widgets
         self.vte_terminal = None
 
-    def do_show_window_build(self):
+    def do_show_window_build(self, build_close_callback):
+        self.build_close_callback = build_close_callback
         self['window_main'].set_sensitive(False)
 
         # Configure VteTerminal component if necessary
@@ -27,7 +28,7 @@
 
     def do_hide_window_build(self):
         self['window_build'].hide()
-        self['window_main'].set_sensitive(True)
+        self.build_close_callback()
 
     def set_build_titles(self, title, heading, subheading):
         self['window_build'].set_title(title)

Modified: dists/trunk/live-magic/livemagic/views/main.py
===================================================================
--- dists/trunk/live-magic/livemagic/views/main.py	2007-07-12 19:56:49 UTC (rev 2467)
+++ dists/trunk/live-magic/livemagic/views/main.py	2007-07-12 21:36:51 UTC (rev 2468)
@@ -7,7 +7,6 @@
 
         # Hide tabs
         self['notebook'].set_show_tabs(False)
-        self['window_main'].show()
 
     def __getitem__(self, key):
         widget = self.xml.get_widget(key)
@@ -23,7 +22,12 @@
         return True
 
     # Application-specific calls
+    def do_show_main_window(self):
+        self['window_main'].show()
 
+    def do_set_window_main_sensitive(self, sensitivity):
+        self['window_build'].set_sensitive(sensitivity)
+
     def do_select_section(self, button):
         # Move to new section tab
         _, _, name = button.get_name().split('_')

Added: dists/trunk/live-magic/livemagic/views/wizard.py
===================================================================
--- dists/trunk/live-magic/livemagic/views/wizard.py	                        (rev 0)
+++ dists/trunk/live-magic/livemagic/views/wizard.py	2007-07-12 21:36:51 UTC (rev 2468)
@@ -0,0 +1,56 @@
+import gtk
+
+class WizardView(object):
+    def __init__(self):
+        self.asst = self.construct_assistant()
+
+    def do_show_wizard(self):
+        self.asst.show()
+
+    def do_hide_wizard(self):
+        self.asst.set_sensitive(False)
+
+    def construct_assistant(self):
+        asst = gtk.Assistant()
+        asst.set_title('Debian Live Magic')
+        asst.set_default_size(640, 480)
+
+        asst.connect('apply', self.controller.on_wizard_apply)
+        asst.connect('cancel', lambda _: gtk.main_quit())
+
+        label = gtk.Label('Expert mode')
+        label.show()
+
+        image = gtk.Image()
+        image.set_from_stock(gtk.STOCK_EDIT, gtk.ICON_SIZE_BUTTON)
+        image.show()
+
+        vbox = gtk.HBox(spacing=4)
+        vbox.add(label)
+        vbox.add(image)
+        vbox.show()
+
+        btn = gtk.Button()
+        btn.add(vbox)
+        btn.connect('clicked', self.controller.on_wizard_expert_mode_selected)
+        btn.show()
+
+        asst.add_action_widget(btn)
+
+        # Don't construct to pages of the gtk.Assistant manually, load
+        # them from the Glade resource file.
+        notebook = self['notebook_wizard']
+        page_types = [gtk.ASSISTANT_PAGE_INTRO] + \
+            [gtk.ASSISTANT_PAGE_CONTENT] * (notebook.get_n_pages() - 2) + \
+            [gtk.ASSISTANT_PAGE_CONFIRM]
+
+        for i in range(notebook.get_n_pages()):
+            page = notebook.get_nth_page(i)
+            page.unparent()
+            asst.append_page(page)
+            asst.set_page_complete(page, True)
+            asst.set_page_type(page, page_types[i])
+
+            asst.set_page_title(page, notebook.get_tab_label_text(page))
+
+        return asst




More information about the Debian-live-changes mailing list