[orca/orca-gnome3: 31/87] Added a plugins page in orca preferences dialog



commit 6c97a0ca80cb01034ccf40d37cab8019d678d36d
Author: Javier Hernández Antúnez <jhernandez emergya es>
Date:   Wed Mar 23 13:38:12 2011 +0100

    Added a plugins page in orca preferences dialog

 src/orca/orca-setup.ui     |   48 +++++++++++---------------------
 src/orca/orca_gui_prefs.py |   65 ++++++++++++++++++++++++++++++++-----------
 2 files changed, 65 insertions(+), 48 deletions(-)
---
diff --git a/src/orca/orca-setup.ui b/src/orca/orca-setup.ui
index 2e53cc6..cf72d5f 100644
--- a/src/orca/orca-setup.ui
+++ b/src/orca/orca-setup.ui
@@ -3,14 +3,14 @@
   <!-- interface-requires gtk+ 2.12 -->
   <!-- interface-naming-policy toplevel-contextual -->
   <object class="GtkAdjustment" id="adjustment1">
-    <property name="value">5</property>
     <property name="upper">10</property>
+    <property name="value">5</property>
     <property name="step_increment">0.10000000149</property>
     <property name="page_increment">1</property>
   </object>
   <object class="GtkAdjustment" id="adjustment10">
-    <property name="value">1</property>
     <property name="upper">20</property>
+    <property name="value">1</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
@@ -27,16 +27,16 @@
     <property name="page_increment">0.25</property>
   </object>
   <object class="GtkAdjustment" id="adjustment13">
-    <property name="value">1</property>
     <property name="lower">24</property>
     <property name="upper">256</property>
+    <property name="value">1</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
   <object class="GtkAdjustment" id="adjustment14">
-    <property name="value">1</property>
     <property name="lower">1</property>
     <property name="upper">256</property>
+    <property name="value">1</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
@@ -46,55 +46,55 @@
     <property name="page_increment">10</property>
   </object>
   <object class="GtkAdjustment" id="adjustment2">
-    <property name="value">50</property>
     <property name="upper">100</property>
+    <property name="value">50</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
   <object class="GtkAdjustment" id="adjustment3">
-    <property name="value">10</property>
     <property name="upper">10</property>
+    <property name="value">10</property>
     <property name="step_increment">0.10000000149</property>
     <property name="page_increment">1</property>
   </object>
   <object class="GtkAdjustment" id="adjustment4">
-    <property name="value">10</property>
     <property name="upper">9999</property>
+    <property name="value">10</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
   <object class="GtkAdjustment" id="adjustment5">
-    <property name="value">1</property>
     <property name="lower">1</property>
     <property name="upper">16</property>
+    <property name="value">1</property>
     <property name="step_increment">0.25</property>
     <property name="page_increment">1</property>
   </object>
   <object class="GtkAdjustment" id="adjustment6">
-    <property name="value">1</property>
     <property name="lower">1</property>
     <property name="upper">9999</property>
+    <property name="value">1</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
   <object class="GtkAdjustment" id="adjustment7">
-    <property name="value">1</property>
     <property name="lower">1</property>
     <property name="upper">9999</property>
+    <property name="value">1</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
   <object class="GtkAdjustment" id="adjustment8">
-    <property name="value">1</property>
     <property name="lower">1</property>
     <property name="upper">9999</property>
+    <property name="value">1</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
   <object class="GtkAdjustment" id="adjustment9">
-    <property name="value">1</property>
     <property name="lower">1</property>
     <property name="upper">9999</property>
+    <property name="value">1</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
@@ -273,8 +273,6 @@
     <columns>
       <!-- column-name active -->
       <column type="gboolean"/>
-      <!-- column-name icon -->
-      <column type="GdkPixbuf"/>
       <!-- column-name plugin -->
       <column type="gchararray"/>
       <!-- column-name plugin_type -->
