[wiican] CRUD mapping buttons translated to toolbar buttons Changed homepage



commit 9e6c4cee8c3d9b8b18f0ae6467001c220f68dd96
Author: J. Félix Ontañón <fontanon emergya es>
Date:   Sat Nov 13 11:58:39 2010 +0100

    CRUD mapping buttons translated to toolbar buttons
    Changed homepage

 data/mapping.ui         |  296 ++++++++++++++++++++++++-----------------------
 data/wiimotemanager.ui  |   15 +--
 wiican/ui/managerdlg.py |   34 ++++--
 3 files changed, 179 insertions(+), 166 deletions(-)
---
diff --git a/data/mapping.ui b/data/mapping.ui
index 0aa888d..c2f9e73 100644
--- a/data/mapping.ui
+++ b/data/mapping.ui
@@ -30,226 +30,205 @@
       <object class="GtkVBox" id="dialog-vbox3">
         <property name="visible">True</property>
         <child>
-          <object class="GtkHBox" id="hbox1">
+          <object class="GtkVBox" id="vbox1">
             <property name="visible">True</property>
-            <property name="border_width">5</property>
-            <property name="spacing">6</property>
             <child>
-              <object class="GtkVBox" id="vbox1">
+              <object class="GtkToolbar" id="toolbar1">
                 <property name="visible">True</property>
-                <property name="spacing">6</property>
+                <property name="toolbar_style">both</property>
                 <child>
-                  <object class="GtkButton" id="new_btn">
-                    <property name="label">gtk-new</property>
+                  <object class="GtkToolButton" id="toolbutton1">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                    <property name="use_stock">True</property>
-                    <signal name="clicked" handler="new_btn_clicked_cb"/>
+                    <property name="related_action">new_action</property>
+                    <property name="use_action_appearance">True</property>
+                    <property name="label" translatable="yes">toolbutton1</property>
+                    <property name="use_underline">True</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="padding">3</property>
-                    <property name="position">0</property>
+                    <property name="homogeneous">True</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkButton" id="edit_btn">
-                    <property name="label">gtk-edit</property>
+                  <object class="GtkToolButton" id="toolbutton2">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                    <property name="use_stock">True</property>
-                    <signal name="clicked" handler="edit_btn_clicked_cb"/>
+                    <property name="related_action">edit_action</property>
+                    <property name="use_action_appearance">True</property>
+                    <property name="label" translatable="yes">toolbutton2</property>
+                    <property name="use_underline">True</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="padding">3</property>
-                    <property name="position">1</property>
+                    <property name="homogeneous">True</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkButton" id="delete_btn">
-                    <property name="label">gtk-delete</property>
+                  <object class="GtkToolButton" id="toolbutton3">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                    <property name="use_stock">True</property>
-                    <signal name="clicked" handler="delete_btn_clicked_cb"/>
+                    <property name="related_action">delete_action</property>
+                    <property name="use_action_appearance">True</property>
+                    <property name="label" translatable="yes">toolbutton3</property>
+                    <property name="use_underline">True</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="padding">3</property>
-                    <property name="position">2</property>
+                    <property name="homogeneous">True</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkButton" id="import_btn">
-                    <property name="label" translatable="yes">_Import</property>
+                  <object class="GtkSeparatorToolItem" id="toolbutton6">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                    <property name="image">image3</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="homogeneous">True</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkToolButton" id="toolbutton4">
+                    <property name="visible">True</property>
+                    <property name="related_action">import_action</property>
+                    <property name="use_action_appearance">True</property>
+                    <property name="label" translatable="yes">toolbutton4</property>
                     <property name="use_underline">True</property>
-                    <signal name="clicked" handler="import_btn_clicked_cb"/>
                   </object>
                   <packing>
                     <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="padding">3</property>
-                    <property name="position">3</property>
+                    <property name="homogeneous">True</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkButton" id="export_btn">
-                    <property name="label" translatable="yes">E_xport</property>
+                  <object class="GtkToolButton" id="toolbutton5">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                    <property name="image">image4</property>
+                    <property name="related_action">export_action</property>
+                    <property name="use_action_appearance">True</property>
+                    <property name="label" translatable="yes">toolbutton5</property>
                     <property name="use_underline">True</property>
