[pybliographer/gtk3: 7/25] sort: Port dialog to gtk+3



commit 7a561216fd62513748aa02b41b5e2b63b978ac6a
Author: Germán Poo-Caamaño <gpoo gnome org>
Date:   Thu May 30 00:00:13 2013 -0700

    sort: Port dialog to gtk+3
    
    Signed-off-by: Germán Poo-Caamaño <gpoo gnome org>

 Pyblio/GnomeUI/Sort.py           |   32 +++---
 Pyblio/GnomeUI/glade/Makefile.am |    2 +-
 Pyblio/GnomeUI/glade/sort.glade  |  217 --------------------------------------
 Pyblio/GnomeUI/glade/sort.ui     |  186 ++++++++++++++++++++++++++++++++
 4 files changed, 202 insertions(+), 235 deletions(-)
---
diff --git a/Pyblio/GnomeUI/Sort.py b/Pyblio/GnomeUI/Sort.py
index a565aa1..a83e7dd 100644
--- a/Pyblio/GnomeUI/Sort.py
+++ b/Pyblio/GnomeUI/Sort.py
@@ -1,7 +1,8 @@
+# -*- coding: utf-8 -*-
 # This file is part of pybliographer
 # 
-# Copyright (C) 1998-2004 Frederic GOBRY
-# Email : gobry pybliographer org
+# Copyright (C) 1998-2004 Frederic GOBRY <gobry pybliographer org>
+# Copyright (C) 2013 Germán Poo-Caamaño <gpoo gnome org>
 #         
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -23,8 +24,7 @@
 
 import os, string
 
-from gi.repository import Gtk, GObject
-# from gnome import ui
+from gi.repository import Gtk, GObject, GdkPixbuf
 
 from Pyblio import Connector, Sort, Config, version
 from Pyblio.GnomeUI import Utils
@@ -36,19 +36,17 @@ del cPickle
 
 
 class SortDialog (Connector.Publisher, Utils.GladeWindow):
-
     """ Provide a configuration dialog for sorting the main index.
     Emit a 'sort-data' signal when the user chooses new sort options.
     """
 
    # This dialog is described as a glade XML file
-    gladeinfo = { 'file': 'sort.glade',
+    gladeinfo = { 'file': 'sort.ui',
                   'root': '_w_sort',
                   'name': 'sort'
                   }
     
-    def __init__ (self, sort, parent = None):
-
+    def __init__(self, sort, parent=None):
         """ Create the dialog.
 
           - current_sort: the current sorting options
@@ -57,28 +55,28 @@ class SortDialog (Connector.Publisher, Utils.GladeWindow):
         
         Utils.GladeWindow.__init__ (self, parent)
 
-        self._model = Gtk.ListStore (GdkPixbuf.Pixbuf, str, GObject.TYPE_PYOBJECT, int)
-        self._w_tree.set_model (self._model)
+        self._model = Gtk.ListStore(GdkPixbuf.Pixbuf, str, GObject.TYPE_PYOBJECT, int)
+        self._w_tree.set_model(self._model)
 
 
         # Only the first two rows are visibles, the others are for
         # internal bookkeeping.
         
-        col = Gtk.TreeViewColumn ('Direction', Gtk.CellRendererPixbuf (), pixbuf = 0)
+        col = Gtk.TreeViewColumn('Direction', Gtk.CellRendererPixbuf(), pixbuf=0)
         self._w_tree.append_column (col)
 
-        col = Gtk.TreeViewColumn ('Field', Gtk.CellRendererText (), text = 1)
-        self._w_tree.append_column (col)
+        col = Gtk.TreeViewColumn('Field', Gtk.CellRendererText(), text=1)
+        self._w_tree.append_column(col)
 
-        self._w_sort.show ()
+        self._w_sort.show()
 
         self._icon = {0: None}
 
         for id, stock in ((1, Gtk.STOCK_GO_UP), (-1, Gtk.STOCK_GO_DOWN)):
                           
-            self._icon [id] = self._w_tree.render_icon (stock_id = stock,
-                                                        size = Gtk.IconSize.MENU,
-                                                        detail = None)
+            self._icon [id] = self._w_tree.render_icon(stock_id = stock,
+                                                       size = Gtk.IconSize.MENU,
+                                                       detail = None)
         
 
         # Gather the current sort info for all the available
diff --git a/Pyblio/GnomeUI/glade/Makefile.am b/Pyblio/GnomeUI/glade/Makefile.am
index f5c70ef..7591820 100644
--- a/Pyblio/GnomeUI/glade/Makefile.am
+++ b/Pyblio/GnomeUI/glade/Makefile.am
@@ -5,7 +5,7 @@ glade_DATA =                                    \
        fields1.glade                           \
        pyblio.ui                               \
        search.glade                            \
-       sort.glade                              \
+       sort.ui                                 \
        format.ui                               \
        medline.glade                           \
        config1.glade                           \
diff --git a/Pyblio/GnomeUI/glade/sort.ui b/Pyblio/GnomeUI/glade/sort.ui
new file mode 100644
index 0000000..5190cf4
--- /dev/null
+++ b/Pyblio/GnomeUI/glade/sort.ui
@@ -0,0 +1,186 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkDialog" id="_w_sort">
+    <property name="can_focus">False</property>
+    <property name="title" translatable="yes">Select sort criterions</property>
+    <property name="default_width">200</property>
+    <property name="default_height">200</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="cancelbutton1">
+                <property name="label">gtk-cancel</property>
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+                <signal name="clicked" handler="on_cancel" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="okbutton1">
+                <property name="label">gtk-ok</property>
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+                <signal name="clicked" handler="on_accept" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkScrolledWindow" id="scrolledwindow1">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <child>
+              <object class="GtkViewport" id="viewport1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <child>
+                  <object class="GtkVBox" id="vbox1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <child>
+                      <object class="GtkScrolledWindow" id="scrolledwindow2">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <child>
+                          <object class="GtkTreeView" id="_w_tree">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="headers_visible">False</property>
+                            <property name="reorderable">True</property>
+                            <signal name="row-activated" handler="on_activate" swapped="no"/>
+                            <child internal-child="selection">
+                              <object class="GtkTreeSelection" id="treeview-selection1"/>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkHButtonBox" id="hbuttonbox2">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="border_width">5</property>
+                        <property name="layout_style">end</property>
+                        <child>
+                          <object class="GtkButton" id="button1">
+                            <property name="use_action_appearance">False</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="can_default">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_action_appearance">False</property>
+                            <signal name="clicked" handler="_on_set_as_default" swapped="no"/>
+                            <child>
+                              <object class="GtkAlignment" id="alignment1">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xscale">0</property>
+                                <property name="yscale">0</property>
+                                <child>
+                                  <object class="GtkHBox" id="hbox2">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="spacing">2</property>
+                                    <child>
+                                      <object class="GtkImage" id="image1">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="stock">gtk-save</property>
+                                      </object>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="fill">False</property>
+                                        <property name="position">0</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkLabel" id="label1">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="label" translatable="yes">Set as default</property>
+                                        <property name="use_underline">True</property>
+                                      </object>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="fill">False</property>
+                                        <property name="position">1</property>
+                                      </packing>
+                                    </child>
+                                  </object>
+                                </child>
+                              </object>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">cancelbutton1</action-widget>
+      <action-widget response="-5">okbutton1</action-widget>
+    </action-widgets>
+  </object>
+</interface>


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