@@ -2837,8 +2835,8 @@
                                                             <property name="climb_rate">1</property>
                                                             <property name="numeric">True</property>
                                                             <accessibility>
-                                                            <relation type="labelled-by" target="magCrossHairSizeLabel"/>
                                                             <relation type="labelled-by" target="magCrossHairSizeUnitsLabel"/>
+                                                            <relation type="labelled-by" target="magCrossHairSizeLabel"/>
                                                             </accessibility>
                                                             <signal name="value_changed" handler="magCrossHairSizeValueChanged"/>
                                                           </object>
@@ -3041,8 +3039,8 @@
                                                             <property name="climb_rate">1</property>
                                                             <property name="numeric">True</property>
                                                             <accessibility>
-                                                            <relation type="labelled-by" target="magCursorSizeLabel"/>
                                                             <relation type="labelled-by" target="magCursorSizeUnitsLabel"/>
+                                                            <relation type="labelled-by" target="magCursorSizeLabel"/>
                                                             </accessibility>
                                                             <signal name="value_changed" handler="magCursorSizeValueChanged"/>
                                                           </object>
@@ -3620,8 +3618,8 @@
                                                     <property name="climb_rate">1</property>
                                                     <property name="numeric">True</property>
                                                     <accessibility>
-                                                      <relation type="labelled-by" target="magEdgeMarginUnitsLabel"/>
                                                       <relation type="labelled-by" target="magEdgeMarginLabel"/>
+                                                      <relation type="labelled-by" target="magEdgeMarginUnitsLabel"/>
                                                     </accessibility>
                                                     <signal name="value_changed" handler="magEdgeMarginValueChanged"/>
                                                   </object>
@@ -4333,23 +4331,12 @@ attributes&lt;/b&gt;</property>
                                           </object>
                                         </child>
                                         <child>
-                                          <object class="GtkTreeViewColumn" id="Icono">
-                                            <property name="title">Icono</property>
-                                            <child>
-                                              <object class="GtkCellRendererPixbuf" id="icon_cell"/>
-                                              <attributes>
-                                                <attribute name="pixbuf">1</attribute>
-                                              </attributes>
-                                            </child>
-                                          </object>
-                                        </child>
-                                        <child>
                                           <object class="GtkTreeViewColumn" id="Nombre">
                                             <property name="title">Nombre</property>
                                             <child>
                                               <object class="GtkCellRendererText" id="plugin_cell"/>
                                               <attributes>
-                                                <attribute name="text">2</attribute>
+                                                <attribute name="text">1</attribute>
                                               </attributes>
                                             </child>
                                           </object>
@@ -4360,7 +4347,7 @@ attributes&lt;/b&gt;</property>
                                             <child>
                                               <object class="GtkCellRendererText" id="plugin_type"/>
                                               <attributes>
-                                                <attribute name="text">3</attribute>
+                                                <attribute name="text">2</attribute>
                                               </attributes>
                                             </child>
                                           </object>
@@ -4553,7 +4540,6 @@ attributes&lt;/b&gt;</property>
     <property name="skip_taskbar_hint">True</property>
     <property name="skip_pager_hint">True</property>
     <property name="transient_for">orcaSetupWindow</property>
-    <property name="has_separator">False</property>
     <property name="program_name">Glade</property>
     <child internal-child="vbox">
       <object class="GtkVBox" id="dialog-vbox3">
diff --git a/src/orca/orca_gui_prefs.py b/src/orca/orca_gui_prefs.py
index 38f9b68..8be7bd7 100644
--- a/src/orca/orca_gui_prefs.py
+++ b/src/orca/orca_gui_prefs.py
@@ -56,10 +56,11 @@ import orca_gui_profile
 
 _settingsManager = getattr(orca, '_settingsManager')
 _scriptManager = getattr(orca, '_scriptManager')
+_pluginManager = getattr(orca, '_pluginManager')
 
 # needed to fill the graphical treeview