-                    <signal name="clicked" handler="export_btn_clicked_cb"/>
                   </object>
                   <packing>
                     <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="padding">3</property>
-                    <property name="position">4</property>
+                    <property name="homogeneous">True</property>
                   </packing>
                 </child>
               </object>
               <packing>
                 <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="padding">10</property>
                 <property name="position">0</property>
               </packing>
             </child>
             <child>
-              <object class="GtkFrame" id="frame1">
+              <object class="GtkHBox" id="hbox1">
                 <property name="visible">True</property>
-                <property name="label_xalign">0</property>
-                <property name="shadow_type">none</property>
+                <property name="border_width">5</property>
+                <property name="spacing">6</property>
                 <child>
-                  <object class="GtkAlignment" id="alignment1">
+                  <object class="GtkScrolledWindow" id="scrolledwindow1">
                     <property name="visible">True</property>
-                    <property name="left_padding">12</property>
+                    <property name="can_focus">True</property>
+                    <property name="hscrollbar_policy">automatic</property>
+                    <property name="vscrollbar_policy">automatic</property>
+                    <property name="shadow_type">in</property>
                     <child>
-                      <object class="GtkScrolledWindow" id="scrolledwindow1">
+                      <object class="GtkTreeView" id="mapping_list">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
-                        <property name="hscrollbar_policy">automatic</property>
-                        <property name="vscrollbar_policy">automatic</property>
+                        <property name="model">mapping_store</property>
+                        <property name="headers_clickable">False</property>
+                        <property name="search_column">1</property>
+                        <property name="tooltip_column">2</property>
+                        <signal name="row_activated" handler="mapping_list_row_activated_cb"/>
+                        <signal name="key_release_event" handler="mapping_list_key_release_event_cb"/>
                         <child>
-                          <object class="GtkTreeView" id="mapping_list">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="model">mapping_store</property>
-                            <property name="headers_clickable">False</property>
-                            <property name="search_column">1</property>
-                            <property name="tooltip_column">2</property>
-                            <signal name="row_activated" handler="mapping_list_row_activated_cb"/>
-                            <signal name="key_release_event" handler="mapping_list_key_release_event_cb"/>
+                          <object class="GtkTreeViewColumn" id="treeviewcolumn3">
+                            <property name="title">Menu</property>
                             <child>
-                              <object class="GtkTreeViewColumn" id="treeviewcolumn3">
-                                <property name="title">Visible</property>
-                                <child>
-                                  <object class="GtkCellRendererToggle" id="visible_cell">
-                                    <signal name="toggled" handler="visible_cell_toggled_cb"/>
-                                  </object>
-                                  <attributes>
-                                    <attribute name="active">3</attribute>
-                                  </attributes>
-                                </child>
+                              <object class="GtkCellRendererToggle" id="visible_cell">
+                                <signal name="toggled" handler="visible_cell_toggled_cb"/>
                               </object>
+                              <attributes>
+                                <attribute name="active">3</attribute>
+                              </attributes>
                             </child>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkTreeViewColumn" id="treeviewcolumn2">
+                            <property name="resizable">True</property>
+                            <property name="title">Name</property>
                             <child>
-                              <object class="GtkTreeViewColumn" id="treeviewcolumn2">
-                                <property name="resizable">True</property>
-                                <property name="title">Name</property>
-                                <child>
-                                  <object class="GtkCellRendererPixbuf" id="icon_cell"/>
-                                  <attributes>
-                                    <attribute name="pixbuf">0</attribute>
-                                  </attributes>
-                                </child>
-                                <child>
-                                  <object class="GtkCellRendererText" id="mappingname_cell"/>
-                                  <attributes>
-                                    <attribute name="markup">1</attribute>
-                                    <attribute name="text">1</attribute>
-                                  </attributes>
-                                </child>
-                              </object>
+                              <object class="GtkCellRendererPixbuf" id="icon_cell"/>
+                              <attributes>
+                                <attribute name="pixbuf">0</attribute>
+                              </attributes>
+                            </child>
+                            <child>
+                              <object class="GtkCellRendererText" id="mappingname_cell"/>
+                              <attributes>
+                                <attribute name="markup">1</attribute>
+                                <attribute name="text">1</attribute>
+                              </attributes>
                             </child>
                           </object>
                         </child>
                       </object>
                     </child>
                   </object>