-import pluglib
-from pluglib.plugin_manager import plugmanager
+#import pluglib
+#from pluglib.plugin_manager import plugmanager
 
 try:
     import louis
@@ -521,7 +522,12 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
         keyBindingsDict = self.getKeyBindingsModelDict(self.keyBindingsModel)
         if _settingsManager.saveSettings(self.prefsDict,
                                          pronunciationDict,
-                                         keyBindingsDict):
+                                         keyBindingsDict,
+                                         # jhernandez TODO nacho's
+                                         # this dict is provisional
+                                         #
+                                         self.currentPluginsStatus):
+
             self._presentMessage(
                 _("Accessibility support for GNOME has just been enabled."))
             self._presentMessage(
@@ -2240,11 +2246,27 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
 
     def _initPluginsTreeView(self):
 
-        for plugin_id, plugin, plugin_type, registered, plugin_name in plugmanager.get_plugins():
-            if plugin_name != None:
-                self.plugins_store.append([plugmanager.is_plugin_enabled(plugin_id),
-                                           None, plugin_name, plugin_type,
-                                           registered, plugin_id])
+        self.plugins_store.clear()
+        self.currentPluginsStatus = plugins = \
+            _settingsManager.getPlugins(self.prefsDict.get('activeProfile')[0])
+        for plug in plugins:
+            type_str = ''
+            for type in plugins[plug]['type']:
+                if len(type_str) > 0:
+                    type_str += ', '
+                type_str += type
+            self.plugins_store.append([plugins[plug]['active'], \
+                                       plugins[plug]['name'], \
+                                       type_str, None, plug])
+
+# nacho's
+#        for plugin_id, plugin, plugin_type, registered, \
+#                plugin_name in plugins:
+#            if plugin_name != None:
+#                self.plugins_store.append([ \
+#                        plugmanager.is_plugin_enabled(plugin_id), \
+#                        None, plugin_name, plugin_type, \
+#                        registered, plugin_id])
 
     def on_plugabout_btn_clicked(self, button):
         selection = self.plugins_tree.get_selection()
@@ -2275,9 +2297,10 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
         selection = self.plugins_tree.get_selection()
         model, selected = selection.get_selected()
 
-        if selected:
-            plugin = plugmanager.get_plugin_class(model[selected][5])
-            self.plugconf_btn.set_sensitive(pluglib.verify_conf_dialog(plugin))
+# nacho's
+#        if selected:
+#            plugin = plugmanager.get_plugin_class(model[selected][5])
+#            self.plugconf_btn.set_sensitive(pluglib.verify_conf_dialog(plugin))
 
     def on_plugconf_btn_clicked(self, button):
         selection = self.plugins_tree.get_selection()
@@ -2290,14 +2313,20 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
 
     def on_active_cell_toggled(self, checkbox, path):
         active = not checkbox.get_active()
-        plugin_name = self.plugins_store[path][5]
-
-        if active:
-            plugmanager.enable_plugin(plugin_name)
+        plugin_name = self.plugins_store[path][4]
+        self.currentPluginsStatus[plugin_name]['active'] = active
+        self.plugins_store[path][0] = active
+        if active == True:
+            _pluginManager.enable_plugin(plugin_name)
         else:
-            plugmanager.disable_plugin(plugin_name)
+            _pluginManager.disable_plugin(plugin_name)
 
-        self.plugins_store[path][0] = active
+# nacho's
+#        if active:
+#            self.currentPluginsStatus[plugin_name]
+#        else:
+#            self.currentPluginsStatus[plugin_name]
+#        self.plugins_store[path][0] = checkbox.get_active()
 
 
     def __initProfileCombo(self):
@@ -4709,6 +4738,8 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
 
         self.__initProfileCombo()
 
+        self._initPluginsTreeView()
+
 
 class OrcaAdvancedMagGUI(OrcaSetupGUI):
 



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