-                </child>
-                <child type="label">
-                  <object class="GtkLabel" id="label1">
-                    <property name="visible">True</property>
-                    <property name="label" translatable="yes">&lt;b&gt;Mappings&lt;/b&gt;</property>
-                    <property name="use_markup">True</property>
-                  </object>
-                </child>
-              </object>
-              <packing>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkVBox" id="vbox2">
-                <property name="visible">True</property>
-                <property name="spacing">6</property>
-                <child>
-                  <object class="GtkButton" id="up_btn">
-                    <property name="label">gtk-go-up</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                    <property name="use_stock">True</property>
-                    <signal name="clicked" handler="up_btn_clicked_cb"/>
-                  </object>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="padding">3</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkButton" id="down_btn">
-                    <property name="label">gtk-go-down</property>
+                  <object class="GtkVBox" id="vbox3">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                    <property name="use_stock">True</property>
-                    <signal name="clicked" handler="down_btn_clicked_cb"/>
+                    <property name="spacing">6</property>
+                    <child>
+                      <object class="GtkButton" id="up_btn">
+                        <property name="label">gtk-go-up</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="use_stock">True</property>
+                        <signal name="clicked" handler="up_btn_clicked_cb"/>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="padding">3</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkButton" id="down_btn">
+                        <property name="label">gtk-go-down</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="use_stock">True</property>
+                        <signal name="clicked" handler="down_btn_clicked_cb"/>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="padding">3</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">False</property>
-                    <property name="padding">3</property>
+                    <property name="padding">10</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
               </object>
               <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="padding">10</property>
-                <property name="position">2</property>
+                <property name="position">1</property>
               </packing>
             </child>
           </object>
           <packing>
-            <property name="position">2</property>
+            <property name="position">1</property>
           </packing>
         </child>
         <child internal-child="action_area">
@@ -290,14 +269,6 @@
       <action-widget response="-7">close_btn</action-widget>
     </action-widgets>
   </object>
-  <object class="GtkImage" id="image3">
-    <property name="visible">True</property>
-    <property name="icon_name">list-add</property>
-  </object>
-  <object class="GtkImage" id="image4">
-    <property name="visible">True</property>
-    <property name="icon_name">package-x-generic</property>
-  </object>
   <object class="GtkDialog" id="mapping_editor_dlg">
     <property name="width_request">400</property>
     <property name="height_request">550</property>
@@ -714,4 +685,39 @@ Changes will be saved in a new mapping.</property>
     </action-widgets>
   </object>
   <object class="GtkTextBuffer" id="mapping_buffer"/>
+  <object class="GtkAction" id="edit_action">
+    <property name="label">_Edit mapping</property>
+    <property name="short_label">_Edit</property>
+    <property name="tooltip">_Edit mapping properties</property>
+    <property name="stock_id">gtk-edit</property>
+    <signal name="activate" handler="edit_action_activate_cb"/>
+  </object>
+  <object class="GtkAction" id="delete_action">
+    <property name="label">Delete mapping</property>
+    <property name="short_label">Delete</property>
+    <property name="tooltip">Removes the mapping from the catalog</property>
+    <property name="stock_id">gtk-delete</property>
+    <signal name="activate" handler="delete_action_activate_cb"/>
+  </object>
+  <object class="GtkAction" id="import_action">
+    <property name="label">Import mapping</property>
+    <property name="short_label">Import</property>
+    <property name="tooltip">Import a mapping from a .wii file</property>
+    <property name="stock_id">gtk-add</property>
+    <signal name="activate" handler="import_action_activate_cb"/>
+  </object>
+  <object class="GtkAction" id="export_action">
+    <property name="label">_Export mapping</property>
+    <property name="short_label">_Export</property>
+    <property name="tooltip">Export mapping as a .wii file</property>
+    <property name="icon_name">package-x-generic</property>
+    <signal name="activate" handler="export_action_activate_cb"/>
+  </object>
+  <object class="GtkAction" id="new_action">
+    <property name="label">New mapping</property>
+    <property name="short_label">New</property>
+    <property name="tooltip">Creates a new mapping</property>
+    <property name="stock_id">gtk-new</property>
+    <signal name="activate" handler="new_action_activate_cb"/>
+  </object>
 </interface>
diff --git a/data/wiimotemanager.ui b/data/wiimotemanager.ui
index 3b16117..68c1b60 100644
--- a/data/wiimotemanager.ui
+++ b/data/wiimotemanager.ui
@@ -1,4 +1,4 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <requires lib="gtk+" version="2.16"/>
   <!-- interface-naming-policy toplevel-contextual -->
@@ -7,13 +7,13 @@
     <property name="window_position">center</property>
     <property name="destroy_with_parent">True</property>
     <property name="type_hint">normal</property>
-    <property name="program_name">WiiCan</property>
+    <property name="program_name">Wiican</property>
     <property name="version">0.3.1</property>
-    <property name="copyright">2009, 2010 J. F&#xE9;lix Onta&#xF1;&#xF3;n &lt;fontanon emergya es&gt;</property>
+    <property name="copyright">2009, 2010 J. Félix Ontañón &lt;fontanon emergya es&gt;</property>
     <property name="comments" translatable="yes">Yes wii can
 Wiimote usage assistant and mapping manager</property>
-    <property name="website">http://launchpad.net/wiican</property>
-    <property name="website_label">http://launchpad.net/wiican</property>
+    <property name="website">http://fontanon.org/wiican</property>
+    <property name="website_label">http://fontanon.org/wiican</property>
     <property name="license">
 		    GNU GENERAL PUBLIC LICENSE
 		       Version 3, 29 June 2007
@@ -690,8 +690,8 @@ the library.  If this is what you want to do, use the GNU Lesser General
 Public License instead of this License.  But first, please read
 &lt;http://www.gnu.org/philosophy/why-not-lgpl.html&gt;.
 </property>
-    <property name="authors">J. F&#xE9;lix Onta&#xF1;&#xF3;n &lt;fontanon emergya es&gt;</property>
-    <property name="translator_credits" comments="TRANSLATORS: Replace this string with your names, one name per line.">J. F&#xE9;lix Onta&#xF1;&#xF3;n &lt;fontanon emergya es&gt;
+    <property name="authors">J. Félix Ontañón &lt;fontanon emergya es&gt;</property>
+    <property name="translator_credits" comments="TRANSLATORS: Replace this string with your names, one name per line.">J. Félix Ontañón &lt;fontanon emergya es&gt;
 Pierre Slamich &lt;pierre slamich gmail com&gt;
 Siegfried Gevatter &lt;rainct ubuntu com&gt;
 Christian Widell &lt;christian widell gmail com&gt;
@@ -765,7 +765,6 @@ Ulisse &lt;ulisail yahoo it&gt;</property>
     <property name="type_hint">dialog</property>
     <property name="skip_pager_hint">True</property>
     <property name="urgency_hint">True</property>
-    <property name="has_separator">False</property>
     <child internal-child="vbox">
       <object class="GtkVBox" id="dialog-vbox2">
         <property name="visible">True</property>
diff --git a/wiican/ui/managerdlg.py b/wiican/ui/managerdlg.py
index f416022..1808d0d 100644
--- a/wiican/ui/managerdlg.py
+++ b/wiican/ui/managerdlg.py
@@ -42,7 +42,9 @@ class MappingManagerDialog(object):
     def __init__(self):
         builder = gtk.Builder()
         if not builder.add_objects_from_file(MAPPING_UI, 
-                ['mapping_manager_dlg', 'image3', 'image4', 'mapping_store']):
+                ['mapping_manager_dlg', 'image3', 'image4', 'mapping_store',
+                    'new_action', 'edit_action', 'delete_action', 
+                    'import_action', 'export_action']):
             raise 'Cant load %s' % MAPPING_UI
         builder.connect_signals(self)
 
@@ -81,7 +83,7 @@ class MappingManagerDialog(object):
         pref_store.saveconf()
         return self.mapping_dlg.destroy()
 
-    def new_btn_clicked_cb(self, widget):
+    def new_action_activate_cb(self, widget):
         mapping_editor_dlg = MappingEditorDialog(Mapping())
         mapping_editor_dlg.set_title(_('Editing new mapping'))
 
@@ -92,13 +94,14 @@ class MappingManagerDialog(object):
             icon = gtk.gdk.pixbuf_new_from_file_at_size(mapping.get_icon(), 24, 
                 24)
 
-            mapping_name = '<b>%s</b>\n<i>%s</i>' % (mapping.get_name(), mapping.get_comment())
+            mapping_name = '<b>%s</b>\n<i>%s</i>' % (mapping.get_name(), 
+                    mapping.get_comment())
             self.mapping_store.append([icon, mapping_name,
                 mapping.get_comment(), True, mapping_id])
 
         mapping_editor_dlg.destroy()
 
-    def edit_btn_clicked_cb(self, widget):
+    def edit_action_activate_cb(self, widget):
         selection = self.mapping_list.get_selection()
         model, selected = selection.get_selected()
         
@@ -115,21 +118,25 @@ class MappingManagerDialog(object):
                 if system_mapping:
                     icon = gtk.gdk.pixbuf_new_from_file_at_size(new_mapping.get_icon(), 
                         24, 24)
-                    self.mapping_store.append([icon, new_mapping.get_name(), 
-                        new_mapping.get_comment(), True, new_mapping_id])
+
+                    mapping_name = '<b>%s</b>\n<i>%s</i>' % (mapping.get_name(), 
+                            mapping.get_comment())
+                    self.mapping_store.append([icon, mapping_name,
+                        mapping.get_comment(), True, mapping_id])
                 else:
                     mapping_manager[mapping_id] = new_mapping
                     model[selected][ICON_COL] = gtk.gdk.pixbuf_new_from_file_at_size(new_mapping.get_icon(), 
                         24, 24)
-                    model[selected][NAME_COL] = new_mapping.get_name()
+                    model[selected][NAME_COL] = '<b>%s</b>\n<i>%s</i>' % (new_mapping.get_name(), 
+                            new_mapping.get_comment())
                     model[selected][COMMENT_COL] = new_mapping.get_comment()
 
             mapping_editor_dlg.destroy()
 
     def mapping_list_row_activated_cb(self, widget, path, view_column):
-        self.edit_btn_clicked_cb(widget)
+        self.edit_action_activate_cb(widget)
 
-    def delete_btn_clicked_cb(self, widget):
+    def delete_action_activate_cb(self, widget):
         selection = self.mapping_list.get_selection()
         model, selected = selection.get_selected()
         if selected is not None:
@@ -166,9 +173,9 @@ class MappingManagerDialog(object):
 
     def mapping_list_key_release_event_cb(self, widget, event):
        if event.keyval == gtk.gdk.keyval_from_name("Delete"):
-            self.delete_btn_clicked_cb(None)
+            self.delete_action_activate_cb(None)
 
-    def import_btn_clicked_cb(self, widget):
+    def import_action_activate_cb(self, widget):
         import_dlg = gtk.FileChooserDialog(_('Import mapping...'), 
                 self.mapping_dlg, gtk.FILE_CHOOSER_ACTION_OPEN,
                 (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, 
@@ -202,14 +209,15 @@ class MappingManagerDialog(object):
         mapping = mapping_manager[mapping_id]
         icon = gtk.gdk.pixbuf_new_from_file_at_size(mapping.get_icon(), 24, 24)
 
-        mapping_name = '<b>%s</b>\n<i>%s</i>' % (mapping.get_name(), mapping.get_comment())
+        mapping_name = '<b>%s</b>\n<i>%s</i>' % (mapping.get_name(), 
+                mapping.get_comment())
         self.mapping_store.append([icon, mapping_name,
             mapping.get_comment(), True, mapping_id])
 
         pref_store.options['import_dir'] = import_dlg.get_current_folder()
         import_dlg.destroy()
         
-    def export_btn_clicked_cb(self, widget):
+    def export_action_activate_cb(self, widget):
         selection = self.mapping_list.get_selection()
         model, selected = selection.get_selected()
         if selected is not None:



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